aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog19
-rw-r--r--debian/control4
-rw-r--r--src/backend-dbus/actions.c31
-rw-r--r--src/service.c19
-rw-r--r--tests/test-service.cc30
5 files changed, 95 insertions, 8 deletions
diff --git a/debian/changelog b/debian/changelog
index 8788626..c58bc0f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,22 @@
+indicator-session (12.10.5+14.04.20140124-0ubuntu1) trusty; urgency=low
+
+ [ Robert Ancell ]
+ * Recommend yelp, gnome-control-center and gnome-control-center-signon
+ since we try and launch these applications.
+ * Use username as label if the real name is empty or whitespace. (LP:
+ #872908)
+ * Use unity-control-center if it is available. (LP: #1257505)
+
+ [ Sebastien Bacher ]
+ * clean out the extra-sessions directory, it's a leftover.
+ * drop unused cmake file, it refears to geary and doesn't seem useful
+ there.
+
+ [ Ubuntu daily release ]
+ * Automatic snapshot from revision 426
+
+ -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 24 Jan 2014 11:02:01 +0000
+
indicator-session (12.10.5+14.04.20131125-0ubuntu1) trusty; urgency=low
[ Charles Kerr ]
diff --git a/debian/control b/debian/control
index ae76274..f9be310 100644
--- a/debian/control
+++ b/debian/control
@@ -28,8 +28,8 @@ Depends: ${shlibs:Depends},
Recommends: indicator-applet (>= 0.2) | indicator-renderer,
gnome-screensaver,
yelp,
- gnome-control-center,
- gnome-control-center-signon
+ unity-control-center | gnome-control-center,
+ unity-control-center-signon | gnome-control-center-signon
Suggests: lightdm,
zenity
Description: indicator showing session management, status and user switching
diff --git a/src/backend-dbus/actions.c b/src/backend-dbus/actions.c
index fcf850d..b1fa8ac 100644
--- a/src/backend-dbus/actions.c
+++ b/src/backend-dbus/actions.c
@@ -711,22 +711,47 @@ my_help (IndicatorSessionActions * self G_GNUC_UNUSED)
run_outside_app ("yelp");
}
+static gboolean
+have_unity_control_center (void)
+{
+ gchar *path;
+ gboolean have_ucc;
+
+ if (g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity") != 0)
+ return FALSE;
+
+ path = g_find_program_in_path ("unity-control-center");
+ have_ucc = path != NULL;
+ g_free (path);
+
+ return have_ucc;
+}
+
static void
my_settings (IndicatorSessionActions * self G_GNUC_UNUSED)
{
- run_outside_app ("gnome-control-center");
+ if (have_unity_control_center ())
+ run_outside_app ("unity-control-center");
+ else
+ run_outside_app ("gnome-control-center");
}
static void
my_online_accounts (IndicatorSessionActions * self G_GNUC_UNUSED)
{
- run_outside_app ("gnome-control-center credentials");
+ if (have_unity_control_center ())
+ run_outside_app ("unity-control-center credentials");
+ else
+ run_outside_app ("gnome-control-center credentials");
}
static void
my_about (IndicatorSessionActions * self G_GNUC_UNUSED)
{
- run_outside_app ("gnome-control-center info");
+ if (have_unity_control_center ())
+ run_outside_app ("unity-control-center info");
+ else
+ run_outside_app ("gnome-control-center info");
}
/***
diff --git a/src/service.c b/src/service.c
index 9d9b953..2bccaae 100644
--- a/src/service.c
+++ b/src/service.c
@@ -274,6 +274,19 @@ on_user_removed (IndicatorSessionUsers * backend_users G_GNUC_UNUSED,
}
static const char *
+get_user_label (const IndicatorSessionUser * user)
+{
+ const char * c;
+
+ /* If blank or whitespace, use username instead */
+ for (c = user->real_name; *c != '\0' && g_ascii_isspace (*c); c++);
+ if (*c == '\0')
+ return user->user_name;
+
+ return user->real_name;
+}
+
+static const char *
get_current_real_name (IndicatorSessionService * self)
{
GHashTableIter iter;
@@ -289,7 +302,7 @@ get_current_real_name (IndicatorSessionService * self)
{
IndicatorSessionUser * user = value;
if (user->is_current_user)
- return user->real_name;
+ return get_user_label (user);
}
return "";
@@ -435,7 +448,7 @@ compare_users_by_label (gconstpointer ga, gconstpointer gb)
const IndicatorSessionUser * a = *(const IndicatorSessionUser**)ga;
const IndicatorSessionUser * b = *(const IndicatorSessionUser**)gb;
- if ((i = g_strcmp0 (a->real_name, b->real_name)))
+ if ((i = g_strcmp0 (get_user_label (a), get_user_label (b))))
return i;
return g_strcmp0 (a->user_name, b->user_name);
@@ -536,7 +549,7 @@ create_switch_section (IndicatorSessionService * self)
const IndicatorSessionUser * u = g_ptr_array_index (users, i);
GVariant * serialized_icon;
- item = g_menu_item_new (u->real_name, NULL);
+ item = g_menu_item_new (get_user_label (u), NULL);
g_menu_item_set_action_and_target (item, "indicator.switch-to-user", "s", u->user_name);
g_menu_item_set_attribute (item, "x-canonical-type", "s", "indicator.user-menu-item");
diff --git a/tests/test-service.cc b/tests/test-service.cc
index 5ec86d2..f14fe61 100644
--- a/tests/test-service.cc
+++ b/tests/test-service.cc
@@ -819,3 +819,33 @@ TEST_F (ServiceTest, User)
wait_for_signal (mock_settings, "changed::last-command");
check_last_command_is ("switch-to-user::tbaker");
}
+
+TEST_F (ServiceTest, UserLabels)
+{
+ int pos = 0;
+ GMenuModel * switch_menu = 0;
+
+ // Check label uses username when real name is blank
+ IndicatorSessionUser * u = g_new0 (IndicatorSessionUser, 1);
+ u->uid = 100;
+ u->user_name = g_strdup ("blank");
+ u->real_name = g_strdup ("");
+ indicator_session_users_mock_add_user (INDICATOR_SESSION_USERS_MOCK(mock_users), u);
+ wait_for_menu_resync ();
+ ASSERT_TRUE (find_menu_item_for_action ("indicator.switch-to-screensaver", &switch_menu, &pos));
+ check_label ("blank", switch_menu, 2);
+ g_clear_object (&switch_menu);
+ indicator_session_users_mock_remove_user (INDICATOR_SESSION_USERS_MOCK(mock_users), 100);
+
+ // Check label uses username when real name is all whitespace
+ u = g_new0 (IndicatorSessionUser, 1);
+ u->uid = 100;
+ u->user_name = g_strdup ("whitespace");
+ u->real_name = g_strdup (" ");
+ indicator_session_users_mock_add_user (INDICATOR_SESSION_USERS_MOCK(mock_users), u);
+ wait_for_menu_resync ();
+ ASSERT_TRUE (find_menu_item_for_action ("indicator.switch-to-screensaver", &switch_menu, &pos));
+ check_label ("whitespace", switch_menu, 2);
+ g_clear_object (&switch_menu);
+ indicator_session_users_mock_remove_user (INDICATOR_SESSION_USERS_MOCK(mock_users), 100);
+}