[glade] Move GladeWidgetAdaptor code for GtkToolItem into it's own C file



commit 30aeb3de35b7345587b1ed759c402bbd9ba0d8e1
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 4 14:54:02 2013 +0900

    Move GladeWidgetAdaptor code for GtkToolItem into it's own C file

 plugins/gtk+/Makefile.am           |    1 +
 plugins/gtk+/glade-gtk-tool-item.c |   72 ++++++++++++++++++++++++++++++++++++
 plugins/gtk+/glade-gtk.c           |   45 ----------------------
 po/POTFILES.in                     |    1 +
 4 files changed, 74 insertions(+), 45 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 1330b6f..92040ba 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -59,6 +59,7 @@ libgladegtk_la_SOURCES =              \
        glade-gtk-recent-chooser-menu.c \
        glade-gtk-switch.c              \
        glade-gtk-table.c               \
+       glade-gtk-tool-item.c           \
        glade-gtk-tool-item-group.c     \
        glade-gtk-tool-palette.c        \
        glade-gtk-toolbar.c             \
diff --git a/plugins/gtk+/glade-gtk-tool-item.c b/plugins/gtk+/glade-gtk-tool-item.c
new file mode 100644
index 0000000..20fdd5b
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-tool-item.c
@@ -0,0 +1,72 @@
+/*
+ * glade-gtk-tool-item.c - GladeWidgetAdaptor for GtkToolItem
+ *
+ * Copyright (C) 2013 Tristan Van Berkom
+ *
+ * Authors:
+ *      Tristan Van Berkom <tristan van berkom gmail com>
+ *
+ * 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.
+ */
+
+#include <config.h>
+#include <glib/gi18n-lib.h>
+#include <gladeui/glade.h>
+
+GObject *
+glade_gtk_tool_item_constructor (GType type,
+                                 guint n_construct_properties,
+                                 GObjectConstructParam * construct_properties)
+{
+  GladeWidgetAdaptor *adaptor;
+  GObject *ret_obj;
+
+  ret_obj = GWA_GET_OCLASS (GTK_TYPE_CONTAINER)->constructor
+      (type, n_construct_properties, construct_properties);
+
+  adaptor = GLADE_WIDGET_ADAPTOR (ret_obj);
+
+  glade_widget_adaptor_action_remove (adaptor, "add_parent");
+  glade_widget_adaptor_action_remove (adaptor, "remove_parent");
+
+  return ret_obj;
+}
+
+void
+glade_gtk_tool_item_post_create (GladeWidgetAdaptor *adaptor,
+                                 GObject            *object, 
+                                GladeCreateReason   reason)
+{
+  if (GTK_IS_SEPARATOR_TOOL_ITEM (object))
+    return;
+
+  if (reason == GLADE_CREATE_USER &&
+      gtk_bin_get_child (GTK_BIN (object)) == NULL)
+    gtk_container_add (GTK_CONTAINER (object), glade_placeholder_new ());
+}
+
+void
+glade_gtk_tool_item_set_property (GladeWidgetAdaptor * adaptor,
+                                  GObject * object,
+                                  const gchar * id, const GValue * value)
+{
+  GladeWidget *gwidget = glade_widget_get_from_gobject (object);
+  GladeProperty *property = glade_widget_get_property (gwidget, id);
+
+  if (GPC_VERSION_CHECK
+      (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
+    GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id,
+                                                      value);
+}
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 2fe8ea5..e512839 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -83,51 +83,6 @@ glade_gtk_init (const gchar * name)
 
 
 /* ----------------------------- GtkToolItem ------------------------------ */
-GObject *
-glade_gtk_tool_item_constructor (GType type,
-                                 guint n_construct_properties,
-                                 GObjectConstructParam * construct_properties)
-{
-  GladeWidgetAdaptor *adaptor;
-  GObject *ret_obj;
-
-  ret_obj = GWA_GET_OCLASS (GTK_TYPE_CONTAINER)->constructor
-      (type, n_construct_properties, construct_properties);
-
-  adaptor = GLADE_WIDGET_ADAPTOR (ret_obj);
-
-  glade_widget_adaptor_action_remove (adaptor, "add_parent");
-  glade_widget_adaptor_action_remove (adaptor, "remove_parent");
-
-  return ret_obj;
-}
-
-void
-glade_gtk_tool_item_post_create (GladeWidgetAdaptor *adaptor,
-                                 GObject            *object, 
-                                GladeCreateReason   reason)
-{
-  if (GTK_IS_SEPARATOR_TOOL_ITEM (object))
-    return;
-
-  if (reason == GLADE_CREATE_USER &&
-      gtk_bin_get_child (GTK_BIN (object)) == NULL)
-    gtk_container_add (GTK_CONTAINER (object), glade_placeholder_new ());
-}
-
-void
-glade_gtk_tool_item_set_property (GladeWidgetAdaptor * adaptor,
-                                  GObject * object,
-                                  const gchar * id, const GValue * value)
-{
-  GladeWidget *gwidget = glade_widget_get_from_gobject (object);
-  GladeProperty *property = glade_widget_get_property (gwidget, id);
-
-  if (GPC_VERSION_CHECK
-      (glade_property_get_class (property), gtk_major_version, gtk_minor_version + 1))
-    GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor, object, id,
-                                                      value);
-}
 
 /* ----------------------------- GtkToolButton ------------------------------ */
 GladeEditable *
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 58e8280..261792c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -87,6 +87,7 @@ plugins/gtk+/glade-gtk-radio-menu-item.c
 plugins/gtk+/glade-gtk-recent-chooser-menu.c
 plugins/gtk+/glade-gtk-switch.c
 plugins/gtk+/glade-gtk-table.c
+plugins/gtk+/glade-gtk-tool-item.c
 plugins/gtk+/glade-gtk-tool-item-group.c
 plugins/gtk+/glade-gtk-tool-palette.c
 plugins/gtk+/glade-gtk-toolbar.c


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