* all:
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Sun, 11 Feb 2007 13:02:10 +0000 (13:02 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Sun, 11 Feb 2007 13:02:10 +0000 (13:02 +0000)
- move modest-account-view-window.h to widgets/
- use accessor function to get child widgets
(ModestMainWindow) ==> modest_main_window_get_child_widget
- ui-actions: make actions work on ModestMsgViewWindow as well
- move get_password UI stuff to ui-actions; this will be moved
 to front-specific later...
- add signal to modest-tny-account-store: "password_requested"
- misc fixes

pmo-trunk-r814

25 files changed:
src/gtk/Makefile.am
src/gtk/modest-account-view-window.c
src/gtk/modest-account-view-window.h [deleted file]
src/gtk/modest-main-window.c
src/gtk/modest-msg-view-window.c
src/maemo/Makefile.am
src/maemo/modest-account-view-window.c
src/maemo/modest-account-view-window.h [deleted file]
src/maemo/modest-main-window.c
src/maemo/modest-msg-view-window.c
src/modest-mail-operation.c
src/modest-marshal.list
src/modest-tny-account-store.c
src/modest-tny-account-store.h
src/modest-tny-send-queue.c
src/modest-ui-actions.c
src/modest-ui-actions.h
src/widgets/Makefile.am
src/widgets/modest-account-view-window.h [new file with mode: 0644]
src/widgets/modest-folder-view.c
src/widgets/modest-header-view.c
src/widgets/modest-main-window.h
src/widgets/modest-msg-view-window.h
src/widgets/modest-msg-view.c
src/widgets/modest-msg-view.h

index 04ae41c..42cb970 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Makefile.am
 #
 # Makefile.am
-# Time-stamp: <2007-02-07 22:26:18 (djcb)>
+# Time-stamp: <2007-02-10 14:47:15 (djcb)>
 #
 #
 # use Automake 'trick' ==> convenience static libraries, which
 #
 #
 # use Automake 'trick' ==> convenience static libraries, which
@@ -27,7 +27,6 @@ libmodest_ui_la_SOURCES=              \
        modest-account-assistant.c    \
        modest-account-assistant.h    \
        modest-account-view-window.c  \
        modest-account-assistant.c    \
        modest-account-assistant.h    \
        modest-account-view-window.c  \
-       modest-account-view-window.h  \
        modest-msg-edit-window.c      \
        modest-icon-names.h           \
        modest-main-window.c          \
        modest-msg-edit-window.c      \
        modest-icon-names.h           \
        modest-main-window.c          \
index b1a476d..c61cb1d 100644 (file)
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+
+#include <widgets/modest-account-view-window.h>
+#include <widgets/modest-account-view.h>
+
 #include <modest-runtime.h>
 #include <modest-account-mgr-helpers.h>
 #include <modest-runtime.h>
 #include <modest-account-mgr-helpers.h>
-#include <widgets/modest-account-view.h>
 #include <string.h>
 #include <string.h>
-#include "modest-account-view-window.h"
 #include "modest-account-assistant.h"
 #include "modest-tny-platform-factory.h"
 
 #include "modest-account-assistant.h"
 #include "modest-tny-platform-factory.h"
 
diff --git a/src/gtk/modest-account-view-window.h b/src/gtk/modest-account-view-window.h
deleted file mode 100644 (file)
index 4f314e3..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* modest-account-view-window.h */
-/* insert (c)/licensing information) */
-
-#ifndef __MODEST_ACCOUNT_VIEW_WINDOW_H__
-#define __MODEST_ACCOUNT_VIEW_WINDOW_H__
-
-#include <gtk/gtkwidget.h>
-
-G_BEGIN_DECLS
-
-/* convenience macros */
-#define MODEST_TYPE_ACCOUNT_VIEW_WINDOW             (modest_account_view_window_get_type())
-#define MODEST_ACCOUNT_VIEW_WINDOW(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_ACCOUNT_VIEW_WINDOW,ModestAccountViewWindow))
-#define MODEST_ACCOUNT_VIEW_WINDOW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_ACCOUNT_VIEW_WINDOW,GtkWindow))
-#define MODEST_IS_ACCOUNT_VIEW_WINDOW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_ACCOUNT_VIEW_WINDOW))
-#define MODEST_IS_ACCOUNT_VIEW_WINDOW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_ACCOUNT_VIEW_WINDOW))
-#define MODEST_ACCOUNT_VIEW_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_ACCOUNT_VIEW_WINDOW,ModestAccountViewWindowClass))
-
-typedef struct _ModestAccountViewWindow      ModestAccountViewWindow;
-typedef struct _ModestAccountViewWindowClass ModestAccountViewWindowClass;
-
-struct _ModestAccountViewWindow {
-        GtkWindow parent;
-       /* insert public members, if any */
-};
-
-struct _ModestAccountViewWindowClass {
-       GtkWindowClass parent_class;
-       /* insert signal callback declarations, eg. */
-       /* void (* my_event) (ModestAccountViewWindow* obj); */
-};
-
-/* member functions */
-GType        modest_account_view_window_get_type    (void) G_GNUC_CONST;
-
-GtkWidget*   modest_account_view_window_new         (void);
-
-G_END_DECLS
-
-#endif /* __MODEST_ACCOUNT_VIEW_WINDOW_H__ */
-
index dda8fdc..01cabbb 100644 (file)
@@ -34,8 +34,7 @@
 #include <widgets/modest-main-window.h>
 #include <widgets/modest-window-priv.h>
 #include <widgets/modest-msg-edit-window.h>
 #include <widgets/modest-main-window.h>
 #include <widgets/modest-window-priv.h>
 #include <widgets/modest-msg-edit-window.h>
-#include "modest-account-view-window.h"
-
+#include <widgets/modest-account-view-window.h>
 
 #include "modest-widget-memory.h"
 #include "modest-ui-actions.h"
 
 #include "modest-widget-memory.h"
 #include "modest-ui-actions.h"
@@ -86,6 +85,14 @@ struct _ModestMainWindowPrivate {
        
        GtkWidget *online_toggle;
        GtkWidget *folder_info_label;
        
        GtkWidget *online_toggle;
        GtkWidget *folder_info_label;
+
+       ModestHeaderView *header_view;
+       ModestFolderView *folder_view;
+       ModestMsgView    *msg_preview;
+
+       GtkWidget        *status_bar;
+       GtkWidget        *progress_bar;
+
 };
 
 
 };
 
 
@@ -164,22 +171,22 @@ modest_main_window_init (ModestMainWindow *obj)
        tny_folder_store_query_add_item (query, NULL,
                                         TNY_FOLDER_STORE_QUERY_OPTION_SUBSCRIBED);
 
        tny_folder_store_query_add_item (query, NULL,
                                         TNY_FOLDER_STORE_QUERY_OPTION_SUBSCRIBED);
 
-       obj->folder_view =
+       priv->folder_view =
                MODEST_FOLDER_VIEW(modest_folder_view_new (modest_runtime_get_account_store(),
                                                           query));
                MODEST_FOLDER_VIEW(modest_folder_view_new (modest_runtime_get_account_store(),
                                                           query));
-       if (!obj->folder_view)
+       if (!priv->folder_view)
                g_printerr ("modest: cannot instantiate folder view\n");        
        g_object_unref (G_OBJECT (query));
 
        /* header view */
                g_printerr ("modest: cannot instantiate folder view\n");        
        g_object_unref (G_OBJECT (query));
 
        /* header view */
-       obj->header_view  =
+       priv->header_view  =
                MODEST_HEADER_VIEW(modest_header_view_new (NULL, MODEST_HEADER_VIEW_STYLE_DETAILS));
                MODEST_HEADER_VIEW(modest_header_view_new (NULL, MODEST_HEADER_VIEW_STYLE_DETAILS));
-       if (!obj->header_view)
+       if (!priv->header_view)
                g_printerr ("modest: cannot instantiate header view\n");
 
        /* msg preview */
                g_printerr ("modest: cannot instantiate header view\n");
 
        /* msg preview */
-       obj->msg_preview = MODEST_MSG_VIEW(modest_msg_view_new (NULL));
-       if (!obj->msg_preview)
+       priv->msg_preview = MODEST_MSG_VIEW(modest_msg_view_new (NULL));
+       if (!priv->msg_preview)
                g_printerr ("modest: cannot instantiate msgpreiew\n");
 
        /* online/offline combo */
                g_printerr ("modest: cannot instantiate msgpreiew\n");
 
        /* online/offline combo */
@@ -196,14 +203,14 @@ modest_main_window_init (ModestMainWindow *obj)
        priv->folder_info_label = gtk_label_new (NULL);
 
        /* status bar */
        priv->folder_info_label = gtk_label_new (NULL);
 
        /* status bar */
-       obj->status_bar   = gtk_statusbar_new ();
-        gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR(obj->status_bar),
+       priv->status_bar   = gtk_statusbar_new ();
+        gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR(priv->status_bar),
                                            FALSE);
 
        /* progress bar */
                                            FALSE);
 
        /* progress bar */
-       obj->progress_bar = gtk_progress_bar_new ();
-       gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(obj->progress_bar), 1.0);
-       gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR(obj->progress_bar),
+       priv->progress_bar = gtk_progress_bar_new ();
+       gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(priv->progress_bar), 1.0);
+       gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR(priv->progress_bar),
                                        PANGO_ELLIPSIZE_END);
 }
 
                                        PANGO_ELLIPSIZE_END);
 }
 
@@ -214,6 +221,39 @@ modest_main_window_finalize (GObject *obj)
 }
 
 
 }
 
 
+GtkWidget*
+modest_main_window_get_child_widget (ModestMainWindow *self,
+                                    ModestWidgetType widget_type)
+{
+       ModestMainWindowPrivate *priv;
+       GtkWidget *widget;
+       
+       g_return_val_if_fail (self, NULL);
+       g_return_val_if_fail (widget_type >= 0 && widget_type < MODEST_WIDGET_TYPE_NUM,
+                             NULL);
+                               
+       priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
+
+       switch (widget_type) {
+       case MODEST_WIDGET_TYPE_HEADER_VIEW:
+               widget = (GtkWidget*)priv->header_view; break;
+       case MODEST_WIDGET_TYPE_FOLDER_VIEW:
+               widget = (GtkWidget*)priv->folder_view; break;
+       case MODEST_WIDGET_TYPE_MSG_PREVIEW:
+               widget = (GtkWidget*)priv->msg_preview; break;
+       case MODEST_WIDGET_TYPE_STATUS_BAR:
+               widget = (GtkWidget*)priv->status_bar; break;
+       case MODEST_WIDGET_TYPE_PROGRESS_BAR:
+               widget = (GtkWidget*)priv->progress_bar; break;
+       default:
+               g_return_val_if_reached (NULL);
+               return NULL;
+       }
+
+       return widget ? GTK_WIDGET(widget) : NULL;
+}
+
+
 static void
 restore_sizes (ModestMainWindow *self)
 {
 static void
 restore_sizes (ModestMainWindow *self)
 {
@@ -232,7 +272,7 @@ restore_sizes (ModestMainWindow *self)
                                      "modest-msg-paned");
        modest_widget_memory_restore (conf, G_OBJECT(priv->main_paned),
                                      "modest-main-paned");
                                      "modest-msg-paned");
        modest_widget_memory_restore (conf, G_OBJECT(priv->main_paned),
                                      "modest-main-paned");
-       modest_widget_memory_restore (conf, G_OBJECT(self->header_view),"header-view");
+       modest_widget_memory_restore (conf, G_OBJECT(priv->header_view),"header-view");
        modest_widget_memory_restore (conf,G_OBJECT(self), "modest-main-window");
 }
 
        modest_widget_memory_restore (conf,G_OBJECT(self), "modest-main-window");
 }
 
@@ -256,7 +296,7 @@ save_sizes (ModestMainWindow *self)
                                   "modest-msg-paned");
        modest_widget_memory_save (conf, G_OBJECT(priv->main_paned),
                                   "modest-main-paned");
                                   "modest-msg-paned");
        modest_widget_memory_save (conf, G_OBJECT(priv->main_paned),
                                   "modest-main-paned");
-       modest_widget_memory_save (conf, G_OBJECT(self->header_view), "header-view");
+       modest_widget_memory_save (conf, G_OBJECT(priv->header_view), "header-view");
 }
 
 
 }
 
 
@@ -348,40 +388,42 @@ connect_signals (ModestMainWindow *self)
        device        = tny_account_store_get_device(TNY_ACCOUNT_STORE(account_store));
        
        /* folder view */
        device        = tny_account_store_get_device(TNY_ACCOUNT_STORE(account_store));
        
        /* folder view */
-       g_signal_connect (G_OBJECT(self->folder_view), "folder_selection_changed",
+       g_signal_connect (G_OBJECT(priv->folder_view), "folder_selection_changed",
                          G_CALLBACK(modest_ui_actions_on_folder_selection_changed), self);
                          G_CALLBACK(modest_ui_actions_on_folder_selection_changed), self);
-       g_signal_connect (G_OBJECT(self->folder_view), "folder_moved",
+       g_signal_connect (G_OBJECT(priv->folder_view), "folder_moved",
                          G_CALLBACK(modest_ui_actions_on_folder_moved), NULL);
                          G_CALLBACK(modest_ui_actions_on_folder_moved), NULL);
-       g_signal_connect (G_OBJECT(self->folder_view), "button-press-event",
+       g_signal_connect (G_OBJECT(priv->folder_view), "button-press-event",
                          G_CALLBACK (on_folder_view_button_press_event),self);
                          G_CALLBACK (on_folder_view_button_press_event),self);
-       g_signal_connect (self->folder_view,"popup-menu",
+       g_signal_connect (priv->folder_view,"popup-menu",
                          G_CALLBACK (on_folder_view_button_press_event),self);
 
        /* header view */
                          G_CALLBACK (on_folder_view_button_press_event),self);
 
        /* header view */
-       g_signal_connect (G_OBJECT(self->header_view), "status_update",
+       g_signal_connect (G_OBJECT(priv->header_view), "status_update",
                          G_CALLBACK(modest_ui_actions_on_header_status_update), self);
                          G_CALLBACK(modest_ui_actions_on_header_status_update), self);
-       g_signal_connect (G_OBJECT(self->header_view), "header_selected",
+       g_signal_connect (G_OBJECT(priv->header_view), "header_selected",
                          G_CALLBACK(modest_ui_actions_on_header_selected), self);
                          G_CALLBACK(modest_ui_actions_on_header_selected), self);
-       g_signal_connect (G_OBJECT(self->header_view), "header_activated",
+       g_signal_connect (G_OBJECT(priv->header_view), "header_activated",
                          G_CALLBACK(modest_ui_actions_on_header_activated), self);
                          G_CALLBACK(modest_ui_actions_on_header_activated), self);
-       g_signal_connect (G_OBJECT(self->header_view), "item_not_found",
+       g_signal_connect (G_OBJECT(priv->header_view), "item_not_found",
                          G_CALLBACK(modest_ui_actions_on_item_not_found), self);
                          G_CALLBACK(modest_ui_actions_on_item_not_found), self);
-       g_signal_connect (G_OBJECT(self->header_view), "button-press-event",
+       g_signal_connect (G_OBJECT(priv->header_view), "button-press-event",
                          G_CALLBACK (on_header_view_button_press_event), self);
                          G_CALLBACK (on_header_view_button_press_event), self);
-       g_signal_connect (G_OBJECT(self->header_view),"popup-menu",
+       g_signal_connect (G_OBJECT(priv->header_view),"popup-menu",
                          G_CALLBACK (on_header_view_button_press_event), self);
                
        /* msg preview */
                          G_CALLBACK (on_header_view_button_press_event), self);
                
        /* msg preview */
-       g_signal_connect (G_OBJECT(self->msg_preview), "link_clicked",
+       g_signal_connect (G_OBJECT(priv->msg_preview), "link_clicked",
                          G_CALLBACK(modest_ui_actions_on_msg_link_clicked), self);
                          G_CALLBACK(modest_ui_actions_on_msg_link_clicked), self);
-       g_signal_connect (G_OBJECT(self->msg_preview), "link_hover",
+       g_signal_connect (G_OBJECT(priv->msg_preview), "link_hover",
                          G_CALLBACK(modest_ui_actions_on_msg_link_hover), self);
                          G_CALLBACK(modest_ui_actions_on_msg_link_hover), self);
-       g_signal_connect (G_OBJECT(self->msg_preview), "attachment_clicked",
+       g_signal_connect (G_OBJECT(priv->msg_preview), "attachment_clicked",
                          G_CALLBACK(modest_ui_actions_on_msg_attachment_clicked), self);
 
        /* Account store */
        g_signal_connect (G_OBJECT (modest_runtime_get_account_store()), "accounts_reloaded",
                          G_CALLBACK (modest_ui_actions_on_accounts_reloaded), self);
                          G_CALLBACK(modest_ui_actions_on_msg_attachment_clicked), self);
 
        /* Account store */
        g_signal_connect (G_OBJECT (modest_runtime_get_account_store()), "accounts_reloaded",
                          G_CALLBACK (modest_ui_actions_on_accounts_reloaded), self);
+       g_signal_connect (G_OBJECT (modest_runtime_get_account_store()), "password_requested",
+                         G_CALLBACK (modest_ui_actions_on_password_requested), self);
        
        /* Device */
        g_signal_connect (G_OBJECT(device), "connection_changed",
        
        /* Device */
        g_signal_connect (G_OBJECT(device), "connection_changed",
@@ -469,8 +511,8 @@ modest_main_window_new (void)
        parent_priv->menubar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/MenuBar");
 
        gtk_toolbar_set_tooltips (GTK_TOOLBAR (parent_priv->toolbar), TRUE);    
        parent_priv->menubar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/MenuBar");
 
        gtk_toolbar_set_tooltips (GTK_TOOLBAR (parent_priv->toolbar), TRUE);    
-       folder_win = wrapped_in_scrolled_window (GTK_WIDGET(self->folder_view), FALSE);
-       header_win = wrapped_in_scrolled_window (GTK_WIDGET(self->header_view), FALSE);                    
+       folder_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->folder_view), FALSE);
+       header_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->header_view), FALSE);                    
 
        /* paned */
        priv->folder_paned = gtk_vpaned_new ();
 
        /* paned */
        priv->folder_paned = gtk_vpaned_new ();
@@ -479,15 +521,15 @@ modest_main_window_new (void)
        gtk_paned_add1 (GTK_PANED(priv->main_paned), folder_win);
        gtk_paned_add2 (GTK_PANED(priv->main_paned), priv->msg_paned);
        gtk_paned_add1 (GTK_PANED(priv->msg_paned), header_win);
        gtk_paned_add1 (GTK_PANED(priv->main_paned), folder_win);
        gtk_paned_add2 (GTK_PANED(priv->main_paned), priv->msg_paned);
        gtk_paned_add1 (GTK_PANED(priv->msg_paned), header_win);
-       gtk_paned_add2 (GTK_PANED(priv->msg_paned), GTK_WIDGET(self->msg_preview));
+       gtk_paned_add2 (GTK_PANED(priv->msg_paned), GTK_WIDGET(priv->msg_preview));
 
 
-       gtk_widget_show (GTK_WIDGET(self->header_view));
+       gtk_widget_show (GTK_WIDGET(priv->header_view));
 
        /* status bar / progress */
        status_hbox = gtk_hbox_new (FALSE, 0);
        gtk_box_pack_start (GTK_BOX(status_hbox), priv->folder_info_label, FALSE,FALSE, 6);
 
        /* status bar / progress */
        status_hbox = gtk_hbox_new (FALSE, 0);
        gtk_box_pack_start (GTK_BOX(status_hbox), priv->folder_info_label, FALSE,FALSE, 6);
-       gtk_box_pack_start (GTK_BOX(status_hbox), self->status_bar, TRUE, TRUE, 0);
-       gtk_box_pack_start (GTK_BOX(status_hbox), self->progress_bar,FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX(status_hbox), priv->status_bar, TRUE, TRUE, 0);
+       gtk_box_pack_start (GTK_BOX(status_hbox), priv->progress_bar,FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX(status_hbox), priv->online_toggle,FALSE, FALSE, 0);
 
        /* putting it all together... */
        gtk_box_pack_start (GTK_BOX(status_hbox), priv->online_toggle,FALSE, FALSE, 0);
 
        /* putting it all together... */
index df143c2..028f2da 100644 (file)
@@ -177,8 +177,7 @@ modest_msg_view_window_new (TnyMsg *msg, const gchar *account)
        GError *error = NULL;
 
        g_return_val_if_fail (msg, NULL);
        GError *error = NULL;
 
        g_return_val_if_fail (msg, NULL);
-       g_return_val_if_fail (msg, NULL);
-       
+
        obj = g_object_new(MODEST_TYPE_MSG_VIEW_WINDOW, NULL);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
        parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
        obj = g_object_new(MODEST_TYPE_MSG_VIEW_WINDOW, NULL);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
        parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
@@ -229,3 +228,15 @@ modest_msg_view_window_new (TnyMsg *msg, const gchar *account)
 
        return MODEST_WINDOW(obj);
 }
 
        return MODEST_WINDOW(obj);
 }
+
+
+TnyMsg*
+modest_msg_view_window_get_message (ModestMsgViewWindow *self)
+{
+       GtkWidget *msg_view;    
+       g_return_val_if_fail (self, NULL);
+
+       msg_view = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(self)->msg_view;
+
+       return modest_msg_view_get_message (MODEST_MSG_VIEW(msg_view));
+}
index 61898b7..e7d750c 100644 (file)
@@ -43,7 +43,6 @@ noinst_LTLIBRARIES=\
 
 libmodest_ui_la_SOURCES=              \
        modest-account-view-window.c  \
 
 libmodest_ui_la_SOURCES=              \
        modest-account-view-window.c  \
-       modest-account-view-window.h  \
        modest-icon-names.h           \
        modest-main-window.c          \
        modest-main-window-ui.h       \
        modest-icon-names.h           \
        modest-main-window.c          \
        modest-main-window-ui.h       \
index 95d7b2f..7374430 100644 (file)
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+
+#include <widgets/modest-account-view-window.h>
+#include <widgets/modest-account-view.h>
+
 #include <modest-runtime.h>
 #include <modest-account-mgr-helpers.h>
 #include <modest-runtime.h>
 #include <modest-account-mgr-helpers.h>
-#include <widgets/modest-account-view.h>
 #include <string.h>
 #include <string.h>
-#include "modest-account-view-window.h"
 #include "modest-account-assistant.h"
 #include "modest-tny-platform-factory.h"
 
 #include "modest-account-assistant.h"
 #include "modest-tny-platform-factory.h"
 
diff --git a/src/maemo/modest-account-view-window.h b/src/maemo/modest-account-view-window.h
deleted file mode 100644 (file)
index 332fad5..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* modest-account-view-window.h */
-/* insert (c)/licensing information) */
-
-#ifndef __MODEST_ACCOUNT_VIEW_WINDOW_H__
-#define __MODEST_ACCOUNT_VIEW_WINDOW_H__
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-/* convenience macros */
-#define MODEST_TYPE_ACCOUNT_VIEW_WINDOW             (modest_account_view_window_get_type())
-#define MODEST_ACCOUNT_VIEW_WINDOW(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_ACCOUNT_VIEW_WINDOW,ModestAccountViewWindow))
-#define MODEST_ACCOUNT_VIEW_WINDOW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_ACCOUNT_VIEW_WINDOW,GtkWindow))
-#define MODEST_IS_ACCOUNT_VIEW_WINDOW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_ACCOUNT_VIEW_WINDOW))
-#define MODEST_IS_ACCOUNT_VIEW_WINDOW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_ACCOUNT_VIEW_WINDOW))
-#define MODEST_ACCOUNT_VIEW_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_ACCOUNT_VIEW_WINDOW,ModestAccountViewWindowClass))
-
-typedef struct _ModestAccountViewWindow      ModestAccountViewWindow;
-typedef struct _ModestAccountViewWindowClass ModestAccountViewWindowClass;
-
-struct _ModestAccountViewWindow {
-        GtkWindow parent;
-       /* insert public members, if any */
-};
-
-struct _ModestAccountViewWindowClass {
-       GtkWindowClass parent_class;
-       /* insert signal callback declarations, eg. */
-       /* void (* my_event) (ModestAccountViewWindow* obj); */
-};
-
-/* member functions */
-GType        modest_account_view_window_get_type    (void) G_GNUC_CONST;
-
-GtkWidget*   modest_account_view_window_new         (void);
-
-G_END_DECLS
-
-#endif /* __MODEST_ACCOUNT_VIEW_WINDOW_H__ */
-
index 538db96..9fa6f09 100644 (file)
 
 #include <widgets/modest-main-window.h>
 #include <widgets/modest-msg-edit-window.h>
 
 #include <widgets/modest-main-window.h>
 #include <widgets/modest-msg-edit-window.h>
+#include <widgets/modest-account-view-window.h>
 
 #include "modest-widget-memory.h"
 #include "modest-window-priv.h"
 #include "modest-main-window-ui.h"
 
 #include "modest-widget-memory.h"
 #include "modest-window-priv.h"
 #include "modest-main-window-ui.h"
-#include "modest-account-view-window.h"
 #include "modest-account-mgr.h"
 #include "modest-conf.h"
 
 #include "modest-account-mgr.h"
 #include "modest-conf.h"
 
@@ -68,6 +68,10 @@ typedef struct _ModestMainWindowPrivate ModestMainWindowPrivate;
 struct _ModestMainWindowPrivate {
        GtkWidget *msg_paned;
        GtkWidget *main_paned;
 struct _ModestMainWindowPrivate {
        GtkWidget *msg_paned;
        GtkWidget *main_paned;
+
+       ModestHeaderView *header_view;
+       ModestFolderView *folder_view;
+
 };
 
 
 };
 
 
@@ -152,6 +156,33 @@ modest_main_window_finalize (GObject *obj)
 }
 
 
 }
 
 
+GtkWidget*
+modest_main_window_get_child_widget (ModestMainWindow *self,
+                                    ModestWidgetType widget_type)
+{
+       ModestMainWindowPrivate *priv;
+       GtkWidget *widget;
+       
+       g_return_val_if_fail (self, NULL);
+       g_return_val_if_fail (widget_type >= 0 && widget_type < MODEST_WIDGET_TYPE_NUM,
+                             NULL);
+       
+       priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
+
+       switch (widget_type) {
+       case MODEST_WIDGET_TYPE_HEADER_VIEW:
+               widget = (GtkWidget*)priv->header_view; break;
+       case MODEST_WIDGET_TYPE_FOLDER_VIEW:
+               widget = (GtkWidget*)priv->folder_view; break;
+       default:
+               g_return_val_if_reached (NULL);
+               return NULL;
+       }
+
+       return widget ? GTK_WIDGET(widget) : NULL;
+}
+
+
 
 static void
 restore_sizes (ModestMainWindow *self)
 
 static void
 restore_sizes (ModestMainWindow *self)
index 23a9151..46cd8dc 100644 (file)
@@ -254,3 +254,16 @@ modest_msg_view_window_new (TnyMsg *msg, const gchar *account_name)
        modest_window_set_active_account (MODEST_WINDOW(obj), account_name);
        return MODEST_WINDOW(obj);
 }
        modest_window_set_active_account (MODEST_WINDOW(obj), account_name);
        return MODEST_WINDOW(obj);
 }
+
+
+
+TnyMsg*
+modest_msg_view_window_get_message (ModestMsgViewWindow *self)
+{
+       ModestMsgView *msg_view;        
+       g_return_val_if_fail (self, NULL);
+
+       msg_view = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj)->msg_view;
+
+       return modest_msg_view_get_message (msg_view);
+}
index db8b916..faec84c 100644 (file)
@@ -218,8 +218,15 @@ modest_mail_operation_send_mail (ModestMailOperation *self,
        send_queue = TNY_SEND_QUEUE (modest_runtime_get_send_queue (transport_account));
        if (!TNY_IS_SEND_QUEUE(send_queue))
                g_printerr ("modest: could not find send queue for account\n");
        send_queue = TNY_SEND_QUEUE (modest_runtime_get_send_queue (transport_account));
        if (!TNY_IS_SEND_QUEUE(send_queue))
                g_printerr ("modest: could not find send queue for account\n");
-       else
-               tny_send_queue_add (send_queue, msg);
+       else {
+               GError *err = NULL;
+               tny_send_queue_add (send_queue, msg, &err);
+               if (err) {
+                       g_printerr ("modest: error adding msg to send queue: %s\n",
+                                   err->message);
+                       g_error_free (err);
+               }
+       }
 }
 
 void
 }
 
 void
index 65b694c..85f3d34 100644 (file)
@@ -1,8 +1,8 @@
 VOID:POINTER,POINTER
 VOID:POINTER,POINTER,POINTER
 VOID:POINTER,POINTER
 VOID:POINTER,POINTER,POINTER
+VOID:STRING,POINTER,POINTER,POINTER
 VOID:POINTER,BOOL
 VOID:STRING,INT
 VOID:STRING,INT,INT
 VOID:STRING,BOOL
 VOID:STRING,STRING,BOOL
 VOID:POINTER,BOOL
 VOID:STRING,INT
 VOID:STRING,INT,INT
 VOID:STRING,BOOL
 VOID:STRING,STRING,BOOL
-
index a5ae4a3..b971bf4 100644 (file)
@@ -65,6 +65,7 @@ static void    modest_tny_account_store_init          (gpointer g, gpointer ifac
 /* list my signals */
 enum {
        ACCOUNT_UPDATE_SIGNAL,
 /* list my signals */
 enum {
        ACCOUNT_UPDATE_SIGNAL,
+       PASSWORD_REQUESTED_SIGNAL,
        LAST_SIGNAL
 };
 
        LAST_SIGNAL
 };
 
@@ -85,12 +86,6 @@ struct _ModestTnyAccountStorePrivate {
                                                       MODEST_TYPE_TNY_ACCOUNT_STORE, \
                                                       ModestTnyAccountStorePrivate))
 
                                                       MODEST_TYPE_TNY_ACCOUNT_STORE, \
                                                       ModestTnyAccountStorePrivate))
 
-static void    on_password_requested        (ModestTnyAccountStore *account_store, 
-                                            const gchar* account_name,
-                                            gchar **password, 
-                                            gboolean *cancel, 
-                                            gboolean *remember);
-
 /* globals */
 static GObjectClass *parent_class = NULL;
 
 /* globals */
 static GObjectClass *parent_class = NULL;
 
@@ -142,14 +137,24 @@ modest_tny_account_store_class_init (ModestTnyAccountStoreClass *klass)
        g_type_class_add_private (gobject_class,
                                  sizeof(ModestTnyAccountStorePrivate));
 
        g_type_class_add_private (gobject_class,
                                  sizeof(ModestTnyAccountStorePrivate));
 
-       signals[ACCOUNT_UPDATE_SIGNAL] =
+        signals[ACCOUNT_UPDATE_SIGNAL] =
                g_signal_new ("account_update",
                              G_TYPE_FROM_CLASS (gobject_class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET(ModestTnyAccountStoreClass, account_update),
                              NULL, NULL,
                              g_cclosure_marshal_VOID__STRING,
                g_signal_new ("account_update",
                              G_TYPE_FROM_CLASS (gobject_class),
                              G_SIGNAL_RUN_FIRST,
                              G_STRUCT_OFFSET(ModestTnyAccountStoreClass, account_update),
                              NULL, NULL,
                              g_cclosure_marshal_VOID__STRING,
-                             G_TYPE_NONE, 1, G_TYPE_STRING);   
+                             G_TYPE_NONE, 1, G_TYPE_STRING);
+        
+        signals[PASSWORD_REQUESTED_SIGNAL] =
+                g_signal_new ("password_requested",
+                              G_TYPE_FROM_CLASS (gobject_class),
+                              G_SIGNAL_RUN_FIRST,
+                              G_STRUCT_OFFSET(ModestTnyAccountStoreClass, password_requested),
+                              NULL, NULL,
+                              modest_marshal_VOID__STRING_POINTER_POINTER_POINTER,
+                              G_TYPE_NONE, 4, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER,
+                              G_TYPE_POINTER);
 }
 
 
 }
 
 
@@ -230,60 +235,6 @@ get_account_store_for_account (TnyAccount *account)
                                                           "account_store"));
 }
 
                                                           "account_store"));
 }
 
-
-static void
-on_password_requested (ModestTnyAccountStore *account_store, 
-                      const gchar* account_name,
-                      gchar **password, 
-                      gboolean *cancel, 
-                      gboolean *remember)
-{
-       gchar *txt;
-       GtkWidget *dialog, *entry, *remember_pass_check;
-
-       dialog = gtk_dialog_new_with_buttons (_("Password requested"),
-                                             NULL,
-                                             GTK_DIALOG_MODAL,
-                                             GTK_STOCK_CANCEL,
-                                             GTK_RESPONSE_REJECT,
-                                             GTK_STOCK_OK,
-                                             GTK_RESPONSE_ACCEPT,
-                                             NULL);
-
-       txt = g_strdup_printf (_("Please enter your password for %s"), account_name);
-       gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), gtk_label_new(txt),
-                           FALSE, FALSE, 0);
-       g_free (txt);
-
-       entry = gtk_entry_new_with_max_length (40);
-       gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE);
-       gtk_entry_set_invisible_char (GTK_ENTRY(entry), 0x2022); /* bullet unichar */
-       
-       gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), entry,
-                           TRUE, FALSE, 0);    
-
-       remember_pass_check = gtk_check_button_new_with_label (_("Remember password"));
-       gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), remember_pass_check,
-                           TRUE, FALSE, 0);
-
-       gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
-       
-       if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
-               *password = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry)));
-               *cancel   = FALSE;
-       } else {
-               *password = NULL;
-               *cancel   = TRUE;
-       }
-
-       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (remember_pass_check)))
-               *remember = TRUE;
-       else
-               *remember = FALSE;
-
-       gtk_widget_destroy (dialog);
-}
-
 static gchar*
 get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
 {
 static gchar*
 get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
 {
@@ -300,6 +251,8 @@ get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
        
        self = MODEST_TNY_ACCOUNT_STORE (account_store);
         priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
        
        self = MODEST_TNY_ACCOUNT_STORE (account_store);
         priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
+
+       g_warning ("prompt: %s", prompt);
        
        /* is it in the hash? if it's already there, it must be wrong... */
        pwd_ptr = (gpointer)&pwd; /* pwd_ptr so the compiler does not complained about
        
        /* is it in the hash? if it's already there, it must be wrong... */
        pwd_ptr = (gpointer)&pwd; /* pwd_ptr so the compiler does not complained about
@@ -322,17 +275,17 @@ get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
 
                /* we don't have it yet. Get the password from the user */
                const gchar* name = tny_account_get_name (account);
 
                /* we don't have it yet. Get the password from the user */
                const gchar* name = tny_account_get_name (account);
-               gboolean remember;
+               gboolean remember = FALSE;
                pwd = NULL;
                pwd = NULL;
-
-               on_password_requested (self, name, &pwd, cancel, &remember);
-
+               
+               g_signal_emit (G_OBJECT(self), signals[PASSWORD_REQUESTED_SIGNAL], 0,
+                              name, &pwd, cancel, &remember);
+               
                if (!*cancel) {
                        if (remember)
                if (!*cancel) {
                        if (remember)
-                               modest_account_mgr_set_string (priv->account_mgr,
-                                                              key, MODEST_ACCOUNT_PASSWORD,
-                                                              pwd,
-                                                              TRUE, NULL);
+                               modest_account_mgr_set_string (priv->account_mgr,key,
+                                                              MODEST_ACCOUNT_PASSWORD,
+                                                              pwd, TRUE, NULL);
                        /* We need to dup the string even knowing that
                           it's already a dup of the contents of an
                           entry, because it if it's wrong, then camel
                        /* We need to dup the string even knowing that
                           it's already a dup of the contents of an
                           entry, because it if it's wrong, then camel
@@ -346,6 +299,8 @@ get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
        } else
                *cancel = FALSE;
 
        } else
                *cancel = FALSE;
 
+       //g_warning ("pwd: '%s', cancel:%s", pwd, *cancel?"yes":"no");
        return pwd;
 }
 
        return pwd;
 }
 
index e67ccf9..8667a79 100644 (file)
@@ -64,9 +64,17 @@ struct _ModestTnyAccountStore {
 struct _ModestTnyAccountStoreClass {
        GObjectClass parent_class;
 
 struct _ModestTnyAccountStoreClass {
        GObjectClass parent_class;
 
-       void (*account_update)    (ModestTnyAccountStore *self,
-                                  const gchar *account_name,
-                                  gpointer user_data);
+       void (*account_update)        (ModestTnyAccountStore *self,
+                                     const gchar *account_name,
+                                     gpointer user_data);
+       void (*password_requested)    (ModestTnyAccountStore *self,
+                                      const gchar *account_name,
+                                      gchar **password,
+                                      gboolean *remember,
+                                      gboolean *cancel,
+                                      gpointer user_data);
+
+       
 };
 
 /**
 };
 
 /**
index 46755d9..6025caf 100644 (file)
@@ -66,15 +66,15 @@ static TnyCamelSendQueueClass *parent_class = NULL;
 
 
 static void
 
 
 static void
-modest_tny_send_queue_cancel (TnySendQueue *self, gboolean remove)
+modest_tny_send_queue_cancel (TnySendQueue *self, gboolean remove, GError **err)
 {
        g_warning (__FUNCTION__);
 {
        g_warning (__FUNCTION__);
-
-       TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->cancel_func (self, remove);
+       
+       TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->cancel_func (self, remove, err); /* FIXME */
 }
 
 static void
 }
 
 static void
-modest_tny_send_queue_add (TnySendQueue *self, TnyMsg *msg)
+modest_tny_send_queue_add (TnySendQueue *self, TnyMsg *msg, GError **err)
 {
        ModestTnySendQueuePrivate *priv; 
        
 {
        ModestTnySendQueuePrivate *priv; 
        
@@ -87,7 +87,7 @@ modest_tny_send_queue_add (TnySendQueue *self, TnyMsg *msg)
 
        /* FIXME: do something smart here... */
        
 
        /* FIXME: do something smart here... */
        
-       TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->add_func (self, msg);
+       TNY_CAMEL_SEND_QUEUE_CLASS(parent_class)->add_func (self, msg, err); /* FIXME */
 }
 
 static TnyFolder*
 }
 
 static TnyFolder*
index 0a4d048..b646301 100644 (file)
@@ -40,8 +40,8 @@
 #include "modest-tny-platform-factory.h"
 
 #include <widgets/modest-main-window.h>
 #include "modest-tny-platform-factory.h"
 
 #include <widgets/modest-main-window.h>
-#include "modest-account-view-window.h"
 #include <widgets/modest-msg-view-window.h>
 #include <widgets/modest-msg-view-window.h>
+#include <widgets/modest-account-view-window.h>
 
 #include "modest-account-mgr-helpers.h"
 #include "modest-mail-operation.h"
 
 #include "modest-account-mgr-helpers.h"
 #include "modest-mail-operation.h"
@@ -76,10 +76,8 @@ static void     reply_forward_func     (gpointer data, gpointer user_data);
 static void     read_msg_func          (gpointer data, gpointer user_data);
 static void     get_msg_cb             (TnyFolder *folder, TnyMsg *msg,        GError **err, 
                                        gpointer user_data);
 static void     read_msg_func          (gpointer data, gpointer user_data);
 static void     get_msg_cb             (TnyFolder *folder, TnyMsg *msg,        GError **err, 
                                        gpointer user_data);
-
 static void     reply_forward          (GtkWidget *widget, ReplyForwardAction action,
 static void     reply_forward          (GtkWidget *widget, ReplyForwardAction action,
-                                       ModestMainWindow *main_window);
-
+                                       ModestWindow *win);
 static gchar*   ask_for_folder_name    (GtkWindow *parent_window, const gchar *title);
 
 
 static gchar*   ask_for_folder_name    (GtkWindow *parent_window, const gchar *title);
 
 
@@ -109,25 +107,47 @@ modest_ui_actions_on_about (GtkWidget *widget, ModestWindow *win)
        gtk_widget_destroy(about);
 }
 
        gtk_widget_destroy(about);
 }
 
+
+static TnyList *
+get_selected_headers (ModestWindow *win)
+{
+       if (MODEST_IS_MAIN_WINDOW(win)) {
+               GtkWidget *header_view;         
+
+               header_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW(win),
+                                                                  MODEST_WIDGET_TYPE_HEADER_VIEW);
+               return modest_header_view_get_selected_headers (MODEST_HEADER_VIEW(header_view));
+
+       } else if (MODEST_IS_MSG_VIEW_WINDOW (win)) {
+               /* for MsgViewWindows, we simply return a list with one element */
+               TnyMsg *msg;
+               TnyList *list;
+               
+               msg  = modest_msg_view_window_get_message (MODEST_MSG_VIEW_WINDOW(win));
+               list = tny_simple_list_new ();
+               tny_list_prepend (list, G_OBJECT(msg));
+
+               return list;
+       } else
+               return NULL;
+
+}
 void
 void
-modest_ui_actions_on_delete (GtkWidget *widget, ModestMainWindow *main_window)
+modest_ui_actions_on_delete (GtkWidget *widget, ModestWindow *win)
 {
        TnyList *header_list;
        TnyIterator *iter;
 {
        TnyList *header_list;
        TnyIterator *iter;
-       GtkTreeModel *model;
+//     GtkTreeModel *model;
 
 
-       g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
-       
-       if (!main_window->header_view)
-               return;
-       
-       header_list = modest_header_view_get_selected_headers (main_window->header_view);
+       g_return_if_fail (MODEST_IS_WINDOW(win));
+               
+       header_list = get_selected_headers (win);
        
        if (header_list) {
                iter = tny_list_create_iterator (header_list);
        
        if (header_list) {
                iter = tny_list_create_iterator (header_list);
-               model = gtk_tree_view_get_model (GTK_TREE_VIEW (main_window->header_view));
-               if (GTK_IS_TREE_MODEL_SORT (model))
-                       model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model));
+/*             model = gtk_tree_view_get_model (GTK_TREE_VIEW (header_view)); */
+/*             if (GTK_IS_TREE_MODEL_SORT (model)) */
+/*                     model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model)); */
                do {
                        TnyHeader *header;
                        ModestMailOperation *mail_op;
                do {
                        TnyHeader *header;
                        ModestMailOperation *mail_op;
@@ -143,10 +163,10 @@ modest_ui_actions_on_delete (GtkWidget *widget, ModestMainWindow *main_window)
                        modest_mail_operation_remove_msg (mail_op, header, TRUE);
 
                        /* Remove from tree model */
                        modest_mail_operation_remove_msg (mail_op, header, TRUE);
 
                        /* Remove from tree model */
-                       if (modest_mail_operation_get_status (mail_op) == 
-                           MODEST_MAIL_OPERATION_STATUS_SUCCESS)
-                               tny_list_remove (TNY_LIST (model), G_OBJECT (header));
-                       else {
+                       if (modest_mail_operation_get_status (mail_op) ==
+                           MODEST_MAIL_OPERATION_STATUS_SUCCESS) {
+/*                             tny_list_remove (TNY_LIST (model), G_OBJECT (header)); */
+                       } else {
                                /* TODO: error handling management */
                                const GError *error;
                                error = modest_mail_operation_get_error (mail_op);
                                /* TODO: error handling management */
                                const GError *error;
                                error = modest_mail_operation_get_error (mail_op);
@@ -281,8 +301,7 @@ reply_forward_func (gpointer data, gpointer user_data)
  * Common code for the reply and forward actions
  */
 static void
  * Common code for the reply and forward actions
  */
 static void
-reply_forward (GtkWidget *widget, ReplyForwardAction action,
-              ModestMainWindow *main_window)
+reply_forward (GtkWidget *widget, ReplyForwardAction action, ModestWindow *win)
 {
        TnyList *header_list;
        guint reply_forward_type;
 {
        TnyList *header_list;
        guint reply_forward_type;
@@ -291,21 +310,21 @@ reply_forward (GtkWidget *widget, ReplyForwardAction action,
        GetMsgAsyncHelper *helper;
        ReplyForwardHelper *rf_helper;
 
        GetMsgAsyncHelper *helper;
        ReplyForwardHelper *rf_helper;
 
-       if (!main_window->header_view)
-               return;
+       g_return_if_fail (MODEST_IS_WINDOW(win));
 
 
-       header_list = modest_header_view_get_selected_headers (main_window->header_view);       
+       header_list = get_selected_headers (win);       
        if (!header_list)
                return;
        
        reply_forward_type = modest_conf_get_int (modest_runtime_get_conf (),
                                                  (action == ACTION_FORWARD) ? MODEST_CONF_FORWARD_TYPE : MODEST_CONF_REPLY_TYPE,
                                                  NULL);
        if (!header_list)
                return;
        
        reply_forward_type = modest_conf_get_int (modest_runtime_get_conf (),
                                                  (action == ACTION_FORWARD) ? MODEST_CONF_FORWARD_TYPE : MODEST_CONF_REPLY_TYPE,
                                                  NULL);
+
        /* We assume that we can only select messages of the
           same folder and that we reply all of them from the
           same account. In fact the interface currently only
           allows single selection */
        /* We assume that we can only select messages of the
           same folder and that we reply all of them from the
           same account. In fact the interface currently only
           allows single selection */
-               
+       
        /* Fill helpers */
        rf_helper = g_slice_new0 (ReplyForwardHelper);
        rf_helper->reply_forward_type = reply_forward_type;
        /* Fill helpers */
        rf_helper = g_slice_new0 (ReplyForwardHelper);
        rf_helper->reply_forward_type = reply_forward_type;
@@ -313,7 +332,7 @@ reply_forward (GtkWidget *widget, ReplyForwardAction action,
        rf_helper->account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());;
 
        helper = g_slice_new0 (GetMsgAsyncHelper);
        rf_helper->account = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr());;
 
        helper = g_slice_new0 (GetMsgAsyncHelper);
-       helper->main_window = main_window;
+       //helper->main_window = NULL;
        helper->func = reply_forward_func;
        helper->iter = tny_list_create_iterator (header_list);
        helper->user_data = rf_helper;
        helper->func = reply_forward_func;
        helper->iter = tny_list_create_iterator (header_list);
        helper->user_data = rf_helper;
@@ -330,47 +349,57 @@ reply_forward (GtkWidget *widget, ReplyForwardAction action,
 }
 
 void
 }
 
 void
-modest_ui_actions_on_reply (GtkWidget *widget, ModestMainWindow *main_window)
+modest_ui_actions_on_reply (GtkWidget *widget, ModestWindow *win)
 {
 {
-       g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
+       g_return_if_fail (MODEST_IS_WINDOW(win));
 
 
-       reply_forward (widget, ACTION_REPLY, main_window);
+       reply_forward (widget, ACTION_REPLY, win);
 }
 
 void
 }
 
 void
-modest_ui_actions_on_forward (GtkWidget *widget, ModestMainWindow *main_window)
+modest_ui_actions_on_forward (GtkWidget *widget, ModestWindow *win)
 {
 {
-       g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
+       g_return_if_fail (MODEST_IS_WINDOW(win));
 
 
-       reply_forward (widget, ACTION_FORWARD, main_window);
+       reply_forward (widget, ACTION_FORWARD, win);
 }
 
 void
 }
 
 void
-modest_ui_actions_on_reply_all (GtkWidget *widget,ModestMainWindow *main_window)
+modest_ui_actions_on_reply_all (GtkWidget *widget,ModestWindow *win)
 {
 {
-       g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
+       g_return_if_fail (MODEST_IS_WINDOW(win));
 
 
-       reply_forward (widget, ACTION_REPLY_TO_ALL, main_window);
+       reply_forward (widget, ACTION_REPLY_TO_ALL, win);
 }
 
 void 
 modest_ui_actions_on_next (GtkWidget *widget, 
                           ModestMainWindow *main_window)
 {
 }
 
 void 
 modest_ui_actions_on_next (GtkWidget *widget, 
                           ModestMainWindow *main_window)
 {
+       GtkWidget *header_view;
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 
-       if (main_window->header_view)
-               modest_header_view_select_next (main_window->header_view); 
+       header_view = modest_main_window_get_child_widget (main_window,
+                                                          MODEST_WIDGET_TYPE_HEADER_VIEW);
+       if (!header_view)
+               return;
+       
+       modest_header_view_select_next (MODEST_HEADER_VIEW(header_view)); 
 }
 
 void 
 modest_ui_actions_on_prev (GtkWidget *widget, 
                           ModestMainWindow *main_window)
 {
 }
 
 void 
 modest_ui_actions_on_prev (GtkWidget *widget, 
                           ModestMainWindow *main_window)
 {
+       GtkWidget *header_view;
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 
-       if (main_window->header_view)
-               modest_header_view_select_prev (main_window->header_view); 
+       header_view = modest_main_window_get_child_widget (main_window,
+                                                          MODEST_WIDGET_TYPE_HEADER_VIEW);
+       if (!header_view)
+               return;
+       
+       modest_header_view_select_prev (MODEST_HEADER_VIEW(header_view)); 
 }
 
 
 }
 
 
@@ -396,25 +425,30 @@ void
 modest_ui_actions_toggle_view (GtkWidget *widget, ModestMainWindow *main_window)
 {
        ModestConf *conf;
 modest_ui_actions_toggle_view (GtkWidget *widget, ModestMainWindow *main_window)
 {
        ModestConf *conf;
+       GtkWidget *header_view;
        
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
        
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
-       
-       if (!main_window->header_view)
+
+       header_view = modest_main_window_get_child_widget (main_window,
+                                                          MODEST_WIDGET_TYPE_HEADER_VIEW);
+       if (!header_view)
                return;
                return;
+
        conf = modest_runtime_get_conf ();
        
        /* what is saved/restored is depending on the style; thus; we save with
         * old style, then update the style, and restore for this new style*/
        conf = modest_runtime_get_conf ();
        
        /* what is saved/restored is depending on the style; thus; we save with
         * old style, then update the style, and restore for this new style*/
-       modest_widget_memory_save (conf, G_OBJECT(main_window->header_view), "header-view");
+       modest_widget_memory_save (conf, G_OBJECT(header_view), "header-view");
        
        
-       if (modest_header_view_get_style (main_window->header_view) == MODEST_HEADER_VIEW_STYLE_DETAILS)
-               modest_header_view_set_style (main_window->header_view,
+       if (modest_header_view_get_style
+           (MODEST_HEADER_VIEW(header_view)) == MODEST_HEADER_VIEW_STYLE_DETAILS)
+               modest_header_view_set_style (MODEST_HEADER_VIEW(header_view),
                                              MODEST_HEADER_VIEW_STYLE_TWOLINES);
        else
                                              MODEST_HEADER_VIEW_STYLE_TWOLINES);
        else
-               modest_header_view_set_style (main_window->header_view,
+               modest_header_view_set_style (MODEST_HEADER_VIEW(header_view),
                                              MODEST_HEADER_VIEW_STYLE_DETAILS);
 
                                              MODEST_HEADER_VIEW_STYLE_DETAILS);
 
-       modest_widget_memory_restore (conf, G_OBJECT(main_window->header_view),
+       modest_widget_memory_restore (conf, G_OBJECT(header_view),
                                      "header-view");
 }
 
                                      "header-view");
 }
 
@@ -430,11 +464,14 @@ read_msg_func (gpointer data, gpointer user_data)
        TnyHeader *header;
        GetMsgAsyncHelper *helper;
        TnyHeaderFlags header_flags;
        TnyHeader *header;
        GetMsgAsyncHelper *helper;
        TnyHeaderFlags header_flags;
-
+       GtkWidget *msg_preview;
+       
        msg = TNY_MSG (data);
        helper = (GetMsgAsyncHelper *) user_data;
 
        msg = TNY_MSG (data);
        helper = (GetMsgAsyncHelper *) user_data;
 
-       if (!helper->main_window->msg_preview)
+       msg_preview = modest_main_window_get_child_widget (helper->main_window,
+                                                          MODEST_WIDGET_TYPE_MSG_PREVIEW);
+       if (!msg_preview)
                return;
        
        /* mark message as seen; _set_flags crashes, bug in tinymail? */
                return;
        
        /* mark message as seen; _set_flags crashes, bug in tinymail? */
@@ -444,8 +481,7 @@ read_msg_func (gpointer data, gpointer user_data)
        g_object_unref (G_OBJECT (header));
 
        /* Set message on msg view */
        g_object_unref (G_OBJECT (header));
 
        /* Set message on msg view */
-       modest_msg_view_set_message (helper->main_window->msg_preview,
-                                    msg);
+       modest_msg_view_set_message (MODEST_MSG_VIEW(msg_preview), msg);
 }
 
 /*
 }
 
 /*
@@ -465,10 +501,11 @@ get_msg_cb (TnyFolder *folder, TnyMsg *msg, GError **err, gpointer user_data)
        helper = (GetMsgAsyncHelper *) user_data;
 
        if ((*err && ((*err)->code == TNY_FOLDER_ERROR_GET_MSG)) || !msg) {
        helper = (GetMsgAsyncHelper *) user_data;
 
        if ((*err && ((*err)->code == TNY_FOLDER_ERROR_GET_MSG)) || !msg) {
-               ModestHeaderView *header_view =
-                       helper->main_window->header_view;
+               GtkWidget *header_view =
+                       modest_main_window_get_child_widget(helper->main_window,
+                                                           MODEST_WIDGET_TYPE_HEADER_VIEW);
                if (header_view)
                if (header_view)
-                       modest_ui_actions_on_item_not_found (header_view,
+                       modest_ui_actions_on_item_not_found (MODEST_HEADER_VIEW(header_view),
                                                             MODEST_ITEM_TYPE_MESSAGE,
                                                             MODEST_WINDOW(helper->main_window));
                return;
                                                             MODEST_ITEM_TYPE_MESSAGE,
                                                             MODEST_WINDOW(helper->main_window));
                return;
@@ -496,21 +533,24 @@ get_msg_cb (TnyFolder *folder, TnyMsg *msg, GError **err, gpointer user_data)
 }
 
 void 
 }
 
 void 
-modest_ui_actions_on_header_selected (ModestHeaderView *folder_view,     TnyHeader *header,
+modest_ui_actions_on_header_selected (ModestHeaderView *folder_view, TnyHeader *header,
                                      ModestMainWindow *main_window)
 {
                                      ModestMainWindow *main_window)
 {
+       GtkWidget *msg_preview;
        TnyFolder *folder;
        GetMsgAsyncHelper *helper;
        TnyList *list;
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
        TnyFolder *folder;
        GetMsgAsyncHelper *helper;
        TnyList *list;
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
-
-       if (!main_window->msg_preview)
+       
+       msg_preview = modest_main_window_get_child_widget(main_window,
+                                                         MODEST_WIDGET_TYPE_MSG_PREVIEW);
+       if (!msg_preview)
                return;
        
        /* when there's no header, clear the msgview */
        if (!header) {
                return;
        
        /* when there's no header, clear the msgview */
        if (!header) {
-               modest_msg_view_set_message (main_window->msg_preview, NULL);
+               modest_msg_view_set_message (MODEST_MSG_VIEW(msg_preview), NULL);
                return;
        }
 
                return;
        }
 
@@ -538,7 +578,7 @@ modest_ui_actions_on_header_selected (ModestHeaderView *folder_view,     TnyHead
 
 void 
 modest_ui_actions_on_header_activated (ModestHeaderView *folder_view, TnyHeader *header,
 
 void 
 modest_ui_actions_on_header_activated (ModestHeaderView *folder_view, TnyHeader *header,
-                                       ModestMainWindow *main_window)
+                                      ModestMainWindow *main_window)
 {
        ModestWindow *win;
        TnyFolder *folder = NULL;
 {
        ModestWindow *win;
        TnyFolder *folder = NULL;
@@ -595,7 +635,8 @@ modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
 //     GtkLabel *folder_info_label;
        gchar *txt;     
        ModestConf *conf;
 //     GtkLabel *folder_info_label;
        gchar *txt;     
        ModestConf *conf;
-
+       GtkWidget *header_view;
+       
 /*     folder_info_label =  */
 /*             GTK_LABEL (modest_widget_factory_get_folder_info_label */
 /*                        (modest_runtime_get_widget_factory())); */
 /*     folder_info_label =  */
 /*             GTK_LABEL (modest_widget_factory_get_folder_info_label */
 /*                        (modest_runtime_get_widget_factory())); */
@@ -606,17 +647,18 @@ modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
 /*     } */
        
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 /*     } */
        
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
-       
-       if (!main_window->header_view)
-               return;
 
 
+       header_view = modest_main_window_get_child_widget(main_window,
+                                                         MODEST_WIDGET_TYPE_HEADER_VIEW);
+       if (!header_view)
+               return;
+       
        conf = modest_runtime_get_conf ();
 
        if (!selected) { /* the folder was unselected; save it's settings  */
        conf = modest_runtime_get_conf ();
 
        if (!selected) { /* the folder was unselected; save it's settings  */
-               modest_widget_memory_save (conf, G_OBJECT (main_window->header_view),
-                                          "header-view");
+               modest_widget_memory_save (conf, G_OBJECT (header_view), "header-view");
                gtk_window_set_title (GTK_WINDOW(main_window), "Modest");
                gtk_window_set_title (GTK_WINDOW(main_window), "Modest");
-               modest_header_view_set_folder (main_window->header_view, NULL);
+               modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view), NULL);
        } else {  /* the folder was selected */
                if (folder) { /* folder may be NULL */
                        guint num, unread;
        } else {  /* the folder was selected */
                if (folder) { /* folder may be NULL */
                        guint num, unread;
@@ -636,8 +678,8 @@ modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
                        //gtk_label_set_label (GTK_LABEL(folder_info_label), txt);
                        g_free (txt);
                }
                        //gtk_label_set_label (GTK_LABEL(folder_info_label), txt);
                        g_free (txt);
                }
-               modest_header_view_set_folder (main_window->header_view, folder);
-               modest_widget_memory_restore (conf, G_OBJECT(main_window->header_view),
+               modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view), folder);
+               modest_widget_memory_restore (conf, G_OBJECT(header_view),
                                              "header-view");
        }
 }
                                              "header-view");
        }
 }
@@ -672,16 +714,21 @@ statusbar_push (ModestMainWindow *main_window, guint context_id, const gchar *ms
        if (!msg)
                return;
 
        if (!msg)
                return;
 
-       if (main_window->progress_bar) {
-               gtk_widget_show (main_window->progress_bar);
-               g_timeout_add (3000, (GSourceFunc)progress_bar_clean,
-                              main_window->progress_bar);
+       GtkWidget *progress_bar, *status_bar;
+
+       progress_bar = modest_main_window_get_child_widget (main_window,
+                                                           MODEST_WIDGET_TYPE_PROGRESS_BAR);
+       status_bar = modest_main_window_get_child_widget (main_window,
+                                                         MODEST_WIDGET_TYPE_STATUS_BAR);
+       if (progress_bar) {
+               gtk_widget_show (progress_bar);
+               g_timeout_add (3000, (GSourceFunc)progress_bar_clean, progress_bar);
        }
        
        }
        
-       if (main_window->status_bar) {
-               gtk_widget_show (main_window->status_bar);
-               gtk_statusbar_push (GTK_STATUSBAR(main_window->status_bar), 0, msg);
-               g_timeout_add (1500, (GSourceFunc)statusbar_clean, main_window->status_bar);
+       if (status_bar) {
+               gtk_widget_show (status_bar);
+               gtk_statusbar_push (GTK_STATUSBAR(status_bar), 0, msg);
+               g_timeout_add (1500, (GSourceFunc)statusbar_clean, status_bar);
        }
 
 }
        }
 
 }
@@ -718,7 +765,6 @@ modest_ui_actions_on_item_not_found (ModestHeaderView *header_view,ModestItemTyp
                                                 item);
                gtk_dialog_run (GTK_DIALOG(dialog));
        } else {
                                                 item);
                gtk_dialog_run (GTK_DIALOG(dialog));
        } else {
-
                dialog = gtk_dialog_new_with_buttons (_("Connection requested"),
                                                      GTK_WINDOW (win),
                                                      GTK_DIALOG_MODAL,
                dialog = gtk_dialog_new_with_buttons (_("Connection requested"),
                                                      GTK_WINDOW (win),
                                                      GTK_DIALOG_MODAL,
@@ -727,7 +773,6 @@ modest_ui_actions_on_item_not_found (ModestHeaderView *header_view,ModestItemTyp
                                                      GTK_STOCK_OK,
                                                      GTK_RESPONSE_ACCEPT,
                                                      NULL);
                                                      GTK_STOCK_OK,
                                                      GTK_RESPONSE_ACCEPT,
                                                      NULL);
-
                txt = g_strdup_printf (_("This %s is not available in offline mode.\n"
                                         "Do you want to get online?"), item);
                gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), 
                txt = g_strdup_printf (_("This %s is not available in offline mode.\n"
                                         "Do you want to get online?"), item);
                gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), 
@@ -753,20 +798,23 @@ modest_ui_actions_on_header_status_update (ModestHeaderView *header_view,
                                            gint total,  ModestMainWindow *main_window)
 {
        char* txt;
                                            gint total,  ModestMainWindow *main_window)
 {
        char* txt;
+       GtkWidget *progress_bar;
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
-       
-       if (!main_window->progress_bar)
-               return;
 
 
+       progress_bar = modest_main_window_get_child_widget (main_window, 
+                                                           MODEST_WIDGET_TYPE_PROGRESS_BAR);   
+       if (!progress_bar)
+               return;
+       
        if (total != 0)
        if (total != 0)
-               gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(main_window->progress_bar),
+               gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR(progress_bar),
                                               (gdouble)num/(gdouble)total);
        else
                                               (gdouble)num/(gdouble)total);
        else
-               gtk_progress_bar_pulse (GTK_PROGRESS_BAR(main_window->progress_bar));
+               gtk_progress_bar_pulse (GTK_PROGRESS_BAR(progress_bar));
 
        txt = g_strdup_printf (_("Downloading %d of %d"), num, total);
 
        txt = g_strdup_printf (_("Downloading %d of %d"), num, total);
-       gtk_progress_bar_set_text (GTK_PROGRESS_BAR(main_window->progress_bar), txt);
+       gtk_progress_bar_set_text (GTK_PROGRESS_BAR(progress_bar), txt);
        g_free (txt);
        
        statusbar_push (main_window, 0, msg);
        g_free (txt);
        
        statusbar_push (main_window, 0, msg);
@@ -896,18 +944,21 @@ ask_for_folder_name (GtkWindow *parent_window,
 
        return folder_name;
 }
 
        return folder_name;
 }
-       
+
 void 
 modest_ui_actions_on_new_folder (GtkWidget *widget, ModestMainWindow *main_window)
 {
        TnyFolder *parent_folder;
 void 
 modest_ui_actions_on_new_folder (GtkWidget *widget, ModestMainWindow *main_window)
 {
        TnyFolder *parent_folder;
-
-       g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
+       GtkWidget *folder_view;
        
        
-       if (!main_window->folder_view)
+       g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
+
+       folder_view = modest_main_window_get_child_widget (main_window,
+                                                          MODEST_WIDGET_TYPE_FOLDER_VIEW);
+       if (!folder_view)
                return;
 
                return;
 
-       parent_folder = modest_folder_view_get_selected (main_window->folder_view);
+       parent_folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW(folder_view));
        
        if (parent_folder) {
                gchar *folder_name;
        
        if (parent_folder) {
                gchar *folder_name;
@@ -926,7 +977,8 @@ modest_ui_actions_on_new_folder (GtkWidget *widget, ModestMainWindow *main_windo
                        if (new_folder) {
                                /* TODO: tinymail should do this. 
                                   Update view */
                        if (new_folder) {
                                /* TODO: tinymail should do this. 
                                   Update view */
-                               modest_folder_view_add_subfolder (main_window->folder_view, new_folder);
+                               modest_folder_view_add_subfolder (MODEST_FOLDER_VIEW(folder_view),
+                                                                 new_folder);
 
                                /* Free new folder */
                                g_object_unref (new_folder);
 
                                /* Free new folder */
                                g_object_unref (new_folder);
@@ -942,17 +994,19 @@ modest_ui_actions_on_rename_folder (GtkWidget *widget,
                                     ModestMainWindow *main_window)
 {
        TnyFolder *folder;
                                     ModestMainWindow *main_window)
 {
        TnyFolder *folder;
-
+       GtkWidget *folder_view;
+       
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 
-       if (!main_window->folder_view)
+       folder_view = modest_main_window_get_child_widget (main_window,
+                                                          MODEST_WIDGET_TYPE_FOLDER_VIEW);
+       if (!folder_view)
                return;
        
                return;
        
-       folder = modest_folder_view_get_selected (main_window->folder_view);
-
+       folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW(folder_view));
+       
        if (folder) {
                gchar *folder_name;
        if (folder) {
                gchar *folder_name;
-
                folder_name = ask_for_folder_name (GTK_WINDOW (main_window),
                                                   _("Please enter a new name for the folder"));
 
                folder_name = ask_for_folder_name (GTK_WINDOW (main_window),
                                                   _("Please enter a new name for the folder"));
 
@@ -969,7 +1023,7 @@ modest_ui_actions_on_rename_folder (GtkWidget *widget,
                        if (!error)
                                /* TODO: tinymail should do this. 
                                   Update view */
                        if (!error)
                                /* TODO: tinymail should do this. 
                                   Update view */
-                               modest_folder_view_rename (main_window->folder_view);
+                               modest_folder_view_rename (MODEST_FOLDER_VIEW(folder_view));
 
                        /* TODO: else ? notify error ? */
 
 
                        /* TODO: else ? notify error ? */
 
@@ -984,12 +1038,17 @@ delete_folder (ModestMainWindow *main_window, gboolean move_to_trash)
 {
        TnyFolder *folder;
        ModestMailOperation *mail_op;
 {
        TnyFolder *folder;
        ModestMailOperation *mail_op;
+       GtkWidget *folder_view;
        
        
-       if (!main_window->folder_view)
-               return;
+       g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
 
 
-       folder = modest_folder_view_get_selected (main_window->folder_view);
+       folder_view = modest_main_window_get_child_widget (main_window,
+                                                          MODEST_WIDGET_TYPE_FOLDER_VIEW);
+       if (!folder_view)
+               return;
 
 
+       folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW(folder_view));
+       
        mail_op = modest_mail_operation_new ();
        modest_mail_operation_remove_folder (mail_op, folder, move_to_trash);
        g_object_unref (mail_op);
        mail_op = modest_mail_operation_new ();
        modest_mail_operation_remove_folder (mail_op, folder, move_to_trash);
        g_object_unref (mail_op);
@@ -1042,3 +1101,60 @@ modest_ui_actions_on_folder_moved (ModestFolderView *folder_view,  TnyFolder *fo
 
        g_object_unref (G_OBJECT (mail_op));
 }
 
        g_object_unref (G_OBJECT (mail_op));
 }
+
+
+
+void
+modest_ui_actions_on_password_requested (TnyAccountStore *account_store, 
+                                        const gchar* account_name,
+                                        gchar **password, 
+                                        gboolean *cancel, 
+                                        gboolean *remember,
+                                        ModestMainWindow *main_window)
+{
+       gchar *txt;
+       GtkWidget *dialog, *entry, *remember_pass_check;
+
+       dialog = gtk_dialog_new_with_buttons (_("Password requested"),
+                                             NULL,
+                                             GTK_DIALOG_MODAL,
+                                             GTK_STOCK_CANCEL,
+                                             GTK_RESPONSE_REJECT,
+                                             GTK_STOCK_OK,
+                                             GTK_RESPONSE_ACCEPT,
+                                             NULL);
+       gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(main_window));
+       
+       txt = g_strdup_printf (_("Please enter your password for %s"), account_name);
+       gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), gtk_label_new(txt),
+                           FALSE, FALSE, 0);
+       g_free (txt);
+
+       entry = gtk_entry_new_with_max_length (40);
+       gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE);
+       gtk_entry_set_invisible_char (GTK_ENTRY(entry), 0x2022); /* bullet unichar */
+       
+       gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), entry,
+                           TRUE, FALSE, 0);    
+
+       remember_pass_check = gtk_check_button_new_with_label (_("Remember password"));
+       gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), remember_pass_check,
+                           TRUE, FALSE, 0);
+
+       gtk_widget_show_all (GTK_WIDGET(GTK_DIALOG(dialog)->vbox));
+       
+       if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
+               *password = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry)));
+               *cancel   = FALSE;
+       } else {
+               *password = NULL;
+               *cancel   = TRUE;
+       }
+
+       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (remember_pass_check)))
+               *remember = TRUE;
+       else
+               *remember = FALSE;
+
+       gtk_widget_destroy (dialog);
+}
index be7fd3e..0a0bc7d 100644 (file)
@@ -38,7 +38,7 @@ G_BEGIN_DECLS
 /* Menu & toolbar actions */
 void     modest_ui_actions_on_about         (GtkWidget *widget, ModestWindow *win);
 
 /* Menu & toolbar actions */
 void     modest_ui_actions_on_about         (GtkWidget *widget, ModestWindow *win);
 
-void     modest_ui_actions_on_delete        (GtkWidget *widget, ModestMainWindow *main_window);
+void     modest_ui_actions_on_delete        (GtkWidget *widget, ModestWindow *win);
 
 void     modest_ui_actions_on_quit          (GtkWidget *widget, ModestWindow *win);
 
 
 void     modest_ui_actions_on_quit          (GtkWidget *widget, ModestWindow *win);
 
@@ -48,11 +48,11 @@ void     modest_ui_actions_on_new_msg       (GtkWidget *widget, ModestWindow *wi
 
 void     modest_ui_actions_on_open           (GtkWidget *widget, ModestWindow *win);
 
 
 void     modest_ui_actions_on_open           (GtkWidget *widget, ModestWindow *win);
 
-void     modest_ui_actions_on_reply         (GtkWidget *widget, ModestMainWindow *main_window);
+void     modest_ui_actions_on_reply         (GtkWidget *widget, ModestWindow *win);
 
 
-void     modest_ui_actions_on_forward       (GtkWidget *widget, ModestMainWindow *main_window);
+void     modest_ui_actions_on_forward       (GtkWidget *widget, ModestWindow *win);
 
 
-void     modest_ui_actions_on_reply_all     (GtkWidget *widget, ModestMainWindow *main_window);
+void     modest_ui_actions_on_reply_all     (GtkWidget *widget, ModestWindow *win);
 
 void     modest_ui_actions_on_next          (GtkWidget *widget, ModestMainWindow *main_window);
 
 
 void     modest_ui_actions_on_next          (GtkWidget *widget, ModestMainWindow *main_window);
 
@@ -124,5 +124,11 @@ void     modest_ui_actions_on_folder_moved          (ModestFolderView *folder_vi
                                                     TnyFolderStore   *parent,
                                                     gboolean         *done,
                                                     gpointer          user_data);
                                                     TnyFolderStore   *parent,
                                                     gboolean         *done,
                                                     gpointer          user_data);
+
+void     modest_ui_actions_on_password_requested (TnyAccountStore *account_store,
+                                                 const gchar* account_name,
+                                                 gchar **password,  gboolean *cancel, 
+                                                 gboolean *remember, ModestMainWindow *main_window);
+
 G_END_DECLS
 #endif /* __MODEST_UI_ACTIONS_H__ */
 G_END_DECLS
 #endif /* __MODEST_UI_ACTIONS_H__ */
index ed170b5..3f5dd4a 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Makefile.am
 #
 # Makefile.am
-# Time-stamp: <2007-02-06 17:27:49 (djcb)>
+# Time-stamp: <2007-02-10 14:48:38 (djcb)>
 
 INCLUDES=\
        $(MODEST_GSTUFF_CFLAGS) \
 
 INCLUDES=\
        $(MODEST_GSTUFF_CFLAGS) \
@@ -16,26 +16,27 @@ INCLUDES=\
 noinst_LTLIBRARIES=\
        libmodest-widgets.la
 
 noinst_LTLIBRARIES=\
        libmodest-widgets.la
 
-libmodest_widgets_la_SOURCES=       \
-       modest-account-view.c       \
-       modest-account-view.h       \
-       modest-combo-box.c          \
-       modest-combo-box.h          \
-       modest-msg-edit-window.h    \
-       modest-msg-edit-window-ui.h \
-       modest-msg-view-window.h    \
-       modest-folder-view.c        \
-       modest-folder-view.h        \
-       modest-header-view.c        \
-       modest-header-view.h        \
-       modest-header-view-priv.h   \
-       modest-header-view-render.c \
-       modest-main-window.h        \
-       modest-msg-view.c           \
-       modest-msg-view.h           \
-       modest-tny-stream-gtkhtml.c \
-       modest-tny-stream-gtkhtml.h \
-       modest-window.c             \
+libmodest_widgets_la_SOURCES=          \
+       modest-account-view-window.h   \
+       modest-account-view.c          \
+       modest-account-view.h          \
+       modest-combo-box.c             \
+       modest-combo-box.h             \
+       modest-folder-view.c           \
+       modest-folder-view.h           \
+       modest-header-view-priv.h      \
+       modest-header-view-render.c    \
+       modest-header-view.c           \
+       modest-header-view.h           \
+       modest-main-window.h           \
+       modest-msg-edit-window-ui.h    \
+       modest-msg-edit-window.h       \
+       modest-msg-view-window.h       \
+       modest-msg-view.c              \
+       modest-msg-view.h              \
+       modest-tny-stream-gtkhtml.c    \
+       modest-tny-stream-gtkhtml.h    \
+       modest-window.c                \
        modest-window.h             
 
 LDADD = \
        modest-window.h             
 
 LDADD = \
diff --git a/src/widgets/modest-account-view-window.h b/src/widgets/modest-account-view-window.h
new file mode 100644 (file)
index 0000000..4f314e3
--- /dev/null
@@ -0,0 +1,41 @@
+/* modest-account-view-window.h */
+/* insert (c)/licensing information) */
+
+#ifndef __MODEST_ACCOUNT_VIEW_WINDOW_H__
+#define __MODEST_ACCOUNT_VIEW_WINDOW_H__
+
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+/* convenience macros */
+#define MODEST_TYPE_ACCOUNT_VIEW_WINDOW             (modest_account_view_window_get_type())
+#define MODEST_ACCOUNT_VIEW_WINDOW(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),MODEST_TYPE_ACCOUNT_VIEW_WINDOW,ModestAccountViewWindow))
+#define MODEST_ACCOUNT_VIEW_WINDOW_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),MODEST_TYPE_ACCOUNT_VIEW_WINDOW,GtkWindow))
+#define MODEST_IS_ACCOUNT_VIEW_WINDOW(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),MODEST_TYPE_ACCOUNT_VIEW_WINDOW))
+#define MODEST_IS_ACCOUNT_VIEW_WINDOW_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),MODEST_TYPE_ACCOUNT_VIEW_WINDOW))
+#define MODEST_ACCOUNT_VIEW_WINDOW_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),MODEST_TYPE_ACCOUNT_VIEW_WINDOW,ModestAccountViewWindowClass))
+
+typedef struct _ModestAccountViewWindow      ModestAccountViewWindow;
+typedef struct _ModestAccountViewWindowClass ModestAccountViewWindowClass;
+
+struct _ModestAccountViewWindow {
+        GtkWindow parent;
+       /* insert public members, if any */
+};
+
+struct _ModestAccountViewWindowClass {
+       GtkWindowClass parent_class;
+       /* insert signal callback declarations, eg. */
+       /* void (* my_event) (ModestAccountViewWindow* obj); */
+};
+
+/* member functions */
+GType        modest_account_view_window_get_type    (void) G_GNUC_CONST;
+
+GtkWidget*   modest_account_view_window_new         (void);
+
+G_END_DECLS
+
+#endif /* __MODEST_ACCOUNT_VIEW_WINDOW_H__ */
+
index 1329957..9f21ca5 100644 (file)
@@ -34,6 +34,7 @@
 #include <tny-gtk-folder-store-tree-model.h>
 #include <tny-gtk-header-list-model.h>
 #include <tny-folder.h>
 #include <tny-gtk-folder-store-tree-model.h>
 #include <tny-gtk-header-list-model.h>
 #include <tny-folder.h>
+#include <tny-folder-monitor.h>
 #include <tny-account-store.h>
 #include <tny-account.h>
 #include <tny-folder.h>
 #include <tny-account-store.h>
 #include <tny-account.h>
 #include <tny-folder.h>
@@ -65,14 +66,14 @@ static gint         cmp_rows               (GtkTreeModel *tree_model,
                                            gpointer user_data);
 
 /* DnD functions */
                                            gpointer user_data);
 
 /* DnD functions */
-static void         drag_data_get_cb       (GtkWidget *widget, 
+static void         on_drag_data_get       (GtkWidget *widget, 
                                            GdkDragContext *context, 
                                            GtkSelectionData *selection_data, 
                                            guint info, 
                                            guint time, 
                                            gpointer data);
 
                                            GdkDragContext *context, 
                                            GtkSelectionData *selection_data, 
                                            guint info, 
                                            guint time, 
                                            gpointer data);
 
-static void         drag_data_received_cb  (GtkWidget *widget, 
+static void         on_drag_data_received  (GtkWidget *widget, 
                                            GdkDragContext *context, 
                                            gint x, 
                                            gint y, 
                                            GdkDragContext *context, 
                                            gint x, 
                                            gint y, 
@@ -81,7 +82,7 @@ static void         drag_data_received_cb  (GtkWidget *widget,
                                            guint time, 
                                            gpointer data);
 
                                            guint time, 
                                            gpointer data);
 
-static gboolean     drag_motion_cb         (GtkWidget      *widget,
+static gboolean     on_drag_motion         (GtkWidget      *widget,
                                            GdkDragContext *context,
                                            gint            x,
                                            gint            y,
                                            GdkDragContext *context,
                                            gint            x,
                                            gint            y,
@@ -113,13 +114,16 @@ struct _ModestFolderViewPrivate {
 
        gulong               sig1, sig2;
        GMutex              *lock;
 
        gulong               sig1, sig2;
        GMutex              *lock;
+       
        GtkTreeSelection    *cur_selection;
        TnyFolderStoreQuery *query;
        guint                timer_expander;
        GtkTreeSelection    *cur_selection;
        TnyFolderStoreQuery *query;
        guint                timer_expander;
+
+       TnyFolderMonitor    *monitor;
 };
 };
-#define MODEST_FOLDER_VIEW_GET_PRIVATE(o)                              \
-       (G_TYPE_INSTANCE_GET_PRIVATE((o),                               \
-                                    MODEST_TYPE_FOLDER_VIEW,           \
+#define MODEST_FOLDER_VIEW_GET_PRIVATE(o)                      \
+       (G_TYPE_INSTANCE_GET_PRIVATE((o),                       \
+                                    MODEST_TYPE_FOLDER_VIEW,   \
                                     ModestFolderViewPrivate))
 /* globals */
 static GObjectClass *parent_class = NULL;
                                     ModestFolderViewPrivate))
 /* globals */
 static GObjectClass *parent_class = NULL;
@@ -355,8 +359,10 @@ modest_folder_view_init (ModestFolderView *obj)
        priv->cur_folder     = NULL;
        priv->cur_row        = NULL;
        priv->query          = NULL;
        priv->cur_folder     = NULL;
        priv->cur_row        = NULL;
        priv->query          = NULL;
+       priv->monitor        = NULL;
+
        priv->lock           = g_mutex_new ();
        priv->lock           = g_mutex_new ();
-       
+
        column = gtk_tree_view_column_new ();   
        gtk_tree_view_append_column (GTK_TREE_VIEW(obj),column);
        
        column = gtk_tree_view_column_new ();   
        gtk_tree_view_append_column (GTK_TREE_VIEW(obj),column);
        
@@ -489,6 +495,16 @@ update_model_empty (ModestFolderView *self)
        g_return_val_if_fail (self, FALSE);
        priv = MODEST_FOLDER_VIEW_GET_PRIVATE(self);
 
        g_return_val_if_fail (self, FALSE);
        priv = MODEST_FOLDER_VIEW_GET_PRIVATE(self);
 
+       g_mutex_lock (priv->lock);
+       {
+               if (priv->monitor) {
+                       tny_folder_monitor_stop (priv->monitor);
+                       g_object_unref(G_OBJECT(priv->monitor));
+                       priv->monitor = NULL;
+               }
+       }
+       g_mutex_unlock (priv->lock);
+       
        g_signal_emit (G_OBJECT(self), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
                       NULL, TRUE);
        return TRUE;
        g_signal_emit (G_OBJECT(self), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
                       NULL, TRUE);
        return TRUE;
@@ -570,7 +586,7 @@ on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
        if (!gtk_tree_selection_get_selected (sel, &model_sort, &iter_sort)) {
                priv->cur_folder = NULL; /* FIXME: need this? */
                priv->cur_row = NULL; /* FIXME: need this? */
        if (!gtk_tree_selection_get_selected (sel, &model_sort, &iter_sort)) {
                priv->cur_folder = NULL; /* FIXME: need this? */
                priv->cur_row = NULL; /* FIXME: need this? */
-               return; 
+               return; 
        }
 
        model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model_sort));
        }
 
        model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (model_sort));
@@ -592,14 +608,14 @@ on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
         * and one for the selection of the new on */
        g_signal_emit (G_OBJECT(tree_view), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
                       priv->cur_folder, FALSE);
         * and one for the selection of the new on */
        g_signal_emit (G_OBJECT(tree_view), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
                       priv->cur_folder, FALSE);
-       g_signal_emit (G_OBJECT(tree_view), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
-                      folder, TRUE);
        if (priv->cur_folder) {
                tny_folder_sync (priv->cur_folder, TRUE, NULL); /* FIXME */
                gtk_tree_row_reference_free (priv->cur_row);
        }
        if (priv->cur_folder) {
                tny_folder_sync (priv->cur_folder, TRUE, NULL); /* FIXME */
                gtk_tree_row_reference_free (priv->cur_row);
        }
-
        priv->cur_folder = folder;
        priv->cur_folder = folder;
+       g_signal_emit (G_OBJECT(tree_view), signals[FOLDER_SELECTION_CHANGED_SIGNAL], 0,
+                      folder, TRUE);
        path = gtk_tree_model_get_path (model_sort, &iter_sort);
        priv->cur_row = gtk_tree_row_reference_new (model_sort, path);
        gtk_tree_path_free (path);
        path = gtk_tree_model_get_path (model_sort, &iter_sort);
        priv->cur_row = gtk_tree_row_reference_new (model_sort, path);
        gtk_tree_path_free (path);
@@ -763,7 +779,7 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
 /*                        DRAG and DROP stuff                                */
 /*****************************************************************************/
 static void
 /*                        DRAG and DROP stuff                                */
 /*****************************************************************************/
 static void
-drag_data_get_cb (GtkWidget *widget, 
+on_drag_data_get (GtkWidget *widget, 
                  GdkDragContext *context, 
                  GtkSelectionData *selection_data, 
                  guint info, 
                  GdkDragContext *context, 
                  GtkSelectionData *selection_data, 
                  guint info, 
@@ -793,7 +809,7 @@ drag_data_get_cb (GtkWidget *widget,
 }
 
 static void 
 }
 
 static void 
-drag_data_received_cb (GtkWidget *widget, 
+on_drag_data_received (GtkWidget *widget, 
                       GdkDragContext *context, 
                       gint x, 
                       gint y, 
                       GdkDragContext *context, 
                       gint x, 
                       gint y, 
@@ -896,7 +912,7 @@ drag_data_received_cb (GtkWidget *widget,
 
        gtk_tree_row_reference_free (source_row_reference);
        gtk_tree_path_free (child_dest_row);
 
        gtk_tree_row_reference_free (source_row_reference);
        gtk_tree_path_free (child_dest_row);
- out:
+out:
        /* Never delete the source, we do it manually */
        gtk_drag_finish (context, success, FALSE, time);
 
        /* Never delete the source, we do it manually */
        gtk_drag_finish (context, success, FALSE, time);
 
@@ -905,38 +921,38 @@ drag_data_received_cb (GtkWidget *widget,
 static gint
 expand_row_timeout (gpointer data)
 {
 static gint
 expand_row_timeout (gpointer data)
 {
-  GtkTreeView *tree_view = data;
-  GtkTreePath *dest_path = NULL;
-  GtkTreeViewDropPosition pos;
-  gboolean result = FALSE;
-
-  GDK_THREADS_ENTER ();
-
-  gtk_tree_view_get_drag_dest_row (tree_view,
-                                   &dest_path,
-                                   &pos);
-
-  if (dest_path &&
-      (pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER ||
-       pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)) {
-         gtk_tree_view_expand_row (tree_view, dest_path, FALSE);
-         gtk_tree_path_free (dest_path);
-  }
-  else {
-         if (dest_path)
-                 gtk_tree_path_free (dest_path);
-         
-         result = TRUE;
-  }
-  
-  GDK_THREADS_LEAVE ();
-
-  return result;
+       GtkTreeView *tree_view = data;
+       GtkTreePath *dest_path = NULL;
+       GtkTreeViewDropPosition pos;
+       gboolean result = FALSE;
+       
+       GDK_THREADS_ENTER ();
+       
+       gtk_tree_view_get_drag_dest_row (tree_view,
+                                        &dest_path,
+                                        &pos);
+       
+       if (dest_path &&
+           (pos == GTK_TREE_VIEW_DROP_INTO_OR_AFTER ||
+            pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)) {
+               gtk_tree_view_expand_row (tree_view, dest_path, FALSE);
+               gtk_tree_path_free (dest_path);
+       }
+       else {
+               if (dest_path)
+                       gtk_tree_path_free (dest_path);
+               
+               result = TRUE;
+       }
+       
+       GDK_THREADS_LEAVE ();
+
+       return result;
 }
 
 
 static gboolean
 }
 
 
 static gboolean
-drag_motion_cb (GtkWidget      *widget,
+on_drag_motion (GtkWidget      *widget,
                GdkDragContext *context,
                gint            x,
                gint            y,
                GdkDragContext *context,
                gint            x,
                gint            y,
@@ -983,7 +999,7 @@ setup_drag_and_drop (GtkTreeView *self)
 
        gtk_signal_connect(GTK_OBJECT (self),
                           "drag_data_received",
 
        gtk_signal_connect(GTK_OBJECT (self),
                           "drag_data_received",
-                          GTK_SIGNAL_FUNC(drag_data_received_cb),
+                          GTK_SIGNAL_FUNC(on_drag_data_received),
                           NULL);
 
 
                           NULL);
 
 
@@ -996,12 +1012,12 @@ setup_drag_and_drop (GtkTreeView *self)
 
        gtk_signal_connect(GTK_OBJECT (self),
                           "drag_motion",
 
        gtk_signal_connect(GTK_OBJECT (self),
                           "drag_motion",
-                          GTK_SIGNAL_FUNC(drag_motion_cb),
+                          GTK_SIGNAL_FUNC(on_drag_motion),
                           NULL);
 
 
        gtk_signal_connect(GTK_OBJECT (self),
                           "drag_data_get",
                           NULL);
 
 
        gtk_signal_connect(GTK_OBJECT (self),
                           "drag_data_get",
-                          GTK_SIGNAL_FUNC(drag_data_get_cb),
+                          GTK_SIGNAL_FUNC(on_drag_data_get),
                           NULL);
 }
                           NULL);
 }
index fd4bf07..dac1e73 100644 (file)
@@ -356,15 +356,12 @@ modest_header_view_finalize (GObject *obj)
 {
        ModestHeaderView        *self;
        ModestHeaderViewPrivate *priv;
 {
        ModestHeaderView        *self;
        ModestHeaderViewPrivate *priv;
-       GtkTreeSelection        *sel;
        
        self = MODEST_HEADER_VIEW(obj);
        priv = MODEST_HEADER_VIEW_GET_PRIVATE(self);
 
        if (priv->headers)      
                g_object_unref (G_OBJECT(priv->headers));
        
        self = MODEST_HEADER_VIEW(obj);
        priv = MODEST_HEADER_VIEW_GET_PRIVATE(self);
 
        if (priv->headers)      
                g_object_unref (G_OBJECT(priv->headers));
-
-       sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
        
        if (priv->lock) {
                g_mutex_free (priv->lock);
        
        if (priv->lock) {
                g_mutex_free (priv->lock);
@@ -440,14 +437,10 @@ modest_header_view_get_selected_headers (ModestHeaderView *self)
                tmp = list;
                while (tmp) {                   
                        /* get header from selection */
                tmp = list;
                while (tmp) {                   
                        /* get header from selection */
-                       gtk_tree_model_get_iter (tree_model,
-                                                &iter,
-                                                (GtkTreePath *) (tmp->data));
-                                                                         
+                       gtk_tree_model_get_iter (tree_model, &iter, (GtkTreePath *) (tmp->data));
                        gtk_tree_model_get (tree_model, &iter,
                                            TNY_GTK_HEADER_LIST_MODEL_INSTANCE_COLUMN,
                                            &header, -1);
                        gtk_tree_model_get (tree_model, &iter,
                                            TNY_GTK_HEADER_LIST_MODEL_INSTANCE_COLUMN,
                                            &header, -1);
-
                        /* Prepend to list */
                        tny_list_prepend (header_list, G_OBJECT (header));
                        tmp = g_list_next (tmp);
                        /* Prepend to list */
                        tny_list_prepend (header_list, G_OBJECT (header));
                        tmp = g_list_next (tmp);
index fe0c2d6..02df4db 100644 (file)
@@ -54,17 +54,6 @@ typedef struct _ModestMainWindowClass ModestMainWindowClass;
 
 struct _ModestMainWindow {
        ModestWindow parent;
 
 struct _ModestMainWindow {
        ModestWindow parent;
-
-       /* public members;
-        * NOTE: these can be NULL as not all frontends
-        * (gtk, maemo, ...) may use all of them.
-        */
-       ModestHeaderView *header_view;
-       ModestFolderView *folder_view;
-       ModestMsgView    *msg_preview;
-
-       GtkWidget        *status_bar;
-       GtkWidget        *progress_bar;
 };
 
 struct _ModestMainWindowClass {
 };
 
 struct _ModestMainWindowClass {
@@ -90,6 +79,30 @@ GType modest_main_window_get_type (void) G_GNUC_CONST;
  */
 ModestWindow* modest_main_window_new (void);
 
  */
 ModestWindow* modest_main_window_new (void);
 
+/*
+ * we could use the GType instead, but that would require
+ * that there only on widget of a certain type; that is
+ * true now, but might not be. Therefore, these types
+ */
+typedef enum {
+       MODEST_WIDGET_TYPE_HEADER_VIEW,
+       MODEST_WIDGET_TYPE_FOLDER_VIEW,
+       MODEST_WIDGET_TYPE_MSG_PREVIEW,
+       MODEST_WIDGET_TYPE_STATUS_BAR,
+       MODEST_WIDGET_TYPE_PROGRESS_BAR,
+       
+       MODEST_WIDGET_TYPE_NUM,
+} ModestWidgetType;
+
+/**
+ * modest_main_window_get_child_widget
+ * 
+ * get a child window for this window
+ *
+ * Returns: a child window or NULL
+ */
+GtkWidget* modest_main_window_get_child_widget (ModestMainWindow *self,
+                                               ModestWidgetType widget_type);
 
 G_END_DECLS
 
 
 G_END_DECLS
 
index 249cb31..e607e0b 100644 (file)
@@ -76,6 +76,17 @@ GType        modest_msg_view_window_get_type    (void) G_GNUC_CONST;
  */
 ModestWindow*   modest_msg_view_window_new         (TnyMsg *msg, const gchar *account);
 
  */
 ModestWindow*   modest_msg_view_window_new         (TnyMsg *msg, const gchar *account);
 
+
+/**
+ * modest_msg_view_window_get_message:
+ * @msg: an #ModestMsgViewWindow instance
+ * 
+ * get the message in this msg view
+ * 
+ * Returns: a new #TnyMsg instance, or NULL in case of error
+ */
+TnyMsg*         modest_msg_view_window_get_message (ModestMsgViewWindow *window);
+
 G_END_DECLS
 
 #endif /* __MODEST_MSG_VIEW_WINDOW_H__ */
 G_END_DECLS
 
 #endif /* __MODEST_MSG_VIEW_WINDOW_H__ */
index bc42516..c172db5 100644 (file)
@@ -66,7 +66,6 @@ enum {
 
 typedef struct _ModestMsgViewPrivate ModestMsgViewPrivate;
 struct _ModestMsgViewPrivate {
 
 typedef struct _ModestMsgViewPrivate ModestMsgViewPrivate;
 struct _ModestMsgViewPrivate {
-
        GtkWidget   *gtkhtml;
        TnyMsg      *msg;
 
        GtkWidget   *gtkhtml;
        TnyMsg      *msg;
 
@@ -204,7 +203,6 @@ modest_msg_view_new (TnyMsg *msg)
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(self),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(self),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_AUTOMATIC);
-
        if (priv->gtkhtml) 
                gtk_container_add (GTK_CONTAINER(obj), priv->gtkhtml);
        
        if (priv->gtkhtml) 
                gtk_container_add (GTK_CONTAINER(obj), priv->gtkhtml);
        
@@ -399,14 +397,17 @@ get_header_info (TnyMsg *msg, gboolean outgoing)
 
        if (outgoing) {
                if (tny_header_get_to(header))
 
        if (outgoing) {
                if (tny_header_get_to(header))
-                       g_string_append_printf (str, "<tr><td><b>%s</b>:</td><td>%s</td></tr>\n", _("To"), tny_header_get_to(header));
+                       g_string_append_printf (str, "<tr><td><b>%s</b>:</td><td>%s</td></tr>\n", _("To"),
+                                               tny_header_get_to(header));
        } else {
                if (tny_header_get_from (header))
        } else {
                if (tny_header_get_from (header))
-                       g_string_append_printf (str, "<tr><td><b>%s</b>:</td><td>%s</td></tr>\n", _("From"), tny_header_get_from(header));
+                       g_string_append_printf (str, "<tr><td><b>%s</b>:</td><td>%s</td></tr>\n", _("From"),
+                                               tny_header_get_from(header));
        }
        
        if (tny_header_get_subject (header))
        }
        
        if (tny_header_get_subject (header))
-               g_string_append_printf (str, "<tr><td><b>%s</b>:</td><td>%s</td></tr>\n", _("Subject"), tny_header_get_subject(header));
+               g_string_append_printf (str, "<tr><td><b>%s</b>:</td><td>%s</td></tr>\n", _("Subject"),
+                                       tny_header_get_subject(header));
 
 
        if (outgoing) {
 
 
        if (outgoing) {
@@ -415,10 +416,10 @@ get_header_info (TnyMsg *msg, gboolean outgoing)
                g_free (sent);
        } else {
                gchar *received = modest_text_utils_get_display_date (tny_header_get_date_received (header));
                g_free (sent);
        } else {
                gchar *received = modest_text_utils_get_display_date (tny_header_get_date_received (header));
-               g_string_append_printf (str, "<tr><td><b>%s</b>:</td><td>%s</td></tr>\n", _("Received"), received);
+               g_string_append_printf (str, "<tr><td><b>%s</b>:</td><td>%s</td></tr>\n", _("Received"),
+                                       received);
                g_free (received);
        }
                g_free (received);
        }
-
        g_string_append (str, "</table>\n<hr>\n");
        
        g_object_unref (G_OBJECT(header));
        g_string_append (str, "</table>\n<hr>\n");
        
        g_object_unref (G_OBJECT(header));
@@ -580,3 +581,12 @@ modest_msg_view_set_message (ModestMsgView *self, TnyMsg *msg)
 
        g_free (header_info);
 }
 
        g_free (header_info);
 }
+
+
+TnyMsg*
+modest_msg_view_get_message (ModestMsgView *self)
+{
+       g_return_val_if_fail (self, NULL);
+       
+       return MODEST_MSG_VIEW_GET_PRIVATE(self)->msg;
+}
index 73a9232..78360d6 100644 (file)
@@ -98,6 +98,20 @@ GtkWidget*   modest_msg_view_new          (TnyMsg *tny_msg);
  *  */
 void         modest_msg_view_set_message  (ModestMsgView *self, TnyMsg *tny_msg);
 
  *  */
 void         modest_msg_view_set_message  (ModestMsgView *self, TnyMsg *tny_msg);
 
+
+
+/**
+ * modest_msg_view_set_message
+ * @self: a ModestMsgView instance
+ *
+ * get the @tny_msg e-mail message.
+ *
+ * Returns: the message or NULL
+ */
+TnyMsg*      modest_msg_view_get_message  (ModestMsgView *self);
+
+
+
 G_END_DECLS
 
 #endif /* __MODEST_MSG_VIEW_H__ */
 G_END_DECLS
 
 #endif /* __MODEST_MSG_VIEW_H__ */