2007-06-25 Armin Burgmeier <armin@openismus.com>
[modest] / src / modest-init.c
index e0f8048..8f81f3d 100644 (file)
@@ -51,6 +51,7 @@
 #ifdef MODEST_PLATFORM_MAEMO
 #include "modest-hildon-includes.h"
 #endif
+#include <locale.h>
 
 static gboolean init_header_columns (ModestConf *conf, gboolean overwrite);
 static gboolean init_default_account_maybe  (ModestAccountMgr *acc_mgr);
@@ -132,7 +133,8 @@ static GList* new_cold_ids_gslist_from_array( const FolderCols* cols, guint col_
        return result;
 }
 
-GList * modest_init_get_default_header_view_column_ids (TnyFolderType folder_type, ModestHeaderViewStyle style)
+GList* 
+modest_init_get_default_header_view_column_ids (TnyFolderType folder_type, ModestHeaderViewStyle style)
 {
                GList *result = NULL;
                
@@ -185,11 +187,6 @@ modest_init_init_core (void)
        init_i18n();
        init_debug_g_type();
        init_debug_logging();
-
-       if (!g_thread_supported())
-               g_thread_init(NULL);
-       
-       gdk_threads_init ();
        
        if (!modest_runtime_init()) {
                modest_init_uninit ();
@@ -207,7 +204,6 @@ modest_init_init_core (void)
                return FALSE;
        }
 
-       /* based on the debug settings, we decide whether to overwrite old settings */
        reset = modest_runtime_get_debug_flags () & MODEST_RUNTIME_DEBUG_FACTORY_SETTINGS;
        if (!init_header_columns(modest_runtime_get_conf(), reset)) {
                modest_init_uninit ();
@@ -249,7 +245,7 @@ modest_init_init_ui (gint argc, gchar** argv)
        init_stock_icons ();
 
        /* Init notification system */
-       #ifndef MODEST_HILDON_VERSION_0
+       #ifdef MODEST_HAVE_HILDON_NOTIFY
        notify_init ("Basics");
        #endif
 
@@ -280,6 +276,8 @@ save_header_settings (ModestConf *conf, TnyFolderType type,
 {
        int i;
        gchar *key;
+       gchar *sort_key;
+       gchar *sort_value;
        GString *str;
 
        g_return_val_if_fail (cols, FALSE);
@@ -287,6 +285,9 @@ save_header_settings (ModestConf *conf, TnyFolderType type,
        key = _modest_widget_memory_get_keyname_with_double_type ("header-view",
                                                                  type, style,
                                                                  MODEST_WIDGET_MEMORY_PARAM_COLUMN_WIDTH);
+       sort_key = _modest_widget_memory_get_keyname_with_double_type ("header-view",
+                                                                      type, style,
+                                                                      MODEST_WIDGET_MEMORY_PARAM_COLUMN_SORT);
        /* if we're not in overwrite mode, only write stuff it
         * there was nothing before */
        if (!overwrite &&  modest_conf_key_exists(conf, key, NULL)) {
@@ -303,6 +304,18 @@ save_header_settings (ModestConf *conf, TnyFolderType type,
        modest_conf_set_string (conf, key, str->str, NULL);
        g_free (key);
        g_string_free (str, TRUE);
+
+       if ( col_num > 0 ) {
+               gint sort_col_id;
+               if (cols[i].col == MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER_OUT)
+                       sort_col_id = TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN;
+               else
+                       sort_col_id = TNY_GTK_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN;
+               sort_value = g_strdup_printf("%d:%d:%d", sort_col_id, GTK_SORT_DESCENDING, 0);
+               modest_conf_set_string (conf, sort_key, sort_value, NULL);
+               g_free (sort_value);
+       }
+       g_free (sort_key);
        
        return TRUE;
 }
@@ -500,16 +513,20 @@ init_i18n (void)
        const gchar* gettext_package;
        /* Setup gettext, to use our .po files: */
        /* GETTEXT_PACKAGE and MODEST_LOCALE_DIR are defined in config.h */
-#ifdef MODEST_HILDON_VERSION_0
-       gettext_package = GETTEXT_PACKAGE;
-       bindtextdomain (gettext_package, MODEST_LOCALE_DIR);
-#else
-       gettext_package = "osso-email"; /* HACK to use the localizations */
-       bindtextdomain (gettext_package, "/usr/share/locale");
-#endif /*MODEST_HILDON_VERSION_0*/
+/* #ifdef MODEST_HILDON_VERSION_0 */
+/*     gettext_package = GETTEXT_PACKAGE; */
+/*     bindtextdomain (gettext_package, MODEST_LOCALE_DIR); */
+/* #else */
+/*     gettext_package = "osso-email"; /\* HACK to use the localizations *\/ */
+/*     bindtextdomain (gettext_package, "/usr/share/locale"); */
+/* #endif /\*MODEST_HILDON_VERSION_0*\/ */
        
+       gettext_package = GETTEXT_PACKAGE;
+
        bind_textdomain_codeset (gettext_package, "UTF-8");
        textdomain (gettext_package);
+
+       setlocale (LC_ALL, "");
 }