Revision: 2869 http://geany.svn.sourceforge.net/geany/?rev=2869&view=rev Author: ntrel Date: 2008-08-08 18:05:53 +0000 (Fri, 08 Aug 2008)
Log Message: ----------- Rename KeyCallback GeanyKeyCallback. Rename KeyBinding GeanyKeyBinding. Rename KeyBindingGroup GeanyKeyGroup.
Modified Paths: -------------- trunk/ChangeLog trunk/src/build.c trunk/src/keybindings.c trunk/src/keybindings.h trunk/src/plugindata.h trunk/src/plugins.c trunk/src/prefs.c trunk/src/tools.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-08-08 15:15:50 UTC (rev 2868) +++ trunk/ChangeLog 2008-08-08 18:05:53 UTC (rev 2869) @@ -10,6 +10,11 @@ * src/keybindings.c: Don't set plugin keybinding accels for menu items in keybindings_set_item(), so user keycombos can override them. + * src/build.c, src/keybindings.c, src/keybindings.h, src/tools.c, + src/prefs.c, src/plugindata.h, src/plugins.c: + Rename KeyCallback GeanyKeyCallback. + Rename KeyBinding GeanyKeyBinding. + Rename KeyBindingGroup GeanyKeyGroup.
2008-08-08 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/build.c =================================================================== --- trunk/src/build.c 2008-08-08 15:15:50 UTC (rev 2868) +++ trunk/src/build.c 2008-08-08 18:05:53 UTC (rev 2869) @@ -1014,10 +1014,10 @@ /* note: copied from keybindings.c. * Perhaps the separate Tex menu could be merged with the default build menu? * Then this could be done with Glade and set the accels in keybindings.c. */ -static void add_menu_accel(KeyBindingGroup *group, guint kb_id, +static void add_menu_accel(GeanyKeyGroup *group, guint kb_id, GtkAccelGroup *accel_group, GtkWidget *menuitem) { - KeyBinding *kb = &group->keys[kb_id]; + GeanyKeyBinding *kb = &group->keys[kb_id];
if (kb->key != 0) gtk_widget_add_accelerator(menuitem, "activate", accel_group, @@ -1033,7 +1033,7 @@ GtkWidget *menu, *item = NULL, *image, *separator; GtkAccelGroup *accel_group = gtk_accel_group_new(); GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips")); - KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_BUILD); + GeanyKeyGroup *group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_BUILD);
menu = gtk_menu_new();
@@ -1157,7 +1157,7 @@ GtkWidget *menu, *item, *image, *separator; GtkAccelGroup *accel_group = gtk_accel_group_new(); GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(main_widgets.window, "tooltips")); - KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_BUILD); + GeanyKeyGroup *group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_BUILD);
menu = gtk_menu_new();
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2008-08-08 15:15:50 UTC (rev 2868) +++ trunk/src/keybindings.c 2008-08-08 18:05:53 UTC (rev 2869) @@ -46,7 +46,7 @@ #include "vte.h"
-GPtrArray *keybinding_groups; /* array of KeyBindingGroup pointers */ +GPtrArray *keybinding_groups; /* array of GeanyKeyGroup pointers */
/* keyfile group name for non-plugin KB groups */ const gchar keybindings_keyfile_group_name[] = "Bindings"; @@ -91,18 +91,18 @@ static void cb_func_toggle_sidebar(guint key_id);
static void add_popup_menu_accels(void); -static void apply_kb_accel(KeyBindingGroup *group, KeyBinding *kb, gpointer user_data); +static void apply_kb_accel(GeanyKeyGroup *group, GeanyKeyBinding *kb, gpointer user_data);
/* This is used to set default keybindings on startup but at this point we don't want to * assign the keybinding to the menu_item (apply_kb_accel) otherwise it can't be overridden * by user keybindings anymore */ -/** Simple convenience function to fill a KeyBinding struct item. */ -void keybindings_set_item(KeyBindingGroup *group, gsize key_id, - KeyCallback callback, guint key, GdkModifierType mod, +/** Simple convenience function to fill a GeanyKeyBinding struct item. */ +void keybindings_set_item(GeanyKeyGroup *group, gsize key_id, + GeanyKeyCallback callback, guint key, GdkModifierType mod, gchar *name, gchar *label, GtkWidget *menu_item) { - KeyBinding *kb; + GeanyKeyBinding *kb;
g_assert(key_id < group->count);
@@ -117,8 +117,8 @@ }
-static KeyBindingGroup *add_kb_group(KeyBindingGroup *group, - const gchar *name, const gchar *label, gsize count, KeyBinding *keys) +static GeanyKeyGroup *add_kb_group(GeanyKeyGroup *group, + const gchar *name, const gchar *label, gsize count, GeanyKeyBinding *keys) { g_ptr_array_add(keybinding_groups, group);
@@ -135,9 +135,9 @@ lookup_widget(main_widgets.window, G_STRINGIFY(widget_name))
/* Expansion for group_id = FILE: - * static KeyBinding FILE_keys[GEANY_KEYS_FILE_COUNT]; */ + * static GeanyKeyBinding FILE_keys[GEANY_KEYS_FILE_COUNT]; */ #define DECLARE_KEYS(group_id) \ - static KeyBinding group_id ## _keys[GEANY_KEYS_ ## group_id ## _COUNT] + static GeanyKeyBinding group_id ## _keys[GEANY_KEYS_ ## group_id ## _COUNT]
/* Expansion for group_id = FILE: * add_kb_group(&groups[GEANY_KEY_GROUP_FILE], NULL, _("File menu"), @@ -151,8 +151,8 @@ * set in add_popup_menu_accels(). */ static void init_default_kb(void) { - static KeyBindingGroup groups[GEANY_KEY_GROUP_COUNT]; - KeyBindingGroup *group; + static GeanyKeyGroup groups[GEANY_KEY_GROUP_COUNT]; + GeanyKeyGroup *group; DECLARE_KEYS(FILE); DECLARE_KEYS(PROJECT); DECLARE_KEYS(EDITOR); @@ -475,7 +475,7 @@ }
-static void apply_kb_accel(KeyBindingGroup *group, KeyBinding *kb, gpointer user_data) +static void apply_kb_accel(GeanyKeyGroup *group, GeanyKeyBinding *kb, gpointer user_data) { if (kb->key != 0 && kb->menu_item) { @@ -485,7 +485,7 @@ }
-typedef void (*KBItemCallback) (KeyBindingGroup *group, KeyBinding *kb, gpointer user_data); +typedef void (*KBItemCallback) (GeanyKeyGroup *group, GeanyKeyBinding *kb, gpointer user_data);
static void keybindings_foreach(KBItemCallback cb, gpointer user_data) { @@ -493,11 +493,11 @@
for (g = 0; g < keybinding_groups->len; g++) { - KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, g); + GeanyKeyGroup *group = g_ptr_array_index(keybinding_groups, g);
for (i = 0; i < group->count; i++) { - KeyBinding *kb = &group->keys[i]; + GeanyKeyBinding *kb = &group->keys[i];
cb(group, kb, user_data); } @@ -505,7 +505,7 @@ }
-static void load_kb(KeyBindingGroup *group, KeyBinding *kb, gpointer user_data) +static void load_kb(GeanyKeyGroup *group, GeanyKeyBinding *kb, gpointer user_data) { GKeyFile *config = user_data; gchar *val; @@ -550,10 +550,10 @@ }
-static void add_menu_accel(KeyBindingGroup *group, guint kb_id, +static void add_menu_accel(GeanyKeyGroup *group, guint kb_id, GtkAccelGroup *accel_group, GtkWidget *menuitem) { - KeyBinding *kb = &group->keys[kb_id]; + GeanyKeyBinding *kb = &group->keys[kb_id];
if (kb->key != 0) gtk_widget_add_accelerator(menuitem, "activate", accel_group, @@ -568,7 +568,7 @@ static void add_popup_menu_accels(void) { GtkAccelGroup *accel_group = gtk_accel_group_new(); - KeyBindingGroup *group; + GeanyKeyGroup *group;
group = g_ptr_array_index(keybinding_groups, GEANY_KEY_GROUP_EDITOR); GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_EDITOR_UNDO, undo1); @@ -608,7 +608,7 @@ }
-static void set_keyfile_kb(KeyBindingGroup *group, KeyBinding *kb, gpointer user_data) +static void set_keyfile_kb(GeanyKeyGroup *group, GeanyKeyBinding *kb, gpointer user_data) { GKeyFile *config = user_data; gchar *val; @@ -661,7 +661,7 @@
for (g = 0; g < keybinding_groups->len; g++) { - KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, g); + GeanyKeyGroup *group = g_ptr_array_index(keybinding_groups, g);
if (g == 0) { @@ -676,7 +676,7 @@
for (i = 0; i < group->count; i++) { - KeyBinding *kb = &group->keys[i]; + GeanyKeyBinding *kb = &group->keys[i]; gchar *shortcut;
shortcut = gtk_accelerator_get_label(kb->key, kb->mods); @@ -816,7 +816,7 @@ * return FALSE if no completion occurs, so the tab or space is handled normally. */ static gboolean check_snippet_completion(guint keyval, guint state) { - KeyBinding *kb = keybindings_lookup_item(GEANY_KEY_GROUP_EDITOR, + GeanyKeyBinding *kb = keybindings_lookup_item(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_COMPLETESNIPPET);
if (kb->key == keyval && kb->mods == state) @@ -873,7 +873,7 @@ /* make focus commands override any bash commands */ for (i = 0; i < GEANY_KEYS_FOCUS_COUNT; i++) { - KeyBinding *kb = keybindings_lookup_item(GEANY_KEY_GROUP_FOCUS, i); + GeanyKeyBinding *kb = keybindings_lookup_item(GEANY_KEY_GROUP_FOCUS, i);
if (state == kb->mods && keyval == kb->key) return FALSE; @@ -942,11 +942,11 @@ ignore_keybinding = FALSE; for (g = 0; g < keybinding_groups->len; g++) { - KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, g); + GeanyKeyGroup *group = g_ptr_array_index(keybinding_groups, g);
for (i = 0; i < group->count; i++) { - KeyBinding *kb = &group->keys[i]; + GeanyKeyBinding *kb = &group->keys[i];
if (keyval == kb->key && state == kb->mods) { @@ -966,9 +966,9 @@ }
-KeyBinding *keybindings_lookup_item(guint group_id, guint key_id) +GeanyKeyBinding *keybindings_lookup_item(guint group_id, guint key_id) { - KeyBindingGroup *group; + GeanyKeyGroup *group;
g_return_val_if_fail(group_id < keybinding_groups->len, NULL);
@@ -987,7 +987,7 @@ * @param key_id The keybinding command index. */ void keybindings_send_command(guint group_id, guint key_id) { - KeyBinding *kb; + GeanyKeyBinding *kb;
g_return_if_fail(group_id < GEANY_KEY_GROUP_COUNT); /* can't use this for plugin groups */
@@ -1537,7 +1537,7 @@ break; case GEANY_KEYS_EDITOR_SUPPRESSSNIPPETCOMPLETION: { - KeyBinding *kb = keybindings_lookup_item(GEANY_KEY_GROUP_EDITOR, + GeanyKeyBinding *kb = keybindings_lookup_item(GEANY_KEY_GROUP_EDITOR, GEANY_KEYS_EDITOR_COMPLETESNIPPET);
switch (kb->key)
Modified: trunk/src/keybindings.h =================================================================== --- trunk/src/keybindings.h 2008-08-08 15:15:50 UTC (rev 2868) +++ trunk/src/keybindings.h 2008-08-08 18:05:53 UTC (rev 2869) @@ -40,33 +40,33 @@
/** Function pointer type used for keybinding callbacks */ -typedef void (*KeyCallback) (guint key_id); +typedef void (*GeanyKeyCallback) (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 +typedef struct GeanyKeyBinding { guint key; /**< Key value in lower-case, such as @c GDK_a */ GdkModifierType mods; /**< Modifier keys, such as @c GDK_CONTROL_MASK */ 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 */ + GeanyKeyCallback callback; /**< Callback function called when the key combination is pressed */ GtkWidget *menu_item; /**< Menu item widget for setting the menu accelerator */ -} KeyBinding; +} GeanyKeyBinding;
/** A collection of keybindings grouped together. */ -typedef struct KeyBindingGroup +typedef struct GeanyKeyGroup { const gchar *name; /**< Group name used in the configuration file, such as @c "html_chars" */ const gchar *label; /**< Group label used in the preferences dialog keybindings tab */ - gsize count; /**< Count of KeyBinding structs in @a keys */ - KeyBinding *keys; /**< Fixed array of KeyBinding structs */ + gsize count; /**< Count of GeanyKeyBinding structs in @a keys */ + GeanyKeyBinding *keys; /**< Fixed array of GeanyKeyBinding structs */ } -KeyBindingGroup; +GeanyKeyGroup;
-extern GPtrArray *keybinding_groups; /* array of KeyBindingGroup pointers */ +extern GPtrArray *keybinding_groups; /* array of GeanyKeyGroup pointers */
extern const gchar keybindings_keyfile_group_name[];
@@ -319,13 +319,13 @@
void keybindings_free(void);
-void keybindings_set_item(KeyBindingGroup *group, gsize key_id, - KeyCallback callback, guint key, GdkModifierType mod, +void keybindings_set_item(GeanyKeyGroup *group, gsize key_id, + GeanyKeyCallback callback, guint key, GdkModifierType mod, gchar *name, gchar *label, GtkWidget *menu_item);
void keybindings_send_command(guint group_id, guint key_id);
-KeyBinding *keybindings_lookup_item(guint group_id, guint key_id); +GeanyKeyBinding *keybindings_lookup_item(guint group_id, guint key_id);
/* just write the content of the keys array to the config file */ void keybindings_write_to_file(void);
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2008-08-08 15:15:50 UTC (rev 2868) +++ trunk/src/plugindata.h 2008-08-08 18:05:53 UTC (rev 2869) @@ -36,7 +36,7 @@
/* The API version should be incremented whenever any plugin data types below are * modified or appended to. */ -static const gint api_version = 85; +static const gint api_version = 86;
/* 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 @@ -92,7 +92,7 @@
/** Declare and initialise a keybinding group. - * @code KeyBindingGroup plugin_key_group[1]; @endcode + * @code GeanyKeyGroup plugin_key_group[1]; @endcode * You must then set the @c plugin_key_group::keys[] entries for the group in plugin_init(). * The @c plugin_key_group::label field is set by Geany after @c plugin_init() * is called, to the name of the plugin. @@ -100,11 +100,11 @@ * configuration file, such as @c html_chars. * @param key_count The number of keybindings the group will hold. */ #define PLUGIN_KEY_GROUP(group_name, key_count) \ - static KeyBinding plugin_keys[key_count]; \ + static GeanyKeyBinding plugin_keys[key_count]; \ \ /* We have to declare plugin_key_group as a single element array. * Declaring as a pointer to a struct doesn't work with g_module_symbol(). */ \ - KeyBindingGroup plugin_key_group[1] = \ + GeanyKeyGroup plugin_key_group[1] = \ { \ {G_STRINGIFY(group_name), NULL, key_count, plugin_keys} \ }; @@ -375,14 +375,14 @@ EncodingFuncs;
-struct KeyBindingGroup; +struct GeanyKeyGroup; typedef void (*_KeyCallback) (guint key_id);
/* See keybindings.h */ typedef struct KeybindingFuncs { void (*send_command) (guint group_id, guint key_id); - void (*set_item) (struct KeyBindingGroup *group, gsize key_id, + void (*set_item) (struct GeanyKeyGroup *group, gsize key_id, _KeyCallback callback, guint key, GdkModifierType mod, gchar *name, gchar *label, GtkWidget *menu_item); }
Modified: trunk/src/plugins.c =================================================================== --- trunk/src/plugins.c 2008-08-08 15:15:50 UTC (rev 2868) +++ trunk/src/plugins.c 2008-08-08 18:05:53 UTC (rev 2869) @@ -73,7 +73,7 @@ PluginFields fields; gulong *signal_ids; /* signal IDs to disconnect when unloading */ gsize signal_ids_len; - KeyBindingGroup *key_group; + GeanyKeyGroup *key_group;
void (*init) (GeanyData *data); /* Called when the plugin is enabled */ GtkWidget* (*configure) (GtkDialog *dialog); /* plugin configure dialog, optional */ @@ -425,7 +425,7 @@
for (i = 0; i < plugin->key_group->count; i++) { - KeyBinding *kb = &plugin->key_group->keys[i]; + GeanyKeyBinding *kb = &plugin->key_group->keys[i];
if (!NZV(kb->name)) {
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2008-08-08 15:15:50 UTC (rev 2868) +++ trunk/src/prefs.c 2008-08-08 18:05:53 UTC (rev 2869) @@ -78,7 +78,7 @@ static void on_cell_edited(GtkCellRendererText *cellrenderertext, gchar *path, gchar *new_text, gpointer user_data); static gboolean on_keytype_dialog_response(GtkWidget *dialog, GdkEventKey *event, gpointer user_data); static void on_dialog_response(GtkWidget *dialog, gint response, gpointer user_data); -static gboolean find_duplicate(KeyBinding *search_kb, +static gboolean find_duplicate(GeanyKeyBinding *search_kb, guint key, GdkModifierType mods, const gchar *action); static void on_toolbar_show_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointer user_data); @@ -303,7 +303,7 @@
for (g = 0; g < keybinding_groups->len; g++) { - KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, g); + GeanyKeyGroup *group = g_ptr_array_index(keybinding_groups, g);
gtk_tree_store_append(store, &parent, NULL); gtk_tree_store_set(store, &parent, KB_TREE_ACTION, group->label, @@ -311,7 +311,7 @@
for (i = 0; i < group->count; i++) { - KeyBinding *kb = &group->keys[i]; + GeanyKeyBinding *kb = &group->keys[i]; gchar *key_string;
key_string = gtk_accelerator_name(kb->key, kb->mods); @@ -1295,7 +1295,7 @@ }
-static KeyBinding *lookup_kb_from_iter(G_GNUC_UNUSED GtkTreeModel *model, GtkTreeIter *iter) +static GeanyKeyBinding *lookup_kb_from_iter(G_GNUC_UNUSED GtkTreeModel *model, GtkTreeIter *iter) { guint group_idx, keybinding_idx; GtkTreeIter parent; @@ -1318,7 +1318,7 @@ GtkTreeIter iter; guint lkey; GdkModifierType lmods; - KeyBinding *kb; + GeanyKeyBinding *kb;
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(store), &iter, path); if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(store), &iter)) @@ -1368,7 +1368,7 @@ { guint lkey; GdkModifierType lmods; - KeyBinding *kb; + GeanyKeyBinding *kb;
kb = lookup_kb_from_iter(GTK_TREE_MODEL(store), &g_iter);
@@ -1435,7 +1435,7 @@
/* test if the entered key combination is already used */ -static gboolean find_duplicate(KeyBinding *search_kb, +static gboolean find_duplicate(GeanyKeyBinding *search_kb, guint key, GdkModifierType mods, const gchar *action) { gsize g, i; @@ -1445,12 +1445,12 @@
for (g = 0; g < keybinding_groups->len; g++) { - KeyBindingGroup *group = g_ptr_array_index(keybinding_groups, g); + GeanyKeyGroup *group = g_ptr_array_index(keybinding_groups, g);
for (i = 0; i < group->count; i++) { - KeyBinding *keys = group->keys; - KeyBinding *kb = &keys[i]; + GeanyKeyBinding *keys = group->keys; + GeanyKeyBinding *kb = &keys[i];
/* search another item with the same key, * but don't search the key we're looking for keys[idx] */
Modified: trunk/src/tools.c =================================================================== --- trunk/src/tools.c 2008-08-08 15:15:50 UTC (rev 2868) +++ trunk/src/tools.c 2008-08-08 18:05:53 UTC (rev 2869) @@ -447,7 +447,7 @@ { GtkWidget *item; gint key_idx = -1; - KeyBinding *kb = NULL; + GeanyKeyBinding *kb = NULL;
switch (idx) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.