From 13c8a88e17fc80ec5a9a875b1846fb47af2fb29f Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 13 Oct 2023 11:24:50 +0100 Subject: [PATCH] restrict-applications-selector: Fix display of placeholder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `GtkListBox` already correctly works out when to show/hide the placeholder; we don’t need to do that ourselves. It actually breaks things if we hide the placeholder, since `GtkListBox` then doesn’t re-show it. Signed-off-by: Philip Withnall --- libmalcontent-ui/restrict-applications-selector.c | 6 ------ libmalcontent-ui/restrict-applications-selector.ui | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/libmalcontent-ui/restrict-applications-selector.c b/libmalcontent-ui/restrict-applications-selector.c index 735dc96..30f2dd9 100644 --- a/libmalcontent-ui/restrict-applications-selector.c +++ b/libmalcontent-ui/restrict-applications-selector.c @@ -61,7 +61,6 @@ struct _MctRestrictApplicationsSelector GtkBox parent_instance; GtkListBox *listbox; - GtkLabel *placeholder; GList *cached_apps; /* (nullable) (owned) (element-type GAppInfo) */ GListStore *apps; @@ -223,7 +222,6 @@ mct_restrict_applications_selector_class_init (MctRestrictApplicationsSelectorCl gtk_widget_class_set_template_from_resource (widget_class, "/org/freedesktop/MalcontentUi/ui/restrict-applications-selector.ui"); gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsSelector, listbox); - gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsSelector, placeholder); gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsSelector, apps); } @@ -245,10 +243,6 @@ mct_restrict_applications_selector_init (MctRestrictApplicationsSelector *self) self, NULL); - /* Hide placeholder if not empty */ - n_apps = g_list_model_get_n_items (G_LIST_MODEL (self->apps)); - gtk_widget_set_visible (GTK_WIDGET (self->placeholder), n_apps != 0); - self->blocklisted_apps = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, diff --git a/libmalcontent-ui/restrict-applications-selector.ui b/libmalcontent-ui/restrict-applications-selector.ui index 52adf25..ccb7e92 100644 --- a/libmalcontent-ui/restrict-applications-selector.ui +++ b/libmalcontent-ui/restrict-applications-selector.ui @@ -9,7 +9,7 @@ none - + No applications found to restrict.