diff --git a/ChangeLog b/ChangeLog index 5ff13ee6..c19b9373 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,8 @@ Little redesign of the preferences dialog. New options for setting the placement of notebook tabs. * doc/Makefile.am: Minor improvements. + * src/keyfile.c, src/geany.h, src/prefs.c, src/vte.c, src/callbacks.c, + src/dialogs.c: Added option to disable the VTE follows path feature. 2006-07-02 Nick Treleaven diff --git a/src/callbacks.c b/src/callbacks.c index a94ead91..150e1727 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -766,19 +766,18 @@ on_notebook1_switch_page_after (GtkNotebook *notebook, } #ifdef HAVE_VTE + if (app->have_vte && vc->follow_path && doc_list[idx].file_name != NULL) + { gchar *path; gchar *cmd; - if (app->have_vte && doc_list[idx].file_name != NULL) - { - path = g_path_get_dirname(doc_list[idx].file_name); - cmd = g_strconcat("cd ", path, "\n", "clear\n", NULL); - vte_send_cmd(cmd); - g_free(path); - g_free(cmd); - } + path = g_path_get_dirname(doc_list[idx].file_name); + cmd = g_strconcat("cd ", path, "\n", NULL); + vte_send_cmd(cmd); + g_free(path); + g_free(cmd); + } #endif - } diff --git a/src/dialogs.c b/src/dialogs.c index 0aacddbd..fd558c8d 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -1646,7 +1646,7 @@ void dialogs_show_prefs_dialog(void) #ifdef HAVE_VTE GtkWidget *notebook, *vbox, *label, *alignment, *table; GtkWidget *font_term, *color_fore, *color_back, *spin_scrollback, *entry_emulation; - GtkWidget *check_scroll_key, *check_scroll_out; + GtkWidget *check_scroll_key, *check_scroll_out, *check_follow_path; GtkTooltips *tooltips; GtkObject *spin_scrollback_adj; #endif @@ -1686,7 +1686,7 @@ void dialogs_show_prefs_dialog(void) gtk_box_pack_start(GTK_BOX(vbox), alignment, FALSE, FALSE, 0); gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 12, 6); - table = gtk_table_new(7, 2, FALSE); + table = gtk_table_new(8, 2, FALSE); gtk_container_add(GTK_CONTAINER(alignment), table); gtk_table_set_row_spacings(GTK_TABLE(table), 3); gtk_table_set_col_spacings(GTK_TABLE(table), 25); @@ -1770,6 +1770,13 @@ void dialogs_show_prefs_dialog(void) gtk_tooltips_set_tip(tooltips, check_scroll_out, _("Whether to scroll to the bottom if an output was generated."), NULL); gtk_button_set_focus_on_click(GTK_BUTTON(check_scroll_out), FALSE); + check_follow_path = gtk_check_button_new_with_mnemonic(_("Follow the path of the current file")); + gtk_table_attach(GTK_TABLE(table), check_follow_path, 1, 2, 7, 8, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip(tooltips, check_follow_path, _("Whether to execute \"cd $path\" when you switch between opened files."), NULL); + gtk_button_set_focus_on_click(GTK_BUTTON(check_follow_path), FALSE); + label = gtk_label_new(_("Terminal")); gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook), gtk_notebook_get_nth_page( GTK_NOTEBOOK(notebook), 6), label); @@ -1788,6 +1795,8 @@ void dialogs_show_prefs_dialog(void) gtk_widget_ref(check_scroll_key), (GDestroyNotify) gtk_widget_unref); g_object_set_data_full(G_OBJECT(app->prefs_dialog), "check_scroll_out", gtk_widget_ref(check_scroll_out), (GDestroyNotify) gtk_widget_unref); + g_object_set_data_full(G_OBJECT(app->prefs_dialog), "check_follow_path", + gtk_widget_ref(check_follow_path), (GDestroyNotify) gtk_widget_unref); gtk_widget_show_all(vbox); diff --git a/src/geany.h b/src/geany.h index 326a999d..46c822bd 100644 --- a/src/geany.h +++ b/src/geany.h @@ -180,6 +180,7 @@ typedef struct MyApp gboolean load_vte; gboolean have_vte; gchar *lib_vte; + gchar *terminal_settings; #endif gchar *long_line_color; gchar *pref_template_developer; @@ -192,7 +193,6 @@ typedef struct MyApp gchar *msgwin_font; gchar *configdir; gchar *search_text; - gchar *terminal_settings; gchar build_make_custopt[256]; gchar *tools_browser_cmd; gchar *tools_make_cmd; diff --git a/src/keyfile.c b/src/keyfile.c index eb249f9a..812284c0 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -106,7 +106,7 @@ void configuration_save(void) #ifdef HAVE_VTE g_key_file_set_boolean(config, PACKAGE, "load_vte", app->load_vte); g_key_file_set_comment(config, PACKAGE, "terminal_settings", - _(" VTE settings: FONT;FOREGROUND;BACKGROUND;scrollback;type;scroll on keystroke;scroll on output"), NULL); + _(" VTE settings: FONT;FOREGROUND;BACKGROUND;scrollback;type;scroll on keystroke;scroll on output;follow path of file"), NULL); g_key_file_set_string(config, PACKAGE, "terminal_settings", app->terminal_settings); #endif g_key_file_set_string(config, PACKAGE, "editor_font", app->editor_font); diff --git a/src/prefs.c b/src/prefs.c index 6fcc0f04..f235c0b5 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -298,6 +298,9 @@ void prefs_init_dialog(void) widget = lookup_widget(app->prefs_dialog, "check_scroll_out"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->scroll_on_out); + + widget = lookup_widget(app->prefs_dialog, "check_follow_path"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), vc->follow_path); } #endif } @@ -480,6 +483,9 @@ void on_prefs_button_clicked(GtkDialog *dialog, gint response, gpointer user_dat widget = lookup_widget(app->prefs_dialog, "check_scroll_out"); vc->scroll_on_out = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + widget = lookup_widget(app->prefs_dialog, "check_follow_path"); + vc->follow_path = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + g_free(app->terminal_settings); hex_color_fore = utils_get_hex_from_color(vc->color_fore); hex_color_back = utils_get_hex_from_color(vc->color_back); diff --git a/src/vte.c b/src/vte.c index 12c6e8f0..e162587e 100644 --- a/src/vte.c +++ b/src/vte.c @@ -287,12 +287,12 @@ void vte_apply_user_settings(void) static void vte_get_settings(void) { - gchar **values = g_strsplit(app->terminal_settings, ";", 7); + gchar **values = g_strsplit(app->terminal_settings, ";", 8); - if (g_strv_length(values) != 7) + if (g_strv_length(values) != 8) { - app->terminal_settings = g_strdup_printf("Monospace 10;#FFFFFF;#000000;500;xterm;true;true"); - values = g_strsplit(app->terminal_settings, ";", 7); + app->terminal_settings = g_strdup_printf("Monospace 10;#FFFFFF;#000000;500;xterm;true;true;false"); + values = g_strsplit(app->terminal_settings, ";", 8); } vc->font = g_strdup(values[0]); vc->color_fore = g_new0(GdkColor, 1); @@ -307,6 +307,7 @@ static void vte_get_settings(void) vc->scroll_on_key = utils_atob(values[5]); vc->scroll_on_out = utils_atob(values[6]); + vc->follow_path = utils_atob(values[7]); g_strfreev(values); } @@ -330,7 +331,7 @@ static void vte_popup_menu_clicked(GtkMenuItem *menuitem, gpointer user_data) case 2: { on_preferences1_activate(menuitem, NULL); - gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(app->prefs_dialog, "notebook2")), 5); + gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(app->prefs_dialog, "notebook2")), 6); break; } } diff --git a/src/vte.h b/src/vte.h index e143be52..d3d7e322 100644 --- a/src/vte.h +++ b/src/vte.h @@ -70,6 +70,7 @@ struct vte_conf GtkWidget *menu; gboolean scroll_on_key; gboolean scroll_on_out; + gboolean follow_path; gint scrollback_lines; gchar *emulation; gchar *font;