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



commit 3e91894c484f6f927d855d97ecfd31e6e7192fc6
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 4 15:12:33 2013 +0900

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

 plugins/gtk+/Makefile.am           |    1 +
 plugins/gtk+/glade-gtk-combo-box.c |   71 ++++++++++++++++++++++++++++++++++++
 plugins/gtk+/glade-gtk.c           |   46 -----------------------
 po/POTFILES.in                     |    1 +
 4 files changed, 73 insertions(+), 46 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index e6a95b5..e2b9e88 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -37,6 +37,7 @@ libgladegtk_la_SOURCES =              \
        glade-gtk-action-widgets.c      \
        glade-gtk-box.c                 \
        glade-gtk-button.c              \
+       glade-gtk-combo-box.c           \
        glade-gtk-container.c           \
        glade-gtk-dialog.c              \
        glade-gtk-entry.c               \
diff --git a/plugins/gtk+/glade-gtk-combo-box.c b/plugins/gtk+/glade-gtk-combo-box.c
new file mode 100644
index 0000000..eb25d25
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-combo-box.c
@@ -0,0 +1,71 @@
+/*
+ * glade-gtk-combo-box.c - GladeWidgetAdaptor for GtkComboBox
+ *
+ * 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>
+
+void
+glade_gtk_combo_box_set_property (GladeWidgetAdaptor * adaptor,
+                                  GObject * object,
+                                  const gchar * id, const GValue * value)
+{
+  if (!strcmp (id, "entry-text-column"))
+    {
+      /* Avoid warnings */
+      if (g_value_get_int (value) >= 0)
+        GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor,
+                                                          object, id, value);
+    }
+  else if (!strcmp (id, "text-column"))
+    {
+      if (g_value_get_int (value) >= 0)
+        gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (object),
+                                             g_value_get_int (value));
+    }
+  else
+    GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor,
+                                                      object, id, value);
+}
+
+GList *glade_gtk_cell_layout_get_children (GladeWidgetAdaptor * adaptor,
+                                           GObject * container);
+
+GList *
+glade_gtk_combo_box_get_children (GladeWidgetAdaptor * adaptor,
+                                  GtkComboBox * combo)
+{
+  GList *list = NULL;
+
+  list = glade_gtk_cell_layout_get_children (adaptor, G_OBJECT (combo));
+
+  /* return the internal entry.
+   *
+   * FIXME: for recent gtk+ we have no comboboxentry
+   * but a "has-entry" property instead
+   */
+  if (gtk_combo_box_get_has_entry (combo))
+    list = g_list_append (list, gtk_bin_get_child (GTK_BIN (combo)));
+
+  return list;
+}
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index f0e4937..806ef26 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -79,52 +79,6 @@ glade_gtk_init (const gchar * name)
 }
 
 
-/* ----------------------------- GtkComboBox ------------------------------ */
-void
-glade_gtk_combo_box_set_property (GladeWidgetAdaptor * adaptor,
-                                  GObject * object,
-                                  const gchar * id, const GValue * value)
-{
-  if (!strcmp (id, "entry-text-column"))
-    {
-      /* Avoid warnings */
-      if (g_value_get_int (value) >= 0)
-        GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor,
-                                                          object, id, value);
-    }
-  else if (!strcmp (id, "text-column"))
-    {
-      if (g_value_get_int (value) >= 0)
-        gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (object),
-                                             g_value_get_int (value));
-    }
-  else
-    GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor,
-                                                      object, id, value);
-}
-
-GList *glade_gtk_cell_layout_get_children (GladeWidgetAdaptor * adaptor,
-                                           GObject * container);
-
-GList *
-glade_gtk_combo_box_get_children (GladeWidgetAdaptor * adaptor,
-                                  GtkComboBox * combo)
-{
-  GList *list = NULL;
-
-  list = glade_gtk_cell_layout_get_children (adaptor, G_OBJECT (combo));
-
-  /* return the internal entry.
-   *
-   * FIXME: for recent gtk+ we have no comboboxentry
-   * but a "has-entry" property instead
-   */
-  if (gtk_combo_box_get_has_entry (combo))
-    list = g_list_append (list, gtk_bin_get_child (GTK_BIN (combo)));
-
-  return list;
-}
-
 /* ----------------------------- GtkComboBoxText ------------------------------ */
 #define GLADE_TAG_ITEMS  "items"
 #define GLADE_TAG_ITEM   "item"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2e1870b..1bb0c2f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -65,6 +65,7 @@ plugins/gtk+/glade-gtk.c
 plugins/gtk+/glade-gtk-about-dialog.c
 plugins/gtk+/glade-gtk-box.c
 plugins/gtk+/glade-gtk-button.c
+plugins/gtk+/glade-gtk-combo-box.c
 plugins/gtk+/glade-gtk-container.c
 plugins/gtk+/glade-gtk-dialog.c
 plugins/gtk+/glade-gtk-entry.c


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