SF.net SVN: geany: [2345] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Fri Mar 14 17:23:33 UTC 2008
Revision: 2345
http://geany.svn.sourceforge.net/geany/?rev=2345&view=rev
Author: ntrel
Date: 2008-03-14 10:23:24 -0700 (Fri, 14 Mar 2008)
Log Message:
-----------
Make KeyBinding name and label fields non-const strings so they can
be freed by any plugins that need to use malloc'd strings.
Document KeyCallback typedef.
Modified Paths:
--------------
trunk/ChangeLog
trunk/plugins/htmlchars.c
trunk/src/keybindings.c
trunk/src/keybindings.h
trunk/src/plugindata.h
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-03-14 16:59:36 UTC (rev 2344)
+++ trunk/ChangeLog 2008-03-14 17:23:24 UTC (rev 2345)
@@ -2,6 +2,11 @@
* src/keybindings.c:
Set main menu accelerators for keybindings.
+ * src/keybindings.c, src/keybindings.h, src/plugindata.h,
+ plugins/htmlchars.c:
+ Make KeyBinding name and label fields non-const strings so they can
+ be freed by any plugins that need to use malloc'd strings.
+ Document KeyCallback typedef.
2008-03-14 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/plugins/htmlchars.c
===================================================================
--- trunk/plugins/htmlchars.c 2008-03-14 16:59:36 UTC (rev 2344)
+++ trunk/plugins/htmlchars.c 2008-03-14 17:23:24 UTC (rev 2345)
@@ -525,7 +525,7 @@
{
GtkWidget *demo_item;
const gchar *menu_text = _("_Insert Special HTML Characters");
- const gchar *kb_label = _("Insert Special HTML Characters");
+ gchar *kb_label = _("Insert Special HTML Characters");
/* Add an item to the Tools menu */
demo_item = gtk_menu_item_new_with_mnemonic(menu_text);
Modified: trunk/src/keybindings.c
===================================================================
--- trunk/src/keybindings.c 2008-03-14 16:59:36 UTC (rev 2344)
+++ trunk/src/keybindings.c 2008-03-14 17:23:24 UTC (rev 2345)
@@ -101,7 +101,7 @@
/** Simple convenience function to fill a KeyBinding struct item */
void keybindings_set_item(KeyBindingGroup *group, gsize key_id,
KeyCallback callback, guint key, GdkModifierType mod,
- const gchar *name, const gchar *label, GtkWidget *menu_item)
+ gchar *name, gchar *label, GtkWidget *menu_item)
{
KeyBinding *kb;
Modified: trunk/src/keybindings.h
===================================================================
--- trunk/src/keybindings.h 2008-03-14 16:59:36 UTC (rev 2344)
+++ trunk/src/keybindings.h 2008-03-14 17:23:24 UTC (rev 2345)
@@ -39,15 +39,18 @@
#endif
+/** Function pointer type used for keybinding callbacks */
typedef void (*KeyCallback) (guint key_id);
/** Represents a single keybinding action */
+/* Note: name and label are not const strings so plugins can set them to malloc'd strings
+ * and free them in cleanup(). */
typedef struct KeyBinding
{
guint key; /**< Key value in lower-case, such as @c GDK_a */
GdkModifierType mods; /**< Modifier keys, such as @c GDK_CONTROL_MASK */
- const gchar *name; /**< Key name for the configuration file, such as @c "menu_new" */
- const gchar *label; /**< Label used in the preferences dialog keybindings tab */
+ gchar *name; /**< Key name for the configuration file, such as @c "menu_new" */
+ gchar *label; /**< Label used in the preferences dialog keybindings tab */
KeyCallback callback; /**< Callback function called when the key combination is pressed */
GtkWidget *menu_item; /**< Menu item widget for setting the menu accelerator */
} KeyBinding;
@@ -302,7 +305,7 @@
void keybindings_set_item(KeyBindingGroup *group, gsize key_id,
KeyCallback callback, guint key, GdkModifierType mod,
- const gchar *name, const gchar *label, GtkWidget *menu_item);
+ gchar *name, gchar *label, GtkWidget *menu_item);
void keybindings_send_command(guint group_id, guint key_id);
Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h 2008-03-14 16:59:36 UTC (rev 2344)
+++ trunk/src/plugindata.h 2008-03-14 17:23:24 UTC (rev 2345)
@@ -35,7 +35,7 @@
/* The API version should be incremented whenever any plugin data types below are
* modified or appended to. */
-static const gint api_version = 48;
+static const gint api_version = 49;
/* 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
@@ -335,7 +335,7 @@
void (*send_command) (guint group_id, guint key_id);
void (*set_item) (struct KeyBindingGroup *group, gsize key_id,
_KeyCallback callback, guint key, GdkModifierType mod,
- const gchar *name, const gchar *label, GtkWidget *menu_item);
+ gchar *name, gchar *label, GtkWidget *menu_item);
}
KeybindingFuncs;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list