restrict-applications-selector: Hide placeholder when list isn't empty
Prevents a broken bottom border radius on the list.
This commit is contained in:
parent
9ed46ae597
commit
73c1d7f3fe
|
@ -61,6 +61,7 @@ struct _MctRestrictApplicationsSelector
|
||||||
GtkBox parent_instance;
|
GtkBox parent_instance;
|
||||||
|
|
||||||
GtkListBox *listbox;
|
GtkListBox *listbox;
|
||||||
|
GtkLabel *placeholder;
|
||||||
|
|
||||||
GList *cached_apps; /* (nullable) (owned) (element-type GAppInfo) */
|
GList *cached_apps; /* (nullable) (owned) (element-type GAppInfo) */
|
||||||
GListStore *apps; /* (owned) */
|
GListStore *apps; /* (owned) */
|
||||||
|
@ -223,11 +224,14 @@ 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_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, listbox);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, MctRestrictApplicationsSelector, placeholder);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mct_restrict_applications_selector_init (MctRestrictApplicationsSelector *self)
|
mct_restrict_applications_selector_init (MctRestrictApplicationsSelector *self)
|
||||||
{
|
{
|
||||||
|
guint n_apps;
|
||||||
|
|
||||||
gtk_widget_init_template (GTK_WIDGET (self));
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
|
|
||||||
self->apps = g_list_store_new (G_TYPE_APP_INFO);
|
self->apps = g_list_store_new (G_TYPE_APP_INFO);
|
||||||
|
@ -244,6 +248,10 @@ mct_restrict_applications_selector_init (MctRestrictApplicationsSelector *self)
|
||||||
self,
|
self,
|
||||||
NULL);
|
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,
|
self->blocklisted_apps = g_hash_table_new_full (g_direct_hash,
|
||||||
g_direct_equal,
|
g_direct_equal,
|
||||||
g_object_unref,
|
g_object_unref,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<property name="selection-mode">none</property>
|
<property name="selection-mode">none</property>
|
||||||
|
|
||||||
<child type="placeholder">
|
<child type="placeholder">
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel" id="placeholder">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">No applications found to restrict.</property>
|
<property name="label" translatable="yes">No applications found to restrict.</property>
|
||||||
</object>
|
</object>
|
||||||
|
|
Loading…
Reference in New Issue