2 * pluginutils.c - this file is part of Geany, a fast and lightweight IDE
4 * Copyright 2009-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
5 * Copyright 2009-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 /** @file pluginutils.h
23 * Plugin utility functions.
24 * These functions all take the @ref geany_plugin symbol as their first argument. */
32 #include "pluginutils.h"
35 #include "geanyobject.h"
36 #include "keybindings.h"
37 #include "keybindingsprivate.h"
38 #include "plugindata.h"
39 #include "pluginprivate.h"
50 GDestroyNotify free_func
;
55 /** Inserts a toolbar item before the Quit button, or after the previous plugin toolbar item.
56 * A separator is added on the first call to this function, and will be shown when @a item is
57 * shown; hidden when @a item is hidden.
58 * @note You should still destroy @a item yourself, usually in @ref plugin_cleanup().
59 * @param plugin Must be @ref geany_plugin.
60 * @param item The item to add. */
62 void plugin_add_toolbar_item(GeanyPlugin
*plugin
, GtkToolItem
*item
)
64 GtkToolbar
*toolbar
= GTK_TOOLBAR(main_widgets
.toolbar
);
66 GeanyAutoSeparator
*autosep
;
68 g_return_if_fail(plugin
);
69 autosep
= &plugin
->priv
->toolbar_separator
;
75 pos
= toolbar_get_insert_position();
77 sep
= gtk_separator_tool_item_new();
78 gtk_toolbar_insert(toolbar
, sep
, pos
);
79 autosep
->widget
= GTK_WIDGET(sep
);
81 toolbar_item_ref(sep
);
85 pos
= gtk_toolbar_get_item_index(toolbar
, GTK_TOOL_ITEM(autosep
->widget
));
86 g_return_if_fail(pos
>= 0);
89 gtk_toolbar_insert(toolbar
, item
, pos
+ autosep
->item_count
+ 1);
90 toolbar_item_ref(item
);
92 /* hide the separator widget if there are no toolbar items showing for the plugin */
93 ui_auto_separator_add_ref(autosep
, GTK_WIDGET(item
));
97 /** Ensures that a plugin's module (*.so) will never be unloaded.
98 * This is necessary if you register new GTypes in your plugin, e.g. when using own classes
99 * using the GObject system.
101 * @param plugin Must be @ref geany_plugin.
106 void plugin_module_make_resident(GeanyPlugin
*plugin
)
108 g_return_if_fail(plugin
);
109 plugin_make_resident(plugin
->priv
);
114 * Connects a signal which will be disconnected on unloading the plugin, to prevent a possible segfault.
115 * @param plugin Must be @ref geany_plugin.
116 * @param object @nullable Object to connect to, or @c NULL when using @link pluginsignals.c Geany signals @endlink.
117 * @param signal_name The name of the signal. For a list of available
118 * signals, please see the @link pluginsignals.c Signal documentation @endlink.
119 * @param after Set to @c TRUE to call your handler after the main signal handlers have been called
120 * (if supported by @a signal_name).
121 * @param callback The function to call when the signal is emitted.
122 * @param user_data The user data passed to the signal handler.
123 * @see plugin_callbacks.
125 * @warning Before version 1.25 (API < 218),
126 * this should only be used on objects that outlive the plugin, never on
127 * objects that will get destroyed before the plugin is unloaded. For objects
128 * created and destroyed by the plugin, you can simply use @c g_signal_connect(),
129 * since all handlers are disconnected when the object is destroyed anyway.
130 * For objects that may or may not outlive the plugin (like @link GeanyEditor.sci
131 * a document's @c ScintillaObject @endlink, which is destroyed when the document
132 * is closed), you currently have to manually handle both situations, when the
133 * plugin is unloaded before the object is destroyed (and then, you have to
134 * disconnect the signal on @c plugin_cleanup()), and when the object is destroyed
135 * during the plugin's lifetime (in which case you cannot and should not disconnect
136 * manually in @c plugin_cleanup() since it already has been disconnected and the
137 * object has been destroyed), and disconnect yourself or not as appropriate.
138 * @note Since version 1.25 (API >= 218), the object lifetime is watched and so the above
139 * restriction does not apply. However, for objects destroyed by the plugin,
140 * @c g_signal_connect() is safe and has lower overhead.
143 void plugin_signal_connect(GeanyPlugin
*plugin
,
144 GObject
*object
, const gchar
*signal_name
, gboolean after
,
145 GCallback callback
, gpointer user_data
)
150 g_return_if_fail(plugin
!= NULL
);
151 g_return_if_fail(object
== NULL
|| G_IS_OBJECT(object
));
154 object
= geany_object
;
157 g_signal_connect_after(object
, signal_name
, callback
, user_data
) :
158 g_signal_connect(object
, signal_name
, callback
, user_data
);
160 if (!plugin
->priv
->signal_ids
)
161 plugin
->priv
->signal_ids
= g_array_new(FALSE
, FALSE
, sizeof(SignalConnection
));
165 g_array_append_val(plugin
->priv
->signal_ids
, sc
);
167 /* watch the object lifetime to nuke our pointers to it */
168 plugin_watch_object(plugin
->priv
, object
);
172 typedef struct PluginSourceData
175 GList list_link
; /* element of plugin->sources cointaining this GSource */
176 GSourceFunc function
;
181 /* prepend psd->list_link to psd->plugin->sources */
182 static void psd_register(PluginSourceData
*psd
, GSource
*source
)
184 psd
->list_link
.data
= source
;
185 psd
->list_link
.prev
= NULL
;
186 psd
->list_link
.next
= psd
->plugin
->sources
;
187 if (psd
->list_link
.next
)
188 psd
->list_link
.next
->prev
= &psd
->list_link
;
189 psd
->plugin
->sources
= &psd
->list_link
;
193 /* removes psd->list_link from psd->plugin->sources */
194 static void psd_unregister(PluginSourceData
*psd
)
196 if (psd
->list_link
.next
)
197 psd
->list_link
.next
->prev
= psd
->list_link
.prev
;
198 if (psd
->list_link
.prev
)
199 psd
->list_link
.prev
->next
= psd
->list_link
.next
;
200 else /* we were the first of the list, update the plugin->sources pointer */
201 psd
->plugin
->sources
= psd
->list_link
.next
;
205 static void on_plugin_source_destroy(gpointer data
)
207 PluginSourceData
*psd
= data
;
210 g_slice_free1(sizeof *psd
, psd
);
214 static gboolean
on_plugin_source_callback(gpointer data
)
216 PluginSourceData
*psd
= data
;
218 return psd
->function(psd
->user_data
);
222 /* adds the given source to the default GMainContext and to the list of sources to remove at plugin
224 static guint
plugin_source_add(GeanyPlugin
*plugin
, GSource
*source
, GSourceFunc func
, gpointer data
)
227 PluginSourceData
*psd
= g_slice_alloc(sizeof *psd
);
229 psd
->plugin
= plugin
->priv
;
230 psd
->function
= func
;
231 psd
->user_data
= data
;
233 g_source_set_callback(source
, on_plugin_source_callback
, psd
, on_plugin_source_destroy
);
234 psd_register(psd
, source
);
235 id
= g_source_attach(source
, NULL
);
236 g_source_unref(source
);
243 * Adds a GLib main loop timeout callback that will be removed when unloading the plugin,
244 * preventing it to run after the plugin has been unloaded (which may lead to a segfault).
246 * @param plugin Must be @ref geany_plugin.
247 * @param interval The time between calls to the function, in milliseconds.
248 * @param function The function to call after the given timeout.
249 * @param data The user data passed to the function.
250 * @return the ID of the event source (you generally won't need it, or better use g_timeout_add()
251 * directly if you want to manage this event source manually).
253 * @see g_timeout_add()
254 * @since 0.21, plugin API 205.
257 guint
plugin_timeout_add(GeanyPlugin
*plugin
, guint interval
, GSourceFunc function
, gpointer data
)
259 return plugin_source_add(plugin
, g_timeout_source_new(interval
), function
, data
);
264 * Adds a GLib main loop timeout callback that will be removed when unloading the plugin,
265 * preventing it to run after the plugin has been unloaded (which may lead to a segfault).
267 * @param plugin Must be @ref geany_plugin.
268 * @param interval The time between calls to the function, in seconds.
269 * @param function The function to call after the given timeout.
270 * @param data The user data passed to the function.
271 * @return the ID of the event source (you generally won't need it, or better use
272 * g_timeout_add_seconds() directly if you want to manage this event source manually).
274 * @see g_timeout_add_seconds()
275 * @since 0.21, plugin API 205.
278 guint
plugin_timeout_add_seconds(GeanyPlugin
*plugin
, guint interval
, GSourceFunc function
,
281 return plugin_source_add(plugin
, g_timeout_source_new_seconds(interval
), function
, data
);
286 * Adds a GLib main loop IDLE callback that will be removed when unloading the plugin, preventing
287 * it to run after the plugin has been unloaded (which may lead to a segfault).
289 * @param plugin Must be @ref geany_plugin.
290 * @param function The function to call in IDLE time.
291 * @param data The user data passed to the function.
292 * @return the ID of the event source (you generally won't need it, or better use g_idle_add()
293 * directly if you want to manage this event source manually).
296 * @since 0.21, plugin API 205.
299 guint
plugin_idle_add(GeanyPlugin
*plugin
, GSourceFunc function
, gpointer data
)
301 return plugin_source_add(plugin
, g_idle_source_new(), function
, data
);
306 * Sets up or resizes a keybinding group for the plugin.
307 * You should then call keybindings_set_item() for each keybinding in the group.
308 * @param plugin Must be @ref geany_plugin.
309 * @param section_name Name of the section used for this group in the keybindings configuration file, i.e. @c "html_chars".
310 * @param count Number of keybindings for the group.
311 * @param callback @nullable Group callback, or @c NULL if you only want individual keybinding callbacks.
312 * @return The plugin's keybinding group.
316 GeanyKeyGroup
*plugin_set_key_group(GeanyPlugin
*plugin
,
317 const gchar
*section_name
, gsize count
, GeanyKeyGroupCallback callback
)
319 Plugin
*priv
= plugin
->priv
;
321 priv
->key_group
= keybindings_set_group(priv
->key_group
, section_name
,
322 priv
->info
.name
, count
, callback
);
323 return priv
->key_group
;
326 /** Sets up or resizes a keybinding group for the plugin
328 * You should then call keybindings_set_item() or keybindings_set_item_full() for each
329 * keybinding in the group.
330 * @param plugin Must be @ref geany_plugin.
331 * @param section_name Name of the section used for this group in the keybindings configuration file, i.e. @c "html_chars".
332 * @param count Number of keybindings for the group.
333 * @param cb @nullable New-style group callback, or @c NULL if you only want individual keybinding callbacks.
334 * @param pdata Plugin specific data, passed to the group callback @a cb.
335 * @param destroy_notify Function that is invoked to free the plugin data when not needed anymore.
336 * @return @transfer{none} The plugin's keybinding group.
338 * @since 1.26 (API 226)
339 * @see See keybindings_set_item
340 * @see See keybindings_set_item_full
343 GeanyKeyGroup
*plugin_set_key_group_full(GeanyPlugin
*plugin
,
344 const gchar
*section_name
, gsize count
,
345 GeanyKeyGroupFunc cb
, gpointer pdata
, GDestroyNotify destroy_notify
)
347 GeanyKeyGroup
*group
;
349 group
= plugin_set_key_group(plugin
, section_name
, count
, NULL
);
351 group
->cb_data
= pdata
;
352 group
->cb_data_destroy
= destroy_notify
;
358 static void on_pref_btn_clicked(gpointer btn
, Plugin
*p
)
360 p
->configure_single(main_widgets
.window
);
364 static GtkWidget
*create_pref_page(Plugin
*p
, GtkWidget
*dialog
)
366 GtkWidget
*page
= NULL
; /* some plugins don't have prefs */
368 if (p
->cbs
.configure
)
370 page
= p
->cbs
.configure(&p
->public, GTK_DIALOG(dialog
), p
->cb_data
);
371 if (! GTK_IS_WIDGET(page
))
373 geany_debug("Invalid widget returned from plugin_configure() in plugin \"%s\"!",
379 GtkWidget
*align
= gtk_alignment_new(0.5, 0.5, 1, 1);
381 gtk_alignment_set_padding(GTK_ALIGNMENT(align
), 6, 6, 6, 6);
382 gtk_container_add(GTK_CONTAINER(align
), page
);
383 page
= gtk_vbox_new(FALSE
, 0);
384 gtk_box_pack_start(GTK_BOX(page
), align
, TRUE
, TRUE
, 0);
387 else if (p
->configure_single
)
389 GtkWidget
*align
= gtk_alignment_new(0.5, 0.5, 0, 0);
392 gtk_alignment_set_padding(GTK_ALIGNMENT(align
), 6, 6, 6, 6);
394 btn
= gtk_button_new_from_stock(GTK_STOCK_PREFERENCES
);
395 g_signal_connect(btn
, "clicked", G_CALLBACK(on_pref_btn_clicked
), p
);
396 gtk_container_add(GTK_CONTAINER(align
), btn
);
403 /* multiple plugin configure dialog
404 * current_plugin can be NULL */
405 static void configure_plugins(Plugin
*current_plugin
)
407 GtkWidget
*dialog
, *vbox
, *nb
;
411 dialog
= gtk_dialog_new_with_buttons(_("Configure Plugins"),
412 GTK_WINDOW(main_widgets
.window
), GTK_DIALOG_DESTROY_WITH_PARENT
,
413 GTK_STOCK_APPLY
, GTK_RESPONSE_APPLY
,
414 GTK_STOCK_CANCEL
, GTK_RESPONSE_CANCEL
,
415 GTK_STOCK_OK
, GTK_RESPONSE_OK
, NULL
);
416 gtk_widget_set_name(dialog
, "GeanyDialog");
418 vbox
= ui_dialog_vbox_new(GTK_DIALOG(dialog
));
419 nb
= gtk_notebook_new();
420 gtk_notebook_set_scrollable(GTK_NOTEBOOK(nb
), TRUE
);
421 gtk_box_pack_start(GTK_BOX(vbox
), nb
, TRUE
, TRUE
, 0);
423 foreach_list(node
, active_plugin_list
)
425 Plugin
*p
= node
->data
;
426 GtkWidget
*page
= create_pref_page(p
, dialog
);
430 GtkWidget
*label
= gtk_label_new(p
->info
.name
);
431 gint n
= gtk_notebook_append_page(GTK_NOTEBOOK(nb
), page
, label
);
433 if (p
== current_plugin
)
437 if (gtk_notebook_get_n_pages(GTK_NOTEBOOK(nb
)))
439 gtk_widget_show_all(vbox
);
441 gtk_notebook_set_current_page(GTK_NOTEBOOK(nb
), cur_page
);
444 while (gtk_dialog_run(GTK_DIALOG(dialog
)) == GTK_RESPONSE_APPLY
);
449 gtk_widget_destroy(dialog
);
453 /** Shows the plugin's configure dialog.
454 * The plugin must implement one of the plugin_configure() or plugin_configure_single() symbols.
455 * @param plugin Must be @ref geany_plugin.
457 /* if NULL, show all plugins */
459 void plugin_show_configure(GeanyPlugin
*plugin
)
465 configure_plugins(NULL
);
470 if (p
->cbs
.configure
)
471 configure_plugins(p
);
474 g_return_if_fail(p
->configure_single
);
475 p
->configure_single(main_widgets
.window
);
480 struct BuilderConnectData
487 static void connect_plugin_signals(GtkBuilder
*builder
, GObject
*object
,
488 const gchar
*signal_name
, const gchar
*handler_name
,
489 GObject
*connect_object
, GConnectFlags flags
, gpointer user_data
)
491 gpointer symbol
= NULL
;
492 struct BuilderConnectData
*data
= user_data
;
494 symbol
= plugin_get_module_symbol(data
->plugin
->priv
, handler_name
);
496 plugin_signal_connect(data
->plugin
, object
, signal_name
, FALSE
,
497 G_CALLBACK(symbol
) /*ub?*/, data
->user_data
);
502 * Allows auto-connecting Glade/GtkBuilder signals in plugins.
504 * When a plugin uses GtkBuilder to load some UI from file/string,
505 * the gtk_builder_connect_signals() function is unable to automatically
506 * connect to the plugin's signal handlers. A plugin could itself use
507 * the gtk_builder_connect_signals_full() function to automatically
508 * connect to the signal handler functions by loading it's GModule
509 * and retrieving pointers to the handler functions, but rather than
510 * each plugin having to do that, this function handles it automatically.
514 * GeanyPlugin *geany_plugin;
516 * G_MODULE_EXPORT void
517 * myplugin_button_clicked(GtkButton *button, gpointer user_data)
519 * g_print("Button pressed\n");
522 * void plugin_init(GeanyData *data)
524 * GtkBuilder *builder = gtk_builder_new();
525 * gtk_builder_add_from_file(builder, "gui.glade", NULL);
526 * plugin_builder_connect_signals(geany_plugin, builder, NULL);
531 * @note It's important that you prefix your callback handlers with
532 * a plugin-specific prefix to avoid clashing with other plugins since
533 * the function symbols will be exported process-wide.
535 * @param plugin Must be @ref geany_plugin.
536 * @param builder The GtkBuilder to connect signals with.
537 * @param user_data User data to pass to the connected signal handlers.
539 * @since 1.24, plugin API 217.
542 void plugin_builder_connect_signals(GeanyPlugin
*plugin
,
543 GtkBuilder
*builder
, gpointer user_data
)
545 struct BuilderConnectData data
= { NULL
};
547 g_return_if_fail(plugin
!= NULL
&& plugin
->priv
!= NULL
);
548 g_return_if_fail(GTK_IS_BUILDER(builder
));
550 data
.user_data
= user_data
;
551 data
.plugin
= plugin
;
553 gtk_builder_connect_signals_full(builder
, connect_plugin_signals
, &data
);
557 /** Add additional data that corresponds to the plugin.
559 * @p pdata is the pointer going to be passed to the individual plugin callbacks
560 * of GeanyPlugin::funcs. When the plugin is cleaned up, @p free_func is invoked for the data,
561 * which connects the data to the time the plugin is enabled.
563 * One intended use case is to set GObjects as data and have them destroyed automatically
564 * by passing g_object_unref() as @a free_func, so that member functions can be used
565 * for the @ref GeanyPluginFuncs (via wrappers) but you can set completely custom data.
567 * Be aware that this can only be called once and only by plugins registered via
568 * @ref geany_plugin_register(). So-called legacy plugins cannot use this function.
570 * @note This function must not be called if the plugin was registered with
571 * geany_plugin_register_full().
573 * @param plugin The plugin provided by Geany
574 * @param pdata The plugin's data to associate, must not be @c NULL
575 * @param free_func The destroy notify
577 * @since 1.26 (API 225)
580 void geany_plugin_set_data(GeanyPlugin
*plugin
, gpointer pdata
, GDestroyNotify free_func
)
582 Plugin
*p
= plugin
->priv
;
584 g_return_if_fail(PLUGIN_LOADED_OK(p
));
585 /* Do not allow calling this only to set a notify. */
586 g_return_if_fail(pdata
!= NULL
);
587 /* The rationale to allow only setting the data once is the following:
588 * In the future we want to support proxy plugins (which bind non-C plugins to
589 * Geany's plugin api). These proxy plugins might need to own the data pointer
590 * on behalf of the proxied plugin. However, if not, then the plugin should be
591 * free to use it. This way we can make sure the plugin doesn't accidentally
594 * Better a more limited API now that can be opened up later than a potentially
595 * wrong one that can only be replaced by another one. */
596 if (p
->cb_data
!= NULL
|| p
->cb_data_destroy
!= NULL
)
598 if (PLUGIN_HAS_LOAD_DATA(p
))
599 g_warning("Invalid call to %s(), geany_plugin_register_full() was used. Ignored!\n", G_STRFUNC
);
601 g_warning("Double call to %s(), ignored!", G_STRFUNC
);
606 p
->cb_data_destroy
= free_func
;
610 static void plugin_doc_data_proxy_free(gpointer pdata
)
612 PluginDocDataProxy
*prox
= pdata
;
616 prox
->free_func(prox
->data
);
617 g_slice_free(PluginDocDataProxy
, prox
);
623 * Retrieve plugin-specific data attached to a document.
625 * @param plugin The plugin who attached the data.
626 * @param doc The document which the data was attached to.
627 * @param key The key name of the attached data.
629 * @return The attached data pointer or `NULL` if the key is not found
630 * for the given plugin.
632 * @since 1.29 (Plugin API 228)
633 * @see plugin_set_document_data plugin_set_document_data_full
636 gpointer
plugin_get_document_data(struct GeanyPlugin
*plugin
,
637 struct GeanyDocument
*doc
, const gchar
*key
)
640 PluginDocDataProxy
*data
;
642 g_return_val_if_fail(plugin
!= NULL
, NULL
);
643 g_return_val_if_fail(doc
!= NULL
, NULL
);
644 g_return_val_if_fail(key
!= NULL
&& *key
!= '\0', NULL
);
646 real_key
= g_strdup_printf("geany/plugins/%s/%s", plugin
->info
->name
, key
);
647 data
= document_get_data(doc
, real_key
);
650 return (data
!= NULL
) ? data
->data
: NULL
;
655 * Attach plugin-specific data to a document.
657 * @param plugin The plugin attaching data to the document.
658 * @param doc The document to attach the data to.
659 * @param key The key name for the data.
660 * @param data The pointer to attach to the document.
662 * @since 1.29 (Plugin API 228)
663 * @see plugin_get_document_data plugin_set_document_data_full
666 void plugin_set_document_data(struct GeanyPlugin
*plugin
, struct GeanyDocument
*doc
,
667 const gchar
*key
, gpointer data
)
669 plugin_set_document_data_full(plugin
, doc
, key
, data
, NULL
);
674 * Attach plugin-specific data and a free function to a document.
676 * This is useful for plugins who want to keep some additional data with
677 * the document and even have it auto-released appropriately (see below).
679 * This is a simple example showing how a plugin might use this to
680 * attach a string to each document and print it when the document is
684 * void on_document_open(GObject *unused, GeanyDocument *doc, GeanyPlugin *plugin)
686 * plugin_set_document_data_full(plugin, doc, "my-data",
687 * g_strdup("some-data"), g_free);
690 * void on_document_save(GObject *unused, GeanyDocument *doc, GeanyPlugin *plugin)
692 * const gchar *some_data = plugin_get_document_data(plugin, doc, "my-data");
693 * g_print("my-data: %s", some_data);
696 * gboolean plugin_init(GeanyPlugin *plugin, gpointer unused)
698 * plugin_signal_connect(plugin, NULL, "document-open", TRUE,
699 * G_CALLBACK(on_document_open), plugin);
700 * plugin_signal_connect(plugin, NULL, "document-new", TRUE,
701 * G_CALLBACK(on_document_open), plugin);
702 * plugin_signal_connect(plugin, NULL, "document-save", TRUE,
703 * G_CALLBACK(on_document_save), plugin);
707 * void geany_load_module(GeanyPlugin *plugin)
710 * plugin->funcs->init = plugin_init;
715 * The @a free_func can be used to tie the lifetime of the data to that
716 * of the @a doc and/or the @a plugin. The @a free_func will be called
717 * in any of the following cases:
719 * - When a document is closed.
720 * - When the plugin is unloaded.
721 * - When the document data is set again using the same key.
723 * @param plugin The plugin attaching data to the document.
724 * @param doc The document to attach the data to.
725 * @param key The key name for the data.
726 * @param data The pointer to attach to the document.
727 * @param free_func The function to call with data when removed.
729 * @since 1.29 (Plugin API 228)
730 * @see plugin_get_document_data plugin_set_document_data
733 void plugin_set_document_data_full(struct GeanyPlugin
*plugin
,
734 struct GeanyDocument
*doc
, const gchar
*key
, gpointer data
,
735 GDestroyNotify free_func
)
737 PluginDocDataProxy
*prox
;
739 g_return_if_fail(plugin
!= NULL
);
740 g_return_if_fail(doc
!= NULL
);
741 g_return_if_fail(key
!= NULL
);
743 prox
= g_slice_new(PluginDocDataProxy
);
746 gchar
*real_key
= g_strdup_printf("geany/plugins/%s/%s", plugin
->info
->name
, key
);
748 prox
->free_func
= free_func
;
749 document_set_data_full(doc
, real_key
, prox
, plugin_doc_data_proxy_free
);