comparison src/editors.c @ 1753:ebfb5af3f5de

fixed editor list in popup menu - show an editor if any of selected files matches - added debug messages
author nadvornik
date Sun, 13 Sep 2009 21:08:40 +0000
parents a0e47436b552
children 650915809048
comparison
equal deleted inserted replaced
1752:843c4eb46e09 1753:ebfb5af3f5de
643 { 643 {
644 GString *string; 644 GString *string;
645 gchar *pathl; 645 gchar *pathl;
646 const gchar *p = NULL; 646 const gchar *p = NULL;
647 647
648 DEBUG_2("editor_command_path_parse: %s %d %d %s", fd->path, consider_sidecars, type, editor->key);
649
648 string = g_string_new(""); 650 string = g_string_new("");
649 651
650 if (type == PATH_FILE || type == PATH_FILE_URL) 652 if (type == PATH_FILE || type == PATH_FILE_URL)
651 { 653 {
652 GList *work = editor->ext_list; 654 GList *work = editor->ext_list;
703 if (pathl && !pathl[0]) /* empty string case */ 705 if (pathl && !pathl[0]) /* empty string case */
704 { 706 {
705 g_free(pathl); 707 g_free(pathl);
706 pathl = NULL; 708 pathl = NULL;
707 } 709 }
708 710
711 DEBUG_2("editor_command_path_parse: return %s", pathl);
709 return pathl; 712 return pathl;
710 } 713 }
711 714
712 static GString *append_quoted(GString *str, const char *s, gboolean single_quotes, gboolean double_quotes) 715 static GString *append_quoted(GString *str, const char *s, gboolean single_quotes, gboolean double_quotes)
713 { 716 {
747 const gchar *p; 750 const gchar *p;
748 GString *result = NULL; 751 GString *result = NULL;
749 gboolean escape = FALSE; 752 gboolean escape = FALSE;
750 gboolean single_quotes = FALSE; 753 gboolean single_quotes = FALSE;
751 gboolean double_quotes = FALSE; 754 gboolean double_quotes = FALSE;
755
756 DEBUG_2("editor_command_parse: %s %d %d", editor->key, consider_sidecars, !!output);
752 757
753 if (output) 758 if (output)
754 result = g_string_new(""); 759 result = g_string_new("");
755 760
756 if (editor->exec[0] == '\0') 761 if (editor->exec[0] == '\0')
819 } 824 }
820 pathl = editor_command_path_parse((FileData *)list->data, 825 pathl = editor_command_path_parse((FileData *)list->data,
821 consider_sidecars, 826 consider_sidecars,
822 (*p == 'f') ? PATH_FILE : PATH_FILE_URL, 827 (*p == 'f') ? PATH_FILE : PATH_FILE_URL,
823 editor); 828 editor);
829 if (!output)
830 {
831 /* just testing, check also the rest of the list (like with F and U)
832 any matching file is OK */
833 GList *work = list->next;
834
835 while (!pathl && work)
836 {
837 FileData *fd = work->data;
838 pathl = editor_command_path_parse(fd,
839 consider_sidecars,
840 (*p == 'f') ? PATH_FILE : PATH_FILE_URL,
841 editor);
842 work = work->next;
843 }
844 }
845
824 if (!pathl) 846 if (!pathl)
825 { 847 {
826 flags |= EDITOR_ERROR_NO_FILE; 848 flags |= EDITOR_ERROR_NO_FILE;
827 goto err; 849 goto err;
828 } 850 }