Catch GConf errors, fixes compilation warnings
authorPhilipp Zabel <philipp.zabel@gmail.com>
Tue, 17 Nov 2009 14:03:01 +0000 (15:03 +0100)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Tue, 17 Nov 2009 21:32:46 +0000 (22:32 +0100)
src/poster/movie-poster-factory.vala
src/settings-dialog.vala

index 095af92..41001d2 100644 (file)
@@ -42,9 +42,13 @@ namespace MoviePoster {
                        }
                        gc = GConf.Client.get_default ();
 
-                       download_posters = gc.get_bool ("/apps/cinaest/download_posters");
-                       gc.add_dir ("/apps/cinaest", GConf.ClientPreloadType.ONELEVEL);
-                       cxnid = gc.notify_add ("/apps/cinaest/download_posters", on_download_posters_changed);
+                       try {
+                               download_posters = gc.get_bool ("/apps/cinaest/download_posters");
+                               gc.add_dir ("/apps/cinaest", GConf.ClientPreloadType.ONELEVEL);
+                               cxnid = gc.notify_add ("/apps/cinaest/download_posters", on_download_posters_changed);
+                       } catch (Error e) {
+                               stdout.printf ("Error installing GConf notification: %s\n", e.message);
+                       }
                }
 
                private static void on_download_posters_changed (GConf.Client gc, uint cxnid, GConf.Entry entry) {
index ec4368c..7800c67 100644 (file)
@@ -85,7 +85,11 @@ class SettingsDialog : Gtk.Dialog {
                int res = 0;
                var gc = GConf.Client.get_default ();
 
-               download_posters.set_active (gc.get_bool ("/apps/cinaest/download_posters"));
+               try {
+                       download_posters.set_active (gc.get_bool ("/apps/cinaest/download_posters"));
+               } catch (Error e) {
+                       stdout.printf ("Error getting GConf option: %s\n", e.message);
+               }
 
                show_all ();
 
@@ -97,8 +101,11 @@ class SettingsDialog : Gtk.Dialog {
                        }
                } while (res >= 0);
 
-               if (res == ResponseType.ACCEPT)
+               if (res == ResponseType.ACCEPT) try {
                        gc.set_bool ("/apps/cinaest/download_posters", download_posters.get_active ());
+               } catch (Error e) {
+                       stdout.printf ("Error setting GConf option: %s\n", e.message);
+               }
                destroy ();
 
                return res;