[gnome-color-manager] Do not reload when colord appears on the bus
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Do not reload when colord appears on the bus
- Date: Wed, 25 May 2011 16:52:17 +0000 (UTC)
commit ca3b1e5fa5acb8e0d56ea8a4ed4abf6e0c1d36cf
Author: Richard Hughes <richard hughsie com>
Date: Wed May 25 17:52:01 2011 +0100
Do not reload when colord appears on the bus
This triggers some kind of race in GDBus. It's probably not a good idea anyway.
src/gcm-session.c | 64 ++++++++++-------------------------------------------
1 files changed, 12 insertions(+), 52 deletions(-)
---
diff --git a/src/gcm-session.c b/src/gcm-session.c
index a06bb51..98b9dd0 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -44,7 +44,6 @@ typedef struct {
GDBusConnection *connection;
GDBusNodeInfo *introspection;
GMainLoop *loop;
- guint watcher_id;
} GcmSessionPrivate;
#define GCM_ICC_PROFILE_IN_X_VERSION_MAJOR 0
@@ -1233,13 +1232,12 @@ out:
}
/**
- * gcm_session_colord_appeared_cb:
+ * gcm_session_client_connect_cb:
**/
static void
-gcm_session_colord_appeared_cb (GDBusConnection *connection,
- const gchar *name,
- const gchar *name_owner,
- gpointer user_data)
+gcm_session_client_connect_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
gboolean ret;
GError *error = NULL;
@@ -1250,7 +1248,14 @@ gcm_session_colord_appeared_cb (GDBusConnection *connection,
GcmX11Output *output;
GcmSessionPrivate *priv = (GcmSessionPrivate *) user_data;
- g_debug ("%s has appeared as %s", name, name_owner);
+ /* connected */
+ g_debug ("connected to colord");
+ ret = cd_client_connect_finish (priv->client, res, &error);
+ if (!ret) {
+ g_warning ("failed to connect to colord: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
/* add screens */
ret = gcm_x11_screen_refresh (priv->x11_screen, &error);
@@ -1301,49 +1306,6 @@ out:
}
/**
- * gcm_session_colord_vanished_cb:
- **/
-static void
-gcm_session_colord_vanished_cb (GDBusConnection *_connection,
- const gchar *name,
- gpointer user_data)
-{
- g_debug ("%s has vanished", name);
-}
-
-/**
- * gcm_session_client_connect_cb:
- **/
-static void
-gcm_session_client_connect_cb (GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
-{
- gboolean ret;
- GError *error = NULL;
- GcmSessionPrivate *priv = (GcmSessionPrivate *) user_data;
-
- /* connected */
- g_debug ("connected to colord");
- ret = cd_client_connect_finish (priv->client, res, &error);
- if (!ret) {
- g_warning ("failed to connect to colord: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* watch to see when colord appears */
- priv->watcher_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
- "org.freedesktop.ColorManager",
- G_BUS_NAME_WATCHER_FLAGS_NONE,
- gcm_session_colord_appeared_cb,
- gcm_session_colord_vanished_cb,
- priv, NULL);
-out:
- return;
-}
-
-/**
* gcm_session_load_introspection:
**/
static gboolean
@@ -1490,8 +1452,6 @@ out:
if (owner_id > 0)
g_bus_unown_name (owner_id);
if (priv != NULL) {
- if (priv->watcher_id > 0)
- g_bus_unwatch_name (priv->watcher_id);
if (priv->profile_store != NULL)
g_object_unref (priv->profile_store);
if (priv->dmi != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]