* make it compile again with latest Tinymail; does not work yet though.
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Thu, 26 Oct 2006 08:14:43 +0000 (08:14 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Thu, 26 Oct 2006 08:14:43 +0000 (08:14 +0000)
pmo-trunk-r475

42 files changed:
ChangeLog
README
docs/reference/modest-docs.sgml
docs/reference/tmpl/modest-proto.sgml
docs/reference/tmpl/modest-tny-transport-actions.sgml
docs/reference/tmpl/modest-unused.sgml
docs/reference/tmpl/modest-window-mgr.sgml
src/Makefile.am
src/gtk/modest-account-assistant.c
src/gtk/modest-account-view-window.c
src/gtk/modest-edit-msg-window.c
src/gtk/modest-edit-msg-window.h
src/gtk/modest-icon-names.h
src/gtk/modest-main-window.c
src/gtk/modest-store-widget.c
src/gtk/modest-transport-widget.c
src/modest-account-mgr.c
src/modest-account-mgr.h
src/modest-conf.c
src/modest-main.c
src/modest-tny-account-store.c
src/modest-tny-attachment.c
src/modest-tny-attachment.h
src/modest-tny-msg-actions.c
src/modest-tny-msg-actions.h
src/modest-tny-store-actions.c
src/modest-tny-store-actions.h
src/modest-tny-stream-gtkhtml.c
src/modest-tny-stream-gtkhtml.h
src/modest-tny-transport-actions.c
src/modest-tny-transport-actions.h
src/modest-widget-factory.c
src/modest-widget-factory.h
src/widgets/modest-account-view.c
src/widgets/modest-combo-box.c
src/widgets/modest-combo-box.h
src/widgets/modest-folder-view.c
src/widgets/modest-folder-view.h
src/widgets/modest-header-view.c
src/widgets/modest-header-view.h
src/widgets/modest-msg-view.c
src/widgets/modest-msg-view.h

index 4d237aa..e69de29 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +0,0 @@
-2006-05-11  Florian Boor <fb@kernelconcepts.de>
-
-       * Add module list.
-
-2006-05-10  Florian Boor <fb@kernelconcepts.de>
-
-       * Install glade file.
-       * Use installed glade file.
diff --git a/README b/README
index 4388450..ddf944c 100644 (file)
--- a/README
+++ b/README
@@ -1,14 +1,14 @@
 modest
 ------
 
-"modest" is a modest e-mail program, based on Philip van Hoofs *tinymail*.
+"modest" is a modest e-mail program, based on Philip van Hoof's *tinymail*.
 tinymail is an effort to ease the writing of email programs, in particular
 for small devices.
 
 And while tinymail can support just about anything, we are using it's 
 *libcamel* backend for mail protocol implementation.
 
-More about camel: http://go-evolution.org/Camel (* currently down *)
+More about camel: http://go-evolution.org/Camel
 More about tinymail: https://svn.cronos.be/svn/tinymail/trunk/
 
 
index 2b5afe3..093e821 100644 (file)
       with <command>gcc</command>'s <symbol>-Wall</symbol> compile option. Of
       course this might not always be possible due to problems in dependent
       libraries and/or compiler version. Therefore, do not
-      include <symbol>-Werror</symbol> in the standard compile options.
+      include <symbol>-Werror</symbol> in the standard compile options; but
+      do use it when building / testing things yourself.
+    </para>
+
+    <para>
+      Code should also run cleanly. GTK+/GLib warnings and errors must be
+      taken very seriously. If you run <application>modest</application> with
+      the <symbol>-d</symbol>-flag, it will <symbol>abort</symbol> whenever
+      there is such a warning. This can be useful when running inside the
+      debugger. 
     </para>
     
     <para>Global functions (the ones in <filename>.h</filename>-files) must
index 3db5e3c..221a4fc 100644 (file)
@@ -17,56 +17,3 @@ modest-proto
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### MACRO MODEST_PROTO_SENDMAIL ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO MODEST_PROTO_SMTP ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO MODEST_PROTO_POP ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO MODEST_PROTO_IMAP ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### TYPEDEF ModestProtoType ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### FUNCTION modest_proto_is_valid ##### -->
-<para>
-
-</para>
-
-@proto: 
-@store_proto: 
-@Returns: 
-
-
-<!-- ##### FUNCTION modest_proto_type ##### -->
-<para>
-
-</para>
-
-@proto: 
-@Returns: 
-
-
index 37f0e83..898f638 100644 (file)
@@ -17,27 +17,11 @@ ModestTnyTransportActions
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### STRUCT ModestTnyTransportActions ##### -->
-<para>
-
-</para>
-
-@parent: 
-
-<!-- ##### FUNCTION modest_tny_transport_actions_new ##### -->
-<para>
-
-</para>
-
-@Returns: 
-
-
 <!-- ##### FUNCTION modest_tny_transport_actions_send_message ##### -->
 <para>
 
 </para>
 
-@self: 
 @transport_account: 
 @from: 
 @to: 
index 1853bd4..8f82678 100644 (file)
 </para>
 
 
+<!-- ##### MACRO MODEST_PROTO_IMAP ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO MODEST_PROTO_POP ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO MODEST_PROTO_SENDMAIL ##### -->
+<para>
+
+</para>
+
+
+<!-- ##### MACRO MODEST_PROTO_SMTP ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### STRUCT ModestEditWindow ##### -->
 <para>
 
 
 @parent: 
 
+<!-- ##### STRUCT ModestOpenWindow ##### -->
+<para>
+
+</para>
+
+@win: 
+@type: 
+@id: 
+
+<!-- ##### TYPEDEF ModestProtoType ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### STRUCT ModestTnyFolderTreeView ##### -->
 <para>
 
 
 @parent: 
 
+<!-- ##### STRUCT ModestTnyTransportActions ##### -->
+<para>
+
+</para>
+
+@parent: 
+
+<!-- ##### STRUCT ModestWindowMgr ##### -->
+<para>
+
+</para>
+
+@parent: 
+
+<!-- ##### TYPEDEF ModestWindowType ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### FUNCTION modest_account_mgr_get_account_bool ##### -->
 <para>
 
 @attachments: 
 @Returns: 
 
+<!-- ##### FUNCTION modest_proto_is_valid ##### -->
+<para>
+
+</para>
+
+@proto: 
+@store_proto: 
+@Returns: 
+
+<!-- ##### FUNCTION modest_proto_type ##### -->
+<para>
+
+</para>
+
+@proto: 
+@Returns: 
+
 <!-- ##### FUNCTION modest_tny_folder_tree_view_is_empty ##### -->
 <para>
 
 @self: 
 @tny_msg: 
 
+<!-- ##### FUNCTION modest_tny_transport_actions_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
 <!-- ##### FUNCTION modest_ui_show_edit_window ##### -->
 <para>
 
 @att: 
 @Returns: 
 
+<!-- ##### FUNCTION modest_window_mgr_find_by_id ##### -->
+<para>
+
+</para>
+
+@self: 
+@window_id: 
+@Returns: 
+
+<!-- ##### FUNCTION modest_window_mgr_find_by_type ##### -->
+<para>
+
+</para>
+
+@self: 
+@type: 
+@Returns: 
+
+<!-- ##### FUNCTION modest_window_mgr_new ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+<!-- ##### FUNCTION modest_window_mgr_register ##### -->
+<para>
+
+</para>
+
+@self: 
+@win: 
+@type: 
+@window_id: 
+@Returns: 
+
+<!-- ##### FUNCTION modest_window_mgr_unregister ##### -->
+<para>
+
+</para>
+
+@self: 
+@win: 
+@Returns: 
+
index de25fba..f2bdc71 100644 (file)
@@ -17,75 +17,3 @@ ModestWindowMgr
 <!-- ##### SECTION Stability_Level ##### -->
 
 
-<!-- ##### TYPEDEF ModestWindowType ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### STRUCT ModestOpenWindow ##### -->
-<para>
-
-</para>
-
-@win: 
-@type: 
-@id: 
-
-<!-- ##### STRUCT ModestWindowMgr ##### -->
-<para>
-
-</para>
-
-@parent: 
-
-<!-- ##### FUNCTION modest_window_mgr_new ##### -->
-<para>
-
-</para>
-
-@Returns: 
-
-
-<!-- ##### FUNCTION modest_window_mgr_register ##### -->
-<para>
-
-</para>
-
-@self: 
-@win: 
-@type: 
-@window_id: 
-@Returns: 
-
-
-<!-- ##### FUNCTION modest_window_mgr_unregister ##### -->
-<para>
-
-</para>
-
-@self: 
-@win: 
-@Returns: 
-
-
-<!-- ##### FUNCTION modest_window_mgr_find_by_type ##### -->
-<para>
-
-</para>
-
-@self: 
-@type: 
-@Returns: 
-
-
-<!-- ##### FUNCTION modest_window_mgr_find_by_id ##### -->
-<para>
-
-</para>
-
-@self: 
-@window_id: 
-@Returns: 
-
-
index 10c64b2..994d8d8 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Makefile.am
-# Time-stamp: <2006-07-24 11:11:09 (djcb)>
+# Time-stamp: <2006-08-17 14:29:08 (djcb)>
 SUBDIRS=$(MODEST_PLATFORM_DIR) widgets
 DIST_SUBDIRS = widgets gtk
 
@@ -28,6 +28,8 @@ modest_SOURCES=\
        modest-conf-keys.h\
        modest-conf.h \
        modest-conf.c\
+       modest-pair.h\
+       modest-pair.c\
        modest-widget-factory.h\
        modest-widget-factory.c\
        modest-widget-memory.h\
@@ -41,8 +43,8 @@ modest_SOURCES=\
        modest-tny-account-store.c\
        modest-tny-msg-actions.h\
        modest-tny-msg-actions.c\
-       modest-proto.h\
-       modest-proto.c\
+       modest-protocol-mgr.h\
+       modest-protocol-mgr.c\
        modest-ui.h\
        modest-text-utils.h\
        modest-text-utils.c\
index ddd89c9..9f01ecb 100644 (file)
@@ -86,6 +86,7 @@ modest_account_assistant_get_type (void)
                        sizeof(ModestAccountAssistant),
                        1,              /* n_preallocs */
                        (GInstanceInitFunc) modest_account_assistant_init,
+                       NULL
                };
                my_type = g_type_register_static (GTK_TYPE_ASSISTANT,
                                                  "ModestAccountAssistant",
index 0109396..50ab756 100644 (file)
@@ -73,6 +73,7 @@ modest_account_view_window_get_type (void)
                        sizeof(ModestAccountViewWindow),
                        1,              /* n_preallocs */
                        (GInstanceInitFunc) modest_account_view_window_init,
+                       NULL
                };
                my_type = g_type_register_static (GTK_TYPE_WINDOW,
                                                  "ModestAccountViewWindow",
index d09f149..ff5e5af 100644 (file)
@@ -53,7 +53,7 @@ struct _ModestEditMsgWindowPrivate {
        
        GtkWidget      *toolbar, *menubar;
        GtkWidget      *msg_body;
-       GtkWidget      *to_field, *cc_field, *bcc_field,
+       GtkWidget      *from_field, *to_field, *cc_field, *bcc_field,
                       *subject_field;
 };
 #define MODEST_EDIT_MSG_WINDOW_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
@@ -156,42 +156,42 @@ on_menu_quit (ModestEditMsgWindow *self, guint action, GtkWidget *widget)
 
 /* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */
 static GtkItemFactoryEntry menu_items[] = {
-       { "/_File",             NULL,                   NULL,           0, "<Branch>" },
+       { "/_File",             NULL,                   NULL,           0, "<Branch>" ,NULL},
        { "/File/_New",         "<control>N",           NULL,           0, "<StockItem>", GTK_STOCK_NEW },
        { "/File/_Open",        "<control>O",           NULL,           0, "<StockItem>", GTK_STOCK_OPEN },
        { "/File/_Save",        "<control>S",           NULL,           0, "<StockItem>", GTK_STOCK_SAVE },
-       { "/File/Save _As",     NULL,                   NULL,           0, "<Item>" },
-       { "/File/Save Draft",   "<control><shift>S",    NULL,           0, "<Item>" },
+       { "/File/Save _As",     NULL,                   NULL,           0, "<Item>", NULL} ,
+       { "/File/Save Draft",   "<control><shift>S",    NULL,           0, "<Item>",NULL },
 
 
-       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>" },
+       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>" ,NULL },
        { "/File/_Quit",        "<CTRL>Q",              on_menu_quit,   0, "<StockItem>", GTK_STOCK_QUIT },
 
-       { "/_Edit",             NULL,                   NULL,           0, "<Branch>" },
+       { "/_Edit",             NULL,                   NULL,           0, "<Branch>" ,NULL },
        { "/Edit/_Undo",        "<CTRL>Z",              NULL,           0, "<StockItem>", GTK_STOCK_UNDO },
        { "/Edit/_Redo",        "<shift><CTRL>Z",       NULL,           0, "<StockItem>", GTK_STOCK_REDO },
-       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>" },
+       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>",NULL },
        { "/Edit/Cut",          "<control>X",           NULL,           0, "<StockItem>", GTK_STOCK_CUT  },
        { "/Edit/Copy",         "<CTRL>C",              NULL,           0, "<StockItem>", GTK_STOCK_COPY },
        { "/Edit/Paste",        NULL,                   NULL,           0, "<StockItem>", GTK_STOCK_PASTE},
-       { "/Edit/sep1",         NULL,                   NULL,           0, "<Separator>" },
-       { "/Edit/Delete",       "<CTRL>Q",              NULL,           0, "<Item>" },
-       { "/Edit/Select all",   "<CTRL>A",              NULL,           0, "<Item>" },
-       { "/Edit/Deselect all",  "<Shift><CTRL>A",      NULL,           0, "<Item>" },
+       { "/Edit/sep1",         NULL,                   NULL,           0, "<Separator>",NULL },
+       { "/Edit/Delete",       "<CTRL>Q",              NULL,           0, "<Item>" ,NULL },
+       { "/Edit/Select all",   "<CTRL>A",              NULL,           0, "<Item>" ,NULL },
+       { "/Edit/Deselect all",  "<Shift><CTRL>A",      NULL,           0, "<Item>",NULL },
 
-       { "/_View",             NULL,           NULL,           0, "<Branch>" },
-       { "/View/To-field",          NULL,              NULL,           0, "<CheckItem>" },
+       { "/_View",             NULL,           NULL,                   0, "<Branch>",NULL },
+       { "/View/To-field",          NULL,              NULL,           0, "<CheckItem>",NULL },
        
-       { "/View/Cc-field:",          NULL,             NULL,           0, "<CheckItem>" },
-       { "/View/Bcc-field:",          NULL,            NULL,           0, "<CheckItem>" },
+       { "/View/Cc-field:",          NULL,             NULL,           0, "<CheckItem>",NULL },
+       { "/View/Bcc-field:",          NULL,            NULL,           0, "<CheckItem>",NULL },
        
        
-       { "/_Insert",             NULL,         NULL,           0, "<Branch>" },
+       { "/_Insert",             NULL,         NULL,           0, "<Branch>",NULL },
 /*     { "/Actions/_Reply",    NULL,                   NULL,           0, "<Item>" }, */
 /*     { "/Actions/_Forward",  NULL,                   NULL,           0, "<Item>" }, */
 /*     { "/Actions/_Bounce",   NULL,                   NULL,           0, "<Item>" },   */
        
-       { "/_Format",            NULL,                  NULL,           0, "<Branch>" }
+       { "/_Format",            NULL,                  NULL,           0, "<Branch>",NULL }
 /*     { "/Options/_Accounts",  NULL,                  on_menu_accounts,0, "<Item>" }, */
 /*     { "/Options/_Contacts",  NULL,                  NULL,           0, "<Item>" }, */
 
@@ -235,19 +235,19 @@ send_mail (ModestEditMsgWindow *self)
        const gchar *from, *to, *cc, *bcc, *subject;
        gchar *body;
        ModestEditMsgWindowPrivate *priv;
-
+       
        GtkTextBuffer *buf;
        GtkTextIter b, e;
        
        priv = MODEST_EDIT_MSG_WINDOW_GET_PRIVATE(self);
 
        /* don't free these */
-       from = "djcb@djcbsoftware.nl";
-       to   =  gtk_entry_get_text (GTK_ENTRY(priv->to_field));
-       cc   =  gtk_entry_get_text (GTK_ENTRY(priv->cc_field));
-       bcc  =  gtk_entry_get_text (GTK_ENTRY(priv->bcc_field));
-       to   =  gtk_entry_get_text (GTK_ENTRY(priv->subject_field));
-
+       from    = "djcb@djcbsoftware.nl";
+       to      =  gtk_entry_get_text (GTK_ENTRY(priv->to_field));
+       cc      =  gtk_entry_get_text (GTK_ENTRY(priv->cc_field));
+       bcc     =  gtk_entry_get_text (GTK_ENTRY(priv->bcc_field));
+       subject =  gtk_entry_get_text (GTK_ENTRY(priv->subject_field));
+       
        /* don't unref */
        buf   =  gtk_text_view_get_buffer (GTK_TEXT_VIEW(priv->msg_body));
        
@@ -319,7 +319,7 @@ toolbar_new (ModestEditMsgWindow *self)
 static void
 init_window (ModestEditMsgWindow *obj)
 {
-       GtkWidget *to_button, *cc_button, *bcc_button, *subject_label; 
+       GtkWidget *to_button, *cc_button, *bcc_button; 
        GtkWidget *header_table;
        GtkWidget *main_vbox;
        
@@ -329,27 +329,29 @@ init_window (ModestEditMsgWindow *obj)
        to_button     = gtk_button_new_with_label (_("To..."));
        cc_button     = gtk_button_new_with_label (_("Cc..."));
        bcc_button    = gtk_button_new_with_label (_("Bcc..."));
-       subject_label = gtk_label_new (_("Subject:"));
-       
+
+       priv->from_field    = modest_widget_factory_get_combo_box (priv->factory,
+                                                                  MODEST_COMBO_BOX_TYPE_TRANSPORTS);
        priv->to_field      = gtk_entry_new_with_max_length (40);
        priv->cc_field      = gtk_entry_new_with_max_length (40);
        priv->bcc_field     = gtk_entry_new_with_max_length (40);
        priv->subject_field = gtk_entry_new_with_max_length (40);
-
-       header_table = gtk_table_new (4,2, FALSE);
-       gtk_table_attach (GTK_TABLE(header_table), to_button,     0,1,0,1,
-                         GTK_SHRINK, 0, 0, 0);
-       gtk_table_attach (GTK_TABLE(header_table), cc_button,     0,1,1,2,
-                         GTK_SHRINK, 0, 0, 0);
-       gtk_table_attach (GTK_TABLE(header_table), bcc_button,    0,1,2,3,
-                         GTK_SHRINK, 0, 0, 0);
-       gtk_table_attach (GTK_TABLE(header_table), subject_label, 0,1,3,4,
-                         GTK_SHRINK, 0, 0, 0);
-       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->to_field,     1,2,0,1);
-       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->cc_field,     1,2,1,2);
-       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->bcc_field,    1,2,2,3);
-       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->subject_field,1,2,3,4);
+       
+       header_table = gtk_table_new (5,2, FALSE);
+       
+       gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("From:")),
+                         0,1,0,1, GTK_SHRINK, 0, 0, 0);
+       gtk_table_attach (GTK_TABLE(header_table), to_button,     0,1,1,2, GTK_SHRINK, 0, 0, 0);
+       gtk_table_attach (GTK_TABLE(header_table), cc_button,     0,1,2,3, GTK_SHRINK, 0, 0, 0);
+       gtk_table_attach (GTK_TABLE(header_table), bcc_button,    0,1,3,4, GTK_SHRINK, 0, 0, 0);
+       gtk_table_attach (GTK_TABLE(header_table), gtk_label_new (_("Subject:")),
+                         0,1,4,5, GTK_SHRINK, 0, 0, 0);
+
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->from_field,   1,2,0,1);
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->to_field,     1,2,1,2);
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->cc_field,     1,2,2,3);
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->bcc_field,    1,2,3,4);
+       gtk_table_attach_defaults (GTK_TABLE(header_table), priv->subject_field,1,2,4,5);
 
        priv->msg_body = gtk_text_view_new ();
        
@@ -405,7 +407,7 @@ modest_edit_msg_window_new (ModestConf *conf, ModestWidgetFactory *factory,
 
        g_return_val_if_fail (conf, NULL);
        g_return_val_if_fail (factory, NULL);
-       g_return_val_if_fail (type >= 0 && type < MODEST_EDIT_TYPE_NUM, NULL);
+       g_return_val_if_fail (type < MODEST_EDIT_TYPE_NUM, NULL);
        g_return_val_if_fail (!(type==MODEST_EDIT_TYPE_NEW && msg), NULL); 
        g_return_val_if_fail (!(type!=MODEST_EDIT_TYPE_NEW && !msg), NULL);     
        
index 422e0d3..53bbd14 100644 (file)
@@ -31,7 +31,7 @@
 #define __MODEST_EDIT_MSG_WINDOW_H__
 
 #include <gtk/gtk.h>
-#include <tny-msg-iface.h>
+#include <tny-msg.h>
 #include <modest-conf.h>
 #include <modest-widget-factory.h>
 #include <glib/gi18n.h>
index fc39ad5..99f1135 100644 (file)
 #define  MODEST_TOOLBAR_ICON_SEND_RECEIVE      PIXMAP_PREFIX "gtk-refresh.svg"
 #define  MODEST_TOOLBAR_ICON_REPLY             PIXMAP_PREFIX "gnome-stock-mail-rpl.svg"
 #define  MODEST_TOOLBAR_ICON_REPLY_ALL         PIXMAP_PREFIX "mail-reply-all.svg"
-#define  MODEST_TOOLBAR_ICON_FORWARD           PIXMAP_PREFIX "forward.svg"
+#define  MODEST_TOOLBAR_ICON_FORWARD           PIXMAP_PREFIX "mail-forward.svg"
 #define  MODEST_TOOLBAR_ICON_DELETE            PIXMAP_PREFIX "edit-delete.svg"
-#define  MODEST_TOOLBAR_ICON_NEXT              PIXMAP_PREFIX "back.svg"
-#define  MODEST_TOOLBAR_ICON_PREV              PIXMAP_PREFIX "forward.svg"
+#define  MODEST_TOOLBAR_ICON_NEXT              PIXMAP_PREFIX "forward.svg"
+#define  MODEST_TOOLBAR_ICON_PREV              PIXMAP_PREFIX "back.svg"
 #define  MODEST_TOOLBAR_ICON_STOP              PIXMAP_PREFIX "stock-stop.svg"
 
 #endif  /*__MODEST_TNY_ICON_NAMES_H__*/
index b863849..83e058b 100644 (file)
@@ -233,38 +233,38 @@ on_menu_quit (ModestMainWindow *self, guint action, GtkWidget *widget)
 
 /* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */
 static GtkItemFactoryEntry menu_items[] = {
-       { "/_File",             NULL,                   NULL,           0, "<Branch>" },
+       { "/_File",             NULL,                   NULL,           0, "<Branch>", NULL },
        { "/File/_New",         "<control>N",           NULL,           0, "<StockItem>", GTK_STOCK_NEW },
        { "/File/_Open",        "<control>O",           NULL,           0, "<StockItem>", GTK_STOCK_OPEN },
        { "/File/_Save",        "<control>S",           NULL,           0, "<StockItem>", GTK_STOCK_SAVE },
-       { "/File/Save _As",     NULL,                   NULL,           0, "<Item>" },
-       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>" },
+       { "/File/Save _As",     NULL,                   NULL,           0, "<Item>", NULL },
+       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>", NULL },
        { "/File/_Quit",        "<CTRL>Q",              on_menu_quit,  0, "<StockItem>", GTK_STOCK_QUIT },
 
-       { "/_Edit",             NULL,                   NULL,           0, "<Branch>" },
+       { "/_Edit",             NULL,                   NULL,           0, "<Branch>", NULL },
        { "/Edit/_Undo",        "<CTRL>Z",              NULL,           0, "<StockItem>", GTK_STOCK_UNDO },
        { "/Edit/_Redo",        "<shift><CTRL>Z",       NULL,           0, "<StockItem>", GTK_STOCK_REDO },
-       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>" },
+       { "/File/sep1",         NULL,                   NULL,           0, "<Separator>", NULL },
        { "/Edit/Cut",          "<control>X",           NULL,           0, "<StockItem>", GTK_STOCK_CUT  },
        { "/Edit/Copy",         "<CTRL>C",              NULL,           0, "<StockItem>", GTK_STOCK_COPY },
        { "/Edit/Paste",        NULL,                   NULL,           0, "<StockItem>", GTK_STOCK_PASTE},
-       { "/Edit/sep1",         NULL,                   NULL,           0, "<Separator>" },
-       { "/Edit/Delete",       "<CTRL>Q",              NULL,           0, "<Item>" },
-       { "/Edit/Select all",   "<CTRL>A",              NULL,           0, "<Item>" },
-       { "/Edit/Deelect all",  "<Shift><CTRL>A",       NULL,           0, "<Item>" },
-
-       { "/_Actions",                NULL,             NULL,           0, "<Branch>" },
-       { "/Actions/_New Message",    NULL,             on_menu_new_message,            0, "<Item>" },
-       { "/Actions/_Reply",    NULL,                   NULL,           0, "<Item>" },
-       { "/Actions/_Forward",  NULL,                   NULL,           0, "<Item>" },
-       { "/Actions/_Bounce",   NULL,                   NULL,           0, "<Item>" },  
+       { "/Edit/sep1",         NULL,                   NULL,           0, "<Separator>", NULL },
+       { "/Edit/Delete",       "<CTRL>Q",              NULL,           0, "<Item>" ,NULL},
+       { "/Edit/Select all",   "<CTRL>A",              NULL,           0, "<Item>" ,NULL},
+       { "/Edit/Deelect all",  "<Shift><CTRL>A",       NULL,           0, "<Item>" ,NULL},
+
+       { "/_Actions",                NULL,             NULL,           0, "<Branch>" ,NULL},
+       { "/Actions/_New Message",    NULL,             on_menu_new_message,            0, "<Item>",NULL },
+       { "/Actions/_Reply",    NULL,                   NULL,           0, "<Item>" ,NULL},
+       { "/Actions/_Forward",  NULL,                   NULL,           0, "<Item>" ,NULL},
+       { "/Actions/_Bounce",   NULL,                   NULL,           0, "<Item>",NULL },     
        
-       { "/_Options",           NULL,                  NULL,           0, "<Branch>" },
-       { "/Options/_Accounts",  NULL,                  on_menu_accounts,0, "<Item>" },
-       { "/Options/_Contacts",  NULL,                  NULL,           0, "<Item>" },
+       { "/_Options",           NULL,                  NULL,           0, "<Branch>" ,NULL},
+       { "/Options/_Accounts",  NULL,                  on_menu_accounts,0, "<Item>" ,NULL},
+       { "/Options/_Contacts",  NULL,                  NULL,           0, "<Item>" ,NULL },
 
 
-       { "/_Help",         NULL,                       NULL,           0, "<Branch>" },
+       { "/_Help",         NULL,                       NULL,           0, "<Branch>" ,NULL},
        { "/_Help/About",   NULL,                       on_menu_about,  0, "<StockItem>", GTK_STOCK_ABOUT},
 };
 
@@ -330,17 +330,42 @@ static void
 on_toolbar_button_clicked (ModestToolbar *toolbar, ModestToolbarButton button_id,
                           ModestMainWindow *self)
 {
+       GtkTreeSelection *sel;
+       GtkTreeIter iter;
+       GtkTreeModel *model;
+       ModestMainWindowPrivate *priv;
+
+       priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
+       
        switch (button_id) {
        case MODEST_TOOLBAR_BUTTON_NEW_MAIL:
                on_menu_new_message (self, 0, NULL);
                break;
-               
        case MODEST_TOOLBAR_BUTTON_REPLY:
+               break;
        case MODEST_TOOLBAR_BUTTON_REPLY_ALL:
+               break;
        case MODEST_TOOLBAR_BUTTON_FORWARD:
+               break;
        case MODEST_TOOLBAR_BUTTON_SEND_RECEIVE:
+               
+
        case MODEST_TOOLBAR_BUTTON_NEXT:
+               sel = gtk_tree_view_get_selection (GTK_TREE_VIEW(priv->header_view));
+               if (sel) {
+                       gtk_tree_selection_get_selected (sel, &model, &iter);
+                       gtk_tree_model_iter_next (model, &iter);
+                       gtk_tree_selection_select_iter (sel, &iter);
+               }
+               
        case MODEST_TOOLBAR_BUTTON_PREV:
+       /*      if (sel) { */
+/*                     gtk_tree_selection_get_selected (sel, &model, &iter); */
+/*                     gtk_tree_model_iter_prev (model, &iter); */
+/*                     gtk_tree_selection_select_iter (sel, &iter); */
+/*             } */
+
+               break;
        case MODEST_TOOLBAR_BUTTON_DELETE:
 
        default:
@@ -364,8 +389,8 @@ toolbar_new (ModestMainWindow *self)
                MODEST_TOOLBAR_SEPARATOR,
                MODEST_TOOLBAR_BUTTON_SEND_RECEIVE,
                MODEST_TOOLBAR_SEPARATOR,
-               MODEST_TOOLBAR_BUTTON_NEXT,
                MODEST_TOOLBAR_BUTTON_PREV,
+               MODEST_TOOLBAR_BUTTON_NEXT,
                MODEST_TOOLBAR_SEPARATOR,               
                MODEST_TOOLBAR_BUTTON_DELETE
        };              
index a537831..b9db1f6 100644 (file)
@@ -289,12 +289,12 @@ modest_store_widget_new (ModestWidgetFactory *factory, const gchar *proto)
 
        priv->proto = g_strdup (proto);
        
-       if (strcmp (proto, MODEST_PROTO_POP) == 0 ||
-           strcmp (proto, MODEST_PROTO_IMAP) == 0) {
+       if (strcmp (proto, MODEST_PROTOCOL_STORE_POP) == 0 ||
+           strcmp (proto, MODEST_PROTOCOL_STORE_IMAP) == 0) {
                w = imap_pop_configuration (self);
-       } else if (strcmp (proto, MODEST_PROTO_MAILDIR) == 0) {
+       } else if (strcmp (proto, MODEST_PROTOCOL_STORE_MAILDIR) == 0) {
                w = maildir_configuration (self);
-       }  else if (strcmp (proto, MODEST_PROTO_MBOX) == 0) {
+       }  else if (strcmp (proto, MODEST_PROTOCOL_STORE_MBOX) == 0) {
                w = mbox_configuration (self);
        } else
                w = gtk_label_new ("");
index 9aeb080..20eec06 100644 (file)
@@ -185,7 +185,7 @@ modest_transport_widget_new (ModestWidgetFactory *factory, const gchar* proto)
 
        priv->proto = g_strdup (proto);
        
-       if (strcmp (proto, MODEST_PROTO_SMTP) == 0) {
+       if (strcmp (proto, MODEST_PROTOCOL_TRANSPORT_SMTP) == 0) {
                w = smtp_configuration (self);
        } else
                w = gtk_label_new ("");
index 4fee9f3..8a05785 100644 (file)
  */
 
 #include <string.h>
-#include "modest-marshal.h"
-#include "modest-account-keys.h"
-#include "modest-account-mgr.h"
+#include <modest-marshal.h>
+#include <modest-account-keys.h>
+#include <modest-account-mgr.h>
 
 /* 'private'/'protected' functions */
 static void modest_account_mgr_class_init (ModestAccountMgrClass * klass);
 static void modest_account_mgr_init (ModestAccountMgr * obj);
 static void modest_account_mgr_finalize (GObject * obj);
 
-static gchar *get_account_keyname (const gchar * accname, const gchar * name, gboolean server_account);
+static gchar *get_account_keyname (const gchar * accname, const gchar * name,
+                                  gboolean server_account);
 
 /* list my signals */
 enum {
@@ -48,8 +49,8 @@ enum {
 
 typedef struct _ModestAccountMgrPrivate ModestAccountMgrPrivate;
 struct _ModestAccountMgrPrivate {
-       ModestConf *modest_conf;
-       GSList *current_accounts;
+       ModestConf        *modest_conf;
+       ModestProtocolMgr *proto_mgr;
 };
 
 #define MODEST_ACCOUNT_MGR_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
@@ -165,6 +166,7 @@ modest_account_mgr_get_type (void)
                        sizeof (ModestAccountMgr),
                        1,      /* n_preallocs */
                        (GInstanceInitFunc) modest_account_mgr_init,
+                       NULL
                };
 
                my_type = g_type_register_static (G_TYPE_OBJECT,
@@ -213,6 +215,7 @@ modest_account_mgr_init (ModestAccountMgr * obj)
                MODEST_ACCOUNT_MGR_GET_PRIVATE (obj);
 
        priv->modest_conf = NULL;
+       priv->proto_mgr   = modest_protocol_mgr_new ();
 }
 
 static void
@@ -225,8 +228,12 @@ modest_account_mgr_finalize (GObject * obj)
                g_object_unref (G_OBJECT(priv->modest_conf));
                priv->modest_conf = NULL;
        }
-}
 
+       if (priv->proto_mgr) {
+               g_object_unref (G_OBJECT(priv->proto_mgr));
+               priv->proto_mgr = NULL;
+       }
+}
 
 ModestAccountMgr *
 modest_account_mgr_new (ModestConf * conf)
@@ -342,10 +349,8 @@ modest_account_mgr_add_account (ModestAccountMgr *self,
 
 gboolean
 modest_account_mgr_add_server_account (ModestAccountMgr * self,
-                                      const gchar * name,
-                                      const gchar * hostname,
-                                      const gchar * username,
-                                      const gchar * password,
+                                      const gchar * name, const gchar * hostname,
+                                      const gchar * username, const gchar * password,
                                       const gchar * proto)
 {
        ModestAccountMgrPrivate *priv;
@@ -440,7 +445,7 @@ strip_prefix_from_elements (GSList * lst, guint n)
 GSList *
 modest_account_mgr_search_server_accounts (ModestAccountMgr * self,
                                           const gchar * account_name,
-                                          ModestProtoType type,
+                                          ModestProtocolType type,
                                           const gchar *proto)
 {
        GSList *accounts;
@@ -463,7 +468,7 @@ modest_account_mgr_search_server_accounts (ModestAccountMgr * self,
        }
        
        /* no restrictions, return everything */
-       if (type == MODEST_PROTO_TYPE_ANY && !proto)
+       if (type == MODEST_PROTOCOL_TYPE_ANY && !proto)
                return strip_prefix_from_elements (accounts, strlen(key)+1);
        /* +1 because we must remove the ending '/' as well */
        
@@ -477,8 +482,9 @@ modest_account_mgr_search_server_accounts (ModestAccountMgr * self,
                acc_proto = modest_account_mgr_get_string (self, account, MODEST_ACCOUNT_PROTO,
                                                           TRUE, NULL);
                if ((!acc_proto) ||                                /* proto not defined? */
-                   (type != MODEST_PROTO_TYPE_ANY &&              /* proto type ...     */
-                    modest_proto_type (acc_proto) != type) ||     /* ... matches?       */
+                   (type != MODEST_PROTOCOL_TYPE_ANY &&                   /* proto type ...     */
+                    !modest_protocol_mgr_protocol_is_valid (priv->proto_mgr,
+                                                            acc_proto,type)) ||           /* ... matches?       */
                    (proto && strcmp (proto, acc_proto) != 0)) {  /* proto matches?     */
                        /* match! remove from the list */
                        GSList *nxt = cursor->next;
@@ -514,6 +520,120 @@ modest_account_mgr_account_names (ModestAccountMgr * self, GError ** err)
 }
 
 
+static ModestServerAccountData*
+modest_account_mgr_get_server_account_data (ModestAccountMgr *self, const gchar* name)
+{
+       ModestServerAccountData *data;
+       
+       g_return_val_if_fail (modest_account_mgr_account_exists (self, name,
+                                                                TRUE, NULL), NULL);    
+       data = g_new0 (ModestServerAccountData, 1);
+
+       data->account_name = g_strdup (name);
+       data->hostname     = modest_account_mgr_get_string (self, name,
+                                                           MODEST_ACCOUNT_HOSTNAME,
+                                                           TRUE, NULL);
+       data->username     = modest_account_mgr_get_string (self, name,
+                                                           MODEST_ACCOUNT_USERNAME,
+                                                           TRUE, NULL);
+       data->proto        = modest_account_mgr_get_string (self, name,
+                                                           MODEST_ACCOUNT_PROTO,
+                                                           TRUE, NULL);
+       data->password     = modest_account_mgr_get_string (self, name,
+                                                           MODEST_ACCOUNT_PASSWORD,
+                                                           TRUE, NULL);
+       return data;
+}
+
+
+static void
+modest_account_mgr_free_server_account_data (ModestAccountMgr *self,
+                                            ModestServerAccountData* data)
+{
+       g_return_if_fail (self);
+
+       if (!data)
+               return; /* not an error */
+
+       g_free (data->account_name);
+       g_free (data->hostname);
+       g_free (data->username);
+       g_free (data->proto);
+       g_free (data->password);
+
+       g_free (data);
+}
+
+
+ModestAccountData*
+modest_account_mgr_get_account_data     (ModestAccountMgr *self,
+                                        const gchar* name)
+{
+       ModestAccountData *data;
+       gchar *server_account;
+       
+       g_return_val_if_fail (self, NULL);
+       g_return_val_if_fail (name, NULL);
+       g_return_val_if_fail (modest_account_mgr_account_exists (self, name,
+                                                                FALSE, NULL), NULL);   
+       data = g_new0 (ModestAccountData, 1);
+
+       data->account_name = g_strdup (name);
+       data->full_name    = modest_account_mgr_get_string (self, name,
+                                                           MODEST_ACCOUNT_FULLNAME,
+                                                           FALSE, NULL);
+       data->email        = modest_account_mgr_get_string (self, name,
+                                                           MODEST_ACCOUNT_EMAIL,
+                                                           FALSE, NULL);
+       data->enabled      = modest_account_mgr_account_get_enabled (self, name);
+
+       /* store */
+       server_account = modest_account_mgr_get_string (self, name,
+                                                       MODEST_ACCOUNT_STORE_ACCOUNT,
+                                                       FALSE, NULL);
+       if (server_account) {
+               data->store_account =
+                       modest_account_mgr_get_server_account_data (self,
+                                                                   server_account);
+               g_free (server_account);
+       }
+
+       /* transport */
+       server_account = modest_account_mgr_get_string (self, name,
+                                                       MODEST_ACCOUNT_TRANSPORT_ACCOUNT,
+                                                       FALSE, NULL);
+       if (server_account) {
+               data->transport_account =
+                       modest_account_mgr_get_server_account_data (self,
+                                                                   server_account);
+               g_free (server_account);
+       }
+
+       return data;
+}
+
+
+void
+modest_account_mgr_free_account_data     (ModestAccountMgr *self,
+                                         ModestAccountData *data)
+{
+       g_return_if_fail (self);
+
+       if (!data)
+               return;
+
+       g_free (data->account_name);
+       g_free (data->full_name);
+       g_free (data->email);
+
+       modest_account_mgr_free_server_account_data (self, data->store_account);
+       modest_account_mgr_free_server_account_data (self, data->transport_account);
+       
+       g_free (data);
+}
+
+
+
 gchar *
 modest_account_mgr_get_string (ModestAccountMgr *self, const gchar *name,
                               const gchar *key, gboolean server_account, GError **err) {
@@ -703,6 +823,5 @@ get_account_keyname (const gchar * accname, const gchar * name, gboolean server_
                retval = g_strconcat (namespace, "/", accname, NULL);
 
        g_free (account_name);
-
        return retval;
 }
index eb9b0c7..03c63d4 100644 (file)
@@ -32,9 +32,9 @@
 #define __MODEST_ACCOUNT_MGR_H__
 
 #include <glib-object.h>
-#include "modest-conf.h"
-#include "modest-account-keys.h"
-#include "modest-proto.h"
+#include <modest-conf.h>
+#include <modest-account-keys.h>
+#include <modest-protocol-mgr.h>
 
 G_BEGIN_DECLS
 
@@ -57,11 +57,37 @@ struct _ModestAccountMgr {
 struct _ModestAccountMgrClass {
        GObjectClass parent_class;
 
-       void (* account_removed)   (ModestAccountMgr *obj, const gchar* account, gboolean server_account, gpointer user_data);
-       void (* account_changed)   (ModestAccountMgr *obj, const gchar* account, const gchar* key, gboolean server_account,
+       void (* account_removed)   (ModestAccountMgr *obj, const gchar* account,
+                                   gboolean server_account, gpointer user_data);
+       void (* account_changed)   (ModestAccountMgr *obj, const gchar* account,
+                                   const gchar* key, gboolean server_account,
                                    gpointer user_data);
 };
 
+/*
+ * some convenience structs to get bulk data about an account 
+ */
+struct _ModestServerAccountData {
+       gchar *account_name;
+       gchar *hostname;
+       gchar *username;
+       gchar *proto;
+       gchar *password;
+};
+typedef struct _ModestServerAccountData ModestServerAccountData;
+
+struct _ModestAccountData {
+       gchar *account_name;
+       gchar *full_name;
+       gchar *email;
+       gboolean enabled;
+       
+       ModestServerAccountData *transport_account;
+       ModestServerAccountData *store_account;
+};
+typedef struct _ModestAccountData ModestAccountData;
+
+
 
 /**
  * modest_ui_get_type:
@@ -169,9 +195,9 @@ GSList*             modest_account_mgr_account_names    (ModestAccountMgr *self, GEr
  * error or if there are no server accounts. The caller must free the returned GSList
  */
 GSList*  modest_account_mgr_search_server_accounts  (ModestAccountMgr *self,
-                                                    const gchar*    account_name,
-                                                    ModestProtoType type,
-                                                    const gchar*    proto);
+                                                    const gchar*       account_name,
+                                                    ModestProtocolType type,
+                                                    const gchar*       proto);
 
 /**
  * modest_account_mgr_account_exists:
@@ -190,6 +216,29 @@ gboolean   modest_account_mgr_account_exists         (ModestAccountMgr *self,
                                                           gboolean server_account,
                                                           GError **err);
 
+/**
+ * modest_account_mgr_get_account_data:
+ * @self: a ModestAccountMgr instance
+ * @name: the name of the account
+ * 
+ * get information about an account
+ *
+ * Returns: a ModestAccountData structure with information about the account.
+ * the data should not be changed, and be freed with modest_account_mgr_free_account_data
+ */
+ModestAccountData *modest_account_mgr_get_account_data     (ModestAccountMgr *self,
+                                                           const gchar* name);
+
+
+/**
+ * modest_account_mgr_free_account_data:
+ * @self: a ModestAccountMgr instance
+ * @data: a ModestAccountData instance
+ * 
+ * free the account data structure
+ */
+void       modest_account_mgr_free_account_data     (ModestAccountMgr *self,
+                                                    ModestAccountData *data);
 
 /**
  * modest_account_mgr_account_set_enabled
@@ -338,6 +387,8 @@ gboolean    modest_account_mgr_set_bool       (ModestAccountMgr *self,
                                                   gboolean server_account,
                                                   GError **err);
 
+
+
 G_END_DECLS
 
 #endif /* __MODEST_ACCOUNT_MGR_H__ */
index afeeb21..5e47643 100644 (file)
@@ -70,6 +70,7 @@ modest_conf_get_type (void)
                        sizeof(ModestConf),
                        1,              /* n_preallocs */
                        (GInstanceInitFunc) modest_conf_init,
+                       NULL
                };
                my_type = g_type_register_static (G_TYPE_OBJECT,
                                                  "ModestConf",
index 1f836ab..b09bf6c 100644 (file)
@@ -33,8 +33,9 @@
 #include <gtk/gtk.h>
 #include <tny-list.h>
 
-#include <tny-account-store-iface.h>
-#include <tny-list-iface.h>
+#include <tny-account-store.h>
+#include <tny-list.h>
+#include <tny-simple-list.h>
 
 #include "modest-conf.h"
 #include "modest-account-mgr.h"
@@ -79,20 +80,20 @@ main (int argc, char *argv[])
 
        static GOptionEntry options[] = {
                { "debug",  'd', 0, G_OPTION_ARG_NONE, &debug,
-                 "Run in debug mode" },
+                 "Run in debug mode", NULL},
                { "mailto", 'm', 0, G_OPTION_ARG_STRING, &mailto,
-                 "New email to <addresses> (comma-separated)"},
+                 "New email to <addresses> (comma-separated)", NULL},
                { "subject", 's', 0, G_OPTION_ARG_STRING, &subject,
-                 "Subject for a new mail"},
+                 "Subject for a new mail", NULL},
                { "body", 'b', 0, G_OPTION_ARG_STRING, &body,
-                 "Body for a new email"},
+                 "Body for a new email", NULL},
                { "cc",  'c', 0, G_OPTION_ARG_STRING, &cc,
-                 "Cc: addresses for a new mail (comma-separated)"},
+                 "Cc: addresses for a new mail (comma-separated)", NULL},
                { "bcc", 'x', 0, G_OPTION_ARG_STRING, &bcc,
-                 "Bcc: addresses for a new mail (comma-separated)"},
+                 "Bcc: addresses for a new mail (comma-separated)", NULL},
                { "batch", 'y', 0, G_OPTION_ARG_NONE, &batch,
-                 "Run in batch mode (don't show UI)"},
-               { NULL }
+                 "Run in batch mode (don't show UI)", NULL},
+               { NULL, 0, 0, 0, NULL, NULL, NULL }
        };
 
        g_type_init ();
@@ -219,29 +220,29 @@ send_mail (ModestConf *conf, const gchar* mailto, const gchar *cc, const gchar *
        ModestAccountMgr *acc_mgr = NULL;
        ModestTnyAccountStore *acc_store = NULL;
 
-       TnyListIface *accounts = NULL;
-       TnyIteratorIface *iter = NULL;
-       TnyTransportAccountIface *account = NULL;       
+       TnyList *accounts = NULL;
+       TnyIterator *iter = NULL;
+       TnyTransportAccount *account = NULL;    
        int retval;
        
        acc_mgr   = modest_account_mgr_new (conf);
        acc_store = modest_tny_account_store_new (acc_mgr);     
 
-       accounts = TNY_LIST_IFACE(tny_list_new ());
-       tny_account_store_iface_get_accounts (TNY_ACCOUNT_STORE_IFACE(acc_store), accounts,
-                                             TNY_ACCOUNT_STORE_IFACE_TRANSPORT_ACCOUNTS);
+       accounts = TNY_LIST(tny_simple_list_new ());
+       tny_account_store_get_accounts (TNY_ACCOUNT_STORE(acc_store), accounts,
+                                             TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS);
 
-       iter = tny_list_iface_create_iterator(accounts);
-       tny_iterator_iface_first (iter);
-       if (tny_iterator_iface_is_done (iter)) {
+       iter = tny_list_create_iterator(accounts);
+       tny_iterator_first (iter);
+       if (tny_iterator_is_done (iter)) {
                g_printerr("modest: no transport accounts defined\n");
                retval = MODEST_ERR_SEND;
                goto cleanup;
        }
 
-       account = TNY_TRANSPORT_ACCOUNT_IFACE (tny_iterator_iface_current(iter));
+       account = TNY_TRANSPORT_ACCOUNT (tny_iterator_get_current(iter));
 
-       if (!modest_tny_transport_actions_send_message ( account,
+       if (!modest_tny_transport_actions_send_message (account,
                                                         "<>", mailto, cc, bcc, subject, body,
                                                         NULL)) {
                retval = MODEST_ERR_SEND;
index bc17d5e..a42323c 100644 (file)
 
 #include <string.h>
 
-#include <tny-account-iface.h>
-#include <tny-account-store-iface.h>
-#include <tny-store-account-iface.h>
-#include <tny-transport-account-iface.h>
-#include <tny-device-iface.h>
-#include <tny-device.h>
+#include <tny-account.h>
 #include <tny-account-store.h>
-
 #include <tny-store-account.h>
 #include <tny-transport-account.h>
+#include <tny-device.h>
+#include <tny-gnome-device.h>
+#include <tny-account-store.h>
+#include <tny-gnome-platform-factory.h>        
+#include <tny-camel-transport-account.h>
+#include <tny-camel-store-account.h>
 #include <modest-marshal.h>
-
 #include "modest-account-mgr.h"
 #include "modest-tny-account-store.h"
 
 /* 'private'/'protected' functions */
 static void modest_tny_account_store_class_init   (ModestTnyAccountStoreClass *klass);
-static void modest_tny_account_store_init         (ModestTnyAccountStore *obj);
+//static void modest_tny_account_store_init         (ModestTnyAccountStore *obj);
 static void modest_tny_account_store_finalize     (GObject *obj);
 
 /* implementations for tny-account-store-iface */
-static void    modest_tny_account_store_iface_init              (gpointer g_iface, gpointer iface_data);
-static void    modest_tny_account_store_add_store_account       (TnyAccountStoreIface *self,
-                                                                TnyStoreAccountIface *account);
-static void    modest_tny_account_store_add_transport_account   (TnyAccountStoreIface *self,
-                                                                TnyTransportAccountIface *account);
-static void    modest_tny_account_store_get_accounts            (TnyAccountStoreIface *iface, TnyListIface *list,
+static void    modest_tny_account_store_instance_init (ModestTnyAccountStore *obj);
+
+static void    modest_tny_account_store_init              (gpointer g, gpointer iface_data);
+static void    modest_tny_account_store_add_store_account       (TnyAccountStore *self,
+                                                                TnyStoreAccount *account);
+static void    modest_tny_account_store_add_transport_account   (TnyAccountStore *self,
+                                                                TnyTransportAccount *account);
+static void    modest_tny_account_store_get_accounts            (TnyAccountStore *iface, TnyList *list,
                                                                 TnyGetAccountsRequestType type);
 /* list my signals */
 enum {
@@ -70,9 +71,11 @@ struct _ModestTnyAccountStorePrivate {
        GMutex *store_lock;     
        gchar *cache_dir;
        gulong sig1, sig2;
+
+       GHashTable *password_hash;
        
        TnySessionCamel *tny_session_camel;
-       TnyDeviceIface  *device;
+       TnyDevice  *device;
        
         ModestAccountMgr *account_mgr;
 };
@@ -89,6 +92,7 @@ GType
 modest_tny_account_store_get_type (void)
 {
        static GType my_type = 0;
+
        if (!my_type) {
                static const GTypeInfo my_info = {
                        sizeof(ModestTnyAccountStoreClass),
@@ -98,21 +102,21 @@ modest_tny_account_store_get_type (void)
                        NULL,           /* class finalize */
                        NULL,           /* class data */
                        sizeof(ModestTnyAccountStore),
-                       1,              /* n_preallocs */
-                       (GInstanceInitFunc) modest_tny_account_store_init,
+                       0,              /* n_preallocs */
+                       (GInstanceInitFunc) modest_tny_account_store_instance_init,
                        NULL
                };
 
                static const GInterfaceInfo iface_info = {
-                       (GInterfaceInitFunc) modest_tny_account_store_iface_init,
+                       (GInterfaceInitFunc) modest_tny_account_store_init,
                        NULL,         /* interface_finalize */
                        NULL          /* interface_data */
                 };
                /* hack hack */
-               my_type = g_type_register_static (TNY_TYPE_ACCOUNT_STORE,
-                                                 "ModestTnyAccountStore", &my_info, 0);
-
-               g_type_add_interface_static (my_type, TNY_TYPE_ACCOUNT_STORE_IFACE,
+               my_type = g_type_register_static (G_TYPE_OBJECT,
+                                                 "ModestTnyAccountStore",
+                                                 &my_info, 0);
+               g_type_add_interface_static (my_type, TNY_TYPE_ACCOUNT_STORE,
                                             &iface_info);
        }
        return my_type;
@@ -151,7 +155,7 @@ modest_tny_account_store_class_init (ModestTnyAccountStoreClass *klass)
 }
 
 static void
-modest_tny_account_store_init (ModestTnyAccountStore *obj)
+modest_tny_account_store_instance_init (ModestTnyAccountStore *obj)
 {
        ModestTnyAccountStorePrivate *priv =
                MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(obj);
@@ -160,6 +164,9 @@ modest_tny_account_store_init (ModestTnyAccountStore *obj)
        priv->device                 = NULL;
        priv->cache_dir              = NULL;
         priv->tny_session_camel      = NULL;
+
+       priv->password_hash          = g_hash_table_new_full (g_str_hash, g_str_equal,
+                                                             g_free, g_free);
 }
 
 
@@ -186,67 +193,98 @@ on_account_changed (ModestAccountMgr *acc_mgr, const gchar *account, gboolean se
 }
 
 
+static ModestTnyAccountStore*
+get_account_store_for_account (TnyAccount *account)
+{
+       return MODEST_TNY_ACCOUNT_STORE(g_object_get_data (G_OBJECT(account), "account_store"));
+}
+
+
+
+static void
+set_account_store_for_account (TnyAccount *account, ModestTnyAccountStore *store)
+{
+       g_object_set_data (G_OBJECT(account), "account_store", (gpointer)store);
+}
+
 
 static gchar*
-get_password (TnyAccountIface *account, const gchar *prompt, gboolean *cancel)
+get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
 {
-       gchar *key;
-       const TnyAccountStoreIface *account_store;
+       const gchar *key;
+       const TnyAccountStore *account_store;
        ModestTnyAccountStore *self;
        ModestTnyAccountStorePrivate *priv;
        gchar *pwd = NULL;
-       gboolean remember_pwd;
+       gboolean already_asked;
        
        g_return_val_if_fail (account, NULL);
        
-       key           = tny_account_iface_get_id (account);
-       account_store = tny_account_iface_get_account_store(account);
+       key           = tny_account_get_id (account);
+       account_store = TNY_ACCOUNT_STORE(get_account_store_for_account (account));
 
        self = MODEST_TNY_ACCOUNT_STORE (account_store);
         priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
 
-       /* is it in the conf? */
-       pwd  = modest_account_mgr_get_string (priv->account_mgr,
-                                             key, MODEST_ACCOUNT_PASSWORD,
-                                             TRUE, NULL);
-       if (!pwd || strlen(pwd) == 0) {
-               /* we don't have it yet. we emit a signal to get the password somewhere */
-               const gchar* name = tny_account_iface_get_name (account);
-               *cancel = TRUE;
-               pwd     = NULL;
-               g_signal_emit (G_OBJECT(self), signals[PASSWORD_REQUESTED_SIGNAL], 0,
-                              name, &pwd, cancel);
-               if (!*cancel) /* remember the password */
-                       modest_account_mgr_set_string (priv->account_mgr,
-                                                      key, MODEST_ACCOUNT_PASSWORD,
-                                                      pwd, TRUE, NULL);
-       } else
-               *cancel = FALSE;
-
+       /* is it in the hash? if it's already there, it must be wrong... */
+//     already_asked = g_hash_table_lookup (priv->password_hash, key) != NULL;
+/*     if (already_asked) */
+/*             g_warning ("password already asked for or in config (%s)", */
+/*                        key); */
+/*     else */
+/*             g_warning ("password not yet asked for or in config (%s)", */
+/*                        key); */
+
+       /* if the password is not already there, try ModestConf */
+//     if (!already_asked) 
+               pwd  = modest_account_mgr_get_string (priv->account_mgr,
+                                                     key, MODEST_ACCOUNT_PASSWORD,
+                                                     TRUE, NULL);
+
+       /* if it was already asked, it must have been wrong, so ask again */
+/*     if (!already_asked ||  !pwd || strlen(pwd) == 0) { */
+/*             g_warning ("emit signal to get pass for %s", key); */
+               
+/*             /\* we don't have it yet. we emit a signal to get the password somewhere *\/ */
+/*             const gchar* name = tny_account_get_name (account); */
+/*             *cancel = TRUE; */
+/*             pwd     = NULL; */
+/*             g_signal_emit (G_OBJECT(self), signals[PASSWORD_REQUESTED_SIGNAL], 0, */
+/*                            name, &pwd, cancel); */
+/*             if (!*cancel) /\* remember the password *\/ */
+/*                     modest_account_mgr_set_string (priv->account_mgr, */
+/*                                                    key, MODEST_ACCOUNT_PASSWORD, */
+/*                                                    pwd, TRUE, NULL); */
+/*     } else */
+/*             *cancel = FALSE; */
+
+//     g_hash_table_insert (priv->password_hash, (gpointer)key, (gpointer)pwd);
+       
        return pwd; 
 }
 
 
 static void
-forget_password (TnyAccountIface *account) {
+forget_password (TnyAccount *account) {
 
        ModestTnyAccountStore *self;
        ModestTnyAccountStorePrivate *priv;
-       const TnyAccountStoreIface *account_store;
+       const TnyAccountStore *account_store;
 
-        account_store = tny_account_iface_get_account_store(account);
+        account_store = TNY_ACCOUNT_STORE(get_account_store_for_account (account));
        self = MODEST_TNY_ACCOUNT_STORE (account_store);
         priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
 }
 
 
+
 /* create a tnyaccount for the server account connected to the account with name 'key'
  */
-static TnyAccountIface*
+static TnyAccount*
 tny_account_from_name (ModestTnyAccountStore *self, const gchar *account, 
-                      const gchar *server_account, ModestProtoType modest_type)
+                      const gchar *server_account, ModestProtocolType modest_type)
 {
-       TnyAccountIface *tny_account;
+       TnyAccount *tny_account;
        ModestTnyAccountStorePrivate *priv;
        gchar *val;
 
@@ -257,10 +295,10 @@ tny_account_from_name (ModestTnyAccountStore *self, const gchar *account,
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
 
        /* is it a store or a transport? */
-       if  (modest_type == MODEST_PROTO_TYPE_STORE) 
-               tny_account = TNY_ACCOUNT_IFACE(tny_store_account_new ());
-       else if (modest_type == MODEST_PROTO_TYPE_TRANSPORT)
-               tny_account = TNY_ACCOUNT_IFACE(tny_transport_account_new ());
+       if  (modest_type == MODEST_PROTOCOL_TYPE_STORE) 
+               tny_account = TNY_ACCOUNT(tny_camel_store_account_new ());
+       else if (modest_type == MODEST_PROTOCOL_TYPE_TRANSPORT)
+               tny_account = TNY_ACCOUNT(tny_camel_transport_account_new ());
        else
                g_assert_not_reached ();
 
@@ -270,17 +308,21 @@ tny_account_from_name (ModestTnyAccountStore *self, const gchar *account,
                return NULL;
        }
        
-       tny_account_iface_set_account_store (TNY_ACCOUNT_IFACE(tny_account),
-                                            TNY_ACCOUNT_STORE_IFACE(self));
+       set_account_store_for_account (TNY_ACCOUNT(tny_account), self);
+
+       /* session */
+       tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account),
+                                      priv->tny_session_camel);
+       
        /* id */
-       tny_account_iface_set_id (tny_account, server_account);
-       tny_account_iface_set_name (tny_account, account);
+       tny_account_set_id (tny_account, server_account);
+       tny_account_set_name (tny_account, account);
 
        /* proto */
        val = modest_account_mgr_get_string (priv->account_mgr, server_account,
                                             MODEST_ACCOUNT_PROTO, TRUE, NULL);
        if (val) {
-               tny_account_iface_set_proto (tny_account, val);
+               tny_account_set_proto (tny_account, val);
                g_free (val);
        } else {
                g_printerr ("modest: protocol not defined for '%s:%s'\n", 
@@ -294,7 +336,7 @@ tny_account_from_name (ModestTnyAccountStore *self, const gchar *account,
                                             MODEST_ACCOUNT_HOSTNAME, TRUE,
                                             NULL);
        if (val) {
-               tny_account_iface_set_hostname (tny_account, val);
+               tny_account_set_hostname (tny_account, val);
                g_free (val);
        }
 
@@ -303,12 +345,12 @@ tny_account_from_name (ModestTnyAccountStore *self, const gchar *account,
                                             MODEST_ACCOUNT_USERNAME, TRUE,
                                             NULL);
        if (val) {
-               tny_account_iface_set_user (tny_account, val);
+               tny_account_set_user (tny_account, val);
                g_free (val);
        }
 
-       tny_account_iface_set_pass_func (tny_account, get_password);
-        tny_account_iface_set_forget_pass_func (tny_account, forget_password);
+       tny_account_set_pass_func (tny_account, get_password);
+        tny_account_set_forget_pass_func (tny_account, forget_password);
 
        return tny_account;
 }
@@ -322,8 +364,6 @@ modest_tny_account_store_finalize (GObject *obj)
        ModestTnyAccountStorePrivate *priv =
                MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
 
-       
-       
        if (priv->account_mgr) {
                g_signal_handler_disconnect (G_OBJECT(priv->account_mgr),
                                             priv->sig1);
@@ -349,6 +389,11 @@ modest_tny_account_store_finalize (GObject *obj)
        g_free (priv->cache_dir);
        priv->cache_dir = NULL;
 
+       if (priv->password_hash) {
+               g_hash_table_destroy (priv->password_hash);
+               priv->password_hash = NULL;
+       }
+
        G_OBJECT_CLASS(parent_class)->finalize (obj);
 }
 
@@ -358,7 +403,8 @@ modest_tny_account_store_new (ModestAccountMgr *account_mgr) {
 
        GObject *obj;
        ModestTnyAccountStorePrivate *priv;
-
+       TnyPlatformFactory *pfact;
+       
        g_return_val_if_fail (account_mgr, NULL);
 
        obj  = G_OBJECT(g_object_new(MODEST_TYPE_TNY_ACCOUNT_STORE, NULL));
@@ -375,14 +421,23 @@ modest_tny_account_store_new (ModestAccountMgr *account_mgr) {
        
        priv->store_lock = g_mutex_new ();
 
-       priv->device = (TnyDeviceIface*)tny_device_new();
+       /* FIXME: don't use GNOME */
+       pfact = TNY_PLATFORM_FACTORY (tny_gnome_platform_factory_get_instance());
+       if (!pfact) {
+               g_printerr ("modest: cannot create platform factory\n");
+               g_object_unref (obj);
+               return NULL;
+       }
+       
+       priv->device = TNY_DEVICE(tny_platform_factory_new_device(pfact));
        if (!priv->device) {
                g_printerr ("modest: cannot create device instance\n");
                g_object_unref (obj);
                return NULL;
        }
+       tny_device_force_online (priv->device);
        
-       priv->tny_session_camel = tny_session_camel_new (TNY_ACCOUNT_STORE_IFACE(obj));
+       priv->tny_session_camel = tny_session_camel_new (TNY_ACCOUNT_STORE(obj));
 
        if (!priv->tny_session_camel) {
                g_printerr ("modest: cannot create TnySessionCamel instance\n");
@@ -395,9 +450,8 @@ modest_tny_account_store_new (ModestAccountMgr *account_mgr) {
 
 
 static gboolean
-add_account  (TnyAccountStoreIface *self, TnyAccountIface *account) {
+add_account  (TnyAccountStore *self, TnyAccount *account) {
 
-       TnyAccountIface       *account_iface;
        ModestTnyAccountStore *account_store;
        ModestTnyAccountStorePrivate *priv;
 
@@ -407,19 +461,18 @@ add_account  (TnyAccountStoreIface *self, TnyAccountIface *account) {
        g_return_val_if_fail (self, FALSE);
        g_return_val_if_fail (account, FALSE);
 
-       account_iface  = TNY_ACCOUNT_IFACE(account);
        account_store  = MODEST_TNY_ACCOUNT_STORE(self);
        priv           = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
 
-       account_name   = tny_account_iface_get_id(account_iface);
+       account_name   = tny_account_get_id(account);
        if (!account_name) {
                g_printerr ("modest: failed to retrieve account name\n");
                return FALSE;
        }
 
-       hostname =  tny_account_iface_get_hostname(account_iface);
-       username =  tny_account_iface_get_user(account_iface);
-       proto    =  tny_account_iface_get_proto(account_iface);
+       hostname =  tny_account_get_hostname(account);
+       username =  tny_account_get_user(account);
+       proto    =  tny_account_get_proto(account);
 
        return modest_account_mgr_add_server_account (priv->account_mgr,
                                                      account_name,
@@ -429,26 +482,38 @@ add_account  (TnyAccountStoreIface *self, TnyAccountIface *account) {
 
 
 static void
-modest_tny_account_store_add_store_account  (TnyAccountStoreIface *self,
-                                            TnyStoreAccountIface *account)
+modest_tny_account_store_add_store_account  (TnyAccountStore *self,
+                                            TnyStoreAccount *account)
 {
-       if (!add_account (self, TNY_ACCOUNT_IFACE(account)))
+       ModestTnyAccountStorePrivate *priv;
+
+       priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+       tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(account),
+                                      priv->tny_session_camel);
+       
+       if (!add_account (self, TNY_ACCOUNT(account)))
                g_printerr ("modest: failed to add store account\n");
 }
 
 
 static void
-modest_tny_account_store_add_transport_account  (TnyAccountStoreIface *self,
-                                                TnyTransportAccountIface *account)
+modest_tny_account_store_add_transport_account  (TnyAccountStore *self,
+                                                TnyTransportAccount *account)
 {
-       if (!add_account (self, TNY_ACCOUNT_IFACE(account)))
+       ModestTnyAccountStorePrivate *priv;
+       
+       priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+       tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(account),
+                                      priv->tny_session_camel);
+       
+       if (!add_account (self, TNY_ACCOUNT(account)))
                g_printerr ("modest: failed to add transport account\n");
 }
 
 
 static gchar*
 get_server_account_for_account (ModestTnyAccountStore *self, const gchar *account_name,
-                               ModestProtoType modest_type)
+                               ModestProtocolType modest_type)
 {
        ModestTnyAccountStorePrivate *priv;
        gchar *server;
@@ -456,9 +521,9 @@ get_server_account_for_account (ModestTnyAccountStore *self, const gchar *accoun
 
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
 
-       if (modest_type == MODEST_PROTO_TYPE_STORE)
+       if (modest_type == MODEST_PROTOCOL_TYPE_STORE)
                key = MODEST_ACCOUNT_STORE_ACCOUNT;
-       else if (modest_type == MODEST_PROTO_TYPE_STORE)
+       else if (modest_type == MODEST_PROTOCOL_TYPE_TRANSPORT)
                key = MODEST_ACCOUNT_TRANSPORT_ACCOUNT;
        else
                g_assert_not_reached();
@@ -468,26 +533,24 @@ get_server_account_for_account (ModestTnyAccountStore *self, const gchar *accoun
                                                key, FALSE, NULL);
        if (!server)
                return NULL;
+       
        if (!modest_account_mgr_account_exists (priv->account_mgr,
                                                server, TRUE, NULL)) {
                g_free (server);
                return NULL;
        }
-          
        return server;
 }
 
-
-
 static void
-modest_tny_account_store_get_accounts  (TnyAccountStoreIface *iface,
-                                       TnyListIface *list,
+modest_tny_account_store_get_accounts  (TnyAccountStore *iface,
+                                       TnyList *list,
                                        TnyGetAccountsRequestType type)
 {
        ModestTnyAccountStore        *self;
        ModestTnyAccountStorePrivate *priv;
        GSList                       *accounts, *cursor;
-       ModestProtoType              modest_type;
+       ModestProtocolType            modest_type;
        
        g_return_if_fail (iface);
 
@@ -495,60 +558,63 @@ modest_tny_account_store_get_accounts  (TnyAccountStoreIface *iface,
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
 
        switch (type) {
-       case TNY_ACCOUNT_STORE_IFACE_TRANSPORT_ACCOUNTS:
-               modest_type = MODEST_PROTO_TYPE_TRANSPORT;
+       case TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS:
+               modest_type = MODEST_PROTOCOL_TYPE_TRANSPORT;
                break;
-       case TNY_ACCOUNT_STORE_IFACE_STORE_ACCOUNTS:
-               modest_type = MODEST_PROTO_TYPE_STORE;
+       case TNY_ACCOUNT_STORE_STORE_ACCOUNTS:
+               modest_type = MODEST_PROTOCOL_TYPE_STORE;
                break;
-       case TNY_ACCOUNT_STORE_IFACE_BOTH:
-               modest_type = MODEST_PROTO_TYPE_ANY;
+       case TNY_ACCOUNT_STORE_BOTH:
+               modest_type = MODEST_PROTOCOL_TYPE_ANY;
                break;
        default:
                g_assert_not_reached ();
        }
 
        cursor = accounts = modest_account_mgr_account_names (priv->account_mgr, NULL); 
+
        while (cursor) {
                gchar           *account_name;
                gchar           *server_account;
-               TnyAccountIface *account_iface;
-
-               account_name =  (gchar*)cursor->data;
+               TnyAccount *account;
 
+               account_name  =  (gchar*)cursor->data;
+               account =  NULL;
+               
                if (!modest_account_mgr_account_get_enabled (priv->account_mgr, account_name)) { 
                        g_free (account_name); 
                        cursor = cursor->next;
                        continue;
                } 
                
-               if (modest_type == MODEST_PROTO_TYPE_TRANSPORT || MODEST_PROTO_TYPE_ANY) {
+               if (modest_type == MODEST_PROTOCOL_TYPE_TRANSPORT || modest_type == MODEST_PROTOCOL_TYPE_ANY) {
                        server_account = get_server_account_for_account (self, account_name,
-                                                                        MODEST_PROTO_TYPE_TRANSPORT);
+                                                                        MODEST_PROTOCOL_TYPE_TRANSPORT);
                        if (server_account)
-                               account_iface = tny_account_from_name (self, account_name, 
+                               account = tny_account_from_name (self, account_name, 
                                                                       server_account,
-                                                                      MODEST_PROTO_TYPE_TRANSPORT);
-                       if (!account_iface)
-                               g_printerr ("modest: failed to create account iface for '%s:%s'\n",
-                                           account_name, server_account);
+                                                                      MODEST_PROTOCOL_TYPE_TRANSPORT);
+                       if (!account)
+                               g_printerr ("modest: no transport account for '%s'\n",
+                                           account_name);
                        else
-                               tny_list_iface_prepend (list, G_OBJECT(account_iface));
+                               tny_list_prepend (list, G_OBJECT(account));
+               
                        g_free (server_account);
                }
                
-               if (modest_type == MODEST_PROTO_TYPE_STORE || MODEST_PROTO_TYPE_ANY) {
+               if (modest_type == MODEST_PROTOCOL_TYPE_STORE || modest_type == MODEST_PROTOCOL_TYPE_ANY) {
                        server_account = get_server_account_for_account (self, account_name,
-                                                                        MODEST_PROTO_TYPE_STORE);
+                                                                        MODEST_PROTOCOL_TYPE_STORE);
                        if (server_account)
-                               account_iface = tny_account_from_name (self, account_name, 
+                               account = tny_account_from_name (self, account_name, 
                                                                       server_account,
-                                                                      MODEST_PROTO_TYPE_STORE);
-                       if (!account_iface)
-                               g_printerr ("modest: failed to create account iface for '%s:%s'\n",
-                                           account_name, server_account);
+                                                                      MODEST_PROTOCOL_TYPE_STORE);
+                       if (!account)
+                               g_printerr ("modest: no store account for '%s'\n",
+                                           account_name);
                        else
-                               tny_list_iface_prepend (list, G_OBJECT(account_iface));
+                               tny_list_prepend (list, G_OBJECT(account));
                        g_free (server_account);
                }
 
@@ -558,56 +624,69 @@ modest_tny_account_store_get_accounts  (TnyAccountStoreIface *iface,
 
        g_slist_free (accounts);
 
-       tny_session_camel_set_current_accounts (priv->tny_session_camel,
-                                               list);
+       tny_session_camel_set_account_store (priv->tny_session_camel, iface);
+/*     tny_session_camel_set_current_accounts (priv->tny_session_camel, */
+/*                                             list); */
 }
 
 
+/*
+ * the cache dir will be ~/.modest/cache
+ * might want to change this in a simple #define...
+ */
 static const gchar*
-modest_tny_account_store_get_cache_dir (TnyAccountStoreIface *self)
+modest_tny_account_store_get_cache_dir (TnyAccountStore *self)
 {
        ModestTnyAccountStorePrivate *priv;
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
-
+       
        if (!priv->cache_dir)
                priv->cache_dir = g_build_filename (g_get_home_dir(),
-                                                   ".modest", "cache", NULL);
+                                                   ".modest",
+                                                   "cache",
+                                                   NULL);
        return priv->cache_dir;
 }
 
 
-static TnyDeviceIface*
-modest_tny_account_store_get_device (TnyAccountStoreIface *self)
+/*
+ * callers need to unref
+ */
+static TnyDevice*
+modest_tny_account_store_get_device (TnyAccountStore *self)
 {
        ModestTnyAccountStorePrivate *priv;
 
        priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE (self);
 
-       return priv->device;
+       return g_object_ref (G_OBJECT(priv->device));
 }
 
 
+
 static gboolean
-modest_tny_account_store_alert (TnyAccountStoreIface *self, TnyAlertType type,
+modest_tny_account_store_alert (TnyAccountStore *self, TnyAlertType type,
                                const gchar *prompt)
 {
-       g_printerr ("modest: alert [%d]: %s", type, prompt);
-       return TRUE; /* FIXME: implement this */
+       g_printerr ("modest: alert [%d]: %s",
+                   type, prompt);
+
+       return TRUE;
 }
 
 
 static void
-modest_tny_account_store_iface_init (gpointer g_iface, gpointer iface_data)
+modest_tny_account_store_init (gpointer g, gpointer iface_data)
 {
-        TnyAccountStoreIfaceClass *klass;
+        TnyAccountStoreIface *klass;
 
-       g_return_if_fail (g_iface);
+       g_return_if_fail (g);
 
-       klass = (TnyAccountStoreIfaceClass *)g_iface;
+       klass = (TnyAccountStoreIface *)g;
 
        klass->get_accounts_func =
                modest_tny_account_store_get_accounts;
-       klass->add_transport_account_func  =
+       klass->add_transport_account_func =
                modest_tny_account_store_add_transport_account;
        klass->add_store_account_func =
                modest_tny_account_store_add_store_account;
index 20ef3a2..8fb8e5e 100644 (file)
@@ -240,13 +240,7 @@ modest_tny_attachment_guess_mime_type (ModestTnyAttachment *self)
 static TnyStreamIface *
 make_stream_from_file(const gchar * filename)
 {
-       gint file;
-       
-       file = open(filename, O_RDONLY);
-       if (file < 0)
-               return NULL;
-
-       return TNY_STREAM_IFACE(tny_stream_camel_new(camel_stream_fs_new_with_fd(file)));
+       return NULL;
 }
 
 void
@@ -290,40 +284,11 @@ modest_tny_attachment_free_list(GList *list)
 ModestTnyAttachment *
 modest_tny_attachment_new_from_mime_part(TnyMimePartIface *part)
 {
-       TnyStreamIface *mem_stream;
-       ModestTnyAttachment *self;
-       
-       mem_stream = TNY_STREAM_IFACE(tny_stream_camel_new(camel_stream_mem_new()));
-       self = modest_tny_attachment_new();
-       tny_mime_part_iface_decode_to_stream(part, mem_stream);
-       tny_stream_iface_reset(mem_stream);
-       modest_tny_attachment_set_stream(self, mem_stream);
-       modest_tny_attachment_set_mime_type(self,
-                                           tny_mime_part_iface_get_content_type(part));
-       modest_tny_attachment_set_name(self,
-                                           tny_mime_part_iface_get_filename(part));
-       return self;
+       return NULL;
 }
 
 ModestTnyAttachment *
 modest_tny_attachment_new_from_message(const TnyMsgIface *msg)
 {
-       TnyStreamIface *mem_stream, *msg_stream;
-       ModestTnyAttachment *self;
-       gint res;
-       
-       mem_stream = TNY_STREAM_IFACE(tny_stream_camel_new(camel_stream_mem_new()));
-       msg_stream = tny_mime_part_iface_get_stream(TNY_MIME_PART_IFACE(msg));
-       printf("ping\n");
-       tny_stream_iface_reset(msg_stream);
-       res = tny_stream_iface_write_to_stream(msg_stream, mem_stream);
-       //tny_msg_mime_part_iface_write_to_stream(TNY_MSG_MIME_PART_IFACE(msg), mem_stream);
-       printf("pong, %d\n", res);
-       tny_stream_iface_reset(msg_stream);
-       tny_stream_iface_reset(mem_stream);
-       self = modest_tny_attachment_new();
-       modest_tny_attachment_set_stream(self, mem_stream);
-       modest_tny_attachment_set_mime_type(self, "message/rfc822");
-       modest_tny_attachment_set_name(self, "original message");
-       return self;
+       return NULL;
 }
index 6f06bac..ea9bac2 100644 (file)
@@ -34,9 +34,9 @@
 #define __MODEST_TNY_ATTACHMENT_H__
 
 #include <glib-object.h>
-#include <tny-stream-iface.h>
-#include <tny-msg-iface.h>
-#include <tny-mime-part-iface.h>
+#include <tny-stream.h>
+#include <tny-msg.h>
+#include <tny-mime-part.h>
 /* other include files */
 
 G_BEGIN_DECLS
index 54049ac..f032916 100644 (file)
 
 #include <gtk/gtk.h>
 #include <gtkhtml/gtkhtml.h>
-#include <tny-text-buffer-stream.h>
-#include <tny-mime-part-iface.h>
-#include <tny-msg-iface.h>
-#include <tny-list-iface.h>
+#include <tny-gtk-text-buffer-stream.h>
+#include <tny-camel-mime-part.h>
+#include <tny-camel-msg.h>
 #include <tny-list.h>
+#include <tny-simple-list.h>
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #include "modest-text-utils.h"
 
 static gchar *
-quote_msg (TnyMsgIface* src, const gchar * from, time_t sent_date, gint limit)
+quote_msg (TnyMsg* src, const gchar * from, time_t sent_date, gint limit)
 {
-       TnyStreamIface *stream;
-       TnyMimePartIface *body;
+       TnyStream *stream;
+       TnyMimePart *body;
        GtkTextBuffer *buf;
        GtkTextIter start, end;
        const gchar *to_quote;
@@ -58,10 +58,10 @@ quote_msg (TnyMsgIface* src, const gchar * from, time_t sent_date, gint limit)
                return NULL;
 
        buf = gtk_text_buffer_new (NULL);
-       stream = TNY_STREAM_IFACE (tny_text_buffer_stream_new (buf));
-       tny_stream_iface_reset (stream);
-       tny_mime_part_iface_decode_to_stream (body, stream);
-       tny_stream_iface_reset (stream);
+       stream = TNY_STREAM (tny_gtk_text_buffer_stream_new (buf));
+       tny_stream_reset (stream);
+       tny_mime_part_decode_to_stream (body, stream);
+       tny_stream_reset (stream);
 
        g_object_unref (G_OBJECT(stream));
        g_object_unref (G_OBJECT(body));
@@ -76,7 +76,7 @@ quote_msg (TnyMsgIface* src, const gchar * from, time_t sent_date, gint limit)
 
 
 gchar*
-modest_tny_msg_actions_quote (TnyMsgIface * self, const gchar * from,
+modest_tny_msg_actions_quote (TnyMsg * self, const gchar * from,
                              time_t sent_date, gint limit,
                              const gchar * to_quote)
 {
@@ -93,32 +93,32 @@ modest_tny_msg_actions_quote (TnyMsgIface * self, const gchar * from,
 
 
 
-TnyMimePartIface *
-modest_tny_msg_actions_find_body_part (TnyMsgIface *msg, gboolean want_html)
+TnyMimePart *
+modest_tny_msg_actions_find_body_part (TnyMsg *msg, gboolean want_html)
 {
        const gchar *mime_type = want_html ? "text/html" : "text/plain";
-       TnyMimePartIface *part;
-       TnyListIface *parts;
-       TnyIteratorIface *iter;
+       TnyMimePart *part;
+       TnyList *parts;
+       TnyIterator *iter;
 
        if (!msg)
                return NULL;
 
-       parts = TNY_LIST_IFACE(tny_list_new());
-       tny_msg_iface_get_parts ((TnyMsgIface*)msg, parts);
+       parts = TNY_LIST (tny_simple_list_new());
+       tny_msg_get_parts ((TnyMsg*)msg, parts);
 
-       iter  = tny_list_iface_create_iterator(parts);
+       iter  = tny_list_create_iterator(parts);
 
-       while (!tny_iterator_iface_is_done(iter)) {
+       while (!tny_iterator_is_done(iter)) {
 
-               part = TNY_MIME_PART_IFACE(tny_iterator_iface_current (iter));
+               part = TNY_MIME_PART(tny_iterator_get_current (iter));
                
-               if (tny_mime_part_iface_content_type_is (part, mime_type) &&
-                   !tny_mime_part_iface_is_attachment (part)) {
+               if (tny_mime_part_content_type_is (part, mime_type) &&
+                   !tny_mime_part_is_attachment (part)) {
                        break;
                }
                part = NULL;
-               tny_iterator_iface_next (iter);
+               tny_iterator_next (iter);
        }
 
        /* did we find a matching part? */
@@ -139,24 +139,26 @@ modest_tny_msg_actions_find_body_part (TnyMsgIface *msg, gboolean want_html)
 
 
 
-TnyMimePartIface *
-modest_tny_msg_actions_find_nth_part (TnyMsgIface *msg, gint index)
+TnyMimePart *
+modest_tny_msg_actions_find_nth_part (TnyMsg *msg, gint index)
 {
-       TnyMimePartIface *part;
-       TnyListIface *parts;
-       TnyIteratorIface *iter;
+       TnyMimePart *part;
+       TnyList *parts;
+       TnyIterator *iter;
 
        g_return_val_if_fail (msg, NULL);
        g_return_val_if_fail (index > 0, NULL);
                
-       parts = TNY_LIST_IFACE(tny_list_new());
-       tny_msg_iface_get_parts ((TnyMsgIface*)msg, parts);
-       iter  = tny_list_iface_create_iterator ((TnyListIface*)parts);
-       if (!tny_iterator_iface_has_first(iter))
-               return NULL;
+       parts = TNY_LIST(tny_simple_list_new());
+       tny_msg_get_parts ((TnyMsg*)msg, parts);
+       iter  = tny_list_create_iterator (parts);
+
+       part = NULL;
        
-       tny_iterator_iface_nth (iter, index);
-       part = TNY_MIME_PART_IFACE(tny_iterator_iface_current (iter));
+       if (!tny_iterator_is_done(iter)) {
+               tny_iterator_nth (iter, index);
+               part = TNY_MIME_PART(tny_iterator_get_current (iter));
+       }
 
        g_object_unref (G_OBJECT(iter));
        g_object_unref (G_OBJECT(parts));
index 09c478d..44a02ec 100644 (file)
@@ -44,7 +44,7 @@
  * 
  * Returns: a newly allocated string containing the quoted message
  */
-gchar *modest_tny_msg_actions_quote (TnyMsgIface * self, const gchar * from,
+gchar *modest_tny_msg_actions_quote (TnyMsg * self, const gchar * from,
                                     time_t sent_date, gint limit,
                                     const gchar *to_quote);
 
@@ -56,9 +56,9 @@ gchar *modest_tny_msg_actions_quote (TnyMsgIface * self, const gchar * from,
  * search a message for the body part. if @want_html is true, try HTML mail
  * first.
  * 
- * Returns: the TnyMsgMimePartIface for the found part, or NULL if no matching part is found
+ * Returns: the TnyMsgMimePart for the found part, or NULL if no matching part is found
  */     
-TnyMimePartIface *modest_tny_msg_actions_find_body_part (TnyMsgIface * self, gboolean want_html);
+TnyMimePart *modest_tny_msg_actions_find_body_part (TnyMsg * self, gboolean want_html);
 
 
 /**
@@ -68,9 +68,9 @@ TnyMimePartIface *modest_tny_msg_actions_find_body_part (TnyMsgIface * self, gbo
  * 
  * search for the nth (mime) part in the message
  * 
- * Returns: the TnyMsgMimePartIface for the found part, or NULL if no matching part is foundi; must be unref'd
+ * Returns: the TnyMsgMimePart for the found part, or NULL if no matching part is foundi; must be unref'd
  */
-TnyMimePartIface * modest_tny_msg_actions_find_nth_part (TnyMsgIface *msg, gint index);
+TnyMimePart * modest_tny_msg_actions_find_nth_part (TnyMsg *msg, gint index);
 
 
 #endif /* __MODEST_TNY_MSG_ACTIONS_H__ */
index 605d397..562f044 100644 (file)
  */
 
 #include <tny-msg.h>
-#include <tny-msg-iface.h>                     
+#include <tny-msg.h>                   
 #include <tny-header.h>
-#include <tny-header-iface.h>
-#include <tny-account-iface.h> 
-#include <tny-account-store-iface.h>
-#include <tny-store-account-iface.h>   
+#include <tny-header.h>
+#include <tny-account.h>       
+#include <tny-account-store.h>
+#include <tny-store-account.h> 
 #include <tny-store-account.h>
 #include <tny-stream-camel.h>
 #include <string.h>
index 502226d..16d618f 100644 (file)
@@ -34,7 +34,7 @@
 #define __MODEST_TNY_STORE_ACTIONS_H__
 
 #include <glib-object.h>
-#include <tny-store-account-iface.h>
+#include <tny-store-account.h>
 
 G_BEGIN_DECLS
 
index 2aa617d..c92cc68 100644 (file)
@@ -31,6 +31,7 @@
 /* modest-tny-stream-gtkhtml.c */
 
 #include "modest-tny-stream-gtkhtml.h"
+#include <tny-stream.h>
 #include <gtkhtml/gtkhtml-stream.h>
 #include <gtkhtml/gtkhtml-search.h>
 
@@ -89,7 +90,7 @@ modest_tny_stream_gtkhtml_get_type (void)
                                                  "ModestTnyStreamGtkhtml",
                                                  &my_info, 0);
 
-               g_type_add_interface_static (my_type, TNY_TYPE_STREAM_IFACE,
+               g_type_add_interface_static (my_type, TNY_TYPE_STREAM,
                                             &iface_info);
 
        }
@@ -147,14 +148,14 @@ modest_tny_stream_gtkhtml_new (GtkHTMLStream *stream)
 
 
 static ssize_t
-gtkhtml_read (TnyStreamIface *self, char *buffer, size_t n)
+gtkhtml_read (TnyStream *self, char *buffer, size_t n)
 {
        return -1; /* we cannot read */
 }
 
 
 static ssize_t
-gtkhtml_write (TnyStreamIface *self, const char *buffer, size_t n)
+gtkhtml_write (TnyStream *self, const char *buffer, size_t n)
 {
        ModestTnyStreamGtkhtmlPrivate *priv;
        
@@ -174,14 +175,14 @@ gtkhtml_write (TnyStreamIface *self, const char *buffer, size_t n)
 
        
 static gint
-gtkhtml_flush (TnyStreamIface *self)
+gtkhtml_flush (TnyStream *self)
 {
        return 0;
 }
        
 
 static gint
-gtkhtml_close (TnyStreamIface *self)
+gtkhtml_close (TnyStream *self)
 {
        ModestTnyStreamGtkhtmlPrivate *priv;
        g_return_val_if_fail (self, 0);
@@ -195,7 +196,7 @@ gtkhtml_close (TnyStreamIface *self)
 
 
 static gboolean
-gtkhtml_eos (TnyStreamIface *self)
+gtkhtml_is_eos (TnyStream *self)
 {
        return TRUE;
 }
@@ -203,14 +204,14 @@ gtkhtml_eos (TnyStreamIface *self)
 
        
 static gint
-gtkhtml_reset (TnyStreamIface *self)
+gtkhtml_reset (TnyStream *self)
 {
        return 0;
 }
 
        
 static ssize_t
-gtkhtml_write_to_stream (TnyStreamIface *self, TnyStreamIface *output)
+gtkhtml_write_to_stream (TnyStream *self, TnyStream *output)
 {
        return 0;
 }
@@ -219,17 +220,17 @@ gtkhtml_write_to_stream (TnyStreamIface *self, TnyStreamIface *output)
 static void
 modest_tny_stream_gtkhml_iface_init (gpointer g_iface, gpointer iface_data)
 {
-        TnyStreamIfaceClass *klass;
+        TnyStreamIface *klass;
        
        g_return_if_fail (g_iface);
 
-       klass = (TnyStreamIfaceClass *)g_iface;
+       klass = (TnyStreamIface*) g_iface;
        
         klass->read_func            = gtkhtml_read;
         klass->write_func           = gtkhtml_write;
         klass->flush_func           = gtkhtml_flush;
         klass->close_func           = gtkhtml_close;
-       klass->eos_func             = gtkhtml_eos;
+       klass->is_eos_func          = gtkhtml_is_eos;
        klass->reset_func           = gtkhtml_reset;
        klass->write_to_stream_func = gtkhtml_write_to_stream;
 }
index 2973531..d523e9c 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <glib-object.h>
 #include <gtkhtml/gtkhtml.h>
-#include <tny-stream-iface.h>
+#include <tny-stream.h>
 
 G_BEGIN_DECLS
 
index 22db181..1a9394a 100644 (file)
 
 #include <tny-msg.h>
 #include <tny-mime-part.h>
-#include <tny-stream-iface.h>
+#include <tny-stream.h>
 #include <tny-header.h>
-#include <tny-account-iface.h> 
-#include <tny-account-store-iface.h>
-#include <tny-transport-account-iface.h>       
+#include <tny-account.h>       
+#include <tny-account-store.h>
 #include <tny-transport-account.h>
 #include <tny-stream-camel.h>
 #include <tny-fs-stream.h>
+#include <tny-camel-msg.h>
+#include <tny-camel-header.h>
+#include <tny-camel-stream.h>
+#include <camel/camel-stream-mem.h>
 #include <string.h>
 
 #include "modest-tny-transport-actions.h"
@@ -73,7 +76,7 @@ get_content_type(const gchar *s)
 }
 
 gboolean
-modest_tny_transport_actions_send_message (TnyTransportAccountIface *transport_account,
+modest_tny_transport_actions_send_message (TnyTransportAccount *transport_account,
                                           const gchar *from,
                                           const gchar *to,
                                           const gchar *cc,
@@ -82,72 +85,72 @@ modest_tny_transport_actions_send_message (TnyTransportAccountIface *transport_a
                                           const gchar *body,
                                           const GList *attachments_list)
 {
-       TnyMsgIface *new_msg;
-       TnyMimePartIface *attachment_part, *text_body_part;
-       TnyHeaderIface *headers;
-       TnyStreamIface *text_body_stream, *attachment_stream;
+       TnyMsg *new_msg;
+       TnyMimePart *attachment_part, *text_body_part;
+       TnyHeader *headers;
+       TnyStream *text_body_stream, *attachment_stream;
        ModestTnyAttachment *attachment;
        GList *pos;
        gchar *content_type;
        const gchar *attachment_content_type;
        const gchar *attachment_filename;
        
-       new_msg          = TNY_MSG_IFACE(tny_msg_new ());
-       headers          = TNY_HEADER_IFACE(tny_header_new ());
-       text_body_stream = TNY_STREAM_IFACE (tny_stream_camel_new
-                                            (camel_stream_mem_new_with_buffer
-                                             (body, strlen(body))));
+       new_msg          = tny_camel_msg_new ();
+       headers          = tny_camel_header_new ();
+       text_body_stream = TNY_STREAM (tny_camel_stream_new
+                                      (camel_stream_mem_new_with_buffer
+                                       (body, strlen(body))));
        
-       tny_header_iface_set_from (TNY_HEADER_IFACE (headers), from);
-       tny_header_iface_set_to (TNY_HEADER_IFACE (headers), to);
-       tny_header_iface_set_cc (TNY_HEADER_IFACE (headers), cc);
-       tny_header_iface_set_bcc (TNY_HEADER_IFACE (headers), bcc);
-       tny_header_iface_set_subject (TNY_HEADER_IFACE (headers), subject);
-       tny_msg_iface_set_header (new_msg, headers);
+       tny_header_set_from (TNY_HEADER (headers), from);
+       tny_header_set_to (TNY_HEADER (headers), to);
+       tny_header_set_cc (TNY_HEADER (headers), cc);
+       tny_header_set_bcc (TNY_HEADER (headers), bcc);
+       tny_header_set_subject (TNY_HEADER (headers), subject);
+       tny_msg_set_header (new_msg, headers);
 
        content_type = get_content_type(body);
        
        if (attachments_list == NULL) {
-               tny_stream_iface_reset (text_body_stream);
-               tny_mime_part_iface_construct_from_stream (TNY_MIME_PART_IFACE(new_msg),
-                                                          text_body_stream, content_type);
-               tny_stream_iface_reset (text_body_stream);
+               tny_stream_reset (text_body_stream);
+               tny_mime_part_construct_from_stream (TNY_MIME_PART(new_msg),
+                                                    text_body_stream, content_type);
+               tny_stream_reset (text_body_stream);
        } else {
                text_body_part = 
-                       TNY_MIME_PART_IFACE (tny_mime_part_new(camel_mime_part_new()));
-               tny_stream_iface_reset (text_body_stream);
-               tny_mime_part_iface_construct_from_stream (text_body_part,
-                                                          text_body_stream,
-                                                          content_type);
-               tny_stream_iface_reset (text_body_stream);
-               tny_msg_iface_add_part(new_msg, text_body_part);
+                       TNY_MIME_PART (tny_camel_mime_part_new(camel_mime_part_new()));
+               tny_stream_reset (text_body_stream);
+               tny_mime_part_construct_from_stream (text_body_part,
+                                                    text_body_stream,
+                                                    content_type);
+               tny_stream_reset (text_body_stream);
+               tny_msg_add_part(new_msg, text_body_part);
                //g_object_unref (G_OBJECT(text_body_part));
        }
        
-       for (    pos = (GList *)attachments_list;
-                pos;
-                pos = pos->next    ) {
-               attachment = pos->data;
-               attachment_filename = modest_tny_attachment_get_name(attachment);
-               attachment_stream = modest_tny_attachment_get_stream(attachment);
-               attachment_part = TNY_MIME_PART_IFACE (tny_mime_part_new (
-                                                              camel_mime_part_new()));
+/*     for (    pos = (GList *)attachments_list; */
+/*              pos; */
+/*              pos = pos->next    ) { */
+/*             attachment = pos->data; */
+/*             attachment_filename = modest_tny_attachment_get_name(attachment); */
+/*             attachment_stream = modest_tny_attachment_get_stream(attachment); */
+/*             attachment_part = TNY_MIME_PART_IFACE (tny_camel_mime_part_new ( */
+/*                                                            camel_mime_part_new())); */
                
-               attachment_content_type = modest_tny_attachment_get_mime_type(attachment);
+/*             attachment_content_type = modest_tny_attachment_get_mime_type(attachment); */
                                 
-               tny_mime_part_iface_construct_from_stream (attachment_part,
-                                                              attachment_stream,
-                                                              attachment_content_type);
-               tny_stream_iface_reset (attachment_stream);
+/*             tny_mime_part_construct_from_stream (attachment_part, */
+/*                                                  attachment_stream, */
+/*                                                  attachment_content_type); */
+/*             tny_stream_reset (attachment_stream); */
                
-               tny_mime_part_iface_set_filename(attachment_part, attachment_filename);
+/*             tny_mime_part_set_filename(attachment_part, attachment_filename); */
                
-               tny_msg_iface_add_part (new_msg, attachment_part);
-               //g_object_unref(G_OBJECT(attachment_part));
-               //close(file);
-       }
+/*             tny_msg_add_part (new_msg, attachment_part); */
+/*             //g_object_unref(G_OBJECT(attachment_part)); */
+/*             //close(file); */
+/*     } */
        
-       tny_transport_account_iface_send (transport_account, new_msg);
+       tny_transport_account_send (transport_account, new_msg);
 
        g_object_unref (G_OBJECT(text_body_stream));
        g_object_unref (G_OBJECT(headers));
index f3ded53..456cdd2 100644 (file)
 #ifndef __MODEST_TNY_TRANSPORT_ACTIONS_H__
 #define __MODEST_TNY_TRANSPORT_ACTIONS_H__
 
-#include <tny-transport-account-iface.h>
+#include <tny-transport-account.h>
 
 G_BEGIN_DECLS
 
 /**
  * modest_tny_transport_actions_send_message:
  * @self: a ModestTnyTransportActions object
- * @transport_account: the TnyTransportAccountIface to use for sending this message
+ * @transport_account: the TnyTransportAccount to use for sending this message
  * @from: the email address of the sender
  * @to: the email address of the receiver
  * @cc: the receivers of a copy of the message (comma-seperated)
@@ -52,7 +52,7 @@ G_BEGIN_DECLS
  *
  * Returns: TRUE but this will change to whether sending was successful
  */
-gboolean modest_tny_transport_actions_send_message (TnyTransportAccountIface *transport_account,
+gboolean modest_tny_transport_actions_send_message (TnyTransportAccount *transport_account,
                                                    const gchar *from,
                                                    const gchar *to,
                                                    const gchar *cc,
index e6f8b27..3ab285c 100644 (file)
@@ -28,8 +28,9 @@
  */
 
 #include "modest-widget-factory.h"
-#include <tny-account-store-iface.h>
-#include <tny-device-iface.h>
+#include <modest-protocol-mgr.h>
+#include <tny-account-store.h>
+#include <tny-device.h>
 
 /* 'private'/'protected' functions */
 static void modest_widget_factory_class_init    (ModestWidgetFactoryClass *klass);
@@ -39,9 +40,9 @@ static void modest_widget_factory_finalize      (GObject *obj);
 
 /* callbacks */
 static void on_folder_selected         (ModestFolderView *folder_view,
-                                       TnyFolderIface *folder,
+                                       TnyFolder *folder,
                                        ModestWidgetFactory *self);
-static void on_message_selected        (ModestHeaderView *header_view, TnyMsgIface *msg,
+static void on_message_selected        (ModestHeaderView *header_view, TnyMsg *msg,
                                        ModestWidgetFactory *self);
 static void on_header_status_update    (ModestHeaderView *header_view, const gchar *msg,
                                        gint status_id, ModestWidgetFactory *self);
@@ -52,7 +53,7 @@ static void on_msg_link_clicked        (ModestMsgView *msgview, const gchar* lin
 static void on_msg_attachment_clicked  (ModestMsgView *msgview, int index,
                                        ModestWidgetFactory *self);
 
-static void on_connection_changed (TnyDeviceIface *device, gboolean online,
+static void on_connection_changed (TnyDevice *device, gboolean online,
                                   ModestWidgetFactory *self);
 static void on_online_toggle_toggled (GtkToggleButton *toggle, ModestWidgetFactory *factory);
 
@@ -76,6 +77,7 @@ struct _ModestWidgetFactoryPrivate {
        ModestTnyAccountStore *account_store;
        ModestAccountMgr      *account_mgr;
        ModestConf            *conf;
+       ModestProtocolMgr     *proto_mgr;
        
        ModestHeaderView      *header_view;
        ModestFolderView      *folder_view;
@@ -142,6 +144,7 @@ modest_widget_factory_init (ModestWidgetFactory *obj)
        priv->conf          = NULL;
        priv->account_mgr   = NULL;
        priv->account_store = NULL;
+       priv->proto_mgr     = modest_protocol_mgr_new ();
        
        priv->progress_bar = gtk_progress_bar_new ();
        gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(priv->progress_bar),
@@ -166,7 +169,12 @@ modest_widget_factory_finalize (GObject *obj)
                g_object_unref (G_OBJECT(priv->conf));
                priv->conf = NULL;
        }
-
+       
+       if (priv->proto_mgr) {
+               g_object_unref (G_OBJECT(priv->proto_mgr));
+               priv->proto_mgr = NULL;
+       }
+       
        if (priv->account_store) {
                g_object_unref (G_OBJECT(priv->account_store));
                priv->account_store = NULL;
@@ -179,7 +187,7 @@ static void
 init_signals (ModestWidgetFactory *self)
 {
        
-       TnyDeviceIface *device;
+       TnyDevice *device;
        ModestWidgetFactoryPrivate *priv;
        
        priv = MODEST_WIDGET_FACTORY_GET_PRIVATE(self);
@@ -210,8 +218,8 @@ init_signals (ModestWidgetFactory *self)
                          G_CALLBACK(on_password_requested), self);     
 
        /* FIXME: const casting is evil ==> tinymail */
-       device = (TnyDeviceIface*)tny_account_store_iface_get_device
-               (TNY_ACCOUNT_STORE_IFACE(priv->account_store));
+       device = (TnyDevice*)tny_account_store_get_device
+               (TNY_ACCOUNT_STORE(priv->account_store));
        if (device) {
                g_signal_connect (G_OBJECT(device), "connection_changed",
                                  G_CALLBACK(on_connection_changed), self);
@@ -220,7 +228,7 @@ init_signals (ModestWidgetFactory *self)
                
                /* init toggle in correct state */
                on_connection_changed (device,
-                                      tny_device_iface_is_online (device),
+                                      tny_device_is_online (device),
                                       self);
        }
 }
@@ -357,37 +365,70 @@ modest_widget_factory_get_status_bar (ModestWidgetFactory *self)
 }
 
 
+
+static const GSList*
+get_transports (ModestWidgetFactory *self)
+{
+       ModestWidgetFactoryPrivate *priv;
+       GSList *transports = NULL;
+       GSList *cursor, *accounts;
+       
+       priv = MODEST_WIDGET_FACTORY_GET_PRIVATE(self);
+
+       cursor = accounts = modest_account_mgr_account_names (priv->account_mgr, NULL);
+       while (cursor) {
+               ModestAccountData *data;
+               gchar *account_name = (gchar*)cursor->data;
+
+               data = modest_account_mgr_get_account_data (priv->account_mgr, account_name);
+               if (data && data->transport_account) {
+                       gchar *display_name = g_strdup_printf ("%s (%s)", data->email, account_name);
+                       ModestPair *pair = modest_pair_new ((gpointer)account_name,
+                                                           (gpointer)display_name , TRUE);
+                       transports = g_slist_append (transports, pair);
+               }
+               /* don't free account name; it's freed when the transports list is freed */
+               cursor = cursor->next;
+       }
+       g_slist_free (accounts);
+       
+       return transports;
+}
+
+
 GtkWidget*
 modest_widget_factory_get_combo_box (ModestWidgetFactory *self, ModestComboBoxType type)
 {
-       GtkWidget *combo_box;
-       const gchar **protos, **cursor; 
-
+       ModestWidgetFactoryPrivate *priv;
+       const GSList *list = NULL;
+       GtkWidget* combo_box;
+       
        g_return_val_if_fail (self, NULL);
 
-       combo_box = gtk_combo_box_new_text ();
+       priv = MODEST_WIDGET_FACTORY_GET_PRIVATE(self);
        
        switch (type) {
        case MODEST_COMBO_BOX_TYPE_STORE_PROTOS:
-               cursor = protos = modest_proto_store_protos ();
+               list = modest_protocol_mgr_get_store_protocols (priv->proto_mgr);
                break;
        case MODEST_COMBO_BOX_TYPE_TRANSPORT_PROTOS:
-               cursor = protos = modest_proto_transport_protos ();
+               list = modest_protocol_mgr_get_transport_protocols (priv->proto_mgr);
                break;
        case MODEST_COMBO_BOX_TYPE_SECURITY_PROTOS:
-               cursor = protos = modest_proto_security_protos ();
+               list = modest_protocol_mgr_get_security_protocols (priv->proto_mgr);
                break;
        case MODEST_COMBO_BOX_TYPE_AUTH_PROTOS:
-               cursor = protos = modest_proto_auth_protos ();
+               list = modest_protocol_mgr_get_auth_protocols (priv->proto_mgr);
+               break;
+       case MODEST_COMBO_BOX_TYPE_TRANSPORTS:
+               list = get_transports (self);
                break;
        default:
-               g_assert_not_reached ();
-       }
-       while (cursor && *cursor) {
-               gtk_combo_box_append_text (GTK_COMBO_BOX(combo_box),
-                                          (const gchar*)*cursor);
-               ++cursor;
+               g_warning ("invalid combo box type: %d", type);
+               return NULL;
        }
+
+       combo_box = modest_combo_box_new (list);
        gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box), 0);
        
        return combo_box;
@@ -441,7 +482,7 @@ modest_widget_factory_get_edit_toolbar (ModestWidgetFactory *self,
 
 
 static void
-on_folder_selected (ModestFolderView *folder_view, TnyFolderIface *folder,
+on_folder_selected (ModestFolderView *folder_view, TnyFolder *folder,
                    ModestWidgetFactory *self)
 {
        ModestWidgetFactoryPrivate *priv;
@@ -454,8 +495,8 @@ on_folder_selected (ModestFolderView *folder_view, TnyFolderIface *folder,
        if (folder) {
                guint num, unread;
                
-               num    = tny_folder_iface_get_all_count    (folder);
-               unread = tny_folder_iface_get_unread_count (folder); 
+               num    = tny_folder_get_all_count    (folder);
+               unread = tny_folder_get_unread_count (folder); 
 
                txt = g_strdup_printf (_("%d %s, %d unread"),
                                       num, num==1 ? _("item") : _("items"), unread);
@@ -468,7 +509,7 @@ on_folder_selected (ModestFolderView *folder_view, TnyFolderIface *folder,
 
 
 static void
-on_message_selected (ModestHeaderView *folder_view, TnyMsgIface *msg,
+on_message_selected (ModestHeaderView *folder_view, TnyMsg *msg,
                     ModestWidgetFactory *self)
 {      
        ModestWidgetFactoryPrivate *priv;
@@ -578,7 +619,7 @@ on_msg_attachment_clicked  (ModestMsgView *msgview, int index,
 
 
 static void
-on_connection_changed (TnyDeviceIface *device, gboolean online,
+on_connection_changed (TnyDevice *device, gboolean online,
                       ModestWidgetFactory *self)
 {
        ModestWidgetFactoryPrivate *priv;
@@ -597,19 +638,19 @@ static void
 on_online_toggle_toggled (GtkToggleButton *toggle, ModestWidgetFactory *self)
 {
        gboolean online;
-       const TnyDeviceIface *device;
+       const TnyDevice *device;
        ModestWidgetFactoryPrivate *priv;
        
        priv    = MODEST_WIDGET_FACTORY_GET_PRIVATE(self);
        online  = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(priv->online_toggle));
-       device  = tny_account_store_iface_get_device
-               (TNY_ACCOUNT_STORE_IFACE(priv->account_store)); 
+       device  = tny_account_store_get_device
+               (TNY_ACCOUNT_STORE(priv->account_store)); 
 
        /* FIXME: const casting should not be necessary ==> tinymail */
        if (online)  /* we're moving to online state */
-               tny_device_iface_force_online ((TnyDeviceIface*)device);
+               tny_device_force_online ((TnyDevice*)device);
        else  /* we're moving to offline state */
-               tny_device_iface_force_offline ((TnyDeviceIface*)device);
+               tny_device_force_offline ((TnyDevice*)device);
 }
 
 
@@ -622,14 +663,14 @@ static void on_item_not_found     (ModestHeaderView* header_view, ModestItemType
        gboolean online;
        gchar *item = type == MODEST_ITEM_TYPE_FOLDER ? "folder" : "message";
        
-       TnyDeviceIface *device;
+       TnyDevice *device;
        ModestWidgetFactoryPrivate *priv;
        
        priv    = MODEST_WIDGET_FACTORY_GET_PRIVATE(self);
-       device  = tny_account_store_iface_get_device
-               (TNY_ACCOUNT_STORE_IFACE(priv->account_store));
+       device  = tny_account_store_get_device
+               (TNY_ACCOUNT_STORE(priv->account_store));
        
-       online = tny_device_iface_is_online (device);
+       online = tny_device_is_online (device);
        if (online) {
                /* already online -- the item is simply not there... */
                dialog = gtk_message_dialog_new (NULL,
@@ -659,7 +700,7 @@ static void on_item_not_found     (ModestHeaderView* header_view, ModestItemType
 
                gtk_window_set_default_size (GTK_WINDOW(dialog), 300, 300);
                if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
-                       tny_device_iface_force_online (device);
+                       tny_device_force_online (device);
        }
        gtk_widget_destroy (dialog);
 }
index 4c023f3..25810d0 100644 (file)
@@ -40,6 +40,7 @@
 #include <widgets/modest-msg-view.h>
 #include <widgets/modest-account-view.h>
 #include <widgets/modest-toolbar.h>
+#include <widgets/modest-combo-box.h>
 
 G_BEGIN_DECLS
 
@@ -71,6 +72,7 @@ enum _ModestComboBoxType {
        MODEST_COMBO_BOX_TYPE_TRANSPORT_PROTOS,
        MODEST_COMBO_BOX_TYPE_SECURITY_PROTOS,
        MODEST_COMBO_BOX_TYPE_AUTH_PROTOS,
+       MODEST_COMBO_BOX_TYPE_TRANSPORTS
 };
 typedef enum _ModestComboBoxType ModestComboBoxType;
 
index f190fce..037fd7f 100644 (file)
@@ -82,6 +82,7 @@ modest_account_view_get_type (void)
                        sizeof(ModestAccountView),
                        1,              /* n_preallocs */
                        (GInstanceInitFunc) modest_account_view_init,
+                       NULL
                };
                my_type = g_type_register_static (GTK_TYPE_TREE_VIEW,
                                                  "ModestAccountView",
index 3514f38..3132d1a 100644 (file)
@@ -1,9 +1,34 @@
-/* modest-combo-box.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) */
 
 #include "modest-combo-box.h"
-/* include other impl specific header files */
 
 /* 'private'/'protected' functions */
 static void modest_combo_box_class_init (ModestComboBoxClass *klass);
@@ -16,13 +41,13 @@ enum {
        LAST_SIGNAL
 };
 
+
 enum {
        COLUMN_ID,
        COLUMN_DISPLAY_NAME,
        COLUMN_NUM
 };
 
-
 typedef struct _ModestComboBoxPrivate ModestComboBoxPrivate;
 struct _ModestComboBoxPrivate {
        /* my private members go here, eg. */
@@ -32,7 +57,7 @@ struct _ModestComboBoxPrivate {
                                               MODEST_TYPE_COMBO_BOX, \
                                               ModestComboBoxPrivate))
 /* globals */
-static GtkComboBoxClass *parent_class = NULL;
+static GObjectClass *parent_class = NULL;
 
 /* uncomment the following if you have defined any signals */
 /* static guint signals[LAST_SIGNAL] = {0}; */
@@ -54,7 +79,7 @@ modest_combo_box_get_type (void)
                        (GInstanceInitFunc) modest_combo_box_init,
                        NULL
                };
-               my_type = g_type_register_static (GTK_TYPE_COMBO_BOX,
+               my_type = g_type_register_static (G_TYPE_OBJECT,
                                                  "ModestComboBox",
                                                  &my_info, 0);
        }
@@ -97,51 +122,59 @@ modest_combo_box_finalize (GObject *obj)
        G_OBJECT_CLASS(parent_class)->finalize (obj);
 }
 
-
 static GtkTreeModel*
-get_model (ModestComboBoxLemma *lemmas)
+get_model (const GSList *pairs)
 {
        GtkTreeIter iter;
        GtkListStore *store;
-       ModestComboBoxLemma *lemma;
-       
-       if (!lemmas)
-               return NULL; /* not an error */
+       const GSList *cursor;
        
        store = gtk_list_store_new (2,
-                                   G_TYPE_STRING,   /* the display name */
-                                   G_TYPE_POINTER); /* the id */
-       
-       for (lemma = lemmas; lemma; ++lemma)
+                                   G_TYPE_POINTER, /* the id */
+                                   G_TYPE_STRING); /* the display name */
+       cursor = pairs;
+       while (cursor) {
+               ModestPair *pair = (ModestPair*)cursor->data;
                gtk_list_store_insert_with_values (store, &iter, G_MAXINT,
-                                                  /* FIXME: g_strdup?*/
-                                                  COLUMN_DISPLAY_NAME, lemma->display_name, 
-                                                  COLUMN_ID,           lemma->id,
+                                                  COLUMN_ID,           pair->first,
+                                                  COLUMN_DISPLAY_NAME, pair->second,
                                                   -1);
+               cursor = cursor->next;
+       }
+       
        return GTK_TREE_MODEL (store);
 }
 
 
 GtkWidget*
-modest_combo_box_new (ModestComboBoxLemma *lemmas)
+modest_combo_box_new (const GSList *pairs)
 {
-       GObject *obj;
        GtkTreeModel *model;
-       
-       obj = g_object_new(MODEST_TYPE_COMBO_BOX, NULL);
-       
-       model = get_model (lemmas);
+       GtkCellRenderer *renderer;
+       GObject *obj;
 
-       gtk_combo_box_set_model (GTK_COMBO_BOX(obj), model);
-       g_object_unref (model);
+       obj  = G_OBJECT(g_object_new(MODEST_TYPE_COMBO_BOX, NULL));
+               
+       model = get_model (pairs);
 
-       gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT(obj),
-                                       gtk_cell_renderer_text_new(),
-                                       "text", COLUMN_DISPLAY_NAME,
-                                       NULL);
+       if (model) {
+               gtk_combo_box_set_model (GTK_COMBO_BOX(obj), model);
+               g_object_unref (model);
+               gtk_cell_layout_clear (GTK_CELL_LAYOUT(obj));
+               
+               renderer = gtk_cell_renderer_text_new ();
+               gtk_cell_layout_pack_start (GTK_CELL_LAYOUT(obj),
+                                           renderer, FALSE);  
+               gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT(obj),
+                                               renderer, "text",
+                                               COLUMN_DISPLAY_NAME, NULL); 
+       }
+       
        return GTK_WIDGET(obj);
 }
 
+
+
 gpointer
 modest_combo_box_get_active_id (ModestComboBox *self)
 {
index f43e0eb..3a6ab75 100644 (file)
@@ -1,18 +1,44 @@
-/* modest-combo-box.h */
-/* insert (c)/licensing information) */
+/* 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.
+ */
 
 #ifndef __MODEST_COMBO_BOX_H__
 #define __MODEST_COMBO_BOX_H__
 
 #include <gtk/gtk.h>
-/* other include files */
+#include <modest-pair.h>
 
 G_BEGIN_DECLS
 
 /* convenience macros */
 #define MODEST_TYPE_COMBO_BOX             (modest_combo_box_get_type())
 #define MODEST_COMBO_BOX(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_COMBO_BOX,ModestComboBox))
-#define MODEST_COMBO_BOX_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_COMBO_BOX,GtkComboBox))
+#define MODEST_COMBO_BOX_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_COMBO_BOX,GObject))
 #define MODEST_IS_COMBO_BOX(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_COMBO_BOX))
 #define MODEST_IS_COMBO_BOX_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_COMBO_BOX))
 #define MODEST_COMBO_BOX_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_COMBO_BOX,ModestComboBoxClass))
@@ -21,42 +47,30 @@ typedef struct _ModestComboBox      ModestComboBox;
 typedef struct _ModestComboBoxClass ModestComboBoxClass;
 
 struct _ModestComboBox {
-        GtkComboBox parent;
+        GObject parent;
        /* insert public members, if any */
 };
 
 struct _ModestComboBoxClass {
-       GtkComboBoxClass parent_class;
+       GObjectClass parent_class;
        /* insert signal callback declarations, eg. */
        /* void (* my_event) (ModestComboBox* obj); */
 };
 
 
-struct _ModestComboBoxLemma {
-       const gchar *display_name;
-       gpointer id;
-};
-typedef struct _ModestComboBoxLemma ModestComboBoxLemma;
-
-/**
- * modest_combo_box_get_type
- *
- * Returns: the id of the ModestComboBox type
- */
+/* member functions */
 GType        modest_combo_box_get_type    (void) G_GNUC_CONST;
 
 /**
  * modest_combo_box_new
- * @lemmas: a ptr to a NULL terminated list of ModestComboBox lemmas,
- * each corresponding to a display_name, and the corresponding value
- * create a new modest combo box,
+ * @hash: a ptr to a GSList; each element should be a ptr to
+ * a ModestPair 
  *
  * create a new modest combo box
  * 
- * Returns: a new ModestComboBox instance, or NULL in case of failure
+ * Returns: a new GtkComboBox instance, or NULL in case of failure
  */
-GtkWidget*   modest_combo_box_new         (ModestComboBoxLemma *lemmas);
-
+GtkWidget*   modest_combo_box_new         (const GSList *hash);
 
 /**
  * modest_combo_box_get_active_id
@@ -66,9 +80,7 @@ GtkWidget*   modest_combo_box_new         (ModestComboBoxLemma *lemmas);
  * 
  * Returns: the id or NULL if there's nothing chosen.
  */
-gpointer   modest_combo_box_get_active_id       (ModestComboBox *self);
-
-
+gpointer   modest_combo_box_get_active_id  (ModestComboBox *self);
 
 G_END_DECLS
 
index 21363e5..12b7041 100644 (file)
 #include <glib/gi18n.h>
 #include <string.h>
 
-#include <tny-account-tree-model.h>
-#include <tny-account-store-iface.h>
-#include <tny-account-iface.h>
-#include <tny-folder-iface.h>
+#include <tny-gtk-account-tree-model.h>
+#include <tny-account-store.h>
+#include <tny-account.h>
+#include <tny-folder.h>
 #include <modest-icon-names.h>
 #include <modest-icon-factory.h>
 #include <modest-tny-account-store.h>
@@ -62,7 +62,7 @@ typedef struct _ModestFolderViewPrivate ModestFolderViewPrivate;
 struct _ModestFolderViewPrivate {
 
        TnyAccountStoreIface *account_store;
-       TnyFolderIface       *cur_folder;
+       TnyFolder            *cur_folder;
        gboolean             view_is_empty;
 
        gulong               sig1, sig2;
@@ -139,9 +139,9 @@ text_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer,
        TnyFolderType type;
        
        gtk_tree_model_get (tree_model, iter,
-                           TNY_ACCOUNT_TREE_MODEL_NAME_COLUMN, &fname,
-                           TNY_ACCOUNT_TREE_MODEL_TYPE_COLUMN, &type,
-                           TNY_ACCOUNT_TREE_MODEL_UNREAD_COLUMN, &unread, -1);
+                           TNY_GTK_ACCOUNT_TREE_MODEL_NAME_COLUMN, &fname,
+                           TNY_GTK_ACCOUNT_TREE_MODEL_TYPE_COLUMN, &type,
+                           TNY_GTK_ACCOUNT_TREE_MODEL_UNREAD_COLUMN, &unread, -1);
        rendobj = G_OBJECT(renderer);
 
        if (unread > 0) {
@@ -221,9 +221,9 @@ icon_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer,
        
        rendobj = G_OBJECT(renderer);
        gtk_tree_model_get (tree_model, iter,
-                           TNY_ACCOUNT_TREE_MODEL_TYPE_COLUMN, &type,
-                           TNY_ACCOUNT_TREE_MODEL_NAME_COLUMN, &fname,
-                           TNY_ACCOUNT_TREE_MODEL_UNREAD_COLUMN, &unread, -1);
+                           TNY_GTK_ACCOUNT_TREE_MODEL_TYPE_COLUMN, &type,
+                           TNY_GTK_ACCOUNT_TREE_MODEL_NAME_COLUMN, &fname,
+                           TNY_GTK_ACCOUNT_TREE_MODEL_UNREAD_COLUMN, &unread, -1);
        rendobj = G_OBJECT(renderer);
        
        if (type == TNY_FOLDER_TYPE_NORMAL)
@@ -396,7 +396,8 @@ update_model_empty (ModestFolderView *self)
        ModestFolderViewPrivate *priv;
        
        g_return_val_if_fail (self, FALSE);
-       
+       priv = MODEST_FOLDER_VIEW_GET_PRIVATE(self);
+
        store = gtk_tree_store_new (1, G_TYPE_STRING);
        gtk_tree_store_append (store, &iter, NULL);
 
@@ -407,12 +408,11 @@ update_model_empty (ModestFolderView *self)
                                 GTK_TREE_MODEL(store));
        g_object_unref (store);
 
-       priv = MODEST_FOLDER_VIEW_GET_PRIVATE(self);
        priv->view_is_empty = TRUE;
 
        g_signal_emit (G_OBJECT(self), signals[FOLDER_SELECTED_SIGNAL], 0,
                       NULL);
-       
+
        return TRUE;
 }
 
@@ -421,30 +421,30 @@ static gboolean
 update_model (ModestFolderView *self, ModestTnyAccountStore *account_store)
 {
        ModestFolderViewPrivate *priv;
-       TnyListIface     *account_list;
+
+       TnyList          *account_list;
        GtkTreeModel     *model, *sortable;
        
        g_return_val_if_fail (account_store, FALSE);
-       
        priv =  MODEST_FOLDER_VIEW_GET_PRIVATE(self);
-
-       model        = GTK_TREE_MODEL(tny_account_tree_model_new ());
-       account_list = TNY_LIST_IFACE(model);
+       
+       model        = GTK_TREE_MODEL(tny_gtk_account_tree_model_new (TRUE)); /* async */
+       account_list = TNY_LIST(model);
 
        update_model_empty (self); /* cleanup */
        priv->view_is_empty = TRUE;
-       
-       tny_account_store_iface_get_accounts (TNY_ACCOUNT_STORE_IFACE(account_store),
+
+       tny_account_store_get_accounts (TNY_ACCOUNT_STORE(account_store),
                                              account_list,
-                                             TNY_ACCOUNT_STORE_IFACE_STORE_ACCOUNTS);
-       if (!account_list) /* no store accounts found */ 
-               return TRUE;
+                                             TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
+       if (account_list) { /* no store accounts found */ 
        
-       sortable = gtk_tree_model_sort_new_with_model (model);
-       gtk_tree_view_set_model (GTK_TREE_VIEW(self), sortable);
-
-       priv->view_is_empty = FALSE;    
-       g_object_unref (model);
+               sortable = gtk_tree_model_sort_new_with_model (model);
+               gtk_tree_view_set_model (GTK_TREE_VIEW(self), sortable);
+               
+               priv->view_is_empty = FALSE;    
+               g_object_unref (model);
+       }
 
        return TRUE;
 } 
@@ -454,9 +454,9 @@ static void
 on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
 {
        GtkTreeModel            *model;
-       TnyFolderIface       *folder = NULL;
+       TnyFolder               *folder = NULL;
        GtkTreeIter             iter;
-       ModestFolderView *tree_view;
+       ModestFolderView        *tree_view;
        ModestFolderViewPrivate *priv;
 
        g_return_if_fail (sel);
@@ -477,11 +477,11 @@ on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
        tree_view = MODEST_FOLDER_VIEW (user_data);
 
        gtk_tree_model_get (model, &iter,
-                           TNY_ACCOUNT_TREE_MODEL_INSTANCE_COLUMN,
+                           TNY_GTK_ACCOUNT_TREE_MODEL_INSTANCE_COLUMN,
                            &folder, -1);
 
        if (priv->cur_folder) 
-               tny_folder_iface_expunge (priv->cur_folder);
+               tny_folder_expunge (priv->cur_folder);
        priv->cur_folder = folder;
 
        /* folder will not be defined if you click eg. on the root node */
index f8c8a79..ffa99bf 100644 (file)
@@ -30,8 +30,8 @@
 #ifndef __MODEST_FOLDER_VIEW_H__
 #define __MODEST_FOLDER_VIEW_H__
 
-#include <tny-account-tree-model.h>
-#include <tny-account-store-iface.h>
+#include <tny-gtk-account-tree-model.h>
+#include <tny-account-store.h>
 #include <glib-object.h>
 
 G_BEGIN_DECLS
index 8b817be..d359406 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <glib/gi18n.h>
 #include "modest-header-view.h"
-#include <tny-list-iface.h>
+#include <tny-list.h>
 #include <string.h>
 #include <modest-marshal.h>
 
@@ -53,8 +53,8 @@ enum {
 typedef struct _ModestHeaderViewPrivate ModestHeaderViewPrivate;
 struct _ModestHeaderViewPrivate {
 
-       TnyFolderIface *tny_folder;
-       TnyListIface      *headers;
+       TnyFolder *tny_folder;
+       TnyList      *headers;
        GSList            *columns;
        GMutex            *lock;
        ModestHeaderViewStyle style;
@@ -140,8 +140,8 @@ msgtype_cell_data (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
 {
        TnyHeaderFlags flags;
        GdkPixbuf *pixbuf = NULL;
-
-       gtk_tree_model_get (tree_model, iter, TNY_HEADER_LIST_MODEL_FLAGS_COLUMN,
+       
+       gtk_tree_model_get (tree_model, iter, TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN,
                            &flags, -1);
 
        if (flags & TNY_HEADER_FLAG_DELETED)
@@ -161,7 +161,7 @@ attach_cell_data (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
        TnyHeaderFlags flags;
        GdkPixbuf *pixbuf = NULL;
 
-       gtk_tree_model_get (tree_model, iter, TNY_HEADER_LIST_MODEL_FLAGS_COLUMN,
+       gtk_tree_model_get (tree_model, iter, TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN,
                            &flags, -1);
 
        if (flags & TNY_HEADER_FLAG_ATTACHMENTS)
@@ -177,7 +177,7 @@ header_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer,
 {
        TnyHeaderFlags flags;
        
-       gtk_tree_model_get (tree_model, iter, TNY_HEADER_LIST_MODEL_FLAGS_COLUMN,
+       gtk_tree_model_get (tree_model, iter, TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN,
                            &flags, -1);
 
        g_object_set (G_OBJECT(renderer),
@@ -226,13 +226,13 @@ sender_receiver_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *rendere
        gint sender_receiver_col;
 
        if (is_sender)
-               sender_receiver_col = TNY_HEADER_LIST_MODEL_FROM_COLUMN;
+               sender_receiver_col = TNY_GTK_HEADER_LIST_MODEL_FROM_COLUMN;
        else
-               sender_receiver_col = TNY_HEADER_LIST_MODEL_TO_COLUMN;
+               sender_receiver_col = TNY_GTK_HEADER_LIST_MODEL_TO_COLUMN;
                
        gtk_tree_model_get (tree_model, iter,
                            sender_receiver_col,  &address,
-                           TNY_HEADER_LIST_MODEL_FLAGS_COLUMN, &flags,
+                           TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN, &flags,
                            -1);
        
        g_object_set (G_OBJECT(renderer),
@@ -299,10 +299,10 @@ compact_header_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer
        time_t date;
                
        gtk_tree_model_get (tree_model, iter,
-                           TNY_HEADER_LIST_MODEL_FLAGS_COLUMN, &flags,
-                           TNY_HEADER_LIST_MODEL_FROM_COLUMN,  &from,
-                           TNY_HEADER_LIST_MODEL_SUBJECT_COLUMN, &subject,
-                           TNY_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN, &date,   
+                           TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN, &flags,
+                           TNY_GTK_HEADER_LIST_MODEL_FROM_COLUMN,  &from,
+                           TNY_GTK_HEADER_LIST_MODEL_SUBJECT_COLUMN, &subject,
+                           TNY_GTK_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN, &date,   
                            -1);
        rendobj = G_OBJECT(renderer);           
 
@@ -397,7 +397,7 @@ init_columns (ModestHeaderView *obj)
                case MODEST_HEADER_VIEW_COLUMN_MSGTYPE:
 
                        column = get_new_column (_("M"), renderer_msgtype, FALSE,
-                                                TNY_HEADER_LIST_MODEL_FLAGS_COLUMN,
+                                                TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN,
                                                 FALSE, (GtkTreeCellDataFunc)msgtype_cell_data,
                                                 NULL);
                        break;
@@ -405,42 +405,42 @@ init_columns (ModestHeaderView *obj)
                case MODEST_HEADER_VIEW_COLUMN_ATTACH:
 
                        column = get_new_column (_("A"), renderer_attach, FALSE,
-                                                TNY_HEADER_LIST_MODEL_FLAGS_COLUMN,
+                                                TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN,
                                                 FALSE, (GtkTreeCellDataFunc)attach_cell_data,
                                                 NULL);
                        break;
                        
                case MODEST_HEADER_VIEW_COLUMN_RECEIVED_DATE:
                        column = get_new_column (_("Received"), renderer_header, TRUE,
-                                                TNY_HEADER_LIST_MODEL_DATE_RECEIVED_COLUMN,
+                                                TNY_GTK_HEADER_LIST_MODEL_DATE_RECEIVED_COLUMN,
                                                 TRUE, (GtkTreeCellDataFunc)header_cell_data,
                                                 NULL);
                        break;
                        
                case MODEST_HEADER_VIEW_COLUMN_FROM:
                        column = get_new_column (_("From"), renderer_header, TRUE,
-                                                TNY_HEADER_LIST_MODEL_FROM_COLUMN,
+                                                TNY_GTK_HEADER_LIST_MODEL_FROM_COLUMN,
                                                 TRUE, (GtkTreeCellDataFunc)sender_receiver_cell_data,
                                                 GINT_TO_POINTER(TRUE));
                        break;
 
                case MODEST_HEADER_VIEW_COLUMN_TO:
                        column = get_new_column (_("To"), renderer_header, TRUE,
-                                                TNY_HEADER_LIST_MODEL_TO_COLUMN,
+                                                TNY_GTK_HEADER_LIST_MODEL_TO_COLUMN,
                                                 TRUE, (GtkTreeCellDataFunc)sender_receiver_cell_data,
                                                 GINT_TO_POINTER(FALSE));
                        break;
                        
                case MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER:
                        column = get_new_column (_("Header"), renderer_header, TRUE,
-                                                TNY_HEADER_LIST_MODEL_FROM_COLUMN,
+                                                TNY_GTK_HEADER_LIST_MODEL_FROM_COLUMN,
                                                 TRUE, (GtkTreeCellDataFunc)compact_header_cell_data,
                                                 NULL);
                        break;
                        
                case MODEST_HEADER_VIEW_COLUMN_SUBJECT:
                        column = get_new_column (_("Subject"), renderer_header, TRUE,
-                                                TNY_HEADER_LIST_MODEL_SUBJECT_COLUMN,
+                                                TNY_GTK_HEADER_LIST_MODEL_SUBJECT_COLUMN,
                                                 TRUE, (GtkTreeCellDataFunc)header_cell_data,
                                                 NULL);
                        break;
@@ -448,7 +448,7 @@ init_columns (ModestHeaderView *obj)
                        
                case MODEST_HEADER_VIEW_COLUMN_SENT_DATE:
                        column = get_new_column (_("Sent"), renderer_header, TRUE,
-                                                TNY_HEADER_LIST_MODEL_DATE_SENT_COLUMN,
+                                                TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_COLUMN,
                                                 TRUE, (GtkTreeCellDataFunc)header_cell_data,
                                                 NULL);
                        break;
@@ -509,7 +509,7 @@ modest_header_view_finalize (GObject *obj)
 }
 
 GtkWidget*
-modest_header_view_new (TnyFolderIface *folder,
+modest_header_view_new (TnyFolder *folder,
                        GSList *columns,
                        ModestHeaderViewStyle style)
 {
@@ -563,7 +563,7 @@ modest_header_view_set_columns (ModestHeaderView *self, GSList *columns)
        for (cursor = columns; cursor; cursor = cursor->next) {
                ModestHeaderViewColumn col = 
                        (ModestHeaderViewColumn) GPOINTER_TO_INT(cursor->data);
-               if (0 > col || col >= MODEST_HEADER_VIEW_COLUMN_NUM)
+               if (col >= MODEST_HEADER_VIEW_COLUMN_NUM)
                        g_printerr ("modest: invalid column %d in column list\n", col);
                else
                        priv->columns = g_slist_append (priv->columns, cursor->data);
@@ -594,8 +594,7 @@ modest_header_view_set_style (ModestHeaderView *self,
                                       ModestHeaderViewStyle style)
 {
        g_return_val_if_fail (self, FALSE);
-       g_return_val_if_fail (style >= 0 && style < MODEST_HEADER_VIEW_STYLE_NUM,
-                             FALSE);
+       g_return_val_if_fail (style < MODEST_HEADER_VIEW_STYLE_NUM, FALSE);
        
        MODEST_HEADER_VIEW_GET_PRIVATE(self)->style = style;
        
@@ -617,7 +616,7 @@ static inline int
 get_prefix_len (const gchar *sub)
 {
        gint i = 0;
-       const static gchar* prefix[] = {"Re:", "RE:", "Fwd:", "FWD:", "FW:", "AW:", NULL};
+       static const gchar* prefix[] = {"Re:", "RE:", "Fwd:", "FWD:", "FW:", "AW:", NULL};
 
        if (sub[0] != 'R' && sub[0] != 'F') /* optimization */
                return 0;
@@ -670,19 +669,19 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
        case MODEST_HEADER_VIEW_COLUMN_COMPACT_HEADER:
        case MODEST_HEADER_VIEW_COLUMN_RECEIVED_DATE:
                gtk_tree_model_get (tree_model, iter1,
-                                   TNY_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN,
                                    &t1,-1);
                gtk_tree_model_get (tree_model, iter2,
-                                   TNY_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_RECEIVED_TIME_T_COLUMN,
                                    &t2,-1);
                return t1 - t2;
                
        case MODEST_HEADER_VIEW_COLUMN_SENT_DATE:
                gtk_tree_model_get (tree_model, iter1,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN,
                                    &t1,-1);
                gtk_tree_model_get (tree_model, iter2,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN,
                                    &t2,-1);
                return t1 - t2;
 
@@ -691,12 +690,12 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
        case MODEST_HEADER_VIEW_COLUMN_SUBJECT: {
 
                gtk_tree_model_get (tree_model, iter1,
-                                   TNY_HEADER_LIST_MODEL_SUBJECT_COLUMN, &s1,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1,
+                                   TNY_GTK_HEADER_LIST_MODEL_SUBJECT_COLUMN, &s1,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1,
                                    -1);
                gtk_tree_model_get (tree_model, iter2,
-                                   TNY_HEADER_LIST_MODEL_SUBJECT_COLUMN, &s2,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2,
+                                   TNY_GTK_HEADER_LIST_MODEL_SUBJECT_COLUMN, &s2,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2,
                                    -1);
                
                cmp = cmp_normalized_subject(s1, s2);
@@ -710,12 +709,12 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
        case MODEST_HEADER_VIEW_COLUMN_FROM:
                
                gtk_tree_model_get (tree_model, iter1,
-                                   TNY_HEADER_LIST_MODEL_FROM_COLUMN, &s1,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1,
+                                   TNY_GTK_HEADER_LIST_MODEL_FROM_COLUMN, &s1,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1,
                                    -1);
                gtk_tree_model_get (tree_model, iter2,
-                                   TNY_HEADER_LIST_MODEL_FROM_COLUMN, &s2,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2,
+                                   TNY_GTK_HEADER_LIST_MODEL_FROM_COLUMN, &s2,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2,
                                    -1);
                cmp = strcmp (s1, s2);
                g_free (s1);
@@ -726,12 +725,12 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
        case MODEST_HEADER_VIEW_COLUMN_TO: 
                
                gtk_tree_model_get (tree_model, iter1,
-                                   TNY_HEADER_LIST_MODEL_TO_COLUMN, &s1,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1,
+                                   TNY_GTK_HEADER_LIST_MODEL_TO_COLUMN, &s1,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1,
                                    -1);
                gtk_tree_model_get (tree_model, iter2,
-                                   TNY_HEADER_LIST_MODEL_TO_COLUMN, &s2,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2,
+                                   TNY_GTK_HEADER_LIST_MODEL_TO_COLUMN, &s2,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2,
                                    -1);
                cmp = strcmp (s1, s2);
                g_free (s1);
@@ -741,10 +740,10 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
 
        case MODEST_HEADER_VIEW_COLUMN_ATTACH:
 
-               gtk_tree_model_get (tree_model, iter1, TNY_HEADER_LIST_MODEL_FLAGS_COLUMN, &val1,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1, -1);
-               gtk_tree_model_get (tree_model, iter2, TNY_HEADER_LIST_MODEL_FLAGS_COLUMN, &val2,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2, -1);
+               gtk_tree_model_get (tree_model, iter1, TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN, &val1,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1, -1);
+               gtk_tree_model_get (tree_model, iter2, TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN, &val2,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2, -1);
                
                cmp = (val1 & TNY_HEADER_FLAG_ATTACHMENTS) -
                        (val2 & TNY_HEADER_FLAG_ATTACHMENTS);
@@ -752,10 +751,10 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
                return cmp ? cmp : t1 - t2;
                
        case MODEST_HEADER_VIEW_COLUMN_MSGTYPE:
-               gtk_tree_model_get (tree_model, iter1, TNY_HEADER_LIST_MODEL_FLAGS_COLUMN, &val1,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1,-1);
-               gtk_tree_model_get (tree_model, iter2, TNY_HEADER_LIST_MODEL_FLAGS_COLUMN, &val2,
-                                   TNY_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2,-1);
+               gtk_tree_model_get (tree_model, iter1, TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN, &val1,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t1,-1);
+               gtk_tree_model_get (tree_model, iter2, TNY_GTK_HEADER_LIST_MODEL_FLAGS_COLUMN, &val2,
+                                   TNY_GTK_HEADER_LIST_MODEL_DATE_SENT_TIME_T_COLUMN, &t2,-1);
                cmp =  (val1 & TNY_HEADER_FLAG_SEEN) - (val2 & TNY_HEADER_FLAG_SEEN);
 
                return cmp ? cmp : t1 - t2;
@@ -767,9 +766,9 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
 
 
 static void
-on_refresh_folder (TnyFolderIface *folder, gboolean cancelled, gpointer user_data)
+on_refresh_folder (TnyFolder *folder, gboolean cancelled, gpointer user_data)
 {
-       GtkTreeModel *oldsortable, *sortable;
+       GtkTreeModel *sortable; 
        ModestHeaderView *self;
        ModestHeaderViewPrivate *priv;
 
@@ -779,52 +778,41 @@ on_refresh_folder (TnyFolderIface *folder, gboolean cancelled, gpointer user_dat
        self = MODEST_HEADER_VIEW(user_data);
        priv = MODEST_HEADER_VIEW_GET_PRIVATE(self);
 
-       g_mutex_lock (priv->lock);
-
        if (!folder)  /* when there is no folder */
                gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(self), FALSE);
-       
        else { /* it's a new one or a refresh */
                GSList *col;
 
-               priv->headers = TNY_LIST_IFACE(tny_header_list_model_new ());
-               
-               tny_folder_iface_get_headers (folder, priv->headers, FALSE);
-               tny_header_list_model_set_folder (TNY_HEADER_LIST_MODEL(priv->headers),
-                                                     folder, TRUE); /* async */
+               priv->headers = TNY_LIST(tny_gtk_header_list_model_new ());
+               tny_folder_get_headers (folder, priv->headers, FALSE);
                
-               oldsortable = gtk_tree_view_get_model(GTK_TREE_VIEW (self));
-               if (oldsortable && GTK_IS_TREE_MODEL_SORT(oldsortable)) {
-                       GtkTreeModel *oldmodel = gtk_tree_model_sort_get_model
-                               (GTK_TREE_MODEL_SORT(oldsortable));
-                       if (oldmodel)
-                               g_object_unref (G_OBJECT(oldmodel));
-                       g_object_unref (oldsortable);
-               }
-       
-               sortable = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL(priv->headers));
+               tny_gtk_header_list_model_set_folder
+                       (TNY_GTK_HEADER_LIST_MODEL(priv->headers),folder, TRUE); /*async*/
+                       
+               sortable = gtk_tree_model_sort_new_with_model
+                       (GTK_TREE_MODEL(priv->headers));
 
                /* install our special sorting functions */
                col = priv->columns;
                while (col) {
                        gint col_id = GPOINTER_TO_INT (col->data);
-                       gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE(sortable), col_id,
+                       gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE(sortable),
+                                                        col_id,
                                                         (GtkTreeIterCompareFunc)cmp_rows,
                                                         GINT_TO_POINTER(col_id), NULL);
                        col = col->next;
                }
 
                gtk_tree_view_set_model (GTK_TREE_VIEW (self), sortable);
-               gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW(self), TRUE);
+               gtk_tree_view_set_headers_clickable (GTK_TREE_VIEW(self),TRUE);
                gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(self), TRUE);
                /* no need to unref sortable */
        }
-       g_mutex_unlock (priv->lock);
 }
 
 
 static void
-on_refresh_folder_status_update (TnyFolderIface *folder, const gchar *msg,
+on_refresh_folder_status_update (TnyFolder *folder, const gchar *msg,
                                 gint status_id,  gpointer user_data)
 {
        ModestHeaderView *self;
@@ -841,32 +829,26 @@ on_refresh_folder_status_update (TnyFolderIface *folder, const gchar *msg,
 
 gboolean
 modest_header_view_set_folder (ModestHeaderView *self,
-                              TnyFolderIface *folder)
+                              TnyFolder *folder)
 {
        ModestHeaderViewPrivate *priv;
        priv = MODEST_HEADER_VIEW_GET_PRIVATE(self);
-       
-       g_mutex_lock (priv->lock);
 
        if (!folder)  {/* when there is no folder */
-               GtkTreeModel *model;
-               model = gtk_tree_view_get_model (GTK_TREE_VIEW(self));
                gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(self), FALSE);
                gtk_tree_view_set_model (GTK_TREE_VIEW (self), NULL);
-               if (model)
-                       g_object_unref (model);
        } else { /* it's a new one or a refresh */
-               tny_folder_iface_refresh_async (folder,
-                                                   on_refresh_folder,
-                                                   on_refresh_folder_status_update,
-                                                   self);
+               tny_folder_refresh_async (folder,
+                                         on_refresh_folder,
+                                         on_refresh_folder_status_update,
+                                         self);
        }
 
        /* no message selected */
        g_signal_emit (G_OBJECT(self), signals[MESSAGE_SELECTED_SIGNAL], 0,
                       NULL);
 
-       g_mutex_unlock (priv->lock);
+       //g_mutex_unlock (priv->lock);
 
        return TRUE;
 }
@@ -877,12 +859,12 @@ static void
 on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
 {
        GtkTreeModel            *model;
-       TnyHeaderIface       *header;
+       TnyHeader       *header;
        GtkTreeIter             iter;
        ModestHeaderView        *self;
        ModestHeaderViewPrivate *priv;
-       const TnyMsgIface *msg = NULL;
-       const TnyFolderIface *folder;
+       const TnyMsg *msg = NULL;
+       const TnyFolder *folder;
        
        g_return_if_fail (sel);
        g_return_if_fail (user_data);
@@ -894,7 +876,7 @@ on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
                return; /* msg was _un_selected */
        
        gtk_tree_model_get (model, &iter,
-                           TNY_HEADER_LIST_MODEL_INSTANCE_COLUMN,
+                           TNY_GTK_HEADER_LIST_MODEL_INSTANCE_COLUMN,
                            &header, -1);
        
        if (!header) {
@@ -902,14 +884,14 @@ on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
                return;
        }
 
-       folder = tny_header_iface_get_folder (TNY_HEADER_IFACE(header));
+       folder = tny_header_get_folder (TNY_HEADER(header));
        if (!folder) {
                g_signal_emit (G_OBJECT(self), signals[ITEM_NOT_FOUND_SIGNAL], 0,
                               MODEST_ITEM_TYPE_FOLDER);
                return;
        }
        
-       msg = tny_folder_iface_get_message (TNY_FOLDER_IFACE(folder),
+       msg = tny_folder_get_message (TNY_FOLDER(folder),
                                                header);
        if (!msg) {
                g_signal_emit (G_OBJECT(self), signals[ITEM_NOT_FOUND_SIGNAL], 0,
@@ -921,7 +903,7 @@ on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
                       msg);
        
        /* mark message as seen; _set_flags crashes, bug in tinymail? */
-       //flags = tny_header_iface_get_flags (TNY_HEADER_IFACE(header));
-       //tny_header_iface_set_flags (header, TNY_HEADER_FLAG_SEEN);
+       //flags = tny_header_get_flags (TNY_HEADER(header));
+       //tny_header_set_flags (header, TNY_HEADER_FLAG_SEEN);
 }      
 
index 9a8a933..20f91b0 100644 (file)
 #define __MODEST_HEADER_VIEW_H__
 
 #include <gtk/gtk.h>
-#include <tny-folder-iface.h>
-#include <tny-account-tree-model.h>
-#include <tny-msg-iface.h>
-#include <tny-header-iface.h>
-#include <tny-header-list-model.h>
+#include <tny-folder.h>
+#include <tny-gtk-account-tree-model.h>
+#include <tny-msg.h>
+#include <tny-header.h>
+#include <tny-gtk-header-list-model.h>
 
 G_BEGIN_DECLS
 
@@ -61,7 +61,7 @@ struct _ModestHeaderViewClass {
        GtkTreeViewClass parent_class;
 
        void (*message_selected) (ModestHeaderView* self,
-                                 TnyMsgIface *msg,
+                                 TnyMsg *msg,
                                  gpointer user_data);
 
        void (*item_not_found) (ModestHeaderView* self,
@@ -117,7 +117,7 @@ GType        modest_header_view_get_type    (void) G_GNUC_CONST;
 
 /**
  * modest_header_view_new:
- * @folder: a TnyMsgFolderIface object
+ * @folder: a TnyMsgFolder object
  * @columns: a list of ModestHeaderViewColumn
  * @style: a ModestHeaderViewColumn with the style of this listview
  *  (  MODEST_HEADER_VIEW_STYLE_NORMAL or MODEST_HEADER_VIEW_STYLE_COMPACT)
@@ -126,21 +126,21 @@ GType        modest_header_view_get_type    (void) G_GNUC_CONST;
  *   
  * Returns: a new GtkWidget (a GtkTreeView-subclass)
  */
-GtkWidget*   modest_header_view_new        (TnyFolderIface *folder,
+GtkWidget*   modest_header_view_new        (TnyFolder *folder,
                                            GSList *columns,
                                            ModestHeaderViewStyle style);
 
 /**
  * modest_header_view_set_folder:
  * @self: a ModestHeaderView instance
- * @folder: a TnyFolderIface object
+ * @folder: a TnyFolder object
  * 
  * set the folder for this ModestHeaderView
  *  
  * Returns: TRUE if it succeeded, FALSE otherwise
  */
 gboolean     modest_header_view_set_folder (ModestHeaderView *self,
-                                           TnyFolderIface *folder);
+                                           TnyFolder *folder);
 
 
 /**
@@ -157,7 +157,7 @@ gboolean     modest_header_view_set_columns (ModestHeaderView *self,
 /**
  * modest_header_view_get_columns:
  * @self: a ModestHeaderView instance
- * @folder: a TnyFolderIface object
+ * @folder: a TnyFolder object
  * 
  * get the columns for this ModestHeaderView
  *  
index e11ae91..2e37fa1 100644 (file)
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <tny-text-buffer-stream.h>
+#include <tny-gtk-text-buffer-stream.h>
 #include <string.h>
 #include <regex.h>
 #include <ctype.h>
@@ -35,8 +35,8 @@
 #include <glib/gi18n.h>
 #include <gtkhtml/gtkhtml.h>
 #include <gtkhtml/gtkhtml-stream.h>
-#include <tny-list-iface.h>
 #include <tny-list.h>
+#include <tny-simple-list.h>
 
 #include <modest-tny-msg-actions.h>
 #include "modest-msg-view.h"
@@ -95,7 +95,7 @@ typedef struct _ModestMsgViewPrivate ModestMsgViewPrivate;
 struct _ModestMsgViewPrivate {
 
        GtkWidget   *gtkhtml;
-       TnyMsgIface *msg;
+       TnyMsg      *msg;
 
        gulong  sig1, sig2, sig3;
 };
@@ -218,7 +218,7 @@ modest_msg_view_finalize (GObject *obj)
 
 
 GtkWidget*
-modest_msg_view_new (TnyMsgIface *msg)
+modest_msg_view_new (TnyMsg *msg)
 {
        GObject *obj;
        ModestMsgView* self;
@@ -287,31 +287,31 @@ on_link_hover (GtkWidget *widget, const gchar *uri, ModestMsgView *msg_view)
 
 
 
-static TnyMimePartIface *
-find_cid_image (TnyMsgIface *msg, const gchar *cid)
+static TnyMimePart *
+find_cid_image (TnyMsg *msg, const gchar *cid)
 {
-       TnyMimePartIface *part = NULL;
-       TnyListIface *parts;
-       TnyIteratorIface *iter;
+       TnyMimePart *part = NULL;
+       TnyList *parts;
+       TnyIterator *iter;
        
        g_return_val_if_fail (msg, NULL);
        g_return_val_if_fail (cid, NULL);
        
-       parts  = TNY_LIST_IFACE (tny_list_new());
+       parts  = TNY_LIST (tny_simple_list_new());
 
-       tny_msg_iface_get_parts (msg, parts); 
-       iter   = tny_list_iface_create_iterator (parts);
+       tny_msg_get_parts (msg, parts); 
+       iter   = tny_list_create_iterator (parts);
        
-       while (!tny_iterator_iface_is_done(iter)) {
+       while (!tny_iterator_is_done(iter)) {
                const gchar *part_cid;
-               part = TNY_MIME_PART_IFACE(tny_iterator_iface_current(iter));
-               part_cid = tny_mime_part_iface_get_content_id (part);
+               part = TNY_MIME_PART(tny_iterator_get_current(iter));
+               part_cid = tny_mime_part_get_content_id (part);
 
                if (part_cid && strcmp (cid, part_cid) == 0)
                        break;
 
                part = NULL;
-               tny_iterator_iface_next (iter);
+               tny_iterator_next (iter);
        }
        
        if (part)
@@ -334,14 +334,14 @@ on_url_requested (GtkWidget *widget, const gchar *uri,
        
        if (g_str_has_prefix (uri, "cid:")) {
                /* +4 ==> skip "cid:" */
-               TnyMimePartIface *part = find_cid_image (priv->msg, uri + 4);
+               TnyMimePart *part = find_cid_image (priv->msg, uri + 4);
                if (!part) {
                        g_printerr ("modest: '%s' not found\n", uri + 4);
                        gtk_html_stream_close (stream, GTK_HTML_STREAM_ERROR);
                } else {
-                       TnyStreamIface *tny_stream =
-                               TNY_STREAM_IFACE(modest_tny_stream_gtkhtml_new(stream));
-                       tny_mime_part_iface_decode_to_stream ((TnyMimePartIface*)part,
+                       TnyStream *tny_stream =
+                               TNY_STREAM(modest_tny_stream_gtkhtml_new(stream));
+                       tny_mime_part_decode_to_stream ((TnyMimePart*)part,
                                                                  tny_stream);
                        gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
        
@@ -364,12 +364,12 @@ typedef struct  {
 
 /* render the attachments as hyperlinks in html */
 static gchar*
-attachments_as_html (ModestMsgView *self, TnyMsgIface *msg)
+attachments_as_html (ModestMsgView *self, TnyMsg *msg)
 {
        ModestMsgViewPrivate *priv;
        GString *appendix;
-       TnyListIface *parts;
-       TnyIteratorIface *iter;
+       TnyList *parts;
+       TnyIterator *iter;
        gchar *html;
        int index = 0;
        
@@ -378,29 +378,29 @@ attachments_as_html (ModestMsgView *self, TnyMsgIface *msg)
 
        priv  = MODEST_MSG_VIEW_GET_PRIVATE (self);
 
-       parts = TNY_LIST_IFACE(tny_list_new());
-       tny_msg_iface_get_parts (msg, parts);
-       iter  = tny_list_iface_create_iterator (parts);
+       parts = TNY_LIST(tny_simple_list_new());
+       tny_msg_get_parts (msg, parts);
+       iter  = tny_list_create_iterator (parts);
        
        appendix= g_string_new ("");
        
-       while (!tny_iterator_iface_is_done(iter)) {
-               TnyMimePartIface *part;
+       while (!tny_iterator_is_done(iter)) {
+               TnyMimePart *part;
 
                ++index; /* attachment numbers are 1-based */
                
-               part = TNY_MIME_PART_IFACE(tny_iterator_iface_current (iter));
+               part = TNY_MIME_PART(tny_iterator_get_current (iter));
 
-               if (tny_mime_part_iface_is_attachment (part)) {
+               if (tny_mime_part_is_attachment (part)) {
 
-                       const gchar *filename = tny_mime_part_iface_get_filename(part);
+                       const gchar *filename = tny_mime_part_get_filename(part);
                        if (!filename)
                                filename = _("attachment");
 
                        g_string_append_printf (appendix, "<a href=\"%s%d\">%s</a> \n",
                                                ATT_PREFIX, index, filename);                    
                }
-               tny_iterator_iface_next (iter);
+               tny_iterator_next (iter);
        }
        g_object_unref (G_OBJECT(iter));
        
@@ -593,10 +593,10 @@ get_url_matches (GString *txt)
 
 
 static gboolean
-set_html_message (ModestMsgView *self, TnyMimePartIface *tny_body, TnyMsgIface *msg)
+set_html_message (ModestMsgView *self, TnyMimePart *tny_body, TnyMsg *msg)
 {
        gchar *html_attachments;
-       TnyStreamIface *gtkhtml_stream; 
+       TnyStream *gtkhtml_stream;      
        ModestMsgViewPrivate *priv;
        
        g_return_val_if_fail (self, FALSE);
@@ -605,21 +605,21 @@ set_html_message (ModestMsgView *self, TnyMimePartIface *tny_body, TnyMsgIface *
        priv = MODEST_MSG_VIEW_GET_PRIVATE(self);
 
        gtkhtml_stream =
-               TNY_STREAM_IFACE(modest_tny_stream_gtkhtml_new
+               TNY_STREAM(modest_tny_stream_gtkhtml_new
                                 (gtk_html_begin(GTK_HTML(priv->gtkhtml))));
        
-       tny_stream_iface_reset (gtkhtml_stream);
+       tny_stream_reset (gtkhtml_stream);
        
        html_attachments = attachments_as_html(self, msg);
        if (html_attachments) {
-               tny_stream_iface_write (gtkhtml_stream, html_attachments,
+               tny_stream_write (gtkhtml_stream, html_attachments,
                                        strlen(html_attachments));
-               tny_stream_iface_reset (gtkhtml_stream);
+               tny_stream_reset (gtkhtml_stream);
                g_free (html_attachments);
        }
 
        // FIXME: tinymail
-       tny_mime_part_iface_decode_to_stream ((TnyMimePartIface*)tny_body,
+       tny_mime_part_decode_to_stream ((TnyMimePart*)tny_body,
                                                  gtkhtml_stream);
 
        g_object_unref (G_OBJECT(gtkhtml_stream));
@@ -631,11 +631,11 @@ set_html_message (ModestMsgView *self, TnyMimePartIface *tny_body, TnyMsgIface *
 /* this is a hack --> we use the tny_text_buffer_stream to
  * get the message text, then write to gtkhtml 'by hand' */
 static gboolean
-set_text_message (ModestMsgView *self, TnyMimePartIface *tny_body, TnyMsgIface *msg)
+set_text_message (ModestMsgView *self, TnyMimePart *tny_body, TnyMsg *msg)
 {
        GtkTextBuffer *buf;
        GtkTextIter begin, end;
-       TnyStreamIface* txt_stream, *gtkhtml_stream;
+       TnyStream* txt_stream, *gtkhtml_stream;
        gchar *txt, *html_attachments;
        ModestMsgViewPrivate *priv;
                
@@ -645,33 +645,33 @@ set_text_message (ModestMsgView *self, TnyMimePartIface *tny_body, TnyMsgIface *
        priv           = MODEST_MSG_VIEW_GET_PRIVATE(self);
        
        buf            = gtk_text_buffer_new (NULL);
-       txt_stream     = TNY_STREAM_IFACE(tny_text_buffer_stream_new (buf));
+       txt_stream     = TNY_STREAM(tny_gtk_text_buffer_stream_new (buf));
                
-       tny_stream_iface_reset (txt_stream);
+       tny_stream_reset (txt_stream);
        
        gtkhtml_stream =
-               TNY_STREAM_IFACE(modest_tny_stream_gtkhtml_new
+               TNY_STREAM(modest_tny_stream_gtkhtml_new
                                 (gtk_html_begin(GTK_HTML(priv->gtkhtml))));
 
        html_attachments = attachments_as_html(self, msg);
        if (html_attachments) {
-               tny_stream_iface_write (gtkhtml_stream, html_attachments,
+               tny_stream_write (gtkhtml_stream, html_attachments,
                                        strlen(html_attachments));
-               tny_stream_iface_reset (gtkhtml_stream);
+               tny_stream_reset (gtkhtml_stream);
                g_free (html_attachments);
        }
 
        // FIXME: tinymail
-       tny_mime_part_iface_decode_to_stream ((TnyMimePartIface*)tny_body,
+       tny_mime_part_decode_to_stream ((TnyMimePart*)tny_body,
                                                  txt_stream);
-       tny_stream_iface_reset (txt_stream);            
+       tny_stream_reset (txt_stream);          
        
        gtk_text_buffer_get_bounds (buf, &begin, &end);
        txt = gtk_text_buffer_get_text (buf, &begin, &end, FALSE);
        if (txt) {
                gchar *html = convert_to_html (txt);
-               tny_stream_iface_write (gtkhtml_stream, html, strlen(html));
-               tny_stream_iface_reset (gtkhtml_stream);
+               tny_stream_write (gtkhtml_stream, html, strlen(html));
+               tny_stream_reset (gtkhtml_stream);
                g_free (txt);
                g_free (html);
        }
@@ -725,9 +725,9 @@ modest_msg_view_get_selected_text (ModestMsgView *self)
 
 
 void
-modest_msg_view_set_message (ModestMsgView *self, TnyMsgIface *msg)
+modest_msg_view_set_message (ModestMsgView *self, TnyMsg *msg)
 {
-       TnyMimePartIface *body;
+       TnyMimePart *body;
        ModestMsgViewPrivate *priv;
 
        g_return_if_fail (self);
@@ -750,7 +750,7 @@ modest_msg_view_set_message (ModestMsgView *self, TnyMsgIface *msg)
                
        body = modest_tny_msg_actions_find_body_part (msg, TRUE);
        if (body) {
-               if (tny_mime_part_iface_content_type_is (body, "text/html"))
+               if (tny_mime_part_content_type_is (body, "text/html"))
                        set_html_message (self, body, msg);
                else
                        set_text_message (self, body, msg);
index 9f258ab..2bc48f1 100644 (file)
@@ -31,9 +31,9 @@
 #define __MODEST_MSG_VIEW_H__
 
 #include <gtk/gtk.h>
-#include <tny-stream-iface.h>
-#include <tny-msg-iface.h>
-#include <tny-mime-part-iface.h>
+#include <tny-stream.h>
+#include <tny-msg.h>
+#include <tny-mime-part.h>
 #include <modest-conf.h>
 
 G_BEGIN_DECLS
@@ -77,7 +77,7 @@ GType        modest_msg_view_get_type    (void) G_GNUC_CONST;
 
 /**
  * modest_msg_view_new 
- * @tny_msg: a TnyMsgIface instance, or NULL
+ * @tny_msg: a TnyMsg instance, or NULL
  *
  * create a new ModestMsgView widget (a GtkScrolledWindow subclass),
  * and display the @tny_msg e-mail message in it. If @tny_msg is NULL,
@@ -85,18 +85,18 @@ GType        modest_msg_view_get_type    (void) G_GNUC_CONST;
  *  
  * Returns: a new ModestMsgView widget, or NULL if there's an error
  */
-GtkWidget*   modest_msg_view_new          (TnyMsgIface *tny_msg);
+GtkWidget*   modest_msg_view_new          (TnyMsg *tny_msg);
 
 
 /**
  * modest_msg_view_set_message
  * @self: a ModestMsgView instance
- * @tny_msg: a TnyMsgIface instance, or NULL
+ * @tny_msg: a TnyMsg instance, or NULL
  *
  * display the @tny_msg e-mail message. If @tny_msg is NULL,
  * then a blank page will be displayed
  *  */
-void         modest_msg_view_set_message  (ModestMsgView *self, TnyMsgIface *tny_msg);
+void         modest_msg_view_set_message  (ModestMsgView *self, TnyMsg *tny_msg);
 
 /**
  * modest_msg_view_get_selected_text: