* compile fixes
[modest] / src / gtk / modest-ui-account-setup.c
index b13f5b7..8087b23 100644 (file)
@@ -1,6 +1,34 @@
-/* modest-ui-wizard.c */
+/* Copyright (c) 2006, Nokia Corporation
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Nokia Corporation nor the names of its
+ *   contributors may be used to endorse or promote products derived from
+ *   this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+ * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
-/* insert (c)/licensing information) */
+/* modest-ui-wizard.c */
 
 #include <gtk/gtk.h>
 #include <glade/glade.h>
@@ -161,11 +189,9 @@ account_delete_action(GtkWidget *button,
        gtk_widget_show_all(confirmation_dialog);
 
        result=gtk_dialog_run(GTK_DIALOG(confirmation_dialog));
-       if (result==GTK_RESPONSE_OK)
-       {
-               modest_account_mgr_remove_server_account(priv->modest_acc_mgr,
-                                                        account_name,
-                                                        NULL);
+       if (result==GTK_RESPONSE_OK) {
+               modest_account_mgr_remove_account(priv->modest_acc_mgr,
+                                                 account_name, TRUE, NULL);
        }
 
        gtk_widget_destroy(confirmation_dialog);
@@ -612,24 +638,29 @@ write_account(GladeXML *glade_xml, ModestUI *modest_ui, gboolean newaccount) {
                g_free(protocol);
                return retval;
        }
-       if (!modest_account_mgr_set_server_account_string(priv->modest_acc_mgr,
-                                                         account,
-                                                         MODEST_ACCOUNT_HOSTNAME,
-                                                         gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASHostnameEntry"))),
-                                                         NULL))
+       if (!modest_account_mgr_set_string(priv->modest_acc_mgr,
+                                          account,
+                                          MODEST_ACCOUNT_HOSTNAME,
+                                          gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASHostnameEntry"))),
+                                          TRUE,
+                                          NULL))
                return FALSE;
-       if (!modest_account_mgr_set_server_account_string(priv->modest_acc_mgr,
-                                                         account,
-                                                         MODEST_ACCOUNT_USERNAME,
-                                                         gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASUsernameEntry"))),
-                                                         NULL))
+       
+       if (!modest_account_mgr_set_string(priv->modest_acc_mgr,
+                                          account,
+                                          MODEST_ACCOUNT_USERNAME,
+                                          gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASUsernameEntry"))),
+                                          TRUE, NULL))
                return FALSE;
-       if (!modest_account_mgr_set_server_account_string(priv->modest_acc_mgr,
-                                                         account,
-                                                         MODEST_ACCOUNT_PASSWORD,
-                                                         gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASPasswordEntry"))),
-                                                         NULL))
+       
+       if (!modest_account_mgr_set_string(priv->modest_acc_mgr,
+                                          account,
+                                          MODEST_ACCOUNT_PASSWORD,
+                                          gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASPasswordEntry"))),
+                                          TRUE,
+                                          NULL))
                return FALSE;
+       
        return TRUE;
 }
 
@@ -784,10 +815,11 @@ account_setup_dialog (ModestUI *modest_ui, gchar *account) {
                gtk_widget_set_sensitive(awidget, FALSE);
                gtk_entry_set_text(GTK_ENTRY(awidget), account);
 
-               tmptext = modest_account_mgr_get_server_account_string(acc_mgr,
-                                                                      account,
-                                                                      MODEST_ACCOUNT_PROTO,
-                                                                      NULL);
+               tmptext = modest_account_mgr_get_string(acc_mgr,
+                                                       account,
+                                                       MODEST_ACCOUNT_PROTO,
+                                                       TRUE,
+                                                       NULL);
                awidget=glade_xml_get_widget(glade_xml, "ASProtocolComboBox");
                gtk_widget_set_sensitive(awidget, FALSE);
                typemodel = gtk_combo_box_get_model(GTK_COMBO_BOX(awidget));
@@ -796,26 +828,29 @@ account_setup_dialog (ModestUI *modest_ui, gchar *account) {
 
                g_free(tmptext);
 
-               tmptext = modest_account_mgr_get_server_account_string(acc_mgr,
-                                                               account,
-                                                               MODEST_ACCOUNT_HOSTNAME,
-                                                               NULL);
+               tmptext = modest_account_mgr_get_string(acc_mgr,
+                                                       account,
+                                                       MODEST_ACCOUNT_HOSTNAME,
+                                                       TRUE,
+                                                       NULL);
                awidget=glade_xml_get_widget(glade_xml, "ASHostnameEntry");
                gtk_entry_set_text(GTK_ENTRY(awidget), tmptext);
                g_free(tmptext);
 
-               tmptext = modest_account_mgr_get_server_account_string(acc_mgr,
-                                                               account,
-                                                               MODEST_ACCOUNT_USERNAME,
-                                                               NULL);
+               tmptext = modest_account_mgr_get_string(acc_mgr,
+                                                       account,
+                                                       MODEST_ACCOUNT_USERNAME,
+                                                       TRUE,
+                                                       NULL);
                awidget=glade_xml_get_widget(glade_xml, "ASUsernameEntry");
                gtk_entry_set_text(GTK_ENTRY(awidget), tmptext);
                g_free(tmptext);
-
-               tmptext = modest_account_mgr_get_server_account_string(acc_mgr,
-                                                               account,
-                                                               MODEST_ACCOUNT_PASSWORD,
-                                                               NULL);
+               
+               tmptext = modest_account_mgr_get_string(acc_mgr,
+                                                       account,
+                                                       MODEST_ACCOUNT_PASSWORD,
+                                                       TRUE,
+                                                       NULL);
                awidget=glade_xml_get_widget(glade_xml, "ASPasswordEntry");
                gtk_entry_set_text(GTK_ENTRY(awidget), tmptext);
                g_free(tmptext);
@@ -912,30 +947,32 @@ create_accounts_model(ModestAccountMgr *acc_mgr) {
        gchar *hostname;
        gchar *protocol;
 
-       acc_names_list = modest_account_mgr_server_account_names(acc_mgr,
-                                                                NULL,
-                                                                MODEST_PROTO_TYPE_ANY,
-                                                                NULL,
-                                                                FALSE);
+       acc_names_list = modest_account_mgr_search_server_accounts (acc_mgr,
+                                                                   NULL,
+                                                                   MODEST_PROTO_TYPE_ANY,
+                                                                   NULL);
        acc_list_store = gtk_list_store_new(ACCOUNT_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
 
        for (acc_names_list_iter=acc_names_list;
             acc_names_list_iter!=NULL;
             acc_names_list_iter=g_slist_next(acc_names_list_iter)) {
+
                gtk_list_store_append(acc_list_store, &acc_list_store_iter);
-               hostname=modest_account_mgr_get_server_account_string(acc_mgr,
-                                                                     acc_names_list_iter->data,
-                                                                     MODEST_ACCOUNT_HOSTNAME,
-                                                                     NULL);
-               protocol=modest_account_mgr_get_server_account_string(acc_mgr,
-                                                                     acc_names_list_iter->data,
-                                                                     MODEST_ACCOUNT_PROTO,
-                                                                     NULL);
+               hostname=modest_account_mgr_get_string(acc_mgr,
+                                                      acc_names_list_iter->data,
+                                                      MODEST_ACCOUNT_HOSTNAME,
+                                                      TRUE,
+                                                      NULL);
+               protocol=modest_account_mgr_get_string(acc_mgr,
+                                                      acc_names_list_iter->data,
+                                                      MODEST_ACCOUNT_PROTO,
+                                                      TRUE,
+                                                      NULL);
                gtk_list_store_set(acc_list_store, &acc_list_store_iter,
                                   ACCOUNT_NAME, acc_names_list_iter->data,
                                   ACCOUNT_HOST, hostname,
                                   ACCOUNT_PROT, protocol,
-                                  -1);
+                                  -1);         
                g_free(hostname);
                g_free(protocol);
        }