Revision: 1717
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1717&view=rev
Author:   nadvornik
Date:     2009-05-31 11:08:00 +0000 (Sun, 31 May 2009)

Log Message:
-----------
do not block the files sent to external editors like gimp

Modified Paths:
--------------
    trunk/src/editors.c
    trunk/src/editors.h
    trunk/src/utilops.c

Modified: trunk/src/editors.c
===================================================================
--- trunk/src/editors.c 2009-05-30 20:18:22 UTC (rev 1716)
+++ trunk/src/editors.c 2009-05-31 11:08:00 UTC (rev 1717)
@@ -1282,6 +1282,23 @@
        return !!(editor->flags & EDITOR_NO_PARAM);
 }
 
+gboolean editor_blocks_file(const gchar *key)
+{
+       EditorDescription *editor;
+       if (!key) return FALSE;
+       
+       editor = g_hash_table_lookup(editors, key);
+       if (!editor) return FALSE;
+
+       /* Decide if the image file should be blocked during editor execution
+          Editors like gimp can be used long time after the original file was
+          saved, for editing unrelated files.
+          %f vs. %F seems to be a good heuristic to detect this kind of 
editors.
+       */
+          
+       return !(editor->flags & EDITOR_SINGLE_COMMAND);
+}
+
 const gchar *editor_get_error_str(EditorFlags flags)
 {
        if (flags & EDITOR_ERROR_EMPTY) return _("Editor template is empty.");

Modified: trunk/src/editors.h
===================================================================
--- trunk/src/editors.h 2009-05-30 20:18:22 UTC (rev 1716)
+++ trunk/src/editors.h 2009-05-31 11:08:00 UTC (rev 1717)
@@ -112,6 +112,8 @@
 const gchar *editor_get_name(const gchar *key);
 
 gboolean is_valid_editor_command(const gchar *key);
+gboolean editor_blocks_file(const gchar *key);
+
 EditorFlags editor_command_parse(const EditorDescription *editor, GList *list, 
gchar **output);
 
 #endif

Modified: trunk/src/utilops.c
===================================================================
--- trunk/src/utilops.c 2009-05-30 20:18:22 UTC (rev 1716)
+++ trunk/src/utilops.c 2009-05-31 11:08:00 UTC (rev 1717)
@@ -845,7 +845,18 @@
                        }
                else
                        {
-                       flags = 
start_editor_from_filelist_full(ud->external_command, ud->flist, 
file_util_perform_ci_cb, ud);
+                       if (editor_blocks_file(ud->external_command))
+                               {
+                               DEBUG_1("Starting %s and waiting for results", 
ud->external_command);
+                               flags = 
start_editor_from_filelist_full(ud->external_command, ud->flist, 
file_util_perform_ci_cb, ud);
+                               }
+                       else
+                               {
+                               /* start the editor without callback and finish 
the operation internally */
+                               DEBUG_1("Starting %s and finishing the 
operation", ud->external_command);
+                               flags = 
start_editor_from_filelist(ud->external_command, ud->flist);
+                               file_util_perform_ci_internal(ud);
+                               }
                        }
 
                if (flags)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to