[gtk+] Exposed GtkTreeView's internal GtkTreeSelection for builder files
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Exposed GtkTreeView's internal GtkTreeSelection for builder files
- Date: Fri, 25 Jun 2010 16:16:02 +0000 (UTC)
commit 17516dc83c890de42584264e225284dc4d957283
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
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 549b2e6..42e4217 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 c7a5ad7..22d25ab 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -466,11 +466,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);
@@ -1318,12 +1321,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);
@@ -1545,7 +1542,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,
@@ -1556,6 +1562,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]