[gthumb] template editors: use the new utility



commit 7480c07ca3ed042f0511a058a2bb7e17ba602a0f
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri May 21 08:02:09 2021 +0200

    template editors: use the new utility

 extensions/list_tools/gth-script-editor-dialog.c | 30 ++----------------------
 extensions/rename_series/dlg-rename-series.c     | 27 ++-------------------
 2 files changed, 4 insertions(+), 53 deletions(-)
---
diff --git a/extensions/list_tools/gth-script-editor-dialog.c 
b/extensions/list_tools/gth-script-editor-dialog.c
index 749b168f..4dc40faf 100644
--- a/extensions/list_tools/gth-script-editor-dialog.c
+++ b/extensions/list_tools/gth-script-editor-dialog.c
@@ -116,32 +116,6 @@ update_sensitivity (GthScriptEditorDialog *self)
 }
 
 
-static void
-command_editor_dialog_response_cb (GtkDialog *dialog,
-                                  int        response_id,
-                                  gpointer   user_data)
-{
-       GthScriptEditorDialog *self = user_data;
-       char                  *value;
-
-       switch (response_id) {
-       case GTK_RESPONSE_OK:
-               value = gth_template_editor_dialog_get_template (GTH_TEMPLATE_EDITOR_DIALOG (dialog));
-               if (value != NULL) {
-                       gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("command_entry")), value);
-                       gtk_widget_destroy (GTK_WIDGET (dialog));
-
-                       g_free (value);
-               }
-               break;
-
-       default:
-               gtk_widget_destroy (GTK_WIDGET (dialog));
-               break;
-       }
-}
-
-
 static void
 edit_command_button_clicked_cb (GtkButton *button,
                                gpointer   user_data)
@@ -161,8 +135,8 @@ edit_command_button_clicked_cb (GtkButton *button,
                                                 gtk_entry_get_text (GTK_ENTRY (GET_WIDGET 
("command_entry"))));
        g_signal_connect (dialog,
                          "response",
-                         G_CALLBACK (command_editor_dialog_response_cb),
-                         self);
+                         G_CALLBACK (gth_template_editor_dialog_default_response),
+                         GET_WIDGET ("command_entry"));
        gtk_widget_show (dialog);
 }
 
diff --git a/extensions/rename_series/dlg-rename-series.c b/extensions/rename_series/dlg-rename-series.c
index 00e0f323..17214ec0 100644
--- a/extensions/rename_series/dlg-rename-series.c
+++ b/extensions/rename_series/dlg-rename-series.c
@@ -695,29 +695,6 @@ update_preview_cb (GtkWidget  *widget,
 }
 
 
-static void
-template_editor_dialog_response_cb (GtkDialog *dialog,
-                                   int        response_id,
-                                   gpointer   user_data)
-{
-       DialogData *data = user_data;
-       char       *template;
-
-       if (response_id != GTK_RESPONSE_OK) {
-               gtk_widget_destroy (GTK_WIDGET (dialog));
-               return;
-       }
-
-       template = gth_template_editor_dialog_get_template (GTH_TEMPLATE_EDITOR_DIALOG (dialog));
-       if (template != NULL) {
-               gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("template_entry")), template);
-               gtk_widget_destroy (GTK_WIDGET (dialog));
-
-               g_free (template);
-       }
-}
-
-
 static void
 edit_template_button_clicked_cb (GtkWidget  *widget,
                                 DialogData *data)
@@ -733,8 +710,8 @@ edit_template_button_clicked_cb (GtkWidget  *widget,
                                                 gtk_entry_get_text (GTK_ENTRY (GET_WIDGET 
("template_entry"))));
        g_signal_connect (dialog,
                          "response",
-                         G_CALLBACK (template_editor_dialog_response_cb),
-                         data);
+                         G_CALLBACK (gth_template_editor_dialog_default_response),
+                         GET_WIDGET ("template_entry"));
        gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
        gtk_window_present (GTK_WINDOW (dialog));
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]