Revision: 2733 http://geany.svn.sourceforge.net/geany/?rev=2733&view=rev Author: eht16 Date: 2008-06-28 08:46:07 -0700 (Sat, 28 Jun 2008)
Log Message: ----------- Add plugin signal "populate-edit-menu" to notify plugins when the editing menu is shown.
Modified Paths: -------------- trunk/ChangeLog trunk/doc/plugins.dox trunk/src/editor.c trunk/src/geanyobject.c trunk/src/geanyobject.h trunk/src/plugindata.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-06-28 15:42:10 UTC (rev 2732) +++ trunk/ChangeLog 2008-06-28 15:46:07 UTC (rev 2733) @@ -7,6 +7,10 @@ * src/editor.c: Attempt to make editor_find_current_word() Unicode-safe. Note: this can be done better. + * doc/plugins.dox, src/editor.c, src/geanyobject.c, src/geanyobject.h, + src/plugindata.h: + Add plugin signal "populate-edit-menu" to notify plugins when the + editing menu is shown.
2008-06-27 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: trunk/doc/plugins.dox =================================================================== --- trunk/doc/plugins.dox 2008-06-28 15:42:10 UTC (rev 2732) +++ trunk/doc/plugins.dox 2008-06-28 15:46:07 UTC (rev 2733) @@ -159,8 +159,24 @@ * @param user_data user data. * @endsignaldef * + * @signaldef populate-edit-menu + * @signalproto + * void user_function(GObject *obj, const gchar *word, gint pos, GeanyDocument *doc, + * gpointer user_data); + * @endsignalproto + * @signaldesc + * Sent before the popup menu of the editing widget is shown. This can be used to modify or extend + * the popup menu. You can access the menu pointer using @a main_widgets->editor_menu. + * @param obj a GeanyObject instance, should be ignored. + * @param word the current word (in UTF-8 encoding) below the cursor position + where the popup menu will be opened. + * @param click_pos the cursor position where the popup will be opened. + * @param doc the current document. + * @param user_data user data. + * @endsignaldef * * + * * @page howto Plugin Howto * * @section intro Introduction
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2008-06-28 15:42:10 UTC (rev 2732) +++ trunk/src/editor.c 2008-06-28 15:46:07 UTC (rev 2733) @@ -47,6 +47,7 @@ #include "dialogs.h" #include "symbols.h" #include "callbacks.h" +#include "geanyobject.h"
/* holds word under the mouse or keyboard cursor */ @@ -109,6 +110,12 @@ ui_update_popup_goto_items((current_word[0] != '\0') ? TRUE : FALSE); ui_update_popup_copy_items(doc); ui_update_insert_include_item(doc, 0); + + if (geany_object) + { + g_signal_emit_by_name(geany_object, "populate-edit-menu", + current_word, editor_info.click_pos, doc); + } gtk_menu_popup(GTK_MENU(main_widgets.editor_menu), NULL, NULL, NULL, NULL, event->button, event->time);
Modified: trunk/src/geanyobject.c =================================================================== --- trunk/src/geanyobject.c 2008-06-28 15:42:10 UTC (rev 2732) +++ trunk/src/geanyobject.c 2008-06-28 15:46:07 UTC (rev 2733) @@ -143,6 +143,15 @@ NULL, NULL, gtk_marshal_NONE__NONE, G_TYPE_NONE, 0); + geany_object_signals[GCB_POPULATE_EDIT_MENU] = g_signal_new ( + "populate-edit-menu", + G_OBJECT_CLASS_TYPE (g_object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GeanyObjectClass, populate_edit_menu), + NULL, NULL, + gtk_marshal_NONE__STRING_INT_POINTER, + G_TYPE_NONE, 3, + G_TYPE_STRING, G_TYPE_INT, G_TYPE_POINTER); }
Modified: trunk/src/geanyobject.h =================================================================== --- trunk/src/geanyobject.h 2008-06-28 15:42:10 UTC (rev 2732) +++ trunk/src/geanyobject.h 2008-06-28 15:46:07 UTC (rev 2733) @@ -41,6 +41,7 @@ GCB_PROJECT_OPEN, GCB_PROJECT_SAVE, GCB_PROJECT_CLOSE, + GCB_POPULATE_EDIT_MENU, GCB_MAX } GeanyCallbackId;
@@ -77,6 +78,7 @@ void (*project_open)(GKeyFile *keyfile); void (*project_save)(GKeyFile *keyfile); void (*project_close)(void); + void (*populate_edit_menu)(const gchar *word, gint click_pos, GeanyDocument *doc); };
GType geany_object_get_type (void);
Modified: trunk/src/plugindata.h =================================================================== --- trunk/src/plugindata.h 2008-06-28 15:42:10 UTC (rev 2732) +++ trunk/src/plugindata.h 2008-06-28 15:46:07 UTC (rev 2733) @@ -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 = 71; +static const gint api_version = 72;
/* 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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.