Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
0e71af8
update dependencies for Gtk4
jeremypw Jun 20, 2026
8b2e18a
Replace Hdy. with Adw.
jeremypw Jun 20, 2026
49f5005
Replace Gtk.SourceFile with Gtk.Source.File
jeremypw Jun 20, 2026
6ca6ef5
Replace Gtk.SourceMap with Gtk.Source.Map
jeremypw Jun 20, 2026
0d45be0
Replace Gtk.SourceBuffer with Gtk.Source.Buffer
jeremypw Jun 20, 2026
2248e41
Replace Gtk.Source with GtkSource.
jeremypw Jun 20, 2026
5399266
Replace draw() with snaphot_line() in GitGutterRenderer
jeremypw Jun 20, 2026
985ec99
Rewrite NavMarkGutterRender query_data
jeremypw Jun 20, 2026
5ac9f85
Temporarily comment out DnD stuff
jeremypw Jun 20, 2026
1d5e383
Replace Gtk.Clipboard with Gdk.Clipboard
jeremypw Jun 20, 2026
f304ce1
Replace GestureMultuPress with GestureClick
jeremypw Jun 22, 2026
d270e41
Merge branch 'jeremypw/gtk4prep/combined' into jeremypw/gtk4
jeremypw Jun 22, 2026
ec4f56a
Replace delete-event with close-request
jeremypw Jun 22, 2026
25eaacc
Replace Granite.Widgets.Welcome with Granite.Placeholder
jeremypw Jun 22, 2026
3e389b4
Replace Granite.Widgets.Toast with Granite.Toast
jeremypw Jun 22, 2026
c7b8ddf
Replace RadioButton with CheckButton
jeremypw Jun 22, 2026
02c8c29
Remove show_all() and no_ahow_all
jeremypw Jun 22, 2026
cddaa03
Remove TemplateManager related code
jeremypw Jun 23, 2026
b5ba66a
Merge branch 'jeremypw/gtk4prep/replace-dialog-run' of https://github…
jeremypw Jun 23, 2026
62755fe
Replace box.add, stack.add, window.add, add_provider_for_display etc
jeremypw Jun 23, 2026
20ca26b
Merge branch 'jeremypw/gtk4prep/lose-template-manager' of https://git…
jeremypw Jun 23, 2026
36206c6
Replace deprecated Gtk style classes with Granite-7 class
jeremypw Jun 23, 2026
ae58313
Replace Gtk.SortColumn
jeremypw Jun 23, 2026
21047ce
Replace Gtk.events_pending ()
jeremypw Jun 23, 2026
aab1c6d
Lose unused entry_path and entry_context
jeremypw Jun 23, 2026
56a6e28
HeaderBar: Replace RadioButton with grouped CheckButton
jeremypw Jun 23, 2026
bdf5551
Replace Gtk.ModelButton with Gtk.Button in HeaderBar
jeremypw Jun 23, 2026
7b6f8cb
Replace show_uri_on_window with UriLauncher
jeremypw Jun 23, 2026
fe809e6
Missed bits
jeremypw Jun 23, 2026
39f7ab0
Replace margin property with margin_top etc
jeremypw Jun 23, 2026
649fb49
Merge branch 'jeremypw/gtk4prep/margin' of https://github.com/element…
jeremypw Jun 23, 2026
801e02e
Fix typos
jeremypw Jun 23, 2026
96b946e
Merge branch 'jeremypw/gtk4prep/margin' of https://github.com/element…
jeremypw Jun 23, 2026
68fa12f
Replace or omit Gtk.IconSize
jeremypw Jun 23, 2026
c1104ad
Replace get_toplevel () with get_root ()
jeremypw Jun 23, 2026
546c815
Use scroll controller in Document View to trigger zoom action
jeremypw Jun 23, 2026
bbdc4ac
Merge branch 'jeremypw/gtk4prep/combined' of https://github.com/eleme…
jeremypw Jun 23, 2026
5d6ba6f
Merge branch 'jeremypw/gtk4prep/scrollcontroller-zoom' of https://git…
jeremypw Jun 23, 2026
7289d63
Port scroll controller in Document
jeremypw Jun 23, 2026
03eccdf
Merge branch 'jeremypw/gtk4prep/combined' of https://github.com/eleme…
jeremypw Jun 24, 2026
9f9c961
Replace focus-out-event handler in Document.vala (Gtk3)
jeremypw Jun 24, 2026
120b2ba
Replace enter-notify-event with EventFocusController
jeremypw Jun 24, 2026
4a854f0
Lose focus-in-event handler in DocumentView
jeremypw Jun 24, 2026
d4306d8
Merge branch 'jeremypw/gtk4prep/combined' of https://github.com/eleme…
jeremypw Jun 24, 2026
e145630
Replace enter_notify_event handler in Terminal
jeremypw Jun 24, 2026
8822d3e
Merge branch 'jeremypw/gtk4prep/combined' of https://github.com/eleme…
jeremypw Jun 24, 2026
382dc9a
Replace WindowState with ToplevelState
jeremypw Jun 24, 2026
d7f8022
Replace checkbutton.clicked with checkbutton.toggled
jeremypw Jun 24, 2026
a49a36c
Merge branch 'jeremypw/gtk4prep/combined' of https://github.com/eleme…
jeremypw Jun 24, 2026
222dc98
Merge branch 'jeremypw/gtk4prep/combined' into jeremypw/gtk4
jeremypw Jun 25, 2026
41e419b
Fix merge
jeremypw Jun 25, 2026
b7ec630
Replace Paned pack1 and pack2
jeremypw Jun 25, 2026
6e254f7
Delete Gtk3 specific comment in SourceList
jeremypw Jun 25, 2026
b0b4363
Replace get_children ()
jeremypw Jun 25, 2026
9eaec09
Fix construction of eventcontroller and add_controller
jeremypw Jun 25, 2026
101de63
Use filechooser.get_files () and iterate ListModel
jeremypw Jun 25, 2026
94bc230
Fix ProjectCHooserButton
jeremypw Jun 25, 2026
7a38345
User button controller instead of button event in Project Button
jeremypw Jun 26, 2026
68def28
Merge branch 'jeremypw/gtk4prep/combined' into jeremypw/gtk4
jeremypw Jun 26, 2026
fbe2fa2
Lose get_action_group, fix activate_action syntax
jeremypw Jun 26, 2026
c62e772
Replace begin/end undoableaction
jeremypw Jun 26, 2026
1c6f1b3
Merge branch 'jeremypw/gtk4prep/combined' of https://github.com/eleme…
jeremypw Jun 26, 2026
5d30baa
Fix homogeneous
jeremypw Jun 26, 2026
b324920
Fix invalid properties/members
jeremypw Jun 26, 2026
cad9eb9
Various syntax property and member fixes
jeremypw Jun 26, 2026
de81207
Fix more syntax. members. functions
jeremypw Jun 26, 2026
bb275c0
Fix more syntax etc
jeremypw Jun 26, 2026
3a34c7a
Fix typo
jeremypw Jun 28, 2026
ba47d33
add_class -> add_css_class
jeremypw Jun 28, 2026
071471a
Replace remove_class with remove_css_class
jeremypw Jun 28, 2026
6c4adec
Replace add_provider with add_provider_for_display
jeremypw Jun 28, 2026
bbf2e34
more add_class -> add_css_class
jeremypw Jun 28, 2026
fedef5f
cssprovider load_from_data -> load_from_string
jeremypw Jun 28, 2026
17bd55e
Fix get_tooltip_context syntax
jeremypw Jun 28, 2026
7ff4018
Avoid Window.get_size ()
jeremypw Jun 28, 2026
b90568a
Merge branch 'jeremypw/gtk4prep/combined' of https://github.com/eleme…
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
14 changes: 7 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ project(
'io.elementary.code',
'vala', 'c',
meson_version: '>= 0.58.0',
version: '8.3.1'
version: '9.0.0'
)

add_project_arguments([
Expand All @@ -29,16 +29,16 @@ i18n = import('i18n')
glib_dep = dependency('glib-2.0', version: '>=2.74.0')
gio_unix_dep = dependency('gio-unix-2.0', version: '>=2.20')
gee_dep = dependency('gee-0.8', version: '>=0.8.5')
gtk_dep = dependency('gtk+-3.0', version: '>=3.6.0')
granite_dep = dependency('granite', version: '>=6.0.0')
handy_dep = dependency('libhandy-1', version: '>=0.90.0')
gtksourceview_dep = dependency('gtksourceview-4')
gtk_dep = dependency('gtk4', version: '>=4.14.2')
granite_dep = dependency('granite-7', version: '>=7.0.0')
adwaita_dep = dependency('libadwaita-1', version: '>=1.0.0')
gtksourceview_dep = dependency('gtksourceview-5')
peas_dep = dependency('libpeas-2')
git_dep = dependency('libgit2-glib-1.0', version: '>=1.2.0')
fontconfig_dep = dependency('fontconfig')
pangofc_dep = dependency('pangoft2')
posix_dep = meson.get_compiler('vala').find_library('posix')
vte_dep = dependency('vte-2.91')
vte_dep = dependency('vte-2.91-gtk4', version: '>=0.76')

code_resources = gnome.compile_resources(
'code-resources', 'data/' + meson.project_name() + '.gresource.xml',
Expand All @@ -55,7 +55,7 @@ dependencies = [
gee_dep,
gtk_dep,
granite_dep,
handy_dep,
adwaita_dep,
gtksourceview_dep,
peas_dep,
git_dep,
Expand Down
5 changes: 3 additions & 2 deletions plugins/brackets-completion/brackets-completion.vala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Scratch.Se

public Object object { owned get; set construct; }

private Gtk.EventControllerKey key_controller;
// private Gtk.EventControllerKey key_controller;
private Gee.HashMap<string, string> brackets;
private Gee.HashMap<uint, string> keys;
private Gtk.TextBuffer current_buffer;
Expand Down Expand Up @@ -42,9 +42,10 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Scratch.Se
plugins = (Scratch.Services.Interface) object;
plugins.hook_document.connect (on_hook_document);
plugins.hook_window.connect ((w) => {
key_controller = new Gtk.EventControllerKey (w) {
var key_controller = new Gtk.EventControllerKey (w) {
propagation_phase = CAPTURE
};
w.add_controller (key_controller);
key_controller.key_pressed.connect (on_key_down);
});
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/detect-indent/detect-indent.vala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Scratch.Plugins.DetectIndent: Peas.ExtensionBase, Scratch.Services.
return;
}

var source_buffer = (Gtk.SourceBuffer) view.buffer;
var source_buffer = (GtkSource.Buffer) view.buffer;
Gtk.TextIter it;
source_buffer.get_iter_at_line (out it, 0);

Expand Down
10 changes: 6 additions & 4 deletions plugins/fuzzy-search/file-item.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class FileItem : Gtk.ListBoxRow {
}

public FileItem (SearchResult res, bool should_distinguish_project = false) {
this.get_style_context ().add_class ("fuzzy-item");
this.get_style_context ().add_class ("flat");
this.add_css_class ("fuzzy-item");
this.add_css_class ("flat");

result = res;
Icon icon;
Expand All @@ -41,8 +41,10 @@ public class FileItem : Gtk.ListBoxRow {
icon = ContentType.get_icon ("text/plain");
}

var image = new Gtk.Image.from_gicon (icon, Gtk.IconSize.DND);
image.get_style_context ().add_class ("fuzzy-file-icon");
var image = new Gtk.Image.from_gicon (icon) {
icon_size = Gtk.IconSize.NORMAL
);
image.add_css_class ("fuzzy-file-icon");

path_box.add (filename_label);
path_box.add (path_label);
Expand Down
43 changes: 21 additions & 22 deletions plugins/fuzzy-search/fuzzy-search-popover.vala
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
public class Scratch.FuzzySearchPopover : Gtk.Popover {
private Gtk.SearchEntry search_term_entry;
private Services.FuzzyFinder fuzzy_finder;
private Gtk.ListBox search_result_container;
private Gtk.ListBox search_result_listbox;
private int preselected_index;
private Gtk.ScrolledWindow scrolled;
private Gee.ArrayList<FileItem> items;
private Scratch.Services.FuzzySearchIndexer indexer;
private int window_height;
private int max_items;
private Gee.LinkedList<GLib.Cancellable> cancellables;
private Gtk.EventControllerKey search_term_entry_key_controller;
// private Gtk.EventControllerKey search_term_entry_key_controller;
private Gtk.Label title_label;
private string current_doc_project;
public Scratch.MainWindow current_window { get; construct; }
Expand Down Expand Up @@ -68,25 +68,25 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
width_request = 500;
pointing_to = { 0, 32, 1, 1 };

this.get_style_context ().add_class ("fuzzy-popover");
this.add_css_class ("fuzzy-popover");

title_label = new Gtk.Label (_("Find project files"));
title_label.halign = Gtk.Align.START;
title_label.get_style_context ().add_class ("h4");
title_label.add_css_class ("h4");

search_term_entry = new Gtk.SearchEntry ();
search_term_entry.halign = Gtk.Align.FILL;
search_term_entry.hexpand = true;

search_result_container = new Gtk.ListBox () {
search_result_listbox = new Gtk.ListBox () {
selection_mode = Gtk.SelectionMode.NONE,
activate_on_single_click = true,
can_focus = false
};

search_result_container.get_style_context ().add_class ("fuzzy-list");
search_result_listbox.add_css_class ("fuzzy-list");

search_result_container.row_activated.connect ((row) => {
search_result_listbox.row_activated.connect ((row) => {
var file_item = row as FileItem;
if (file_item == null) {
return;
Expand All @@ -95,7 +95,8 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
handle_item_selection (items.index_of (file_item));
});

search_term_entry_key_controller = new Gtk.EventControllerKey (search_term_entry);
var search_term_entry_key_controller = new Gtk.EventControllerKey ();
search_term_entry.add_controller (search_term_entry_key_controller);
search_term_entry_key_controller.key_pressed.connect ((keyval, keycode, state) => {
// Handle key up/down to select other files found by fuzzy search
switch (keyval) {
Expand Down Expand Up @@ -184,10 +185,9 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {

bool first = true;



foreach (var c in search_result_container.get_children ()) {
search_result_container.remove (c);
var child = search_result_listbox.get_first_child ();
while (child != null);
search_result_listbox.remove (child);
}

items.clear ();
Expand All @@ -198,16 +198,15 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {

if (first) {
first = false;
file_item.get_style_context ().add_class ("preselect-fuzzy");
file_item.add_css_class ("preselect-fuzzy");
preselected_index = 0;
}

search_result_container.add (file_item);
search_result_listbox.add (file_item);
items.add (file_item);
}

scrolled.hide ();
scrolled.show_all ();

// Reset scrolling
scrolled.vadjustment.value = 0;
Expand All @@ -216,8 +215,9 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
return Source.REMOVE;
});
} else {
foreach (var c in search_result_container.get_children ()) {
search_result_container.remove (c);
var child = search_result_listbox.get_first_child ();
while (child != null);
search_result_listbox.remove (child);
}

items.clear ();
Expand All @@ -237,12 +237,11 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
hexpand = true
};

scrolled.add (search_result_container);
scrolled.add (search_result_listbox);

var box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
box.pack_start (entry_layout, false, false);
box.pack_end (scrolled, true, true);
box.show_all ();

scrolled.hide ();
this.add (box);
Expand All @@ -266,7 +265,7 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {
scrolled.set_max_content_height (45 /* height */ * max_items);

current_doc_project = get_current_project (); // This will not change while popover is showing
search_result_container.set_sort_func ((a , b) => {
search_result_listbox.set_sort_func ((a , b) => {
var result_a = ((FileItem)a).result;
var result_b = ((FileItem)b).result;
var project_a_is_current = result_a.project == current_doc_project;
Expand All @@ -293,8 +292,8 @@ public class Scratch.FuzzySearchPopover : Gtk.Popover {

private void preselect_new_item (FileItem old_item, FileItem new_item) {
var class_name = "preselect-fuzzy";
old_item.get_style_context ().remove_class (class_name);
new_item.get_style_context ().add_class (class_name);
old_item.remove_css_class (class_name);
new_item.add_css_class (class_name);
}

private string get_current_project () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
public class Scratch.Plugins.HighlightSelectedWords : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin {
Scratch.Widgets.SourceView current_source;
Scratch.MainWindow? main_window = null;
Gtk.SourceSearchContext? current_search_context = null;
GtkSource.SearchContext? current_search_context = null;

private const uint SELECTION_HIGHLIGHT_MAX_CHARS = 255;

Expand Down Expand Up @@ -118,8 +118,8 @@ public class Scratch.Plugins.HighlightSelectedWords : Peas.ExtensionBase, Scratc

// We know the selected text is non-zero length, check not too long
if (selected_text.char_count () <= SELECTION_HIGHLIGHT_MAX_CHARS) {
current_search_context = new Gtk.SourceSearchContext (
(Gtk.SourceBuffer)current_source.buffer,
current_search_context = new GtkSource.SearchContext (
(GtkSource.Buffer)current_source.buffer,
null
);
current_search_context.settings.search_text = selected_text;
Expand Down
6 changes: 3 additions & 3 deletions plugins/markdown-actions/markdown-actions.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services

public void update_state () {}

private Gtk.EventControllerKey key_controller;
// private Gtk.EventControllerKey key_controller;
private bool is_markdown = false;

public void activate () {
Expand All @@ -43,9 +43,10 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services
current_source.notify["language"].connect (configure_shortcuts);
});
plugins.hook_window.connect ((w) => {
key_controller = new Gtk.EventControllerKey (w) {
var key_controller = new Gtk.EventControllerKey (w) {
propagation_phase = CAPTURE
};
w.add_controller (w);
key_controller.key_pressed.connect (shortcut_handler);
});
}
Expand All @@ -56,7 +57,6 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services
}

private bool shortcut_handler (
Gtk.EventController controller,
uint keyval,
uint keycode,
Gdk.ModifierType state
Expand Down
8 changes: 2 additions & 6 deletions plugins/pastebin/pastebin_dialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,10 @@ namespace Scratch.Dialogs {

close_button = (Gtk.Button)add_button (_("Cancel"), Gtk.ResponseType.CANCEL);
upload_button = (Gtk.Button)add_button (_("Upload to Pastebin"), Gtk.ResponseType.OK);
upload_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
upload_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);

read_settings ();

show_all ();

format_button.clicked.connect (format_button_clicked);

upload_button.clicked.connect (() => {
Expand Down Expand Up @@ -386,7 +384,7 @@ namespace Scratch.Dialogs {
var cancel_button = (Gtk.Button)format_dialog.add_button (_("Cancel"), Gtk.ResponseType.CANCEL);

var select_button = (Gtk.Button)format_dialog.add_button (_("Select Format"), Gtk.ResponseType.OK);
select_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION);
select_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION);
select_button.clicked.connect (select_button_clicked);

var frame = new Gtk.Frame (null) {
Expand All @@ -398,7 +396,6 @@ namespace Scratch.Dialogs {
frame.add (languages_scrolled);

format_dialog.get_content_area ().add (frame);
format_dialog.show_all ();

cancel_button.clicked.connect (() => {
format_dialog.destroy ();
Expand Down Expand Up @@ -458,7 +455,6 @@ namespace Scratch.Dialogs {
box.pack_start (err_label, false, true, 0);
}

box.show_all ();
stack.visible_child = box;
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/spell/spell.vala
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public class Scratch.Plugins.Spell: Peas.ExtensionBase, Scratch.Services.Activat
});

// Deactivate Spell checker when we are editing a code file
var source_buffer = (Gtk.SourceBuffer) d.source_view.buffer;
var source_buffer = (GtkSource.Buffer) d.source_view.buffer;
var lang = source_buffer.language;
if (lang != null && lang.id != "markdown") {
spell.detach ();
Expand Down
7 changes: 3 additions & 4 deletions plugins/vim-emulation/vim-emulation.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class Scratch.Plugins.VimEmulation : Peas.ExtensionBase, Scratch.Services
Scratch.Widgets.SourceView? view = null;

Scratch.Services.Interface plugins;
private Gtk.EventControllerKey key_controller;
// private Gtk.EventControllerKey key_controller;

public Object object { owned get; set construct; }

Expand All @@ -55,10 +55,10 @@ public class Scratch.Plugins.VimEmulation : Peas.ExtensionBase, Scratch.Services
this.views.add (view);
});
plugins.hook_window.connect ((w) => {
key_controller = new Gtk.EventControllerKey (w) {
key_controller = new Gtk.EventControllerKey () {
propagation_phase = CAPTURE
};

w.add_controller (key_controller);
key_controller.key_pressed.connect (handle_key_press);
});
}
Expand All @@ -68,7 +68,6 @@ public class Scratch.Plugins.VimEmulation : Peas.ExtensionBase, Scratch.Services
}

private bool handle_key_press (
Gtk.EventController controller,
uint keyval,
uint keycode,
Gdk.ModifierType state
Expand Down
Loading
Loading