[Commits] mainwindow.c 1.274.2.348 1.274.2.349 messageview.c 1.94.2.237 1.94.2.238 mimeview.c 1.83.2.192 1.83.2.193 mimeview.h 1.20.2.37 1.20.2.38 summaryview.c 1.395.2.450 1.395.2.451 textview.c 1.96.2.244 1.96.2.245

colin at claws-mail.org colin at claws-mail.org
Wed Aug 29 11:33:04 CEST 2012


Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv4178/src

Modified Files:
      Tag: gtk2
	mainwindow.c messageview.c mimeview.c mimeview.h summaryview.c 
	textview.c 
Log Message:
2012-08-29 [colin]	3.8.1cvs40

	* src/mainwindow.c
	* src/messageview.c
	* src/mimeview.c
	* src/mimeview.h
	* src/summaryview.c
	* src/textview.c
	* src/gtk/menu.c
	* src/gtk/menu.h
		Move the hardcoded mimeview shortcuts to standard menus.

Index: mimeview.c
===================================================================
RCS file: /home/claws-mail/claws/src/mimeview.c,v
retrieving revision 1.83.2.192
retrieving revision 1.83.2.193
diff -u -d -r1.83.2.192 -r1.83.2.193
--- mimeview.c	27 Jul 2012 18:25:38 -0000	1.83.2.192
+++ mimeview.c	29 Aug 2012 09:33:01 -0000	1.83.2.193
@@ -108,21 +108,15 @@
 static gboolean mimeview_scrolled	(GtkWidget	*widget,
 					 GdkEventScroll	*event,
 					 MimeView	*mimeview);
-static void mimeview_display_as_text	(MimeView	*mimeview);
-static void mimeview_save_as		(MimeView	*mimeview);
+
 static void mimeview_save_all		(MimeView	*mimeview);
-static void mimeview_launch		(MimeView	*mimeview,
-					 MimeInfo	*partinfo);
 #ifndef G_OS_WIN32
-static void mimeview_open_with		(MimeView	*mimeview);
 static void mimeview_open_part_with	(MimeView	*mimeview,
 					 MimeInfo	*partinfo,
 					 gboolean	 automatic);
 #endif
 static void mimeview_send_to		(MimeView	*mimeview,
 					 MimeInfo	*partinfo);
-static void mimeview_select_next_part	(MimeView	*mimeview);
-static void mimeview_select_prev_part	(MimeView	*mimeview);
 static void mimeview_view_file		(const gchar	*filename,
 					 MimeInfo	*partinfo,
 					 const gchar	*cmd,
@@ -204,16 +198,16 @@
 
 static GtkActionEntry mimeview_menu_actions[] = {
 	{ "MimeView", NULL, "MimeView" },
-	{ "MimeView/Open", NULL, N_("_Open (l)"), NULL, "Open MIME part", G_CALLBACK(mimeview_launch_cb) },
+	{ "MimeView/Open", NULL, N_("_Open"), NULL, "Open MIME part", G_CALLBACK(mimeview_launch_cb) },
 #if (!defined MAEMO && !defined G_OS_WIN32)
-	{ "MimeView/OpenWith", NULL, N_("Open _with (o)..."), NULL, "Open MIME part with...", G_CALLBACK(mimeview_open_with_cb) },
+	{ "MimeView/OpenWith", NULL, N_("Open _with..."), NULL, "Open MIME part with...", G_CALLBACK(mimeview_open_with_cb) },
 #endif
 	{ "MimeView/SendTo", NULL, N_("Send to..."), NULL, "Send to", G_CALLBACK(mimeview_send_to_cb) },
-	{ "MimeView/DisplayAsText", NULL, N_("_Display as text (t)"), NULL, "Display as text", G_CALLBACK(mimeview_display_as_text_cb) },
-	{ "MimeView/SaveAs", NULL, N_("_Save as (y)..."), NULL, "Save as", G_CALLBACK(mimeview_save_as_cb) },
+	{ "MimeView/DisplayAsText", NULL, N_("_Display as text"), NULL, "Display as text", G_CALLBACK(mimeview_display_as_text_cb) },
+	{ "MimeView/SaveAs", NULL, N_("_Save as..."), NULL, "Save as", G_CALLBACK(mimeview_save_as_cb) },
 	{ "MimeView/SaveAll", NULL, N_("Save _all..."), NULL, "Save all parts", G_CALLBACK(mimeview_save_all_cb) },
-	{ "MimeView/NextPart", NULL, N_("Next part (a)"), NULL, "Next part", G_CALLBACK(mimeview_select_next_part_cb) },
-	{ "MimeView/PrevPart", NULL, N_("Previous part (z)"), NULL, "Previous part", G_CALLBACK(mimeview_select_prev_part_cb) }
+	{ "MimeView/NextPart", NULL, N_("Next part"), NULL, "Next part", G_CALLBACK(mimeview_select_next_part_cb) },
+	{ "MimeView/PrevPart", NULL, N_("Previous part"), NULL, "Previous part", G_CALLBACK(mimeview_select_prev_part_cb) }
 };
 
 static GtkTargetEntry mimeview_mime_types[] =
@@ -1010,7 +1004,6 @@
 }
 
 static void check_signature_cb(GtkWidget *widget, gpointer user_data);
-static void mimeview_check_signature(MimeView *mimeview);
 static void display_full_info_cb(GtkWidget *widget, gpointer user_data);
 
 static void update_signature_noticeview(MimeView *mimeview, MimeInfo *mimeinfo, 
@@ -1328,7 +1321,7 @@
 	}
 }
 
-static void mimeview_check_signature(MimeView *mimeview)
+void mimeview_check_signature(MimeView *mimeview)
 {
 	check_signature_cb(NULL, mimeview);	
 }
@@ -1386,7 +1379,13 @@
 		siginfo = procmime_mimeinfo_parent(siginfo);
 	}
 	mimeview->siginfo = siginfo;
-	
+
+	/* This shortcut boolean is there to correctly set the menu's
+	 * CheckSignature item sensitivity without killing performance
+	 * each time the menu sensitiveness is updated (a lot).
+	 */
+	mimeview->signed_part = (siginfo == selected);
+
 	if (siginfo == NULL) {
 		noticeview_hide(mimeview->siginfoview);
 		return;
@@ -1535,7 +1534,7 @@
 	return mimeview_key_pressed(mimeview->ctree, event, mimeview);
 }
 
-static void mimeview_select_next_part(MimeView *mimeview)
+void mimeview_select_next_part(MimeView *mimeview)
 {
 	GtkTreeView *ctree = GTK_TREE_VIEW(mimeview->ctree);
 	GtkTreeModel *model = gtk_tree_view_get_model(ctree);
@@ -1568,7 +1567,7 @@
 	gtk_tree_path_free(path);
 }
 
-static void mimeview_select_prev_part(MimeView *mimeview)
+void mimeview_select_prev_part(MimeView *mimeview)
 {
 	GtkTreeView *ctree = GTK_TREE_VIEW(mimeview->ctree);
 	GtkTreeModel *model = gtk_tree_view_get_model(ctree);
@@ -1644,36 +1643,6 @@
 	case GDK_KEY_Down:
 		mimeview_scroll_one_line(mimeview, (event->keyval == GDK_KEY_Up));
 		return TRUE;
-	case GDK_KEY_y:
-		BREAK_ON_MODIFIER_KEY();
-		mimeview_save_as(mimeview);
-		return TRUE;
-	case GDK_KEY_t:
-		BREAK_ON_MODIFIER_KEY();
-		mimeview_display_as_text(mimeview);
-		return TRUE;	
-	case GDK_KEY_l:
-		BREAK_ON_MODIFIER_KEY();
-		mimeview_launch(mimeview, NULL);
-		return TRUE;
-	case GDK_KEY_o:
-		BREAK_ON_MODIFIER_KEY();
-#ifndef G_OS_WIN32
-		mimeview_open_with(mimeview);
-#endif
-		return TRUE;
-	case GDK_KEY_c:
-		BREAK_ON_MODIFIER_KEY();
-		mimeview_check_signature(mimeview);
-		return TRUE;
-	case GDK_KEY_a:
-		BREAK_ON_MODIFIER_KEY();
-		mimeview_select_next_part(mimeview);
-		return TRUE;
-	case GDK_KEY_z:
-		BREAK_ON_MODIFIER_KEY();
-		mimeview_select_prev_part(mimeview);
-		return TRUE;
 	default:
 		break;
 	}
@@ -1965,7 +1934,7 @@
  * Menu callback: Save the selected attachment
  * \param mimeview Current display
  */
-static void mimeview_save_as(MimeView *mimeview)
+void mimeview_save_as(MimeView *mimeview)
 {
 	gchar *filename;
 	gchar *filepath = NULL;
@@ -2027,7 +1996,7 @@
 	g_free(filepath);
 }
 
-static void mimeview_display_as_text(MimeView *mimeview)
+void mimeview_display_as_text(MimeView *mimeview)
 {
 	MimeInfo *partinfo;
 
@@ -2039,7 +2008,7 @@
 	mimeview_show_message_part(mimeview, partinfo);
 }
 
-static void mimeview_launch(MimeView *mimeview, MimeInfo *partinfo)
+void mimeview_launch(MimeView *mimeview, MimeInfo *partinfo)
 {
 	gchar *filename;
 	gint err;
@@ -2065,7 +2034,7 @@
 }
 
 #ifndef G_OS_WIN32
-static void mimeview_open_with(MimeView *mimeview)
+void mimeview_open_with(MimeView *mimeview)
 {
 	MimeInfo *partinfo;
 
@@ -2366,18 +2335,10 @@
 static gint icon_key_pressed(GtkWidget *button, GdkEventKey *event,
 			     MimeView *mimeview)
 {
-	gint          num;
-	MimeInfo     *partinfo;
 	SummaryView  *summaryview;
-	TextView     *textview;
-
-	num      = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "icon_number"));
-	partinfo = g_object_get_data(G_OBJECT(button), "partinfo");
 	
 	if (!event) return FALSE;
 
-	textview = mimeview->textview;
-
 	switch (event->keyval) {
 	case GDK_KEY_space:
 		if (mimeview_scroll_page(mimeview, FALSE))

Index: summaryview.c
===================================================================
RCS file: /home/claws-mail/claws/src/summaryview.c,v
retrieving revision 1.395.2.450
retrieving revision 1.395.2.451
diff -u -d -r1.395.2.450 -r1.395.2.451
--- summaryview.c	27 Aug 2012 17:41:06 -0000	1.395.2.450
+++ summaryview.c	29 Aug 2012 09:33:01 -0000	1.395.2.451
@@ -6734,20 +6734,6 @@
 		BREAK_ON_MODIFIER_KEY();
 		summary_delete_trash(summaryview);
 		break;
-	case GDK_KEY_y:
-	case GDK_KEY_t:
-	case GDK_KEY_l:
-	case GDK_KEY_o:
-	case GDK_KEY_c:
-	case GDK_KEY_a:
-	case GDK_KEY_z:
-		if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) == 0) {
-			g_signal_stop_emission_by_name(G_OBJECT(widget), 
-                                       "key_press_event");
-			mimeview_pass_key_press_event(messageview->mimeview,
-						      event);
-			break;
-		}
 	default:
 		break;
 	}

Index: textview.c
===================================================================
RCS file: /home/claws-mail/claws/src/textview.c,v
retrieving revision 1.96.2.244
retrieving revision 1.96.2.245
diff -u -d -r1.96.2.244 -r1.96.2.245
--- textview.c	27 Jul 2012 18:50:03 -0000	1.96.2.244
+++ textview.c	29 Aug 2012 09:33:02 -0000	1.96.2.245
@@ -944,10 +944,16 @@
 	GtkTextBuffer *buffer;
 	GtkTextIter iter;
 	const gchar *name;
-	gchar *content_type;
+	gchar *content_type, *shortcut;
+	GtkUIManager *ui_manager;
 
 	if (!partinfo) return;
 
+	if (textview->messageview->window != NULL)
+		ui_manager = textview->messageview->ui_manager;
+	else
+		ui_manager = textview->messageview->mainwin->ui_manager;
+
 	textview_set_font(textview, NULL);
 	textview_clear(textview);
 
@@ -982,7 +988,11 @@
 	TEXTVIEW_INSERT(_("     - To save, select "));
 	TEXTVIEW_INSERT_LINK(_("'Save as...'"), "sc://save_as", NULL);
 #ifndef GENERIC_UMPC
-	TEXTVIEW_INSERT(_(" (Shortcut key: 'y')"));
+	TEXTVIEW_INSERT(_(" (Shortcut key: '"));
+	shortcut = cm_menu_item_get_shortcut(ui_manager, "Menu/File/SavePartAs");
+	TEXTVIEW_INSERT(shortcut);
+	g_free(shortcut);
+	TEXTVIEW_INSERT("')");
 #endif
 	TEXTVIEW_INSERT("\n");
 
@@ -990,7 +1000,11 @@
 	TEXTVIEW_INSERT_LINK(_("'Display as text'"), "sc://display_as_text", NULL);
 
 #ifndef GENERIC_UMPC
-	TEXTVIEW_INSERT(_(" (Shortcut key: 't')"));
+	TEXTVIEW_INSERT(_(" (Shortcut key: '"));
+	shortcut = cm_menu_item_get_shortcut(ui_manager, "Menu/View/PartAsText");
+	TEXTVIEW_INSERT(shortcut);
+	g_free(shortcut);
+	TEXTVIEW_INSERT("')");
 #endif
 	TEXTVIEW_INSERT("\n");
 
@@ -998,13 +1012,21 @@
 	TEXTVIEW_INSERT_LINK(_("'Open'"), "sc://open", NULL);
 
 #ifndef GENERIC_UMPC
-	TEXTVIEW_INSERT(_(" (Shortcut key: 'l')\n"));
+	TEXTVIEW_INSERT(_(" (Shortcut key: '"));
+	shortcut = cm_menu_item_get_shortcut(ui_manager, "Menu/View/OpenPartWith");
+	TEXTVIEW_INSERT(shortcut);
+	g_free(shortcut);
+	TEXTVIEW_INSERT("')\n");
 	TEXTVIEW_INSERT(_("       (alternately double-click, or click the middle "));
 	TEXTVIEW_INSERT(_("mouse button)\n"));
 #ifndef G_OS_WIN32
 	TEXTVIEW_INSERT(_("     - Or use "));
 	TEXTVIEW_INSERT_LINK(_("'Open with...'"), "sc://open_with", NULL);
-	TEXTVIEW_INSERT(_(" (Shortcut key: 'o')"));
+	TEXTVIEW_INSERT(_(" (Shortcut key: '"));
+	shortcut = cm_menu_item_get_shortcut(ui_manager, "Menu/View/OpenPart");
+	TEXTVIEW_INSERT(shortcut);
+	g_free(shortcut);
+	TEXTVIEW_INSERT("')");
 #endif
 #endif
 	TEXTVIEW_INSERT("\n");
@@ -2427,19 +2449,6 @@
 		if (summaryview)
 			summary_pass_key_press_event(summaryview, event);
 		break;
-	case GDK_KEY_y:
-	case GDK_KEY_t:
-	case GDK_KEY_l:
-	case GDK_KEY_o:
-	case GDK_KEY_c:
-	case GDK_KEY_a:
-		if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) == 0) {
-			KEY_PRESS_EVENT_STOP();
-			mimeview_pass_key_press_event(messageview->mimeview,
-						      event);
-			break;
-		}
-		/* possible fall through */
 	default:
 		window = gtk_widget_get_window(messageview->mainwin->window);
 		if (summaryview &&

Index: mainwindow.c
===================================================================
RCS file: /home/claws-mail/claws/src/mainwindow.c,v
retrieving revision 1.274.2.348
retrieving revision 1.274.2.349
diff -u -d -r1.274.2.348 -r1.274.2.349
--- mainwindow.c	27 Aug 2012 17:09:08 -0000	1.274.2.348
+++ mainwindow.c	29 Aug 2012 09:33:01 -0000	1.274.2.349
@@ -447,6 +447,15 @@
 				  gpointer	 data);
 static gboolean any_folder_want_synchronise(void);
 
+static void save_part_as_cb(GtkAction *action, gpointer data);
+static void view_part_as_text_cb(GtkAction *action, gpointer data);
+static void open_part_cb(GtkAction *action, gpointer data);
+#ifndef G_OS_WIN32
+static void open_part_with_cb(GtkAction *action, gpointer data);
+#endif
+static void check_signature_cb(GtkAction *action, gpointer data);
+static void goto_next_part_cb(GtkAction *action, gpointer data);
+static void goto_prev_part_cb(GtkAction *action, gpointer data);
 #define DO_ACTION(name, act)	{ if (!strcmp(a_name, name)) action = act; }
 
 static void mainwindow_nothing_cb	   (GtkAction *action, gpointer data)
@@ -507,7 +516,9 @@
 	{"File/EmptyTrashes",			NULL, N_("Empty all _Trash folders"), "<shift>D", NULL, G_CALLBACK(empty_trash_cb) },
 	/* {"File/---",				NULL, "---" }, */
 
-	{"File/SaveAs",				NULL, N_("_Save as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
+	{"File/SaveAs",				NULL, N_("_Save email as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
+	{"File/SavePartAs",			NULL, N_("_Save part as..."), "Y", NULL, G_CALLBACK(save_part_as_cb) },
+	/* {"File/---",				NULL, "---" }, */
 
 	{"File/PageSetup",			NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
 	{"File/Print",				NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
@@ -570,6 +581,9 @@
 	/* {"View/Goto/---",			NULL, "---", NULL, NULL, NULL }, */
 	{"View/Goto/NextUnreadFolder",		NULL, N_("Next unread _folder"), "<shift>G", NULL, G_CALLBACK(goto_unread_folder_cb) },
 	{"View/Goto/OtherFolder",		NULL, N_("_Other folder..."), "G", NULL, G_CALLBACK(goto_folder_cb) },
+	/* {"View/Goto/---",			NULL, "---", NULL, NULL, NULL }, */
+	{"View/Goto/NextPart",			NULL, N_("Next part"), "A", NULL, G_CALLBACK(goto_next_part_cb) },
+	{"View/Goto/PrevPart",			NULL, N_("Previous part"), "Z", NULL, G_CALLBACK(goto_prev_part_cb) },
 
         /* {"View/Scroll/---",                  NULL, "---", NULL, NULL, NULL }, */
         {"View/Scroll",                         NULL, N_("Message scroll") },
@@ -603,6 +617,15 @@
 	/* {"View/---",				NULL, "---", NULL, NULL, NULL }, */
 	{"View/OpenNewWindow",			NULL, N_("Open in new _window"), "<control><alt>N", NULL, G_CALLBACK(open_msg_cb) },
 	{"View/MessageSource",			NULL, N_("Mess_age source"), "<control>U", NULL, G_CALLBACK(view_source_cb) },
+	/* {"View/---",				NULL, "---", NULL, NULL, NULL }, */
+	{"View/Part",				NULL, N_("Message part") },
+	{"View/Part/AsText",			NULL, N_("View as text"), "T", NULL, G_CALLBACK(view_part_as_text_cb) },
+	{"View/Part/Open",			NULL, N_("Open"), "L", NULL, G_CALLBACK(open_part_cb) },
+#ifndef G_OS_WIN32
+	{"View/Part/OpenWith",			NULL, N_("Open with..."), "O", NULL, G_CALLBACK(open_part_with_cb) },
+#endif
+	/* {"View/---",				NULL, "---", NULL, NULL, NULL }, */
+
 	{"View/Quotes",				NULL, N_("Quotes") }, 
 	/* {"View/---",				NULL, "---", NULL, NULL, NULL }, */
 	{"View/UpdateSummary",			NULL, N_("_Update summary"), "<control><alt>U", NULL, G_CALLBACK(update_summary_cb) },
@@ -683,6 +706,9 @@
 	/*{"Message/---",			NULL, "---" },*/
 
 	{"Message/Reedit",			NULL, N_("Re-_edit"), NULL, NULL, G_CALLBACK(reedit_cb) },
+	/*{"Message/---",			NULL, "---" },*/
+
+	{"Message/CheckSignature",		NULL, N_("Check signature"), "C", NULL, G_CALLBACK(check_signature_cb) },
 
 /* Tools menu */
 
@@ -1653,12 +1679,14 @@
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "EmptyTrashes", "File/EmptyTrashes", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator4", "File/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SavePartAs", "File/SavePartAs", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator5", "File/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "PageSetup", "File/PageSetup", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM)
-	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator5", "File/---", GTK_UI_MANAGER_SEPARATOR)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator6", "File/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "OfflineMode", "File/OfflineMode", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "SynchroniseFolders", "File/SynchroniseFolders", GTK_UI_MANAGER_MENUITEM)
-	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator6", "File/---", GTK_UI_MANAGER_SEPARATOR)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Separator7", "File/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/File", "Exit", "File/Exit", GTK_UI_MANAGER_MENUITEM)
 
 /* Edit menu */
@@ -1757,6 +1785,9 @@
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator7", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextUnreadFolder", "View/Goto/NextUnreadFolder", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "OtherFolder", "View/Goto/OtherFolder", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "Separator8", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "NextPart", "View/Goto/NextPart", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Goto", "PrevPart", "View/Goto/PrevPart", GTK_UI_MANAGER_MENUITEM)
         MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Scroll", "View/Scroll", GTK_UI_MANAGER_MENU)
         MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "PrevLine", "View/Scroll/PrevLine", GTK_UI_MANAGER_MENUITEM)
         MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Scroll", "NextLine", "View/Scroll/NextLine", GTK_UI_MANAGER_MENUITEM)
@@ -1837,7 +1868,13 @@
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "CollapseAll", "View/Quotes/CollapseAll", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse2", "View/Quotes/Collapse2", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Quotes", "Collapse3", "View/Quotes/Collapse3", GTK_UI_MANAGER_MENUITEM)
-	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator6", "View/---", GTK_UI_MANAGER_SEPARATOR)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Part", "View/Part", GTK_UI_MANAGER_MENU)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "AsText", "View/Part/AsText", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "Open", "View/Part/Open", GTK_UI_MANAGER_MENUITEM)
+#ifndef G_OS_WIN32
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View/Part", "OpenWith", "View/Part/OpenWith", GTK_UI_MANAGER_MENUITEM)
+#endif
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "Separator8", "View/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/View", "UpdateSummary", "View/UpdateSummary", GTK_UI_MANAGER_MENUITEM)
 
 /* Message menu */
@@ -1910,6 +1947,7 @@
 
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Reedit", "Message/Reedit", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "Separator6", "Message/---", GTK_UI_MANAGER_SEPARATOR)
+	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Message", "CheckSignature", "Message/CheckSignature", GTK_UI_MANAGER_MENUITEM)
 
 /* Tools menu */
 	MENUITEM_ADDUI_MANAGER(mainwin->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM)
@@ -3220,12 +3258,14 @@
 	GtkWidget *menu;
 	GList *children, *cur_item;
 	gint i;
+	gboolean mimepart_selected = FALSE;
 
 	static const struct {
 		gchar *const entry;
 		SensitiveCond cond;
 	} entry[] = {
 		{"Menu/File/SaveAs", M_TARGET_EXIST},
+		{"Menu/File/SavePartAs", M_SINGLE_TARGET_EXIST},
 		{"Menu/File/Print"  , M_TARGET_EXIST},
 		{"Menu/File/SynchroniseFolders", M_WANT_SYNC},
 		{"Menu/File/Exit"      , M_UNLOCKED},
@@ -3251,8 +3291,11 @@
 		{"Menu/View/Goto/PrevLabeled", M_MSG_EXIST},
 		{"Menu/View/Goto/NextLabeled", M_MSG_EXIST},
 		{"Menu/View/Goto/ParentMessage"      , M_SINGLE_TARGET_EXIST},
+		{"Menu/View/Goto/NextPart"      , M_SINGLE_TARGET_EXIST},
+		{"Menu/View/Goto/PrevPart"      , M_SINGLE_TARGET_EXIST},
 		{"Menu/View/OpenNewWindow"        , M_SINGLE_TARGET_EXIST},
 		{"Menu/View/MessageSource"            , M_SINGLE_TARGET_EXIST},
+		{"Menu/View/Part"            , M_SINGLE_TARGET_EXIST},
 		{"Menu/View/AllHeaders"          	   , M_SINGLE_TARGET_EXIST},
 		{"Menu/View/Quotes"                    , M_SINGLE_TARGET_EXIST},
 
@@ -3286,6 +3329,7 @@
 		{"Menu/Message/ColorLabel"		  , M_TARGET_EXIST},
 		{"Menu/Message/Tags"		  , M_TARGET_EXIST},
 		{"Menu/Message/Reedit"               , M_HAVE_ACCOUNT|M_ALLOW_REEDIT},
+		{"Menu/Message/CheckSignature"               , M_SINGLE_TARGET_EXIST},
 
 		{"Menu/Tools/AddSenderToAB"   , M_SINGLE_TARGET_EXIST},
 		{"Menu/Tools/CollectAddresses"            , M_FOLDER_SELECTED},
@@ -3419,6 +3463,17 @@
 	cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/NextHistory",
 		messageview_nav_has_next(mainwin->messageview));
 
+	if (mainwin->messageview 
+	&&  mainwin->messageview->mimeview)
+		mimepart_selected = !mimeview_tree_is_empty(mainwin->messageview->mimeview);
+
+	cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/File/SavePartAs", mimepart_selected);
+	cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/NextPart", mimepart_selected);
+	cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Goto/PrevPart", mimepart_selected);
+	cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/Part", mimepart_selected);
+	cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/Message/CheckSignature", 
+				   mimepart_selected && mainwin->messageview->mimeview->signed_part);
+
 	main_window_menu_callback_unblock(mainwin);
 }
 
@@ -5451,6 +5506,69 @@
 	main_window_set_menu_sensitive(mainwin);
 }
 
+static void save_part_as_cb(GtkAction *action, gpointer data)
+{
+	MainWindow *mainwin = (MainWindow *)data;
+
+	if (mainwin->messageview 
+	&&  mainwin->messageview->mimeview)
+		mimeview_save_as(mainwin->messageview->mimeview);
+}
+
+static void view_part_as_text_cb(GtkAction *action, gpointer data)
+{
+	MainWindow *mainwin = (MainWindow *)data;
+
+	if (mainwin->messageview 
+	&&  mainwin->messageview->mimeview)
+		mimeview_display_as_text(mainwin->messageview->mimeview);
+}
+
+static void open_part_cb(GtkAction *action, gpointer data)
+{
+	MainWindow *mainwin = (MainWindow *)data;
+
+	if (mainwin->messageview 
+	&&  mainwin->messageview->mimeview)
+		mimeview_launch(mainwin->messageview->mimeview, NULL);
+}
+#ifndef G_OS_WIN32
+static void open_part_with_cb(GtkAction *action, gpointer data)
+{
+	MainWindow *mainwin = (MainWindow *)data;
+
+	if (mainwin->messageview 
+	&&  mainwin->messageview->mimeview)
+		mimeview_open_with(mainwin->messageview->mimeview);
+}
+#endif
+static void check_signature_cb(GtkAction *action, gpointer data)
+{
+	MainWindow *mainwin = (MainWindow *)data;
+
+	if (mainwin->messageview 
+	&&  mainwin->messageview->mimeview)
+		mimeview_check_signature(mainwin->messageview->mimeview);
+}
+
+static void goto_next_part_cb(GtkAction *action, gpointer data)
+{
+	MainWindow *mainwin = (MainWindow *)data;
+
+	if (mainwin->messageview 
+	&&  mainwin->messageview->mimeview)
+		mimeview_select_next_part(mainwin->messageview->mimeview);
+}
+
+static void goto_prev_part_cb(GtkAction *action, gpointer data)
+{
+	MainWindow *mainwin = (MainWindow *)data;
+
+	if (mainwin->messageview 
+	&&  mainwin->messageview->mimeview)
+		mimeview_select_prev_part(mainwin->messageview->mimeview);
+}
+
 #ifdef MAEMO
 gboolean maemo_mainwindow_is_fullscreen(GtkWidget *widget)
 {

Index: mimeview.h
===================================================================
RCS file: /home/claws-mail/claws/src/mimeview.h,v
retrieving revision 1.20.2.37
retrieving revision 1.20.2.38
diff -u -d -r1.20.2.37 -r1.20.2.38
--- mimeview.h	27 May 2012 17:30:52 -0000	1.20.2.37
+++ mimeview.h	29 Aug 2012 09:33:01 -0000	1.20.2.38
@@ -102,6 +102,8 @@
 	MimeInfo *spec_part;
 	GtkUIManager *ui_manager;
 	GtkActionGroup *action_group;
+	gboolean signed_part;
+
 #ifdef USE_PTHREAD
 	SigCheckData *check_data;
 #endif
@@ -177,6 +179,17 @@
 					(MimeView	*mimeview,
 					 const gchar	*content_type);
 gboolean mimeview_tree_is_empty		(MimeView 	*mimeview);
+void mimeview_save_as		(MimeView	*mimeview);
+void mimeview_display_as_text	(MimeView	*mimeview);
+void mimeview_launch		(MimeView	*mimeview,
+				 MimeInfo	*partinfo);
+#ifndef G_OS_WIN32
+void mimeview_open_with		(MimeView	*mimeview);
+#endif
+void mimeview_check_signature(MimeView *mimeview);
+void mimeview_select_next_part(MimeView *mimeview);
+void mimeview_select_prev_part(MimeView *mimeview);
+
 
 #ifdef __cplusplus
 }

Index: messageview.c
===================================================================
RCS file: /home/claws-mail/claws/src/messageview.c,v
retrieving revision 1.94.2.237
retrieving revision 1.94.2.238
diff -u -d -r1.94.2.237 -r1.94.2.238
--- messageview.c	12 Aug 2012 16:16:44 -0000	1.94.2.237
+++ messageview.c	29 Aug 2012 09:33:01 -0000	1.94.2.238
@@ -185,6 +185,16 @@
 					 MsgInfo	*old_msginfo);
 static gboolean messageview_update_msg	(gpointer source, gpointer data);
 
+static void save_part_as_cb(GtkAction *action, gpointer data);
+static void view_part_as_text_cb(GtkAction *action, gpointer data);
+static void open_part_cb(GtkAction *action, gpointer data);
+#ifndef G_OS_WIN32
+static void open_part_with_cb(GtkAction *action, gpointer data);
+#endif
+static void check_signature_cb(GtkAction *action, gpointer data);
+static void goto_next_part_cb(GtkAction *action, gpointer data);
+static void goto_prev_part_cb(GtkAction *action, gpointer data);
+
 static void messageview_nothing_cb	   (GtkAction *action, gpointer data)
 {
 
@@ -204,7 +214,8 @@
 	{"PlaceHolder",			NULL, "Placeholder", NULL, NULL, G_CALLBACK(messageview_nothing_cb) },
 
 /* File menu */
-	{"File/SaveAs",			NULL, N_("_Save as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
+	{"File/SaveAs",			NULL, N_("_Save email as..."), "<control>S", NULL, G_CALLBACK(save_as_cb) },
+	{"File/SavePartAs",		NULL, N_("_Save part as..."), "Y", NULL, G_CALLBACK(save_part_as_cb) },
 	{"File/PageSetup",		NULL, N_("Page setup..."), NULL, NULL, G_CALLBACK(page_setup_cb) },
 	{"File/Print",			NULL, N_("_Print..."), "<control>P", NULL, G_CALLBACK(print_cb) },
 	{"File/---",			NULL, "---", NULL, NULL, NULL },
@@ -241,6 +252,8 @@
 	{"View/Goto/NextUnreadFolder",	NULL, N_("Next unread _folder"), "<shift>G", NULL, G_CALLBACK(goto_unread_folder_cb) },
 	{"View/Goto/OtherFolder",	NULL, N_("_Other folder..."), "G", NULL, G_CALLBACK(goto_folder_cb) },
 	/* {"View/Goto/---",		NULL, "---", NULL, NULL, NULL }, */
+	{"View/Goto/NextPart",		NULL, N_("Next part"), "A", NULL, G_CALLBACK(goto_next_part_cb) },
+	{"View/Goto/PrevPart",		NULL, N_("Previous part"), "Z", NULL, G_CALLBACK(goto_prev_part_cb) },
         {"View/Scroll",                 NULL, N_("Message scroll") },
         {"View/Scroll/PrevLine",        NULL, N_("Previous line"), NULL, NULL, G_CALLBACK(scroll_prev_line_cb) },
         {"View/Scroll/NextLine",        NULL, N_("Next line"), NULL, NULL, G_CALLBACK(scroll_next_line_cb) },
@@ -271,6 +284,12 @@
 
 	{"View/---",			NULL, "---", NULL, NULL, NULL },
 	{"View/MessageSource",		NULL, N_("Mess_age source"), "<control>U", NULL, G_CALLBACK(view_source_cb) },
+	{"View/Part",			NULL, N_("Message part") },
+	{"View/Part/AsText",		NULL, N_("View as text"), "T", NULL, G_CALLBACK(view_part_as_text_cb) },
+	{"View/Part/Open",		NULL, N_("Open"), "L", NULL, G_CALLBACK(open_part_cb) },
+#ifndef G_OS_WIN32
+	{"View/Part/OpenWith",		NULL, N_("Open with..."), "O", NULL, G_CALLBACK(open_part_with_cb) },
+#endif
 
 	{"View/Quotes",			NULL, N_("Quotes") }, 
 
@@ -288,6 +307,7 @@
 	{"Message/Forward",		NULL, N_("_Forward"), "<control><alt>F", NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_FORWARD_INLINE */
 	{"Message/ForwardAtt",		NULL, N_("For_ward as attachment"), NULL, NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_FORWARD_AS_ATTACH */
 	{"Message/Redirect",		NULL, N_("Redirec_t"), NULL, NULL, G_CALLBACK(reply_cb) }, /* COMPOSE_REDIRECT */
+	{"Message/CheckSignature",		NULL, N_("Check signature"), "C", NULL, G_CALLBACK(check_signature_cb) },
 
 /* Tools menu */	
 	{"Tools/AddressBook",		NULL, N_("_Address book"), "<control><shift>A", NULL, G_CALLBACK(addressbook_open_cb) }, 
@@ -474,9 +494,11 @@
 
 /* File menu */
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "SaveAs", "File/SaveAs", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "SavePartAs", "File/SavePartAs", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Separator1", "File/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "PageSetup", "File/PageSetup", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Print", "File/Print", GTK_UI_MANAGER_MENUITEM)
-	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Separator1", "File/---", GTK_UI_MANAGER_SEPARATOR)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Separator2", "File/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/File", "Close", "File/Close", GTK_UI_MANAGER_MENUITEM)
 
 /* Edit menu */
@@ -509,6 +531,9 @@
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator7", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextUnreadFolder", "View/Goto/NextUnreadFolder", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "OtherFolder", "View/Goto/OtherFolder", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "Separator8", "View/Goto/---", GTK_UI_MANAGER_SEPARATOR)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "NextPart", "View/Goto/NextPart", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Goto", "PrevPart", "View/Goto/PrevPart", GTK_UI_MANAGER_MENUITEM)
 
         MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Scroll", "View/Scroll", GTK_UI_MANAGER_MENU)
         MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Scroll", "PrevLine", "View/Scroll/PrevLine", GTK_UI_MANAGER_MENUITEM)
@@ -591,6 +616,12 @@
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "CollapseAll", "View/Quotes/CollapseAll", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "Collapse2", "View/Quotes/Collapse2", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Quotes", "Collapse3", "View/Quotes/Collapse3", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View", "Part", "View/Part", GTK_UI_MANAGER_MENU)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Part", "AsText", "View/Part/AsText", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Part", "Open", "View/Part/Open", GTK_UI_MANAGER_MENUITEM)
+#ifndef G_OS_WIN32
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/View/Part", "OpenWith", "View/Part/OpenWith", GTK_UI_MANAGER_MENUITEM)
+#endif
 
 /* Message menu */
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Compose", "Message/Compose", GTK_UI_MANAGER_MENUITEM)
@@ -604,6 +635,7 @@
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Forward", "Message/Forward", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "ForwardAtt", "Message/ForwardAtt", GTK_UI_MANAGER_MENUITEM)
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "Redirect", "Message/Redirect", GTK_UI_MANAGER_MENUITEM)
+	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Message", "CheckSignature", "Message/CheckSignature", GTK_UI_MANAGER_MENUITEM)
 
 /* Tools menu */
 	MENUITEM_ADDUI_MANAGER(msgview->ui_manager, "/Menu/Tools", "AddressBook", "Tools/AddressBook", GTK_UI_MANAGER_MENUITEM)
@@ -2945,6 +2977,8 @@
 	cm_toggle_menu_set_active_full(messageview->ui_manager, "Menu/View/Quotes/Collapse3", (prefs_common.hide_quotes == 3));
 	cm_menu_set_sensitive_full(messageview->ui_manager, "Menu/View/Goto/PrevHistory", messageview_nav_has_prev(messageview));
 	cm_menu_set_sensitive_full(messageview->ui_manager, "Menu/View/Goto/NextHistory", messageview_nav_has_next(messageview));
+
+	cm_menu_set_sensitive_full(messageview->ui_manager, "Menu/Message/CheckSignature", messageview->mimeview->signed_part);
 }
 
 void messageview_learn (MessageView *msgview, gboolean is_spam)
@@ -3007,3 +3041,60 @@
 	g_slist_free(newlist);
 	g_hash_table_destroy(uri_hashtable);
 }
+
+static void save_part_as_cb(GtkAction *action, gpointer data)
+{
+	MessageView *messageview = (MessageView *)data;
+
+	if (messageview->mimeview)
+		mimeview_save_as(messageview->mimeview);
+}
+
+static void view_part_as_text_cb(GtkAction *action, gpointer data)
+{
+	MessageView *messageview = (MessageView *)data;
+
+	if (messageview->mimeview)
+		mimeview_display_as_text(messageview->mimeview);
+}
+
+static void open_part_cb(GtkAction *action, gpointer data)
+{
+	MessageView *messageview = (MessageView *)data;
+
+	if (messageview->mimeview)
+		mimeview_launch(messageview->mimeview, NULL);
+}
+#ifndef G_OS_WIN32
+static void open_part_with_cb(GtkAction *action, gpointer data)
+{
+	MessageView *messageview = (MessageView *)data;
+
+	if (messageview->mimeview)
+		mimeview_open_with(messageview->mimeview);
+}
+#endif
+static void check_signature_cb(GtkAction *action, gpointer data)
+{
+	MessageView *messageview = (MessageView *)data;
+
+	if (messageview->mimeview)
+		mimeview_check_signature(messageview->mimeview);
+}
+
+static void goto_next_part_cb(GtkAction *action, gpointer data)
+{
+	MessageView *messageview = (MessageView *)data;
+
+	if (messageview->mimeview)
+		mimeview_select_next_part(messageview->mimeview);
+}
+
+static void goto_prev_part_cb(GtkAction *action, gpointer data)
+{
+	MessageView *messageview = (MessageView *)data;
+
+	if (messageview->mimeview)
+		mimeview_select_prev_part(messageview->mimeview);
+}
+



More information about the Commits mailing list