Branch: refs/heads/document-messages Author: Colomban Wendling ban@herbesfolles.org Committer: Jiří Techet techet@gmail.com Date: Sat, 24 Dec 2011 11:30:58 Commit: 23eede529178e3dc058d777f35c34d8de2d8cbab https://github.com/geany/geany/commit/23eede529178e3dc058d777f35c34d8de2d8cb...
Log Message: ----------- Make switch to MRU upon tab close configurable
Add configuration option tab_close_switch_to_mru to allow the user to choose whether to switch to the most recently used tab or to the next one after closing the current tab.
Modified Paths: -------------- data/geany.glade src/document.h src/keybindings.c src/keyfile.c
Modified: data/geany.glade 12 files changed, 12 insertions(+), 0 deletions(-) =================================================================== @@ -2117,6 +2117,18 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="check_tab_close_switch_to_mru"> + <property name="label" translatable="yes">Switch to last used document after closing a tab</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="position">4</property> + </packing> + </child> </object> </child> </object>
Modified: src/document.h 1 files changed, 1 insertions(+), 0 deletions(-) =================================================================== @@ -62,6 +62,7 @@ gboolean gio_unsafe_save_backup; gboolean use_gio_unsafe_file_saving; /* whether to use GIO as the unsafe backend */ gchar *extract_filetype_regex; /* regex to extract filetype on opening */ + gboolean tab_close_switch_to_mru; } GeanyFilePrefs;
Modified: src/keybindings.c 23 files changed, 17 insertions(+), 6 deletions(-) =================================================================== @@ -632,15 +632,26 @@ static void on_document_close(GObject *obj, GeanyDocument *doc) { if (! main_status.quitting) { - GeanyDocument *last_doc; + /* switch to appropriate page when closing current doc */ + if (document_get_current() == doc) + { + gint page;
- last_doc = g_queue_peek_nth(mru_docs, 1); + page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook)) + + (file_prefs.tab_order_ltr ? 1 : -1);
- if (DOC_VALID(last_doc) && document_get_current() == doc) - { - gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), - document_get_notebook_page(last_doc)); + if (file_prefs.tab_close_switch_to_mru) + { + GeanyDocument *last_doc; + + last_doc = g_queue_peek_nth(mru_docs, 1); + if (DOC_VALID(last_doc)) + page = document_get_notebook_page(last_doc); + } + + gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), page); } + g_queue_remove(mru_docs, doc); /* this prevents the pop up window from showing when there's a single * document */
Modified: src/keyfile.c 2 files changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -139,6 +139,8 @@ static void init_pref_groups(void)
stash_group_add_toggle_button(group, &interface_prefs.notebook_double_click_hides_widgets, "notebook_double_click_hides_widgets", FALSE, "check_double_click_hides_widgets"); + stash_group_add_toggle_button(group, &file_prefs.tab_close_switch_to_mru, + "tab_close_switch_to_mru", FALSE, "check_tab_close_switch_to_mru"); stash_group_add_integer(group, &interface_prefs.tab_pos_sidebar, "tab_pos_sidebar", GTK_POS_TOP); stash_group_add_radio_buttons(group, &interface_prefs.sidebar_pos, "sidebar_pos", GTK_POS_LEFT,
@@ Diff output truncated at 100000 characters. @@
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).