Revision: 1653
http://geeqie.svn.sourceforge.net/geeqie/?rev=1653&view=rev
Author: nadvornik
Date: 2009-04-20 21:34:16 +0000 (Mon, 20 Apr 2009)
Log Message:
-----------
added remote interface for exporting additional info (sidecars,
destination) to external commands
see the symlink command for an example
http://sourceforge.net/tracker/?func=detail&aid=2488845&group_id=222125&atid=1054680
Modified Paths:
--------------
trunk/plugins/symlink/Makefile.am
trunk/plugins/symlink/symlink.desktop
trunk/src/remote.c
Added Paths:
-----------
trunk/plugins/symlink/geeqie-symlink
Modified: trunk/plugins/symlink/Makefile.am
===================================================================
--- trunk/plugins/symlink/Makefile.am 2009-04-20 21:07:52 UTC (rev 1652)
+++ trunk/plugins/symlink/Makefile.am 2009-04-20 21:34:16 UTC (rev 1653)
@@ -1,3 +1,4 @@
+dist_bin_SCRIPTS = geeqie-symlink
qq_desktopdir = $(pkgdatadir)/applications
qq_desktop_DATA = symlink.desktop
Added: trunk/plugins/symlink/geeqie-symlink
===================================================================
--- trunk/plugins/symlink/geeqie-symlink (rev 0)
+++ trunk/plugins/symlink/geeqie-symlink 2009-04-20 21:34:16 UTC (rev
1653)
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# This is a helper script that symlinks grouped files
+# it uses geeqie remote connection to get details about grouped files
+
+
+# iterate over files on commandline
+for file in "$@" ; do
+ # we got only one file for each group, typically the main one
+ # get the sidecars:
+ geeqie -r --get-sidecars:"$file" |while read sidecar ; do
+ # the main file is included in the sidecar file list, no special
handling is required
+ # get destination path for each sidecar file:
+ geeqie -r --get-destination:"$sidecar" | if read destination ; then
+ ln -s "$sidecar" "$destination"
+ fi
+ done
+done
Property changes on: trunk/plugins/symlink/geeqie-symlink
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/plugins/symlink/symlink.desktop
===================================================================
--- trunk/plugins/symlink/symlink.desktop 2009-04-20 21:07:52 UTC (rev
1652)
+++ trunk/plugins/symlink/symlink.desktop 2009-04-20 21:34:16 UTC (rev
1653)
@@ -4,11 +4,8 @@
Name=Symlink
#Name[cs]=
-# FIXME: this can't be an oneliner, it needs to be changed to a full
-# featured script in separate file, with error handling etc.
-# expansion of environment variables directly in Exec is not supported
-# by the specification and it will be removed
-Exec=ln -s %f "$GEEQIE_DESTINATION"
+# call the helper script
+Exec=geeqie-symlink %f
# Desktop files that are usable only in Geeqie should be marked like this:
Categories=X-Geeqie;
Modified: trunk/src/remote.c
===================================================================
--- trunk/src/remote.c 2009-04-20 21:07:52 UTC (rev 1652)
+++ trunk/src/remote.c 2009-04-20 21:34:16 UTC (rev 1653)
@@ -321,6 +321,7 @@
if (buffer[0] == '\n') /* empty line finishes
the command */
{
g_free(buffer);
+ fflush(stdout);
break;
}
buffer[termpos] = '\0';
@@ -528,6 +529,42 @@
g_free(filename);
}
+static void gr_get_sidecars(const gchar *text, GIOChannel *channel, gpointer
data)
+{
+ gchar *filename = expand_tilde(text);
+ FileData *fd = file_data_new_simple(filename);
+
+ GList *work;
+ if (fd->parent) fd = fd->parent;
+
+ g_io_channel_write_chars(channel, fd->path, -1, NULL, NULL);
+ g_io_channel_write_chars(channel, "\n", -1, NULL, NULL);
+
+ work = fd->sidecar_files;
+
+ while (work)
+ {
+ fd = work->data;
+ work = work->next;
+ g_io_channel_write_chars(channel, fd->path, -1, NULL, NULL);
+ g_io_channel_write_chars(channel, "\n", -1, NULL, NULL);
+ }
+ g_free(filename);
+}
+
+static void gr_get_destination(const gchar *text, GIOChannel *channel,
gpointer data)
+{
+ gchar *filename = expand_tilde(text);
+ FileData *fd = file_data_new_simple(filename);
+
+ if (fd->change && fd->change->dest)
+ {
+ g_io_channel_write_chars(channel, fd->change->dest, -1, NULL,
NULL);
+ g_io_channel_write_chars(channel, "\n", -1, NULL, NULL);
+ }
+ g_free(filename);
+}
+
static void gr_file_view(const gchar *text, GIOChannel *channel, gpointer data)
{
gchar *filename = expand_tilde(text);
@@ -615,6 +652,8 @@
{ "-t", "--tools-hide", gr_tools_hide, FALSE, TRUE,
N_("hide tools") },
{ "-q", "--quit", gr_quit, FALSE, FALSE,
N_("quit") },
{ NULL, "--config-load:", gr_config_load, TRUE, FALSE,
N_("load config file") },
+ { NULL, "--get-sidecars:", gr_get_sidecars, TRUE, FALSE,
N_("get list of sidecars of the given file") },
+ { NULL, "--get-destination:", gr_get_destination, TRUE, FALSE,
N_("get destination path for the given file") },
{ NULL, "file:", gr_file_load, TRUE, FALSE,
N_("open file") },
{ NULL, "view:", gr_file_view, TRUE, FALSE,
N_("open file in new window") },
{ NULL, "--list-clear", gr_list_clear, FALSE, FALSE,
NULL },
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn