[gnome-control-center] color: Only allow the user to import custom profiles with colord >= 0.1.12



commit 08c71b017fb0f4e1df327c568baa4ff584d5b1c7
Author: Richard Hughes <richard hughsie com>
Date:   Mon Aug 22 23:03:32 2011 +0100

    color: Only allow the user to import custom profiles with colord >= 0.1.12
    
    When I was adding the color panel, we ripped out the import code as it was all
    pretty hacky and hardcoded, with the intention of doing it the right way in
    colord rather than in each client.
    
    At the moment if the user selects 'Import' then the panel does nothing as the
    code that would actually make it work was missing.
    
    I've now added the required client code in colord 0.1.12 which makes it possible
    to actually import files not listed in the dropdown.
    
    This makes it possible to install a display profile that's been downloaded into
    the 'Downloads' directory by firefox.

 panels/color/cc-color-panel.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index b0ffbb8..dcb779b 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -418,7 +418,9 @@ gcm_prefs_add_profiles_suitable_for_devices (CcColorPanel *prefs,
     }
 
   /* add a import entry */
+#if CD_CHECK_VERSION(0,1,12)
   gcm_prefs_combobox_add_profile (widget, NULL, GCM_PREFS_ENTRY_TYPE_IMPORT, NULL);
+#endif
   gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
 out:
   if (profile_array != NULL)
@@ -1057,6 +1059,7 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget,
                                     CcColorPanel *prefs)
 {
   GFile *file = NULL;
+  GError *error = NULL;
   gboolean ret;
   CdProfile *profile = NULL;
   GtkTreeIter iter;
@@ -1090,6 +1093,19 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget,
           goto out;
         }
 
+#if CD_CHECK_VERSION(0,1,12)
+      profile = cd_client_import_profile_sync (priv->client,
+                                               file,
+                                               priv->cancellable,
+                                               &error);
+      if (profile == NULL)
+        {
+          g_warning ("failed to get imported profile: %s", error->message);
+          g_error_free (error);
+          goto out;
+        }
+#endif
+
       /* add to combobox */
       gtk_list_store_append (GTK_LIST_STORE(model), &iter);
       gtk_list_store_set (GTK_LIST_STORE(model), &iter,



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