2007-01-30 [colin] 2.7.2cvs7
authorColin Leroy <colin@colino.net>
Tue, 30 Jan 2007 17:15:04 +0000 (17:15 +0000)
committerColin Leroy <colin@colino.net>
Tue, 30 Jan 2007 17:15:04 +0000 (17:15 +0000)
* src/main.c
* src/compose.c
Handle local URIs to attach files (file:///...)
Fixes attaching files from Thunar for example

ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/main.c

index 67308dc..8e0801a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-30 [colin]     2.7.2cvs7
+
+       * src/main.c
+       * src/compose.c
+               Handle local URIs to attach files (file:///...)
+               Fixes attaching files from Thunar for example
+
 2007-01-30 [colin]     2.7.2cvs6
 
        * src/prefs_ext_prog.c
index 410d0fd..452321c 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.168 -r 1.274.2.169 src/mainwindow.c;  cvs diff -u -r 1.39.2.31 -r 1.39.2.32 src/mainwindow.h;  cvs diff -u -r 1.14.2.48 -r 1.14.2.49 src/plugins/trayicon/trayicon.c;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/trayicon/trayicon_prefs.c;  cvs diff -u -r 1.1.2.1 -r 1.1.2.2 src/plugins/trayicon/trayicon_prefs.h;  ) > 2.7.2cvs4.patchset
 ( cvs diff -u -r 1.53.2.22 -r 1.53.2.23 po/POTFILES.in;  cvs diff -u -r 1.1.2.2 -r 1.1.2.3 src/plugins/trayicon/trayicon_prefs.c;  ) > 2.7.2cvs5.patchset
 ( cvs diff -u -r 1.3.2.13 -r 1.3.2.14 src/prefs_ext_prog.c;  ) > 2.7.2cvs6.patchset
+( cvs diff -u -r 1.115.2.130 -r 1.115.2.131 src/main.c;  cvs diff -u -r 1.382.2.355 -r 1.382.2.356 src/compose.c;  ) > 2.7.2cvs7.patchset
index 321a694..7624354 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=7
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=6
+EXTRA_VERSION=7
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 06269cf..117e265 100644 (file)
@@ -3132,6 +3132,17 @@ static gboolean compose_attach_append(Compose *compose, const gchar *file,
        gboolean has_binary = FALSE;
 
        if (!is_file_exist(file)) {
+               gchar *file_from_uri = g_filename_from_uri(file, NULL, NULL);
+               gboolean result = FALSE;
+               if (file_from_uri && is_file_exist(file_from_uri)) {
+                       result = compose_attach_append(
+                                               compose, file_from_uri,
+                                               filename,
+                                               content_type);
+               }
+               g_free(file_from_uri);
+               if (result)
+                       return TRUE;
                alertpanel_error("File %s doesn't exist\n", filename);
                return FALSE;
        }
index 4c0b745..dfd4036 100644 (file)
@@ -1094,17 +1094,23 @@ static void parse_cmd_opt(int argc, char *argv[])
                        }
                } else if (!strncmp(argv[i], "--attach", 8)) {
                        const gchar *p = argv[i + 1];
-                       gchar *file;
+                       gchar *file = NULL;
 
                        while (p && *p != '\0' && *p != '-') {
                                if (!cmd.attach_files) {
                                        cmd.attach_files = g_ptr_array_new();
                                }
-                               if (*p != G_DIR_SEPARATOR) {
+                               if ((file = g_filename_from_uri(p, NULL, NULL)) != NULL) {
+                                       if (!is_file_exist(file)) {
+                                               g_free(file);
+                                               file = NULL;
+                                       }
+                               }
+                               if (file == NULL && *p != G_DIR_SEPARATOR) {
                                        file = g_strconcat(claws_get_startup_dir(),
                                                           G_DIR_SEPARATOR_S,
                                                           p, NULL);
-                               } else {
+                               } else if (file == NULL) {
                                        file = g_strdup(p);
                                }
                                g_ptr_array_add(cmd.attach_files, file);