[gedit] externaltools: update menuitems when something changes in the manager.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] externaltools: update menuitems when something changes in the manager.
- Date: Mon, 10 Oct 2011 10:43:14 +0000 (UTC)
commit d5ecf90337f40ffa3e1320e7c0c282ad8f0bd9e1
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Oct 10 12:42:43 2011 +0200
externaltools: update menuitems when something changes in the manager.
plugins/externaltools/tools/manager.py | 9 +++------
plugins/externaltools/tools/windowactivatable.py | 4 ++++
2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/plugins/externaltools/tools/manager.py b/plugins/externaltools/tools/manager.py
index e62c6d2..43e781f 100644
--- a/plugins/externaltools/tools/manager.py
+++ b/plugins/externaltools/tools/manager.py
@@ -854,12 +854,9 @@ class Manager:
def on_tool_manager_dialog_focus_out(self, dialog, event):
self.save_current_tool()
- #FIXME: this is wrong, we must emit a signal and let the plugin update the menu
- """
- for window in gedit.app_get_default().get_windows():
- helper = window.get_data("ExternalToolsPluginWindowData")
- helper.menu.update()
- """
+ for window in Gedit.App.get_default().get_windows():
+ windowactivatable = window.get_data("ExternalToolsPluginWindowData")
+ windowactivatable.menu.update()
def get_cell_data_cb(self, column, cell, model, piter, user_data=None):
tool = model.get_value(piter, self.TOOL_COLUMN)
diff --git a/plugins/externaltools/tools/windowactivatable.py b/plugins/externaltools/tools/windowactivatable.py
index 7aabd5e..27aa179 100644
--- a/plugins/externaltools/tools/windowactivatable.py
+++ b/plugins/externaltools/tools/windowactivatable.py
@@ -166,6 +166,9 @@ class WindowActivatable(GObject.Object, Gedit.WindowActivatable):
self.menu = None
def do_activate(self):
+ # We need to get access to the activatable object to update the
+ # menuitems from the manager.
+ self.window.set_data("ExternalToolsPluginWindowData", self)
self._library = ToolLibrary()
ui_manager = self.window.get_ui_manager()
@@ -221,6 +224,7 @@ class WindowActivatable(GObject.Object, Gedit.WindowActivatable):
self.window.get_ui_manager().ensure_update()
def do_deactivate(self):
+ self.window.set_data("ExternalToolsPluginWindowData", None)
ui_manager = self.window.get_ui_manager()
self.menu.deactivate()
ui_manager.remove_ui(self._merge_id)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]