<p></p>
<p><b>@eht16</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/2859#discussion_r688110422">src/callbacks.c</a>:</p>
<pre style='color:#555'>> @@ -335,6 +335,21 @@ void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data)
        document_reload_prompt(doc, NULL);
 }
 
+/* reload all files */
+void on_toolbutton_reload_all_clicked(GtkAction *action, gpointer user_data)
+{
+       guint i;
+       gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
+       
+       foreach_document(i)
+       {
+               if (! (documents[i]->file_name == NULL))
</pre>
<p>After having a closer look and some testing, the logic and dialog response handling is a litte wrong:<br>
combining the conditions to show the dialog and handling its response in a single if statement is error prone if not impossible. The current implementation doesn't work properly.</p>
<p>As a suggestion, I rewrote the condition handling as follows:</p>
<div class="highlight highlight-source-diff"><pre><span class="pl-c1">diff --git a/src/callbacks.c b/src/callbacks.c</span>
index acbd8737..487c48ac 100644
<span class="pl-md">--- a/src/callbacks.c</span>
<span class="pl-mi1">+++ b/src/callbacks.c</span>
<span class="pl-mdr">@@ -340,27 +340,35 @@</span> void on_reload_all(GtkAction *action, gpointer user_data)
 {
        guint i;
        gint cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.notebook));
<span class="pl-md"><span class="pl-md">-</span>  </span>
<span class="pl-mi1"><span class="pl-mi1">+</span></span>
        if (!file_prefs.keep_edit_history_on_reload)
        {
<span class="pl-mi1"><span class="pl-mi1">+</span>                GeanyDocument *doc;</span>
                foreach_document(i)
                {
<span class="pl-md"><span class="pl-md">-</span>                  if (!(documents[i]->changed || (document_can_undo(documents[i]) ||</span>
<span class="pl-md"><span class="pl-md">-</span>                  document_can_redo(documents[i]))) && dialogs_show_question_full(NULL,</span>
<span class="pl-md"><span class="pl-md">-</span>                  _("_Reload"), GTK_STOCK_CANCEL, _("Any unsaved changes will be lost."),</span>
<span class="pl-md"><span class="pl-md">-</span>                  _("Are you sure you want to reload all files?")))</span>
<span class="pl-md"><span class="pl-md">-</span>                          break;</span>
<span class="pl-md"><span class="pl-md">-</span>                  else</span>
<span class="pl-md"><span class="pl-md">-</span>                          return;</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                        doc = documents[i];</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                        if (doc->changed || document_can_undo(doc) || document_can_redo(doc))</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                        {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                if (dialogs_show_question_full(NULL, _("_Reload"), GTK_STOCK_CANCEL,</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                        _("Any unsaved changes will be lost."),</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                        _("Are you sure you want to reload all files?")))</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                        break; // break the loop and continue with reloading below</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                }</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                else</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                        return; // cancel reloading</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                                }</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>                        }</span>
                }
        }
<span class="pl-md"><span class="pl-md">-</span>  </span>
<span class="pl-mi1"><span class="pl-mi1">+</span></span>
        foreach_document(i)
        {
                if (! (documents[i]->file_name == NULL))
                        document_reload_force(documents[i], documents[i]->encoding);
        }
<span class="pl-md"><span class="pl-md">-</span>  </span>
<span class="pl-mi1"><span class="pl-mi1">+</span></span>
        gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook), cur_page);
 } </pre></div>
<p>This is a bit more verbose but IMO easier to read and understand.</p>
<p>Btw, stripping trailing spaces is always a good idea (at least for Geany code :D).</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/pull/2859#discussion_r688110422">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJYAXCXQUU5CMMOS5QDT4Q7ILANCNFSM5BN3PO7A">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email">Android</a>.<img src="https://github.com/notifications/beacon/AAIOWJ5UVRFSNLURIHAWZSDT4Q7ILA5CNFSM5BN3PO7KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOFN2UVFA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/2859#discussion_r688110422",
"url": "https://github.com/geany/geany/pull/2859#discussion_r688110422",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>