static void auto_select_account (DialogData *data) { gtk_widget_hide (data->dialog); if (data->conn != NULL) gth_task_dialog (GTH_TASK (data->conn), FALSE); if (data->accounts != NULL) { if (data->email != NULL) { connect_to_server (data); } else if (data->accounts->next == NULL) { data->email = g_strdup ((char *)data->accounts->data); connect_to_server (data); } else { GtkWidget *dialog; gth_task_dialog (GTH_TASK (data->conn), TRUE); dialog = picasa_account_chooser_dialog_new (data->accounts, data->email); g_signal_connect (dialog, "response", G_CALLBACK (account_chooser_dialog_response_cb), data); gtk_window_set_title (GTK_WINDOW (dialog), _("Choose Account")); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (data->browser)); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_window_present (GTK_WINDOW (dialog)); } } else account_properties_dialog (data, NULL); }
static void list_albums_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { DialogData *data = user_data; PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object); GError *error = NULL; _g_object_list_unref (data->albums); data->albums = picasa_web_service_list_albums_finish (picasaweb, result, &error); if (error != NULL) { gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the album list"), error); g_clear_error (&error); gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT); return; } update_album_list (data); gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (data->browser)); gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE); gtk_window_present (GTK_WINDOW (data->dialog)); }
static void ask_authorization_dialog_loaded_cb (OAuthAskAuthorizationDialog *dialog, gpointer user_data) { PicasaWebService *self = user_data; const char *title; title = oauth_ask_authorization_dialog_get_title (dialog); if (title == NULL) return; if (g_str_has_prefix (title, PICASA_WEB_REDIRECT_TITLE)) { const char *authorization_code; gtk_widget_hide (GTK_WIDGET (dialog)); gth_task_dialog (GTH_TASK (self), FALSE, NULL); authorization_code = title + strlen (PICASA_WEB_REDIRECT_TITLE); _picasa_web_service_get_refresh_token (self, authorization_code, gth_task_get_cancellable (GTH_TASK (self)), refresh_token_ready_cb, self); } }
static void show_authentication_error_dialog (WebService *self, GError **error) { GtkWidget *dialog; if (g_error_matches (*error, WEB_SERVICE_ERROR, WEB_SERVICE_ERROR_TOKEN_EXPIRED)) { web_service_ask_authorization (self); return; } dialog = _gtk_message_dialog_new (GTK_WINDOW (self->priv->browser), GTK_DIALOG_MODAL, GTK_STOCK_DIALOG_ERROR, _("Could not connect to the server"), (*error)->message, _("Choose _Account..."), WEB_AUTHENTICATION_RESPONSE_CHOOSE_ACCOUNT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); gth_task_dialog (GTH_TASK (self), TRUE, dialog); g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_true), NULL); g_signal_connect (dialog, "response", G_CALLBACK (authentication_error_dialog_response_cb), self); gtk_widget_show (dialog); g_clear_error (error); }
static void album_combobox_changed_cb (GtkComboBox *widget, gpointer user_data) { DialogData *data = user_data; GtkTreeIter iter; if (! gtk_combo_box_get_active_iter (widget, &iter)) { gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("No album selected")); return; } _g_object_unref (data->album); gtk_tree_model_get (gtk_combo_box_get_model (widget), &iter, ALBUM_DATA_COLUMN, &data->album, -1); gth_import_preferences_dialog_set_event (GTH_IMPORT_PREFERENCES_DIALOG (data->preferences_dialog), data->album->title); gth_task_dialog (GTH_TASK (data->service), FALSE, NULL); picasa_web_service_list_photos (data->service, data->album, data->cancellable, list_photos_ready_cb, data); }
static void ask_authorization_dialog_response_cb (GtkDialog *dialog, int response_id, gpointer user_data) { WebService *self = user_data; switch (response_id) { case GTK_RESPONSE_DELETE_EVENT: case GTK_RESPONSE_CANCEL: gtk_widget_destroy (GTK_WIDGET (dialog)); gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT); break; case GTK_RESPONSE_OK: gtk_widget_destroy (GTK_WIDGET (dialog)); gth_task_dialog (GTH_TASK (self), FALSE, NULL); web_service_get_user_info (self, self->priv->cancellable, get_user_info_ready_cb, self); break; default: break; } }
static void pixbuf_task_dialog_cb (GthTask *task, gboolean opened, gpointer user_data) { gth_task_dialog (GTH_TASK (user_data), opened); }
static void export_completed_with_success (DialogData *data) { GtkWidget *dialog; gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); dialog = _gtk_message_dialog_new (GTK_WINDOW (data->browser), GTK_DIALOG_MODAL, NULL, _("Files successfully uploaded to the server."), NULL, _GTK_LABEL_CLOSE, GTK_RESPONSE_CLOSE, _("_Open in the Browser"), _OPEN_IN_BROWSER_RESPONSE, NULL); g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_true), NULL); g_signal_connect (dialog, "response", G_CALLBACK (completed_messagedialog_response_cb), data); gtk_window_present (GTK_WINDOW (dialog)); }
static void photoset_combobox_changed_cb (GtkComboBox *widget, gpointer user_data) { DialogData *data = user_data; GtkTreeIter iter; if (! gtk_combo_box_get_active_iter (widget, &iter)) { gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("No album selected")); return; } _g_object_unref (data->photoset); gtk_tree_model_get (gtk_combo_box_get_model (widget), &iter, PHOTOSET_DATA_COLUMN, &data->photoset, -1); gth_import_preferences_dialog_set_event (GTH_IMPORT_PREFERENCES_DIALOG (data->preferences_dialog), data->photoset->title); gth_task_dialog (GTH_TASK (data->service), FALSE, NULL); flickr_service_list_photos (data->service, data->photoset, "original_format, url_sq, url_t, url_s, url_m, url_z, url_b, url_o", data->cancellable, list_photos_ready_cb, data); }
static void photoset_list_ready_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { DialogData *data = user_data; GError *error = NULL; GList *scan; _g_object_list_unref (data->photosets); data->photosets = flickr_service_list_photosets_finish (FLICKR_SERVICE (source_object), res, &error); if (error != NULL) { if (data->service != NULL) gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), error); g_clear_error (&error); gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT); return; } gtk_list_store_clear (GTK_LIST_STORE (GET_WIDGET ("photoset_liststore"))); for (scan = data->photosets; scan; scan = scan->next) { FlickrPhotoset *photoset = scan->data; char *n_photos; GtkTreeIter iter; n_photos = g_strdup_printf ("(%d)", photoset->n_photos); gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("photoset_liststore")), &iter); gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("photoset_liststore")), &iter, PHOTOSET_DATA_COLUMN, photoset, PHOTOSET_ICON_COLUMN, "file-catalog-symbolic", PHOTOSET_TITLE_COLUMN, photoset->title, PHOTOSET_N_PHOTOS_COLUMN, n_photos, -1); g_free (n_photos); } gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, TRUE); gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (data->browser)); gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE); gtk_window_present (GTK_WINDOW (data->dialog)); }
static void get_albums_ready_cb (GObject *source_object, GAsyncResult *res, gpointer user_data) { DialogData *data = user_data; GError *error = NULL; GList *scan; _g_object_list_unref (data->albums); data->albums = facebook_service_get_albums_finish (data->service, res, &error); if (error != NULL) { if (data->service != NULL) gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), error); g_clear_error (&error); gtk_widget_destroy (data->dialog); return; } gtk_list_store_clear (GTK_LIST_STORE (GET_WIDGET ("album_liststore"))); for (scan = data->albums; scan; scan = scan->next) { FacebookAlbum *album = scan->data; char *n_photos; GtkTreeIter iter; n_photos = g_strdup_printf ("(%d)", album->count); gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter); gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter, ALBUM_DATA_COLUMN, album, ALBUM_ICON_COLUMN, "file-catalog-symbolic", ALBUM_NAME_COLUMN, album->name, ALBUM_SIZE_COLUMN, n_photos, -1); g_free (n_photos); } gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (data->browser)); gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE); gtk_window_present (GTK_WINDOW (data->dialog)); }
static void connect_to_server_step2 (DialogData *data) { if (data->password == NULL) { gth_task_dialog (GTH_TASK (data->conn), TRUE); account_properties_dialog (data, data->email); } else { gth_task_dialog (GTH_TASK (data->conn), FALSE); google_connection_connect (data->conn, data->email, data->password, data->challange, data->cancellable, connection_ready_cb, data); } }
static void list_photos_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { DialogData *data = user_data; GError *error = NULL; GList *list; GList *scan; gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _g_object_list_unref (data->photos); data->photos = flickr_service_list_photos_finish (data->service, result, &error); if (error != NULL) { if (data->service != NULL) gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the photo list"), error); g_clear_error (&error); gtk_widget_destroy (data->dialog); return; } list = NULL; for (scan = data->photos; scan; scan = scan->next) { FlickrPhoto *photo = scan->data; GthFileData *file_data; if (photo->url[FLICKR_URL_O] == NULL) continue; file_data = gth_file_data_new_for_uri (photo->url[FLICKR_URL_O], (photo->mime_type != NULL) ? photo->mime_type : "image/jpeg"); g_file_info_set_file_type (file_data->info, G_FILE_TYPE_REGULAR); g_file_info_set_size (file_data->info, FAKE_SIZE); /* set a fake size to make the progress dialog work correctly */ g_file_info_set_attribute_object (file_data->info, "flickr::object", G_OBJECT (photo)); list = g_list_prepend (list, file_data); } gth_file_list_set_files (GTH_FILE_LIST (data->file_list), list); update_selection_status (data); gtk_widget_set_sensitive (GET_WIDGET ("download_button"), list != NULL); _g_object_list_unref (list); }
static void overwrite_dialog_response_cb (GtkDialog *dialog, gint response_id, gpointer user_data) { GthPixbufListTask *self = user_data; if (response_id != GTK_RESPONSE_OK) self->priv->overwrite_response = GTH_OVERWRITE_RESPONSE_UNSPECIFIED; else self->priv->overwrite_response = gth_overwrite_dialog_get_response (GTH_OVERWRITE_DIALOG (dialog)); gtk_widget_hide (GTK_WIDGET (dialog)); gth_task_dialog (GTH_TASK (self), FALSE); switch (self->priv->overwrite_response) { case GTH_OVERWRITE_RESPONSE_NO: case GTH_OVERWRITE_RESPONSE_ALWAYS_NO: case GTH_OVERWRITE_RESPONSE_UNSPECIFIED: if (self->priv->overwrite_response == GTH_OVERWRITE_RESPONSE_ALWAYS_NO) self->priv->overwrite_mode = GTH_OVERWRITE_SKIP; process_next_file (self); break; case GTH_OVERWRITE_RESPONSE_YES: case GTH_OVERWRITE_RESPONSE_ALWAYS_YES: if (self->priv->overwrite_response == GTH_OVERWRITE_RESPONSE_ALWAYS_YES) self->priv->overwrite_mode = GTH_OVERWRITE_OVERWRITE; pixbuf_task_save_current_pixbuf (self, NULL, TRUE); break; case GTH_OVERWRITE_RESPONSE_RENAME: { GFile *parent; GFile *new_destination; if (self->priv->destination_folder != NULL) { parent = g_object_ref (self->priv->destination_folder); } else { GthFileData *file_data; file_data = self->priv->current->data; parent = g_file_get_parent (file_data->file); } new_destination = g_file_get_child_for_display_name (parent, gth_overwrite_dialog_get_filename (GTH_OVERWRITE_DIALOG (dialog)), NULL); pixbuf_task_save_current_pixbuf (self, new_destination, FALSE); g_object_unref (new_destination); g_object_unref (parent); } break; } gtk_widget_destroy (GTK_WIDGET (dialog)); }
static void show_export_dialog (DialogData *data) { update_account_list (data); update_album_list (data); gth_task_dialog (GTH_TASK (data->conn), TRUE); gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (data->browser)); gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE); gtk_window_present (GTK_WINDOW (data->dialog)); }
static void post_photos_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { DialogData *data = user_data; PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object); GError *error = NULL; gth_task_dialog (GTH_TASK (data->conn), TRUE); if (! picasa_web_service_post_photos_finish (picasaweb, result, &error)) { if (data->conn != NULL) gth_task_dialog (GTH_TASK (data->conn), TRUE); _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not upload the files"), &error); return; } export_completed_with_success (data); }
static void list_photos_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { DialogData *data = user_data; GError *error = NULL; GList *list; GList *scan; gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _g_object_list_unref (data->photos); data->photos = facebook_service_list_photos_finish (data->service, result, &error); if (error != NULL) { if (data->service != NULL) gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the photo list"), error); g_clear_error (&error); gtk_widget_destroy (data->dialog); return; } list = NULL; for (scan = data->photos; scan; scan = scan->next) { FacebookPhoto *photo = scan->data; GthFileData *file_data; file_data = gth_file_data_new_for_uri (facebook_photo_get_original_url (photo), "image/jpeg"); g_file_info_set_file_type (file_data->info, G_FILE_TYPE_REGULAR); g_file_info_set_size (file_data->info, FAKE_SIZE); /* set a fake size to make the progress dialog work correctly */ g_file_info_set_attribute_object (file_data->info, "facebook::object", G_OBJECT (photo)); list = g_list_prepend (list, file_data); } gth_file_list_set_files (GTH_FILE_LIST (data->file_list), list); update_selection_status (data); gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, list != NULL); _g_object_list_unref (list); }
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 list_photos_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { DialogData *data = user_data; PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object); GError *error = NULL; GList *list; GList *scan; gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _g_object_list_unref (data->photos); data->photos = picasa_web_service_list_albums_finish (picasaweb, result, &error); if (error != NULL) { gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not get the photo list"), error); g_clear_error (&error); gtk_widget_destroy (data->dialog); return; } list = NULL; for (scan = data->photos; scan; scan = scan->next) { PicasaWebPhoto *photo = scan->data; GthFileData *file_data; file_data = gth_file_data_new_for_uri (photo->uri, photo->mime_type); g_file_info_set_file_type (file_data->info, G_FILE_TYPE_REGULAR); g_file_info_set_size (file_data->info, photo->size); g_file_info_set_attribute_object (file_data->info, "gphoto::object", G_OBJECT (photo)); list = g_list_prepend (list, file_data); } gth_file_list_set_files (GTH_FILE_LIST (data->file_list), list); update_selection_status (data); gtk_dialog_set_response_sensitive (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK, TRUE); _g_object_list_unref (list); }
static void pixbuf_saved_cb (GthFileData *file_data, GError *error, gpointer user_data) { GthPixbufListTask *self = user_data; GFile *parent; GList *file_list; if (error != NULL) { if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) { if (self->priv->overwrite_mode == GTH_OVERWRITE_SKIP) { process_next_file (self); } else { GthFileData *file_data; GtkWidget *dialog; gth_task_dialog (GTH_TASK (self), TRUE); file_data = self->priv->current->data; dialog = gth_overwrite_dialog_new (NULL, self->priv->new_pixbuf, file_data->file, GTH_OVERWRITE_RESPONSE_YES, (self->priv->n_files == 1)); g_signal_connect (dialog, "response", G_CALLBACK (overwrite_dialog_response_cb), self); gtk_widget_show (dialog); } } else gth_task_completed (GTH_TASK (self), error); return; } parent = g_file_get_parent (file_data->file); file_list = g_list_append (NULL, file_data->file); gth_monitor_folder_changed (gth_main_get_default_monitor (), parent, file_list, GTH_MONITOR_EVENT_CHANGED); g_list_free (file_list); g_object_unref (parent); process_next_file (self); }
static void completed_messagedialog_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_CLOSE: gtk_widget_destroy (GTK_WIDGET (dialog)); gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT); break; case _OPEN_IN_BROWSER_RESPONSE: { OAuthAccount *account; GdkScreen *screen; char *url = NULL; GError *error = NULL; account = web_service_get_current_account (WEB_SERVICE (data->service)); screen = gtk_widget_get_screen (GTK_WIDGET (dialog)); gtk_widget_destroy (GTK_WIDGET (dialog)); if (data->album != NULL) { if (data->album->alternate_url != NULL) url = g_strdup (data->album->alternate_url); else url = g_strconcat ("http://picasaweb.google.com/", account->id, "/", data->album->id, NULL); } else url = g_strconcat ("http://picasaweb.google.com/", account->id, NULL); if ((url != NULL) && ! gtk_show_uri (screen, url, 0, &error)) { gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), error); g_clear_error (&error); } gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT); g_free (url); } break; default: break; } }
static void connection_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { DialogData *data = user_data; GoogleConnection *conn = GOOGLE_CONNECTION (source_object); GError *error = NULL; if (! google_connection_connect_finish (conn, result, &error)) { if (g_error_matches (error, GOOGLE_CONNECTION_ERROR, GOOGLE_CONNECTION_ERROR_CAPTCHA_REQUIRED)) { challange_account_dialog (data); } else if (g_error_matches (error, GOOGLE_CONNECTION_ERROR, GOOGLE_CONNECTION_ERROR_BAD_AUTHENTICATION)) { account_properties_dialog (data, data->email); } else { if (data->conn != NULL) gth_task_dialog (GTH_TASK (data->conn), TRUE); _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error); gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT); } return; } if (! g_list_find_custom (data->accounts, data->email, (GCompareFunc) strcmp)) data->accounts = g_list_append (data->accounts, g_strdup (data->email)); #ifdef HAVE_GNOME_KEYRING if (gnome_keyring_is_available ()) { gnome_keyring_store_password (GNOME_KEYRING_NETWORK_PASSWORD, NULL, _("Picasa Web Album"), data->password, store_password_done_cb, data, NULL, "user", data->email, "server", "picasaweb.google.com", "protocol", "http", NULL); return; } #endif get_album_list (data); }
void web_service_autoconnect (WebService *self) { gtk_widget_hide (self->priv->dialog); gth_task_dialog (GTH_TASK (self), FALSE, NULL); if (self->priv->accounts != NULL) { if (self->priv->account != NULL) { connect_to_server (self); } else if (self->priv->accounts->next == NULL) { self->priv->account = g_object_ref (self->priv->accounts->data); connect_to_server (self); } else show_choose_account_dialog (self); } else web_service_ask_authorization (self); }
static void account_properties_dialog (DialogData *data, const char *email) { GtkWidget *dialog; if (data->conn != NULL) gth_task_dialog (GTH_TASK (data->conn), TRUE); dialog = picasa_account_properties_dialog_new (email, NULL, NULL); g_signal_connect (dialog, "response", G_CALLBACK (account_properties_dialog_response_cb), data); gtk_window_set_title (GTK_WINDOW (dialog), _("Account")); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (data->browser)); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_window_present (GTK_WINDOW (dialog)); }
static void export_completed_with_success (DialogData *data) { GtkBuilder *builder; GtkWidget *dialog; gth_task_dialog (GTH_TASK (data->conn), TRUE); builder = _gtk_builder_new_from_file ("picasa-web-export-completed.ui", "picasaweb"); dialog = _gtk_builder_get_widget (builder, "completed_messagedialog"); g_object_set_data_full (G_OBJECT (dialog), "builder", builder, g_object_unref); g_signal_connect (dialog, "response", G_CALLBACK (completed_messagedialog_response_cb), data); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (data->browser)); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_window_present (GTK_WINDOW (dialog)); }
static void show_choose_account_dialog (WebService *self) { GtkWidget *dialog; gth_task_dialog (GTH_TASK (self), TRUE, NULL); dialog = oauth_account_chooser_dialog_new (self->priv->accounts, self->priv->account); g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_true), NULL); g_signal_connect (dialog, "response", G_CALLBACK (account_chooser_dialog_response_cb), self); gtk_window_set_title (GTK_WINDOW (dialog), _("Choose Account")); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser)); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_window_present (GTK_WINDOW (dialog)); }
static void create_album_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { DialogData *data = user_data; PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object); PicasaWebAlbum *album; GError *error = NULL; album = picasa_web_service_create_album_finish (picasaweb, result, &error); if (error != NULL) { gth_task_dialog (GTH_TASK (data->service), TRUE, NULL); _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not create the album"), error); g_clear_error (&error); return; } data->albums = g_list_append (data->albums, album); update_album_list (data); }
static void gth_organize_task_exec (GthTask *base) { GthOrganizeTask *self; const char *attributes; self = GTH_ORGANIZE_TASK (base); self->priv->organized = FALSE; self->priv->n_catalogs = 0; self->priv->n_files = 0; gtk_list_store_clear (self->priv->results_liststore); switch (self->priv->group_policy) { case GTH_GROUP_POLICY_DIGITALIZED_DATE: attributes = "standard::name,standard::type,time::modified,time::modified-usec,Embedded::Photo::DateTimeOriginal"; break; case GTH_GROUP_POLICY_MODIFIED_DATE: default: attributes = "standard::name,standard::type,time::modified,time::modified-usec"; break; } g_directory_foreach_child (self->priv->folder, self->priv->recursive, TRUE, attributes, gth_task_get_cancellable (GTH_TASK (self)), start_dir_func, for_each_file_func, done_func, self); gtk_widget_show (GET_WIDGET ("cancel_button")); gtk_widget_hide (GET_WIDGET ("close_button")); gtk_widget_hide (GET_WIDGET ("ok_button")); gtk_window_set_transient_for (GTK_WINDOW (GET_WIDGET ("organize_files_dialog")), GTK_WINDOW (self->priv->browser)); gtk_window_set_modal (GTK_WINDOW (GET_WIDGET ("organize_files_dialog")), TRUE); gtk_widget_show (GET_WIDGET ("organize_files_dialog")); gth_task_dialog (base, TRUE); }
static void ask_authorization_dialog_load_request_cb (OAuthAskAuthorizationDialog *dialog, gpointer user_data) { OAuthService *self = user_data; const char *uri; uri = oauth_ask_authorization_dialog_get_uri (dialog); if (uri == NULL) return; if (g_str_has_prefix (uri, OAUTH_CALLBACK)) { const char *uri_data; GHashTable *data; gboolean success = FALSE; uri_data = uri + strlen (OAUTH_CALLBACK "?"); data = soup_form_decode (uri_data); _g_strset (&self->priv->token, g_hash_table_lookup (data, "oauth_token")); if (self->priv->token != NULL) { gtk_widget_hide (GTK_WIDGET (dialog)); gth_task_dialog (GTH_TASK (self), FALSE, NULL); success = TRUE; _oauth_service_get_access_token (self, g_hash_table_lookup (data, "oauth_verifier"), gth_task_get_cancellable (GTH_TASK (self)), get_access_token_ready_cb, self); } if (! success) gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL); g_hash_table_destroy (data); } }
void _web_service_set_auth_dialog (WebService *self, GtkDialog *dialog) { self->priv->auth_dialog = GTK_WIDGET (dialog); g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &self->priv->auth_dialog); gth_task_dialog (GTH_TASK (self), TRUE, self->priv->auth_dialog); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); if (gtk_widget_get_visible (self->priv->dialog)) gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->dialog)); else gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (self->priv->browser)); g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_true), NULL); g_signal_connect (dialog, "response", G_CALLBACK (ask_authorization_dialog_response_cb), self); }