Thanks for all the feedback. That makes it pretty straight forward. >But I tried this patch , but here i got a problem , > >When terminal is opened with "F4" , have you tried to close that >Thunar Window ? It's unable to be closed. > >And multiple terminal (Press F4 for more than one time won't work ..) > >A better implemention could be like this:
I screwed up. The wait() should not have been there. Your implementation is much better. It works on my Debian Wheezy. On Sun, Nov 6, 2011 at 10:38 PM, Harald Judt <h.j...@gmx.at> wrote: > Am 06.11.2011 16:39, schrieb Jogy Antony: >> > > I haven't tried it, but the first thing that caught my eye was that the > patch doesn't take into account the user's perference for the terminal > application. Maybe consider using 'exo-open --launch TerminalEmulator > --working-directory <dir>' instead? > > -- > `Experience is the best teacher.' > _______________________________________________ > Xfce4-dev mailing list > xfce4-...@xfce.org > https://mail.xfce.org/mailman/listinfo/xfce4-dev >
diff --git a/thunar/thunar-window.c b/thunar/thunar-window.c index a42d982..411a5fa 100644 --- a/thunar/thunar-window.c +++ b/thunar/thunar-window.c @@ -62,7 +62,8 @@ #include <thunar/thunar-window-ui.h> #include <glib.h> - +#include <stdio.h> +#include <stdlib.h> /* Property identifiers */ @@ -78,6 +79,7 @@ enum /* Signal identifiers */ enum { + OPEN_TERMHERE, BACK, RELOAD, TOGGLE_SIDEPANE, @@ -99,6 +101,7 @@ static void thunar_window_set_property (GObject guint prop_id, const GValue *value, GParamSpec *pspec); +static gboolean thunar_window_open_term (ThunarWindow *window); static gboolean thunar_window_back (ThunarWindow *window); static gboolean thunar_window_reload (ThunarWindow *window); static gboolean thunar_window_toggle_sidepane (ThunarWindow *window); @@ -216,6 +219,7 @@ struct _ThunarWindowClass GtkWindowClass __parent__; /* internal action signals */ + gboolean (*open_term) (ThunarWindow *window); gboolean (*back) (ThunarWindow *window); gboolean (*reload) (ThunarWindow *window); gboolean (*toggle_sidepane) (ThunarWindow *window); @@ -342,7 +346,12 @@ static guint window_signals[LAST_SIGNAL]; G_DEFINE_TYPE_WITH_CODE (ThunarWindow, thunar_window, GTK_TYPE_WINDOW, G_IMPLEMENT_INTERFACE (THUNAR_TYPE_BROWSER, NULL)) - +static gboolean thunar_window_open_term(ThunarWindow *window) { + gchar *command = g_strdup_printf("exo-open --launch TerminalEmulator --working-directory %s" , g_file_get_path(window->current_directory->gfile) ); + gboolean ret = g_spawn_command_line_async(command , NULL); + free(command); + return ret; +} static void thunar_window_class_init (ThunarWindowClass *klass) @@ -361,7 +370,9 @@ thunar_window_class_init (ThunarWindowClass *klass) gtkwidget_class->realize = thunar_window_realize; gtkwidget_class->unrealize = thunar_window_unrealize; gtkwidget_class->configure_event = thunar_window_configure_event; - + + + klass->open_term = thunar_window_open_term; klass->back = thunar_window_back; klass->reload = thunar_window_reload; klass->toggle_sidepane = thunar_window_toggle_sidepane; @@ -426,6 +437,17 @@ thunar_window_class_init (ThunarWindowClass *klass) THUNAR_ZOOM_LEVEL_NORMAL, EXO_PARAM_READWRITE)); + window_signals[OPEN_TERMHERE] = + g_signal_new (I_("open_term"), + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (ThunarWindowClass, open_term), + g_signal_accumulator_true_handled, NULL, + _thunar_marshal_BOOLEAN__VOID, + G_TYPE_BOOLEAN, 0); + + + /** * ThunarWindow::back: * @window : a #ThunarWindow instance. @@ -527,6 +549,7 @@ thunar_window_class_init (ThunarWindowClass *klass) /* setup the key bindings for the windows */ binding_set = gtk_binding_set_by_class (klass); + gtk_binding_entry_add_signal (binding_set, GDK_F4, 0, "open_term", 0); gtk_binding_entry_add_signal (binding_set, GDK_BackSpace, 0, "back", 0); gtk_binding_entry_add_signal (binding_set, GDK_F5, 0, "reload", 0); gtk_binding_entry_add_signal (binding_set, GDK_F9, 0, "toggle-sidepane", 0);
_______________________________________________ Thunar-dev mailing list Thunar-dev@xfce.org https://mail.xfce.org/mailman/listinfo/thunar-dev