diff --git a/ChangeLog b/ChangeLog index 0309cd0f7..44784d03f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2006-07-07 [paul] 2.3.1cvs67 + + * src/action.c + Return now Closes dialog + * src/mimeview.c + * src/mimeview.h + * src/textview.c + add contextual menu to mime parts listed + in the textview + Thank to Colin + * src/common/utils.c + reversal: ' is a valid character in URLs + 2006-07-06 [colin] 2.3.1cvs66 * src/remotefolder.h diff --git a/PATCHSETS b/PATCHSETS index 72ae088ed..3a1fdee39 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -1667,3 +1667,4 @@ ( cvs diff -u -r 1.5.2.33 -r 1.5.2.34 src/gtk/gtkutils.c; ) > 2.3.1cvs64.patchset ( cvs diff -u -r 1.213.2.103 -r 1.213.2.104 src/folder.c; cvs diff -u -r 1.179.2.126 -r 1.179.2.127 src/imap.c; cvs diff -u -r 1.105.2.62 -r 1.105.2.63 src/prefs_account.c; cvs diff -u -r 1.20.2.33 -r 1.20.2.34 src/common/utils.h; cvs diff -u -r 1.1.4.44 -r 1.1.4.45 src/etpan/imap-thread.c; ) > 2.3.1cvs65.patchset ( cvs diff -u -r 1.1.4.3 -r 1.1.4.4 src/remotefolder.h; ) > 2.3.1cvs66.patchset +( cvs diff -u -r 1.12.2.35 -r 1.12.2.36 src/action.c; cvs diff -u -r 1.83.2.75 -r 1.83.2.76 src/mimeview.c; cvs diff -u -r 1.20.2.10 -r 1.20.2.11 src/mimeview.h; cvs diff -u -r 1.96.2.123 -r 1.96.2.124 src/textview.c; cvs diff -u -r 1.36.2.71 -r 1.36.2.72 src/common/utils.c; ) > 2.3.1cvs67.patchset diff --git a/configure.ac b/configure.ac index bd68bf52d..b0d99c3d0 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=3 MICRO_VERSION=1 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=66 +EXTRA_VERSION=67 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/action.c b/src/action.c index da91ae664..9f9dd05c3 100644 --- a/src/action.c +++ b/src/action.c @@ -1073,7 +1073,8 @@ static void hide_io_dialog_cb(GtkWidget *w, gpointer data) static gint io_dialog_key_pressed_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { - if (event && event->keyval == GDK_Escape) + if (event && (event->keyval == GDK_Escape || + event->keyval == GDK_Return)) hide_io_dialog_cb(widget, data); return TRUE; } diff --git a/src/common/utils.c b/src/common/utils.c index 33e160f8a..604ea0cf7 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -4314,7 +4314,7 @@ gboolean get_uri_part(const gchar *start, const gchar *scanpos, for (ep_ = scanpos; *ep_ != '\0'; ep_++) { if (!g_ascii_isgraph(*(const guchar *)ep_) || !IS_ASCII(*(const guchar *)ep_) || - strchr("[]{}<>\"'", *ep_)) { + strchr("[]{}<>\"", *ep_)) { break; } else if (strchr("(", *ep_)) { parenthese_cnt++; diff --git a/src/mimeview.c b/src/mimeview.c index b3fa79926..5ee7a17a0 100644 --- a/src/mimeview.c +++ b/src/mimeview.c @@ -118,6 +118,8 @@ static void mimeview_save_as (MimeView *mimeview); static void mimeview_save_all (MimeView *mimeview); static void mimeview_launch (MimeView *mimeview); static void mimeview_open_with (MimeView *mimeview); +static void mimeview_open_part_with (MimeView *mimeview, + MimeInfo *partinfo); static void mimeview_view_file (const gchar *filename, MimeInfo *partinfo, const gchar *cmdline, @@ -1034,6 +1036,7 @@ static void mimeview_selected(GtkCTree *ctree, GtkCTreeNode *node, gint column, MimeInfo *partinfo; if (mimeview->opened == node) return; mimeview->opened = node; + mimeview->spec_part = NULL; gtk_ctree_node_moveto(ctree, node, -1, 0.5, 0); partinfo = gtk_ctree_node_get_row_data(ctree, node); @@ -1120,8 +1123,7 @@ static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event, mimeview_launch(mimeview); return TRUE; } else if (event->button == 3) { - if (partinfo && (partinfo->type == MIMETYPE_TEXT || - partinfo->type == MIMETYPE_MESSAGE || + if (partinfo && (partinfo->type == MIMETYPE_MESSAGE || partinfo->type == MIMETYPE_IMAGE || partinfo->type == MIMETYPE_MULTIPART)) menu_set_sensitive(mimeview->popupfactory, @@ -1316,7 +1318,7 @@ static void mimeview_drag_data_get(GtkWidget *widget, uriname = g_strconcat("file://", filename, "\r\n", NULL); gtk_selection_data_set(selection_data, selection_data->target, 8, - uriname, strlen(uriname)); + (guchar *)uriname, strlen(uriname)); g_free(uriname); g_free(filename); @@ -1464,6 +1466,25 @@ static void mimeview_save_all(MimeView *mimeview) prefs_common.attach_save_dir = g_strdup(dirname); } +static MimeInfo *mimeview_get_part_to_use(MimeView *mimeview) +{ + MimeInfo *partinfo = NULL; + if (mimeview->spec_part) { + partinfo = mimeview->spec_part; + mimeview->spec_part = NULL; + } else { + partinfo = mimeview_get_selected_part(mimeview); + if (!partinfo) { + partinfo = (MimeInfo *) g_object_get_data + (G_OBJECT(mimeview->popupmenu), + "pop_partinfo"); + g_object_set_data(G_OBJECT(mimeview->popupmenu), + "pop_partinfo", NULL); + } + } + + return partinfo; +} /** * Menu callback: Save the selected attachment * \param mimeview Current display @@ -1479,14 +1500,8 @@ static void mimeview_save_as(MimeView *mimeview) if (!mimeview->opened) return; if (!mimeview->file) return; - partinfo = mimeview_get_selected_part(mimeview); - if (!partinfo) { - partinfo = (MimeInfo *) g_object_get_data - (G_OBJECT(mimeview->popupmenu), - "pop_partinfo"); - g_object_set_data(G_OBJECT(mimeview->popupmenu), - "pop_partinfo", NULL); - } + partinfo = mimeview_get_part_to_use(mimeview); + g_return_if_fail(partinfo != NULL); if (get_part_name(partinfo) == NULL) { @@ -1534,15 +1549,8 @@ static void mimeview_display_as_text(MimeView *mimeview) if (!mimeview->opened) return; - partinfo = mimeview_get_selected_part(mimeview); - if (!partinfo) { - partinfo = (MimeInfo *) g_object_get_data - (G_OBJECT(mimeview->popupmenu), - "pop_partinfo"); - g_object_set_data(G_OBJECT(mimeview->popupmenu), - "pop_partinfo", NULL); - - } + partinfo = mimeview_get_part_to_use(mimeview); + g_return_if_fail(partinfo != NULL); mimeview_show_message_part(mimeview, partinfo); } @@ -1555,14 +1563,8 @@ static void mimeview_launch(MimeView *mimeview) if (!mimeview->opened) return; if (!mimeview->file) return; - partinfo = mimeview_get_selected_part(mimeview); - if (!partinfo) { - partinfo = (MimeInfo *) g_object_get_data - (G_OBJECT(mimeview->popupmenu), - "pop_partinfo"); - g_object_set_data(G_OBJECT(mimeview->popupmenu), - "pop_partinfo", NULL); - } + partinfo = mimeview_get_part_to_use(mimeview); + g_return_if_fail(partinfo != NULL); filename = procmime_get_tmp_file_name(partinfo); @@ -1579,23 +1581,23 @@ static void mimeview_launch(MimeView *mimeview) static void mimeview_open_with(MimeView *mimeview) { MimeInfo *partinfo; - gchar *filename; - gchar *cmd; - gchar *mime_command = NULL; - gchar *content_type = NULL; if (!mimeview) return; if (!mimeview->opened) return; if (!mimeview->file) return; - partinfo = mimeview_get_selected_part(mimeview); - if (!partinfo) { - partinfo = (MimeInfo *) g_object_get_data - (G_OBJECT(mimeview->popupmenu), - "pop_partinfo"); - g_object_set_data(G_OBJECT(mimeview->popupmenu), - "pop_partinfo", NULL); - } + partinfo = mimeview_get_part_to_use(mimeview); + + mimeview_open_part_with(mimeview, partinfo); +} + +static void mimeview_open_part_with(MimeView *mimeview, MimeInfo *partinfo) +{ + gchar *filename; + gchar *cmd; + gchar *mime_command = NULL; + gchar *content_type = NULL; + g_return_if_fail(partinfo != NULL); filename = procmime_get_tmp_file_name(partinfo); @@ -1667,7 +1669,7 @@ static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo, def_cmd = NULL; } else if (MIMETYPE_APPLICATION == partinfo->type && !g_ascii_strcasecmp(partinfo->subtype, "octet-stream")) { - mimeview_open_with(mimeview); + mimeview_open_part_with(mimeview, partinfo); return; } else if (MIMETYPE_IMAGE == partinfo->type) { cmd = prefs_common.mime_image_viewer; @@ -1698,13 +1700,13 @@ static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo, if (def_cmd) g_snprintf(buf, sizeof(buf), def_cmd, filename); else { - mimeview_open_with(mimeview); + mimeview_open_part_with(mimeview, partinfo); return; } } if (execute_command_line(buf, TRUE) != 0) - mimeview_open_with(mimeview); + mimeview_open_part_with(mimeview, partinfo); } void mimeview_register_viewer_factory(MimeViewerFactory *factory) @@ -2187,7 +2189,7 @@ void mimeview_update (MimeView *mimeview) { } } -void mimeview_handle_cmd(MimeView *mimeview, const gchar *cmd, gpointer data) +void mimeview_handle_cmd(MimeView *mimeview, const gchar *cmd, GdkEventButton *event, gpointer data) { MessageView *msgview = NULL; MainWindow *mainwin = NULL; @@ -2220,6 +2222,9 @@ void mimeview_handle_cmd(MimeView *mimeview, const gchar *cmd, gpointer data) icon_list_toggle_by_mime_info(mimeview, (MimeInfo *)data); icon_selected(mimeview, -1, (MimeInfo *)data); mimeview_launch(mimeview); + } else if (!strcmp(cmd, "sc://menu_attachment") && data != NULL) { + mimeview->spec_part = (MimeInfo *)data; + part_button_pressed(mimeview, event, (MimeInfo *)data); } } diff --git a/src/mimeview.h b/src/mimeview.h index 7282f644d..b3ad486d4 100644 --- a/src/mimeview.h +++ b/src/mimeview.h @@ -99,6 +99,7 @@ struct _MimeView #ifdef USE_PTHREAD SigCheckData *check_data; #endif + MimeInfo *spec_part; }; struct _MimeViewerFactory @@ -150,6 +151,7 @@ void mimeview_register_viewer_factory (MimeViewerFactory *factory); void mimeview_unregister_viewer_factory (MimeViewerFactory *factory); void mimeview_handle_cmd (MimeView *mimeview, const gchar *cmd, + GdkEventButton *event, gpointer data); diff --git a/src/textview.c b/src/textview.c index 9b81b6933..df80a1230 100644 --- a/src/textview.c +++ b/src/textview.c @@ -2098,11 +2098,14 @@ static gboolean textview_uri_button_pressed(GtkTextTag *tag, GObject *obj, (textview->messageview)? textview->messageview->mimeview:NULL; if (mimeview && bevent->button == 1) { - mimeview_handle_cmd(mimeview, uri->filename, uri->data); + mimeview_handle_cmd(mimeview, uri->filename, NULL, uri->data); } else if (mimeview && bevent->button == 2 && !g_ascii_strcasecmp(uri->filename, "sc://select_attachment")) { - mimeview_handle_cmd(mimeview, "sc://open_attachment", uri->data); - } + mimeview_handle_cmd(mimeview, "sc://open_attachment", NULL, uri->data); + } else if (mimeview && bevent->button == 3 && + !g_ascii_strcasecmp(uri->filename, "sc://select_attachment")) { + mimeview_handle_cmd(mimeview, "sc://menu_attachment", bevent, uri->data); + } return TRUE; } else if (!g_ascii_strncasecmp(uri->uri, "mailto:", 7)) { if (bevent->button == 3) {