From ec749ac683867006ca5ccb20149bba8501a4a489 Mon Sep 17 00:00:00 2001 From: rbuj Date: Tue, 17 Mar 2020 12:34:02 +0100 Subject: image-converter: Add error-dialog.ui --- image-converter/Makefile.am | 1 + image-converter/caja-image-resizer.c | 33 ++--- image-converter/caja-image-rotator.c | 33 ++--- image-converter/error-dialog.ui | 147 +++++++++++++++++++++ ...te.caja.extensions.imageconverter.gresource.xml | 1 + 5 files changed, 185 insertions(+), 30 deletions(-) create mode 100644 image-converter/error-dialog.ui diff --git a/image-converter/Makefile.am b/image-converter/Makefile.am index 08e18a9..2c5d94c 100644 --- a/image-converter/Makefile.am +++ b/image-converter/Makefile.am @@ -52,6 +52,7 @@ $(extension_DATA): $(extension_in_files) EXTRA_DIST = \ caja-image-resize.ui \ caja-image-rotate.ui \ + error-dialog.ui \ org.mate.caja.extensions.imageconverter.gresource.xml \ $(NULL) diff --git a/image-converter/caja-image-resizer.c b/image-converter/caja-image-resizer.c index cf17cb2..84f834c 100644 --- a/image-converter/caja-image-resizer.c +++ b/image-converter/caja-image-resizer.c @@ -198,21 +198,24 @@ op_finished (GPid pid, gint status, gpointer data) if (status != 0) { /* resizing failed */ - char *name = caja_file_info_get_name (file); - - GtkWidget *msg_dialog = gtk_message_dialog_new (GTK_WINDOW (priv->progress_dialog), - GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, - GTK_BUTTONS_NONE, - "'%s' cannot be resized. Check whether you have permission to write to this folder.", - name); - g_free (name); - - gtk_dialog_add_button (GTK_DIALOG (msg_dialog), _("_Skip"), 1); - gtk_dialog_add_button (GTK_DIALOG (msg_dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - gtk_dialog_add_button (GTK_DIALOG (msg_dialog), _("_Retry"), 0); - gtk_dialog_set_default_response (GTK_DIALOG (msg_dialog), 0); - - int response_id = gtk_dialog_run (GTK_DIALOG (msg_dialog)); + GtkBuilder *builder; + GtkWidget *msg_dialog; + GObject *dialog_text; + int response_id; + char *msg; + char *name; + + name = caja_file_info_get_name (file); + + builder = gtk_builder_new_from_resource ("/org/mate/caja/extensions/imageconverter/error-dialog.ui"); + msg_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "error_dialog")); + dialog_text = gtk_builder_get_object (builder, "error_text"); + msg = g_strdup_printf ("'%s' cannot be resized. Check whether you have permission to write to this folder.", name); + gtk_label_set_text (GTK_LABEL (dialog_text), msg); + g_free (msg); + g_object_unref (builder); + + response_id = gtk_dialog_run (GTK_DIALOG (msg_dialog)); gtk_widget_destroy (msg_dialog); if (response_id == 0) { retry = TRUE; diff --git a/image-converter/caja-image-rotator.c b/image-converter/caja-image-rotator.c index fca0f8e..4d3db73 100644 --- a/image-converter/caja-image-rotator.c +++ b/image-converter/caja-image-rotator.c @@ -195,21 +195,24 @@ op_finished (GPid pid, gint status, gpointer data) if (status != 0) { /* rotating failed */ - char *name = caja_file_info_get_name (file); - - GtkWidget *msg_dialog = gtk_message_dialog_new (GTK_WINDOW (priv->progress_dialog), - GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, - GTK_BUTTONS_NONE, - "'%s' cannot be rotated. Check whether you have permission to write to this folder.", - name); - g_free (name); - - gtk_dialog_add_button (GTK_DIALOG (msg_dialog), _("_Skip"), 1); - gtk_dialog_add_button (GTK_DIALOG (msg_dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); - gtk_dialog_add_button (GTK_DIALOG (msg_dialog), _("_Retry"), 0); - gtk_dialog_set_default_response (GTK_DIALOG (msg_dialog), 0); - - int response_id = gtk_dialog_run (GTK_DIALOG (msg_dialog)); + GtkBuilder *builder; + GtkWidget *msg_dialog; + GObject *dialog_text; + int response_id; + char *msg; + char *name; + + name = caja_file_info_get_name (file); + + builder = gtk_builder_new_from_resource ("/org/mate/caja/extensions/imageconverter/error-dialog.ui"); + msg_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "error_dialog")); + dialog_text = gtk_builder_get_object (builder, "error_text"); + msg = g_strdup_printf ("'%s' cannot be rotated. Check whether you have permission to write to this folder.", name); + gtk_label_set_text (GTK_LABEL (dialog_text), msg); + g_free (msg); + g_object_unref (builder); + + response_id = gtk_dialog_run (GTK_DIALOG (msg_dialog)); gtk_widget_destroy (msg_dialog); if (response_id == 0) { retry = TRUE; diff --git a/image-converter/error-dialog.ui b/image-converter/error-dialog.ui new file mode 100644 index 0000000..6129686 --- /dev/null +++ b/image-converter/error-dialog.ui @@ -0,0 +1,147 @@ + + + + + + True + False + process-stop + + + False + 12 + Error + center + dialog-error + dialog + + + + + + True + False + vertical + + + True + False + True + True + expand + + + _Skip + True + True + True + True + + + True + True + 0 + + + + + _Cancel + True + True + True + image1 + True + True + + + True + True + 1 + + + + + _Retry + True + True + True + True + + + True + True + 2 + + + + + + False + True + end + 0 + + + + + True + False + + + True + False + 12 + + + True + False + dialog-error + 6 + + + False + False + 0 + + + + + True + False + An error has occurred. + True + True + 40 + 0 + + + False + False + 1 + + + + + True + True + 0 + + + + + False + True + 1 + + + + + + button2 + button1 + button3 + + + diff --git a/image-converter/org.mate.caja.extensions.imageconverter.gresource.xml b/image-converter/org.mate.caja.extensions.imageconverter.gresource.xml index 309c152..caf061a 100644 --- a/image-converter/org.mate.caja.extensions.imageconverter.gresource.xml +++ b/image-converter/org.mate.caja.extensions.imageconverter.gresource.xml @@ -19,5 +19,6 @@ caja-image-resize.ui caja-image-rotate.ui + error-dialog.ui -- cgit v1.2.1