[krb5-auth-dialog] Register org.gnome.KrbAuthDialog early
- From: Guido GÃnther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] Register org.gnome.KrbAuthDialog early
- Date: Tue, 27 Sep 2011 18:53:22 +0000 (UTC)
commit 15fde0ec01fd3c55e886e077e3a8dcd2c24fd02c
Author: Guido GÃnther <agx sigxcpu org>
Date: Tue Sep 27 20:47:54 2011 +0200
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);
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]