Skip to content

Commit

Permalink
Fix #201: Geeqie to pop to top of current windows when open up with -r
Browse files Browse the repository at this point in the history
#201

Additional remote option to bring Geeqie widow to the top when opening
image:

file:<file>  open <file>, bring Geeqie window to the top
File:<file>  open <file>, do not bring Geeqie window to the top
  • Loading branch information
Colin Clark committed Mar 27, 2017
1 parent acb8819 commit ecbdd1d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
24 changes: 15 additions & 9 deletions doc/docbook/GuideReferenceCommandLine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<table frame="all">
<tgroup cols="3" rowsep="1" colsep="1">
<thead rowsep="1" colsep="1">
<row >
<row>
<entry>Short Option</entry>
<entry>Long Option</entry>
<entry>Description</entry>
Expand Down Expand Up @@ -88,16 +88,17 @@
<section id="Remotecommands">
<title>Remote commands</title>
<para>The --remote command line option will send all entered commands to an existing Geeqie process, a new process will be started if one does not exist. These are the additional commands that can be used with the remote command:</para>
<table frame="all">
<tgroup cols="3" rowsep="1" colsep="1">
<thead rowsep="1" colsep="1">

<table frame="all">
<tgroup cols="3" rowsep="1" colsep="1">
<thead rowsep="1" colsep="1">
<row>
<entry>Short Option</entry>
<entry>Long Option</entry>
<entry>Description</entry>
</row></thead>
<tbody> <row>
</row>
</thead>
<tbody>
<row>
<entry>-n</entry>
<entry>--next</entry>
<entry>Change main window to display next image.</entry>
Expand Down Expand Up @@ -190,7 +191,12 @@
<row>
<entry />
<entry>file:&lt;file&gt;</entry>
<entry>Change main window to display &lt;file&gt;</entry>
<entry>Open &lt;file&gt; and bring Geeqie window to the top</entry>
</row>
<row>
<entry />
<entry>File:&lt;file&gt;</entry>
<entry>Open &lt;file&gt; and do not bring Geeqie window to the top</entry>
</row>
<row>
<entry />
Expand Down Expand Up @@ -222,4 +228,4 @@
</table>
<para />
</section>
</section>
</section>
13 changes: 11 additions & 2 deletions src/remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

static RemoteConnection *remote_client_open(const gchar *path);
static gint remote_client_send(RemoteConnection *rc, const gchar *text);
static void gr_raise(const gchar *text, GIOChannel *channel, gpointer data);


typedef struct _RemoteClient RemoteClient;
Expand Down Expand Up @@ -495,7 +496,7 @@ static void gr_quit(const gchar *text, GIOChannel *channel, gpointer data)
g_idle_add(gr_quit_idle_cb, NULL);
}

static void gr_file_load(const gchar *text, GIOChannel *channel, gpointer data)
static void gr_file_load_no_raise(const gchar *text, GIOChannel *channel, gpointer data)
{
gchar *filename = expand_tilde(text);

Expand Down Expand Up @@ -523,6 +524,13 @@ static void gr_file_load(const gchar *text, GIOChannel *channel, gpointer data)
g_free(filename);
}

static void gr_file_load(const gchar *text, GIOChannel *channel, gpointer data)
{
gr_file_load_no_raise(text, channel, data);

gr_raise(text, channel, data);
}

static void gr_file_tell(const gchar *text, GIOChannel *channel, gpointer data)
{
LayoutWindow *lw = NULL; /* NULL to force layout_valid() to do some magic */
Expand Down Expand Up @@ -674,7 +682,8 @@ static RemoteCommandEntry remote_commands[] = {
{ NULL, "--config-load:", gr_config_load, TRUE, FALSE, N_("<FILE>"), N_("load configuration from FILE") },
{ NULL, "--get-sidecars:", gr_get_sidecars, TRUE, FALSE, N_("<FILE>"), N_("get list of sidecars of FILE") },
{ NULL, "--get-destination:", gr_get_destination, TRUE, FALSE, N_("<FILE>"), N_("get destination path of FILE") },
{ NULL, "file:", gr_file_load, TRUE, FALSE, N_("<FILE>"), N_("open FILE") },
{ NULL, "file:", gr_file_load, TRUE, FALSE, N_("<FILE>"), N_("open FILE, bring Geeqie window to the top") },
{ NULL, "File:", gr_file_load_no_raise, TRUE, FALSE, N_("<FILE>"), N_("open FILE, do not bring Geeqie window to the top") },
{ NULL, "--tell", gr_file_tell, FALSE, FALSE, NULL, N_("print filename of current image") },
{ NULL, "view:", gr_file_view, TRUE, FALSE, N_("<FILE>"), N_("open FILE in new window") },
{ NULL, "--list-clear", gr_list_clear, FALSE, FALSE, NULL, N_("clear command line collection list") },
Expand Down

0 comments on commit ecbdd1d

Please sign in to comment.