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.
This commit is contained in:
parent
f6be8b47d7
commit
23eede5291
@ -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>
|
||||
|
@ -62,6 +62,7 @@ typedef struct GeanyFilePrefs
|
||||
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;
|
||||
|
||||
|
@ -632,15 +632,26 @@ static void on_document_close(GObject *obj, GeanyDocument *doc)
|
||||
{
|
||||
if (! main_status.quitting)
|
||||
{
|
||||
GeanyDocument *last_doc;
|
||||
|
||||
last_doc = g_queue_peek_nth(mru_docs, 1);
|
||||
|
||||
if (DOC_VALID(last_doc) && document_get_current() == doc)
|
||||
/* switch to appropriate page when closing current doc */
|
||||
if (document_get_current() == doc)
|
||||
{
|
||||
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),
|
||||
document_get_notebook_page(last_doc));
|
||||
gint page;
|
||||
|
||||
page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook)) +
|
||||
(file_prefs.tab_order_ltr ? 1 : -1);
|
||||
|
||||
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 */
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user