Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to gtk4 #1497

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ You'll need the following dependencies:
* libgail-3-dev
* libgee-0.8-dev
* libgit2-glib-1.0-dev
* libgtksourceview-4-dev
* libgtksourceview-5-dev
* libgtkspell3-3-dev
* libgranite-dev >= 6.0.0
* libhandy-1-dev >= 0.90.0
* libpeas-dev
* libgranite-7-dev >= 6.0.0
* libadwaita-1-dev >= 1.0.0
* libsoup2.4-dev
* libvala-0.48-dev (or higher)
* libvte-2.91-dev
* libvala-0.56-dev (or higher)
* libvte-2.91-gtk4-dev
* valac

Run `meson build` to configure the build environment. Change to the build directory and run `ninja test` to build
Expand Down
87 changes: 38 additions & 49 deletions io.elementary.code.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,43 @@
app-id: io.elementary.code
runtime: io.elementary.Sdk # The outline plugin requires libvala which is only in the SDK, not the runtime
runtime-version: '7.1'
runtime-version: "7.1"
sdk: io.elementary.Sdk
command: io.elementary.code
finish-args:
- '--filesystem=xdg-run/gvfsd'
- '--filesystem=host'
- "--filesystem=xdg-run/gvfsd"
- "--filesystem=host"

- '--share=ipc'
- '--socket=fallback-x11'
- '--socket=wayland'
- "--share=ipc"
- "--socket=fallback-x11"
- "--socket=wayland"

- '--talk-name=org.gtk.vfs.*'
- '--talk-name=org.gnome.SettingsDaemon'
- '--talk-name=org.elementary.Contractor'
- "--talk-name=org.gtk.vfs.*"
- "--talk-name=org.gnome.SettingsDaemon"
- "--talk-name=org.elementary.Contractor"

- '--metadata=X-DConf=migrate-path=/io/elementary/code/'
- "--metadata=X-DConf=migrate-path=/io/elementary/code/"
cleanup:
- '/include'
- '/lib/pkgconfig'
- '/lib/cmake'
- '/lib/girepository-1.0'
- '/share/gir-1.0'
- '/share/vala'
- '*.a'
- '*.la'
- "/include"
- "/lib/pkgconfig"
- "/lib/cmake"
- "/lib/girepository-1.0"
- "/share/gir-1.0"
- "/share/vala"
- "*.a"
- "*.la"
modules:
- name: gtksourceview
buildsystem: meson
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/gtksourceview.git
tag: '4.8.4'

- name: peas
buildsystem: meson
config-opts:
- '-Dgtk_doc=false'
- '-Ddemos=false'
- '-Dvapi=true'
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/libpeas.git
tag: libpeas-1.34.0
tag: "4.8.4"

- name: git2-glib
buildsystem: meson
builddir: true
config-opts:
- '-Dpython=false'
- "-Dpython=false"
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/libgit2-glib.git
Expand All @@ -57,51 +46,51 @@ modules:
- name: ssh2
buildsystem: cmake-ninja
config-opts:
- '-DCMAKE_BUILD_TYPE=RelWithDebInfo'
- '-DBUILD_SHARED_LIBS:BOOL=ON'
- '-DBUILD_EXAMPLES:BOOL=OFF'
- '-DBUILD_TESTING:BOOL=OFF'
- '-DCMAKE_INSTALL_LIBDIR:PATH=/app/lib'
- "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
- "-DBUILD_SHARED_LIBS:BOOL=ON"
- "-DBUILD_EXAMPLES:BOOL=OFF"
- "-DBUILD_TESTING:BOOL=OFF"
- "-DCMAKE_INSTALL_LIBDIR:PATH=/app/lib"
cleanup:
- '/share/man'
- '/share/doc'
- "/share/man"
- "/share/doc"
sources:
- type: git
url: https://github.com/libssh2/libssh2.git
tag: libssh2-1.10.0
- name: libgit2
buildsystem: cmake-ninja
config-opts:
- '-DCMAKE_BUILD_TYPE=RelWithDebInfo'
- "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
sources:
- type: git
url: https://github.com/libgit2/libgit2.git
tag: 'v1.5.1'
tag: "v1.5.1"

- name: editorconfig
buildsystem: cmake-ninja
config-opts:
- '-DCMAKE_BUILD_TYPE=RelWithDebInfo'
- '-DBUILD_DOCUMENTATION:BOOL=OFF'
- "-DCMAKE_BUILD_TYPE=RelWithDebInfo"
- "-DBUILD_DOCUMENTATION:BOOL=OFF"
sources:
- type: git
url: https://github.com/editorconfig/editorconfig-core-c.git
tag: 'v0.12.6'
tag: "v0.12.6"
disable-submodules: true

- name: gtkspell
config-opts:
- '--disable-gtk-doc-html'
- "--disable-gtk-doc-html"
cleanup:
- '/share/gtk-doc' # for some reason, it still install the html folder.
- "/share/gtk-doc" # for some reason, it still install the html folder.
sources:
- type: archive
url: https://downloads.sourceforge.net/gtkspell/gtkspell3-3.0.10.tar.xz
sha256: b040f63836b347eb344f5542443dc254621805072f7141d49c067ecb5a375732
modules:
- name: intltool
cleanup:
- '*'
- "*"
sources:
- type: archive
url: https://launchpad.net/intltool/trunk/0.51.0/+download/intltool-0.51.0.tar.gz
Expand All @@ -110,11 +99,11 @@ modules:
- name: vte
buildsystem: meson
config-opts:
- '-Dbuildtype=debugoptimized'
- "-Dbuildtype=debugoptimized"
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/vte.git
branch: '0.70.2'
branch: "0.70.2"

- name: universal-ctags
sources:
Expand All @@ -125,7 +114,7 @@ modules:
- name: code
buildsystem: meson
config-opts:
- '-Dhave_pkexec=false'
- "-Dhave_pkexec=false"
sources:
- type: dir
path: .
18 changes: 7 additions & 11 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_project_arguments([
)

add_project_arguments(
['--vapidir', meson.project_source_root() / 'vapi'],
['--vapidir', meson.global_source_root() / 'vapi'],
language: 'vala'
)

Expand All @@ -26,20 +26,18 @@ pluginsdir = get_option('prefix') / get_option('libdir') / meson.project_name()
gnome = import('gnome')
i18n = import('i18n')

glib_dep = dependency('glib-2.0', version: '>=2.30.0')
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')
peas_dep = dependency('libpeas-1.0')
peasgtk_dep = dependency('libpeas-gtk-1.0')
gtk_dep = dependency('gtk4', version: '>=4.14.2')
granite_dep = dependency('granite-7', version: '>=7.0.0')
handy_dep = dependency('libadwaita-1', version: '>=1.0.0')
gtksourceview_dep = dependency('gtksourceview-5')
git_dep = dependency('libgit2-glib-1.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 @@ -58,8 +56,6 @@ dependencies = [
granite_dep,
handy_dep,
gtksourceview_dep,
peas_dep,
peasgtk_dep,
git_dep,
fontconfig_dep,
pangofc_dep,
Expand Down
2 changes: 1 addition & 1 deletion plugins/fuzzy-search/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ custom_target(module_name + '.plugin_merge',
'--desktop',
'--keyword=Description',
'--keyword=Name',
'-d' + join_paths(meson.source_root (), 'po', 'plugins'),
'-d' + join_paths(meson.global_source_root (), 'po', 'plugins'),
'--template=@INPUT@',
'-o@OUTPUT@',
],
Expand Down
6 changes: 2 additions & 4 deletions src/FolderManager/FileItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace Scratch.FolderManager {
view.activate (file.path);
}

public override Gtk.Menu? get_context_menu () {
public override GLib.Menu? get_context_menu () {
GLib.FileInfo info = null;

try {
Expand Down Expand Up @@ -88,9 +88,7 @@ namespace Scratch.FolderManager {
menu_model.append_section (null, external_actions_section);
menu_model.append_section (null, direct_actions_section);

var menu = new Gtk.Menu.from_model (menu_model);
menu.insert_action_group (FileView.ACTION_GROUP, view.actions);
return menu;
return menu_model;
}

private GLib.MenuItem create_submenu_for_open_in (string? file_type) {
Expand Down
6 changes: 2 additions & 4 deletions src/FolderManager/FolderItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace Scratch.FolderManager {
}
}

public override Gtk.Menu? get_context_menu () {
public override GLib.Menu? get_context_menu () {
var open_in_terminal_pane_item = new GLib.MenuItem (
(_("Open in Terminal Pane")),
GLib.Action.print_detailed_name (
Expand Down Expand Up @@ -152,9 +152,7 @@ namespace Scratch.FolderManager {
menu_model.append_section (null, direct_actions_section);
menu_model.append_section (null, search_section);

var menu = new Gtk.Menu.from_model (menu_model);
menu.insert_action_group (FileView.ACTION_GROUP, view.actions);
return menu;
return menu_model;
}

protected GLib.MenuItem create_submenu_for_open_in (string? file_type) {
Expand Down
6 changes: 2 additions & 4 deletions src/FolderManager/ProjectFolderItem.vala
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace Scratch.FolderManager {
}
}

public override Gtk.Menu? get_context_menu () {
public override GLib.Menu? get_context_menu () {
GLib.FileInfo info = null;
unowned string? file_type = null;

Expand Down Expand Up @@ -296,9 +296,7 @@ namespace Scratch.FolderManager {
menu_model.append_section (null, delete_actions_section);
menu_model.append_section (null, search_actions_section);

var menu = new Gtk.Menu.from_model (menu_model);
menu.insert_action_group (FileView.ACTION_GROUP, view.actions);
return menu;
return menu_model;
}

protected GLib.MenuItem create_submenu_for_branch () {
Expand Down
2 changes: 1 addition & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

namespace Scratch {
public class MainWindow : Hdy.Window {
public class MainWindow : Adw.Window {
public const int FONT_SIZE_MAX = 72;
public const int FONT_SIZE_MIN = 7;
private const uint MAX_SEARCH_TEXT_LENGTH = 255;
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Document.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Scratch.Services {
public unowned SimpleActionGroup actions { get; set construct; }

// The TabPage that this document is a child of
public unowned Hdy.TabPage tab { get; private set; }
public unowned Adw.TabPage tab { get; private set; }

public bool is_file_temporary {
get {
Expand Down Expand Up @@ -293,7 +293,7 @@ namespace Scratch.Services {
this.show_all ();
}

public void init_tab (Hdy.TabPage tab) {
public void init_tab (Adw.TabPage tab) {
this.tab = tab;
notify["tab.loading"].connect (on_tab_loading_change);

Expand Down
16 changes: 8 additions & 8 deletions src/Widgets/DocumentView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public class Scratch.Widgets.DocumentView : Gtk.Box {
public bool outline_visible { get; set; default = false; }
public int outline_width { get; set; }

private Hdy.TabView tab_view;
private Hdy.TabBar tab_bar;
private weak Hdy.TabPage? tab_menu_target = null;
private Adw.TabView tab_view;
private Adw.TabBar tab_bar;
private weak Adw.TabPage? tab_menu_target = null;
private Gtk.CssProvider style_provider;
private Gtk.MenuButton tab_history_button;

Expand Down Expand Up @@ -423,7 +423,7 @@ public class Scratch.Widgets.DocumentView : Gtk.Box {
}

// This is called when tab context menu is opened or closed
private void tab_view_setup_menu (Hdy.TabPage? page) {
private void tab_view_setup_menu (Adw.TabPage? page) {
tab_menu_target = page;

var close_other_tabs_action = Utils.action_from_group (MainWindow.ACTION_CLOSE_OTHER_TABS, window.actions);
Expand Down Expand Up @@ -467,7 +467,7 @@ public class Scratch.Widgets.DocumentView : Gtk.Box {
on_doc_removed_shared (doc);
}

private void on_doc_removed (Hdy.TabPage tab, int position) {
private void on_doc_removed (Adw.TabPage tab, int position) {
var doc = tab.get_child () as Services.Document;
if (doc == null) {
return;
Expand Down Expand Up @@ -545,7 +545,7 @@ public class Scratch.Widgets.DocumentView : Gtk.Box {
}
}

private void on_doc_reordered (Hdy.TabPage tab, int new_position) {
private void on_doc_reordered (Adw.TabPage tab, int new_position) {
var doc = tab.child as Services.Document;
if (doc != null) {
docs.remove (doc);
Expand All @@ -556,12 +556,12 @@ public class Scratch.Widgets.DocumentView : Gtk.Box {
save_opened_files ();
}

private unowned Hdy.TabView? on_doc_to_new_window (Hdy.TabView tab_view) {
private unowned Adw.TabView? on_doc_to_new_window (Adw.TabView tab_view) {
var other_window = new MainWindow (false);
return other_window.document_view.tab_view;
}

private void on_doc_added (Hdy.TabPage page, int position) {
private void on_doc_added (Adw.TabPage page, int position) {
var doc = page.get_child () as Services.Document;

doc.init_tab (page);
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/HeaderBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2013 Mario Guerriero <mefrio.g@gmail.com>
*/

public class Scratch.HeaderBar : Hdy.HeaderBar {
public class Scratch.HeaderBar : Adw.HeaderBar {
// Plugins segfault without full access
public Code.FormatBar format_bar;
public GLib.Menu share_menu;
Expand Down
2 changes: 1 addition & 1 deletion src/Widgets/Sidebar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Code.Sidebar : Gtk.Grid {

public Gtk.Stack stack { get; private set; }
public Code.ChooseProjectButton choose_project_button { get; private set; }
public Hdy.HeaderBar headerbar { get; private set; }
public Adw.HeaderBar headerbar { get; private set; }
public GLib.MenuModel project_menu_model { get; construct; }

private Gtk.StackSwitcher stack_switcher;
Expand Down
Loading