mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 22:41:43 +00:00
GtkListBox: Support placeholders in ui files
This makes the gtk_list_box_set_placeholder functionality available from GtkBuilder https://bugzilla.gnome.org/show_bug.cgi?id=738111
This commit is contained in:
parent
8fcf3a8e88
commit
291e4e107d
@ -147,7 +147,12 @@ enum {
|
||||
#define BOX_PRIV(box) ((GtkListBoxPrivate*)gtk_list_box_get_instance_private ((GtkListBox*)(box)))
|
||||
#define ROW_PRIV(row) ((GtkListBoxRowPrivate*)gtk_list_box_row_get_instance_private ((GtkListBoxRow*)(row)))
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkListBox, gtk_list_box, GTK_TYPE_CONTAINER)
|
||||
static void gtk_list_box_buildable_interface_init (GtkBuildableIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkListBox, gtk_list_box, GTK_TYPE_CONTAINER,
|
||||
G_ADD_PRIVATE (GtkListBox)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||
gtk_list_box_buildable_interface_init))
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkListBoxRow, gtk_list_box_row, GTK_TYPE_BIN)
|
||||
|
||||
static void gtk_list_box_apply_filter_all (GtkListBox *box);
|
||||
@ -3517,3 +3522,23 @@ gtk_list_box_row_class_init (GtkListBoxRowClass *klass)
|
||||
g_object_class_install_properties (object_class, LAST_ROW_PROPERTY, row_properties);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_box_buildable_add_child (GtkBuildable *buildable,
|
||||
GtkBuilder *builder,
|
||||
GObject *child,
|
||||
const gchar *type)
|
||||
{
|
||||
if (type && strcmp (type, "placeholder") == 0)
|
||||
gtk_list_box_set_placeholder (GTK_LIST_BOX (buildable), GTK_WIDGET (child));
|
||||
else if (!type)
|
||||
gtk_container_add (GTK_CONTAINER (buildable), GTK_WIDGET (child));
|
||||
else
|
||||
GTK_BUILDER_WARN_INVALID_CHILD_TYPE (buildable, type);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_box_buildable_interface_init (GtkBuildableIface *iface)
|
||||
{
|
||||
iface->add_child = gtk_list_box_buildable_add_child;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user