Revision: 1756
http://geany.svn.sourceforge.net/geany/?rev=1756&view=rev
Author: eht16
Date: 2007-07-28 07:10:49 -0700 (Sat, 28 Jul 2007)
Log Message:
-----------
Hide empty symbol types in the symbol list.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/symbols.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-07-28 11:47:56 UTC (rev 1755)
+++ trunk/ChangeLog 2007-07-28 14:10:49 UTC (rev 1756)
@@ -10,6 +10,7 @@
if there are any plugins.
Use PACKAGE_LIB_DIR.
Load plugins in ~/.geany/plugins/ prior to the default location.
+ * src/symbols.c: Hide empty symbol types in the symbol list.
2007-07-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/symbols.c
===================================================================
--- trunk/src/symbols.c 2007-07-28 11:47:56 UTC (rev 1755)
+++ trunk/src/symbols.c 2007-07-28 14:10:49 UTC (rev 1756)
@@ -43,6 +43,9 @@
#include "msgwindow.h"
#include "treeviews.h"
+
+#define MAX_SYMBOL_TYPES 8 // amount of types in the symbol list (currently max. 8 are used)
+
const guint TM_GLOBAL_TYPE_MASK =
tm_tag_class_t | tm_tag_enum_t | tm_tag_interface_t |
tm_tag_struct_t | tm_tag_typedef_t | tm_tag_union_t;
@@ -640,6 +643,34 @@
}
+/* the following code surely can be improved, at the moment it collects some iters
+ * for removal and after that the actual removal is done. I didn't find a way to find and remove
+ * an empty row in one loop (next iter fails then) */
+static void hide_empty_rows(GtkTreeModel *model, GtkTreeStore *store)
+{
+ GtkTreeIter iter, *iters[MAX_SYMBOL_TYPES] = { NULL };
+ gint i = 0;
+
+ if (! gtk_tree_model_get_iter_first(model, &iter))
+ return; // stop when first iter is invalid, i.e. no elements
+
+ do // first collect the iters we need to delete empty rows
+ {
+ if (! gtk_tree_model_iter_has_child(model, &iter))
+ iters[i++] = gtk_tree_iter_copy(&iter);
+ } while (gtk_tree_model_iter_next(model, &iter));
+
+ // now actually delete the collected iters
+ for (i = 0; i < MAX_SYMBOL_TYPES; i++)
+ {
+ if (iters[i] == NULL)
+ break;
+ gtk_tree_store_remove(store, iters[i]);
+ gtk_tree_iter_free(iters[i]);
+ }
+}
+
+
gboolean symbols_recreate_tag_list(gint idx)
{
GList *tmp;
@@ -742,6 +773,7 @@
g_object_unref(icon);
}
}
+ hide_empty_rows(model, doc_list[idx].tag_store);
gtk_tree_view_set_model(GTK_TREE_VIEW(doc_list[idx].tag_tree), model); // Re-attach model to view
g_object_unref(model);
gtk_tree_view_expand_all(GTK_TREE_VIEW(doc_list[idx].tag_tree));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1755
http://geany.svn.sourceforge.net/geany/?rev=1755&view=rev
Author: eht16
Date: 2007-07-28 04:47:56 -0700 (Sat, 28 Jul 2007)
Log Message:
-----------
Only show the separator between built-in Tools menu items and plugins if there are any plugins.
Use PACKAGE_LIB_DIR.
Load plugins in ~/.geany/plugins/ prior to the default location.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/plugins.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-07-28 10:27:42 UTC (rev 1754)
+++ trunk/ChangeLog 2007-07-28 11:47:56 UTC (rev 1755)
@@ -5,6 +5,11 @@
Allow using auto completion in PHP files outside of the PHP tags,
generally in comments, for news files without filetype and on
non-empty lines.
+ * src/Makefile.am, src/plugins.c:
+ Only show the separator between built-in Tools menu items and plugins
+ if there are any plugins.
+ Use PACKAGE_LIB_DIR.
+ Load plugins in ~/.geany/plugins/ prior to the default location.
2007-07-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am 2007-07-28 10:27:42 UTC (rev 1754)
+++ trunk/src/Makefile.am 2007-07-28 11:47:56 UTC (rev 1755)
@@ -80,7 +80,8 @@
endif
INCLUDES = \
- -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+ -DPACKAGE_DATA_DIR=\""$(datadir)"\" -DPACKAGE_LIB_DIR=\""$(libdir)"\" \
+ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-I$(srcdir)/../scintilla/include -I$(srcdir)/../tagmanager/include @GTK_CFLAGS@
clean-local:
Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c 2007-07-28 10:27:42 UTC (rev 1754)
+++ trunk/src/plugins.c 2007-07-28 11:47:56 UTC (rev 1755)
@@ -263,15 +263,9 @@
}
-// TODO: Pass -DLIBDIR=\"$(libdir)/geany\" in Makefile.am
-#define LIBDIR \
- PACKAGE_DATA_DIR G_DIR_SEPARATOR_S ".." G_DIR_SEPARATOR_S "lib" \
- G_DIR_SEPARATOR_S PACKAGE
-
static void
-load_plugins()
+load_plugins(const gchar *path)
{
- const gchar *path = LIBDIR;
GSList *list, *item;
list = utils_get_file_list(path, NULL, NULL);
@@ -297,14 +291,22 @@
void plugins_init()
{
GtkWidget *widget;
+ gchar *path_user;
geany_data_init();
widget = gtk_separator_menu_item_new();
- gtk_widget_show(widget);
gtk_container_add(GTK_CONTAINER(geany_data.tools_menu), widget);
- load_plugins();
+ path_user = g_strconcat(app->configdir, G_DIR_SEPARATOR_S, "plugins", NULL);
+ // first load plugins in ~/.geany/plugins/, then in $prefix/lib/geany
+ load_plugins(path_user);
+ load_plugins(PACKAGE_LIB_DIR G_DIR_SEPARATOR_S "geany");
+
+ if (g_list_length(plugin_list) > 0)
+ gtk_widget_show(widget);
+
+ g_free(path_user);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1753
http://geany.svn.sourceforge.net/geany/?rev=1753&view=rev
Author: ntrel
Date: 2007-07-27 04:56:50 -0700 (Fri, 27 Jul 2007)
Log Message:
-----------
Use AE spelling of 'color'.
Modified Paths:
--------------
trunk/ChangeLog
trunk/geany.glade
trunk/src/interface.c
trunk/src/keybindings.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-07-27 11:34:16 UTC (rev 1752)
+++ trunk/ChangeLog 2007-07-27 11:56:50 UTC (rev 1753)
@@ -12,6 +12,8 @@
Move Color Chooser and Word Count tools to tools.c.
* src/plugins.c:
Add separator between built-in Tools menu items and plugins.
+ * src/interface.c, src/keybindings.c, geany.glade:
+ Use AE spelling of 'color'.
2007-07-26 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade 2007-07-27 11:34:16 UTC (rev 1752)
+++ trunk/geany.glade 2007-07-27 11:56:50 UTC (rev 1753)
@@ -1340,7 +1340,7 @@
<widget class="GtkImageMenuItem" id="menu_choose_color1">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Open a color chooser dialog, to interactively pick colors from a palette.</property>
- <property name="label" translatable="yes">_Colour Chooser</property>
+ <property name="label" translatable="yes">_Color Chooser</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
@@ -4408,8 +4408,8 @@
<child>
<widget class="GtkCheckButton" id="check_toolbar_colour">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">Display the Colour Chooser button in the toolbar</property>
- <property name="label" translatable="yes">Show Colour Chooser button</property>
+ <property name="tooltip" translatable="yes">Display the Color Chooser button in the toolbar</property>
+ <property name="label" translatable="yes">Show Color Chooser button</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">False</property>
@@ -4829,7 +4829,7 @@
<widget class="GtkCheckButton" id="checkbutton1">
<property name="tooltip" translatable="yes">Use white text on a black background.</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">Invert syntax highlighting colours</property>
+ <property name="label" translatable="yes">Invert syntax highlighting colors</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@@ -5121,7 +5121,7 @@
<child>
<widget class="GtkRadioButton" id="radio_long_line_background">
<property name="visible">True</property>
- <property name="tooltip" translatable="yes">The background colour of characters after the given cursor position (see below) changed to the colour set below. (This is recommended if you use proportional fonts)</property>
+ <property name="tooltip" translatable="yes">The background color of characters after the given cursor position (see below) changed to the color set below. (This is recommended if you use proportional fonts)</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Background</property>
<property name="use_underline">True</property>
Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c 2007-07-27 11:34:16 UTC (rev 1752)
+++ trunk/src/interface.c 2007-07-27 11:56:50 UTC (rev 1753)
@@ -937,7 +937,7 @@
tools1_menu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (tools1), tools1_menu);
- menu_choose_color1 = gtk_image_menu_item_new_with_mnemonic (_("_Colour Chooser"));
+ menu_choose_color1 = gtk_image_menu_item_new_with_mnemonic (_("_Color Chooser"));
gtk_widget_show (menu_choose_color1);
gtk_container_add (GTK_CONTAINER (tools1_menu), menu_choose_color1);
gtk_tooltips_set_tip (tooltips, menu_choose_color1, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL);
@@ -3113,11 +3113,11 @@
gtk_tooltips_set_tip (tooltips, check_toolbar_compile, _("Display the Compile and Run buttons in the toolbar"), NULL);
gtk_button_set_focus_on_click (GTK_BUTTON (check_toolbar_compile), FALSE);
- check_toolbar_colour = gtk_check_button_new_with_mnemonic (_("Show Colour Chooser button"));
+ check_toolbar_colour = gtk_check_button_new_with_mnemonic (_("Show Color Chooser button"));
gtk_widget_show (check_toolbar_colour);
gtk_box_pack_start (GTK_BOX (vbox16), check_toolbar_colour, FALSE, FALSE, 0);
GTK_WIDGET_UNSET_FLAGS (check_toolbar_colour, GTK_CAN_FOCUS);
- gtk_tooltips_set_tip (tooltips, check_toolbar_colour, _("Display the Colour Chooser button in the toolbar"), NULL);
+ gtk_tooltips_set_tip (tooltips, check_toolbar_colour, _("Display the Color Chooser button in the toolbar"), NULL);
gtk_button_set_focus_on_click (GTK_BUTTON (check_toolbar_colour), FALSE);
check_toolbar_zoom = gtk_check_button_new_with_mnemonic (_("Show Zoom In and Zoom Out buttons"));
@@ -3250,7 +3250,7 @@
gtk_widget_show (vbox12);
gtk_container_add (GTK_CONTAINER (alignment6), vbox12);
- checkbutton1 = gtk_check_button_new_with_mnemonic (_("Invert syntax highlighting colours"));
+ checkbutton1 = gtk_check_button_new_with_mnemonic (_("Invert syntax highlighting colors"));
gtk_box_pack_start (GTK_BOX (vbox12), checkbutton1, FALSE, FALSE, 0);
gtk_tooltips_set_tip (tooltips, checkbutton1, _("Use white text on a black background."), NULL);
@@ -3348,7 +3348,7 @@
radio_long_line_background = gtk_radio_button_new_with_mnemonic (NULL, _("Background"));
gtk_widget_show (radio_long_line_background);
gtk_box_pack_start (GTK_BOX (hbox5), radio_long_line_background, FALSE, FALSE, 0);
- gtk_tooltips_set_tip (tooltips, radio_long_line_background, _("The background colour of characters after the given cursor position (see below) changed to the colour set below. (This is recommended if you use proportional fonts)"), NULL);
+ gtk_tooltips_set_tip (tooltips, radio_long_line_background, _("The background color of characters after the given cursor position (see below) changed to the color set below. (This is recommended if you use proportional fonts)"), NULL);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radio_long_line_background), radio_long_line_line_group);
radio_long_line_line_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_long_line_background));
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2007-07-27 11:34:16 UTC (rev 1752)
+++ trunk/src/keybindings.c 2007-07-27 11:56:50 UTC (rev 1753)
@@ -187,7 +187,7 @@
GDK_minus, GDK_CONTROL_MASK, "menu_zoomout", _("Zoom Out"));
keys[GEANY_KEYS_MENU_OPENCOLORCHOOSER] = fill(cb_func_menu_opencolorchooser,
- 0, 0, "menu_opencolorchooser", _("Show Colour Chooser"));
+ 0, 0, "menu_opencolorchooser", _("Show Color Chooser"));
keys[GEANY_KEYS_MENU_INSERTSPECIALCHARS] = fill(cb_func_menu_insert_specialchars,
0, 0, "menu_insert_specialchars", _("Insert Special HTML Characters"));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1750
http://geany.svn.sourceforge.net/geany/?rev=1750&view=rev
Author: ntrel
Date: 2007-07-27 03:43:25 -0700 (Fri, 27 Jul 2007)
Log Message:
-----------
Use new email address.
Modified Paths:
--------------
trunk/ChangeLog
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-07-27 10:37:22 UTC (rev 1749)
+++ trunk/ChangeLog 2007-07-27 10:43:25 UTC (rev 1750)
@@ -1,4 +1,4 @@
-2007-07-27 Nick Treleaven <nick.treleaven(a)btinternet.com>
+2007-07-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* plugins/demoplugin.c, plugins/htmlchars.c, plugins/classbuilder.c,
src/plugindata.h, src/plugins.c:
@@ -9,7 +9,7 @@
Update plugins to use newer API symbols.
-2007-07-26 Nick Treleaven <nick.treleaven(a)btinternet.com>
+2007-07-26 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/highlighting.c:
Ignore whitespace_chars for Haxe.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 1749
http://geany.svn.sourceforge.net/geany/?rev=1749&view=rev
Author: ntrel
Date: 2007-07-27 03:37:22 -0700 (Fri, 27 Jul 2007)
Log Message:
-----------
Add GeanyData* geany_data symbol for plugins so they don't have to
keep a copy of the init() argument.
Rename PluginData GeanyData (but use a typedef for backward
compatibility).
Update plugins to use newer API symbols.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/classbuilder.c
trunk/plugins/demoplugin.c
trunk/plugins/htmlchars.c
trunk/src/plugindata.h
trunk/src/plugins.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2007-07-26 12:12:54 UTC (rev 1748)
+++ trunk/ChangeLog 2007-07-27 10:37:22 UTC (rev 1749)
@@ -1,3 +1,14 @@
+2007-07-27 Nick Treleaven <nick.treleaven(a)btinternet.com>
+
+ * plugins/demoplugin.c, plugins/htmlchars.c, plugins/classbuilder.c,
+ src/plugindata.h, src/plugins.c:
+ Add GeanyData* geany_data symbol for plugins so they don't have to
+ keep a copy of the init() argument.
+ Rename PluginData GeanyData (but use a typedef for backward
+ compatibility).
+ Update plugins to use newer API symbols.
+
+
2007-07-26 Nick Treleaven <nick.treleaven(a)btinternet.com>
* src/highlighting.c:
Modified: trunk/plugins/classbuilder.c
===================================================================
--- trunk/plugins/classbuilder.c 2007-07-26 12:12:54 UTC (rev 1748)
+++ trunk/plugins/classbuilder.c 2007-07-27 10:37:22 UTC (rev 1749)
@@ -32,26 +32,20 @@
#include "document.h"
-static PluginData *plugin_data;
+PluginFields *plugin_fields;
+GeanyData *geany_data;
-#define doc_array plugin_data->doc_array
+#define doc_array geany_data->doc_array
// can't use document as a macro because it's currently a typename
-#define documents plugin_data->document
-#define scintilla plugin_data->sci
-#define templates plugin_data->templates
-#define utils plugin_data->utils
-#define ui plugin_data->ui
+#define documents geany_data->document
+#define scintilla geany_data->sci
+#define templates geany_data->templates
+#define utils geany_data->utils
+#define ui geany_data->ui
-static struct
-{
- GtkWidget *menu_item;
-}
-local_data;
+VERSION_CHECK(7)
-
-VERSION_CHECK(4)
-
PLUGIN_INFO(_("Class Builder"), _("Creates source files for new class types."))
@@ -369,7 +363,7 @@
cc_dlg->class_type = type;
cc_dlg->dialog = gtk_dialog_new_with_buttons(_("Create Class"),
- GTK_WINDOW(plugin_data->app->window),
+ GTK_WINDOW(geany_data->app->window),
GTK_DIALOG_MODAL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OK, GTK_RESPONSE_OK,
@@ -783,7 +777,7 @@
}
-void init(PluginData *data)
+void init(GeanyData *data)
{
GtkWidget *menu_create_class1;
GtkWidget *image1861;
@@ -791,8 +785,6 @@
GtkWidget *menu_create_cpp_class;
GtkWidget *menu_create_gtk_class;
- plugin_data = data;
-
menu_create_class1 = gtk_image_menu_item_new_with_mnemonic (_("Create Cla_ss"));
gtk_container_add (GTK_CONTAINER (data->tools_menu), menu_create_class1);
@@ -817,11 +809,11 @@
gtk_widget_show_all(menu_create_class1);
- local_data.menu_item = menu_create_class1;
+ plugin_fields->menu_item = menu_create_class1;
}
void cleanup()
{
- gtk_widget_destroy(local_data.menu_item);
+ gtk_widget_destroy(plugin_fields->menu_item);
}
Modified: trunk/plugins/demoplugin.c
===================================================================
--- trunk/plugins/demoplugin.c 2007-07-26 12:12:54 UTC (rev 1748)
+++ trunk/plugins/demoplugin.c 2007-07-27 10:37:22 UTC (rev 1749)
@@ -29,18 +29,13 @@
#include "plugindata.h"
-static PluginData *plugin_data;
+PluginFields *plugin_fields;
+GeanyData *geany_data;
-static struct
-{
- GtkWidget *menu_item;
-}
-local_data;
-
/* Check that Geany supports plugin API version 2 or later, and check
* for binary compatibility. */
-VERSION_CHECK(2)
+VERSION_CHECK(7)
/* All plugins must set name and description */
PLUGIN_INFO(_("Demo"), _("Example plugin."))
@@ -53,7 +48,7 @@
GtkWidget *dialog;
dialog = gtk_message_dialog_new(
- GTK_WINDOW(plugin_data->app->window),
+ GTK_WINDOW(geany_data->app->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
@@ -67,20 +62,18 @@
/* Called by Geany to initialize the plugin */
-void init(PluginData *data)
+void init(GeanyData *data)
{
GtkWidget *demo_item;
- plugin_data = data; // keep a pointer to the main application fields & functions
-
// Add an item to the Tools menu
demo_item = gtk_menu_item_new_with_mnemonic(_("_Demo Plugin"));
gtk_widget_show(demo_item);
- gtk_container_add(GTK_CONTAINER(plugin_data->tools_menu), demo_item);
+ gtk_container_add(GTK_CONTAINER(geany_data->tools_menu), demo_item);
g_signal_connect(G_OBJECT(demo_item), "activate", G_CALLBACK(item_activate), NULL);
// keep a pointer to the menu item, so we can remove it when the plugin is unloaded
- local_data.menu_item = demo_item;
+ plugin_fields->menu_item = demo_item;
}
@@ -89,5 +82,5 @@
void cleanup()
{
// remove the menu item added in init()
- gtk_widget_destroy(local_data.menu_item);
+ gtk_widget_destroy(plugin_fields->menu_item);
}
Modified: trunk/plugins/htmlchars.c
===================================================================
--- trunk/plugins/htmlchars.c 2007-07-26 12:12:54 UTC (rev 1748)
+++ trunk/plugins/htmlchars.c 2007-07-27 10:37:22 UTC (rev 1749)
@@ -30,18 +30,17 @@
#include "document.h"
-PluginFields *plugin_fields;
+PluginFields *plugin_fields;
+GeanyData *geany_data;
-static PluginData *plugin_data;
-
-#define doc_array plugin_data->doc_array
+#define doc_array geany_data->doc_array
// can't use document as a macro because it's currently a typename
-#define documents plugin_data->document
-#define scintilla plugin_data->sci
-#define ui plugin_data->ui
+#define documents geany_data->document
+#define scintilla geany_data->sci
+#define ui geany_data->ui
-VERSION_CHECK(5)
+VERSION_CHECK(7)
PLUGIN_INFO(_("HTML Characters"), _("Inserts HTML character entities like '&'."))
@@ -76,7 +75,7 @@
GtkWidget *swin, *vbox, *label;
sc_dialog = gtk_dialog_new_with_buttons(
- _("Special Characters"), GTK_WINDOW(plugin_data->app->window),
+ _("Special Characters"), GTK_WINDOW(geany_data->app->window),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Insert"), GTK_RESPONSE_OK, NULL);
vbox = ui->dialog_vbox_new(GTK_DIALOG(sc_dialog));
@@ -509,16 +508,14 @@
/* Called by Geany to initialize the plugin */
-void init(PluginData *data)
+void init(GeanyData *data)
{
GtkWidget *demo_item;
- plugin_data = data; // keep a pointer to the main application fields & functions
-
// Add an item to the Tools menu
demo_item = gtk_menu_item_new_with_mnemonic(_("_Insert Special HTML Characters"));
gtk_widget_show(demo_item);
- gtk_container_add(GTK_CONTAINER(plugin_data->tools_menu), demo_item);
+ gtk_container_add(GTK_CONTAINER(geany_data->tools_menu), demo_item);
g_signal_connect(G_OBJECT(demo_item), "activate", G_CALLBACK(item_activate), NULL);
// disable menu_item when there are no documents open
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2007-07-26 12:12:54 UTC (rev 1748)
+++ trunk/src/plugindata.h 2007-07-27 10:37:22 UTC (rev 1749)
@@ -34,11 +34,14 @@
* PluginInfo* info()
* Use PLUGIN_INFO() macro to define it. Required by Geany.
*
+ * GeanyData* geany_data
+ * Geany owned fields and functions.
+ *
* PluginFields* plugin_fields
* Plugin owned fields, including flags.
*
- * void init(PluginData *data)
- * Called after loading the plugin.
+ * void init(GeanyData *data)
+ * Called after loading the plugin. data is the same as geany_data.
*
* void cleanup()
* Called before unloading the plugin. Required for normal plugins - it should undo
@@ -48,7 +51,7 @@
/* The API version should be incremented whenever any plugin data types below are
* modified. */
-static const gint api_version = 6;
+static const gint api_version = 7;
/* The ABI version should be incremented whenever existing fields in the plugin
* data types below have to be changed or reordered. It should stay the same if fields
@@ -95,7 +98,9 @@
}
PluginFlags;
-/* Fields set and owned by the plugin */
+/* Fields set and owned by the plugin.
+ * Note: Remember to increment api_version (and abi_version if necessary) when
+ * making changes. */
typedef struct PluginFields
{
PluginFlags flags;
@@ -111,10 +116,10 @@
typedef struct UIUtilsFuncs UIUtilsFuncs;
/* These are fields and functions owned by Geany.
- * Fields will be appended when needed by plugin authors.
+ * Fields and functions will be appended when needed by plugin authors.
* Note: Remember to increment api_version (and abi_version if necessary) when
* making changes. */
-typedef struct PluginData
+typedef struct GeanyData
{
MyApp *app; // Geany application data fields
GtkWidget *tools_menu; // Almost all plugins should add menu items to the Tools menu only
@@ -126,11 +131,13 @@
UtilsFuncs *utils;
UIUtilsFuncs *ui;
}
-PluginData;
+GeanyData;
+typedef GeanyData PluginData; // for compatibility with API < 7
+
/* For more info about these functions, see the main source code.
- * E.g. for PluginData::document->new_file(), see document_new_file() in document.[hc]. */
+ * E.g. for GeanyData::document->new_file(), see document_new_file() in document.[hc]. */
struct filetype;
Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c 2007-07-26 12:12:54 UTC (rev 1748)
+++ trunk/src/plugins.c 2007-07-27 10:37:22 UTC (rev 1749)
@@ -45,7 +45,7 @@
PluginFields fields;
PluginInfo* (*info) (); /* Returns plugin name, description */
- void (*init) (PluginData *data); /* Called when the plugin is enabled */
+ void (*init) (GeanyData *data); /* Called when the plugin is enabled */
void (*cleanup) (); /* Called when the plugin is disabled or when Geany exits */
}
Plugin;
@@ -85,7 +85,8 @@
&ui_frame_new_with_alignment
};
-static PluginData geany_data = {
+
+static GeanyData geany_data = {
NULL,
NULL,
NULL,
@@ -162,6 +163,7 @@
GModule *module;
PluginInfo* (*info)();
PluginFields **plugin_fields;
+ GeanyData **p_geany_data;
g_return_val_if_fail(fname, NULL);
g_return_val_if_fail(g_module_supported(), NULL);
@@ -211,6 +213,9 @@
plugin->filename = g_strdup(fname);
plugin->module = module;
+ g_module_symbol(module, "geany_data", (void *) &p_geany_data);
+ if (p_geany_data)
+ *p_geany_data = &geany_data;
g_module_symbol(module, "plugin_fields", (void *) &plugin_fields);
if (plugin_fields)
*plugin_fields = &plugin->fields;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.