[gnome-flashback] own org.gnome.Shell
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] own org.gnome.Shell
- Date: Sat, 29 Nov 2014 16:36:41 +0000 (UTC)
commit 670c310e8eaf89e895da96e62edc2a724c4ec068
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Nov 29 17:57:04 2014 +0200
own org.gnome.Shell
Own org.gnome.Shell for all gnome-flashback application. Then
watch for this name in libraries that need to export interface
on this name.
This is only workaround. Ideally we should not use org.gnome.Shell
at all.
gnome-flashback/flashback-application.c | 17 +++++++++++++++++
.../flashback-end-session-dialog.c | 20 ++++++++++++++++++++
.../libkey-grabber/flashback-key-grabber.c | 18 ++++++++++++++++++
3 files changed, 55 insertions(+), 0 deletions(-)
---
diff --git a/gnome-flashback/flashback-application.c b/gnome-flashback/flashback-application.c
index 214c0ca..1838423 100644
--- a/gnome-flashback/flashback-application.c
+++ b/gnome-flashback/flashback-application.c
@@ -45,6 +45,8 @@ struct _FlashbackApplicationPrivate {
FlashbackKeyGrabber *grabber;
MetaIdleMonitorDBus *idle_monitor;
GvcApplet *applet;
+
+ gint bus_name;
};
G_DEFINE_TYPE_WITH_PRIVATE (FlashbackApplication, flashback_application, G_TYPE_OBJECT);
@@ -135,6 +137,11 @@ flashback_application_finalize (GObject *object)
{
FlashbackApplication *app = FLASHBACK_APPLICATION (object);
+ if (app->priv->bus_name) {
+ g_bus_unown_name (app->priv->bus_name);
+ app->priv->bus_name = 0;
+ }
+
g_clear_object (&app->priv->background);
g_clear_object (&app->priv->config);
g_clear_object (&app->priv->dialog);
@@ -159,6 +166,16 @@ flashback_application_init (FlashbackApplication *application)
g_signal_connect (priv->settings, "changed",
G_CALLBACK (flashback_application_settings_changed), application);
flashback_application_settings_changed (priv->settings, NULL, application);
+
+ priv->bus_name = g_bus_own_name (G_BUS_TYPE_SESSION,
+ "org.gnome.Shell",
+ G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
+ G_BUS_NAME_OWNER_FLAGS_REPLACE,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
}
static void
diff --git a/gnome-flashback/libend-session-dialog/flashback-end-session-dialog.c
b/gnome-flashback/libend-session-dialog/flashback-end-session-dialog.c
index d100dd0..a75c89b 100644
--- a/gnome-flashback/libend-session-dialog/flashback-end-session-dialog.c
+++ b/gnome-flashback/libend-session-dialog/flashback-end-session-dialog.c
@@ -125,9 +125,15 @@ handle_open (DBusEndSessionDialog *object,
}
static void
+/*
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
+*/
+name_appeared_handler (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
{
FlashbackEndSessionDialog *dialog;
GError *error = NULL;
@@ -146,6 +152,7 @@ on_bus_acquired (GDBusConnection *connection,
}
}
+/*
static void
on_name_acquired (GDBusConnection *connection,
const char *name,
@@ -159,6 +166,7 @@ on_name_lost (GDBusConnection *connection,
gpointer user_data)
{
}
+*/
static void
flashback_end_session_dialog_finalize (GObject *object)
@@ -178,7 +186,10 @@ flashback_end_session_dialog_finalize (GObject *object)
}
if (dialog->priv->bus_name) {
+ /*
g_bus_unown_name (dialog->priv->bus_name);
+ */
+ g_bus_unwatch_name (dialog->priv->bus_name);
dialog->priv->bus_name = 0;
}
@@ -194,6 +205,14 @@ flashback_end_session_dialog_init (FlashbackEndSessionDialog *dialog)
dialog->priv->dialog = NULL;
dialog->priv->iface = NULL;
+ dialog->priv->bus_name = g_bus_watch_name (G_BUS_TYPE_SESSION,
+ "org.gnome.Shell",
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ name_appeared_handler,
+ NULL,
+ dialog,
+ NULL);
+ /*
dialog->priv->bus_name = g_bus_own_name (G_BUS_TYPE_SESSION,
"org.gnome.Shell",
G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
@@ -203,6 +222,7 @@ flashback_end_session_dialog_init (FlashbackEndSessionDialog *dialog)
on_name_lost,
dialog,
NULL);
+ */
}
static void
diff --git a/gnome-flashback/libkey-grabber/flashback-key-grabber.c
b/gnome-flashback/libkey-grabber/flashback-key-grabber.c
index e83d40e..610bf0a 100644
--- a/gnome-flashback/libkey-grabber/flashback-key-grabber.c
+++ b/gnome-flashback/libkey-grabber/flashback-key-grabber.c
@@ -223,9 +223,15 @@ handle_ungrab_accelerator (DBusKeyGrabber *object,
}
static void
+/*
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
gpointer user_data)
+*/
+name_appeared_handler (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
{
FlashbackKeyGrabber *grabber;
DBusKeyGrabber *skeleton;
@@ -262,7 +268,10 @@ flashback_key_grabber_finalize (GObject *object)
grabber = FLASHBACK_KEY_GRABBER (object);
if (grabber->priv->bus_name) {
+ /*
g_bus_unown_name (grabber->priv->bus_name);
+ */
+ g_bus_unwatch_name (grabber->priv->bus_name);
grabber->priv->bus_name = 0;
}
@@ -293,6 +302,14 @@ flashback_key_grabber_init (FlashbackKeyGrabber *grabber)
g_signal_connect (grabber->priv->bindings, "binding-activated",
G_CALLBACK (binding_activated), grabber);
+ grabber->priv->bus_name = g_bus_watch_name (G_BUS_TYPE_SESSION,
+ KEY_GRABBER_DBUS_NAME,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ name_appeared_handler,
+ NULL,
+ grabber,
+ NULL);
+ /*
grabber->priv->bus_name = g_bus_own_name (G_BUS_TYPE_SESSION,
KEY_GRABBER_DBUS_NAME,
G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
@@ -302,6 +319,7 @@ flashback_key_grabber_init (FlashbackKeyGrabber *grabber)
NULL,
grabber,
NULL);
+ */
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]