From b15515bdae6eb661d8ddb384a7a8e52e0b14b725 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sat, 27 Jun 2026 16:52:18 +0100 Subject: [PATCH 1/8] Fix spell.vala --- plugins/spell/spell.vala | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/spell/spell.vala b/plugins/spell/spell.vala index b9e56172f..193e023ad 100644 --- a/plugins/spell/spell.vala +++ b/plugins/spell/spell.vala @@ -72,18 +72,21 @@ public class Scratch.Plugins.Spell: Peas.ExtensionBase, Scratch.Services.Activat } if (language_list.length () == 0) { + // This fallback to the LC used but might fail. + spell.set_language (null); + var dialog = new Granite.MessageDialog ( _("No Suitable Dictionaries Were Found"), _("Please install at least one [aspell] dictionary."), new ThemedIcon ("dialog-warning"), Gtk.ButtonsType.CLOSE ); - dialog.run (); - dialog.destroy (); - - // This fallback to the LC used but might fail. - spell.set_language (null); - + dialog.response.connect (() => { + dialog.destroy (); + }); + // The following code does not depend on the dialog response + //so we can just show the dialog + dialog.show (); } else if (!exist_language) { this.lang_dict = language_list.first ().data; spell.set_language (lang_dict); From 25c3ec3387180e3709853a54482d727c350cfa26 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sat, 27 Jun 2026 16:58:56 +0100 Subject: [PATCH 2/8] FileView appchooser dialog --- src/FolderManager/FileView.vala | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/FolderManager/FileView.vala b/src/FolderManager/FileView.vala index f6f5ac420..f8f380012 100644 --- a/src/FolderManager/FileView.vala +++ b/src/FolderManager/FileView.vala @@ -511,14 +511,18 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane var dialog = new Gtk.AppChooserDialog (new Gtk.Window (), Gtk.DialogFlags.MODAL, file); dialog.deletable = false; - if (dialog.run () == Gtk.ResponseType.OK) { - var app_info = dialog.get_app_info (); - if (app_info != null) { - Utils.launch_app_with_file (app_info.get_id (), path); + dialog.response.connect ((res) => { + if (res == Gtk.ResponseType.OK) { + var app_info = dialog.get_app_info (); + if (app_info != null) { + Utils.launch_app_with_file (app_info.get_id (), path); + } } - } - dialog.destroy (); + dialog.destroy (); + }); + + dialog.show (); } private void action_execute_contract_with_file_path (SimpleAction action, Variant? param) { From 8edd97df639958726ebeaabd052744b8d9383fa2 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sat, 27 Jun 2026 17:01:03 +0100 Subject: [PATCH 3/8] Branch creation error dialog --- src/FolderManager/ProjectFolderItem.vala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/FolderManager/ProjectFolderItem.vala b/src/FolderManager/ProjectFolderItem.vala index 91c9117b2..654c61014 100644 --- a/src/FolderManager/ProjectFolderItem.vala +++ b/src/FolderManager/ProjectFolderItem.vala @@ -397,13 +397,14 @@ namespace Scratch.FolderManager { new ThemedIcon ("git"), Gtk.ButtonsType.CLOSE ) { - badge_icon = new ThemedIcon ("dialog-error") + badge_icon = new ThemedIcon ("dialog-error"), + modal = true }; dialog.transient_for = (Gtk.Window)(view.get_toplevel ()); dialog.response.connect (() => { dialog.destroy (); }); - dialog.run (); + dialog.show (); } } From 37becd242e6d78ef2828fa7746e2ad72b66122cc Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sat, 27 Jun 2026 17:04:28 +0100 Subject: [PATCH 4/8] Document save elsewhere dialog --- src/Services/Document.vala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Services/Document.vala b/src/Services/Document.vala index a20460ed1..4d7fdefa6 100644 --- a/src/Services/Document.vala +++ b/src/Services/Document.vala @@ -1044,7 +1044,8 @@ namespace Scratch.Services { Gtk.ButtonsType.NONE ) { badge_icon = new ThemedIcon ("dialog-question"), - transient_for = app_instance.active_window + transient_for = app_instance.active_window, + modal = true }; dialog.add_button (_("Ignore"), Gtk.ResponseType.REJECT); @@ -1077,7 +1078,7 @@ namespace Scratch.Services { }); }); - dialog.present (); + dialog.show (); } private void ask_external_changes ( From a610569ac5edb552458041e45be4c78e00796406 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sat, 27 Jun 2026 17:11:57 +0100 Subject: [PATCH 5/8] Document external changes dialog --- src/Services/Document.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Services/Document.vala b/src/Services/Document.vala index 4d7fdefa6..1d0b3fcfa 100644 --- a/src/Services/Document.vala +++ b/src/Services/Document.vala @@ -1095,8 +1095,8 @@ namespace Scratch.Services { new ThemedIcon ("dialog-warning"), Gtk.ButtonsType.NONE ) { - transient_for = app_instance.active_window - + transient_for = app_instance.active_window, + modal = true }; dialog.add_button (_("Continue"), Gtk.ResponseType.REJECT); @@ -1154,7 +1154,7 @@ namespace Scratch.Services { }); }); - dialog.present (); + dialog.show (); } // Set Undo/Redo action sensitive property public void check_undoable_actions () { From 8446a4c91736e42306f7b55c33bbaf58182d0839 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sat, 27 Jun 2026 17:16:46 +0100 Subject: [PATCH 6/8] MonitoredRepository dialogs --- src/Services/MonitoredRepository.vala | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Services/MonitoredRepository.vala b/src/Services/MonitoredRepository.vala index b0ab88519..00317fc53 100644 --- a/src/Services/MonitoredRepository.vala +++ b/src/Services/MonitoredRepository.vala @@ -259,7 +259,7 @@ namespace Scratch.Services { }; dialog.response.connect (() => {dialog.destroy ();}); - dialog.present (); + dialog.show (); return false; } @@ -313,7 +313,9 @@ namespace Scratch.Services { parent, new_branch_name, project_diff - ); + ) { + modal = true + }; dialog.response.connect ((res) => { dialog.destroy (); if (res == Gtk.ResponseType.ACCEPT) { @@ -321,8 +323,7 @@ namespace Scratch.Services { } }); - dialog.present (); - + dialog.show (); return false; } @@ -342,10 +343,12 @@ namespace Scratch.Services { _("An error occurred while checking out the requested branch"), e.message, "dialog-warning" - ); + ) { + modal = true + }; dialog.response.connect (dialog.destroy); - dialog.present (); + dialog.show (); return false; } From 0af05f85be6316b4dd4144d0388c9cc53dfc2580 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sat, 27 Jun 2026 17:22:57 +0100 Subject: [PATCH 7/8] Explicit modal --- src/Dialogs/BranchActions/BranchActionDialog.vala | 3 ++- src/Dialogs/CloneRepositoryDialog.vala | 4 ++-- src/Dialogs/CloseProjectsConfirmationDialog.vala | 3 ++- src/Dialogs/GlobalSearchDialog.vala | 3 ++- src/Dialogs/OverwriteUncommittedConfirmationDialog.vala | 4 ++-- src/Dialogs/RestoreConfirmationDialog.vala | 3 ++- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Dialogs/BranchActions/BranchActionDialog.vala b/src/Dialogs/BranchActions/BranchActionDialog.vala index 745001e2c..ce95d7ad7 100644 --- a/src/Dialogs/BranchActions/BranchActionDialog.vala +++ b/src/Dialogs/BranchActions/BranchActionDialog.vala @@ -49,7 +49,8 @@ public class Scratch.Dialogs.BranchActionDialog : Granite.MessageDialog { public BranchActionDialog (FolderManager.ProjectFolderItem project) { Object ( - project: project + project: project, + modal: true ); } diff --git a/src/Dialogs/CloneRepositoryDialog.vala b/src/Dialogs/CloneRepositoryDialog.vala index 8a0e2dfa4..80631c603 100644 --- a/src/Dialogs/CloneRepositoryDialog.vala +++ b/src/Dialogs/CloneRepositoryDialog.vala @@ -41,7 +41,8 @@ public class Scratch.Dialogs.CloneRepositoryDialog : Granite.MessageDialog { public CloneRepositoryDialog (string _suggested_local_folder, string _suggested_remote) { Object ( suggested_local_folder: _suggested_local_folder, - suggested_remote: _suggested_remote + suggested_remote: _suggested_remote, + modal: true ); } @@ -49,7 +50,6 @@ public class Scratch.Dialogs.CloneRepositoryDialog : Granite.MessageDialog { transient_for = ((Gtk.Application)(GLib.Application.get_default ())).get_active_window (); image_icon = new ThemedIcon ("git"); badge_icon = new ThemedIcon ("emblem-downloads"); - modal = true; ///TRANSLATORS "Git" is a proper name and must not be translated primary_text = _("Create a local clone of a Git repository"); diff --git a/src/Dialogs/CloseProjectsConfirmationDialog.vala b/src/Dialogs/CloseProjectsConfirmationDialog.vala index 51d7365b7..54cf1f678 100644 --- a/src/Dialogs/CloseProjectsConfirmationDialog.vala +++ b/src/Dialogs/CloseProjectsConfirmationDialog.vala @@ -26,7 +26,8 @@ public class Scratch.Dialogs.CloseProjectsConfirmationDialog : Granite.MessageDi buttons: Gtk.ButtonsType.NONE, transient_for: parent, n_parents: n_parents, - n_children: n_children + n_children: n_children, + modal: true ); } diff --git a/src/Dialogs/GlobalSearchDialog.vala b/src/Dialogs/GlobalSearchDialog.vala index 9c6927205..94438a976 100644 --- a/src/Dialogs/GlobalSearchDialog.vala +++ b/src/Dialogs/GlobalSearchDialog.vala @@ -44,7 +44,8 @@ public class Scratch.Dialogs.GlobalSearchDialog : Granite.MessageDialog { is_repo: is_repo, case_sensitive: case_sensitive, wholeword: wholeword, - use_regex: use_regex + use_regex: use_regex, + modal: true ); } diff --git a/src/Dialogs/OverwriteUncommittedConfirmationDialog.vala b/src/Dialogs/OverwriteUncommittedConfirmationDialog.vala index cc373c59a..0c63bcbbf 100644 --- a/src/Dialogs/OverwriteUncommittedConfirmationDialog.vala +++ b/src/Dialogs/OverwriteUncommittedConfirmationDialog.vala @@ -27,14 +27,14 @@ public class Scratch.Dialogs.OverwriteUncommittedConfirmationDialog : Granite.Me Object ( buttons: Gtk.ButtonsType.NONE, transient_for: parent, - branch_name: new_branch_name + branch_name: new_branch_name, + modal: true ); show_error_details (details); } construct { - modal = true; image_icon = new ThemedIcon ("dialog-warning"); primary_text = _("There are uncommitted changes in the current branch"); diff --git a/src/Dialogs/RestoreConfirmationDialog.vala b/src/Dialogs/RestoreConfirmationDialog.vala index 58cb63e24..938f60aee 100644 --- a/src/Dialogs/RestoreConfirmationDialog.vala +++ b/src/Dialogs/RestoreConfirmationDialog.vala @@ -21,7 +21,8 @@ public class Scratch.Dialogs.RestoreConfirmationDialog : Granite.MessageDialog { public RestoreConfirmationDialog (MainWindow parent) { Object ( buttons: Gtk.ButtonsType.NONE, - transient_for: parent + transient_for: parent, + modal: true ); } From b4880b1834c6c3115619f026db0395f7702db846 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Sat, 27 Jun 2026 17:26:01 +0100 Subject: [PATCH 8/8] Lose unused NewBranchDialog --- po/POTFILES | 1 - src/Dialogs/NewBranchDialog.vala | 81 -------------------------------- src/meson.build | 1 - 3 files changed, 83 deletions(-) delete mode 100644 src/Dialogs/NewBranchDialog.vala diff --git a/po/POTFILES b/po/POTFILES index 8c2fe24a1..3256ba916 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -3,7 +3,6 @@ src/MainWindow.vala src/Utils.vala src/Dialogs/CloneRepositoryDialog.vala src/Dialogs/GlobalSearchDialog.vala -src/Dialogs/NewBranchDialog.vala src/Dialogs/PreferencesDialog.vala src/Dialogs/RestoreConfirmationDialog.vala src/Dialogs/CloseProjectsConfirmationDialog.vala diff --git a/src/Dialogs/NewBranchDialog.vala b/src/Dialogs/NewBranchDialog.vala deleted file mode 100644 index a93f55a95..000000000 --- a/src/Dialogs/NewBranchDialog.vala +++ /dev/null @@ -1,81 +0,0 @@ -/* -* Copyright 2021 elementary, Inc. (https://elementary.io) -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public -* License as published by the Free Software Foundation; either -* version 2 of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -* Boston, MA 02110-1301 USA. -* -* Authored by: Jeremy Wootten -*/ - -public class Scratch.Dialogs.NewBranchDialog : Granite.MessageDialog { - public FolderManager.ProjectFolderItem active_project { get; construct; } - - private Granite.ValidatedEntry new_branch_name_entry; - public string new_branch_name { - get { - return new_branch_name_entry.text; - } - } - - public NewBranchDialog (FolderManager.ProjectFolderItem project) { - Object ( - transient_for: ((Gtk.Application)(GLib.Application.get_default ())).get_active_window (), - active_project: project, - image_icon: new ThemedIcon ("git") - ); - } - - construct { - assert (active_project.is_git_repo); - add_button (_("Cancel"), Gtk.ResponseType.CANCEL); - primary_text = _("Create a new branch of ā€œ%s/%sā€").printf ( - active_project.file.file.get_basename (), - active_project.get_current_branch_name () - ); - ///TRANSLATORS "Git" is a proper name and must not be translated - secondary_text = _("The branch name must be unique and follow Git naming rules."); - badge_icon = new ThemedIcon ("list-add"); - new_branch_name_entry = new Granite.ValidatedEntry () { - activates_default = true - }; - - custom_bin.add (new_branch_name_entry); - - var create_button = (Gtk.Button) add_button (_("Create Branch"), Gtk.ResponseType.APPLY); - create_button.can_default = true; - create_button.has_default = true; - create_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); - - new_branch_name_entry.bind_property ( - "is-valid", create_button, "sensitive", BindingFlags.DEFAULT | BindingFlags.SYNC_CREATE - ); - - new_branch_name_entry.changed.connect (() => { - unowned var new_name = new_branch_name_entry.text; - if (!active_project.is_valid_new_branch_name (new_name)) { - new_branch_name_entry.is_valid = false; - return; - } - - if (active_project.has_local_branch_name (new_name)) { - new_branch_name_entry.is_valid = false; - return; - } - - //Do we need to check remote branches as well? - new_branch_name_entry.is_valid = true; - }); - } -} diff --git a/src/meson.build b/src/meson.build index 94292027a..e58f5eb72 100644 --- a/src/meson.build +++ b/src/meson.build @@ -24,7 +24,6 @@ code_files = files( 'Dialogs/CloneRepositoryDialog.vala', 'Dialogs/OverwriteUncommittedConfirmationDialog.vala', 'Dialogs/GlobalSearchDialog.vala', - # 'Dialogs/NewBranchDialog.vala', 'Dialogs/BranchActions/BranchActionDialog.vala', 'Dialogs/BranchActions/BranchCheckoutPage.vala', 'Dialogs/BranchActions/BranchCreatePage.vala',