81 GeanyAutoSeparator *autosep;
83 g_return_if_fail(plugin);
92 sep = gtk_separator_tool_item_new();
93 gtk_toolbar_insert(toolbar, sep,
pos);
94 autosep->widget = GTK_WIDGET(sep);
100 pos = gtk_toolbar_get_item_index(toolbar, GTK_TOOL_ITEM(autosep->widget));
101 g_return_if_fail(
pos >= 0);
104 gtk_toolbar_insert(toolbar, item,
pos + autosep->item_count + 1);
123 g_return_if_fail(plugin);
159 GObject *
object,
const gchar *signal_name, gboolean after,
160 GCallback callback, gpointer user_data)
165 g_return_if_fail(plugin !=
NULL);
166 g_return_if_fail(
object ==
NULL || G_IS_OBJECT(
object));
172 g_signal_connect_after(
object, signal_name, callback, user_data) :
173 g_signal_connect(
object, signal_name, callback, user_data);
225 g_slice_free1(
sizeof *psd, psd);
250 id = g_source_attach(source,
NULL);
251 g_source_unref(source);
274 return plugin_source_add(plugin, g_timeout_source_new(interval), function, data);
296 return plugin_source_add(plugin, g_timeout_source_new_seconds(interval), function, data);
338 return priv->key_group;
359 const gchar *section_name, gsize
count,
366 group->cb_data = pdata;
367 group->cb_data_destroy = destroy_notify;
381 GtkWidget *page =
NULL;
386 if (! GTK_IS_WIDGET(page))
388 geany_debug(
"Invalid widget returned from plugin_configure() in plugin \"%s\"!",
394 GtkWidget *align = gtk_alignment_new(0.5, 0.5, 1, 1);
396 gtk_alignment_set_padding(GTK_ALIGNMENT(align), 6, 6, 6, 6);
398 page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
399 gtk_box_pack_start(GTK_BOX(page), align, TRUE, TRUE, 0);
404 GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0, 0);
407 gtk_alignment_set_padding(GTK_ALIGNMENT(align), 6, 6, 6, 6);
409 btn = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES);
422 GtkWidget *
dialog, *vbox, *nb;
426 dialog = gtk_dialog_new_with_buttons(
_(
"Configure Plugins"),
428 GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
429 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
430 GTK_STOCK_OK, GTK_RESPONSE_OK,
NULL);
431 gtk_widget_set_name(
dialog,
"GeanyDialog");
434 nb = gtk_notebook_new();
435 gtk_notebook_set_scrollable(GTK_NOTEBOOK(nb), TRUE);
436 gtk_box_pack_start(GTK_BOX(vbox), nb, TRUE, TRUE, 0);
446 gint n = gtk_notebook_append_page(GTK_NOTEBOOK(nb), page,
label);
448 if (p == current_plugin)
452 if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(nb)))
456 gtk_notebook_set_current_page(GTK_NOTEBOOK(nb), cur_page);
459 while (gtk_dialog_run(GTK_DIALOG(
dialog)) == GTK_RESPONSE_APPLY);
464 gtk_widget_destroy(
dialog);
503 const gchar *signal_name,
const gchar *handler_name,
504 GObject *connect_object, GConnectFlags flags, gpointer user_data)
506 gpointer symbol =
NULL;
563 g_return_if_fail(GTK_IS_BUILDER(
builder));
619 g_return_if_fail(pdata !=
NULL);
632 g_warning(
"Invalid call to %s(), geany_plugin_register_full() was used. Ignored!\n", G_STRFUNC);
634 g_warning(
"Double call to %s(), ignored!", G_STRFUNC);
676 g_return_val_if_fail(doc !=
NULL,
NULL);
677 g_return_val_if_fail(key !=
NULL && *key !=
'\0',
NULL);
679 real_key = g_strdup_printf(
"geany/plugins/%s/%s",
plugin->
info->
name, key);
700 const gchar *key, gpointer data)
768 GDestroyNotify free_func)
773 g_return_if_fail(doc !=
NULL);
774 g_return_if_fail(key !=
NULL);
779 gchar *real_key = g_strdup_printf(
"geany/plugins/%s/%s",
plugin->
info->
name, key);
void document_set_data_full(GeanyDocument *doc, const gchar *key, gpointer data, GDestroyNotify free_func)
gpointer document_get_data(const GeanyDocument *doc, const gchar *key)
GeanyKeyGroup * keybindings_set_group(GeanyKeyGroup *group, const gchar *section_name, const gchar *label, gsize count, GeanyKeyGroupCallback callback)
Configurable keyboard shortcuts.
gboolean(* GeanyKeyGroupCallback)(guint key_id)
Function pointer type used for keybinding group callbacks.
gboolean(* GeanyKeyGroupFunc)(GeanyKeyGroup *group, guint key_id, gpointer user_data)
Function pointer type used for keybinding group callbacks, with userdata for passing context.
void geany_debug(gchar const *format,...)
This file defines the plugin API, the interface between Geany and its plugins.
#define GEANY_API_VERSION
The Application Programming Interface (API) version, incremented whenever any plugin data types are m...
void plugin_watch_object(Plugin *plugin, gpointer object)
gpointer plugin_get_module_symbol(Plugin *plugin, const gchar *sym)
void plugin_make_resident(Plugin *plugin)
#define PLUGIN_LOADED_OK(p)
#define PLUGIN_HAS_LOAD_DATA(p)
GList * active_plugin_list
void plugin_show_configure(GeanyPlugin *plugin)
Shows the plugin's configure dialog.
static void psd_register(PluginSourceData *psd, GSource *source)
guint plugin_idle_add(GeanyPlugin *plugin, GSourceFunc function, gpointer data)
<simplesect kind="geany:skip"></simplesect> Adds a GLib main loop IDLE callback that will be removed ...
static void on_pref_btn_clicked(gpointer btn, Plugin *p)
void plugin_set_document_data_full(struct GeanyPlugin *plugin, struct GeanyDocument *doc, const gchar *key, gpointer data, GDestroyNotify free_func)
Attach plugin-specific data and a free function to a document.
static void plugin_doc_data_proxy_free(gpointer pdata)
void geany_plugin_set_data(GeanyPlugin *plugin, gpointer pdata, GDestroyNotify free_func)
Add additional data that corresponds to the plugin.
static void connect_plugin_signals(GtkBuilder *builder, GObject *object, const gchar *signal_name, const gchar *handler_name, GObject *connect_object, GConnectFlags flags, gpointer user_data)
static void psd_unregister(PluginSourceData *psd)
struct PluginSourceData PluginSourceData
static void configure_plugins(Plugin *current_plugin)
GeanyKeyGroup * plugin_set_key_group_full(GeanyPlugin *plugin, const gchar *section_name, gsize count, GeanyKeyGroupFunc cb, gpointer pdata, GDestroyNotify destroy_notify)
Sets up or resizes a keybinding group for the plugin.
void plugin_module_make_resident(GeanyPlugin *plugin)
Ensures that a plugin's module (*.so) will never be unloaded.
static gboolean on_plugin_source_callback(gpointer data)
void plugin_set_document_data(struct GeanyPlugin *plugin, struct GeanyDocument *doc, const gchar *key, gpointer data)
Attach plugin-specific data to a document.
static GtkWidget * create_pref_page(Plugin *p, GtkWidget *dialog)
static guint plugin_source_add(GeanyPlugin *plugin, GSource *source, GSourceFunc func, gpointer data)
guint plugin_timeout_add_seconds(GeanyPlugin *plugin, guint interval, GSourceFunc function, gpointer data)
<simplesect kind="geany:skip"></simplesect> Adds a GLib main loop timeout callback that will be remov...
gpointer plugin_get_document_data(struct GeanyPlugin *plugin, struct GeanyDocument *doc, const gchar *key)
Retrieve plugin-specific data attached to a document.
GeanyKeyGroup * plugin_set_key_group(GeanyPlugin *plugin, const gchar *section_name, gsize count, GeanyKeyGroupCallback callback)
<simplesect kind="geany:skip"></simplesect> Sets up or resizes a keybinding group for the plugin.
void plugin_signal_connect(GeanyPlugin *plugin, GObject *object, const gchar *signal_name, gboolean after, GCallback callback, gpointer user_data)
<simplesect kind="geany:skip"></simplesect> Connects a signal which will be disconnected on unloading...
static void on_plugin_source_destroy(gpointer data)
gint geany_api_version(void)
Returns the runtime API version Geany was compiled with.
gpointer geany_plugin_get_data(const GeanyPlugin *plugin)
Get the additional data that corresponds to the plugin.
void plugin_add_toolbar_item(GeanyPlugin *plugin, GtkToolItem *item)
Inserts a toolbar item before the Quit button, or after the previous plugin toolbar item.
void plugin_builder_connect_signals(GeanyPlugin *plugin, GtkBuilder *builder, gpointer user_data)
Allows auto-connecting Glade/GtkBuilder signals in plugins.
guint plugin_timeout_add(GeanyPlugin *plugin, guint interval, GSourceFunc function, gpointer data)
<simplesect kind="geany:skip"></simplesect> Adds a GLib main loop timeout callback that will be remov...
Plugin utility functions.
static GeanyProjectPrivate priv
gtk_container_add(GTK_CONTAINER(dialog->vbox), check_button)
gtk_widget_show_all(dialog)
Structure for representing an open tab with all its properties.
GtkWidget * window
Main window.
GtkWidget * toolbar
Main toolbar.
GtkWidget *(* configure)(GeanyPlugin *plugin, GtkDialog *dialog, gpointer pdata)
plugins configure dialog, optional (can be NULL)
void(* configure_single)(GtkWidget *parent)
GeanyAutoSeparator toolbar_separator
GDestroyNotify cb_data_destroy
Basic information for the plugin and identification.
PluginInfo * info
Fields set in plugin_set_info().
struct GeanyPluginPrivate * priv
const gchar * name
The name of the plugin.
Defines internationalization macros.
GtkWidget * ui_dialog_vbox_new(GtkDialog *dialog)
Makes a fixed border for dialogs without increasing the button box border.
GeanyMainWidgets main_widgets
void ui_auto_separator_add_ref(GeanyAutoSeparator *autosep, GtkWidget *item)
static GtkBuilder * builder
User Interface general utility functions.
General utility functions, non-GTK related.
#define foreach_list(node, list)
Iterates all the nodes in list.