Refactoring work to make new folder and rename folder share
[modest] / src / modest-init.c
index f75354f..442b590 100644 (file)
 #include "widgets/modest-global-settings-dialog.h"
 #include "modest-tny-msg.h"
 #ifdef MODEST_PLATFORM_MAEMO
-#include <hildon/hildon-notification.h>
-#else
-#include <libnotify/notify.h>
+#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);
@@ -187,11 +186,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 ();
@@ -251,7 +245,9 @@ modest_init_init_ui (gint argc, gchar** argv)
        init_stock_icons ();
 
        /* Init notification system */
+       #ifndef MODEST_HILDON_VERSION_0
        notify_init ("Basics");
+       #endif
 
        return TRUE;
 }
@@ -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, "");
 }