[geany/geany] 726174: Allow plugins to get the data they set

Matthew Brush git-noreply at xxxxx
Fri Aug 4 09:33:40 UTC 2017


Branch:      refs/heads/master
Author:      Matthew Brush <matt at geany.org>
Committer:   Matthew Brush <mbrush at codebrainz.ca>
Date:        Fri, 04 Aug 2017 09:33:40 UTC
Commit:      7261742f8169b19fd5ac7f10a0845a684287e2d9
             https://github.com/geany/geany/commit/7261742f8169b19fd5ac7f10a0845a684287e2d9

Log Message:
-----------
Allow plugins to get the data they set


Modified Paths:
--------------
    src/plugindata.h
    src/pluginutils.c

Modified: src/plugindata.h
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -59,7 +59,7 @@ G_BEGIN_DECLS
  * @warning You should not test for values below 200 as previously
  * @c GEANY_API_VERSION was defined as an enum value, not a macro.
  */
-#define GEANY_API_VERSION 233
+#define GEANY_API_VERSION 234
 
 /* hack to have a different ABI when built with GTK3 because loading GTK2-linked plugins
  * with GTK3-linked Geany leads to crash */
@@ -315,6 +315,7 @@ gboolean geany_plugin_register(GeanyPlugin *plugin, gint api_version,
 gboolean geany_plugin_register_full(GeanyPlugin *plugin, gint api_version,
                                     gint min_api_version, gint abi_version,
                                     gpointer data, GDestroyNotify free_func);
+gpointer geany_plugin_get_data(const GeanyPlugin *plugin);
 void geany_plugin_set_data(GeanyPlugin *plugin, gpointer data, GDestroyNotify free_func);
 
 /** Convenience macro to register a plugin.


Modified: src/pluginutils.c
18 lines changed, 18 insertions(+), 0 deletions(-)
===================================================================
@@ -570,6 +570,24 @@ void plugin_builder_connect_signals(GeanyPlugin *plugin,
 }
 
 
+/** Get the additional data that corresponds to the plugin.
+ *
+ * @param plugin The plugin provided by Geany
+ * @return The data corresponding to the plugin or @c NULL if none set.
+ *
+ * @since 1.32 (API 234)
+ *
+ * @see geany_plugin_set_data()
+ */
+gpointer geany_plugin_get_data(const GeanyPlugin *plugin)
+{
+	g_return_val_if_fail (plugin != NULL, NULL);
+	g_return_val_if_fail (PLUGIN_LOADED_OK (plugin->priv), NULL);
+
+	return plugin->priv->cb_data;
+}
+
+
 /** Add additional data that corresponds to the plugin.
  *
  * @p pdata is the pointer going to be passed to the individual plugin callbacks



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list