Merge branch 'matthiasc/for-main' into 'main'

gtk-demo: Change sidebar tab behavior

Closes #3543

See merge request GNOME/gtk!6079
This commit is contained in:
Matthias Clasen 2023-06-10 11:03:02 +00:00
commit 1888f1e422
3 changed files with 16 additions and 3 deletions

View File

@ -83,6 +83,7 @@
<style>
<class name="navigation-sidebar"/>
</style>
<property name="tab-behavior">item</property>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="resource">/ui/main-listitem.ui</property>

View File

@ -1677,7 +1677,7 @@ subparser_end (GtkBuildableParseContext *context,
data->subparser->child,
element_name,
data->subparser->data);
g_free (data->subparser->parser);
g_clear_pointer (&data->subparser->parser, g_free);
if (_gtk_builder_lookup_failed (data->builder, error))
return;

View File

@ -1497,9 +1497,11 @@ test_cell_view (void)
g_object_unref (model);
path = gtk_tree_path_new_first ();
gtk_cell_view_set_displayed_row (GTK_CELL_VIEW (cellview), path);
gtk_tree_path_free (path);
renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (cellview));
g_assert_cmpint (g_list_length (renderers), ==, 1);
g_list_free (renderers);
window = gtk_builder_get_object (builder, "window1");
g_assert_nonnull (window);
@ -2289,7 +2291,6 @@ test_expose_object (void)
menu = gtk_popover_new ();
builder = gtk_builder_new ();
gtk_builder_expose_object (builder, "builder", G_OBJECT (builder));
gtk_builder_expose_object (builder, "external_menu", G_OBJECT (menu));
gtk_builder_add_from_string (builder, buffer, -1, &error);
g_assert_no_error (error);
@ -2299,7 +2300,6 @@ test_expose_object (void)
g_assert_true (gtk_menu_button_get_popover (GTK_MENU_BUTTON (obj)) == GTK_POPOVER (menu));
g_object_unref (menu);
g_object_unref (builder);
}
@ -2459,6 +2459,8 @@ my_gtk_grid_class_init (MyGtkGridClass *klass)
gtk_widget_class_set_template (widget_class, template);
gtk_widget_class_bind_template_child (widget_class, MyGtkGrid, label);
gtk_widget_class_bind_template_child_private (widget_class, MyGtkGrid, label);
g_bytes_unref (template);
}
static void
@ -2478,6 +2480,9 @@ test_template (void)
g_assert_true (my_gtk_grid->label == my_gtk_grid->priv->label);
g_assert_true (GTK_IS_LABEL (my_gtk_grid->label));
g_assert_true (GTK_IS_LABEL (my_gtk_grid->priv->label));
g_object_ref_sink (my_gtk_grid);
g_object_unref (my_gtk_grid);
}
_BUILDER_TEST_EXPORT void
@ -2746,6 +2751,8 @@ my_gtk_box_class_init (MyGtkBoxClass *klass)
gtk_widget_class_bind_template_child (widget_class, MyGtkBox, label2);
G_OBJECT_CLASS (klass)->dispose = my_gtk_box_dispose;
g_bytes_unref (template);
}
typedef struct
@ -2834,6 +2841,8 @@ my_gtk_buildable_class_init (MyGtkBuildableClass *klass)
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
gtk_widget_class_set_template (widget_class, template);
g_bytes_unref (template);
}
static const GtkBuildableParser custom_parser = {
@ -2898,6 +2907,9 @@ test_buildable (void)
/* Check everything is fine */
g_assert_true (g_type_from_name ("MyGtkBuildable"));
g_assert_true (MY_IS_GTK_BUILDABLE (my_gtk_buildable));
g_object_ref_sink (my_gtk_buildable);
g_object_unref (my_gtk_buildable);
}
int