+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().
+
+ * src/modest-widget-memory.c: (restore_settings_header_view):
+ Use the new function to get defaults, if the gconf key is empty,
+ instead of not creating any columns. This seems to fix the
+ empty right-hand pane problems.
+
+ * src/widgets/modest-header-view.h: Improved documentation.
+
2007-06-13 Murray Cumming <murrayc@murrayc.com>
* src/maemo/easysetup/modest-easysetup-wizard.c: (create_account):
};
#endif /* MODEST_PLATFORM_MAEMO */
+static GList* new_cold_ids_gslist_from_array( const FolderCols* cols, guint col_num)
+{
+ GList *result = NULL;
+
+ guint i = 0;
+ for (i = 0; i < col_num; ++i) {
+ result = g_list_append (result, GINT_TO_POINTER (cols[i].col));
+ }
+
+ return result;
+}
+
+GList * modest_init_get_default_header_view_column_ids (TnyFolderType folder_type, ModestHeaderViewStyle style)
+{
+ GList *result = NULL;
+
+ switch (folder_type) {
+ case TNY_FOLDER_TYPE_SENT:
+ case TNY_FOLDER_TYPE_DRAFTS:
+ if (style == MODEST_HEADER_VIEW_STYLE_DETAILS)
+ result = new_cold_ids_gslist_from_array (OUTBOX_COLUMNS_DETAILS,
+ G_N_ELEMENTS(OUTBOX_COLUMNS_DETAILS));
+ else if (style == MODEST_HEADER_VIEW_STYLE_TWOLINES)
+ result = new_cold_ids_gslist_from_array (SENT_COLUMNS_TWOLINES,
+ G_N_ELEMENTS(SENT_COLUMNS_TWOLINES));
+ break;
+ case TNY_FOLDER_TYPE_OUTBOX:
+ if (style == MODEST_HEADER_VIEW_STYLE_TWOLINES)
+ result = new_cold_ids_gslist_from_array (OUTBOX_COLUMNS_TWOLINES,
+ G_N_ELEMENTS(OUTBOX_COLUMNS_TWOLINES));
+ break;
+
+ default:
+ if (style == MODEST_HEADER_VIEW_STYLE_DETAILS)
+ result = new_cold_ids_gslist_from_array (INBOX_COLUMNS_DETAILS,
+ G_N_ELEMENTS(INBOX_COLUMNS_DETAILS));
+ else if (style == MODEST_HEADER_VIEW_STYLE_TWOLINES)
+ result = new_cold_ids_gslist_from_array (INBOX_COLUMNS_TWOLINES,
+ G_N_ELEMENTS(INBOX_COLUMNS_TWOLINES));
+ };
+
+ if (!result) {
+ g_warning("DEBUG: %s: No default columns IDs found for "
+ "folder_type=%d, style=%d\n", __FUNCTION__, folder_type, style);
+ }
+
+ return result;
+}
gboolean
modest_init_init_core (void)
#include <glib.h>
#include <glib-object.h>
#include <modest-runtime.h>
+#include <widgets/modest-header-view.h>
G_BEGIN_DECLS
*/
gboolean modest_init_one_local_folder (gchar *maildir_path);
+/**
+ * modest_init_get_default_header_view_column_widths:
+ *
+ * Get a GList* containing the default column ids,
+ * for when suitable values cannot be retrieved from gconf.
+ * The result should be freed with g_slist_free().
+ * Use (ModestHeaderViewColumn(GPOINTER_TO_INT(item->data)) to get the IDs.
+ */
+GList * modest_init_get_default_header_view_column_ids (TnyFolderType folder_type, ModestHeaderViewStyle style);
G_END_DECLS
}
/* Add the merged outbox folder to the virtual local-folders store: */
- printf ("Debug: %s: adding merged outbox.\n", __FUNCTION__);
+ /* printf ("Debug: %s: adding merged outbox.\n", __FUNCTION__); */
modest_tny_local_folders_account_add_extra_folder (self, TNY_FOLDER(merged_outbox));
g_object_unref (merged_outbox);
merged_outbox = NULL;
#include <modest-account-mgr-helpers.h>
#include <modest-tny-platform-factory.h>
#include <modest-tny-folder.h>
+#include <modest-init.h>
#include <widgets/modest-header-view.h>
#include <widgets/modest-msg-view.h>
#include <widgets/modest-folder-view.h>
}
g_free (data);
+ /* Use defaults if gconf has no, or empty information: */
+ /* We don't know why the value is empty sometimes. */
+ if (g_list_length(cols) == 0) {
+ g_warning("%s: gconf key %s was empty. Using default column IDs.\n",
+ __FUNCTION__, key);
+ g_list_free (cols);
+ cols = NULL;
+ }
+
+ if (!cols)
+ cols = modest_init_get_default_header_view_column_ids (type, style);
+
if (cols) {
GList *viewcolumns, *colcursor, *widthcursor, *sortablecursor;
modest_header_view_set_columns (header_view, cols, type);
/**
* modest_header_view_set_columns:
* @self: a ModestHeaderView instance
- * @columns: a list of ModestHeaderViewColumn
+ * @columns: a list of gint ModestHeaderViewColumn column IDs, using GINT_TO_POINTER() and GPOINTER_TO_INT().
* @type: #TnyFolderType type
*
* set the columns for this ModestHeaderView.