[gtk+/gtk-2-22] Exposed GtkTreeView's internal GtkTreeSelection for builder files (cherry picked from commit 17516dc
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-22] Exposed GtkTreeView's internal GtkTreeSelection for builder files (cherry picked from commit 17516dc
- Date: Sat, 26 Jun 2010 20:32:10 +0000 (UTC)
commit 1adba9e908daf124770107fe2d1b0cb66363dc0b
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Fri Jun 25 12:14:28 2010 -0400
Exposed GtkTreeView's internal GtkTreeSelection for builder files
(cherry picked from commit 17516dc83c890de42584264e225284dc4d957283)
docs/reference/gtk/tmpl/gtktreeview.sgml | 8 +++++-
gtk/gtktreeview.c | 43 +++++++++++++++++++++--------
2 files changed, 38 insertions(+), 13 deletions(-)
---
diff --git a/docs/reference/gtk/tmpl/gtktreeview.sgml b/docs/reference/gtk/tmpl/gtktreeview.sgml
index 9dcd8f1..5c4e084 100644
--- a/docs/reference/gtk/tmpl/gtktreeview.sgml
+++ b/docs/reference/gtk/tmpl/gtktreeview.sgml
@@ -46,7 +46,8 @@ former you can use gtk_tree_view_convert_widget_to_bin_window_coords()
<title>GtkTreeView as GtkBuildable</title>
<para>
The GtkTreeView implementation of the GtkBuildable interface accepts
-GtkTreeViewColumn objects as <child> elements in UI definitions.
+GtkTreeViewColumn objects as <child> elements and exposes the
+internal GtkTreeSelection in UI definitions.
</para>
<example>
<title>A UI definition fragment with GtkTreeView</title>
@@ -64,6 +65,11 @@ GtkTreeViewColumn objects as <child> elements in UI definitions.
</child>
</object>
</child>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="selection">
+ <signal name="changed" handler="on_treeview_selection_changed"/>
+ </object>
+ </child>
</object>
]]></programlisting>
</example>
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 765d80c..bbeb44d 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -464,11 +464,14 @@ static GtkTreeViewColumn *gtk_tree_view_get_drop_column (GtkTreeView *tree
gint drop_position);
/* GtkBuildable */
-static void gtk_tree_view_buildable_add_child (GtkBuildable *tree_view,
- GtkBuilder *builder,
- GObject *child,
- const gchar *type);
-static void gtk_tree_view_buildable_init (GtkBuildableIface *iface);
+static void gtk_tree_view_buildable_add_child (GtkBuildable *tree_view,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *type);
+static GObject *gtk_tree_view_buildable_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const gchar *childname);
+static void gtk_tree_view_buildable_init (GtkBuildableIface *iface);
static gboolean scroll_row_timeout (gpointer data);
@@ -1316,12 +1319,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
}
static void
-gtk_tree_view_buildable_init (GtkBuildableIface *iface)
-{
- iface->add_child = gtk_tree_view_buildable_add_child;
-}
-
-static void
gtk_tree_view_init (GtkTreeView *tree_view)
{
tree_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (tree_view, GTK_TYPE_TREE_VIEW, GtkTreeViewPrivate);
@@ -1543,7 +1540,16 @@ gtk_tree_view_finalize (GObject *object)
G_OBJECT_CLASS (gtk_tree_view_parent_class)->finalize (object);
}
-
+
+static GtkBuildableIface *parent_buildable_iface;
+
+static void
+gtk_tree_view_buildable_init (GtkBuildableIface *iface)
+{
+ parent_buildable_iface = g_type_interface_peek_parent (iface);
+ iface->add_child = gtk_tree_view_buildable_add_child;
+ iface->get_internal_child = gtk_tree_view_buildable_get_internal_child;
+}
static void
gtk_tree_view_buildable_add_child (GtkBuildable *tree_view,
@@ -1554,6 +1560,19 @@ gtk_tree_view_buildable_add_child (GtkBuildable *tree_view,
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), GTK_TREE_VIEW_COLUMN (child));
}
+static GObject *
+gtk_tree_view_buildable_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const gchar *childname)
+{
+ if (strcmp (childname, "selection") == 0)
+ return G_OBJECT (GTK_TREE_VIEW (buildable)->priv->selection);
+
+ return parent_buildable_iface->get_internal_child (buildable,
+ builder,
+ childname);
+}
+
/* GtkObject Methods
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]