Revision: 4035 http://geany.svn.sourceforge.net/geany/?rev=4035&view=rev Author: ntrel Date: 2009-07-28 11:35:33 +0000 (Tue, 28 Jul 2009)
Log Message: ----------- Move plugin_* utility functions to pluginutils.c. Add pluginprivate.h.
Modified Paths: -------------- trunk/ChangeLog trunk/src/Makefile.am trunk/src/makefile.win32 trunk/src/plugindata.h trunk/src/plugins.c trunk/wscript
Added Paths: ----------- trunk/src/pluginprivate.h trunk/src/pluginutils.c trunk/src/pluginutils.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2009-07-28 02:03:08 UTC (rev 4034) +++ trunk/ChangeLog 2009-07-28 11:35:33 UTC (rev 4035) @@ -1,3 +1,12 @@ +2009-07-28 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/pluginprivate.h, src/makefile.win32, src/plugindata.h, + src/pluginutils.c, src/plugins.c, src/pluginutils.h, + src/Makefile.am, ChangeLog, wscript: + Move plugin_* utility functions to pluginutils.c. + Add pluginprivate.h. + + 2009-07-25 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* doc/geany.txt, doc/geany.html: @@ -7,7 +16,7 @@
2009-07-25 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
- * po/LINGUAS, po/sl_SI.po, THANKS, src/about.c: + * po/LINGUAS, po/sl_SI.po, THANKS, src/about.c: Added a first Slovenian translation. Thanks to Joze Klepec.
Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-07-28 02:03:08 UTC (rev 4034) +++ trunk/src/Makefile.am 2009-07-28 11:35:33 UTC (rev 4035) @@ -29,7 +29,9 @@ msgwindow.c msgwindow.h \ navqueue.c navqueue.h \ notebook.c notebook.h \ + pluginprivate.h \ plugins.c plugins.h \ + pluginutils.c pluginutils.h \ prefix.c prefix.h \ prefs.c prefs.h \ printing.c printing.h \
Modified: trunk/src/makefile.win32 =================================================================== --- trunk/src/makefile.win32 2009-07-28 02:03:08 UTC (rev 4034) +++ trunk/src/makefile.win32 2009-07-28 11:35:33 UTC (rev 4035) @@ -62,7 +62,8 @@ OBJS = about.o build.o callbacks.o dialogs.o document.o editor.o encodings.o filetypes.o \ geanyentryaction.o geanymenubuttonaction.o geanyobject.o geanywraplabel.o highlighting.o \ interface.o keybindings.o keyfile.o \ - log.o main.o msgwindow.o navqueue.o notebook.o plugins.o prefs.o printing.o project.o \ + log.o main.o msgwindow.o navqueue.o notebook.o plugins.o pluginutils.o \ + prefs.o printing.o project.o \ queue.o sciwrappers.o search.o socket.o stash.o \ symbols.o templates.o toolbar.o tools.o treeviews.o \ ui_utils.o utils.o win32.o
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2009-07-28 02:03:08 UTC (rev 4034) +++ trunk/src/plugindata.h 2009-07-28 11:35:33 UTC (rev 4035) @@ -90,7 +90,8 @@ PluginInfo;
-/** Basic information for the plugin and identification. */ +/** Basic information for the plugin and identification. + * @see geany_plugin. */ typedef struct GeanyPlugin { PluginInfo *info; /**< Fields set in plugin_set_info(). */
Added: trunk/src/pluginprivate.h =================================================================== --- trunk/src/pluginprivate.h (rev 0) +++ trunk/src/pluginprivate.h 2009-07-28 11:35:33 UTC (rev 4035) @@ -0,0 +1,39 @@ +/* + * pluginprivate.h - this file is part of Geany, a fast and lightweight IDE + * + * Copyright 2009 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + * Copyright 2009 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * $Id$ + */ + + +#ifndef PLUGINPRIVATE_H +#define PLUGINPRIVATE_H + +#include "ui_utils.h" + +typedef struct GeanyPluginPrivate +{ + GeanyAutoSeparator toolbar_separator; + gboolean resident; +} +GeanyPluginPrivate; + + +#endif /* PLUGINPRIVATE_H */
Property changes on: trunk/src/pluginprivate.h ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2009-07-28 02:03:08 UTC (rev 4034) +++ trunk/src/plugins.c 2009-07-28 11:35:33 UTC (rev 4035) @@ -23,8 +23,6 @@ */
/* Code to manage, load and unload plugins. */ -/** @file plugins.c - * Plugin utility functions. */
#include "geany.h"
@@ -61,17 +59,10 @@ #include "stash.h" #include "keyfile.h" #include "win32.h" +#include "pluginutils.h" +#include "pluginprivate.h"
- -typedef struct GeanyPluginPrivate -{ - GeanyAutoSeparator toolbar_separator; - gboolean resident; -} -GeanyPluginPrivate; - - typedef struct Plugin { GModule *module; @@ -79,7 +70,7 @@ PluginInfo info; /* plugin name, description, etc */ PluginFields fields; GeanyPlugin public; /* fields the plugin can read */ - GeanyPluginPrivate priv; /* GeanyPlugin type private data */ + GeanyPluginPrivate priv; /* GeanyPlugin type private data, same as (*public.priv) */
gulong *signal_ids; /* signal IDs to disconnect when unloading */ gsize signal_ids_len; @@ -106,10 +97,7 @@
static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data);
-void plugin_add_toolbar_item(GeanyPlugin *plugin, GtkToolItem *item); -void plugin_module_make_resident(GeanyPlugin *plugin);
- static PluginFuncs plugin_funcs = { &plugin_add_toolbar_item, &plugin_module_make_resident @@ -1307,62 +1295,4 @@ }
-/** Insert a toolbar item before the Quit button, or after the previous plugin toolbar item. - * A separator is added on the first call to this function, and will be shown when @a item is - * shown; hidden when @a item is hidden. - * @note You should still destroy @a item yourself, usually in @ref plugin_cleanup(). - * @param plugin Must be @ref geany_plugin. - * @param item The item to add. */ -void plugin_add_toolbar_item(GeanyPlugin *plugin, GtkToolItem *item) -{ - GtkToolbar *toolbar = GTK_TOOLBAR(main_widgets.toolbar); - gint pos; - GeanyAutoSeparator *autosep; - - g_return_if_fail(plugin); - autosep = &plugin->priv->toolbar_separator; - - if (!autosep->widget) - { - GtkToolItem *sep; - - pos = toolbar_get_insert_position(); - - sep = gtk_separator_tool_item_new(); - gtk_toolbar_insert(toolbar, sep, pos); - autosep->widget = GTK_WIDGET(sep); - - gtk_toolbar_insert(toolbar, item, pos + 1); - - toolbar_item_ref(sep); - toolbar_item_ref(item); - } - else - { - pos = gtk_toolbar_get_item_index(toolbar, GTK_TOOL_ITEM(autosep->widget)); - g_return_if_fail(pos >= 0); - gtk_toolbar_insert(toolbar, item, pos); - toolbar_item_ref(item); - } - /* hide the separator widget if there are no toolbar items showing for the plugin */ - ui_auto_separator_add_ref(autosep, GTK_WIDGET(item)); -} - - -/** Ensures that a plugin's module (*.so) will never be unloaded. - * This is necessary if you register new GTypes in your plugin, e.g. when using own classes - * using the GObject system. - * - * @param plugin Must be @ref geany_plugin. - * - * @since 0.16 - */ -void plugin_module_make_resident(GeanyPlugin *plugin) -{ - g_return_if_fail(plugin); - - plugin->priv->resident = TRUE; -} - - #endif
Added: trunk/src/pluginutils.c =================================================================== --- trunk/src/pluginutils.c (rev 0) +++ trunk/src/pluginutils.c 2009-07-28 11:35:33 UTC (rev 4035) @@ -0,0 +1,94 @@ +/* + * pluginutils.c - this file is part of Geany, a fast and lightweight IDE + * + * Copyright 2009 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + * Copyright 2009 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * $Id$ + */ + +/** @file pluginutils.c + * Plugin utility functions. + * These functions all take the @ref geany_plugin symbol as their first argument. */ + +#include "geany.h" +#include "pluginutils.h" +#include "pluginprivate.h" + +#include "ui_utils.h" +#include "toolbar.h" + + +/** Insert a toolbar item before the Quit button, or after the previous plugin toolbar item. + * A separator is added on the first call to this function, and will be shown when @a item is + * shown; hidden when @a item is hidden. + * @note You should still destroy @a item yourself, usually in @ref plugin_cleanup(). + * @param plugin Must be @ref geany_plugin. + * @param item The item to add. */ +void plugin_add_toolbar_item(GeanyPlugin *plugin, GtkToolItem *item) +{ + GtkToolbar *toolbar = GTK_TOOLBAR(main_widgets.toolbar); + gint pos; + GeanyAutoSeparator *autosep; + + g_return_if_fail(plugin); + autosep = &plugin->priv->toolbar_separator; + + if (!autosep->widget) + { + GtkToolItem *sep; + + pos = toolbar_get_insert_position(); + + sep = gtk_separator_tool_item_new(); + gtk_toolbar_insert(toolbar, sep, pos); + autosep->widget = GTK_WIDGET(sep); + + gtk_toolbar_insert(toolbar, item, pos + 1); + + toolbar_item_ref(sep); + toolbar_item_ref(item); + } + else + { + pos = gtk_toolbar_get_item_index(toolbar, GTK_TOOL_ITEM(autosep->widget)); + g_return_if_fail(pos >= 0); + gtk_toolbar_insert(toolbar, item, pos); + toolbar_item_ref(item); + } + /* hide the separator widget if there are no toolbar items showing for the plugin */ + ui_auto_separator_add_ref(autosep, GTK_WIDGET(item)); +} + + +/** Ensures that a plugin's module (*.so) will never be unloaded. + * This is necessary if you register new GTypes in your plugin, e.g. when using own classes + * using the GObject system. + * + * @param plugin Must be @ref geany_plugin. + * + * @since 0.16 + */ +void plugin_module_make_resident(GeanyPlugin *plugin) +{ + g_return_if_fail(plugin); + + plugin->priv->resident = TRUE; +} + +
Property changes on: trunk/src/pluginutils.c ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
Added: trunk/src/pluginutils.h =================================================================== --- trunk/src/pluginutils.h (rev 0) +++ trunk/src/pluginutils.h 2009-07-28 11:35:33 UTC (rev 4035) @@ -0,0 +1,35 @@ +/* + * pluginutils.h - this file is part of Geany, a fast and lightweight IDE + * + * Copyright 2009 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + * Copyright 2009 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * $Id$ + */ + + +#ifndef PLUGINUTILS_H +#define PLUGINUTILS_H + +#include "plugindata.h" + +void plugin_add_toolbar_item(GeanyPlugin *plugin, GtkToolItem *item); + +void plugin_module_make_resident(GeanyPlugin *plugin); + +#endif /* PLUGINUTILS_H */
Property changes on: trunk/src/pluginutils.h ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native
Modified: trunk/wscript =================================================================== --- trunk/wscript 2009-07-28 02:03:08 UTC (rev 4034) +++ trunk/wscript 2009-07-28 11:35:33 UTC (rev 4035) @@ -95,7 +95,7 @@ 'src/geanymenubuttonaction.c', 'src/geanyobject.c', 'src/geanywraplabel.c', 'src/highlighting.c', 'src/interface.c', 'src/keybindings.c', 'src/keyfile.c', 'src/log.c', 'src/main.c', 'src/msgwindow.c', 'src/navqueue.c', 'src/notebook.c', - 'src/plugins.c', 'src/prefix.c', 'src/prefs.c', 'src/printing.c', 'src/project.c', + 'src/plugins.c', 'pluginutils.c', 'src/prefix.c', 'src/prefs.c', 'src/printing.c', 'src/project.c', 'src/queue.c', 'src/sciwrappers.c', 'src/search.c', 'src/socket.c', 'src/stash.c', 'src/symbols.c', 'src/templates.c', 'src/toolbar.c', 'src/tools.c', 'src/treeviews.c',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.