[gnome-color-manager] trivial: ensure we remove deleted profiles from colord



commit ec2e4bd171c8d40f02e5e939ff7dbba27a0ad4db
Author: Richard Hughes <richard hughsie com>
Date:   Sat Apr 9 18:51:10 2011 +0100

    trivial: ensure we remove deleted profiles from colord
    
    We were using the filename as the profile-id, which simply will not work.

 src/gcm-session.c |   24 +++++++++++++++++++-----
 src/gcm-viewer.c  |    4 ++++
 2 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/src/gcm-session.c b/src/gcm-session.c
index aaa8088..402f28d 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -1317,20 +1317,34 @@ gcm_session_profile_store_removed_cb (GcmProfileStore *profile_store_,
 {
 	gboolean ret;
 	GError *error = NULL;
+	CdProfile *profile;
+
+	/* find the ID for the filename */
+	g_debug ("filename %s removed", filename);
+	profile = cd_client_find_profile_by_filename_sync (priv->client,
+							   filename,
+							   NULL,
+							   &error);
+	if (profile == NULL) {
+		g_warning ("%s", error->message);
+		g_error_free (error);
+		goto out;
+	}
 
-	g_debug ("profile %s removed", filename);
+	/* remove it from colord */
+	g_debug ("profile %s removed", cd_profile_get_id (profile));
 	ret = cd_client_delete_profile_sync (priv->client,
-					     filename,
+					     cd_profile_get_id (profile),
 					     NULL,
 					     &error);
 	if (!ret) {
-		g_warning ("failed to create profile: %s",
-			   error->message);
+		g_warning ("%s", error->message);
 		g_error_free (error);
 		goto out;
 	}
 out:
-	return;
+	if(profile != NULL)
+		g_object_unref (profile);
 }
 
 /**
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index 0ba5af0..57a54d7 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -901,6 +901,8 @@ gcm_viewer_client_profile_added_cb (CdClient *client,
 				    CdProfile *profile,
 				    GcmViewerPrivate *viewer)
 {
+	g_debug ("%s added, rescanning",
+		 cd_profile_get_id (profile));
 	gcm_viewer_update_profile_list (viewer);
 }
 
@@ -912,6 +914,8 @@ gcm_viewer_client_profile_removed_cb (CdClient *client,
 				      CdProfile *profile,
 				      GcmViewerPrivate *viewer)
 {
+	g_debug ("%s removed, rescanning",
+		 cd_profile_get_id (profile));
 	gcm_viewer_update_profile_list (viewer);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]