[gnome-control-center] user-accounts: Info message when we are offline
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] user-accounts: Info message when we are offline
- Date: Wed, 14 Aug 2013 20:32:22 +0000 (UTC)
commit 39e6b6d0449c329c42c7b7d4d34f5cecd917acc8
Author: Ondrej Holy <oholy redhat com>
Date: Thu Jul 4 13:49:51 2013 +0200
user-accounts: Info message when we are offline
https://bugzilla.gnome.org/show_bug.cgi?id=702477
panels/user-accounts/data/account-dialog.ui | 70 +++++++++++++++++++++++++++
panels/user-accounts/um-account-dialog.c | 27 ++++++++++-
2 files changed, 95 insertions(+), 2 deletions(-)
---
diff --git a/panels/user-accounts/data/account-dialog.ui b/panels/user-accounts/data/account-dialog.ui
index cba128d..9176e9b 100644
--- a/panels/user-accounts/data/account-dialog.ui
+++ b/panels/user-accounts/data/account-dialog.ui
@@ -567,6 +567,76 @@
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <object class="GtkGrid" id="enterprise-offline-area">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label18">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Enterprise login allows an existing centrally
managed user account to be used on this device.</property>
+ <property name="wrap">True</property>
+ <property name="wrap_mode">word-char</property>
+ <property name="margin_bottom">12</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">network-offline-symbolic</property>
+ <property name="pixel_size">64</property>
+ <property name="yalign">1</property>
+ <property name="vexpand">True</property>
+ <property name="hexpand">True</property>
+ <property name="margin_bottom">6</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label17">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Go online to add
+enterprise login accounts.</property>
+ <property name="yalign">0</property>
+ <property name="justify">center</property>
+ <property name="vexpand">True</property>
+ <property name="hexpand">True</property>
+ <attributes>
+ <attribute name="scale" value="1.2"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</object>
<object class="GtkDialog" id="join-dialog">
<property name="can_focus">False</property>
diff --git a/panels/user-accounts/um-account-dialog.c b/panels/user-accounts/um-account-dialog.c
index f8fd49c..0facb1f 100644
--- a/panels/user-accounts/um-account-dialog.c
+++ b/panels/user-accounts/um-account-dialog.c
@@ -37,6 +37,7 @@
typedef enum {
UM_LOCAL,
UM_ENTERPRISE,
+ UM_OFFLINE,
NUM_MODES
} UmAccountMode;
@@ -1178,6 +1179,17 @@ on_realmd_disappeared (GDBusConnection *unused1,
mode_change (self, UM_LOCAL);
}
+static void
+on_network_changed (GNetworkMonitor *monitor,
+ gboolean available,
+ gpointer user_data)
+{
+ UmAccountDialog *self = UM_ACCOUNT_DIALOG (user_data);
+
+ if (self->mode != UM_LOCAL)
+ mode_change (self, UM_ENTERPRISE);
+}
+
static gboolean
enterprise_domain_timeout (UmAccountDialog *self)
{
@@ -1247,6 +1259,7 @@ enterprise_init (UmAccountDialog *self,
GtkBuilder *builder)
{
GtkWidget *widget;
+ GNetworkMonitor *monitor;
self->enterprise_realms = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_OBJECT);
self->enterprise_check_credentials = FALSE;
@@ -1290,6 +1303,9 @@ enterprise_init (UmAccountDialog *self,
G_BUS_NAME_WATCHER_FLAGS_AUTO_START,
on_realmd_appeared, on_realmd_disappeared,
self, NULL);
+
+ monitor = g_network_monitor_get_default ();
+ g_signal_connect (monitor, "network-changed", G_CALLBACK (on_network_changed), self);
}
static void
@@ -1323,12 +1339,19 @@ static void
mode_change (UmAccountDialog *self,
UmAccountMode mode)
{
- gboolean active;
+ gboolean active, available;
+ GNetworkMonitor *monitor;
+
+ if (mode != UM_LOCAL) {
+ monitor = g_network_monitor_get_default ();
+ available = g_network_monitor_get_network_available (monitor);
+ mode = available ? UM_ENTERPRISE : UM_OFFLINE;
+ }
gtk_notebook_set_current_page (GTK_NOTEBOOK (self->container_widget), mode);
/* The enterprise toggle state */
- active = (mode == UM_ENTERPRISE);
+ active = (mode != UM_LOCAL);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->enterprise_button)) != active)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->enterprise_button), active);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]