From 19e24fb5ee53cb70de02669fc2d1dc0cdbd82c11 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sat, 24 May 2014 16:53:59 +0200 Subject: [PATCH] infobars: Dismiss the info bar when reloading via toolbar button/keybinding. --- src/document.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/document.c b/src/document.c index a5088907..0ea14a8c 100644 --- a/src/document.c +++ b/src/document.c @@ -1372,6 +1372,10 @@ gboolean document_reload_file(GeanyDocument *doc, const gchar *forced_enc) g_return_val_if_fail(doc != NULL, FALSE); + /* Use cancel because the response handler would call this recursively */ + if (doc->priv->info_bars[MSG_TYPE_RELOAD] != NULL) + gtk_info_bar_response(GTK_INFO_BAR(doc->priv->info_bars[MSG_TYPE_RELOAD]), GTK_RESPONSE_CANCEL); + /* try to set the cursor to the position before reloading */ pos = sci_get_current_position(doc->editor->sci); new_doc = document_open_file_full(doc, NULL, pos, doc->readonly, doc->file_type, forced_enc); @@ -3148,11 +3152,10 @@ static GtkWidget* document_show_message(GeanyDocument *doc, GtkMessageType msgty static void on_monitor_reload_file_response(GtkWidget *bar, gint response_id, GeanyDocument *doc) { unprotect_document(doc); + doc->priv->info_bars[MSG_TYPE_RELOAD] = NULL; if (response_id == GTK_RESPONSE_ACCEPT) document_reload_file(doc, doc->encoding); - - doc->priv->info_bars[MSG_TYPE_RELOAD] = NULL; } static gboolean on_sci_key(GtkWidget *w, GdkEventKey *event, gpointer data)