[glade/glade-3-20] Gtk+ plugin: reworked popover adaptor to share class wrapper with derived types



commit 72e2b9757252d85e5dd905b4fe029d5501d1257d
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Wed Feb 28 20:48:30 2018 -0300

    Gtk+ plugin: reworked popover adaptor to share class wrapper with derived types

 plugins/gtk+/Makefile.am         |    1 +
 plugins/gtk+/glade-gtk-popover.c |   22 +++++++++++++++++-----
 plugins/gtk+/glade-gtk-popover.h |   34 ++++++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+), 5 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 4390c7e..a3fcbad 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -207,6 +207,7 @@ noinst_HEADERS =                    \
        glade-gtk-dialog.h              \
        glade-gtk-frame.h               \
        glade-gtk-image.h               \
+       glade-gtk-popover.h             \
        glade-gtk-menu-shell.h          \
        glade-gtk-notebook.h            \
        glade-gtk-tree-view.h           \
diff --git a/plugins/gtk+/glade-gtk-popover.c b/plugins/gtk+/glade-gtk-popover.c
index 8a88f8e..a251307 100644
--- a/plugins/gtk+/glade-gtk-popover.c
+++ b/plugins/gtk+/glade-gtk-popover.c
@@ -23,8 +23,8 @@
 
 #include <config.h>
 #include <glib/gi18n-lib.h>
-#include <gladeui/glade.h>
 
+#include "glade-gtk-popover.h"
 #include "glade-popover-editor.h"
 
 #define GLADE_TYPE_GTK_POPOVER glade_gtk_popover_get_type ()
@@ -37,14 +37,20 @@ struct _GladeGtkPopover
 
 G_DEFINE_TYPE (GladeGtkPopover, glade_gtk_popover, GTK_TYPE_POPOVER)
 
-static void
-glade_gtk_popover_init (GladeGtkPopover *popover)
+void
+glade_gtk_popover_init_common (gpointer popover)
 {
   gtk_popover_set_modal (GTK_POPOVER (popover), FALSE);
   gtk_popover_set_relative_to (GTK_POPOVER (popover), NULL);
 }
 
 static void
+glade_gtk_popover_init (GladeGtkPopover *popover)
+{
+  glade_gtk_popover_init_common (popover);
+}
+
+static void
 glade_gtk_popover_map (GtkWidget *widget)
 {
   GtkWidgetClass *klass = g_type_class_peek_parent (glade_gtk_popover_parent_class);
@@ -73,8 +79,8 @@ glade_gtk_popover_key_press_event (GtkWidget *popover, GdkEventKey *event)
   return FALSE;
 }
 
-static void
-glade_gtk_popover_class_init (GladeGtkPopoverClass *klass)
+void
+glade_gtk_popover_class_init_common (gpointer klass)
 {
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
@@ -88,6 +94,12 @@ glade_gtk_popover_class_init (GladeGtkPopoverClass *klass)
   widget_class->unmap = glade_gtk_popover_unmap;
 }
 
+static void
+glade_gtk_popover_class_init (GladeGtkPopoverClass *klass)
+{
+  glade_gtk_popover_class_init_common (klass);
+}
+
 
 GObject *
 glade_gtk_popover_constructor (GType type,
diff --git a/plugins/gtk+/glade-gtk-popover.h b/plugins/gtk+/glade-gtk-popover.h
new file mode 100644
index 0000000..615a69d
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-popover.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2018 Juan Pablo Ugarte
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Authors:
+ *   Juan Pablo Ugarte <juanpablougarte gmail com>
+ */
+#ifndef _GLADE_GTK_POPOVER_H_
+#define _GLADE_GTK_POPOVER_H_
+
+#include <gtk/gtk.h>
+#include <gladeui/glade.h>
+
+G_BEGIN_DECLS
+
+void glade_gtk_popover_init_common (gpointer popover);
+void glade_gtk_popover_class_init_common (gpointer klass);
+
+G_END_DECLS
+
+#endif  /* _GLADE_GTK_POPOVER_H_ */


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