applications: Use AdwStatusPage for the empty page

Make it streamlined with other panels
This commit is contained in:
Georges Basile Stavracas Neto 2022-01-20 12:18:26 -03:00
parent 0b0b699c20
commit f7d6c102c9
2 changed files with 31 additions and 49 deletions

View file

@ -84,8 +84,8 @@ struct _CcApplicationsPanel
GSettings *search_settings;
GtkStack *stack;
GtkBox *empty_box;
GtkBox *settings_box;
GtkWidget *empty_box;
GtkWidget *settings_box;
GtkButton *install_button;
GtkBox *permission_section;
@ -1661,7 +1661,7 @@ update_panel (CcApplicationsPanel *self,
if (row == NULL)
{
adw_window_title_set_title (self->header_title, _("Applications"));
gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->empty_box));
gtk_stack_set_visible_child (self->stack, self->empty_box);
gtk_widget_hide (GTK_WIDGET (GTK_WIDGET (self->header_button)));
return;
}
@ -1669,7 +1669,7 @@ update_panel (CcApplicationsPanel *self,
info = cc_applications_row_get_info (CC_APPLICATIONS_ROW (row));
adw_window_title_set_title (self->header_title, g_app_info_get_display_name (info));
gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->settings_box));
gtk_stack_set_visible_child (self->stack, self->settings_box);
gtk_widget_set_visible (GTK_WIDGET (self->header_button), gnome_software_is_installed ());
g_clear_pointer (&self->current_app_id, g_free);

View file

@ -28,55 +28,37 @@
</child>
<child type="content">
<object class="GtkScrolledWindow" id="main_scroll">
<property name="hscrollbar-policy">never</property>
<object class="GtkStack" id="stack">
<child>
<object class="AdwClamp">
<property name="margin_top">32</property>
<property name="margin_bottom">32</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<object class="AdwStatusPage" id="empty_box">
<property name="icon-name">org.gnome.Software-symbolic</property>
<property name="title" translatable="yes">No applications</property>
<child>
<object class="GtkStack" id="stack">
<object class="GtkButton" id="install_button">
<property name="label" translatable="yes">Install some…</property>
<property name="halign">center</property>
<signal name="clicked" handler="open_software_cb" object="CcApplicationsPanel" swapped="yes"/>
<style>
<class name="pill" />
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="settings_box">
<property name="hscrollbar-policy">never</property>
<child>
<object class="AdwClamp">
<property name="margin_top">32</property>
<property name="margin_bottom">32</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<child>
<object class="GtkBox" id="empty_box">
<property name="orientation">vertical</property>
<property name="valign">center</property>
<child>
<object class="GtkImage">
<property name="valign">start</property>
<property name="pixel-size">80</property>
<property name="icon-name">org.gnome.Software-symbolic</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-bottom">15</property>
<property name="label" translatable="yes">No applications</property>
<style>
<class name="dim-label"/>
</style>
<attributes>
<attribute name="scale" value="1.2"/>
</attributes>
</object>
</child>
<child>
<object class="GtkButton" id="install_button">
<property name="label" translatable="yes">Install some…</property>
<property name="receives-default">1</property>
<property name="halign">center</property>
<signal name="clicked" handler="open_software_cb" object="CcApplicationsPanel" swapped="yes"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="settings_box">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">24</property>
<property name="hexpand">1</property>