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



commit 92939f59e2ac716944a7f70b0a7d5e44f96ebe9d
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 4 15:19:34 2013 +0900

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

 plugins/gtk+/Makefile.am             |    1 +
 plugins/gtk+/glade-gtk-spin-button.c |   66 ++++++++++++++++++++++++++++++++++
 plugins/gtk+/glade-gtk.c             |   40 --------------------
 po/POTFILES.in                       |    1 +
 4 files changed, 68 insertions(+), 40 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 958a84f..8152e15 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -62,6 +62,7 @@ libgladegtk_la_SOURCES =              \
        glade-gtk-paned.c               \
        glade-gtk-radio-menu-item.c     \
        glade-gtk-recent-chooser-menu.c \
+       glade-gtk-spin-button.c         \
        glade-gtk-switch.c              \
        glade-gtk-table.c               \
        glade-gtk-text-buffer.c         \
diff --git a/plugins/gtk+/glade-gtk-spin-button.c b/plugins/gtk+/glade-gtk-spin-button.c
new file mode 100644
index 0000000..003c9a3
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-spin-button.c
@@ -0,0 +1,66 @@
+/*
+ * glade-gtk-spin-button.c - GladeWidgetAdaptor for GtkSpinButton
+ *
+ * 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>
+
+static void
+glade_gtk_spin_button_set_adjustment (GObject * object, const GValue * value)
+{
+  GObject *adjustment;
+  GtkAdjustment *adj;
+
+  g_return_if_fail (GTK_IS_SPIN_BUTTON (object));
+
+  adjustment = g_value_get_object (value);
+
+  if (adjustment && GTK_IS_ADJUSTMENT (adjustment))
+    {
+      adj = GTK_ADJUSTMENT (adjustment);
+
+      if (gtk_adjustment_get_page_size (adj) > 0)
+        {
+          GladeWidget *gadj = glade_widget_get_from_gobject (adj);
+
+          /* Silently set any spin-button adjustment page size to 0 */
+          glade_widget_property_set (gadj, "page-size", 0.0F);
+          gtk_adjustment_set_page_size (adj, 0);
+        }
+
+      gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (object), adj);
+      gtk_spin_button_set_value (GTK_SPIN_BUTTON (object),
+                                 gtk_adjustment_get_value (adj));
+    }
+}
+
+void
+glade_gtk_spin_button_set_property (GladeWidgetAdaptor * adaptor,
+                                    GObject * object,
+                                    const gchar * id, const GValue * value)
+{
+  if (!strcmp (id, "adjustment"))
+    glade_gtk_spin_button_set_adjustment (object, value);
+  else
+    GWA_GET_CLASS (GTK_TYPE_ENTRY)->set_property (adaptor, object, id, value);
+}
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 1f54cb4..f03f0be 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -79,46 +79,6 @@ glade_gtk_init (const gchar * name)
 }
 
 
-/* ----------------------------- GtkSpinButton ------------------------------ */
-static void
-glade_gtk_spin_button_set_adjustment (GObject * object, const GValue * value)
-{
-  GObject *adjustment;
-  GtkAdjustment *adj;
-
-  g_return_if_fail (GTK_IS_SPIN_BUTTON (object));
-
-  adjustment = g_value_get_object (value);
-
-  if (adjustment && GTK_IS_ADJUSTMENT (adjustment))
-    {
-      adj = GTK_ADJUSTMENT (adjustment);
-
-      if (gtk_adjustment_get_page_size (adj) > 0)
-        {
-          GladeWidget *gadj = glade_widget_get_from_gobject (adj);
-
-          /* Silently set any spin-button adjustment page size to 0 */
-          glade_widget_property_set (gadj, "page-size", 0.0F);
-          gtk_adjustment_set_page_size (adj, 0);
-        }
-
-      gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (object), adj);
-      gtk_spin_button_set_value (GTK_SPIN_BUTTON (object),
-                                 gtk_adjustment_get_value (adj));
-    }
-}
-
-void
-glade_gtk_spin_button_set_property (GladeWidgetAdaptor * adaptor,
-                                    GObject * object,
-                                    const gchar * id, const GValue * value)
-{
-  if (!strcmp (id, "adjustment"))
-    glade_gtk_spin_button_set_adjustment (object, value);
-  else
-    GWA_GET_CLASS (GTK_TYPE_ENTRY)->set_property (adaptor, object, id, value);
-}
 
 /* ------------------------------ GtkAssistant ------------------------------ */
 static void
diff --git a/po/POTFILES.in b/po/POTFILES.in
index abf115d..0fbd30f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -90,6 +90,7 @@ plugins/gtk+/glade-gtk-notebook.c
 plugins/gtk+/glade-gtk-paned.c
 plugins/gtk+/glade-gtk-radio-menu-item.c
 plugins/gtk+/glade-gtk-recent-chooser-menu.c
+plugins/gtk+/glade-gtk-spin-button.c
 plugins/gtk+/glade-gtk-switch.c
 plugins/gtk+/glade-gtk-table.c
 plugins/gtk+/glade-gtk-text-buffer.c


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