online-accounts: Use AdwBanner to indicate when we're offline

Fixes #2201
This commit is contained in:
Felipe Borges 2023-07-04 18:18:27 -03:00
parent 2e8bf16a25
commit 9ca9c03d06
2 changed files with 42 additions and 43 deletions

View file

@ -51,7 +51,7 @@ struct _CcOnlineAccountsPanel
GtkBox *editor_box;
GtkLabel *notification_label;
GtkRevealer *notification_revealer;
GtkLabel *offline_label;
AdwBanner *offline_banner;
GtkListBox *providers_listbox;
GtkButton *remove_account_button;
GtkBox *accounts_vbox;
@ -869,7 +869,7 @@ cc_online_accounts_panel_class_init (CcOnlineAccountsPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcOnlineAccountsPanel, close_notification_button);
gtk_widget_class_bind_template_child (widget_class, CcOnlineAccountsPanel, notification_label);
gtk_widget_class_bind_template_child (widget_class, CcOnlineAccountsPanel, notification_revealer);
gtk_widget_class_bind_template_child (widget_class, CcOnlineAccountsPanel, offline_label);
gtk_widget_class_bind_template_child (widget_class, CcOnlineAccountsPanel, offline_banner);
gtk_widget_class_bind_template_child (widget_class, CcOnlineAccountsPanel, providers_listbox);
gtk_widget_class_bind_template_callback (widget_class, on_accounts_listbox_row_activated);
@ -901,8 +901,8 @@ cc_online_accounts_panel_init (CcOnlineAccountsPanel *self)
monitor = g_network_monitor_get_default();
g_object_bind_property (monitor,
"network-available",
self->offline_label,
"visible",
self->offline_banner,
"revealed",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
g_object_bind_property (monitor,

View file

@ -47,56 +47,55 @@
</child>
<child>
<object class="AdwPreferencesPage">
<property name="description" translatable="yes">Allow apps to access online services by connecting your cloud accounts.</property>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="GtkLabel" id="offline_label">
<property name="margin-top">24</property>
<property name="wrap">True</property>
<property name="label" translatable="yes">No internet connection — connect to set up new online accounts</property>
</object>
</child>
<object class="AdwBanner" id="offline_banner">
<property name="title" translatable="yes">No internet connection — connect to set up new online accounts</property>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="accounts_frame">
<property name="title" translatable="yes">Your Accounts</property>
<property name="visible">False</property>
<object class="AdwPreferencesPage">
<property name="description" translatable="yes">Allow apps to access online services by connecting your cloud accounts.</property>
<child>
<object class="GtkListBox" id="accounts_listbox">
<property name="hexpand">True</property>
<property name="selection_mode">none</property>
<signal name="row-activated" handler="on_accounts_listbox_row_activated" object="CcOnlineAccountsPanel" swapped="yes" />
<style>
<class name="boxed-list" />
</style>
<accessibility>
<relation name="labelled-by">accounts_frame</relation>
</accessibility>
<object class="AdwPreferencesGroup" id="accounts_frame">
<property name="title" translatable="yes">Your Accounts</property>
<property name="visible">False</property>
<child>
<object class="GtkListBox" id="accounts_listbox">
<property name="hexpand">True</property>
<property name="selection_mode">none</property>
<signal name="row-activated" handler="on_accounts_listbox_row_activated" object="CcOnlineAccountsPanel" swapped="yes" />
<style>
<class name="boxed-list" />
</style>
<accessibility>
<relation name="labelled-by">accounts_frame</relation>
</accessibility>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Connect an Account</property>
<child>
<object class="GtkListBox" id="providers_listbox">
<property name="selection_mode">none</property>
<signal name="row-activated" handler="on_provider_row_activated_cb" object="CcOnlineAccountsPanel" swapped="yes" />
<style>
<class name="boxed-list" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Connect an Account</property>
<child>
<object class="GtkListBox" id="providers_listbox">
<property name="selection_mode">none</property>
<signal name="row-activated" handler="on_provider_row_activated_cb" object="CcOnlineAccountsPanel" swapped="yes" />
<style>
<class name="boxed-list" />
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>