sharing: Use AdwPreferencesPage/AdwPreferencesGroup in all dialogs
This commit is contained in:
parent
cacc2b5bef
commit
45a5a1e0e7
2 changed files with 38 additions and 87 deletions
|
@ -70,13 +70,13 @@ struct _CcSharingPanel
|
|||
GtkWidget *personal_file_sharing_dialog;
|
||||
GtkWidget *personal_file_sharing_vbox;
|
||||
GtkWidget *personal_file_sharing_headerbar;
|
||||
GtkWidget *personal_file_sharing_label;
|
||||
AdwPreferencesPage *personal_file_sharing_page;
|
||||
GtkWidget *personal_file_sharing_password_entry_row;
|
||||
GtkWidget *personal_file_sharing_require_password_switch_row;
|
||||
GtkWidget *personal_file_sharing_row;
|
||||
GtkWidget *personal_file_sharing_switch;
|
||||
GtkWidget *remote_login_dialog;
|
||||
GtkWidget *remote_login_label;
|
||||
AdwPreferencesPage *remote_login_page;
|
||||
GtkWidget *remote_login_row;
|
||||
GtkWidget *remote_login_switch;
|
||||
|
||||
|
@ -141,13 +141,13 @@ cc_sharing_panel_class_init (CcSharingPanelClass *klass)
|
|||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, media_sharing_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, personal_file_sharing_dialog);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, personal_file_sharing_headerbar);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, personal_file_sharing_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, personal_file_sharing_page);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, personal_file_sharing_password_entry_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, personal_file_sharing_require_password_switch_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, personal_file_sharing_vbox);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, personal_file_sharing_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, remote_login_dialog);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, remote_login_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, remote_login_page);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, remote_login_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, remote_login_switch);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcSharingPanel, shared_folders_listbox);
|
||||
|
@ -525,20 +525,20 @@ cc_sharing_panel_setup_media_sharing_dialog (CcSharingPanel *self)
|
|||
|
||||
static void
|
||||
cc_sharing_panel_setup_label_with_hostname (CcSharingPanel *self,
|
||||
GtkWidget *label)
|
||||
AdwPreferencesPage *page)
|
||||
{
|
||||
g_autofree gchar *text = NULL;
|
||||
const gchar *hostname;
|
||||
|
||||
hostname = gtk_editable_get_text (GTK_EDITABLE (self->hostname_entry));
|
||||
|
||||
if (label == self->personal_file_sharing_label)
|
||||
if (page == self->personal_file_sharing_page)
|
||||
{
|
||||
g_autofree gchar *url = g_strdup_printf ("<a href=\"dav://%s\">dav://%s</a>", hostname, hostname);
|
||||
/* TRANSLATORS: %s is replaced with a link to a dav://<hostname> URL */
|
||||
text = g_strdup_printf (_("File Sharing allows you to share your Public folder with others on your current network using: %s"), url);
|
||||
}
|
||||
else if (label == self->remote_login_label)
|
||||
else if (page == self->remote_login_page)
|
||||
{
|
||||
g_autofree gchar *command = g_strdup_printf ("<a href=\"ssh %s\">ssh %s</a>", hostname, hostname);
|
||||
/* TRANSLATORS: %s is replaced with a link to a "ssh <hostname>" command to run */
|
||||
|
@ -547,7 +547,7 @@ cc_sharing_panel_setup_label_with_hostname (CcSharingPanel *self,
|
|||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (label), text);
|
||||
adw_preferences_page_set_description (ADW_PREFERENCES_PAGE (page), text);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -700,8 +700,8 @@ sharing_proxy_ready (GObject *source,
|
|||
gtk_window_set_transient_for (GTK_WINDOW (self->remote_login_dialog),
|
||||
GTK_WINDOW (parent));
|
||||
|
||||
cc_sharing_panel_setup_label_with_hostname (self, self->personal_file_sharing_label);
|
||||
cc_sharing_panel_setup_label_with_hostname (self, self->remote_login_label);
|
||||
cc_sharing_panel_setup_label_with_hostname (self, self->personal_file_sharing_page);
|
||||
cc_sharing_panel_setup_label_with_hostname (self, self->remote_login_page);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -81,44 +81,36 @@
|
|||
<object class="AdwHeaderBar" id="personal_file_sharing_headerbar"/>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<object class="AdwPreferencesPage" id="personal_file_sharing_page">
|
||||
<child>
|
||||
<object class="AdwClamp">
|
||||
<property name="margin_start">12</property>
|
||||
<property name="margin_end">12</property>
|
||||
<property name="margin_top">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="personal_file_sharing_require_password_switch_row">
|
||||
<property name="title" translatable="yes">_Require Password</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPasswordEntryRow" id="personal_file_sharing_password_entry_row">
|
||||
<property name="title" translatable="yes">_Password</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<property name="title" translatable="yes">Networks</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="personal_file_sharing_vbox">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="personal_file_sharing_label">
|
||||
<property name="xalign">0</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max-width-chars">36</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox">
|
||||
<property name="selection-mode">none</property>
|
||||
<style>
|
||||
<class name="boxed-list"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="AdwSwitchRow" id="personal_file_sharing_require_password_switch_row">
|
||||
<property name="title" translatable="yes">_Require Password</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="AdwPasswordEntryRow" id="personal_file_sharing_password_entry_row">
|
||||
<property name="title" translatable="yes">_Password</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -136,6 +128,10 @@
|
|||
<property name="resizable">False</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="hide-on-close">True</property>
|
||||
<property name="width-request">360</property>
|
||||
<property name="height-request">294</property>
|
||||
<property name="default-width">360</property>
|
||||
<property name="default-height">294</property>
|
||||
<child>
|
||||
<object class="GtkShortcutController">
|
||||
<property name="scope">managed</property>
|
||||
|
@ -153,21 +149,7 @@
|
|||
<object class="AdwHeaderBar"/>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="GtkBox">
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<property name="spacing">12</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="remote_login_label">
|
||||
<property name="xalign">0</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="wrap">True</property>
|
||||
<property name="max-width-chars">36</property>
|
||||
</object>
|
||||
</child>
|
||||
<object class="AdwPreferencesPage" id="remote_login_page">
|
||||
<child>
|
||||
<object class="AdwPreferencesGroup">
|
||||
<child>
|
||||
|
@ -209,46 +191,15 @@
|
|||
<object class="AdwHeaderBar" id="media_sharing_headerbar"/>
|
||||
</child>
|
||||
<property name="content">
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar_policy">never</property>
|
||||
<object class="AdwPreferencesPage">
|
||||
<property name="description" translatable="yes">Share music, photos and videos over the network.</property>
|
||||
<child>
|
||||
<object class="AdwClamp">
|
||||
<object class="AdwPreferencesGroup">
|
||||
<property name="title" translatable="yes">Folders</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="shared_folders_grid">
|
||||
<property name="margin_start">12</property>
|
||||
<property name="margin_end">12</property>
|
||||
<property name="margin_top">12</property>
|
||||
<property name="margin_bottom">12</property>
|
||||
<property name="row_spacing">12</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label13">
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Share music, photos and videos over the network.</property>
|
||||
<property name="max-width-chars">36</property>
|
||||
<property name="wrap">True</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label15">
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Folders</property>
|
||||
<property name="mnemonic_widget">shared_folders_listbox</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
<style>
|
||||
<class name="heading"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBox" id="shared_folders_listbox">
|
||||
<property name="selection-mode">none</property>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue