mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 17:30:10 +00:00
Exposed GtkTreeView's internal GtkTreeSelection for builder files
(cherry picked from commit 17516dc83c
)
This commit is contained in:
parent
63a276654d
commit
1adba9e908
@ -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>
|
||||
|
@ -468,6 +468,9 @@ 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);
|
||||
|
||||
|
||||
@ -1315,12 +1318,6 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
|
||||
g_type_class_add_private (o_class, sizeof (GtkTreeViewPrivate));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
@ -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
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user