From c5f190f7257dcf5c054334a67be9e2d77708e112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Wed, 7 Nov 2007 17:16:28 +0000 Subject: [PATCH] Apply patch from Simone Denei to add a "Restart" item to the VTE popup menu in case running application hangs. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2031 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 6 ++++++ src/vte.c | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/ChangeLog b/ChangeLog index a81fef46..e8357d97 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-07 Enrico Tröger + + * src/vte.c: Apply patch from Simone Denei to add a "Restart" item to + the VTE popup menu in case running application hangs. + + 2007-11-06 Enrico Tröger * src/build.c: Enable stopping of Run command on Windows. diff --git a/src/vte.c b/src/vte.c index a65b2b78..264563d9 100644 --- a/src/vte.c +++ b/src/vte.c @@ -74,6 +74,7 @@ enum POPUP_COPY, POPUP_PASTE, POPUP_CHANGEPATH, + POPUP_RESTARTTERMINAL, POPUP_PREFERENCES }; @@ -298,6 +299,19 @@ static void vte_start(GtkWidget *widget) } +static void vte_restart(GtkWidget *widget) +{ + vte_get_working_directory(); // try to keep the working directory when restarting the VTE + if (pid > 0) + { + kill(pid, SIGINT); + pid = 0; + } + vf->vte_terminal_reset(VTE_TERMINAL(widget), TRUE, TRUE); + vte_start(widget); +} + + static gboolean vte_button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { if (event->button == 3) @@ -380,6 +394,12 @@ static void vte_popup_menu_clicked(GtkMenuItem *menuitem, gpointer user_data) vte_cwd(doc_list[idx].file_name, TRUE); break; } + case POPUP_RESTARTTERMINAL: + { + vte_restart(vc->vte); + break; + + } case POPUP_PREFERENCES: { GtkWidget *notebook; @@ -416,6 +436,11 @@ static GtkWidget *vte_create_popup_menu(void) gtk_container_add(GTK_CONTAINER(menu), item); g_signal_connect((gpointer)item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_CHANGEPATH)); + item = gtk_image_menu_item_new_with_label(_("Restart terminal")); + gtk_widget_show(item); + gtk_container_add(GTK_CONTAINER(menu), item); + g_signal_connect((gpointer)item, "activate", G_CALLBACK(vte_popup_menu_clicked), GINT_TO_POINTER(POPUP_RESTARTTERMINAL)); + item = gtk_separator_menu_item_new(); gtk_widget_show(item); gtk_container_add(GTK_CONTAINER(menu), item);