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



commit 6c2ac93f4a9cd112c0b8521115bf86c0fd4e523b
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 4 14:58:56 2013 +0900

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

 plugins/gtk+/Makefile.am                  |    1 +
 plugins/gtk+/glade-gtk-menu-tool-button.c |  104 +++++++++++++++++++++++++++++
 plugins/gtk+/glade-gtk.c                  |   78 ---------------------
 po/POTFILES.in                            |    1 +
 4 files changed, 106 insertions(+), 78 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 87f18ac..ef0115a 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -52,6 +52,7 @@ libgladegtk_la_SOURCES =              \
        glade-gtk-menu-bar.c            \
        glade-gtk-menu-item.c           \
        glade-gtk-menu-shell.c          \
+       glade-gtk-menu-tool-button.c    \
        glade-gtk-message-dialog.c      \
        glade-gtk-notebook.c            \
        glade-gtk-paned.c               \
diff --git a/plugins/gtk+/glade-gtk-menu-tool-button.c b/plugins/gtk+/glade-gtk-menu-tool-button.c
new file mode 100644
index 0000000..60d9bd2
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-menu-tool-button.c
@@ -0,0 +1,104 @@
+/*
+ * glade-gtk-menu-tool-button.c - GladeWidgetAdaptor for GtkMenuToolButton
+ *
+ * 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>
+
+#include "glade-gtk.h"
+
+GList *
+glade_gtk_menu_tool_button_get_children (GladeWidgetAdaptor * adaptor,
+                                         GtkMenuToolButton * button)
+{
+  GList *list = NULL;
+  GtkWidget *menu = gtk_menu_tool_button_get_menu (button);
+
+  list = glade_util_container_get_all_children (GTK_CONTAINER (button));
+
+  /* Ensure that we only return one 'menu' */
+  if (menu && g_list_find (list, menu) == NULL)
+    list = g_list_append (list, menu);
+
+  return list;
+}
+
+gboolean
+glade_gtk_menu_tool_button_add_verify (GladeWidgetAdaptor *adaptor,
+                                      GtkWidget          *container,
+                                      GtkWidget          *child,
+                                      gboolean            user_feedback)
+{
+  if (!GTK_IS_MENU (child))
+    {
+      if (user_feedback)
+       {
+         GladeWidgetAdaptor *menu_adaptor = 
+           glade_widget_adaptor_get_by_type (GTK_TYPE_MENU);
+
+         glade_util_ui_message (glade_app_get_window (),
+                                GLADE_UI_INFO, NULL,
+                                ONLY_THIS_GOES_IN_THAT_MSG,
+                                glade_widget_adaptor_get_title (menu_adaptor),
+                                glade_widget_adaptor_get_title (adaptor));
+       }
+
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+void
+glade_gtk_menu_tool_button_add_child (GladeWidgetAdaptor * adaptor,
+                                      GObject * object, GObject * child)
+{
+  if (GTK_IS_MENU (child))
+    {
+      g_object_set_data (child, "special-child-type", "menu");
+
+      gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (object),
+                                    GTK_WIDGET (child));
+    }
+}
+
+void
+glade_gtk_menu_tool_button_remove_child (GladeWidgetAdaptor * adaptor,
+                                         GObject * object, GObject * child)
+{
+  if (GTK_IS_MENU (child))
+    {
+      gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (object), NULL);
+
+      g_object_set_data (child, "special-child-type", NULL);
+    }
+}
+
+void
+glade_gtk_menu_tool_button_replace_child (GladeWidgetAdaptor * adaptor,
+                                         GObject * container,
+                                         GObject * current, GObject * new_object)
+{
+  glade_gtk_menu_tool_button_remove_child (adaptor, container, current);
+  glade_gtk_menu_tool_button_add_child (adaptor, container, new_object);
+}
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 0954098..642f733 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -82,83 +82,6 @@ glade_gtk_init (const gchar * name)
 }
 
 
-/* ----------------------------- GtkMenuToolButton ------------------------------ */
-GList *
-glade_gtk_menu_tool_button_get_children (GladeWidgetAdaptor * adaptor,
-                                         GtkMenuToolButton * button)
-{
-  GList *list = NULL;
-  GtkWidget *menu = gtk_menu_tool_button_get_menu (button);
-
-  list = glade_util_container_get_all_children (GTK_CONTAINER (button));
-
-  /* Ensure that we only return one 'menu' */
-  if (menu && g_list_find (list, menu) == NULL)
-    list = g_list_append (list, menu);
-
-  return list;
-}
-
-gboolean
-glade_gtk_menu_tool_button_add_verify (GladeWidgetAdaptor *adaptor,
-                                      GtkWidget          *container,
-                                      GtkWidget          *child,
-                                      gboolean            user_feedback)
-{
-  if (!GTK_IS_MENU (child))
-    {
-      if (user_feedback)
-       {
-         GladeWidgetAdaptor *menu_adaptor = 
-           glade_widget_adaptor_get_by_type (GTK_TYPE_MENU);
-
-         glade_util_ui_message (glade_app_get_window (),
-                                GLADE_UI_INFO, NULL,
-                                ONLY_THIS_GOES_IN_THAT_MSG,
-                                glade_widget_adaptor_get_title (menu_adaptor),
-                                glade_widget_adaptor_get_title (adaptor));
-       }
-
-      return FALSE;
-    }
-
-  return TRUE;
-}
-
-void
-glade_gtk_menu_tool_button_add_child (GladeWidgetAdaptor * adaptor,
-                                      GObject * object, GObject * child)
-{
-  if (GTK_IS_MENU (child))
-    {
-      g_object_set_data (child, "special-child-type", "menu");
-
-      gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (object),
-                                    GTK_WIDGET (child));
-    }
-}
-
-void
-glade_gtk_menu_tool_button_remove_child (GladeWidgetAdaptor * adaptor,
-                                         GObject * object, GObject * child)
-{
-  if (GTK_IS_MENU (child))
-    {
-      gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (object), NULL);
-
-      g_object_set_data (child, "special-child-type", NULL);
-    }
-}
-
-void
-glade_gtk_menu_tool_button_replace_child (GladeWidgetAdaptor * adaptor,
-                                         GObject * container,
-                                         GObject * current, GObject * new_object)
-{
-  glade_gtk_menu_tool_button_remove_child (adaptor, container, current);
-  glade_gtk_menu_tool_button_add_child (adaptor, container, new_object);
-}
-
 /* ----------------------------- GtkLabel ------------------------------ */
 void
 glade_gtk_label_post_create (GladeWidgetAdaptor * adaptor,
@@ -171,7 +94,6 @@ glade_gtk_label_post_create (GladeWidgetAdaptor * adaptor,
                                          MNEMONIC_INSENSITIVE_MSG);
 }
 
-
 static void
 glade_gtk_label_set_label (GObject * object, const GValue * value)
 {
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a3d55e5..2b1c82a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -80,6 +80,7 @@ plugins/gtk+/glade-gtk-menu.c
 plugins/gtk+/glade-gtk-menu-bar.c
 plugins/gtk+/glade-gtk-menu-item.c
 plugins/gtk+/glade-gtk-menu-shell.c
+plugins/gtk+/glade-gtk-menu-tool-button.c
 plugins/gtk+/glade-gtk-message-dialog.c
 plugins/gtk+/glade-gtk-notebook.c
 plugins/gtk+/glade-gtk-paned.c


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