diff options
| author | Andrea Azzarone <azzaronea@gmail.com> | 2014-02-20 21:52:57 +0100 |
|---|---|---|
| committer | Andrea Azzarone <azzaronea@gmail.com> | 2014-02-20 21:52:57 +0100 |
| commit | c8432ca9a41f5e98ed9a35643ff603f5e088b859 (patch) | |
| tree | 7fc0d4b4b30f60833dc13697dc74da5f89aaebb2 /services | |
| parent | 68fda05391c8b40223c611a9dace4b77dd5347ed (diff) | |
| parent | a9e17d7cd61fd0f41f5e74df226763bf3fcb993e (diff) | |
Merge trunk.
(bzr r3566.5.438)
Diffstat (limited to 'services')
| -rw-r--r-- | services/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | services/panel-main.c | 23 | ||||
| -rw-r--r-- | services/panel-service.c | 24 | ||||
| -rw-r--r-- | services/panel-service.h | 2 | ||||
| -rw-r--r-- | services/unity-panel-service-lockscreen.conf.in | 8 |
5 files changed, 53 insertions, 7 deletions
diff --git a/services/CMakeLists.txt b/services/CMakeLists.txt index 8ce92ca10..103c8854c 100644 --- a/services/CMakeLists.txt +++ b/services/CMakeLists.txt @@ -58,3 +58,6 @@ install(TARGETS unity-panel-service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/unit configure_file(unity-panel-service.conf.in ${CMAKE_CURRENT_BINARY_DIR}/unity-panel-service.conf) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unity-panel-service.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/share/upstart/sessions) + +configure_file(unity-panel-service-lockscreen.conf.in ${CMAKE_CURRENT_BINARY_DIR}/unity-panel-service-lockscreen.conf) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unity-panel-service-lockscreen.conf DESTINATION ${CMAKE_INSTALL_PREFIX}/share/upstart/sessions) diff --git a/services/panel-main.c b/services/panel-main.c index 3cfefae2d..adf8143e7 100644 --- a/services/panel-main.c +++ b/services/panel-main.c @@ -100,7 +100,8 @@ static const gchar introspection_xml[] = " </interface>" "</node>"; -#define S_NAME "com.canonical.Unity.Panel.Service" +#define S_NAME_DESKTOP "com.canonical.Unity.Panel.ServiceDesktop" +#define S_NAME_LOCKSCREEN "com.canonical.Unity.Panel.ServiceLockscreen" #define S_PATH "/com/canonical/Unity/Panel/Service" #define S_IFACE "com.canonical.Unity.Panel.Service" @@ -406,6 +407,13 @@ main (gint argc, gchar **argv) { PanelService *service; guint owner_id; + gboolean lockscreen_mode = FALSE; + GError *error = NULL; + GOptionContext *context; + GOptionEntry entries[] = { + { "lockscreen-mode", 0, 0, G_OPTION_ARG_NONE, &lockscreen_mode, "Load indicators for the lockscreen", NULL }, + { NULL }}; + g_unsetenv ("UBUNTU_MENUPROXY"); g_setenv ("NO_AT_BRIDGE", "1", TRUE); @@ -416,6 +424,17 @@ main (gint argc, gchar **argv) INDICATORICONDIR); ido_init (); + context = g_option_context_new ("- Unity Panel Service"); + g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); + if (!g_option_context_parse (context, &argc, &argv, &error)) + { + g_print ("unity-panel-service: %s\n", error->message); + g_print ("Try --help for more information.\n"); + return 1; + } + + panel_service_set_lockscreen_mode (lockscreen_mode); + if (g_getenv ("SILENT_PANEL_SERVICE") != NULL) { g_log_set_default_handler (discard_log_message, NULL); @@ -429,7 +448,7 @@ main (gint argc, gchar **argv) service = panel_service_get_default (); owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, - S_NAME, + !lockscreen_mode ? S_NAME_DESKTOP : S_NAME_LOCKSCREEN, G_BUS_NAME_OWNER_FLAGS_NONE, on_bus_acquired, on_name_acquired, diff --git a/services/panel-service.c b/services/panel-service.c index 1b44048d9..2c6f26904 100644 --- a/services/panel-service.c +++ b/services/panel-service.c @@ -53,6 +53,7 @@ G_DEFINE_TYPE (PanelService, panel_service, G_TYPE_OBJECT); #define SHOW_HUD_KEY "show-hud" static PanelService *static_service = NULL; +static gboolean lockscreen_mode = FALSE; struct _PanelServicePrivate { @@ -150,7 +151,7 @@ panel_service_class_dispose (GObject *self) g_idle_remove_by_data (self); gdk_window_remove_filter (NULL, (GdkFilterFunc)event_filter, self); - if (priv->upstart != NULL) + if (priv->upstart != NULL && !lockscreen_mode) { int event_sent = 0; event_sent = upstart_emit_event_sync (NULL, priv->upstart, @@ -461,6 +462,9 @@ event_filter (GdkXEvent *ev, GdkEvent *gev, PanelService *self) { case XI_KeyPress: { + if (lockscreen_mode) + break; + KeySym keysym = XkbKeycodeToKeysym (event->display, event->detail, 0, 0); if (event_matches_keybinding (event->mods.base, keysym, &priv->menu_toggle) || @@ -586,7 +590,7 @@ initial_resync (PanelService *self) static gboolean ready_signal (PanelService *self) { - if (PANEL_IS_SERVICE (self) && self->priv->upstart != NULL) + if (PANEL_IS_SERVICE (self) && self->priv->upstart != NULL && !lockscreen_mode) { int event_sent = 0; event_sent = upstart_emit_event_sync (NULL, self->priv->upstart, "indicator-services-start", NULL, 0); @@ -714,7 +718,7 @@ panel_service_init (PanelService *self) update_keybinding (priv->gsettings, SHOW_HUD_KEY, &priv->show_hud); const gchar *upstartsession = g_getenv ("UPSTART_SESSION"); - if (upstartsession != NULL) + if (upstartsession != NULL && !lockscreen_mode) { DBusConnection *conn = dbus_connection_open (upstartsession, NULL); if (conn != NULL) @@ -859,7 +863,11 @@ initial_load_default_or_custom_indicators (PanelService *self, GList *indicators if (!indicators) { - load_indicators (self); + if (!lockscreen_mode) + { + load_indicators (self); + } + load_indicators_from_indicator_files (self); sort_indicators (self); } @@ -908,6 +916,12 @@ panel_service_get_default_with_indicators (GList *indicators) return self; } +void +panel_service_set_lockscreen_mode (gboolean enable) +{ + lockscreen_mode = enable; +} + guint panel_service_get_n_indicators (PanelService *self) { @@ -1313,7 +1327,7 @@ load_indicators_from_indicator_files (PanelService *self) IndicatorNg *indicator; filename = g_build_filename (INDICATOR_SERVICE_DIR, name, NULL); - indicator = indicator_ng_new_for_profile (filename, "desktop", &error); + indicator = indicator_ng_new_for_profile (filename, !lockscreen_mode ? "desktop" : "desktop_greeter", &error); if (indicator) { load_indicator (self, INDICATOR_OBJECT (indicator), name); diff --git a/services/panel-service.h b/services/panel-service.h index f386ffdf1..a4c76ac25 100644 --- a/services/panel-service.h +++ b/services/panel-service.h @@ -71,6 +71,8 @@ GType panel_service_get_type (void) G_GNUC_CONST; PanelService * panel_service_get_default (); PanelService * panel_service_get_default_with_indicators (GList *indicators); +void panel_service_set_lockscreen_mode (gboolean enable); + guint panel_service_get_n_indicators (PanelService *self); IndicatorObject * panel_service_get_indicator_nth (PanelService *self, guint position); diff --git a/services/unity-panel-service-lockscreen.conf.in b/services/unity-panel-service-lockscreen.conf.in new file mode 100644 index 000000000..b6a3cb600 --- /dev/null +++ b/services/unity-panel-service-lockscreen.conf.in @@ -0,0 +1,8 @@ +description "Backing Service for the Unity Panel" +author "Andrea Azzarone <andrea.azzarone@canonical.com>" + +start on desktop-lock +stop on desktop-unlock + +respawn +exec ${CMAKE_INSTALL_PREFIX}/lib/unity/unity-panel-service --lockscreen-mode \ No newline at end of file |
