static void save_callback (TransferResult result, char *error_message, gpointer data) { ScreenshotDialog *dialog = data; GtkWidget *toplevel; toplevel = screenshot_dialog_get_toplevel (dialog); screenshot_dialog_set_busy (dialog, FALSE); if (result == TRANSFER_OK) { save_folder_to_gconf (dialog); set_recent_entry (dialog); gtk_widget_destroy (toplevel); /* we're done, stop the mainloop now */ gtk_main_quit (); } else if (result == TRANSFER_OVERWRITE || result == TRANSFER_CANCELLED) { /* user has canceled the overwrite dialog or the transfer itself, let him * choose another name. */ screenshot_dialog_focus_entry (dialog); } else /* result == TRANSFER_ERROR */ { /* we had an error, display a dialog to the user and let him choose * another name/location to save the screenshot. */ GtkWidget *error_dialog; char *uri; uri = screenshot_dialog_get_uri (dialog); error_dialog = gtk_message_dialog_new (GTK_WINDOW (toplevel), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Error while saving screenshot"), NULL); /* translators: first %s is the file path, second %s is the VFS error */ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (error_dialog), _("Impossible to save the screenshot " "to %s.\n Error was %s.\n Please choose another " "location and retry."), uri, error_message); gtk_widget_show (error_dialog); g_signal_connect (error_dialog, "response", G_CALLBACK (error_dialog_response_cb), dialog); g_free (uri); } }
static void save_file_completed (ScreenshotDialog *dialog) { GtkWidget *toplevel; toplevel = screenshot_dialog_get_toplevel (dialog); save_folder_to_settings (dialog); set_recent_entry (dialog); gtk_widget_destroy (toplevel); /* we're done, stop the mainloop now */ gtk_main_quit (); }
static void save_pixbuf_handle_success (ScreenshotApplication *self) { set_recent_entry (self); if (screenshot_config->interactive) { ScreenshotDialog *dialog = self->priv->dialog; save_folder_to_settings (self); gtk_widget_destroy (dialog->dialog); } else { g_application_release (G_APPLICATION (self)); } }