diff options
-rw-r--r-- | data/CMakeLists.txt | 20 | ||||
-rw-r--r-- | data/com.canonical.indicator.session.gschema.xml.in | 5 | ||||
-rw-r--r-- | data/indicator-session.conf.in | 3 | ||||
-rw-r--r-- | data/indicator-session.desktop.in | 4 | ||||
-rw-r--r-- | data/indicator-session.upstart.desktop.in | 9 | ||||
-rw-r--r-- | debian/changelog | 13 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | src/service.c | 59 | ||||
-rw-r--r-- | tests/com.canonical.indicator.session.gschema.xml | 7 | ||||
-rw-r--r-- | tests/test-service.cc | 10 |
10 files changed, 117 insertions, 14 deletions
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 163e2cd..a6a2e9f 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -57,6 +57,26 @@ configure_file ("${XDG_AUTOSTART_FILE_IN}" "${XDG_AUTOSTART_FILE}") install (FILES "${XDG_AUTOSTART_FILE}" DESTINATION "${XDG_AUTOSTART_DIR}") +## +## Upstart XDG Autostart Override +## + +# where to install +set (UPSTART_XDG_AUTOSTART_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/upstart/xdg/autostart") +message (STATUS "${UPSTART_XDG_AUTOSTART_DIR} is the Upstart XDG autostart override dir") + +set (UPSTART_XDG_AUTOSTART_NAME "${CMAKE_PROJECT_NAME}.upstart.desktop") +set (UPSTART_XDG_AUTOSTART_FILE "${CMAKE_CURRENT_BINARY_DIR}/${UPSTART_XDG_AUTOSTART_NAME}") +set (UPSTART_XDG_AUTOSTART_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${UPSTART_XDG_AUTOSTART_NAME}.in") + +# build it +set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}") +configure_file ("${UPSTART_XDG_AUTOSTART_FILE_IN}" "${UPSTART_XDG_AUTOSTART_FILE}") + +# install it +install (FILES "${UPSTART_XDG_AUTOSTART_FILE}" + DESTINATION "${UPSTART_XDG_AUTOSTART_DIR}" + RENAME "${XDG_AUTOSTART_NAME}") ## ## Unity Indicator File diff --git a/data/com.canonical.indicator.session.gschema.xml.in b/data/com.canonical.indicator.session.gschema.xml.in index 6010b3f..d5e852e 100644 --- a/data/com.canonical.indicator.session.gschema.xml.in +++ b/data/com.canonical.indicator.session.gschema.xml.in @@ -25,6 +25,11 @@ <summary>Determine the visibility of the User's real name on the panel</summary> <description>Allow for the Removal of the users name from the panel</description> </key> + <key type="b" name="user-show-menu"> + <default>true</default> + <summary>Show the list of users</summary> + <description>Allow for the user list to be hidden by the user.</description> + </key> </schema> diff --git a/data/indicator-session.conf.in b/data/indicator-session.conf.in index 6bd93a2..c7530e3 100644 --- a/data/indicator-session.conf.in +++ b/data/indicator-session.conf.in @@ -1,8 +1,9 @@ description "Indicator Session Service" -start on indicators-loaded or indicator-services-start +start on indicator-services-start stop on desktop-end or indicator-services-end respawn +respawn limit 2 10 exec @pkglibexecdir@/indicator-session-service diff --git a/data/indicator-session.desktop.in b/data/indicator-session.desktop.in index b6d289d..10dcadd 100644 --- a/data/indicator-session.desktop.in +++ b/data/indicator-session.desktop.in @@ -2,8 +2,8 @@ Type=Application Name=Indicator Session Exec=@pkglibexecdir@/indicator-session-service -NotShowIn=Unity; +OnlyShowIn=Unity;GNOME; NoDisplay=true StartupNotify=false Terminal=false - +AutostartCondition=GNOME3 unless-session gnome diff --git a/data/indicator-session.upstart.desktop.in b/data/indicator-session.upstart.desktop.in new file mode 100644 index 0000000..f4970f6 --- /dev/null +++ b/data/indicator-session.upstart.desktop.in @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Name=Indicator Session +Exec=@pkglibexecdir@/indicator-session-service +OnlyShowIn=Unity; +NoDisplay=true +StartupNotify=false +Terminal=false +Hidden=true diff --git a/debian/changelog b/debian/changelog index e34c3d3..7143125 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +indicator-session (12.10.5+14.04.20140320-0ubuntu1) trusty; urgency=low + + [ Charles Kerr ] + * Don't show the lockscreen accelerator in switch-user mode. (LP: + #1241906) + * indicator-session relies on the org.gnome.desktop.lockdown schema + provided by gsettings-desktop-schemas. (LP: #1212664) + + [ Ted Gould ] + * Synchronize process management across indicators + + -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Thu, 20 Mar 2014 19:18:01 +0000 + indicator-session (12.10.5+14.04.20140311.1-0ubuntu1) trusty; urgency=low [ Marco Trevisan (Treviño) ] diff --git a/debian/control b/debian/control index 03c19f2..fb067cc 100644 --- a/debian/control +++ b/debian/control @@ -25,6 +25,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, systemd-services, gnome-settings-daemon-schemas, + gsettings-desktop-schemas, Recommends: indicator-applet (>= 0.2) | indicator-renderer, gnome-screensaver, yelp, diff --git a/src/service.c b/src/service.c index e998d16..68fbc50 100644 --- a/src/service.c +++ b/src/service.c @@ -152,6 +152,14 @@ rebuild_settings_section_soon (IndicatorSessionService * self) **** ***/ +static gboolean +show_user_list (IndicatorSessionService * self) +{ + return g_settings_get_boolean (self->priv->indicator_settings, + "user-show-menu"); +} + + static GVariant * action_state_for_header (IndicatorSessionService * self) { @@ -240,6 +248,32 @@ on_user_changed (IndicatorSessionUsers * backend_users G_GNUC_UNUSED, } static void +maybe_add_users (IndicatorSessionService * self) +{ + if (!show_user_list (self)) + return; + + GList * uids, * l; + + uids = indicator_session_users_get_uids (self->priv->backend_users); + for (l=uids; l!=NULL; l=l->next) + add_user (self, GPOINTER_TO_UINT(l->data)); + g_list_free (uids); +} + + +static void +user_show_menu_changed (IndicatorSessionService * self) +{ + if (show_user_list (self)) + maybe_add_users (self); + else + g_hash_table_remove_all (self->priv->users); + + rebuild_switch_section_soon (self); +} + +static void on_user_removed (IndicatorSessionUsers * backend_users G_GNUC_UNUSED, guint uid, gpointer gself) @@ -457,9 +491,9 @@ serialize_icon_file (const gchar * filename) static GMenuModel * create_switch_section (IndicatorSessionService * self, int profile) { - gchar * str; GMenu * menu; GMenuItem * item; + gboolean want_accel; guint i; gpointer guser; GHashTableIter iter; @@ -474,6 +508,7 @@ create_switch_section (IndicatorSessionService * self, int profile) { const char * action = "indicator.switch-to-screensaver"; item = g_menu_item_new (_("Start Screen Saver"), action); + want_accel = TRUE; } else if (profile == PROFILE_LOCKSCREEN || indicator_session_guest_is_active (p->backend_guest)) @@ -481,6 +516,7 @@ create_switch_section (IndicatorSessionService * self, int profile) const char * action = "indicator.switch-to-greeter"; item = g_menu_item_new (ellipsis ? _("Switch Account…") : _("Switch Account"), action); + want_accel = FALSE; } else { @@ -491,11 +527,13 @@ create_switch_section (IndicatorSessionService * self, int profile) else item = g_menu_item_new (ellipsis ? _("Lock/Switch Account…") : _("Lock/Switch Account"), action); + + want_accel = TRUE; } - if (profile != PROFILE_LOCKSCREEN) + if (want_accel) { - str = g_settings_get_string (p->keybinding_settings, "screensaver"); + gchar * str = g_settings_get_string (p->keybinding_settings, "screensaver"); g_menu_item_set_attribute (item, "accel", "s", str); g_free (str); } @@ -514,7 +552,11 @@ create_switch_section (IndicatorSessionService * self, int profile) g_object_unref (item); } - /* build an array of all the users we know of */ + /* if we need to show the user list, build an array of all the users we know + * of, otherwise get out now */ + if (!show_user_list (self)) + return G_MENU_MODEL (menu); + users = g_ptr_array_new (); g_hash_table_iter_init (&iter, p->users); while (g_hash_table_iter_next (&iter, NULL, &guser)) @@ -1026,8 +1068,6 @@ static void /* cppcheck-suppress unusedFunction */ indicator_session_service_init (IndicatorSessionService * self) { - GList * l; - GList * uids; priv_t * p; gpointer gp; GIcon * icon; @@ -1055,10 +1095,7 @@ indicator_session_service_init (IndicatorSessionService * self) g_direct_equal, NULL, (GDestroyNotify)indicator_session_user_free); - uids = indicator_session_users_get_uids (p->backend_users); - for (l=uids; l!=NULL; l=l->next) - add_user (self, GPOINTER_TO_UINT(l->data)); - g_list_free (uids); + maybe_add_users (self); init_gactions (self); @@ -1105,6 +1142,8 @@ indicator_session_service_init (IndicatorSessionService * self) G_CALLBACK(rebuild_session_section_soon), self); g_signal_connect_swapped (gp, "changed::show-real-name-on-panel", G_CALLBACK(rebuild_header_soon), self); + g_signal_connect_swapped (gp, "changed::user-show-menu", + G_CALLBACK(user_show_menu_changed), self); /* watch for changes to the lock keybinding */ gp = p->keybinding_settings; diff --git a/tests/com.canonical.indicator.session.gschema.xml b/tests/com.canonical.indicator.session.gschema.xml index 76b2be3..60e680b 100644 --- a/tests/com.canonical.indicator.session.gschema.xml +++ b/tests/com.canonical.indicator.session.gschema.xml @@ -26,7 +26,12 @@ <summary>Determine the visibility of the User's real name on the panel</summary> <description>Allow for the Removal of the users name from the panel</description> </key> + <key type="b" name="user-show-menu"> + <default>true</default> + <summary>Show the list of users</summary> + <description>Allow for the user menu to be hidden by the user.</description> + </key> </schema> -</schemalist>
\ No newline at end of file +</schemalist> diff --git a/tests/test-service.cc b/tests/test-service.cc index 0815d19..ab84459 100644 --- a/tests/test-service.cc +++ b/tests/test-service.cc @@ -807,6 +807,16 @@ TEST_F (ServiceTest, User) check_label ("Third Doctor", switch_menu, 8); g_clear_object (&switch_menu); + /* Hide the user list */ + g_settings_set_boolean (indicator_settings, "user-show-menu", FALSE); + wait_for_menu_resync (); + // now there should be 2 menuitems: greeter + guest + ASSERT_TRUE (find_menu_item_for_action ("indicator.switch-to-screensaver", &switch_menu, &pos)); + ASSERT_EQ (0, pos); + ASSERT_EQ (2, g_menu_model_get_n_items (switch_menu)); + g_clear_object (&switch_menu); + g_settings_set_boolean (indicator_settings, "user-show-menu", TRUE); + // now switch to one of the doctors g_action_group_activate_action (G_ACTION_GROUP(action_group), "switch-to-user", |