X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-init.c;h=ddf28114a30e946a3e3755d9d08727a42f4e4bee;hb=a7b778d59a6e5d9eb3a22632e5e3804fc92fe86e;hp=f13483f662491b636146918d6235b55aec904653;hpb=8125ec9d64e509b2238ff58a8cd905791f717c3e;p=modest diff --git a/src/modest-init.c b/src/modest-init.c index f13483f..ddf2811 100644 --- a/src/modest-init.c +++ b/src/modest-init.c @@ -63,6 +63,9 @@ static void init_default_settings (ModestConf *conf); static void init_device_name (ModestConf *conf); static gboolean init_ui (gint argc, gchar** argv); + +static gboolean _is_initialized = FALSE; + /* * defaults for the column headers */ @@ -73,7 +76,7 @@ typedef struct { } FolderCols; -static const guint MODEST_MAIN_PANED_POS = 280; +static const guint MODEST_MAIN_PANED_POS_PERCENTAGE = 30; static const FolderCols INBOX_COLUMNS_DETAILS[] = { {MODEST_HEADER_VIEW_COLUMN_MSGTYPE, 40, 0}, @@ -122,7 +125,8 @@ static const TnyFolderType LOCAL_FOLDERS[] = { }; #endif /* MODEST_PLATFORM_MAEMO */ -static GList* new_cold_ids_gslist_from_array( const FolderCols* cols, guint col_num) +static GList* +new_cold_ids_gslist_from_array( const FolderCols* cols, guint col_num) { GList *result = NULL; @@ -177,19 +181,19 @@ gboolean modest_init (int argc, char *argv[]) { gboolean reset; - static gboolean invoked = FALSE; - if (invoked) { + if (_is_initialized) { g_printerr ("modest: modest_init_init_core may only be invoked once\n"); - g_assert (!invoked); /* abort */ return FALSE; - } else - invoked = TRUE; - + } + init_i18n(); init_debug_g_type(); init_debug_logging(); + /* initialize the prng, we need it when creating random files */ + srandom((int)getpid()); + if (!gnome_vfs_initialized()) { if (!gnome_vfs_init ()) { g_printerr ("modest: failed to init gnome-vfs\n"); @@ -238,8 +242,8 @@ modest_init (int argc, char *argv[]) g_printerr ("modest: failed to init ui\n"); return FALSE; } - - return TRUE; + + return _is_initialized = TRUE; } @@ -264,12 +268,19 @@ init_ui (gint argc, gchar** argv) gboolean modest_init_uninit (void) { + if (!_is_initialized) + return TRUE; + + if (gnome_vfs_initialized()) /* apparently, this returns TRUE, even after a shutdown */ + gnome_vfs_shutdown (); + if (!modest_runtime_uninit()) g_printerr ("modest: failed to uninit runtime\n"); - if (gnome_vfs_initialized()) - gnome_vfs_shutdown (); + if (!modest_platform_uninit()) + g_printerr ("modest: failed to uninit platform\n"); + _is_initialized = FALSE; return TRUE; } @@ -386,11 +397,12 @@ init_header_columns (ModestConf *conf, gboolean overwrite) }; } - key = _modest_widget_memory_get_keyname (MODEST_CONF_MAIN_PANED_KEY, MODEST_WIDGET_MEMORY_PARAM_POS); + key = _modest_widget_memory_get_keyname (MODEST_CONF_MAIN_PANED_KEY, + MODEST_WIDGET_MEMORY_PARAM_POS); /* if we're not in overwrite mode, only write stuff it * there was nothing before */ if (overwrite || !modest_conf_key_exists(conf, key, NULL)) - modest_conf_set_int (conf, key, MODEST_MAIN_PANED_POS, NULL); + modest_conf_set_int (conf, key, MODEST_MAIN_PANED_POS_PERCENTAGE, NULL); g_free (key); return TRUE; @@ -583,8 +595,8 @@ init_stock_icons (void) { MODEST_STOCK_NEW_MAIL, "new mail", 0, 0, NULL }, /* { MODEST_STOCK_SEND_RECEIVE, "send receive", 0, 0, NULL }, */ { MODEST_STOCK_REPLY, "reply", 0, 0, NULL }, - { MODEST_STOCK_REPLY_ALL, "reply all", 0, 0, NULL }, - { MODEST_STOCK_FORWARD, "forward", 0, 0, NULL }, +/* { MODEST_STOCK_REPLY_ALL, "reply all", 0, 0, NULL }, */ +/* { MODEST_STOCK_FORWARD, "forward", 0, 0, NULL }, */ { MODEST_STOCK_DELETE, "delete", 0, 0, NULL }, /* { MODEST_STOCK_NEXT, "next", 0, 0, NULL }, */ /* { MODEST_STOCK_PREV, "prev", 0, 0, NULL }, */ @@ -601,8 +613,8 @@ init_stock_icons (void) MODEST_TOOLBAR_ICON_NEW_MAIL, /* MODEST_TOOLBAR_ICON_SEND_RECEIVE, */ MODEST_TOOLBAR_ICON_REPLY, - MODEST_TOOLBAR_ICON_REPLY_ALL, - MODEST_TOOLBAR_ICON_FORWARD, +/* MODEST_TOOLBAR_ICON_REPLY_ALL, */ +/* MODEST_TOOLBAR_ICON_FORWARD, */ MODEST_TOOLBAR_ICON_DELETE, /* MODEST_TOOLBAR_ICON_NEXT, */ /* MODEST_TOOLBAR_ICON_PREV, */ @@ -657,23 +669,32 @@ init_stock_icons (void) static void init_default_settings (ModestConf *conf) { - if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_TOOLBAR, NULL)) - modest_conf_set_bool (conf, MODEST_CONF_SHOW_TOOLBAR, TRUE, NULL); + /* Show toolbar keys */ + if (!modest_conf_key_exists (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR, NULL)) + modest_conf_set_bool (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR, TRUE, NULL); + + if (!modest_conf_key_exists (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL)) + modest_conf_set_bool (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR_FULLSCREEN, TRUE, NULL); - if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_TOOLBAR_FULLSCREEN, NULL)) - modest_conf_set_bool (conf, MODEST_CONF_SHOW_TOOLBAR_FULLSCREEN, TRUE, NULL); + if (!modest_conf_key_exists (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR, NULL)) + modest_conf_set_bool (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR, TRUE, NULL); + + if (!modest_conf_key_exists (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL)) + modest_conf_set_bool (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR_FULLSCREEN, TRUE, NULL); + + if (!modest_conf_key_exists (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR, NULL)) + modest_conf_set_bool (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR, TRUE, NULL); + if (!modest_conf_key_exists (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL)) + modest_conf_set_bool (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR_FULLSCREEN, TRUE, NULL); + + /* Editor keys */ if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_CC, NULL)) modest_conf_set_bool (conf, MODEST_CONF_SHOW_CC, TRUE, NULL); if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_BCC, NULL)) modest_conf_set_bool (conf, MODEST_CONF_SHOW_BCC, FALSE, NULL); -/* Not used: - if (!modest_conf_key_exists (conf, MODEST_CONF_CONNECT_AT_STARTUP, NULL)) - modest_conf_set_bool (conf, MODEST_CONF_CONNECT_AT_STARTUP, TRUE, NULL); -*/ - /* Global settings */ if (!modest_conf_key_exists (conf, MODEST_CONF_AUTO_UPDATE, NULL)) modest_conf_set_bool (conf, MODEST_CONF_AUTO_UPDATE, TRUE, NULL);