diff options
author | rbuj <[email protected]> | 2020-03-17 12:34:02 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-04-12 23:27:43 +0200 |
commit | ec749ac683867006ca5ccb20149bba8501a4a489 (patch) | |
tree | 45b91c9148811bcfadb004342e10e6dfc3c227a3 /image-converter | |
parent | ce18af2970f8bee907197b2b8c5b398ae0ab97c2 (diff) | |
download | caja-extensions-ec749ac683867006ca5ccb20149bba8501a4a489.tar.bz2 caja-extensions-ec749ac683867006ca5ccb20149bba8501a4a489.tar.xz |
image-converter: Add error-dialog.ui
Diffstat (limited to 'image-converter')
-rw-r--r-- | image-converter/Makefile.am | 1 | ||||
-rw-r--r-- | image-converter/caja-image-resizer.c | 33 | ||||
-rw-r--r-- | image-converter/caja-image-rotator.c | 33 | ||||
-rw-r--r-- | image-converter/error-dialog.ui | 147 | ||||
-rw-r--r-- | image-converter/org.mate.caja.extensions.imageconverter.gresource.xml | 1 |
5 files changed, 185 insertions, 30 deletions
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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.2 --> +<interface> + <requires lib="gtk+" version="3.22"/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">process-stop</property> + </object> + <object class="GtkDialog" id="error_dialog"> + <property name="can_focus">False</property> + <property name="border_width">12</property> + <property name="title" translatable="yes">Error</property> + <property name="window_position">center</property> + <property name="icon_name">dialog-error</property> + <property name="type_hint">dialog</property> + <child type="titlebar"> + <placeholder/> + </child> + <child internal-child="vbox"> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child internal-child="action_area"> + <object class="GtkButtonBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="homogeneous">True</property> + <property name="layout_style">expand</property> + <child> + <object class="GtkButton" id="button2"> + <property name="label" translatable="yes">_Skip</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button1"> + <property name="label" translatable="yes">_Cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="image">image1</property> + <property name="use_underline">True</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button3"> + <property name="label" translatable="yes">_Retry</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <style> + <class name="linked"/> + </style> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="vbox8"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkBox" id="hbox3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">12</property> + <child> + <object class="GtkImage"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">dialog-error</property> + <property name="icon_size">6</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="error_text"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">An error has occurred.</property> + <property name="wrap">True</property> + <property name="selectable">True</property> + <property name="max_width_chars">40</property> + <property name="yalign">0</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="1">button2</action-widget> + <action-widget response="-6">button1</action-widget> + <action-widget response="0">button3</action-widget> + </action-widgets> + </object> +</interface> 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 @@ <gresource prefix="/org/mate/caja/extensions/imageconverter"> <file compressed="true">caja-image-resize.ui</file> <file compressed="true">caja-image-rotate.ui</file> + <file compressed="true">error-dialog.ui</file> </gresource> </gresources> |