#include "modest-conf.h"
#include "modest-account-mgr.h"
+#include "modest-identity-mgr.h"
#include "modest-ui.h"
-#ifdef HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
#include <gtk/gtk.h>
GError *err = NULL;
int retval = 0;
-
+
static gboolean update, debug, reinstall;
static gchar *mailto, *subject, *bcc, *cc, *body;
-
+
static GOptionEntry options[] = {
{ "debug", 'd', 0, G_OPTION_ARG_NONE, &debug,
"Run in debug mode" },
{ "subject", 's', 0, G_OPTION_ARG_STRING, &subject,
"Subject for a new mail"},
{ "body", 'b', 0, G_OPTION_ARG_STRING, &body,
- "Body for a new email"},
+ "Body for a new email"},
{ "cc", 0, 0, G_OPTION_ARG_STRING, &cc,
- "CC-addresses for a new mail (comma-separated)"},
+ "CC-addresses for a new mail (comma-separated)"},
{ "bcc", 0, 0, G_OPTION_ARG_STRING, &bcc,
"BCC-adresses for a new mail (comma-separated)"},
{ "reinstall-factory-settings", 0, 0, G_OPTION_ARG_NONE, &reinstall,
{ NULL }
};
-
+
g_type_init ();
-
+
context = g_option_context_new (NULL);
g_option_context_add_main_entries (context, options, NULL);
-
+
if (!g_option_context_parse (context, &argc, &argv, &err)) {
g_printerr ("modest: error in command line parameter(s): %s\n",
err ? err->message : "");
goto cleanup;
}
+
+
+ gtk_init (&argc, &argv);
+
+ modest_icon_factory_init ();
-
- gtk_init (&argc, &argv);
modest_ui = MODEST_UI(modest_ui_new (modest_conf));
if (!modest_ui) {
g_warning ("failed to initialize ui");
{
gboolean ok;
gtk_init (&argc, &argv);
-
+
if (mailto||cc||bcc||subject||body)
ok = modest_ui_show_edit_window (modest_ui,
mailto, /* to */
gtk_main();
}
-
+
cleanup:
if (err)
g_error_free (err);
if (modest_ui)
g_object_unref (modest_ui);
-
+
if (modest_conf)
g_object_unref (modest_conf);
-
+
+ modest_icon_factory_uninit ();
+
return retval;
}
MODEST_CONF_EDIT_WINDOW_WIDTH_DEFAULT, NULL);
modest_conf_set_int (conf, MODEST_CONF_EDIT_WINDOW_HEIGHT,
MODEST_CONF_EDIT_WINDOW_HEIGHT_DEFAULT, NULL);
-
+
g_print ("modest: returned to factory settings\n");
}
install_test_account (ModestConf *conf)
{
ModestAccountMgr *acc_mgr;
+ ModestIdentityMgr *id_mgr;
const gchar *acc_name = "test";
g_return_if_fail (conf);
g_warning ("could not delete existing account");
}
}
-
+
if (!modest_account_mgr_add_account (acc_mgr, acc_name, "mystore", "mytransport", NULL))
g_warning ("failed to add test account");
+ else
+ {
+ modest_account_mgr_add_server_account (acc_mgr, "mystore", "localhost", "djcb",
+ 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,
+ "user@localhost",
+ "", "", FALSE, NULL, FALSE ))
+ g_warning ("failed to add test identity");
- modest_account_mgr_add_server_account (acc_mgr, "mystore", "localhost", "djcb",
- NULL, "imap");
- modest_account_mgr_add_server_account (acc_mgr, "mytransport", "localhost", NULL,
- NULL, "smtp");
g_object_unref (G_OBJECT(acc_mgr));
+ g_object_unref (G_OBJECT(id_mgr));
}