[gnome-control-center] applications: Replace GtkStack child names with widget references
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] applications: Replace GtkStack child names with widget references
- Date: Mon, 30 Mar 2020 02:00:58 +0000 (UTC)
commit 23db1e9933c0d28059ce2fc7dd613b9ae8c8cf2d
Author: Robert Ancell <robert ancell canonical com>
Date: Wed Nov 20 14:37:27 2019 +1300
applications: Replace GtkStack child names with widget references
The child names are easier to break if widgets are changed - this can't be
detected by the compiler.
panels/applications/cc-applications-panel.c | 10 +++++++---
panels/applications/cc-applications-panel.ui | 10 ++--------
2 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
index 21a825b34..eb622d1fc 100644
--- a/panels/applications/cc-applications-panel.c
+++ b/panels/applications/cc-applications-panel.c
@@ -75,6 +75,8 @@ struct _CcApplicationsPanel
GSettings *search_settings;
GtkStack *stack;
+ GtkBox *empty_box;
+ GtkBox *settings_box;
GtkBox *permission_section;
GtkListBox *permission_list;
@@ -93,7 +95,7 @@ struct _CcApplicationsPanel
GtkListBox *integration_list;
CcToggleRow *notification;
CcToggleRow *background;
- GtkToggleRow *wallpaper;
+ CcToggleRow *wallpaper;
CcToggleRow *sound;
CcInfoRow *no_sound;
CcToggleRow *search;
@@ -1561,7 +1563,7 @@ update_panel (CcApplicationsPanel *self,
if (row == NULL)
{
gtk_label_set_label (self->title_label, _("Applications"));
- gtk_stack_set_visible_child_name (self->stack, "empty");
+ gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->empty_box));
gtk_widget_hide (GTK_WIDGET (GTK_WIDGET (self->header_button)));
return;
}
@@ -1569,7 +1571,7 @@ update_panel (CcApplicationsPanel *self,
info = cc_applications_row_get_info (CC_APPLICATIONS_ROW (row));
gtk_label_set_label (self->title_label, g_app_info_get_display_name (info));
- gtk_stack_set_visible_child_name (self->stack, "settings");
+ gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->settings_box));
gtk_widget_show (GTK_WIDGET (self->header_button));
g_clear_pointer (&self->current_app_id, g_free);
@@ -1856,6 +1858,7 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, camera);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, clear_cache_button);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, data);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, empty_box);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, header_button);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_section);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_reset);
@@ -1878,6 +1881,7 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, sidebar_listbox);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, sidebar_search_entry);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, search);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, settings_box);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, sound);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, stack);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage);
diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui
index d52fd6ac0..8be041bdf 100644
--- a/panels/applications/cc-applications-panel.ui
+++ b/panels/applications/cc-applications-panel.ui
@@ -20,7 +20,7 @@
<object class="GtkStack" id="stack">
<property name="visible">1</property>
<child>
- <object class="GtkBox">
+ <object class="GtkBox" id="empty_box">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<property name="valign">center</property>
@@ -69,12 +69,9 @@
</packing>
</child>
</object>
- <packing>
- <property name="name">empty</property>
- </packing>
</child>
<child>
- <object class="GtkBox">
+ <object class="GtkBox" id="settings_box">
<property name="visible">1</property>
<property name="orientation">vertical</property>
<property name="spacing">24</property>
@@ -402,9 +399,6 @@
</object>
</child>
</object>
- <packing>
- <property name="name">settings</property>
- </packing>
</child>
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]