X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmodest-main.c;h=0804f1c5dbd41cc039e1fd71feaf2dc81c956551;hb=c2ad13506a698f37d5e7f0a4265c91158dc0ad66;hp=b9f687681490a4f12ae8410a889c3b54e066fe85;hpb=6ed23d6ec6b9a8ecd3145df32925c977ae777a72;p=modest diff --git a/src/modest-main.c b/src/modest-main.c index b9f6876..0804f1c 100644 --- a/src/modest-main.c +++ b/src/modest-main.c @@ -3,7 +3,9 @@ #include "modest-conf.h" #include "modest-account-mgr.h" +#include "modest-identity-mgr.h" #include "modest-ui.h" +#include "modest-icon-factory.h" #ifdef HAVE_CONFIG_H #include @@ -71,16 +73,16 @@ main (int argc, char *argv[]) goto cleanup; } + gtk_init (&argc, &argv); + + modest_icon_factory_init (); + if (reinstall) { modest_conf_remove_key (modest_conf, MODEST_CONF_NAMESPACE, NULL); install_basic_conf_settings (modest_conf); - install_test_account (modest_conf); goto cleanup; } - - - gtk_init (&argc, &argv); modest_ui = MODEST_UI(modest_ui_new (modest_conf)); if (!modest_ui) { g_warning ("failed to initialize ui"); @@ -91,15 +93,17 @@ main (int argc, char *argv[]) gboolean ok; gtk_init (&argc, &argv); - if (mailto||cc||bcc||subject||body) - ok = modest_ui_show_edit_window (modest_ui, + if (mailto||cc||bcc||subject||body) { +#if 0 + ok = modest_ui_new_edit_window (modest_ui, mailto, /* to */ cc, /* cc */ bcc, /* bcc */ subject, /* subject */ body, /* body */ NULL); /* attachments */ - else +#endif + } else ok = modest_ui_show_main_window (modest_ui); if (!ok) @@ -122,6 +126,8 @@ cleanup: if (modest_conf) g_object_unref (modest_conf); + modest_icon_factory_uninit (); + return retval; } @@ -152,6 +158,7 @@ static void install_test_account (ModestConf *conf) { ModestAccountMgr *acc_mgr; + ModestIdentityMgr *id_mgr; const gchar *acc_name = "test"; g_return_if_fail (conf); @@ -175,7 +182,21 @@ install_test_account (ModestConf *conf) NULL, "imap"); modest_account_mgr_add_server_account (acc_mgr, "mytransport", "localhost", NULL, NULL, "smtp"); + + } + id_mgr = MODEST_IDENTITY_MGR(modest_identity_mgr_new (conf)); + if (modest_identity_mgr_identity_exists(id_mgr, "myidentity", NULL)) { + if (!modest_identity_mgr_remove_identity(id_mgr, "myidentity", NULL)) { + g_warning ("could not delete existing identity"); + } } + if (!modest_identity_mgr_add_identity (id_mgr, + MODEST_IDENTITY_DEFAULT_IDENTITY, + "Default User", + "user@localhost", + "", "", FALSE, NULL, FALSE )) + g_warning ("failed to add test identity"); + g_object_unref (G_OBJECT(acc_mgr)); + g_object_unref (G_OBJECT(id_mgr)); } -