Do not show document change notification dialog when MRU switch is in progress
When switching between MRU documents, Geany pops up a dialog about document change even for the intermediate non-final documents. This leads to both reload dialog and document switch dialog displayed at the same time and termination of document switching because the newly displayed dialog takes focus. This patch disables reload checks for the intermediate documents and forces reload check for the final document.
This commit is contained in:
parent
ec6798d761
commit
5cc8a96d44
@ -2891,7 +2891,8 @@ gboolean document_check_disk_status(GeanyDocument *doc, gboolean force)
|
||||
g_return_val_if_fail(doc != NULL, FALSE);
|
||||
|
||||
/* ignore remote files and documents that have never been saved to disk */
|
||||
if (file_prefs.disk_check_timeout == 0 || doc->real_path == NULL || doc->priv->is_remote)
|
||||
if (notebook_switch_in_progress() || file_prefs.disk_check_timeout == 0
|
||||
|| doc->real_path == NULL || doc->priv->is_remote)
|
||||
return FALSE;
|
||||
|
||||
use_gio_filemon = (doc->priv->monitor != NULL);
|
||||
|
@ -169,6 +169,8 @@ static gboolean on_key_release_event(GtkWidget *widget, GdkEventKey *ev, gpointe
|
||||
/* user may have rebound keybinding to a different modifier than Ctrl, so check all */
|
||||
if (switch_in_progress && is_modifier_key(ev->keyval))
|
||||
{
|
||||
GeanyDocument *doc;
|
||||
|
||||
switch_in_progress = FALSE;
|
||||
|
||||
if (switch_dialog)
|
||||
@ -177,8 +179,10 @@ static gboolean on_key_release_event(GtkWidget *widget, GdkEventKey *ev, gpointe
|
||||
switch_dialog = NULL;
|
||||
}
|
||||
|
||||
update_mru_docs_head(document_get_current());
|
||||
doc = document_get_current();
|
||||
update_mru_docs_head(doc);
|
||||
mru_pos = 0;
|
||||
document_check_disk_status(doc, TRUE);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -289,6 +293,12 @@ void notebook_switch_tablastused(void)
|
||||
}
|
||||
|
||||
|
||||
gboolean notebook_switch_in_progress(void)
|
||||
{
|
||||
return switch_in_progress;
|
||||
}
|
||||
|
||||
|
||||
static gboolean focus_sci(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||
{
|
||||
GeanyDocument *doc = document_get_current();
|
||||
|
@ -36,4 +36,8 @@ void notebook_remove_page(gint page_num);
|
||||
* previous tabs. */
|
||||
void notebook_switch_tablastused(void);
|
||||
|
||||
/* Returns TRUE when MRU tab switch is in progress (i.e. not at the final
|
||||
* document yet). */
|
||||
gboolean notebook_switch_in_progress(void);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user