Blob Blame Raw
From 49cc45deb53b879c904fd2ce059277db9c87a9f8 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Wed, 21 Nov 2012 21:38:01 +0000
Subject: [PATCH] Do not try to connect to colord in cd-fix-profile until
 actually needed

This speeds up the startup of the tool and also means it can be used on build
servers without colord or DBus running.
---
 client/cd-fix-profile.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/client/cd-fix-profile.c b/client/cd-fix-profile.c
index d968e8b..3a481cf 100644
--- a/client/cd-fix-profile.c
+++ b/client/cd-fix-profile.c
@@ -384,11 +384,14 @@ cd_util_get_standard_space_filename (CdUtilPrivate *priv,
 				     CdStandardSpace standard_space,
 				     GError **error)
 {
-	CdProfile *profile_tmp;
+	CdProfile *profile_tmp = NULL;
 	gboolean ret;
 	gchar *filename = NULL;
 
 	/* try to find */
+	ret = cd_client_connect_sync (priv->client, NULL, error);
+	if (!ret)
+		goto out;
 	profile_tmp = cd_client_get_standard_space_sync (priv->client,
 							 standard_space,
 							 NULL,
@@ -1101,12 +1104,6 @@ main (int argc, char *argv[])
 	/* create helper object */
 	priv = g_new0 (CdUtilPrivate, 1);
 	priv->client = cd_client_new ();
-	ret = cd_client_connect_sync (priv->client, NULL, &error);
-	if (!ret) {
-		g_print ("%s\n", error->message);
-		g_error_free (error);
-		goto out;
-	}
 
 	/* add commands */
 	priv->cmd_array = g_ptr_array_new_with_free_func ((GDestroyNotify) cd_util_item_free);
-- 
1.8.0