2007-06-14 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Thu, 14 Jun 2007 10:38:15 +0000 (10:38 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Thu, 14 Jun 2007 10:38:15 +0000 (10:38 +0000)
* src/maemo/modest-main-window.c: (set_toolbar_mode): Prevent a warning
        when the toolbar does not exist yet.
        * src/modest-widget-memory.c: (save_settings_header_view):
        Added g_warnings() to help us to discover when we are trying to set
        an empty columns list in gconf.

pmo-trunk-r2226

ChangeLog2
src/maemo/modest-main-window.c
src/modest-widget-memory.c

index 1c50237..7a7c9a9 100644 (file)
@@ -1,5 +1,13 @@
 2007-06-14  Murray Cumming  <murrayc@murrayc.com>
 
+       * src/maemo/modest-main-window.c: (set_toolbar_mode): Prevent a warning
+       when the toolbar does not exist yet.
+       * src/modest-widget-memory.c: (save_settings_header_view):
+       Added g_warnings() to help us to discover when we are trying to set 
+       an empty columns list in gconf.
+
+2007-06-14  Murray Cumming  <murrayc@murrayc.com>
+
        * src/modest-init.h:
        * src/modest-init.c: 
        Added modest_init_get_default_header_view_column_ids().
index c0e44dd..135ab4f 100644 (file)
@@ -1618,6 +1618,10 @@ set_toolbar_mode (ModestMainWindow *self,
        parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
        priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
 
+       /* In case this was called before the toolbar exists: */
+       if (!(parent_priv->toolbar))
+               return;
+
        g_return_if_fail (GTK_IS_TOOLBAR(parent_priv->toolbar)); 
        
        sort_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ToolbarSort");
index b6ab67f..55d31c2 100644 (file)
@@ -276,6 +276,11 @@ save_settings_header_view (ModestConf *conf, ModestHeaderView *header_view,
                                                                  MODEST_WIDGET_MEMORY_PARAM_COLUMN_WIDTH);
 
        cursor = cols = modest_header_view_get_columns (header_view);
+       if (!cols) {
+               g_warning ("DEBUG: %s: modest_header_view_get_columns() returned NULL.",
+                        __FUNCTION__);
+       }
+       
        str = g_string_new (NULL);
 
        /* NOTE: the exact details of this format are important, as they
@@ -300,7 +305,13 @@ save_settings_header_view (ModestConf *conf, ModestHeaderView *header_view,
                cursor = g_list_next (cursor);
        }
 
-       modest_conf_set_string (conf, key, str->str, NULL);
+       if (str->str == NULL) {
+               /* TODO: Find out why this happens sometimes. */
+               g_warning ("DEBUG: %s: Attempting to write an empty value to "
+                       "gconf key %s. Preventing.", __FUNCTION__, key);
+       }
+       else
+               modest_conf_set_string (conf, key, str->str, NULL);
 
        g_free (key);   
        g_string_free (str, TRUE);