diff --git a/demos/gtk-demo/demo.gresource.xml b/demos/gtk-demo/demo.gresource.xml
index 0ec808bd96..b2712d8dba 100644
--- a/demos/gtk-demo/demo.gresource.xml
+++ b/demos/gtk-demo/demo.gresource.xml
@@ -219,6 +219,7 @@
infobar.c
links.c
listbox.c
+ listbox2.c
listview_applauncher.c
listview_colors.c
listview_clocks.c
@@ -229,7 +230,6 @@
listview_words.c
list_store.c
markup.c
- modelbutton.c
overlay.c
overlay2.c
paint.c
@@ -279,6 +279,9 @@
messages.txt
apple-red.png
+
+ listbox2.ui
+
glarea-gl.fs.glsl
glarea-gl.vs.glsl
@@ -310,9 +313,6 @@
scale.ui
-
- modelbutton.ui
-
demotaggedentry.c
demotaggedentry.h
diff --git a/demos/gtk-demo/listbox.c b/demos/gtk-demo/listbox.c
index 2f785e271a..0a9b6959df 100644
--- a/demos/gtk-demo/listbox.c
+++ b/demos/gtk-demo/listbox.c
@@ -1,4 +1,4 @@
-/* List Box
+/* List Box/Complex list
*
* GtkListBox allows lists with complicated layouts, using
* regular widgets supporting sorting and filtering.
diff --git a/demos/gtk-demo/listbox2.c b/demos/gtk-demo/listbox2.c
new file mode 100644
index 0000000000..6b4aae0009
--- /dev/null
+++ b/demos/gtk-demo/listbox2.c
@@ -0,0 +1,71 @@
+/* List Box/Controls
+ *
+ * GtkListBox is well-suited for creating “button strips” — lists of
+ * controls for use in preference dialogs or settings panels. To create
+ * this style of list, use the .rich-list style class.
+ */
+
+#include
+
+static GtkWidget *window;
+static GtkWidget *switch_widget;
+static GtkWidget *check;
+static GtkWidget *image;
+
+static void
+row_activated (GtkListBox *list,
+ GtkListBoxRow *row)
+{
+ if (gtk_widget_is_ancestor (switch_widget, GTK_WIDGET (row)))
+ {
+ gtk_switch_set_active (GTK_SWITCH (switch_widget),
+ !gtk_switch_get_active (GTK_SWITCH (switch_widget)));
+ }
+ else if (gtk_widget_is_ancestor (check, GTK_WIDGET (row)))
+ {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
+ !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+ }
+ else if (gtk_widget_is_ancestor (image, GTK_WIDGET (row)))
+ {
+ gtk_widget_set_opacity (image,
+ 1.0 - gtk_widget_get_opacity (image));
+ }
+}
+
+GtkWidget *
+do_listbox2 (GtkWidget *do_widget)
+{
+ if (!window)
+ {
+ GtkBuilderScope *scope;
+ GtkBuilder *builder;
+
+ scope = gtk_builder_cscope_new ();
+ gtk_builder_cscope_add_callback_symbol (GTK_BUILDER_CSCOPE (scope),
+ "row_activated", G_CALLBACK (row_activated));
+ builder = gtk_builder_new ();
+ gtk_builder_set_scope (builder, scope);
+
+ gtk_builder_add_from_resource (builder, "/listbox2/listbox2.ui", NULL);
+
+ window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
+ gtk_window_set_display (GTK_WINDOW (window),
+ gtk_widget_get_display (do_widget));
+ g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
+
+ switch_widget = GTK_WIDGET (gtk_builder_get_object (builder, "switch"));
+ check = GTK_WIDGET (gtk_builder_get_object (builder, "check"));
+ image = GTK_WIDGET (gtk_builder_get_object (builder, "image"));
+
+ g_object_unref (builder);
+ g_object_unref (scope);
+ }
+
+ if (!gtk_widget_get_visible (window))
+ gtk_widget_show (window);
+ else
+ gtk_window_destroy (GTK_WINDOW (window));
+
+ return window;
+}
diff --git a/demos/gtk-demo/listbox2.ui b/demos/gtk-demo/listbox2.ui
new file mode 100644
index 0000000000..54975c887b
--- /dev/null
+++ b/demos/gtk-demo/listbox2.ui
@@ -0,0 +1,324 @@
+
+
+
+
+ horizontal
+
+
+
+
+
+
+
+
+
+
+
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 2b1c36f611..ad6043571f 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -766,6 +766,7 @@ demo_filter_by_name (GtkTreeListRow *row,
GListModel *children;
GtkDemo *demo;
guint i, n;
+ GtkTreeListRow *parent;
/* Show all items if search is empty */
if (!search_needle || !search_needle[0] || !*search_needle[0])
@@ -774,6 +775,17 @@ demo_filter_by_name (GtkTreeListRow *row,
g_assert (GTK_IS_TREE_LIST_ROW (row));
g_assert (GTK_IS_FILTER_LIST_MODEL (model));
+ /* Show a row if itself of any parent matches */
+ for (parent = row; parent; parent = gtk_tree_list_row_get_parent (parent))
+ {
+ demo = gtk_tree_list_row_get_item (parent);
+ g_assert (GTK_IS_DEMO (demo));
+
+ if (filter_demo (demo))
+ return TRUE;
+ }
+
+ /* Show a row if any child matches */
children = gtk_tree_list_row_get_children (row);
if (children)
{
@@ -792,10 +804,7 @@ demo_filter_by_name (GtkTreeListRow *row,
}
}
- demo = gtk_tree_list_row_get_item (row);
- g_assert (GTK_IS_DEMO (demo));
-
- return filter_demo (demo);
+ return FALSE;
}
static void
diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build
index 0b419edb21..9e0eaf2e9b 100644
--- a/demos/gtk-demo/meson.build
+++ b/demos/gtk-demo/meson.build
@@ -40,6 +40,7 @@ demos = files([
'infobar.c',
'links.c',
'listbox.c',
+ 'listbox2.c',
'flowbox.c',
'list_store.c',
'listview_applauncher.c',
@@ -51,7 +52,6 @@ demos = files([
'listview_weather.c',
'listview_words.c',
'markup.c',
- 'modelbutton.c',
'overlay.c',
'overlay2.c',
'paint.c',
diff --git a/demos/gtk-demo/modelbutton.c b/demos/gtk-demo/modelbutton.c
deleted file mode 100644
index 055189a1f5..0000000000
--- a/demos/gtk-demo/modelbutton.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Model Button
- *
- * GtkModelButton is a button widget that is designed to be used with
- * a GAction as model. The button will adjust its appearance according
- * to the kind of action it is connected to.
- *
- * It is also possible to use GtkModelButton without a GAction. In this
- * case, you should set the "role" attribute yourself, and connect to the
- * "clicked" signal as you would for any other button.
- *
- * A common use of GtkModelButton is to implement menu-like content
- * in popovers.
- */
-
-#include
-
-void
-modelbutton_tool_clicked (GtkButton *button)
-{
- gboolean active;
-
- g_object_get (button, "active", &active, NULL);
- g_object_set (button, "active", !active, NULL);
-}
-
-GtkWidget *
-do_modelbutton (GtkWidget *do_widget)
-{
- static GtkWidget *window = NULL;
- static GActionEntry win_entries[] = {
- { "color", NULL, "s", "'red'", NULL },
- { "chocolate", NULL, NULL, "true", NULL },
- { "vanilla", NULL, NULL, "false", NULL },
- { "sprinkles", NULL, NULL, NULL, NULL }
- };
-
- if (!window)
- {
- GtkBuilder *builder;
- GActionGroup *actions;
-
- builder = gtk_builder_new_from_resource ("/modelbutton/modelbutton.ui");
- window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
- gtk_window_set_display (GTK_WINDOW (window),
- gtk_widget_get_display (do_widget));
- g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
-
- actions = (GActionGroup*)g_simple_action_group_new ();
- g_action_map_add_action_entries (G_ACTION_MAP (actions),
- win_entries, G_N_ELEMENTS (win_entries),
- window);
- gtk_widget_insert_action_group (window, "win", actions);
-
-
- g_object_unref (builder);
- }
-
- if (!gtk_widget_get_visible (window))
- gtk_widget_show (window);
- else
- gtk_window_destroy (GTK_WINDOW (window));
-
-
- return window;
-}
-
diff --git a/demos/gtk-demo/modelbutton.ui b/demos/gtk-demo/modelbutton.ui
deleted file mode 100644
index 12593a29d5..0000000000
--- a/demos/gtk-demo/modelbutton.ui
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
-
- Model Button
- 0
-
-
-
-
-
- vertical
- 80
- 80
- 80
- 80
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- vertical
-
-
- win.color
- 'red'
- Red
-
-
-
-
- win.color
- 'green'
- Green
-
-
-
-
- win.color
- 'blue'
- Blue
-
-
-
-
-
-
-
-
-
- vertical
-
-
- win.chocolate
- Chocolate
-
-
-
-
- win.vanilla
- Vanilla
-
-
-
-
-
-
-
- win.sprinkles
- Add Sprinkles
-
-
-
-
-
-
-
-
-
- vertical
-
-
- Hammer
- check
-
-
-
-
-
- Screwdriver
- check
-
-
-
-
-
- Drill
- check
-
-
-
-
-
-
-
diff --git a/demos/gtk-demo/spinbutton.c b/demos/gtk-demo/spinbutton.c
index 8fd93ddb0f..97f25b857a 100644
--- a/demos/gtk-demo/spinbutton.c
+++ b/demos/gtk-demo/spinbutton.c
@@ -185,54 +185,54 @@ do_spinbutton (GtkWidget *do_widget)
static GtkWidget *window;
if (!window)
- {
- GtkBuilder *builder;
- GtkAdjustment *adj;
- GtkWidget *label;
+ {
+ GtkBuilder *builder;
+ GtkAdjustment *adj;
+ GtkWidget *label;
- builder = gtk_builder_new_from_resource ("/spinbutton/spinbutton.ui");
- window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
- gtk_window_set_display (GTK_WINDOW (window),
- gtk_widget_get_display (do_widget));
- gtk_window_set_title (GTK_WINDOW (window), "Spin Buttons");
- gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
- g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
+ builder = gtk_builder_new_from_resource ("/spinbutton/spinbutton.ui");
+ window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
+ gtk_window_set_display (GTK_WINDOW (window),
+ gtk_widget_get_display (do_widget));
+ gtk_window_set_title (GTK_WINDOW (window), "Spin Buttons");
+ gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
+ g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
- adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "basic_adjustment"));
- label = GTK_WIDGET (gtk_builder_get_object (builder, "basic_label"));
- g_object_bind_property_full (adj, "value",
- label, "label",
- G_BINDING_SYNC_CREATE,
- value_to_label,
- NULL,
- NULL, NULL);
- adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "hex_adjustment"));
- label = GTK_WIDGET (gtk_builder_get_object (builder, "hex_label"));
- g_object_bind_property_full (adj, "value",
- label, "label",
- G_BINDING_SYNC_CREATE,
- value_to_label,
- NULL,
- NULL, NULL);
- adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "time_adjustment"));
- label = GTK_WIDGET (gtk_builder_get_object (builder, "time_label"));
- g_object_bind_property_full (adj, "value",
- label, "label",
- G_BINDING_SYNC_CREATE,
- value_to_label,
- NULL,
- NULL, NULL);
- adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "month_adjustment"));
- label = GTK_WIDGET (gtk_builder_get_object (builder, "month_label"));
- g_object_bind_property_full (adj, "value",
- label, "label",
- G_BINDING_SYNC_CREATE,
- value_to_label,
- NULL,
- NULL, NULL);
+ adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "basic_adjustment"));
+ label = GTK_WIDGET (gtk_builder_get_object (builder, "basic_label"));
+ g_object_bind_property_full (adj, "value",
+ label, "label",
+ G_BINDING_SYNC_CREATE,
+ value_to_label,
+ NULL,
+ NULL, NULL);
+ adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "hex_adjustment"));
+ label = GTK_WIDGET (gtk_builder_get_object (builder, "hex_label"));
+ g_object_bind_property_full (adj, "value",
+ label, "label",
+ G_BINDING_SYNC_CREATE,
+ value_to_label,
+ NULL,
+ NULL, NULL);
+ adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "time_adjustment"));
+ label = GTK_WIDGET (gtk_builder_get_object (builder, "time_label"));
+ g_object_bind_property_full (adj, "value",
+ label, "label",
+ G_BINDING_SYNC_CREATE,
+ value_to_label,
+ NULL,
+ NULL, NULL);
+ adj = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "month_adjustment"));
+ label = GTK_WIDGET (gtk_builder_get_object (builder, "month_label"));
+ g_object_bind_property_full (adj, "value",
+ label, "label",
+ G_BINDING_SYNC_CREATE,
+ value_to_label,
+ NULL,
+ NULL, NULL);
- g_object_unref (builder);
- }
+ g_object_unref (builder);
+ }
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index c453733828..deeaed97f9 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -3078,11 +3078,11 @@ list {
> row.expander .row-header { padding: 2px; }
&.horizontal row.separator:not(:first-child),
- &.separators.horizontal row:not(:first-child) {
+ &.separators.horizontal > row:not(:first-child) {
border-left: 1px solid $borders_color;
}
&:not(.horizontal) row.separator:not(:first-child),
- &.separators:not(.horizontal) row:not(:first-child) {
+ &.separators:not(.horizontal) > row:not(:first-child) {
border-top: 1px solid $borders_color;
}
}