diff options
| -rw-r--r-- | debian/control | 3 | ||||
| -rw-r--r-- | services/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | services/panel-service.c | 102 | ||||
| -rw-r--r-- | tests/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | unity-shared/UpstartWrapper.cpp | 6 |
5 files changed, 52 insertions, 64 deletions
diff --git a/debian/control b/debian/control index 0f71e41a6..bac7a398b 100644 --- a/debian/control +++ b/debian/control @@ -31,8 +31,6 @@ Build-Depends: cmake, libindicator3-dev (>= 0.12.2), libjson-glib-dev, libjson-perl, - libnih-dbus-dev, - libnih-dev, libnotify-dev, libnux-4.0-dev (>= 4.0.6), libpam0g-dev, @@ -110,7 +108,6 @@ Package: unity-services Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, - upstart-bin, Description: Services for the Unity interface Unity is a desktop experience that sings. Designed by Canonical and the Ayatana community, Unity is all about the combination of familiarity and the future. We diff --git a/services/CMakeLists.txt b/services/CMakeLists.txt index 103c8854c..b80ec71ba 100644 --- a/services/CMakeLists.txt +++ b/services/CMakeLists.txt @@ -13,9 +13,6 @@ set(UNITY_PANEL_SERVICE_DEPS x11 libido3-0.1>=13.0.0 libupstart - libnih - libnih-dbus - dbus-1 ) pkg_check_modules(SERVICE_DEPS REQUIRED ${UNITY_PANEL_SERVICE_DEPS}) diff --git a/services/panel-service.c b/services/panel-service.c index e8b2e14f3..fb010723c 100644 --- a/services/panel-service.c +++ b/services/panel-service.c @@ -34,9 +34,7 @@ #include <X11/XF86keysym.h> #include <X11/extensions/XInput2.h> -#include <upstart.h> -#include <nih/alloc.h> -#include <nih/error.h> +#include <upstart/upstart-dbus.h> G_DEFINE_TYPE (PanelService, panel_service, G_TYPE_OBJECT); @@ -87,8 +85,6 @@ struct _PanelServicePrivate IndicatorObjectEntry *pressed_entry; gboolean use_event; - - NihDBusProxy * upstart; }; /* Globals */ @@ -139,6 +135,7 @@ static void load_indicators_from_indicator_files (PanelService *); static void sort_indicators (PanelService *); static void notify_object (IndicatorObject *object); static void update_keybinding (GSettings *, const gchar *, gpointer); +static void emit_upstart_event (const gchar *); static GdkFilterReturn event_filter (GdkXEvent *, GdkEvent *, PanelService *); /* @@ -154,21 +151,8 @@ 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 && !lockscreen_mode) - { - int event_sent = 0; - event_sent = upstart_emit_event_sync (NULL, priv->upstart, - "indicator-services-end", NULL, 0); - if (event_sent != 0) - { - NihError * err = nih_error_get(); - g_warning("Unable to signal for indicator services to stop: %s", err->message); - nih_free(err); - } - - nih_unref (priv->upstart, NULL); - priv->upstart = NULL; - } + if (!lockscreen_mode) + emit_upstart_event ("indicator-services-end"); if (GTK_IS_WIDGET (priv->last_menu) && gtk_widget_get_realized (GTK_WIDGET (priv->last_menu))) @@ -699,17 +683,8 @@ initial_resync (PanelService *self) static gboolean ready_signal (PanelService *self) { - 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); - if (event_sent != 0) - { - NihError * err = nih_error_get(); - g_warning("Unable to signal for indicator services to start: %s", err->message); - nih_free(err); - } - } + if (!lockscreen_mode) + emit_upstart_event ("indicator-services-start"); return FALSE; } @@ -802,6 +777,48 @@ parse_string_keybinding (const char *str, KeyBinding *kb) } static void +emit_upstart_event (const gchar *event) +{ + const gchar *upstartsession = g_getenv ("UPSTART_SESSION"); + + if (!upstartsession) + return; + + GError *error = NULL; + GDBusConnection* conn = g_dbus_connection_new_for_address_sync (upstartsession, + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT, + NULL, NULL, &error); + + if (error) + { + g_warning ("Unable to connect to Upstart session: %s", error->message); + g_error_free (error); + return; + } + + GVariant *result = g_dbus_connection_call_sync (conn, DBUS_SERVICE_UPSTART, + DBUS_PATH_UPSTART, + DBUS_INTERFACE_UPSTART, + "EmitEvent", + g_variant_new ("(sasb)", event, NULL, 0), + NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, + NULL, &error); + + if (error) + { + g_warning ("Unable to emit Upstart event: %s", error->message); + g_error_free (error); + } + else + { + g_variant_unref (result); + } + + g_object_unref (conn); +} + + +static void panel_service_init (PanelService *self) { PanelServicePrivate *priv; @@ -825,29 +842,6 @@ panel_service_init (PanelService *self) update_keybinding (priv->gsettings, MENU_TOGGLE_KEYBINDING_KEY, &priv->menu_toggle); update_keybinding (priv->gsettings, SHOW_DASH_KEY, &priv->show_dash); update_keybinding (priv->gsettings, SHOW_HUD_KEY, &priv->show_hud); - - const gchar *upstartsession = g_getenv ("UPSTART_SESSION"); - if (upstartsession != NULL && !lockscreen_mode) - { - DBusConnection *conn = dbus_connection_open (upstartsession, NULL); - if (conn != NULL) - { - priv->upstart = nih_dbus_proxy_new (NULL, conn, - NULL, - DBUS_PATH_UPSTART, - NULL, NULL); - if (priv->upstart == NULL) - { - NihError * err = nih_error_get(); - g_warning("Unable to get Upstart proxy: %s", err->message); - nih_free(err); - } - dbus_connection_unref (conn); - } - } - - if (priv->upstart != NULL) - priv->upstart->auto_start = FALSE; } static gboolean diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b58035f3f..782ef6e62 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,7 +8,7 @@ file (COPY ${CMAKE_CURRENT_SOURCE_DIR}/data DESTINATION ${CMAKE_BINARY_DIR}/test # # Unit tests # -set (TEST_DEPS "${UNITY_PLUGIN_DEPS};unity>=4.99.0;libupstart;libnih;libnih-dbus;dbus-1") +set (TEST_DEPS "${UNITY_PLUGIN_DEPS};unity>=4.99.0;libupstart;") pkg_check_modules (TEST_UNIT_DEPS REQUIRED ${TEST_DEPS}) string (REPLACE ";" " " TEST_UNIT_DEPS_CFLAGS_OTHER "${TEST_UNIT_CFLAGS_OTHER}") diff --git a/unity-shared/UpstartWrapper.cpp b/unity-shared/UpstartWrapper.cpp index eda82399c..5ec3add22 100644 --- a/unity-shared/UpstartWrapper.cpp +++ b/unity-shared/UpstartWrapper.cpp @@ -20,6 +20,7 @@ #include "UpstartWrapper.h" #include <UnityCore/GLibDBusProxy.h> +#include <upstart/upstart-dbus.h> namespace unity { @@ -41,9 +42,8 @@ private: UpstartWrapper::Impl::Impl(bool test_mode) { - upstart_proxy_ = std::make_shared<unity::glib::DBusProxy>(test_mode ? "com.canonical.Unity.Test.Upstart" : "com.ubuntu.Upstart", - "/com/ubuntu/Upstart", - "com.ubuntu.Upstart0_6"); + upstart_proxy_ = std::make_shared<unity::glib::DBusProxy>(test_mode ? "com.canonical.Unity.Test.Upstart" : DBUS_SERVICE_UPSTART, + DBUS_PATH_UPSTART, DBUS_INTERFACE_UPSTART); } void UpstartWrapper::Impl::Emit(std::string const& name) |
