* Added simple view mode for main window
authorSergio Villar Senin <svillar@igalia.com>
Thu, 12 Apr 2007 12:59:24 +0000 (12:59 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 12 Apr 2007 12:59:24 +0000 (12:59 +0000)
* Fixed an issue with an include file

pmo-trunk-r1550

src/gnome/modest-main-window.c
src/maemo/modest-main-window-ui.h
src/maemo/modest-main-window.c
src/maemo/modest-msg-edit-window.c
src/modest-ui-actions.c
src/modest-ui-actions.h
src/widgets/modest-main-window.h
src/widgets/modest-msg-edit-window-ui.h

index 9248664..3be825c 100644 (file)
@@ -690,3 +690,17 @@ modest_main_window_close_all (ModestMainWindow *self)
           all */
        return TRUE;
 }
+
+void 
+modest_main_window_set_style (ModestMainWindow *self, 
+                             ModestMainWindowStyle style)
+{
+       /* TODO */
+}
+
+ModestMainWindowStyle
+modest_main_window_get_style (ModestMainWindow *self)
+{
+       /* TODO */
+       return MODEST_MAIN_WINDOW_STYLE_SPLITTED;
+}
index 9547872..4d2af3f 100644 (file)
@@ -84,8 +84,6 @@ static const GtkActionEntry modest_action_entries [] = {
        
        /* View */
        { "ViewSort",            NULL,        N_("mcen_me_inbox_sort"),     NULL,      NULL,  NULL },
-/*     { "ViewFolders",         NULL,        N_("mcen_me_inbox_hidefolders"),     NULL,     NULL,  NULL }, */
-/*     { "ViewFullscreen",      NULL,        N_("mcen_me_inbox_fullscreen"),  NULL,     NULL,  G_CALLBACK (modest_ui_actions_on_toggle_fullscreen) }, */
        { "ViewShowToolbar", NULL, N_("mcen_me_inbox_toolbar") }, /* submenu */
        { "ViewShowToolbarNormalScreen",         NULL,        N_("mcen_me_inbox_normalview"),     NULL,     NULL,  NULL },
        { "ViewShowToolbarFullScreen",      NULL,        N_("mcen_me_inbox_optimizedview"),  NULL,     NULL,  NULL },
@@ -118,7 +116,7 @@ static const GtkActionEntry modest_action_entries [] = {
        { "ToolbarMessageReplyAll",   MODEST_STOCK_REPLY_ALL,     N_("qgn_toolb_messagin_replyall"),         NULL, NULL,  G_CALLBACK (modest_ui_actions_on_reply_all) },
        { "ToolbarMessageForward",    MODEST_STOCK_FORWARD,     N_("qgn_toolb_messagin_forward"),      NULL, NULL,  G_CALLBACK (modest_ui_actions_on_forward) },
        { "ToolbarSendReceive",       MODEST_STOCK_REFRESH,   N_("qgn_toolb_gene_refresh"),      NULL, NULL,  G_CALLBACK (modest_ui_actions_on_send_receive) },
-       { "ToolbarToggleView",        MODEST_STOCK_SPLIT_VIEW,      N_("gqn_toolb_rss_fldonoff"),                "<CTRL>t", NULL,  G_CALLBACK (modest_ui_actions_toggle_view) },
+       { "ToolbarToggleView",        MODEST_STOCK_SPLIT_VIEW,      N_("gqn_toolb_rss_fldonoff"),                "<CTRL>t", NULL,  G_CALLBACK (modest_ui_actions_toggle_main_view) },
        { "ToolbarDeleteMessage",     MODEST_STOCK_DELETE,     N_("qgn_toolb_gene_deletebutton"),             NULL, NULL,  G_CALLBACK (modest_ui_actions_on_delete) },
        { "ToolbarSort",     MODEST_STOCK_SORT,     N_("qgn_list_sort"),             NULL, NULL, NULL },
        { "ToolbarFindInMessage",     GTK_STOCK_FIND,       N_("qgn_toolb_gene_find"),         NULL, NULL, NULL },
index 4bb0fb7..b854c80 100644 (file)
@@ -75,11 +75,13 @@ typedef struct _ModestMainWindowPrivate ModestMainWindowPrivate;
 struct _ModestMainWindowPrivate {
        GtkWidget *msg_paned;
        GtkWidget *main_paned;
+       GtkWidget *main_vbox;
        GtkWidget *progress_bar;
 
        ModestHeaderView *header_view;
        ModestFolderView *folder_view;
 
+       ModestMainWindowStyle style;
 };
 #define MODEST_MAIN_WINDOW_GET_PRIVATE(o)      (G_TYPE_INSTANCE_GET_PRIVATE((o), \
                                                 MODEST_TYPE_MAIN_WINDOW, \
@@ -177,8 +179,10 @@ modest_main_window_init (ModestMainWindow *obj)
 
        priv->msg_paned    = NULL;
        priv->main_paned   = NULL;      
+       priv->main_vbox    = NULL;
        priv->header_view  = NULL;
        priv->folder_view  = NULL;
+       priv->style  = MODEST_MAIN_WINDOW_STYLE_SPLITTED;
 
        /* progress bar */
        priv->progress_bar = gtk_progress_bar_new ();
@@ -370,7 +374,6 @@ modest_main_window_new (void)
        ModestMainWindow *self; 
        ModestMainWindowPrivate *priv;
        ModestWindowPrivate *parent_priv;
-       GtkWidget *main_vbox;
        GtkWidget *header_win, *folder_win;
        GtkActionGroup *action_group;
        GError *error = NULL;
@@ -438,7 +441,8 @@ modest_main_window_new (void)
        modest_header_view_set_style (priv->header_view, MODEST_HEADER_VIEW_STYLE_TWOLINES);
        
        folder_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->folder_view), FALSE);
-       header_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->header_view), FALSE);                    
+       header_win = wrapped_in_scrolled_window (GTK_WIDGET(priv->header_view), FALSE);
+
        /* paned */
        priv->main_paned = gtk_hpaned_new ();
        gtk_paned_add1 (GTK_PANED(priv->main_paned), folder_win);
@@ -447,15 +451,15 @@ modest_main_window_new (void)
        gtk_tree_view_columns_autosize (GTK_TREE_VIEW(priv->header_view));
 
        /* putting it all together... */
-       main_vbox = gtk_vbox_new (FALSE, 6);
-       gtk_box_pack_start (GTK_BOX(main_vbox), priv->main_paned, TRUE, TRUE,0);
+       priv->main_vbox = gtk_vbox_new (FALSE, 6);
+       gtk_box_pack_start (GTK_BOX(priv->main_vbox), priv->main_paned, TRUE, TRUE,0);
 
-       gtk_container_add (GTK_CONTAINER(self), main_vbox);
+       gtk_container_add (GTK_CONTAINER(self), priv->main_vbox);
        restore_sizes (MODEST_MAIN_WINDOW(self));
        
        gtk_window_set_title (GTK_WINDOW(self), _("Modest"));
        gtk_window_set_icon_from_file (GTK_WINDOW(self), MODEST_APP_ICON, NULL);
-       gtk_widget_show_all (main_vbox);
+       gtk_widget_show_all (priv->main_vbox);
 
 /*     /\* should we hide the toolbar? *\/ */
 /*     if (!modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_SHOW_TOOLBAR, NULL)) */
@@ -501,6 +505,61 @@ modest_main_window_close_all (ModestMainWindow *self)
                return FALSE;
 }
 
+void 
+modest_main_window_set_style (ModestMainWindow *self, 
+                             ModestMainWindowStyle style)
+{
+       ModestMainWindowPrivate *priv;
+       GtkWidget *scrolled_win;
+
+       g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
+
+       priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
+
+       /* no change -> nothing to do */
+       if (priv->style == style)
+               return;
+
+       priv->style = style;
+       scrolled_win = gtk_widget_get_parent (GTK_WIDGET (priv->header_view));
+
+       switch (style) {
+       case MODEST_MAIN_WINDOW_STYLE_SIMPLE:
+               /* Remove main paned */
+               g_object_ref (priv->main_paned);
+               gtk_container_remove (GTK_CONTAINER (priv->main_vbox), priv->main_paned);
+
+               /* Reparent header view with scrolled window */
+               gtk_widget_reparent (scrolled_win, priv->main_vbox);
+               break;
+       case MODEST_MAIN_WINDOW_STYLE_SPLITTED:
+               /* Remove header view */
+               g_object_ref (scrolled_win);
+               gtk_container_remove (GTK_CONTAINER (priv->main_vbox), scrolled_win);
+
+               /* Reparent the main paned */
+               gtk_paned_add2 (GTK_PANED (priv->main_paned), scrolled_win);
+               gtk_container_add (GTK_CONTAINER (priv->main_vbox), priv->main_paned);
+               break;
+       default:
+               g_return_if_reached ();
+       }
+
+       /* Show changes */
+       gtk_widget_show (GTK_WIDGET (priv->main_vbox));
+}
+
+ModestMainWindowStyle
+modest_main_window_get_style (ModestMainWindow *self)
+{
+       ModestMainWindowPrivate *priv;
+
+       g_return_val_if_fail (MODEST_IS_MAIN_WINDOW (self), -1);
+
+       priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
+       return priv->style;
+}
+
 static gboolean
 modest_main_window_window_state_event (GtkWidget *widget, GdkEventWindowState *event, gpointer userdata)
 {
index 992e844..2edb100 100644 (file)
 #include <hildon-widgets/hildon-color-button.h>
 #include <hildon-widgets/hildon-banner.h>
 #include <hildon-widgets/hildon-caption.h>
+#include "widgets/modest-msg-edit-window-ui.h"
 
 #ifdef MODEST_HILDON_VERSION_0
 #include <hildon-widgets/hildon-file-chooser-dialog.h>
 #else
 #include <hildon/hildon-file-chooser-dialog.h>
-#include <widgets/modest-msg-edit-window-ui.h>
 
 #endif /*MODEST_HILDON_VERSION_0 */
 
index 5a14c75..7a3c3ce 100644 (file)
@@ -663,7 +663,7 @@ modest_ui_actions_on_send_receive (GtkAction *action,  ModestWindow *win)
 
 
 void
-modest_ui_actions_toggle_view (GtkAction *action, ModestMainWindow *main_window)
+modest_ui_actions_toggle_header_list_view (GtkAction *action, ModestMainWindow *main_window)
 {
        ModestConf *conf;
        GtkWidget *header_view;
@@ -1629,3 +1629,24 @@ modest_ui_actions_on_toggle_show_bcc (GtkToggleAction *toggle,
 
        modest_msg_edit_window_show_bcc (window, gtk_toggle_action_get_active (toggle));
 }
+
+void
+modest_ui_actions_toggle_main_view (GtkAction *action, 
+                                   ModestMainWindow *main_window)
+{
+       ModestConf *conf;
+       
+       g_return_if_fail (MODEST_IS_MAIN_WINDOW(main_window));
+
+       conf = modest_runtime_get_conf ();
+       
+/*     modest_widget_memory_save (conf, G_OBJECT(header_view), "header-view"); */
+       
+       if (modest_main_window_get_style (main_window) == MODEST_MAIN_WINDOW_STYLE_SPLITTED)
+               modest_main_window_set_style (main_window, MODEST_MAIN_WINDOW_STYLE_SIMPLE);
+       else
+               modest_main_window_set_style (main_window, MODEST_MAIN_WINDOW_STYLE_SPLITTED);
+
+/*     modest_widget_memory_restore (conf, G_OBJECT(header_view), */
+/*                                   "header-view"); */
+}
index c47c66a..1b98700 100644 (file)
@@ -67,7 +67,30 @@ void     modest_ui_actions_on_prev          (GtkAction *action, ModestWindow *ma
 
 void     modest_ui_actions_on_message_details (GtkAction *action, ModestWindow *win);
 
-void    modest_ui_actions_toggle_view       (GtkAction *action, ModestMainWindow *main_window);
+
+/**
+ * modest_ui_actions_toggle_main_view:
+ * @action: the #GtkAction
+ * @main_window: the #ModestMainWindow
+ * 
+ * this action switches between split view (with a folders pane at the
+ * left) and simple view without the left pane with the folders and
+ * accounts. Maybe it's only useful for Maemo code, but as it uses
+ * generic code could be used also by the GNOME UI
+ **/
+void    modest_ui_actions_toggle_main_view          (GtkAction *action, 
+                                                     ModestMainWindow *main_window);
+
+/**
+ * modest_ui_actions_toggle_header_list_view:
+ * @action: the #GtkAction
+ * @main_window: the #ModestMainWindow
+ * 
+ * this action shows or hides the column titles of the header list
+ * view. It also enables the two lines rendering for the treeview rows
+ **/
+void    modest_ui_actions_toggle_header_list_view    (GtkAction *action, 
+                                                      ModestMainWindow *main_window);
 
 /* Widget actions */
 void     modest_ui_actions_on_header_selected          (ModestHeaderView *folder_view, 
@@ -165,11 +188,13 @@ void     modest_ui_actions_on_zoom_minus (GtkAction *action,
 
 void     modest_ui_actions_on_toggle_fullscreen    (GtkToggleAction *toggle,
                                                    ModestWindow *window);
+
+void     modest_ui_actions_on_change_fullscreen    (GtkAction *action,
+                                                   ModestWindow *window);
+
 void     modest_ui_actions_on_paste                    (GtkAction *action,
                                                        ModestWindow *window);
 
-void     modest_ui_actions_on_change_fullscreen    (GtkAction *toggle,
-                                                   ModestWindow *window);
 void     modest_ui_actions_on_select_all               (GtkAction *action,
                                                        ModestWindow *window);
 
@@ -184,5 +209,8 @@ void     modest_ui_actions_on_change_zoom              (GtkRadioAction *action,
                                                        ModestWindow *window);
 
 
+
+
+
 G_END_DECLS
 #endif /* __MODEST_UI_ACTIONS_H__ */
index 412d603..006b2b6 100644 (file)
@@ -60,6 +60,11 @@ struct _ModestMainWindowClass {
        ModestWindowClass parent_class;
 };
 
+typedef enum _ModestMainWindowStyle {
+       MODEST_MAIN_WINDOW_STYLE_SIMPLE,
+       MODEST_MAIN_WINDOW_STYLE_SPLITTED
+} ModestMainWindowStyle;
+
 /**
  * modest_main_window_get_type:
  * 
@@ -114,6 +119,29 @@ GtkWidget* modest_main_window_get_child_widget (ModestMainWindow *self,
  **/
 gboolean   modest_main_window_close_all        (ModestMainWindow *self);
 
+
+/**
+ * modest_main_window_set_style:
+ * @self: the #ModestMainWindow
+ * @style: a #ModestMainWindowStyle that will be set
+ * 
+ * sets the style of the main window, a splitted view with folders at
+ * the left and messages at the right, or the simple view, with just
+ * messages.
+ **/
+void       modest_main_window_set_style        (ModestMainWindow *self, 
+                                               ModestMainWindowStyle style);
+
+/**
+ * modest_main_window_get_style:
+ * @self: 
+ * 
+ * gets the current show style of the main window
+ * 
+ * Return value: the current #ModestWindowStyle
+ **/
+ModestMainWindowStyle       modest_main_window_get_style        (ModestMainWindow *self);
+
 G_END_DECLS
 
 #endif /* __MODEST_MAIN_WINDOW_H__ */
index 6b5f1d1..de9a903 100644 (file)
@@ -31,6 +31,7 @@
 #define __MODEST_MSG_EDIT_WINDOW_UI_H__
 
 #include <glib/gi18n.h>
+#include <gtk/gtk.h>
 #include "modest-icon-names.h"
 #include "modest-ui-actions.h"