* modest-ui-wizard.c:
authorSilvan Marco Fin <silvan@kernelconcepts.de>
Fri, 9 Jun 2006 10:15:24 +0000 (10:15 +0000)
committerSilvan Marco Fin <silvan@kernelconcepts.de>
Fri, 9 Jun 2006 10:15:24 +0000 (10:15 +0000)
  - removed some debugging messages from modest-ui-wizard.c
  - corrected server_account detection in modest-ui-wizard.c
  - removed unnescessary instantiations of id_mgr and acc_mgr in
    wizard_add_account
* modest-main.c
  - obsoleted install_test_account removed (for wizard to come)
  - g_type_init removed and gtk_init(...) moved up to this position

pmo-trunk-r208

src/gtk-glade/modest-ui-wizard.c
src/modest-main.c

index bf8c556..e3e4b72 100644 (file)
@@ -118,19 +118,14 @@ gchar *search_unused_account_or_idenitity_name(gpointer mgr, gchar *draft)
 
        tmpaccount_name=g_string_new("");
        g_string_printf(tmpaccount_name, "%s", draft);
-       g_message("mgr is account_mgr: %d", MODEST_IS_ACCOUNT_MGR(mgr));
        if(MODEST_IS_ACCOUNT_MGR(mgr))
        {
-               g_message("acc_mgr_acc_exists for '%s': %d", tmpaccount_name->str, modest_account_mgr_server_account_exists(mgr, tmpaccount_name->str, NULL));
-               for(counter=0; modest_account_mgr_account_exists(mgr, tmpaccount_name->str, NULL); counter++)
+               for(counter=0; modest_account_mgr_server_account_exists(mgr, tmpaccount_name->str, NULL); counter++)
                        g_string_printf(tmpaccount_name, "%s%d", draft, counter);
        }
        else
-       {
-               g_message("id_mgr_id_exists for '%s': %d", tmpaccount_name->str, modest_identity_mgr_identity_exists(mgr, tmpaccount_name->str, NULL));
                for(counter=0;      modest_identity_mgr_identity_exists(mgr, tmpaccount_name->str, NULL); counter++)
                        g_string_printf(tmpaccount_name, "%s%d", draft, counter);
-       }
 
        return g_string_free(tmpaccount_name, FALSE);
 }
@@ -149,12 +144,8 @@ gboolean wizard_account_add(GladeXML *glade_xml, ModestUI *modest_ui)
        priv = MODEST_UI_GET_PRIVATE(MODEST_UI(modest_ui));
        conf = priv->modest_conf;
 
-
-       acc_mgr = MODEST_ACCOUNT_MGR(modest_account_mgr_new (conf));
-       if (!acc_mgr) {
-               g_warning ("failed to instantiate account mgr");
-               return FALSE;
-       }
+       acc_mgr = priv->modest_acc_mgr;
+       id_mgr = priv->modest_id_mgr;
 
        tmptext2=get_text_from_combobox(glade_xml_get_widget(glade_xml, "AWMailboxtypeComboBox"));
        tmptext=g_utf8_strdown(tmptext2, -1);
@@ -179,7 +170,6 @@ gboolean wizard_account_add(GladeXML *glade_xml, ModestUI *modest_ui)
                                               "smtp");
        g_free(tmpaccount_name);
 
-       id_mgr = MODEST_IDENTITY_MGR(modest_identity_mgr_new (conf));
        tmpaccount_name=search_unused_account_or_idenitity_name(id_mgr, "default");
        if (!modest_identity_mgr_add_identity (id_mgr,
                                               tmpaccount_name,
@@ -188,8 +178,6 @@ gboolean wizard_account_add(GladeXML *glade_xml, ModestUI *modest_ui)
                g_warning ("failed to add default identity");
 
        g_free(tmpaccount_name);
-       g_object_unref (G_OBJECT(acc_mgr));
-       g_object_unref (G_OBJECT(id_mgr));
        return TRUE;
 }
 
index c1fab8b..8b59653 100644 (file)
@@ -13,8 +13,6 @@
 #include <gtk/gtk.h>
 
 static void install_basic_conf_settings (ModestConf *conf);
-static void install_test_account        (ModestConf *conf);
-
 
 int
 main (int argc, char *argv[])
@@ -50,8 +48,7 @@ main (int argc, char *argv[])
                { NULL }
        };
 
-
-       g_type_init ();
+       gtk_init (&argc, &argv);
 
        context = g_option_context_new (NULL);
        g_option_context_add_main_entries (context, options, NULL);
@@ -76,27 +73,23 @@ main (int argc, char *argv[])
        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_icon_factory_init ();
-       
+
        modest_ui = MODEST_UI(modest_ui_new (modest_conf));
        if (!modest_ui) {
                g_warning ("failed to initialize ui");
                goto cleanup;
        }
-       
+
        {
                gboolean ok;
                gtk_init (&argc, &argv);
 
-               if (mailto||cc||bcc||subject||body) {
+                if (mailto||cc||bcc||subject||body) {
+                        ok = FALSE;
 #if 0
                        ok = modest_ui_new_edit_window (modest_ui,
                                                         mailto,  /* to */
@@ -157,48 +150,3 @@ install_basic_conf_settings (ModestConf *conf)
 }
 
 
-static void
-install_test_account (ModestConf *conf)
-{
-       ModestAccountMgr *acc_mgr;
-       ModestIdentityMgr *id_mgr;
-       const gchar *acc_name = "test";
-       g_return_if_fail (conf);
-
-       acc_mgr = MODEST_ACCOUNT_MGR(modest_account_mgr_new (conf));
-       if (!acc_mgr) {
-               g_warning ("failed to instantiate account mgr");
-               return;
-       }
-
-       if (modest_account_mgr_account_exists (acc_mgr, acc_name, NULL)) {
-               if (!modest_account_mgr_remove_account(acc_mgr, acc_name, NULL)) {
-                       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");
-       
-       g_object_unref (G_OBJECT(acc_mgr));
-       g_object_unref (G_OBJECT(id_mgr));
-}