Add plugin signal "populate-edit-menu" to notify plugins when the editing menu is shown.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2733 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
b2c8cd062c
commit
2d5d52a08d
@ -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>
|
||||
|
||||
@ -159,6 +159,22 @@ PluginCallback plugin_callbacks[] =
|
||||
* @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
|
||||
|
||||
@ -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 @@ on_editor_button_press_event (GtkWidget *widget,
|
||||
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);
|
||||
|
||||
|
||||
@ -143,6 +143,15 @@ static void create_signals(GObjectClass *g_object_class)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ typedef enum
|
||||
GCB_PROJECT_OPEN,
|
||||
GCB_PROJECT_SAVE,
|
||||
GCB_PROJECT_CLOSE,
|
||||
GCB_POPULATE_EDIT_MENU,
|
||||
GCB_MAX
|
||||
} GeanyCallbackId;
|
||||
|
||||
@ -77,6 +78,7 @@ struct _GeanyObjectClass
|
||||
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);
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user