Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a75be27
Replace file_chooser.run () in MainWindow
jeremypw Jun 22, 2026
4b3c2f7
Replace chooser.run () in MainWindow
jeremypw Jun 22, 2026
df7ebda
Replace confirmation_dialog.run () in MainWindow
jeremypw Jun 22, 2026
04ee148
Replace dialog.run () in Document.vala
jeremypw Jun 22, 2026
dbef704
Replace file_Chooser.run () in Document
jeremypw Jun 22, 2026
64ff120
Replace dialog.run () in FolderManager
jeremypw Jun 22, 2026
9f0046d
Replace dialog.run () in spell plugin
jeremypw Jun 22, 2026
302dc32
Create custom dialogs as modal; use present () consistently
jeremypw Jun 23, 2026
29d5788
Lose unused dialog
jeremypw Jun 23, 2026
c4ee58c
Merge branch 'master' into jeremypw/gtk4prep/replace-dialog-run
jeremypw Jun 23, 2026
684ecb4
Add missed modal: true
jeremypw Jun 23, 2026
c0d134e
Address Granite.MessageDialogs
jeremypw Jun 23, 2026
f87c76b
Merge branch 'master' into jeremypw/gtk4prep/replace-dialog-run
jeremypw Jun 23, 2026
41289b0
Merge branch 'master' into jeremypw/gtk4prep/replace-dialog-run
jeremypw Jun 24, 2026
18b4b9d
Merge branch 'master' into jeremypw/gtk4prep/replace-dialog-run
jeremypw Jun 25, 2026
9d8a143
Update POTFILES
jeremypw Jun 25, 2026
2ea727d
Return correct response in ask_save_changes
jeremypw Jun 25, 2026
6ef61da
Make global search async
jeremypw Jun 25, 2026
d984300
Clarify dialog.show () at end of clause
jeremypw Jun 25, 2026
5b51e12
Yield after showing dialog in add_folder.
jeremypw Jun 25, 2026
cc55b5d
Make clone repository async
jeremypw Jun 25, 2026
4cc1a7e
Merge branch 'master' into jeremypw/gtk4prep/replace-dialog-run
jeremypw Jun 27, 2026
e2d0ea3
Merge branch 'master' into jeremypw/gtk4prep/replace-dialog-run
jeremypw Jun 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion plugins/spell/spell.vala
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public class Scratch.Plugins.Spell: Peas.ExtensionBase, Scratch.Services.Activat
window = w;
window.destroy.connect (save_settings);
});

}


Expand Down
2 changes: 2 additions & 0 deletions src/Dialogs/PreferencesDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ public class Scratch.Dialogs.Preferences : Granite.Dialog {
realize.connect (() => {
stack.set_visible_child_name ("behavior");
});

show_all ();
}

private class SettingSwitch : Gtk.Grid {
Expand Down
9 changes: 6 additions & 3 deletions src/FolderManager/FileView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane
: search_root.file.file;

bool is_explicit = !(item_for_path is ProjectFolderItem);
search_root.global_search (start_folder, term, is_explicit);
search_root.global_search.begin (start_folder, term, is_explicit);
}
}
}
Expand Down Expand Up @@ -621,13 +621,16 @@ public class Scratch.FolderManager.FileView : Code.Widgets.SourceList, Code.Pane

var close_projects = false;
dialog.response.connect ((res) => {
dialog.destroy ();
if (res == Gtk.ResponseType.ACCEPT) {
close_projects = true;
}

dialog.destroy ();
add_folder.callback ();
});

dialog.run ();
dialog.show ();
yield;

if (close_projects) {
foreach (var item in parents) {
Expand Down
6 changes: 4 additions & 2 deletions src/FolderManager/ProjectFolderItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ namespace Scratch.FolderManager {
// via a context menu on an explicitly chosen folder, in which case everything in that
// folder will be searched, or whether the hot-key was used in which case the search will
// take place on the active project and will omit certain folders
public void global_search (
public async void global_search (
GLib.File start_folder = this.file.file,
string? term = null,
bool is_explicit = false
Expand Down Expand Up @@ -511,9 +511,11 @@ namespace Scratch.FolderManager {
}

dialog.destroy ();
global_search.callback ();
});

dialog.run ();
dialog.show ();
Comment thread
danirabbit marked this conversation as resolved.
yield;

if (search_term != null) {
// Remove results of previous search before attempting a new one
Expand Down
170 changes: 94 additions & 76 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ namespace Scratch {
preferences_dialog.destroy ();
});

preferences_dialog.present ();
preferences_dialog.show ();
}

private void action_close_window () {
Expand Down Expand Up @@ -989,19 +989,22 @@ namespace Scratch {
file_chooser.select_multiple = true;
file_chooser.set_current_folder_uri (Utils.last_path ?? GLib.Environment.get_home_dir ());

var response = file_chooser.run ();
file_chooser.destroy (); // Close now so it does not stay open during lengthy or failed loading

if (response == Gtk.ResponseType.ACCEPT) {
foreach (string uri in file_chooser.get_uris ()) {
// Update last visited path
Utils.last_path = Path.get_dirname (uri);
// Open the file
var file = File.new_for_uri (uri);
var doc = new Scratch.Services.Document (actions, file);
open_document.begin (doc);
file_chooser.response.connect ((res) => {
var uris = file_chooser.get_uris ();
file_chooser.destroy (); // Close now so it does not stay open during lengthy or failed loading
if (res == Gtk.ResponseType.ACCEPT) {
foreach (string uri in file_chooser.get_uris ()) {
// Update last visited path
Utils.last_path = Path.get_dirname (uri);
// Open the file
var file = File.new_for_uri (uri);
var doc = new Scratch.Services.Document (actions, file);
open_document.begin (doc);
}
}
}
});

file_chooser.show ();
}

private void action_open_in_new_window (SimpleAction action, Variant? param) {
Expand Down Expand Up @@ -1031,14 +1034,18 @@ namespace Scratch {

chooser.select_multiple = true;

if (chooser.run () == Gtk.ResponseType.ACCEPT) {
chooser.get_files ().foreach ((glib_file) => {
var foldermanager_file = new FolderManager.File (glib_file.get_path ());
folder_manager_view.open_folder (foldermanager_file);
});
}
chooser.response.connect ((res) => {
var files = chooser.get_files ();
chooser.destroy ();
if (res == Gtk.ResponseType.ACCEPT) {
files.foreach ((glib_file) => {
var foldermanager_file = new FolderManager.File (glib_file.get_path ());
folder_manager_view.open_folder (foldermanager_file);
});
}
});

chooser.destroy ();
chooser.show ();
}

private void action_open_folder (SimpleAction action, Variant? param) {
Expand All @@ -1051,70 +1058,76 @@ namespace Scratch {
}

private void action_clone_repo (SimpleAction action, Variant? param) {
clone_repo.begin ();
}

private async void clone_repo () {
var default_projects_folder = Scratch.settings.get_string ("default-projects-folder");
if (default_projects_folder == "" && git_manager.active_project_path != "") {
default_projects_folder = Path.get_dirname (git_manager.active_project_path);
}

var default_remote = Scratch.settings.get_string ("default-remote");
var clone_dialog = new Dialogs.CloneRepositoryDialog (default_projects_folder, default_remote);

var cloning_done = false;
clone_dialog.response.connect ((res) => {
// Persist last entries (not necessarily valid)
Scratch.settings.set_string ("default-remote", clone_dialog.get_remote ());
Scratch.settings.set_string ("default-projects-folder", clone_dialog.get_projects_folder ());
//TODO Show more information re progress using Ggit callbacks
if (res == Gtk.ResponseType.APPLY && clone_dialog.can_clone) {
sidebar.cloning_in_progress = true;
cloning_done = (res != Gtk.ResponseType.APPLY || !clone_dialog.can_clone);
clone_repo.callback ();
});

while (!cloning_done) {
clone_dialog.show ();
yield;

if (!cloning_done) {
Scratch.settings.set_string ("default-remote", clone_dialog.get_remote ());
Scratch.settings.set_string ("default-projects-folder", clone_dialog.get_projects_folder ());
//TODO Show more information re progress using Ggit callbacks
clone_dialog.hide ();

var uri = clone_dialog.get_valid_source_repository_uri ();
var target = clone_dialog.get_valid_target ();
git_manager.clone_repository.begin (
uri,
target,
(obj, res) => {
sidebar.cloning_in_progress = false;
File? workdir = null;
string? error = null;
if (git_manager.clone_repository.end (res, out workdir, out error)) {
open_folder (workdir);
clone_dialog.destroy ();
if (this.is_active) {
sidebar.notify_cloning_success ();
} else {
var notification = new Notification (_("Cloning completed"));
notification.set_body (_("Clone successfully created in %s").printf (target));
notification.set_icon (new ThemedIcon ("process-completed-symbolic"));
app.send_notification ("cloning-finished-%s".printf (target), notification);
}
} else {
var message_dialog = new Granite.MessageDialog.with_image_from_icon_name (
_("Unable to clone %s").printf (uri),
error,
"dialog-error",
Gtk.ButtonsType.CLOSE
) {
transient_for = this
};
message_dialog.add_button (_("Retry"), 1);
message_dialog.response.connect ((res) => {
if (res == 1) {
clone_dialog.show ();
} else {
clone_dialog.destroy ();
}

message_dialog.destroy ();
});
message_dialog.present ();
}
sidebar.cloning_in_progress = true;
File? workdir = null;
string? error = null;
var success = yield git_manager.clone_repository (uri, target, out workdir, out error);
sidebar.cloning_in_progress = false;

if (success) {
open_folder (workdir);
if (this.is_active) {
sidebar.notify_cloning_success ();
} else {
var notification = new Notification (_("Cloning completed"));
notification.set_body (_("Clone successfully created in %s").printf (target));
notification.set_icon (new ThemedIcon ("process-completed-symbolic"));
app.send_notification ("cloning-finished-%s".printf (target), notification);
}
);
} else {
clone_dialog.destroy ();
cloning_done = true;
} else {
var message_dialog = new Granite.MessageDialog.with_image_from_icon_name (
_("Unable to clone %s").printf (uri),
error,
"dialog-error",
Gtk.ButtonsType.CLOSE
) {
transient_for = this,
modal = true
};
message_dialog.add_button (_("Retry"), 1);
message_dialog.response.connect ((res) => {
cloning_done = res != 1;
message_dialog.destroy ();
clone_repo.callback ();
});
message_dialog.show ();
yield;
}
}
});
}

clone_dialog.present ();
clone_dialog.destroy ();
}

private void action_collapse_all_folders () {
Expand Down Expand Up @@ -1155,13 +1168,18 @@ namespace Scratch {

private void action_revert () {
var confirmation_dialog = new Scratch.Dialogs.RestoreConfirmationDialog (this);
if (confirmation_dialog.run () == Gtk.ResponseType.ACCEPT) {
var doc = get_current_document ();
if (doc != null) {
doc.revert ();
confirmation_dialog.response.connect ((res) => {
if (res == Gtk.ResponseType.ACCEPT) {
var doc = get_current_document ();
if (doc != null) {
doc.revert ();
}
}
}
confirmation_dialog.destroy ();

confirmation_dialog.destroy ();
});

confirmation_dialog.show ();
}

private void action_duplicate () {
Expand Down
Loading
Loading