[gnac/gnac-gsettings] Prevented warnings from g_settings_set_string



commit cbf95494003f51ee6aa96f08092fe9efa382e22b
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date:   Sat Oct 16 19:42:31 2010 +0100

    Prevented warnings from g_settings_set_string

 src/gnac-main.c    |    8 ++++++--
 src/gnac-options.c |    6 ++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/gnac-main.c b/src/gnac-main.c
index f85bf57..e998ab5 100644
--- a/src/gnac-main.c
+++ b/src/gnac-main.c
@@ -884,9 +884,13 @@ gnac_on_ui_profile_changed_cb(GtkComboBox *box,
 {
   const gchar *profile_name = NULL;
   profile_name = gnac_profiles_get_name();
-  if (!g_settings_set_string(settings, GNAC_KEY_LAST_USED_PROFILE, profile_name)) {
-    g_printerr("Failed to set key %s to %s\n",
+  if (profile_name) {
+    gboolean ret = g_settings_set_string(settings,
         GNAC_KEY_LAST_USED_PROFILE, profile_name);
+    if (!ret) {
+      g_printerr("Failed to set key %s to %s\n",
+          GNAC_KEY_LAST_USED_PROFILE, profile_name);
+    }
   }
 }
 
diff --git a/src/gnac-options.c b/src/gnac-options.c
index 1efee12..7fb89ef 100644
--- a/src/gnac-options.c
+++ b/src/gnac-options.c
@@ -102,8 +102,10 @@ gnac_options_audio_profile_cb(const gchar  *option_name,
                               gpointer      data,
                               GError      **error)
 {
-  g_settings_set_string(settings, GNAC_KEY_LAST_USED_PROFILE, value);
-  libgnac_debug("profile \"%s\" selected", value);
+  if (value) {
+    g_settings_set_string(settings, GNAC_KEY_LAST_USED_PROFILE, value);
+    libgnac_debug("profile \"%s\" selected", value);
+  }
   return TRUE;
 }
 



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