Mercurial > geeqie
comparison src/remote.c @ 1556:3840882253fe
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
author | nadvornik |
---|---|
date | Mon, 20 Apr 2009 21:34:16 +0000 |
parents | a96a20c7feb1 |
children | 956aab097ea7 |
comparison
equal
deleted
inserted
replaced
1555:70f94d61b1aa | 1556:3840882253fe |
---|---|
319 if (buffer) | 319 if (buffer) |
320 { | 320 { |
321 if (buffer[0] == '\n') /* empty line finishes the command */ | 321 if (buffer[0] == '\n') /* empty line finishes the command */ |
322 { | 322 { |
323 g_free(buffer); | 323 g_free(buffer); |
324 fflush(stdout); | |
324 break; | 325 break; |
325 } | 326 } |
326 buffer[termpos] = '\0'; | 327 buffer[termpos] = '\0'; |
327 printf("%s\n", buffer); | 328 printf("%s\n", buffer); |
328 g_free(buffer); | 329 g_free(buffer); |
523 else | 524 else |
524 { | 525 { |
525 log_printf("remote sent filename that does not exist:\"%s\"\n", filename); | 526 log_printf("remote sent filename that does not exist:\"%s\"\n", filename); |
526 } | 527 } |
527 | 528 |
529 g_free(filename); | |
530 } | |
531 | |
532 static void gr_get_sidecars(const gchar *text, GIOChannel *channel, gpointer data) | |
533 { | |
534 gchar *filename = expand_tilde(text); | |
535 FileData *fd = file_data_new_simple(filename); | |
536 | |
537 GList *work; | |
538 if (fd->parent) fd = fd->parent; | |
539 | |
540 g_io_channel_write_chars(channel, fd->path, -1, NULL, NULL); | |
541 g_io_channel_write_chars(channel, "\n", -1, NULL, NULL); | |
542 | |
543 work = fd->sidecar_files; | |
544 | |
545 while (work) | |
546 { | |
547 fd = work->data; | |
548 work = work->next; | |
549 g_io_channel_write_chars(channel, fd->path, -1, NULL, NULL); | |
550 g_io_channel_write_chars(channel, "\n", -1, NULL, NULL); | |
551 } | |
552 g_free(filename); | |
553 } | |
554 | |
555 static void gr_get_destination(const gchar *text, GIOChannel *channel, gpointer data) | |
556 { | |
557 gchar *filename = expand_tilde(text); | |
558 FileData *fd = file_data_new_simple(filename); | |
559 | |
560 if (fd->change && fd->change->dest) | |
561 { | |
562 g_io_channel_write_chars(channel, fd->change->dest, -1, NULL, NULL); | |
563 g_io_channel_write_chars(channel, "\n", -1, NULL, NULL); | |
564 } | |
528 g_free(filename); | 565 g_free(filename); |
529 } | 566 } |
530 | 567 |
531 static void gr_file_view(const gchar *text, GIOChannel *channel, gpointer data) | 568 static void gr_file_view(const gchar *text, GIOChannel *channel, gpointer data) |
532 { | 569 { |
613 { "-d", "--delay=", gr_slideshow_delay, TRUE, FALSE, N_("set slide show delay in seconds") }, | 650 { "-d", "--delay=", gr_slideshow_delay, TRUE, FALSE, N_("set slide show delay in seconds") }, |
614 { "+t", "--tools-show", gr_tools_show, FALSE, TRUE, N_("show tools") }, | 651 { "+t", "--tools-show", gr_tools_show, FALSE, TRUE, N_("show tools") }, |
615 { "-t", "--tools-hide", gr_tools_hide, FALSE, TRUE, N_("hide tools") }, | 652 { "-t", "--tools-hide", gr_tools_hide, FALSE, TRUE, N_("hide tools") }, |
616 { "-q", "--quit", gr_quit, FALSE, FALSE, N_("quit") }, | 653 { "-q", "--quit", gr_quit, FALSE, FALSE, N_("quit") }, |
617 { NULL, "--config-load:", gr_config_load, TRUE, FALSE, N_("load config file") }, | 654 { NULL, "--config-load:", gr_config_load, TRUE, FALSE, N_("load config file") }, |
655 { NULL, "--get-sidecars:", gr_get_sidecars, TRUE, FALSE, N_("get list of sidecars of the given file") }, | |
656 { NULL, "--get-destination:", gr_get_destination, TRUE, FALSE, N_("get destination path for the given file") }, | |
618 { NULL, "file:", gr_file_load, TRUE, FALSE, N_("open file") }, | 657 { NULL, "file:", gr_file_load, TRUE, FALSE, N_("open file") }, |
619 { NULL, "view:", gr_file_view, TRUE, FALSE, N_("open file in new window") }, | 658 { NULL, "view:", gr_file_view, TRUE, FALSE, N_("open file in new window") }, |
620 { NULL, "--list-clear", gr_list_clear, FALSE, FALSE, NULL }, | 659 { NULL, "--list-clear", gr_list_clear, FALSE, FALSE, NULL }, |
621 { NULL, "--list-add:", gr_list_add, TRUE, FALSE, NULL }, | 660 { NULL, "--list-add:", gr_list_add, TRUE, FALSE, NULL }, |
622 { NULL, "raise", gr_raise, FALSE, FALSE, NULL }, | 661 { NULL, "raise", gr_raise, FALSE, FALSE, NULL }, |