aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2011-06-30 03:13:19 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2011-06-30 03:13:19 +0000
commit1f31e54aa7e0282d0ff5c61cc634cd6e0bd4d071 (patch)
treec8b5101f5312e4d414347938f16fe5d77a3c5453
parent99c8a36557261ae7148b30acebbbba7090d86210 (diff)
added 'Print' menu in mime part menu. Added part widget to message/rfc822 part.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2920 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog6
-rw-r--r--src/mimeview.c11
-rw-r--r--src/mimeview.h5
-rw-r--r--src/textview.c25
4 files changed, 41 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 6856e047..17f8d6c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-30
+
+ * src/textview.c
+ src/mimeview.[ch]: added 'Print' menu in mime part menu.
+ Added part widget to message/rfc822 part.
+
2011-06-29
* libsylph/socket.c: win32: supported IPv6 with fallback implementation
diff --git a/src/mimeview.c b/src/mimeview.c
index 1fa10517..b4a84a93 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2010 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2011 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1095,6 +1095,15 @@ void mimeview_print(MimeView *mimeview)
partinfo = mimeview_get_selected_part(mimeview);
g_return_if_fail(partinfo != NULL);
+ mimeview_print_part(mimeview, partinfo);
+}
+
+void mimeview_print_part(MimeView *mimeview, MimeInfo *partinfo)
+{
+ g_return_if_fail(partinfo != NULL);
+
+ if (!mimeview->file) return;
+
if (partinfo->mime_type == MIME_MESSAGE_RFC822) {
gchar *filename;
MsgInfo *msginfo;
diff --git a/src/mimeview.h b/src/mimeview.h
index 1dca1a19..6cebcf39 100644
--- a/src/mimeview.h
+++ b/src/mimeview.h
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2011 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -101,4 +101,7 @@ void mimeview_open_part_with (MimeView *mimeview,
void mimeview_save_part_as (MimeView *mimeview,
MimeInfo *partinfo);
+void mimeview_print_part (MimeView *mimeview,
+ MimeInfo *partinfo);
+
#endif /* __MIMEVIEW_H__ */
diff --git a/src/textview.c b/src/textview.c
index 8c16942a..bb8f8061 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -632,6 +632,7 @@ enum {
PART_MENU_OPEN,
PART_MENU_OPEN_WITH,
PART_MENU_SAVE_AS,
+ PART_MENU_PRINT,
PART_MENU_COPY_FILENAME
};
@@ -707,12 +708,18 @@ static gboolean textview_part_widget_button_pressed(GtkWidget *widget,
for (cur = GTK_MENU_SHELL(menu)->children; cur != NULL; cur = cur->next) {
GtkWidget *menuitem = GTK_WIDGET(cur->data);
gint type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
- if (type == PART_MENU_COPY_FILENAME) {
+ if (type == PART_MENU_PRINT) {
+ if (mimeinfo->mime_type == MIME_TEXT ||
+ mimeinfo->mime_type == MIME_TEXT_HTML ||
+ mimeinfo->mime_type == MIME_MESSAGE_RFC822)
+ gtk_widget_set_sensitive(menuitem, TRUE);
+ else
+ gtk_widget_set_sensitive(menuitem, FALSE);
+ } else if (type == PART_MENU_COPY_FILENAME) {
if (mimeinfo->filename || mimeinfo->name)
gtk_widget_set_sensitive(menuitem, TRUE);
else
gtk_widget_set_sensitive(menuitem, FALSE);
- break;
}
}
@@ -776,6 +783,9 @@ static void textview_part_menu_activated(GtkWidget *widget, gpointer data)
case PART_MENU_SAVE_AS:
mimeview_save_part_as(mimeview, mimeinfo);
break;
+ case PART_MENU_PRINT:
+ mimeview_print_part(mimeview, mimeinfo);
+ break;
case PART_MENU_COPY_FILENAME:
filename = mimeinfo->filename ? mimeinfo->filename :
mimeinfo->name ? mimeinfo->name : NULL;
@@ -816,7 +826,12 @@ static void textview_part_menu_create(TextView *textview)
MENUITEM_ADD_WITH_MNEMONIC(menu, menuitem, _("_Save as..."), PART_MENU_SAVE_AS);
g_signal_connect(G_OBJECT(menuitem), "activate",
G_CALLBACK(textview_part_menu_activated), textview);
+ MENUITEM_ADD_FROM_STOCK(menu, menuitem, GTK_STOCK_PRINT, PART_MENU_PRINT);
+ g_signal_connect(G_OBJECT(menuitem), "activate",
+ G_CALLBACK(textview_part_menu_activated), textview);
+
MENUITEM_ADD(menu, menuitem, NULL, 0);
+
MENUITEM_ADD_WITH_MNEMONIC(menu, menuitem, _("_Copy file name"), PART_MENU_COPY_FILENAME);
g_signal_connect(G_OBJECT(menuitem), "activate",
G_CALLBACK(textview_part_menu_activated), textview);
@@ -909,11 +924,13 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo, FILE *fp)
charset = textview_get_src_encoding(textview, mimeinfo);
if (mimeinfo->mime_type == MIME_MESSAGE_RFC822) {
- textview_insert_border(textview, &iter, 8);
+ g_snprintf(buf, sizeof(buf), "%s (%s)",
+ mimeinfo->content_type,
+ to_human_readable(mimeinfo->content_size));
+ textview_add_part_widget(textview, &iter, mimeinfo, buf);
gtk_text_buffer_get_end_iter(buffer, &iter);
headers = textview_scan_header(textview, fp, charset);
if (headers) {
- gtk_text_buffer_insert(buffer, &iter, "\n", 1);
textview_show_header(textview, headers);
procheader_header_array_destroy(headers);
}