Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ endif
subdir('data')
subdir('src')
if get_option('plugins')
subdir('plugins')
# subdir('plugins')
endif
subdir('po')

Expand Down
2 changes: 1 addition & 1 deletion plugins/fuzzy-search/fuzzy-search.vala
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Scratch.Services.A

var popover = new Scratch.FuzzySearchPopover (indexer, window);
popover.open_file.connect ((filepath) => {
var file = new Scratch.FolderManager.File (filepath);
var file = new Code.File (filepath);
var doc = new Scratch.Services.Document (window.actions, file.file);

window.open_document.begin (doc);
Expand Down
28 changes: 24 additions & 4 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,18 @@ namespace Scratch {
var window = get_last_window ();
foreach (var file in files) {
bool is_folder;
var path = file.get_uri ();
if (Scratch.Services.FileHandler.can_open_file (file, out is_folder)) {
if (is_folder) {
window.open_folder (file);
window.open_folder_as_project (file); // Opens in sidebar not as documents
} else {
debug ("Files length: %d\n", files.length);
var doc = new Scratch.Services.Document (window.actions, file);
// var doc = new Scratch.Services.Document (window.actions, file);
if (location_jump_manager.has_selection_range != null && files.length == 1) {
window.open_document_at_selected_range.begin (doc, true, location_jump_manager.range);
// We know file exists so we do not need to check again
window.document_view.open_document.begin (path, true, 0, location_jump_manager.range);
} else {
window.open_document.begin (doc);
window.document_view.open_document.begin (path);
}
}
}
Expand Down Expand Up @@ -231,6 +233,24 @@ namespace Scratch {
return true;
}

public bool can_rename_file (Code.File file) {
// folder_manager_view.rename_request.connect ((file) => {
var allow = true;
foreach (var window in get_windows ()) {
var win = (MainWindow)window;
foreach (var doc in win.document_view.docs) {
if (doc.file.equal (file.file)) {
// Only allow sidebar to rename docs that are in sync with their file in
// all windows
allow = allow && !doc.locked && doc.saved;
}
}
}

return allow;
// });
}

public static int main (string[] args) {
// By default, profile whole app when profiling is enabled in meson_options.txt
// These conditional statements can be moved to profile sections of code
Expand Down
4 changes: 2 additions & 2 deletions src/Dialogs/BranchActions/BranchActionDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public class Scratch.Dialogs.BranchActionDialog : Granite.MessageDialog {
}

public bool can_apply { get; set; default = false; }
public FolderManager.ProjectFolderItem project { get; construct; }
public Code.ProjectFolderItem project { get; construct; }

private Gtk.Stack stack;

public BranchActionDialog (FolderManager.ProjectFolderItem project) {
public BranchActionDialog (Code.ProjectFolderItem project) {
Object (
project: project,
modal: true
Expand Down
Loading
Loading