Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[export]: Batch export with multiple presets #18047

Merged
merged 8 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/control/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,14 @@ gboolean dt_conf_key_exists(const char *key)
return (res || dt_confgen_value_exists(key, DT_DEFAULT));
}

/** remove key from conf */
void dt_conf_remove_key(const char *key)
{
dt_pthread_mutex_lock(&darktable.conf->mutex);
g_hash_table_remove(darktable.conf->table, key);
dt_pthread_mutex_unlock(&darktable.conf->mutex);
}

static void _conf_add(char *key, char *val, dt_conf_dreggn_t *d)
{
if(strncmp(key, d->match, strlen(d->match)) == 0)
Expand Down
1 change: 1 addition & 0 deletions src/control/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ void dt_conf_init(dt_conf_t *cf, const char *filename, GSList *override_entries)
void dt_conf_cleanup(dt_conf_t *cf);
void dt_conf_save(dt_conf_t *cf);
gboolean dt_conf_key_exists(const char *key);
void dt_conf_remove_key(const char *key);
gboolean dt_conf_key_not_empty(const char *key);
GSList *dt_conf_all_string_entries(const char *dir);
void dt_conf_string_entry_free(gpointer data);
Expand Down
2 changes: 2 additions & 0 deletions src/gui/presets.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ static void _edit_preset_response(GtkDialog *dialog,
sqlite3_finalize(stmt);

if(g->callback) ((void (*)(dt_gui_presets_edit_dialog_t *))g->callback)(g);
DT_CONTROL_SIGNAL_RAISE(DT_SIGNAL_PRESETS_CHANGED,
g_strdup(g->operation));
}
else if(response_id == GTK_RESPONSE_YES && g->old_id)
{
Expand Down
3 changes: 3 additions & 0 deletions src/imageio/storage/imageio_storage_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ OPTIONAL(char *, ask_user_confirmation, struct dt_imageio_module_storage_t *self
/* ask the storage if export is currently possible */
OPTIONAL(gboolean, export_enabled, struct dt_imageio_module_storage_t *self);

/* for storage modules which require a login */
OPTIONAL(gboolean, storage_login, struct dt_imageio_module_storage_t *self);

#ifdef FULL_API_H

#pragma GCC visibility pop
Expand Down
25 changes: 16 additions & 9 deletions src/imageio/storage/piwigo.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ static void _piwigo_conflict_changed(GtkWidget *widget,
}

/** Refresh albums */
static void _piwigo_refresh_albums(dt_storage_piwigo_gui_data_t *ui,
static gboolean _piwigo_refresh_albums(dt_storage_piwigo_gui_data_t *ui,
const gchar *select_album)
{
gtk_widget_set_sensitive(GTK_WIDGET(ui->album_list), FALSE);
Expand All @@ -699,7 +699,7 @@ static void _piwigo_refresh_albums(dt_storage_piwigo_gui_data_t *ui,
if(ui->api == NULL || ui->api->authenticated == FALSE)
{
_piwigo_authenticate(ui);
if(ui->api == NULL || !ui->api->authenticated) return;
if(ui->api == NULL || !ui->api->authenticated) return FALSE;
}

int index = 0;
Expand Down Expand Up @@ -781,6 +781,8 @@ static void _piwigo_refresh_albums(dt_storage_piwigo_gui_data_t *ui,
gtk_widget_set_sensitive(GTK_WIDGET(ui->parent_album_list), TRUE);
dt_bauhaus_combobox_set(ui->album_list, index);
dt_bauhaus_combobox_set(ui->parent_album_list, 0);

return TRUE;
}


Expand Down Expand Up @@ -966,20 +968,25 @@ static gboolean _piwigo_api_upload_photo(dt_storage_piwigo_params_t *p,
}

// Login button pressed...
static void _piwigo_login_clicked(GtkButton *button,
gpointer data)
static void _piwigo_login_clicked(GtkButton *button, dt_imageio_module_storage_t *self)
{
dt_storage_piwigo_gui_data_t *ui = (dt_storage_piwigo_gui_data_t *)data;
storage_login(self);
}

gboolean storage_login(dt_imageio_module_storage_t *self)
{
dt_storage_piwigo_gui_data_t *ui = self->gui_data;
_piwigo_ctx_destroy(&ui->api);

gchar *last_album = dt_conf_get_string("storage/piwigo/last_album");
_piwigo_refresh_albums(ui, last_album);
gboolean res = _piwigo_refresh_albums(ui, last_album);
g_free(last_album);

return res;
}

// Refresh button pressed...
static void _piwigo_refresh_clicked(GtkButton *button,
gpointer data)
static void _piwigo_refresh_clicked(GtkButton *button, gpointer data)
{
dt_storage_piwigo_gui_data_t *ui = (dt_storage_piwigo_gui_data_t *)data;

Expand Down Expand Up @@ -1087,7 +1094,7 @@ void gui_init(dt_imageio_module_storage_t *self)
button = gtk_button_new_with_label(_("login"));
gtk_widget_set_tooltip_text(button, _("Piwigo login"));
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(_piwigo_login_clicked), (gpointer)ui);
G_CALLBACK(_piwigo_login_clicked), self);
gtk_box_pack_start(GTK_BOX(self->widget), button, FALSE, FALSE, 0);

// status area
Expand Down
Loading
Loading