[gnome-control-center/T20771: 13/44] region: replace the "Login Screen" button
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/T20771: 13/44] region: replace the "Login Screen" button
- Date: Tue, 23 Jan 2018 21:07:39 +0000 (UTC)
commit 237e92d6c7c83acd361249490d2062a594c022e9
Author: Felipe Erias Morandeira <femorandeira igalia com>
Date: Thu Apr 10 13:44:03 2014 +0200
region: replace the "Login Screen" button
...on the title bar with joined toggles (like in Background panel) for a
clearer UI.
[endlessm/eos-shell#2152]
panels/region/cc-region-panel.c | 36 +++++++++--------------------
panels/region/region.ui | 48 +++++++++++++++++++++++++++++++++++++-
2 files changed, 57 insertions(+), 27 deletions(-)
---
diff --git a/panels/region/cc-region-panel.c b/panels/region/cc-region-panel.c
index 2fe1771..ac1315a 100644
--- a/panels/region/cc-region-panel.c
+++ b/panels/region/cc-region-panel.c
@@ -89,6 +89,10 @@ struct _CcRegionPanelPrivate {
GtkWidget *restart_notification;
gchar *needs_restart_file_path;
+ GtkWidget *hbox_selector;
+ GtkWidget *session_language_button;
+ GtkWidget *login_language_button;
+
GtkWidget *language_section;
GtkListBoxRow *language_row;
GtkWidget *language_label;
@@ -171,19 +175,6 @@ cc_region_panel_finalize (GObject *object)
G_OBJECT_CLASS (cc_region_panel_parent_class)->finalize (object);
}
-static void
-cc_region_panel_constructed (GObject *object)
-{
- CcRegionPanel *self = CC_REGION_PANEL (object);
- CcRegionPanelPrivate *priv = self->priv;
-
- G_OBJECT_CLASS (cc_region_panel_parent_class)->constructed (object);
-
- if (priv->permission)
- cc_shell_embed_widget_in_header (cc_panel_get_shell (CC_PANEL (object)),
- priv->login_button);
-}
-
static const char *
cc_region_panel_get_help_uri (CcPanel *panel)
{
@@ -200,7 +191,6 @@ cc_region_panel_class_init (CcRegionPanelClass * klass)
panel_class->get_help_uri = cc_region_panel_get_help_uri;
- object_class->constructed = cc_region_panel_constructed;
object_class->finalize = cc_region_panel_finalize;
}
@@ -1689,8 +1679,6 @@ localed_proxy_ready (GObject *source,
priv = self->priv;
priv->localed = proxy;
- gtk_widget_set_sensitive (priv->login_button, TRUE);
-
g_signal_connect (priv->localed, "g-properties-changed",
G_CALLBACK (on_localed_properties_changed), self);
on_localed_properties_changed (priv->localed, NULL, NULL, self);
@@ -1702,7 +1690,7 @@ login_changed (CcRegionPanel *self)
CcRegionPanelPrivate *priv = self->priv;
gboolean can_acquire;
- priv->login = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->login_button));
+ priv->login = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->login_language_button));
gtk_widget_set_visible (priv->login_label, priv->login);
can_acquire = priv->permission &&
@@ -1736,7 +1724,7 @@ set_login_button_visibility (CcRegionPanel *self)
g_object_get (priv->user_manager, "has-multiple-users", &has_multiple_users, NULL);
priv->login_auto_apply = !has_multiple_users && g_permission_get_allowed (priv->permission);
- gtk_widget_set_visible (priv->login_button, !priv->login_auto_apply);
+ gtk_widget_set_visible (priv->hbox_selector, !priv->login_auto_apply);
g_signal_handlers_disconnect_by_func (priv->user_manager, set_login_button_visibility, self);
}
@@ -1770,13 +1758,11 @@ setup_login_button (CcRegionPanel *self)
g_object_unref (bus);
priv->login_label = WID ("login-label");
- priv->login_button = gtk_toggle_button_new_with_mnemonic (_("Login _Screen"));
- gtk_style_context_add_class (gtk_widget_get_style_context (priv->login_button),
- "text-button");
- gtk_widget_set_valign (priv->login_button, GTK_ALIGN_CENTER);
- gtk_widget_set_visible (priv->login_button, FALSE);
- gtk_widget_set_sensitive (priv->login_button, FALSE);
- g_signal_connect_swapped (priv->login_button, "notify::active",
+ priv->hbox_selector = WID ("hbox-selector");
+ priv->session_language_button = WID ("session-language-button");
+ priv->login_language_button = WID ("login-language-button");
+
+ g_signal_connect_swapped (priv->login_language_button, "notify::active",
G_CALLBACK (login_changed), self);
g_object_get (priv->user_manager, "is-loaded", &loaded, NULL);
diff --git a/panels/region/region.ui b/panels/region/region.ui
index 7e8f8d5..9319865 100644
--- a/panels/region/region.ui
+++ b/panels/region/region.ui
@@ -35,6 +35,50 @@
<property name="spacing">12</property>
<property name="hexpand">True</property>
<child>
+ <object class="GtkBox" id="hbox-selector">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">horizontal</property>
+ <property name="homogeneous">True</property>
+ <property name="halign">center</property>
+ <property name="hexpand">True</property>
+ <style>
+ <class name="linked"/>
+ </style>
+ <child>
+ <object class="GtkRadioButton" id="session-language-button">
+ <property name="label" translatable="yes">My Account</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">False</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="login-language-button">
+ <property name="label" translatable="yes">Login Screen</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="active">False</property>
+ <property name="draw_indicator">False</property>
+ <property name="group">session-language-button</property>
+ <style>
+ <class name="raised"/>
+ </style>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkFrame" id="language_section">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -205,7 +249,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -519,7 +563,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]