1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Tue, 27 Sep 2011 20:47:54 +0200
Subject: Register org.gnome.KrbAuthDialog early
and get the bus via g_bus_get_sync unbreak DBus activation.
---
src/ka-applet.c | 6 ++----
src/ka-dbus.c | 20 +++++++++-----------
2 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/src/ka-applet.c b/src/ka-applet.c
index f1fffbf..56d4b14 100644
--- a/src/ka-applet.c
+++ b/src/ka-applet.c
@@ -188,10 +188,6 @@ ka_applet_startup (GApplication *application)
KA_DEBUG ("Primary application");
self->priv->startup_ccache = ka_kerberos_init (self);
- if (!ka_dbus_connect (self)) {
- ka_applet_destroy (self);
- }
-
main_window = ka_main_window_create (self, self->priv->uixml);
gtk_application_add_window (GTK_APPLICATION(self), main_window);
ka_preferences_window_create (self, self->priv->uixml);
@@ -1080,6 +1076,8 @@ ka_applet_create ()
applet->priv->loader = ka_plugin_loader_create (applet);
g_return_val_if_fail (applet->priv->loader != NULL, NULL);
+ g_return_val_if_fail (ka_dbus_connect (applet), NULL);
+
return applet;
}
diff --git a/src/ka-dbus.c b/src/ka-dbus.c
index 2b84adc..c88561e 100644
--- a/src/ka-dbus.c
+++ b/src/ka-dbus.c
@@ -169,15 +169,11 @@ static const GDBusInterfaceVTable interface_vtable =
};
-static void
-ka_dbus_on_get_bus_cb (GObject *source_object G_GNUC_UNUSED,
- GAsyncResult *res,
- gpointer user_data)
+static gboolean
+ka_dbus_register (KaApplet *applet)
{
- KaApplet *applet = user_data;
guint id;
- dbus_connection = g_bus_get_finish (res, NULL);
introspection_data = g_dbus_node_info_new_for_xml (
ka_dbus_introspection_xml,
NULL);
@@ -189,9 +185,10 @@ ka_dbus_on_get_bus_cb (GObject *source_object G_GNUC_UNUSED,
applet,
NULL, /* user_data_free_func */
NULL); /* GError** */
- if (!id)
- g_error ("Failed to register DBus object");
+
+ g_return_val_if_fail(id, FALSE);
ka_dbus_connect_signals (applet);
+ return TRUE;
}
@@ -212,9 +209,10 @@ ka_dbus_connect (KaApplet *applet)
{
g_return_val_if_fail (applet != 0, FALSE);
- g_bus_get (G_BUS_TYPE_SESSION, NULL, ka_dbus_on_get_bus_cb,
- applet);
- return TRUE;
+ dbus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ g_return_val_if_fail (dbus_connection != NULL, FALSE);
+
+ return ka_dbus_register(applet);
}
/*
--
|