* all:
authorDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 19 Jan 2007 00:11:13 +0000 (00:11 +0000)
committerDirk-Jan C. Binnema <dirk-jan.binnema@nokia.com>
Fri, 19 Jan 2007 00:11:13 +0000 (00:11 +0000)
- add extra toolbar button to toggle the view
from 'two-line' to 'detailed' mode

pmo-trunk-r669

src/gtk/modest-main-window.c
src/gtk/ui/modest-ui.xml
src/modest-marshal.list
src/modest-ui-actions.h
src/modest-ui.c
src/widgets/modest-main-window-ui.h

index a6268a9..6d00015 100644 (file)
@@ -181,14 +181,12 @@ modest_main_window_finalize (GObject *obj)
 static ModestHeaderView*
 header_view_new (ModestMainWindow *self)
 {
 static ModestHeaderView*
 header_view_new (ModestMainWindow *self)
 {
-       int i;
        ModestHeaderView *header_view;
        ModestMainWindowPrivate *priv;
        priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
        
        header_view = modest_widget_factory_get_header_view (priv->widget_factory);
        ModestHeaderView *header_view;
        ModestMainWindowPrivate *priv;
        priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
        
        header_view = modest_widget_factory_get_header_view (priv->widget_factory);
-       modest_header_view_set_style (header_view,
-                                     MODEST_HEADER_VIEW_STYLE_SHOW_HEADERS);
+       modest_header_view_set_style (header_view, MODEST_HEADER_VIEW_STYLE_DETAILS);
        return header_view;
 }
 
        return header_view;
 }
 
index 04ba930..eb44df6 100644 (file)
@@ -84,6 +84,8 @@
     <toolitem action="GotoNext"/>
     <separator/>
     <toolitem action="ActionsDelete"/>
     <toolitem action="GotoNext"/>
     <separator/>
     <toolitem action="ActionsDelete"/>
+    <separator/>
+    <toolitem name="ToggleView" action="ToggleView"/>
   </toolbar>
 
 </ui>
   </toolbar>
 
 </ui>
index 24502f4..187d0bb 100644 (file)
@@ -6,4 +6,3 @@ VOID:STRING,INT,INT
 VOID:STRING,BOOL
 VOID:STRING,STRING,BOOL
 VOID:STRING,POINTER,POINTER,POINTER
 VOID:STRING,BOOL
 VOID:STRING,STRING,BOOL
 VOID:STRING,POINTER,POINTER,POINTER
-
index 0cc3154..3bb9c38 100644 (file)
@@ -54,6 +54,8 @@ void     _modest_ui_actions_on_reply_all     (GtkWidget *widget, ModestMainWindo
 
 void     _modest_ui_actions_on_next          (GtkWidget *widget, ModestMainWindow *main_window);
 
 
 void     _modest_ui_actions_on_next          (GtkWidget *widget, ModestMainWindow *main_window);
 
+void    _modest_ui_actions_toggle_view      (GtkWidget *widget, ModestMainWindow *main_window);
+
 /* Widget actions */
 void     _modest_ui_actions_on_header_selected          (ModestHeaderView *folder_view, 
                                                         TnyHeader *header,
 /* Widget actions */
 void     _modest_ui_actions_on_header_selected          (ModestHeaderView *folder_view, 
                                                         TnyHeader *header,
index 3691fe5..1216e9e 100644 (file)
@@ -363,7 +363,7 @@ connect_signals (ModestUI *self)
                          priv->main_window);
        g_signal_connect (G_OBJECT(header_view), "item_not_found",
                          G_CALLBACK(_modest_ui_actions_on_item_not_found), 
                          priv->main_window);
        g_signal_connect (G_OBJECT(header_view), "item_not_found",
                          G_CALLBACK(_modest_ui_actions_on_item_not_found), 
-                         priv->main_window);   
+                         priv->main_window);
        /* msg preview */
        g_signal_connect (G_OBJECT(msg_view), "link_clicked",
                          G_CALLBACK(_modest_ui_actions_on_msg_link_clicked), 
        /* msg preview */
        g_signal_connect (G_OBJECT(msg_view), "link_clicked",
                          G_CALLBACK(_modest_ui_actions_on_msg_link_clicked), 
@@ -566,6 +566,8 @@ reply_forward_func (gpointer data, gpointer user_data)
                        modest_mail_operation_create_forward_mail (msg, rf_helper->from, rf_helper->reply_forward_type);
                edit_type = MODEST_EDIT_TYPE_FORWARD;
                break;
                        modest_mail_operation_create_forward_mail (msg, rf_helper->from, rf_helper->reply_forward_type);
                edit_type = MODEST_EDIT_TYPE_FORWARD;
                break;
+       default:
+               g_return_if_reached ();
        }
 
        /* Set from */
        }
 
        /* Set from */
@@ -696,6 +698,36 @@ _modest_ui_actions_on_next (GtkWidget *widget,
        modest_header_view_select_next (header_view);
 }
 
        modest_header_view_select_next (header_view);
 }
 
+void
+_modest_ui_actions_toggle_view (GtkWidget *widget,
+                               ModestMainWindow *main_window)
+{
+       ModestHeaderView *header_view;
+       ModestWidgetFactory *widget_factory;
+       ModestConf *conf;
+       TnyPlatformFactory *plat_factory;
+
+       /* Get ModestConf */
+       plat_factory = modest_tny_platform_factory_get_instance ();
+       conf = modest_tny_platform_factory_get_conf_instance
+               (MODEST_TNY_PLATFORM_FACTORY(plat_factory));
+       widget_factory = modest_main_window_get_widget_factory (main_window);
+       header_view = modest_widget_factory_get_header_view (widget_factory);
+       g_object_unref (G_OBJECT(widget_factory));
+
+       /* 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(header_view), "header-view");
+       
+       if (modest_header_view_get_style (header_view) == MODEST_HEADER_VIEW_STYLE_DETAILS)
+               modest_header_view_set_style (header_view, MODEST_HEADER_VIEW_STYLE_TWOLINES);
+       else
+               modest_header_view_set_style (header_view, MODEST_HEADER_VIEW_STYLE_DETAILS);
+
+       modest_widget_memory_restore (conf, G_OBJECT(header_view), "header-view");
+}
+
+
 
 /*
  * Marks a message as read and passes it to the msg preview widget
 
 /*
  * Marks a message as read and passes it to the msg preview widget
@@ -1092,6 +1124,8 @@ _modest_ui_actions_on_item_not_found (ModestHeaderView *header_view,
        gdk_threads_leave ();
 }
 
        gdk_threads_leave ();
 }
 
+
+
 void
 _modest_ui_actions_on_header_status_update (ModestHeaderView *header_view, 
                                            const gchar *msg,
 void
 _modest_ui_actions_on_header_status_update (ModestHeaderView *header_view, 
                                            const gchar *msg,
@@ -1118,6 +1152,7 @@ _modest_ui_actions_on_header_status_update (ModestHeaderView *header_view,
 }
 
 
 }
 
 
+
 void
 _modest_ui_actions_on_msg_link_hover (ModestMsgView *msgview, 
                                      const gchar* link,
 void
 _modest_ui_actions_on_msg_link_hover (ModestMsgView *msgview, 
                                      const gchar* link,
index 1de2a93..24d7f0a 100644 (file)
@@ -64,6 +64,9 @@ static const GtkActionEntry modest_action_entries [] = {
        { "EditSelectAll",   NULL,             N_("Select all"),   "<CTRL>A",         N_("Select all"), NULL },
        { "EditDeselectAll", NULL,             N_("Deselect all"), "<Shift><CTRL>A",  N_("Deselect all"), NULL },
 
        { "EditSelectAll",   NULL,             N_("Select all"),   "<CTRL>A",         N_("Select all"), NULL },
        { "EditDeselectAll", NULL,             N_("Deselect all"), "<Shift><CTRL>A",  N_("Deselect all"), NULL },
 
+       /* VIEW */
+       { "ToggleView",        GTK_STOCK_CDROM,   N_("_Toggle view"), NULL,        N_("Toggle the list view"),  G_CALLBACK(_modest_ui_actions_toggle_view) },
+       
        /* ACTIONS */
        { "ActionsNew",         MODEST_STOCK_NEW_MAIL, N_("_New Message"),   NULL, N_("Compose a new message"), G_CALLBACK (_modest_ui_actions_on_new_msg) },
        { "ActionsReply",       MODEST_STOCK_REPLY, N_("_Reply"),         NULL, N_("Reply to a message"), G_CALLBACK (_modest_ui_actions_on_reply) },
        /* ACTIONS */
        { "ActionsNew",         MODEST_STOCK_NEW_MAIL, N_("_New Message"),   NULL, N_("Compose a new message"), G_CALLBACK (_modest_ui_actions_on_new_msg) },
        { "ActionsReply",       MODEST_STOCK_REPLY, N_("_Reply"),         NULL, N_("Reply to a message"), G_CALLBACK (_modest_ui_actions_on_reply) },