[gthumb] make the template editor available to all the extensions



commit 7a0b9d1a7cae38aeba219d1b27fff7e51cd81b0a
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat May 8 19:38:43 2021 +0200

    make the template editor available to all the extensions

 .../data => data}/ui/code-selector.ui              |  0
 data/ui/meson.build                                |  1 +
 extensions/rename_series/data/ui/meson.build       |  2 +-
 extensions/rename_series/meson.build               |  2 --
 .../gth-template-editor-dialog.c                   | 28 +++++++++++-----------
 .../gth-template-editor-dialog.h                   |  6 ++---
 .../gth-template-selector.c                        | 12 ++++++----
 .../gth-template-selector.h                        |  0
 gthumb/meson.build                                 |  4 ++++
 9 files changed, 30 insertions(+), 25 deletions(-)
---
diff --git a/extensions/rename_series/data/ui/code-selector.ui b/data/ui/code-selector.ui
similarity index 100%
rename from extensions/rename_series/data/ui/code-selector.ui
rename to data/ui/code-selector.ui
diff --git a/data/ui/meson.build b/data/ui/meson.build
index 9f42cefb..07b50881 100644
--- a/data/ui/meson.build
+++ b/data/ui/meson.build
@@ -1,5 +1,6 @@
 ui_files = files(
   'browser-preferences.ui',
+  'code-selector.ui',
   'extensions-preferences.ui',
   'favorite-properties.ui',
   'file-selection-info.ui',
diff --git a/extensions/rename_series/data/ui/meson.build b/extensions/rename_series/data/ui/meson.build
index aa7a03da..b34a62ab 100644
--- a/extensions/rename_series/data/ui/meson.build
+++ b/extensions/rename_series/data/ui/meson.build
@@ -1 +1 @@
-install_data('code-selector.ui', 'rename-series.ui', install_dir : ui_install_dir)
+install_data('rename-series.ui', install_dir : ui_install_dir)
diff --git a/extensions/rename_series/meson.build b/extensions/rename_series/meson.build
index 48d18ab8..5c06dc8f 100644
--- a/extensions/rename_series/meson.build
+++ b/extensions/rename_series/meson.build
@@ -3,8 +3,6 @@ source_files = files(
   'callbacks.c',
   'dlg-rename-series.c',
   'gth-rename-task.c',
-  'gth-template-editor-dialog.c',
-  'gth-template-selector.c',
   'main.c'
 )
 
diff --git a/extensions/rename_series/gth-template-editor-dialog.c b/gthumb/gth-template-editor-dialog.c
similarity index 91%
rename from extensions/rename_series/gth-template-editor-dialog.c
rename to gthumb/gth-template-editor-dialog.c
index 8673e51e..779b37a7 100644
--- a/extensions/rename_series/gth-template-editor-dialog.c
+++ b/gthumb/gth-template-editor-dialog.c
@@ -22,7 +22,7 @@
 #include <config.h>
 #include <stdlib.h>
 #include <gtk/gtk.h>
-#include <gthumb.h>
+#include "gtk-utils.h"
 #include "gth-template-editor-dialog.h"
 #include "gth-template-selector.h"
 
@@ -146,7 +146,7 @@ gth_template_editor_dialog_construct (GthTemplateEditorDialog *self,
                                      GthTemplateCode         *allowed_codes,
                                      int                      n_codes,
                                      const char              *title,
-                                     GtkWindow               *parent)
+                                     GtkWindow               *parent)
 {
        GtkWidget *child;
        GString   *regexp;
@@ -157,10 +157,10 @@ gth_template_editor_dialog_construct (GthTemplateEditorDialog *self,
        self->priv->n_codes = n_codes;
 
        if (title != NULL)
-               gtk_window_set_title (GTK_WINDOW (self), title);
-       if (parent != NULL)
-               gtk_window_set_transient_for (GTK_WINDOW (self), parent);
-       gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
+               gtk_window_set_title (GTK_WINDOW (self), title);
+       if (parent != NULL)
+               gtk_window_set_transient_for (GTK_WINDOW (self), parent);
+       gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
        gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 5);
        gtk_container_set_border_width (GTK_CONTAINER (self), 5);
 
@@ -169,10 +169,10 @@ gth_template_editor_dialog_construct (GthTemplateEditorDialog *self,
 
        _gtk_dialog_add_class_to_response (GTK_DIALOG (self), GTK_RESPONSE_OK, 
GTK_STYLE_CLASS_SUGGESTED_ACTION);
 
-       self->priv->content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-       gtk_container_set_border_width (GTK_CONTAINER (self->priv->content), 5);
-       gtk_widget_show (self->priv->content);
-       gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), self->priv->content, 
TRUE, TRUE, 0);
+       self->priv->content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
+       gtk_container_set_border_width (GTK_CONTAINER (self->priv->content), 5);
+       gtk_widget_show (self->priv->content);
+       gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), self->priv->content, 
TRUE, TRUE, 0);
 
        child = _gth_template_editor_create_selector (self);
        gtk_box_pack_start (GTK_BOX (self->priv->content), child, FALSE, FALSE, 0);
@@ -232,9 +232,9 @@ gth_template_editor_dialog_construct (GthTemplateEditorDialog *self,
 
 GtkWidget *
 gth_template_editor_dialog_new (GthTemplateCode *allowed_codes,
-                               int              n_codes,
-                               const char      *title,
-                               GtkWindow       *parent)
+                               int              n_codes,
+                               const char      *title,
+                               GtkWindow       *parent)
 {
        GthTemplateEditorDialog *self;
 
@@ -276,7 +276,7 @@ gth_template_editor_dialog_set_template (GthTemplateEditorDialog *self,
 
 char *
 gth_template_editor_dialog_get_template (GthTemplateEditorDialog  *self,
-                                        GError                  **error)
+                                        GError                  **error)
 {
        GString *template;
        GList   *children;
diff --git a/extensions/rename_series/gth-template-editor-dialog.h b/gthumb/gth-template-editor-dialog.h
similarity index 94%
rename from extensions/rename_series/gth-template-editor-dialog.h
rename to gthumb/gth-template-editor-dialog.h
index 7e55e2e9..e6890ffd 100644
--- a/extensions/rename_series/gth-template-editor-dialog.h
+++ b/gthumb/gth-template-editor-dialog.h
@@ -49,11 +49,11 @@ struct _GthTemplateEditorDialogClass {
 
 GType       gth_template_editor_dialog_get_type     (void);
 GtkWidget * gth_template_editor_dialog_new          (GthTemplateCode          *allowed_codes,
-                                                    int                       n_codes,
-                                                    const char               *title,
+                                                    int                       n_codes,
+                                                    const char               *title,
                                                     GtkWindow                *parent);
 void        gth_template_editor_dialog_set_template (GthTemplateEditorDialog  *self,
-                                                    const char               *template);
+                                                    const char               *value);
 char *      gth_template_editor_dialog_get_template (GthTemplateEditorDialog  *self,
                                                     GError                  **error);
 
diff --git a/extensions/rename_series/gth-template-selector.c b/gthumb/gth-template-selector.c
similarity index 98%
rename from extensions/rename_series/gth-template-selector.c
rename to gthumb/gth-template-selector.c
index 27d22f36..958a7ac8 100644
--- a/extensions/rename_series/gth-template-selector.c
+++ b/gthumb/gth-template-selector.c
@@ -21,8 +21,10 @@
 
 #include <config.h>
 #include <glib/gi18n.h>
-#include <gthumb.h>
 #include "gth-template-selector.h"
+#include "glib-utils.h"
+#include "gtk-utils.h"
+#include "gth-main.h"
 
 
 #define GET_WIDGET(x) (_gtk_builder_get_widget (self->priv->builder, (x)))
@@ -92,7 +94,7 @@ gth_template_selector_class_init (GthTemplateSelectorClass *klass)
        gth_template_selector_signals[ADD_TEMPLATE] =
                g_signal_new ("add-template",
                              G_TYPE_FROM_CLASS (klass),
-                             G_SIGNAL_RUN_LAST,
+                             G_SIGNAL_RUN_LAST,
                              G_STRUCT_OFFSET (GthTemplateSelectorClass, add_template),
                              NULL, NULL,
                              g_cclosure_marshal_VOID__VOID,
@@ -101,7 +103,7 @@ gth_template_selector_class_init (GthTemplateSelectorClass *klass)
        gth_template_selector_signals[REMOVE_TEMPLATE] =
                g_signal_new ("remove-template",
                              G_TYPE_FROM_CLASS (klass),
-                             G_SIGNAL_RUN_LAST,
+                             G_SIGNAL_RUN_LAST,
                              G_STRUCT_OFFSET (GthTemplateSelectorClass, remove_template),
                              NULL, NULL,
                              g_cclosure_marshal_VOID__VOID,
@@ -203,7 +205,7 @@ gth_template_selector_construct (GthTemplateSelector *self,
        gtk_box_set_spacing (GTK_BOX (self), 6);
        gtk_container_set_border_width (GTK_CONTAINER (self), 0);
 
-       self->priv->builder = _gtk_builder_new_from_file("code-selector.ui", "rename_series");
+       self->priv->builder = _gtk_builder_new_from_file("code-selector.ui", NULL);
        gtk_container_add (GTK_CONTAINER (self), GET_WIDGET ("code_selector"));
 
        gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("enumerator_digits_spinbutton")), 1.0);
@@ -331,7 +333,7 @@ gth_template_selector_construct (GthTemplateSelector *self,
 
 GtkWidget *
 gth_template_selector_new (GthTemplateCode *allowed_codes,
-                          int              n_codes)
+                          int              n_codes)
 {
        GthTemplateSelector *self;
 
diff --git a/extensions/rename_series/gth-template-selector.h b/gthumb/gth-template-selector.h
similarity index 100%
rename from extensions/rename_series/gth-template-selector.h
rename to gthumb/gth-template-selector.h
diff --git a/gthumb/meson.build b/gthumb/meson.build
index 7d339482..0e70e3b5 100644
--- a/gthumb/meson.build
+++ b/gthumb/meson.build
@@ -89,6 +89,8 @@ public_header_files = [
   'gth-string-list.h',
   'gth-tags-entry.h',
   'gth-tags-file.h',
+  'gth-template-editor-dialog.h',
+  'gth-template-selector.h',
   'gth-task.h',
   'gth-test.h',
   'gth-test-aspect-ratio.h',
@@ -260,6 +262,8 @@ source_files = files(
   'gth-string-list.c',
   'gth-tags-entry.c',
   'gth-tags-file.c',
+  'gth-template-editor-dialog.c',
+  'gth-template-selector.c',
   'gth-task.c',
   'gth-test.c',
   'gth-test-aspect-ratio.c',


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