static void list_ready_cb (GList *files, GError *error, gpointer user_data) { DialogData *data = user_data; data->loading_list = FALSE; if (data->cancelling) { gth_file_list_cancel (GTH_FILE_LIST (data->file_list), cancel_done, data); } else if (error != NULL) { _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->dialog), _("Could not load the folder"), error); } else { _g_object_unref (data->last_source); data->last_source = g_file_dup (data->source); data->files = _g_object_list_ref (files); gth_file_list_set_files (GTH_FILE_LIST (data->file_list), data->files); } update_sensitivity (data); }
static void export_dialog_response_cb (GtkDialog *dialog, int response_id, gpointer user_data) { DialogData *data = user_data; switch (response_id) { case GTK_RESPONSE_HELP: show_help_dialog (GTK_WINDOW (data->browser), "export-to-picasaweb"); break; case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_CANCEL: picasa_web_accounts_save_to_file (data->accounts, data->email); gth_file_list_cancel (GTH_FILE_LIST (data->list_view), (DataFunc) destroy_dialog, data); break; case GTK_RESPONSE_OK: { GtkTreeModel *tree_model; GtkTreeIter iter; GList *file_list; if (! gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (GET_WIDGET ("albums_treeview"))), &tree_model, &iter)) { gtk_widget_set_sensitive (GET_WIDGET ("upload_button"), FALSE); return; } _g_clear_object (&data->album); gtk_tree_model_get (tree_model, &iter, ALBUM_DATA_COLUMN, &data->album, -1); gtk_widget_hide (data->dialog); gth_task_dialog (GTH_TASK (data->conn), FALSE); file_list = gth_file_data_list_to_file_list (data->file_list); picasa_web_service_post_photos (data->picasaweb, data->album, file_list, data->cancellable, post_photos_ready_cb, data); _g_object_list_unref (file_list); } break; default: break; } }
static void cancel (DialogData *data, DataFunc done_func) { if (data->cancelling) return; data->done_func = done_func; data->cancelling = TRUE; if (data->loading_list) g_cancellable_cancel (data->cancellable); else gth_file_list_cancel (GTH_FILE_LIST (data->file_list), cancel_done, data); }
static void export_dialog_response_cb (GtkDialog *dialog, int response_id, gpointer user_data) { DialogData *data = user_data; switch (response_id) { case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_CANCEL: gth_file_list_cancel (GTH_FILE_LIST (data->list_view), (DataFunc) destroy_dialog, data); break; case GTK_RESPONSE_OK: { GtkTreeModel *tree_model; GtkTreeIter iter; GList *file_list; int max_width; int max_height; if (! gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (GET_WIDGET ("albums_treeview"))), &tree_model, &iter)) { gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, FALSE); return; } _g_clear_object (&data->album); gtk_tree_model_get (tree_model, &iter, ALBUM_DATA_COLUMN, &data->album, -1); gtk_widget_hide (data->dialog); gth_task_dialog (GTH_TASK (data->service), FALSE, NULL); file_list = gth_file_data_list_to_file_list (data->file_list); max_width = -1; max_height = -1; if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("resize_checkbutton")))) { int idx = gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("resize_combobox"))); max_width = ImageSizeValues[idx].width; max_height = ImageSizeValues[idx].height; } g_settings_set_int (data->settings, PREF_PICASAWEB_RESIZE_WIDTH, max_width); g_settings_set_int (data->settings, PREF_PICASAWEB_RESIZE_HEIGHT, max_height); picasa_web_service_post_photos (data->service, data->album, file_list, max_width, max_height, data->cancellable, post_photos_ready_cb, data); _g_object_list_unref (file_list); } break; default: break; } }
static void import_dialog_response_cb (GtkDialog *dialog, int response_id, gpointer user_data) { DialogData *data = user_data; switch (response_id) { case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_CANCEL: gth_file_list_cancel (GTH_FILE_LIST (data->file_list), (DataFunc) gtk_widget_destroy, data->dialog); break; case GTK_RESPONSE_OK: { GtkTreeIter iter; FlickrPhotoset *photoset; GList *file_list; if (! gtk_combo_box_get_active_iter (GTK_COMBO_BOX (GET_WIDGET ("photoset_combobox")), &iter)) { gtk_widget_set_sensitive (GET_WIDGET ("download_button"), FALSE); return; } gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("photoset_liststore")), &iter, PHOTOSET_DATA_COLUMN, &photoset, -1); file_list = get_files_to_download (data); if (file_list != NULL) { GSettings *settings; GFile *destination; gboolean single_subfolder; GthSubfolderType subfolder_type; GthSubfolderFormat subfolder_format; char *custom_format; GthTask *task; settings = g_settings_new (GTHUMB_IMPORTER_SCHEMA); destination = gth_import_preferences_get_destination (); subfolder_type = g_settings_get_enum (settings, PREF_IMPORTER_SUBFOLDER_TYPE); subfolder_format = g_settings_get_enum (settings, PREF_IMPORTER_SUBFOLDER_FORMAT); single_subfolder = g_settings_get_boolean (settings, PREF_IMPORTER_SUBFOLDER_SINGLE); custom_format = g_settings_get_string (settings, PREF_IMPORTER_SUBFOLDER_CUSTOM_FORMAT); task = gth_import_task_new (data->browser, file_list, destination, subfolder_type, subfolder_format, single_subfolder, custom_format, (photoset->title != NULL ? photoset->title : ""), NULL, FALSE, FALSE, FALSE); gth_browser_exec_task (data->browser, task, FALSE); gtk_widget_destroy (data->dialog); g_object_unref (task); _g_object_unref (destination); g_object_unref (settings); } _g_object_list_unref (file_list); g_object_unref (photoset); } break; default: break; } }
static void export_dialog_response_cb (GtkDialog *dialog, int response_id, gpointer user_data) { DialogData *data = user_data; switch (response_id) { case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_CANCEL: gth_file_list_cancel (GTH_FILE_LIST (data->list_view), (DataFunc) destroy_dialog, data); break; case GTK_RESPONSE_OK: { const char *photoset_title; GList *file_list; int max_width; int max_height; gtk_widget_hide (data->dialog); gth_task_dialog (GTH_TASK (data->service), FALSE, NULL); data->photoset = NULL; photoset_title = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (data->photoset_combobox)))); if ((photoset_title != NULL) && (g_strcmp0 (photoset_title, "") != 0)) { GList *link; link = g_list_find_custom (data->photosets, photoset_title, (GCompareFunc) find_photoset_by_title); if (link != NULL) data->photoset = g_object_ref (link->data); if (data->photoset == NULL) { data->photoset = flickr_photoset_new (); flickr_photoset_set_title (data->photoset, photoset_title); } } file_list = gth_file_data_list_to_file_list (data->file_list); max_width = -1; max_height = -1; if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("resize_checkbutton")))) { int idx = gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("resize_combobox"))); max_width = ImageSizeValues[idx].width; max_height = ImageSizeValues[idx].height; } g_settings_set_int (data->settings, PREF_FLICKR_RESIZE_WIDTH, max_width); g_settings_set_int (data->settings, PREF_FLICKR_RESIZE_HEIGHT, max_height); flickr_service_post_photos (data->service, gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("privacy_combobox"))), gtk_combo_box_get_active (GTK_COMBO_BOX (GET_WIDGET ("safety_combobox"))), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("hidden_checkbutton"))), max_width, max_height, file_list, data->cancellable, post_photos_ready_cb, data); _g_object_list_unref (file_list); } break; default: break; } }
static void import_dialog_response_cb (GtkDialog *dialog, int response_id, gpointer user_data) { DialogData *data = user_data; switch (response_id) { case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_CANCEL: gth_file_list_cancel (GTH_FILE_LIST (data->file_list), (DataFunc) gtk_widget_destroy, data->dialog); break; case GTK_RESPONSE_OK: { GtkTreeIter iter; PicasaWebAlbum *album; GList *file_list; if (! gtk_combo_box_get_active_iter (GTK_COMBO_BOX (GET_WIDGET ("album_combobox")), &iter)) { gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, FALSE); return; } gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("album_liststore")), &iter, ALBUM_DATA_COLUMN, &album, -1); file_list = get_files_to_download (data); if (file_list != NULL) { GFile *destination; GError *error = NULL; GSettings *settings; gboolean single_subfolder; GthSubfolderType subfolder_type; GthSubfolderFormat subfolder_format; char *custom_format; char **tags; int i; GthTask *task; destination = gth_import_preferences_get_destination (); if (! gth_import_task_check_free_space (destination, file_list, &error)) { _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->dialog), _("Could not import the files"), error); g_clear_error (&error); _g_object_unref (destination); _g_object_list_unref (file_list); g_object_unref (album); return; } settings = g_settings_new (GTHUMB_IMPORTER_SCHEMA); subfolder_type = g_settings_get_enum (settings, PREF_IMPORTER_SUBFOLDER_TYPE); subfolder_format = g_settings_get_enum (settings, PREF_IMPORTER_SUBFOLDER_FORMAT); single_subfolder = g_settings_get_boolean (settings, PREF_IMPORTER_SUBFOLDER_SINGLE); custom_format = g_settings_get_string (settings, PREF_IMPORTER_SUBFOLDER_CUSTOM_FORMAT); tags = g_strsplit ((album->keywords != NULL ? album->keywords : ""), ",", -1); for (i = 0; tags[i] != NULL; i++) tags[i] = g_strstrip (tags[i]); task = gth_import_task_new (data->browser, file_list, destination, subfolder_type, subfolder_format, single_subfolder, custom_format, (album->title != NULL ? album->title : ""), tags, FALSE, FALSE, FALSE); gth_browser_exec_task (data->browser, task, GTH_TASK_FLAGS_DEFAULT); gtk_widget_destroy (data->dialog); g_object_unref (task); g_strfreev (tags); g_object_unref (settings); _g_object_unref (destination); } _g_object_list_unref (file_list); g_object_unref (album); } break; default: break; } }