From 5d07a66d1dbf3158e1ab6143c2537d9e8c290a1a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 27 Mar 2020 16:06:03 -0400 Subject: [PATCH 1/2] widget-factory: Fix the radio button example We only want one of the sensitive buttons to be active, so don't tell them all to be active. --- demos/widget-factory/widget-factory.ui | 5 ----- 1 file changed, 5 deletions(-) diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui index ecca3b4ff1..d69afb3b3e 100644 --- a/demos/widget-factory/widget-factory.ui +++ b/demos/widget-factory/widget-factory.ui @@ -700,7 +700,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus. radiobutton 1 - 1 radiobutton1 1 @@ -713,7 +712,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus. radiobutton 1 1 - 1 radiobutton1 1 @@ -726,7 +724,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus. radiobutton 0 1 - 1 1 3 @@ -738,7 +735,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus. radiobutton 0 1 - 1 radiobutton3 1 @@ -752,7 +748,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus. 0 1 1 - 1 radiobutton3 1 From 93d54ba10b3921d01a122d117f1e7ffcf32abd38 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 27 Mar 2020 16:24:20 -0400 Subject: [PATCH 2/2] gtk-demo: Fix the search entry demo Avoid critical warnings when setting up the context menu actions. --- demos/gtk-demo/search_entry.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/demos/gtk-demo/search_entry.c b/demos/gtk-demo/search_entry.c index 71fb5949fc..d9999eea5e 100644 --- a/demos/gtk-demo/search_entry.c +++ b/demos/gtk-demo/search_entry.c @@ -216,11 +216,18 @@ entry_add_to_context_menu (GtkEntry *entry) }; GMenuModel *submenu; GMenuItem *item; + GAction *action; + GVariant *value; actions = g_simple_action_group_new (); g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS(entries), entry); gtk_widget_insert_action_group (GTK_WIDGET (entry), "search", G_ACTION_GROUP (actions)); + action = g_action_map_lookup_action (G_ACTION_MAP (actions), "search-by"); + value = g_variant_ref_sink (g_variant_new_string ("name")); + set_search_by (G_SIMPLE_ACTION (action), value, entry); + g_variant_unref (value); + menu = g_menu_new (); item = g_menu_item_new (_("C_lear"), "search.clear"); g_menu_item_set_attribute (item, "touch-icon", "s", "edit-clear-symbolic"); @@ -297,10 +304,6 @@ do_search_entry (GtkWidget *do_widget) gtk_widget_show (cancel_button); /* Set up the search icon */ - GVariant *value = g_variant_ref_sink (g_variant_new_string ("name")); - set_search_by (NULL, value, entry); - g_variant_unref (value); - gtk_entry_set_icon_activatable (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY, TRUE); gtk_entry_set_icon_sensitive (GTK_ENTRY (entry), GTK_ENTRY_ICON_PRIMARY, TRUE);