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



commit 9b2f2fcf97225c69a58b2f757770e9ebcf1b8d9b
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat May 4 15:10:41 2013 +0900

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

 plugins/gtk+/Makefile.am           |    1 +
 plugins/gtk+/glade-gtk-text-view.c |   64 ++++++++++++++++++++++++++++++++++++
 plugins/gtk+/glade-gtk.c           |   40 ----------------------
 po/POTFILES.in                     |    1 +
 4 files changed, 66 insertions(+), 40 deletions(-)
---
diff --git a/plugins/gtk+/Makefile.am b/plugins/gtk+/Makefile.am
index 6fb8eb0..e6a95b5 100644
--- a/plugins/gtk+/Makefile.am
+++ b/plugins/gtk+/Makefile.am
@@ -63,6 +63,7 @@ libgladegtk_la_SOURCES =              \
        glade-gtk-switch.c              \
        glade-gtk-table.c               \
        glade-gtk-text-buffer.c         \
+       glade-gtk-text-view.c           \
        glade-gtk-tool-button.c         \
        glade-gtk-tool-item.c           \
        glade-gtk-tool-item-group.c     \
diff --git a/plugins/gtk+/glade-gtk-text-view.c b/plugins/gtk+/glade-gtk-text-view.c
new file mode 100644
index 0000000..0f29ded
--- /dev/null
+++ b/plugins/gtk+/glade-gtk-text-view.c
@@ -0,0 +1,64 @@
+/*
+ * glade-gtk-text-view.c - GladeWidgetAdaptor for GtkTextView
+ *
+ * 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 gboolean
+glade_gtk_text_view_stop_double_click (GtkWidget * widget,
+                                       GdkEventButton * event,
+                                       gpointer user_data)
+{
+  /* Return True if the event is double or triple click */
+  return (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS);
+}
+
+void
+glade_gtk_text_view_post_create (GladeWidgetAdaptor * adaptor,
+                                 GObject * object, GladeCreateReason reason)
+{
+  /* This makes gtk_text_view_set_buffer() stop complaing */
+  gtk_drag_dest_set (GTK_WIDGET (object), 0, NULL, 0, 0);
+
+  /* Glade hangs when a TextView gets a double click. So we stop them */
+  g_signal_connect (object, "button-press-event",
+                    G_CALLBACK (glade_gtk_text_view_stop_double_click), NULL);
+}
+
+void
+glade_gtk_text_view_set_property (GladeWidgetAdaptor * adaptor,
+                                  GObject * object,
+                                  const gchar * property_name,
+                                  const GValue * value)
+{
+  if (strcmp (property_name, "buffer") == 0)
+    {
+      if (!g_value_get_object (value))
+        return;
+    }
+
+  GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor,
+                                                    object,
+                                                    property_name, value);
+}
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index ce343fc..f0e4937 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -79,46 +79,6 @@ glade_gtk_init (const gchar * name)
 }
 
 
-
-/* ----------------------------- GtkTextView ------------------------------ */
-static gboolean
-glade_gtk_text_view_stop_double_click (GtkWidget * widget,
-                                       GdkEventButton * event,
-                                       gpointer user_data)
-{
-  /* Return True if the event is double or triple click */
-  return (event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS);
-}
-
-void
-glade_gtk_text_view_post_create (GladeWidgetAdaptor * adaptor,
-                                 GObject * object, GladeCreateReason reason)
-{
-  /* This makes gtk_text_view_set_buffer() stop complaing */
-  gtk_drag_dest_set (GTK_WIDGET (object), 0, NULL, 0, 0);
-
-  /* Glade hangs when a TextView gets a double click. So we stop them */
-  g_signal_connect (object, "button-press-event",
-                    G_CALLBACK (glade_gtk_text_view_stop_double_click), NULL);
-}
-
-void
-glade_gtk_text_view_set_property (GladeWidgetAdaptor * adaptor,
-                                  GObject * object,
-                                  const gchar * property_name,
-                                  const GValue * value)
-{
-  if (strcmp (property_name, "buffer") == 0)
-    {
-      if (!g_value_get_object (value))
-        return;
-    }
-
-  GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor,
-                                                    object,
-                                                    property_name, value);
-}
-
 /* ----------------------------- GtkComboBox ------------------------------ */
 void
 glade_gtk_combo_box_set_property (GladeWidgetAdaptor * adaptor,
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2f0eb43..2e1870b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -91,6 +91,7 @@ plugins/gtk+/glade-gtk-recent-chooser-menu.c
 plugins/gtk+/glade-gtk-switch.c
 plugins/gtk+/glade-gtk-table.c
 plugins/gtk+/glade-gtk-text-buffer.c
+plugins/gtk+/glade-gtk-text-view.c
 plugins/gtk+/glade-gtk-tool-button.c
 plugins/gtk+/glade-gtk-tool-item.c
 plugins/gtk+/glade-gtk-tool-item-group.c


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