Skip to content
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
1 change: 0 additions & 1 deletion geany/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def on_preferences_button_clicked(self, button, treeview, model):
def activate_plugin(self, filename):
self.loader.load_plugin(filename)


def deactivate_plugin(self, filename):
self.loader.unload_plugin(filename)

Expand Down
19 changes: 17 additions & 2 deletions src/geanypy-plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ static GtkWidget *loader_item = NULL;
static PyObject *manager = NULL;
static gchar *plugin_dir = NULL;
static SignalManager *signal_manager = NULL;
static GtkToolItem* toolbar_button = NULL;



/* Forward declarations to prevent compiler warnings. */
Expand Down Expand Up @@ -269,11 +271,25 @@ plugin_init(GeanyData *data)
gtk_widget_show(loader_item);
g_signal_connect(loader_item, "activate",
G_CALLBACK(on_python_plugin_loader_activate), NULL);
}

toolbar_button = gtk_tool_button_new_from_stock(GTK_STOCK_ADD);
if (toolbar_button != NULL)
{
plugin_add_toolbar_item(geany_plugin, toolbar_button);
ui_add_document_sensitive(GTK_WIDGET(toolbar_button));

g_signal_connect(toolbar_button, "clicked",
G_CALLBACK(on_python_plugin_loader_activate), NULL);

gtk_widget_show(GTK_WIDGET(toolbar_button));
}
}

G_MODULE_EXPORT void plugin_cleanup(void)
{
if (toolbar_button != NULL)
gtk_widget_destroy(GTK_WIDGET(toolbar_button));

PyObject* deactivate_all_plugins = PyObject_GetAttrString(manager,
"deactivate_all_plugins");
if (deactivate_all_plugins != NULL)
Expand All @@ -282,7 +298,6 @@ G_MODULE_EXPORT void plugin_cleanup(void)
if (r)
Py_DECREF(r);
Py_DECREF(deactivate_all_plugins);

}

signal_manager_free(signal_manager);
Expand Down