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

Lose libpeas dependency #1502

Closed
wants to merge 20 commits into from
Closed
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y exuberant-ctags libeditorconfig-dev libgail-3-dev libgee-0.8-dev libgit2-glib-1.0-dev libgranite-dev libgtk-3-dev libgtksourceview-4-dev libgtkspell3-3-dev libhandy-1-dev libpeas-dev libsoup2.4-dev libvala-dev libvte-2.91-dev meson valac polkitd libpolkit-gobject-1-dev
apt install -y exuberant-ctags libeditorconfig-dev libgail-3-dev libgee-0.8-dev libgit2-glib-1.0-dev libgranite-dev libgtk-3-dev libgtksourceview-4-dev libgtkspell3-3-dev libhandy-1-dev libsoup2.4-dev libvala-dev libvte-2.91-dev meson valac polkitd libpolkit-gobject-1-dev
- name: Build
env:
DESTDIR: out
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ You'll need the following dependencies:
* libgtkspell3-3-dev
* libgranite-dev >= 6.0.0
* libhandy-1-dev >= 0.90.0
* libpeas-dev
* libsoup2.4-dev
* libvala-0.48-dev (or higher)
* libvte-2.91-dev
Expand Down
11 changes: 0 additions & 11 deletions io.elementary.code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ modules:
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

- name: git2-glib
buildsystem: meson
builddir: true
Expand Down
6 changes: 2 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@ gnome = import('gnome')
i18n = import('i18n')

glib_dep = dependency('glib-2.0', version: '>=2.30.0')
gmodule_dep = dependency('gmodule-2.0', version: '>=2.30.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')
git_dep = dependency('libgit2-glib-1.0')
fontconfig_dep = dependency('fontconfig')
pangofc_dep = dependency('pangoft2')
Expand All @@ -52,14 +51,13 @@ vala_dep = dependency('libvala-@0@'.format(vala_version))

dependencies = [
glib_dep,
gmodule_dep,
gio_unix_dep,
gee_dep,
gtk_dep,
granite_dep,
handy_dep,
gtksourceview_dep,
peas_dep,
peasgtk_dep,
git_dep,
fontconfig_dep,
pangofc_dep,
Expand Down
32 changes: 16 additions & 16 deletions plugins/brackets-completion/brackets-completion.vala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
/***
BEGIN LICENSE

Copyright (C) 2013 Mario Guerriero <[email protected]>
Copyright (C) 2019-24 elementary, Inc. <https://elementary.io>
2013 Mario Guerriero <[email protected]>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License version 3, as published
by the Free Software Foundation.
Expand All @@ -18,7 +19,7 @@
END LICENSE
***/

public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Peas.Activatable {
public class Scratch.Plugins.BracketsCompletion : Scratch.Plugins.PluginBase {
Gee.HashMap<string, string> brackets;
Gee.HashMap<uint, string> keys;
const string[] VALID_NEXT_CHARS = {
Expand All @@ -30,12 +31,12 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Peas.Activ

private string previous_selection = "";

Scratch.Services.Interface plugins;
public Object object { owned get; construct; }

public void update_state () {}
public BracketsCompletion (PluginInfo info, Interface iface) {
base (info, iface);
}

public void activate () {
ulong doc_hook_handler = 0;
protected override void activate_internal () {
brackets = new Gee.HashMap<string, string> ();
brackets["("] = ")";
brackets["["] = "]";
Expand All @@ -55,12 +56,11 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Peas.Activ
keys[Gdk.Key.quotedbl] = "\"";
keys[Gdk.Key.grave] = "`";

plugins = (Scratch.Services.Interface) object;
plugins.hook_document.connect (on_hook_document);
doc_hook_handler = iface.hook_document.connect (on_hook_document);
}

public void deactivate () {
plugins.hook_document.disconnect (on_hook_document);
protected override void deactivate_internal () {
iface.disconnect (doc_hook_handler);
}

void on_hook_document (Scratch.Services.Document doc) {
Expand Down Expand Up @@ -275,9 +275,9 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Peas.Activ
}
}

[ModuleInit]
public void peas_register_types (GLib.TypeModule module) {
var objmodule = module as Peas.ObjectModule;
objmodule.register_extension_type (typeof (Peas.Activatable),
typeof (Scratch.Plugins.BracketsCompletion));
public Scratch.Plugins.PluginBase module_init (
Scratch.Plugins.PluginInfo info,
Scratch.Plugins.Interface iface
) {
return new Scratch.Plugins.BracketsCompletion (info, iface);
}
52 changes: 33 additions & 19 deletions plugins/detect-indent/detect-indent.vala
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
public class Scratch.Plugins.DetectIndent: Peas.ExtensionBase, Peas.Activatable {
// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
/***
BEGIN LICENSE

Copyright (C) 2019-24 elementary, Inc. <https://elementary.io>
2013 LemonBoy <[email protected]>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License version 3, as published
by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranties of
MERCHANTABILITY, SATISFACTORY QUALITY, 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, see <http://www.gnu.org/licenses/>

END LICENSE
***/
public class Scratch.Plugins.DetectIndent: Scratch.Plugins.PluginBase {
const int MAX_LINES = 500;

Scratch.Services.Interface plugins;
public Object object {owned get; construct;}

public void update_state () {
public DetectIndent (PluginInfo info, Interface iface) {
base (info, iface);
}

public void activate () {
plugins = (Scratch.Services.Interface) object;

plugins.hook_document.connect ((d) => {
ulong doc_hook_handler = 0;
protected override void activate_internal () {
doc_hook_handler = iface.hook_document.connect ((d) => {
var view = d.source_view;

if (!view.get_editable ()) {
Expand Down Expand Up @@ -69,17 +86,14 @@ public class Scratch.Plugins.DetectIndent: Peas.ExtensionBase, Peas.Activatable
});
}

public void deactivate () {

protected override void deactivate_internal () {
iface.disconnect (doc_hook_handler);
}

}

[ModuleInit]
public void peas_register_types (GLib.TypeModule module) {
var objmodule = module as Peas.ObjectModule;
objmodule.register_extension_type (
typeof (Peas.Activatable),
typeof (Scratch.Plugins.DetectIndent)
);
public Scratch.Plugins.PluginBase module_init (
Scratch.Plugins.PluginInfo info,
Scratch.Plugins.Interface iface
) {
return new Scratch.Plugins.DetectIndent (info, iface);
}
71 changes: 37 additions & 34 deletions plugins/editorconfig/editorconfig.vala
Original file line number Diff line number Diff line change
@@ -1,37 +1,33 @@
/*
* Copyright (c) 2018 elementary LLC. (https://github.com/elementary)
*
* 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 3 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
*/
// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
/***
BEGIN LICENSE

public class Scratch.Plugins.EditorConfigPlugin: Peas.ExtensionBase, Peas.Activatable {
Scratch.Services.Interface plugins;
public Object object { owned get; construct; }
private Code.FormatBar format_bar;
Copyright (C) 2018-24 elementary, Inc. <https://elementary.io>
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License version 3, as published
by the Free Software Foundation.

public void update_state () { }
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranties of
MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.

public void activate () {
plugins = (Scratch.Services.Interface) object;
You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>

plugins.hook_toolbar.connect ((tb) => {
format_bar = tb.format_bar;
});
END LICENSE
***/

plugins.hook_document.connect ((d) => {
public class Scratch.Plugins.EditorConfigPlugin: Scratch.Plugins.PluginBase {
private Code.FormatBar format_bar;

public EditorConfigPlugin (PluginInfo info, Interface iface) {
base (info, iface);
}

ulong doc_hook_handler = 0;
protected override void activate_internal () {
doc_hook_handler = iface.hook_document.connect ((d) => {
// Ensure use global settings by default
format_bar.tab_style_set_by_editor_config = false;
format_bar.tab_width_set_by_editor_config = false;
Expand Down Expand Up @@ -83,13 +79,20 @@ public class Scratch.Plugins.EditorConfigPlugin: Peas.ExtensionBase, Peas.Activa
}
}
});

iface.hook_toolbar.connect ((tb) => {
format_bar = tb.format_bar;
});
}

public void deactivate () { }
protected override void deactivate_internal () {
iface.disconnect (doc_hook_handler);
}
}

[ModuleInit]
public void peas_register_types (GLib.TypeModule module) {
var objmodule = module as Peas.ObjectModule;
objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.EditorConfigPlugin));
public Scratch.Plugins.PluginBase module_init (
Scratch.Plugins.PluginInfo info,
Scratch.Plugins.Interface iface
) {
return new Scratch.Plugins.EditorConfigPlugin (info, iface);
}
52 changes: 25 additions & 27 deletions plugins/fuzzy-search/fuzzy-search.vala
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2023 elementary, Inc. <https://elementary.io>
* SPDX-FileCopyrightText: 2023-24 elementary, Inc. <https://elementary.io>
*
* Authored by: Marvin Ahlgrimm
*/


public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Peas.Activatable {
public Object object { owned get; construct; }
public class Scratch.Plugins.FuzzySearch: Scratch.Plugins.PluginBase {
private const uint ACCEL_KEY = Gdk.Key.F;
private const Gdk.ModifierType ACCEL_MODTYPE = Gdk.ModifierType.MOD1_MASK;

private Scratch.Services.FuzzySearchIndexer indexer;
private MainWindow window = null;
private Scratch.Services.Interface plugins;
private GLib.MenuItem fuzzy_menuitem;
private GLib.Cancellable cancellable;

Expand All @@ -33,14 +31,14 @@ public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Peas.Activatable {
action_accelerators.set (ACTION_SHOW, @"<Alt>$(Gdk.keyval_name (ACCEL_KEY))");
}

public void update_state () {

public FuzzySearch (PluginInfo info, Interface iface) {
base (info, iface);
}

public void activate () {
plugins = (Scratch.Services.Interface) object;

plugins.hook_window.connect ((w) => {
ulong window_hook_handler = 0;
ulong folder_hook_handler = 0;
protected override void activate_internal () {
window_hook_handler = iface.hook_window.connect ((w) => {
if (window != null) {
return;
}
Expand All @@ -59,7 +57,7 @@ public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Peas.Activatable {
folder_settings.changed["opened-folders"].connect (handle_opened_projects_change);
});

plugins.hook_folder_item_change.connect ((src, dest, event) => {
folder_hook_handler = iface.hook_folder_item_change.connect ((src, dest, event) => {
if (indexer == null) {
return;
}
Expand All @@ -68,6 +66,17 @@ public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Peas.Activatable {
});
}

protected override void deactivate_internal () {
folder_settings.changed["opened-folders"].disconnect (handle_opened_projects_change);
remove_actions ();
if (cancellable != null) {
cancellable.cancel ();
}

iface.disconnect (window_hook_handler);
iface.disconnect (folder_hook_handler);
}

private void add_actions () {
if (actions == null) {
actions = new SimpleActionGroup ();
Expand Down Expand Up @@ -138,27 +147,16 @@ public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Peas.Activatable {
popover.popup ();
}

public void deactivate () {
folder_settings.changed["opened-folders"].disconnect (handle_opened_projects_change);
remove_actions ();
if (cancellable != null) {
cancellable.cancel ();
}
}


private void handle_opened_projects_change () {
var show_action = Utils.action_from_group (ACTION_SHOW, actions);
string[] opened_folders = folder_settings.get_strv ("opened-folders");
show_action.set_enabled (opened_folders != null && opened_folders.length > 0);
}
}

[ModuleInit]
public void peas_register_types (GLib.TypeModule module) {
var objmodule = module as Peas.ObjectModule;
objmodule.register_extension_type (
typeof (Peas.Activatable),
typeof (Scratch.Plugins.FuzzySearch)
);
public Scratch.Plugins.PluginBase module_init (
Scratch.Plugins.PluginInfo info,
Scratch.Plugins.Interface iface
) {
return new Scratch.Plugins.FuzzySearch (info, iface);
}
Loading
Loading