2006-07-07 [paul] 2.3.1cvs67
authorPaul Mangan <paul@claws-mail.org>
Fri, 7 Jul 2006 08:20:23 +0000 (08:20 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 7 Jul 2006 08:20:23 +0000 (08:20 +0000)
* 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

ChangeLog
PATCHSETS
configure.ac
src/action.c
src/common/utils.c
src/mimeview.c
src/mimeview.h
src/textview.c

index 0309cd0f7366d469c4c0332530c9078cb4872782..44784d03fb19e87cc48415b4f8c170b1cecb350b 100644 (file)
--- 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
index 72ae088ed98f07ab44e8e6864ab95816e192366f..3a1fdee39ebf2670ab9dd7f92deafad927f316e9 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index bd68bf52d7bd025986a9a978770487caa231bac2..b0d99c3d035d2306531c862a485ff8024cb13323 100644 (file)
@@ -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=
 
index da91ae664975a1058c40aad6ca19a51b69436700..9f9dd05c343b58b546730b3db7369ff568f70abb 100644 (file)
@@ -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;
 }
index 33e160f8acc774f79866848e892a034fa1fda58f..604ea0cf7c6a102b149e5fc07a8e912f774638f0 100644 (file)
@@ -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++;
index b3fa79926720ec573212fcd82e3ff9416a2e3a7a..5ee7a17a08163634c47abbaa3ff7402cfaf60473 100644 (file)
@@ -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);
        }
 }
 
index 7282f644d0f9cbd548dcebf18ab985d226198959..b3ad486d45cdc97c5235f2de2ab339a2e1cebcb7 100644 (file)
@@ -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);
 
 
index 9b81b69332f2bc39f43589f6e35cd3bf42796a7e..df80a1230628c6c8f9f25a13a67e265df8d778f1 100644 (file)
@@ -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) {