From 29859a69b86bb4e5b24b2320e0397714fda09c07 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Tue, 3 Jun 2008 19:24:17 +0100 Subject: [PATCH] Xterm here works again. --- ROX-Filer/src/menu.c | 7 ++++++- ROX-Filer/src/run.c | 10 ---------- ROX-Filer/src/support.c | 14 ++++++++++++++ ROX-Filer/src/support.h | 2 ++ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/ROX-Filer/src/menu.c b/ROX-Filer/src/menu.c index dad1dff3..52d32b42 100644 --- a/ROX-Filer/src/menu.c +++ b/ROX-Filer/src/menu.c @@ -1693,14 +1693,19 @@ static void send_to(FilerWindow *filer_window) static void xterm_here(gpointer data, guint action, GtkWidget *widget) { const char *argv[] = {"sh", "-c", NULL, NULL}; + char *path; gboolean close = action; argv[2] = o_menu_xterm.value; g_return_if_fail(window_with_focus != NULL); - if (rox_spawn(window_with_focus->sym_path, argv) && close) + path = path_or_uri(window_with_focus->gfile); /* Bit hopeful maybe ;-) */ + + if (rox_spawn(path, argv) && close) gtk_widget_destroy(window_with_focus->window); + + g_free(path); } static void home_directory(gpointer data, guint action, GtkWidget *widget) diff --git a/ROX-Filer/src/run.c b/ROX-Filer/src/run.c index ea784e73..08a1288c 100644 --- a/ROX-Filer/src/run.c +++ b/ROX-Filer/src/run.c @@ -762,16 +762,6 @@ err: return success; } -static char *path_or_uri(GFile *path) -{ - char *retval; - - retval = g_file_get_path(path); - if (retval == NULL) - retval = g_file_get_uri(path); - return retval; -} - /* Returns FALSE is no run action is set for this type. */ static gboolean type_open(GFile *path, MIME_type *type) { diff --git a/ROX-Filer/src/support.c b/ROX-Filer/src/support.c index 2ede8a94..1801184c 100644 --- a/ROX-Filer/src/support.c +++ b/ROX-Filer/src/support.c @@ -1724,3 +1724,17 @@ gchar *build_command_with_path(const char *cmd, const char *path) return result; } + +/* Convert path to a local Unix pathname if possible, or to a URI if not. + * g_free the result. + */ +char *path_or_uri(GFile *path) +{ + char *retval; + + retval = g_file_get_path(path); + if (retval == NULL) + retval = g_file_get_uri(path); + return retval; +} + diff --git a/ROX-Filer/src/support.h b/ROX-Filer/src/support.h index a18fa0c4..7438598e 100644 --- a/ROX-Filer/src/support.h +++ b/ROX-Filer/src/support.h @@ -9,6 +9,7 @@ #define PRETTY_SIZE_LIMIT 10000 #define TIME_FORMAT "%T %d %b %Y" +#include #include XMLwrapper *xml_cache_load(const gchar *pathname); @@ -70,5 +71,6 @@ gboolean get_values_from_desktop_file(const char *path, const char *key, gchar **value, ...); gchar *build_command_with_path(const char *cmd, const char *path); +char *path_or_uri(GFile *path); #endif /* _SUPPORT_H */ -- 2.11.4.GIT