[anjuta] search-plugin: unmerge ui and remove action group when the plugin is deactivated



commit 5d0f2120fd19376855c89b7fc32629035ed50c47
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Thu Sep 24 16:56:09 2009 +0200

    search-plugin: unmerge ui and remove action group when the plugin is deactivated
    
    https://bugzilla.gnome.org/show_bug.cgi?id=596123

 plugins/search/plugin.c |   17 ++++++++++++-----
 plugins/search/plugin.h |    4 +++-
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/plugins/search/plugin.c b/plugins/search/plugin.c
index 71dec66..3fb41cc 100644
--- a/plugins/search/plugin.c
+++ b/plugins/search/plugin.c
@@ -98,11 +98,11 @@ activate_plugin (AnjutaPlugin *plugin)
 																IAnjutaDocumentManager, NULL);
 	
 	ui = anjuta_shell_get_ui (plugin->shell, NULL);
-	anjuta_ui_add_action_group_entries (ui, "ActionGroupSearch",
-					_("Searchingâ?¦"),
-					actions_search,
-					G_N_ELEMENTS (actions_search),
-					GETTEXT_PACKAGE, TRUE, plugin);
+	splugin->action_group = anjuta_ui_add_action_group_entries (ui, "ActionGroupSearch",
+	                                                            _("Searchingâ?¦"),
+	                                                            actions_search,
+	                                                            G_N_ELEMENTS (actions_search),
+	                                                            GETTEXT_PACKAGE, TRUE, plugin);
 
 	
 	splugin->uiid = anjuta_ui_merge (ui, UI_FILE);
@@ -115,6 +115,13 @@ activate_plugin (AnjutaPlugin *plugin)
 static gboolean
 deactivate_plugin (AnjutaPlugin *plugin)
 {
+	SearchPlugin* splugin = ANJUTA_PLUGIN_SEARCH (plugin);
+	AnjutaUI *ui;
+
+	ui = anjuta_shell_get_ui (plugin->shell, NULL);
+
+	anjuta_ui_unmerge (ui, splugin->uiid);
+	anjuta_ui_remove_action_group (ui, splugin->action_group);
 	
 	return TRUE;
 }
diff --git a/plugins/search/plugin.h b/plugins/search/plugin.h
index 4dfd429..3e1dc59 100644
--- a/plugins/search/plugin.h
+++ b/plugins/search/plugin.h
@@ -34,7 +34,9 @@ typedef struct _SearchPluginClass SearchPluginClass;
 
 struct _SearchPlugin{
 	AnjutaPlugin parent;
-	
+
+  GtkActionGroup *action_group;
+  
 	gint uiid;
 	IAnjutaDocumentManager* docman;
 };



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]