Fix #2979578 unable to open second pcmanfm instance in specific case.
authorHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sun, 18 Apr 2010 17:53:10 +0000 (01:53 +0800)
committerHong Jen Yee (PCMan) <pcman.tw@gmail.com>
Sun, 18 Apr 2010 17:53:10 +0000 (01:53 +0800)
TODO [new file with mode: 0644]
src/pcmanfm.c

diff --git a/TODO b/TODO
new file mode 100644 (file)
index 0000000..db8fcc9
--- /dev/null
+++ b/TODO
@@ -0,0 +1,6 @@
+Loadable modules:
+    support desktop painting module so there can be modules painting on the desktop window.
+
+Use fm_launch_paths for command line arguments handling.
+
+Add a new command line argument to change wallpaper mode.
index b5735bf..8e0860f 100644 (file)
@@ -239,8 +239,18 @@ inline static void ipc_buf_to_args(GByteArray* buf)
         for(i = 0; i < len; ++i)
         {
             char* file = buf_read_str(&p);
-            files_to_open[i] = fm_canonicalize_filename(file, cwd);
-            g_free(file);
+            char* scheme = g_uri_parse_scheme(file);
+            if(scheme) /* a valid URI */
+            {
+                /* FIXME: should we canonicalize URIs? and how about file:///? */
+                files_to_open[i] = file;
+                g_free(scheme);
+            }
+            else /* a file path */
+            {
+                files_to_open[i] = fm_canonicalize_filename(file, cwd);
+                g_free(file);
+            }
         }
         files_to_open[i] = NULL;
     }
@@ -356,6 +366,16 @@ void single_instance_finalize()
     unlink(lock_file);
 }
 
+static FmJobErrorAction on_file_info_job_error(FmFileInfoJob* job, GError* err, FmJobErrorSeverity severity, gpointer user_data)
+{
+    if(err->domain == G_IO_ERROR && err->code == G_IO_ERROR_NOT_MOUNTED)
+    {
+        FmPath* current = fm_file_info_job_get_current(job);
+        if( fm_mount_path(NULL, current, TRUE) )
+            return FM_JOB_RETRY;
+    }
+    return FM_JOB_CONTINUE;
+}
 
 gboolean pcmanfm_run()
 {
@@ -454,6 +474,7 @@ gboolean pcmanfm_run()
             }
             if(cwd)
                 fm_path_unref(cwd);
+            g_signal_connect(job, "error", G_CALLBACK(on_file_info_job_error), NULL);
             fm_job_run_sync_with_mainloop(job);
             infos = fm_list_peek_head_link(FM_FILE_INFO_JOB(job)->file_infos);
             fm_launch_files_simple(NULL, NULL, infos, pcmanfm_open_folder, NULL);