Skip to content

Commit

Permalink
Remove plugin set option (elementary#1324)
Browse files Browse the repository at this point in the history
* Remove plugin set option

* Remove plugin set option from manpage
  • Loading branch information
Jeremy Wootten authored Jun 18, 2023
1 parent a2719c0 commit d104736
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 34 deletions.
5 changes: 0 additions & 5 deletions data/io.elementary.code.1
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ Open a new window\.
Show a help message and exit\.
.
.TP
\fB\-s\fR, \fB\-\-set=\fR\fINAME\fR
Load Code with an alternative set of core plugins\. Code will be rebranded to this name\. This is useful for repurposing Code into IDEs using plugin sets\.
The name will be looked up in the plugin directory, typically /usr/lib/io.elementary.code/plugins/, and all plugins from the sub-directory \fINAME\fR will be loaded into Code as core plugins\.
.
.TP
\fB\-v\fR, \fB\-\-version\fR
Print version info and exit\.
.
Expand Down
5 changes: 0 additions & 5 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ namespace Scratch {
public GLib.Settings privacy_settings;

public class Application : Gtk.Application {
public string app_cmd_name { get { return _app_cmd_name; } }
public string data_home_folder_unsaved { get { return _data_home_folder_unsaved; } }
public string default_font { get; set; }
private static string _app_cmd_name;
private static string _data_home_folder_unsaved;
private static bool create_new_tab = false;
private static bool create_new_window = false;
Expand All @@ -39,14 +37,11 @@ namespace Scratch {
{ "new-tab", 't', 0, OptionArg.NONE, null, N_("New Tab"), null },
{ "new-window", 'n', 0, OptionArg.NONE, null, N_("New Window"), null },
{ "version", 'v', 0, OptionArg.NONE, null, N_("Print version info and exit"), null },
{ "set", 's', 0, OptionArg.STRING, ref _app_cmd_name, N_("Set of plugins"), N_("plugin") },
{ GLib.OPTION_REMAINING, 0, 0, OptionArg.FILENAME_ARRAY, null, null, N_("[FILE…]") },
{ null }
};

static construct {
_app_cmd_name = "Code";

// Init data home folder for unsaved text files
_data_home_folder_unsaved = Path.build_filename (
Environment.get_user_data_dir (), Constants.PROJECT_NAME, "unsaved"
Expand Down
2 changes: 1 addition & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ namespace Scratch {

clipboard = Gtk.Clipboard.get_for_display (get_display (), Gdk.SELECTION_CLIPBOARD);

plugins = new Scratch.Services.PluginsManager (this, app.app_cmd_name.down ());
plugins = new Scratch.Services.PluginsManager (this);

key_press_event.connect (on_key_pressed);

Expand Down
24 changes: 1 addition & 23 deletions src/Services/PluginManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ namespace Scratch.Services {
public class PluginsManager : GLib.Object {
Peas.Engine engine;
Peas.ExtensionSet exts;
Peas.Engine engine_core;
Peas.ExtensionSet exts_core;

string settings_field;

Expand All @@ -72,7 +70,7 @@ namespace Scratch.Services {
public signal void extension_added (Peas.PluginInfo info);
public signal void extension_removed (Peas.PluginInfo info);

public PluginsManager (MainWindow window, string? set_name = null) {
public PluginsManager (MainWindow window) {
this.window = window;

settings_field = "plugins-enabled";
Expand All @@ -98,26 +96,6 @@ namespace Scratch.Services {
});
exts.foreach (on_extension_foreach);

if (set_name != null) {
/* The core now */
engine_core = new Peas.Engine ();
engine_core.enable_loader ("python");
engine_core.add_search_path (Constants.PLUGINDIR + "/" + set_name + "/", null);

var core_list = engine_core.get_plugin_list ().copy ();
string[] core_plugins = new string[core_list.length ()];
for (int i = 0; i < core_list.length (); i++) {
core_plugins[i] = core_list.nth_data (i).get_module_name ();

}
engine_core.loaded_plugins = core_plugins;

/* Our extension set */
exts_core = new Peas.ExtensionSet (engine_core, typeof (Peas.Activatable), "object", plugin_iface, null);

exts_core.foreach (on_extension_foreach);
}

// Connect managers signals to interface's signals
this.hook_window.connect ((w) => {
plugin_iface.hook_window (w);
Expand Down

0 comments on commit d104736

Please sign in to comment.