From f4f46d1bad7d908a3065ab9369b9f4d4876e2ff8 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 19 Jan 2007 00:11:13 +0000 Subject: [PATCH] * all: - add extra toolbar button to toggle the view from 'two-line' to 'detailed' mode pmo-trunk-r669 --- src/gtk/modest-main-window.c | 4 +--- src/gtk/ui/modest-ui.xml | 2 ++ src/modest-marshal.list | 1 - src/modest-ui-actions.h | 2 ++ src/modest-ui.c | 37 ++++++++++++++++++++++++++++++++++- src/widgets/modest-main-window-ui.h | 3 +++ 6 files changed, 44 insertions(+), 5 deletions(-) diff --git a/src/gtk/modest-main-window.c b/src/gtk/modest-main-window.c index a6268a9..6d00015 100644 --- a/src/gtk/modest-main-window.c +++ b/src/gtk/modest-main-window.c @@ -181,14 +181,12 @@ modest_main_window_finalize (GObject *obj) 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); - 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; } diff --git a/src/gtk/ui/modest-ui.xml b/src/gtk/ui/modest-ui.xml index 04ba930..eb44df6 100644 --- a/src/gtk/ui/modest-ui.xml +++ b/src/gtk/ui/modest-ui.xml @@ -84,6 +84,8 @@ + + diff --git a/src/modest-marshal.list b/src/modest-marshal.list index 24502f4..187d0bb 100644 --- a/src/modest-marshal.list +++ b/src/modest-marshal.list @@ -6,4 +6,3 @@ VOID:STRING,INT,INT VOID:STRING,BOOL VOID:STRING,STRING,BOOL VOID:STRING,POINTER,POINTER,POINTER - diff --git a/src/modest-ui-actions.h b/src/modest-ui-actions.h index 0cc3154..3bb9c38 100644 --- a/src/modest-ui-actions.h +++ b/src/modest-ui-actions.h @@ -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_toggle_view (GtkWidget *widget, ModestMainWindow *main_window); + /* Widget actions */ void _modest_ui_actions_on_header_selected (ModestHeaderView *folder_view, TnyHeader *header, diff --git a/src/modest-ui.c b/src/modest-ui.c index 3691fe5..1216e9e 100644 --- a/src/modest-ui.c +++ b/src/modest-ui.c @@ -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); + priv->main_window); /* 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; + default: + g_return_if_reached (); } /* Set from */ @@ -696,6 +698,36 @@ _modest_ui_actions_on_next (GtkWidget *widget, 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 @@ -1092,6 +1124,8 @@ _modest_ui_actions_on_item_not_found (ModestHeaderView *header_view, gdk_threads_leave (); } + + 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, diff --git a/src/widgets/modest-main-window-ui.h b/src/widgets/modest-main-window-ui.h index 1de2a93..24d7f0a 100644 --- a/src/widgets/modest-main-window-ui.h +++ b/src/widgets/modest-main-window-ui.h @@ -64,6 +64,9 @@ static const GtkActionEntry modest_action_entries [] = { { "EditSelectAll", NULL, N_("Select all"), "A", N_("Select all"), NULL }, { "EditDeselectAll", NULL, N_("Deselect all"), "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) }, -- 1.7.9.5