[anjuta] language-support-cpp-java, document-manager: Move Edit->Autocomplete
- From: Johannes Schmid <jhs src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [anjuta] language-support-cpp-java, document-manager: Move Edit->Autocomplete
- Date: Tue, 1 Dec 2009 16:35:25 +0000 (UTC)
commit 5776aac8cb65329845f8e60abc3f3d6e2bcd03b3
Author: Johannes Schmid <jhs gnome org>
Date: Tue Dec 1 17:34:49 2009 +0100
language-support-cpp-java, document-manager: Move Edit->Autocomplete
Moved the Edit->Autocomplete menu item from language-support plugin to the document-manager to
avoid conflicts between different language-support plugins. Also moved corresponding icons.
plugins/document-manager/action-callbacks.c | 15 ++++++
plugins/document-manager/action-callbacks.h | 1 +
.../document-manager/anjuta-document-manager.xml | 5 ++-
plugins/document-manager/images/Makefile.am | 6 ++-
plugins/document-manager/plugin.c | 17 +++++++
plugins/language-support-cpp-java/Makefile.am | 6 +--
.../anjuta-language-support-cpp-java.xml | 2 -
plugins/language-support-cpp-java/plugin.c | 46 --------------------
8 files changed, 43 insertions(+), 55 deletions(-)
---
diff --git a/plugins/document-manager/action-callbacks.c b/plugins/document-manager/action-callbacks.c
index 88ca7ca..a4960b3 100644
--- a/plugins/document-manager/action-callbacks.c
+++ b/plugins/document-manager/action-callbacks.c
@@ -35,6 +35,7 @@
#include <libanjuta/interfaces/ianjuta-editor-zoom.h>
#include <libanjuta/interfaces/ianjuta-editor-goto.h>
#include <libanjuta/interfaces/ianjuta-editor-language.h>
+#include <libanjuta/interfaces/ianjuta-editor-assist.h>
#include <sys/wait.h>
#include <sys/stat.h>
@@ -956,3 +957,17 @@ on_bookmarks_clear_activate (GtkAction *action, gpointer user_data)
plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
anjuta_bookmarks_clear (ANJUTA_BOOKMARKS(plugin->bookmarks));
}
+
+void
+on_autocomplete_activate (GtkAction *action, gpointer user_data)
+{
+ IAnjutaDocument *doc;
+ DocmanPlugin *plugin;
+ doc = get_current_document (user_data);
+ plugin = ANJUTA_PLUGIN_DOCMAN (user_data);
+ if (doc && IANJUTA_IS_EDITOR_ASSIST(doc))
+ {
+ IAnjutaEditorAssist* assist = IANJUTA_EDITOR_ASSIST (doc);
+ ianjuta_editor_assist_invoke (assist, NULL, NULL);
+ }
+}
diff --git a/plugins/document-manager/action-callbacks.h b/plugins/document-manager/action-callbacks.h
index d02c7b3..2c972a6 100644
--- a/plugins/document-manager/action-callbacks.h
+++ b/plugins/document-manager/action-callbacks.h
@@ -102,4 +102,5 @@ void on_bookmark_next_activate (GtkAction *action, gpointer user_data);
void on_bookmark_prev_activate (GtkAction *action, gpointer user_data);
void on_bookmarks_clear_activate (GtkAction *action, gpointer user_data);
+void on_autocomplete_activate (GtkAction *action, gpointer user_data);
#endif
diff --git a/plugins/document-manager/anjuta-document-manager.xml b/plugins/document-manager/anjuta-document-manager.xml
index f159b49..e69e189 100644
--- a/plugins/document-manager/anjuta-document-manager.xml
+++ b/plugins/document-manager/anjuta-document-manager.xml
@@ -58,7 +58,10 @@
</menu>
</placeholder>
<placeholder name="PlaceholderInsertMenus"/>
- <placeholder name="PlaceholderOperationMenus"/>
+ <placeholder name="PlaceholderOperationMenus">
+ <separator name="separator1"/>
+ <menuitem name="Autocomplete" action="ActionEditAutocomplete" />
+ </placeholder>
</menu>
<menu name="MenuView" action="ActionMenuView">
<menu name="MenuViewEditor" action="ActionMenuViewEditor">
diff --git a/plugins/document-manager/images/Makefile.am b/plugins/document-manager/images/Makefile.am
index 5e810f9..5bc5650 100644
--- a/plugins/document-manager/images/Makefile.am
+++ b/plugins/document-manager/images/Makefile.am
@@ -38,7 +38,11 @@ document_manager_pixmaps_DATA = \
anjuta-go-history-next-16.png \
anjuta-go-history-next-24.png \
anjuta-go-history-prev-16.png \
- anjuta-go-history-prev-24.png
+ anjuta-go-history-prev-24.png \
+ anjuta-complete-16.png \
+ anjuta-complete-24.png \
+ anjuta-complete-auto-16.png \
+ anjuta-complete-auto-24.png
EXTRA_DIST = $(document_manager_pixmaps_DATA)
diff --git a/plugins/document-manager/plugin.c b/plugins/document-manager/plugin.c
index b7a313e..b515e9f 100644
--- a/plugins/document-manager/plugin.c
+++ b/plugins/document-manager/plugin.c
@@ -37,6 +37,7 @@
#include <libanjuta/interfaces/ianjuta-editor-zoom.h>
#include <libanjuta/interfaces/ianjuta-editor-goto.h>
#include <libanjuta/interfaces/ianjuta-editor-search.h>
+#include <libanjuta/interfaces/ianjuta-editor-assist.h>
#include <libanjuta/interfaces/ianjuta-file-savable.h>
#include <libanjuta/interfaces/ianjuta-editor-language.h>
#include <libanjuta/interfaces/ianjuta-language-support.h>
@@ -75,6 +76,7 @@
#define ANJUTA_PIXMAP_HISTORY_NEXT "anjuta-go-history-next"
#define ANJUTA_PIXMAP_HISTORY_PREV "anjuta-go-history-prev"
+#define ANJUTA_PIXMAP_AUTOCOMPLETE "anjuta-complete-auto"
/* Stock icons */
#define ANJUTA_STOCK_FOLD_TOGGLE "anjuta-fold-toggle"
@@ -96,6 +98,7 @@
#define ANJUTA_STOCK_HISTORY_PREV "anjuta-history-prev"
#define ANJUTA_STOCK_MATCH_NEXT "anjuta-match-next"
#define ANJUTA_STOCK_MATCH_PREV "anjuta-match-prev"
+#define ANJUTA_STOCK_AUTOCOMPLETE "anjuta-autocomplete"
static gpointer parent_class;
@@ -303,6 +306,10 @@ static GtkActionEntry actions_edit[] = {
, N_("_Clear"), NULL,
N_("Delete the selected text from the editor"),
G_CALLBACK (on_editor_command_clear_activate)},
+ { "ActionEditAutocomplete", ANJUTA_STOCK_AUTOCOMPLETE,
+ N_("_Auto-Complete"), "<control>Return",
+ N_("Auto-complete the current word"), G_CALLBACK (on_autocomplete_activate)
+ }
};
static GtkToggleActionEntry actions_view[] = {
@@ -832,6 +839,15 @@ update_document_ui_interface_items (AnjutaPlugin *plugin, IAnjutaDocument *doc)
"ActionEditGotoLine");
g_object_set (G_OBJECT (action), "sensitive", flag, NULL);
+ /* IAnjutaEditorAssist */
+ flag = IANJUTA_IS_EDITOR_ASSIST (doc);
+
+ /* Enable autocompletion action */
+ action = anjuta_ui_get_action (ui,
+ "ActionGroupEditorEdit",
+ "ActionEditAutocomplete");
+ g_object_set (G_OBJECT (action), "visible", flag,
+ "sensitive", flag, NULL);
}
static void
@@ -881,6 +897,7 @@ register_stock_icons (AnjutaPlugin *plugin)
REGISTER_ICON_FULL (ANJUTA_PIXMAP_GOTO_LINE, ANJUTA_STOCK_GOTO_LINE);
REGISTER_ICON_FULL (ANJUTA_PIXMAP_HISTORY_NEXT, ANJUTA_STOCK_HISTORY_NEXT);
REGISTER_ICON_FULL (ANJUTA_PIXMAP_HISTORY_PREV, ANJUTA_STOCK_HISTORY_PREV);
+ REGISTER_ICON_FULL (ANJUTA_PIXMAP_AUTOCOMPLETE, ANJUTA_STOCK_AUTOCOMPLETE);
END_REGISTER_ICON;
}
diff --git a/plugins/language-support-cpp-java/Makefile.am b/plugins/language-support-cpp-java/Makefile.am
index dd5fdc5..5d9bd70 100644
--- a/plugins/language-support-cpp-java/Makefile.am
+++ b/plugins/language-support-cpp-java/Makefile.am
@@ -10,11 +10,7 @@ cpp_java_ui_DATA = anjuta-language-support-cpp-java.xml
# Plugin Icon file
cpp_java_pixmapsdir = $(anjuta_image_dir)
cpp_java_pixmaps_DATA = \
- anjuta-language-cpp-java-plugin.png \
- anjuta-complete-16.png \
- anjuta-complete-24.png \
- anjuta-complete-auto-16.png \
- anjuta-complete-auto-24.png \
+ anjuta-language-cpp-java-plugin.png \
anjuta-indent-auto-16.png \
anjuta-indent-auto-24.png
diff --git a/plugins/language-support-cpp-java/anjuta-language-support-cpp-java.xml b/plugins/language-support-cpp-java/anjuta-language-support-cpp-java.xml
index 54e3d99..d2229da 100644
--- a/plugins/language-support-cpp-java/anjuta-language-support-cpp-java.xml
+++ b/plugins/language-support-cpp-java/anjuta-language-support-cpp-java.xml
@@ -3,8 +3,6 @@
<menubar name="MenuMain">
<menu name="MenuEdit" action="ActionMenuEdit">
<placeholder name="PlaceholderOperationMenus">
- <separator name="separator1"/>
- <menuitem name="Autocomplete" action="ActionEditAutocomplete" />
<menuitem name="AutoindentAction" action="ActionEditAutoindent" />
</placeholder>
</menu>
diff --git a/plugins/language-support-cpp-java/plugin.c b/plugins/language-support-cpp-java/plugin.c
index 9a820a5..c2e6206 100644
--- a/plugins/language-support-cpp-java/plugin.c
+++ b/plugins/language-support-cpp-java/plugin.c
@@ -42,12 +42,9 @@
/* Pixmaps */
#define ANJUTA_PIXMAP_SWAP "anjuta-swap"
-#define ANJUTA_PIXMAP_COMPLETE "anjuta-complete"
-#define ANJUTA_PIXMAP_AUTOCOMPLETE "anjuta-complete-auto"
#define ANJUTA_PIXMAP_AUTOINDENT "anjuta-indent-auto"
#define ANJUTA_STOCK_SWAP "anjuta-swap"
#define ANJUTA_STOCK_COMPLETE "anjuta-complete"
-#define ANJUTA_STOCK_AUTOCOMPLETE "anjuta-autocomplete"
#define ANJUTA_STOCK_AUTOINDENT "anjuta-indent"
#define UI_FILE PACKAGE_DATA_DIR"/ui/anjuta-language-support-cpp-java.xml"
@@ -1634,19 +1631,6 @@ install_support (CppJavaPlugin *lang_plugin)
IAnjutaSymbolManager,
NULL),
lang_plugin->prefs);
- /* assist is NULL, if the editor does not provide any assistance */
- if (assist != NULL)
- {
- GtkAction *action;
-
- lang_plugin->assist = assist;
-
- /* Enable autocompletion action */
- action = gtk_action_group_get_action (lang_plugin->action_group,
- "ActionEditAutocomplete");
- g_object_set (G_OBJECT (action), "visible", TRUE,
- "sensitive", TRUE, NULL);
- }
}
lang_plugin->support_installed = TRUE;
@@ -1677,20 +1661,7 @@ uninstall_support (CppJavaPlugin *lang_plugin)
if (lang_plugin->assist)
{
- AnjutaPlugin *plugin;
- AnjutaUI *ui;
- GtkAction *action;
-
g_object_unref (lang_plugin->assist);
- lang_plugin->assist = NULL;
-
- /* Disable autocompletion action */
- plugin = ANJUTA_PLUGIN (lang_plugin);
- ui = anjuta_shell_get_ui (plugin->shell, NULL);
- action = gtk_action_group_get_action (lang_plugin->action_group,
- "ActionEditAutocomplete");
- g_object_set (G_OBJECT (action), "visible", FALSE,
- "sensitive", FALSE, NULL);
}
lang_plugin->support_installed = FALSE;
@@ -1899,14 +1870,6 @@ on_auto_indent (GtkAction *action, gpointer data)
ianjuta_document_end_undo_action (IANJUTA_DOCUMENT(editor), NULL);
}
-static void
-on_auto_complete (GtkAction *action, gpointer data)
-{
- CppJavaPlugin *lang_plugin;
- lang_plugin = ANJUTA_PLUGIN_CPP_JAVA (data);
- /* FIXME */
-}
-
static GtkActionEntry actions[] = {
{
"ActionMenuEdit",
@@ -1914,13 +1877,6 @@ static GtkActionEntry actions[] = {
NULL, NULL, NULL
},
{
- "ActionEditAutocomplete",
- ANJUTA_STOCK_AUTOCOMPLETE,
- N_("_Auto-Complete"), "<control>Return",
- N_("Auto-complete the current word"),
- G_CALLBACK (on_auto_complete)
- },
- {
"ActionEditAutoindent",
ANJUTA_STOCK_AUTOINDENT,
N_("Auto-Indent"), "<control>i",
@@ -1947,8 +1903,6 @@ register_stock_icons (AnjutaPlugin *plugin)
/* Register stock icons */
BEGIN_REGISTER_ICON (plugin);
REGISTER_ICON_FULL (ANJUTA_PIXMAP_SWAP, ANJUTA_STOCK_SWAP);
- REGISTER_ICON_FULL (ANJUTA_PIXMAP_COMPLETE, ANJUTA_STOCK_COMPLETE);
- REGISTER_ICON_FULL (ANJUTA_PIXMAP_AUTOCOMPLETE, ANJUTA_STOCK_AUTOCOMPLETE);
REGISTER_ICON_FULL (ANJUTA_PIXMAP_AUTOINDENT, ANJUTA_STOCK_AUTOINDENT);
END_REGISTER_ICON;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]