[gthumb] moved GthPropertyView implementation in its own file



commit 126e660d3b7561e1f9047f855a1739da9efaae78
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Jan 9 11:14:55 2019 +0100

    moved GthPropertyView implementation in its own file

 gthumb/gth-file-comment.c    |  2 +-
 gthumb/gth-file-details.c    |  2 +-
 gthumb/gth-file-properties.c |  2 +-
 gthumb/gth-property-view.c   | 64 ++++++++++++++++++++++++++++++++++++++++++++
 gthumb/gth-property-view.h   | 58 +++++++++++++++++++++++++++++++++++++++
 gthumb/gth-sidebar-section.c |  2 +-
 gthumb/gth-sidebar.c         | 45 ++-----------------------------
 gthumb/gth-sidebar.h         | 26 ------------------
 gthumb/meson.build           |  2 ++
 9 files changed, 130 insertions(+), 73 deletions(-)
---
diff --git a/gthumb/gth-file-comment.c b/gthumb/gth-file-comment.c
index e19df246..124b0d62 100644
--- a/gthumb/gth-file-comment.c
+++ b/gthumb/gth-file-comment.c
@@ -24,7 +24,7 @@
 #include "glib-utils.h"
 #include "gth-file-comment.h"
 #include "gth-main.h"
-#include "gth-sidebar.h"
+#include "gth-property-view.h"
 
 
 #define GTH_STYLE_CLASS_COMMENT "comment"
diff --git a/gthumb/gth-file-details.c b/gthumb/gth-file-details.c
index 78c3fe40..7948a12e 100644
--- a/gthumb/gth-file-details.c
+++ b/gthumb/gth-file-details.c
@@ -23,7 +23,7 @@
 #include <glib/gi18n.h>
 #include "glib-utils.h"
 #include "gth-file-details.h"
-#include "gth-sidebar.h"
+#include "gth-property-view.h"
 
 
 static void gth_file_details_gth_property_view_interface_init (GthPropertyViewInterface *iface);
diff --git a/gthumb/gth-file-properties.c b/gthumb/gth-file-properties.c
index c65d5a0d..6acff9cb 100644
--- a/gthumb/gth-file-properties.c
+++ b/gthumb/gth-file-properties.c
@@ -24,7 +24,7 @@
 #include "glib-utils.h"
 #include "gth-file-properties.h"
 #include "gth-main.h"
-#include "gth-sidebar.h"
+#include "gth-property-view.h"
 #include "gth-string-list.h"
 #include "gth-time.h"
 #include "gtk-utils.h"
diff --git a/gthumb/gth-property-view.c b/gthumb/gth-property-view.c
new file mode 100644
index 00000000..fed9859e
--- /dev/null
+++ b/gthumb/gth-property-view.c
@@ -0,0 +1,64 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2019 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <gtk/gtk.h>
+#include "gth-property-view.h"
+
+
+G_DEFINE_INTERFACE (GthPropertyView, gth_property_view, 0)
+
+
+static void
+gth_property_view_default_init (GthPropertyViewInterface *iface)
+{
+       /* void */
+}
+
+
+const char *
+gth_property_view_get_name (GthPropertyView *self)
+{
+       return GTH_PROPERTY_VIEW_GET_INTERFACE (self)->get_name (self);
+}
+
+
+const char *
+gth_property_view_get_icon (GthPropertyView *self)
+{
+       return GTH_PROPERTY_VIEW_GET_INTERFACE (self)->get_icon (self);
+}
+
+
+gboolean
+gth_property_view_can_view (GthPropertyView *self,
+                           GthFileData     *file_data)
+{
+       return GTH_PROPERTY_VIEW_GET_INTERFACE (self)->can_view (self, file_data);
+}
+
+
+void
+gth_property_view_set_file (GthPropertyView *self,
+                           GthFileData     *file_data)
+{
+       GTH_PROPERTY_VIEW_GET_INTERFACE (self)->set_file (self, file_data);
+}
diff --git a/gthumb/gth-property-view.h b/gthumb/gth-property-view.h
new file mode 100644
index 00000000..758418fc
--- /dev/null
+++ b/gthumb/gth-property-view.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2019 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GTH_PROPERTY_VIEW_H
+#define GTH_PROPERTY_VIEW_H
+
+#include <gtk/gtk.h>
+#include "gth-file-data.h"
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_PROPERTY_VIEW               (gth_property_view_get_type ())
+#define GTH_PROPERTY_VIEW(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_PROPERTY_VIEW, 
GthPropertyView))
+#define GTH_IS_PROPERTY_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_PROPERTY_VIEW))
+#define GTH_PROPERTY_VIEW_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTH_TYPE_PROPERTY_VIEW, 
GthPropertyViewInterface))
+
+typedef struct _GthPropertyView GthPropertyView;
+typedef struct _GthPropertyViewInterface GthPropertyViewInterface;
+
+struct _GthPropertyViewInterface {
+       GTypeInterface parent_iface;
+       const char *    (*get_name)     (GthPropertyView *self);
+       const char *    (*get_icon)     (GthPropertyView *self);
+       gboolean        (*can_view)     (GthPropertyView *self,
+                                        GthFileData     *file_data);
+       void            (*set_file)     (GthPropertyView *self,
+                                        GthFileData     *file_data);
+};
+
+GType          gth_property_view_get_type      (void);
+const char *   gth_property_view_get_name      (GthPropertyView *self);
+const char *   gth_property_view_get_icon      (GthPropertyView *self);
+gboolean       gth_property_view_can_view      (GthPropertyView *self,
+                                               GthFileData     *file_data);
+void           gth_property_view_set_file      (GthPropertyView *self,
+                                               GthFileData     *file_data);
+
+G_END_DECLS
+
+#endif /* GTH_PROPERTY_VIEW_H */
diff --git a/gthumb/gth-sidebar-section.c b/gthumb/gth-sidebar-section.c
index 3ad0bfd1..750b731b 100644
--- a/gthumb/gth-sidebar-section.c
+++ b/gthumb/gth-sidebar-section.c
@@ -22,7 +22,7 @@
 #include <config.h>
 #include <gtk/gtk.h>
 #include "glib-utils.h"
-#include "gth-sidebar.h"
+#include "gth-property-view.h"
 #include "gth-sidebar-section.h"
 #include "gtk-utils.h"
 
diff --git a/gthumb/gth-sidebar.c b/gthumb/gth-sidebar.c
index 68f26033..e301a811 100644
--- a/gthumb/gth-sidebar.c
+++ b/gthumb/gth-sidebar.c
@@ -23,6 +23,7 @@
 #include <gtk/gtk.h>
 #include "glib-utils.h"
 #include "gth-main.h"
+#include "gth-property-view.h"
 #include "gth-sidebar.h"
 #include "gth-sidebar-section.h"
 #include "gth-toolbox.h"
@@ -248,6 +249,7 @@ _gth_sidebar_update_view (GthSidebar  *sidebar)
        gtk_stack_set_visible_child_name (GTK_STACK (sidebar), (sidebar->priv->n_visibles == 0) ? 
GTH_SIDEBAR_PAGE_EMPTY : sidebar->priv->selected_page);
 }
 
+
 void
 gth_sidebar_set_file (GthSidebar  *sidebar,
                      GthFileData *file_data)
@@ -344,46 +346,3 @@ gth_sidebar_get_sections_status (GthSidebar *sidebar)
 
        return result;
 }
-
-
-/* -- gth_property_view -- */
-
-
-G_DEFINE_INTERFACE (GthPropertyView, gth_property_view, 0)
-
-
-static void
-gth_property_view_default_init (GthPropertyViewInterface *iface)
-{
-       /* void */
-}
-
-
-const char *
-gth_property_view_get_name (GthPropertyView *self)
-{
-       return GTH_PROPERTY_VIEW_GET_INTERFACE (self)->get_name (self);
-}
-
-
-const char *
-gth_property_view_get_icon (GthPropertyView *self)
-{
-       return GTH_PROPERTY_VIEW_GET_INTERFACE (self)->get_icon (self);
-}
-
-
-gboolean
-gth_property_view_can_view (GthPropertyView *self,
-                                   GthFileData     *file_data)
-{
-       return GTH_PROPERTY_VIEW_GET_INTERFACE (self)->can_view (self, file_data);
-}
-
-
-void
-gth_property_view_set_file (GthPropertyView *self,
-                           GthFileData     *file_data)
-{
-       GTH_PROPERTY_VIEW_GET_INTERFACE (self)->set_file (self, file_data);
-}
diff --git a/gthumb/gth-sidebar.h b/gthumb/gth-sidebar.h
index d7733673..8045303c 100644
--- a/gthumb/gth-sidebar.h
+++ b/gthumb/gth-sidebar.h
@@ -34,11 +34,6 @@ G_BEGIN_DECLS
 #define GTH_IS_SIDEBAR_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_SIDEBAR))
 #define GTH_SIDEBAR_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GTH_TYPE_SIDEBAR, GthSidebarClass))
 
-#define GTH_TYPE_PROPERTY_VIEW               (gth_property_view_get_type ())
-#define GTH_PROPERTY_VIEW(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_PROPERTY_VIEW, 
GthPropertyView))
-#define GTH_IS_PROPERTY_VIEW(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_PROPERTY_VIEW))
-#define GTH_PROPERTY_VIEW_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GTH_TYPE_PROPERTY_VIEW, 
GthPropertyViewInterface))
-
 typedef enum {
        GTH_SIDEBAR_STATE_HIDDEN,
        GTH_SIDEBAR_STATE_PROPERTIES,
@@ -58,19 +53,6 @@ struct _GthSidebarClass {
        GtkStackClass __parent_class;
 };
 
-typedef struct _GthPropertyView GthPropertyView;
-typedef struct _GthPropertyViewInterface GthPropertyViewInterface;
-
-struct _GthPropertyViewInterface {
-       GTypeInterface parent_iface;
-       const char *    (*get_name)     (GthPropertyView *self);
-       const char *    (*get_icon)     (GthPropertyView *self);
-       gboolean        (*can_view)     (GthPropertyView *self,
-                                        GthFileData     *file_data);
-       void            (*set_file)     (GthPropertyView *self,
-                                        GthFileData     *file_data);
-};
-
 GType          gth_sidebar_get_type            (void);
 GtkWidget *    gth_sidebar_new                 (char           **sections_status);
 GtkWidget *    gth_sidebar_get_toolbox         (GthSidebar      *sidebar);
@@ -83,14 +65,6 @@ void           gth_sidebar_deactivate_tool     (GthSidebar      *sidebar);
 void           gth_sidebar_update_sensitivity  (GthSidebar      *sidebar);
 char **        gth_sidebar_get_sections_status (GthSidebar      *sidebar);
 
-GType          gth_property_view_get_type      (void);
-const char *   gth_property_view_get_name      (GthPropertyView *self);
-const char *   gth_property_view_get_icon      (GthPropertyView *self);
-gboolean       gth_property_view_can_view      (GthPropertyView *self,
-                                               GthFileData     *file_data);
-void           gth_property_view_set_file      (GthPropertyView *self,
-                                               GthFileData     *file_data);
-
 G_END_DECLS
 
 #endif /* GTH_SIDEBAR_H */
diff --git a/gthumb/meson.build b/gthumb/meson.build
index 00af83d5..5dff6b58 100644
--- a/gthumb/meson.build
+++ b/gthumb/meson.build
@@ -74,6 +74,7 @@ public_header_files = [
   'gth-paned.h',
   'gth-preferences.h',
   'gth-progress-dialog.h',
+  'gth-property-view.h',
   'gth-request-dialog.h',
   'gth-save-file-data-task.h',
   'gth-save-image-task.h',
@@ -236,6 +237,7 @@ source_files = files(
   'gth-paned.c',
   'gth-preferences.c',
   'gth-progress-dialog.c',
+  'gth-property-view.c',
   'gth-request-dialog.c',
   'gth-save-file-data-task.c',
   'gth-save-image-task.c',


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