[gnome-color-manager] Failure to load a profile shouldn't prevent adding of the device
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Failure to load a profile shouldn't prevent adding of the device
- Date: Tue, 10 Nov 2009 20:07:56 +0000 (UTC)
commit b1d3db6d41a60136c171cf7f8fe7cde3e32cfc30
Author: Richard Hughes <richard hughsie com>
Date: Tue Nov 10 20:07:12 2009 +0000
Failure to load a profile shouldn't prevent adding of the device
src/gcm-device.c | 11 ++++++++---
src/gcm-prefs.c | 11 ++++++-----
2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/gcm-device.c b/src/gcm-device.c
index f6bcf6d..779f88e 100644
--- a/src/gcm-device.c
+++ b/src/gcm-device.c
@@ -228,10 +228,15 @@ gcm_device_load (GcmDevice *device, GError **error)
/* load this */
ret = gcm_device_load_from_profile (device, &error_local);
if (!ret) {
- if (error != NULL)
- *error = g_error_new (1, 0, "failed to load from config: %s", error_local->message);
+
+ /* just print a warning, this is not fatal */
+ egg_warning ("failed to load profile %s: %s", device->priv->profile, error_local->message);
g_error_free (error_local);
- goto out;
+
+ /* recover as the file might have been corrupted */
+ g_free (device->priv->profile);
+ device->priv->profile = NULL;
+ ret = TRUE;
}
out:
g_free (filename);
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 87b370c..724add5 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -221,6 +221,7 @@ gcm_prefs_calibrate_scanner_get_scanned_profile (void)
/* setup the filter */
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/tiff");
+ gtk_file_filter_add_mime_type (filter, "application/x-it87_2");
/* TRANSLATORS: filter name on the file->open dialog */
gtk_file_filter_set_name (filter, _("Supported images files"));
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter);
@@ -884,12 +885,12 @@ gcm_prefs_add_profiles (GtkWidget *widget)
if (!ret) {
egg_warning ("failed to add profile: %s", error->message);
g_error_free (error);
- g_object_unref (profile);
- continue;
+ /* not fatal */
+ error = NULL;
+ } else {
+ /* add to array */
+ g_ptr_array_add (profiles_array, g_object_ref (profile));
}
-
- /* add to array */
- g_ptr_array_add (profiles_array, g_object_ref (profile));
g_object_unref (profile);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]