static void gimp_file_dialog_response (GtkDialog *dialog, gint response_id) { GimpFileDialog *file_dialog = GIMP_FILE_DIALOG (dialog); if (response_id != GTK_RESPONSE_OK && file_dialog->busy) { file_dialog->canceled = TRUE; if (GIMP_PROGRESS_BOX (file_dialog->progress)->active && GIMP_PROGRESS_BOX (file_dialog->progress)->cancelable) { gimp_progress_cancel (GIMP_PROGRESS (dialog)); } } }
static void gimp_progress_dialog_response (GtkDialog *dialog, gint response_id) { GimpProgressDialog *progress_dialog = GIMP_PROGRESS_DIALOG (dialog); if (GIMP_PROGRESS_BOX (progress_dialog->box)->cancelable) gimp_progress_cancel (GIMP_PROGRESS (dialog)); }
static void gimp_progress_dialog_progress_end (GimpProgress *progress) { GimpProgressDialog *dialog = GIMP_PROGRESS_DIALOG (progress); if (! dialog->box) return; if (GIMP_PROGRESS_BOX (dialog->box)->active) { gimp_progress_end (GIMP_PROGRESS (dialog->box)); gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL, FALSE); gtk_widget_hide (GTK_WIDGET (dialog)); } }
static void file_open_location_response (GtkDialog *dialog, gint response_id, Gimp *gimp) { GtkWidget *entry; GtkWidget *box; const gchar *text = NULL; if (response_id != GTK_RESPONSE_OK) { box = g_object_get_data (G_OBJECT (dialog), "progress-box"); if (box && GIMP_PROGRESS_BOX (box)->active) gimp_progress_cancel (GIMP_PROGRESS (box)); else gtk_widget_destroy (GTK_WIDGET (dialog)); return; } entry = g_object_get_data (G_OBJECT (dialog), "location-entry"); gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE); gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, FALSE); text = gtk_entry_get_text (GTK_ENTRY (entry)); if (text && strlen (text)) { GimpImage *image; gchar *filename; GFile *file; GimpPDBStatusType status; GError *error = NULL; filename = g_filename_from_uri (text, NULL, NULL); if (filename) { file = g_file_new_for_uri (text); g_free (filename); } else { file = file_utils_filename_to_file (gimp, text, &error); } box = gimp_progress_box_new (); gtk_container_set_border_width (GTK_CONTAINER (box), 12); gtk_box_pack_end (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), box, FALSE, FALSE, 0); g_object_set_data (G_OBJECT (dialog), "progress-box", box); if (file) { GFile *entered_file = g_file_new_for_uri (text); gtk_widget_show (box); image = file_open_with_proc_and_display (gimp, gimp_get_user_context (gimp), GIMP_PROGRESS (box), file, entered_file, FALSE, NULL, G_OBJECT (gtk_widget_get_screen (entry)), gimp_widget_get_monitor (entry), &status, &error); g_object_unref (entered_file); if (image == NULL && status != GIMP_PDB_CANCEL) { gimp_message (gimp, G_OBJECT (box), GIMP_MESSAGE_ERROR, _("Opening '%s' failed:\n\n%s"), gimp_file_get_utf8_name (file), error->message); g_clear_error (&error); } g_object_unref (file); } else { gimp_message (gimp, G_OBJECT (box), GIMP_MESSAGE_ERROR, _("Opening '%s' failed:\n\n%s"), text, error->message); g_clear_error (&error); gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, TRUE); gtk_editable_set_editable (GTK_EDITABLE (entry), TRUE); return; } } gtk_widget_destroy (GTK_WIDGET (dialog)); }