[gedit] externaltools: add popup method so the languages popup does not flicker when it is shown
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] externaltools: add popup method so the languages popup does not flicker when it is shown
- Date: Fri, 3 Feb 2012 21:25:06 +0000 (UTC)
commit a93938222221ee0c6a79181013874b7c34958daa
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Fri Feb 3 22:28:45 2012 +0100
externaltools: add popup method so the languages popup does not flicker when it is shown
plugins/externaltools/tools/manager.py | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/plugins/externaltools/tools/manager.py b/plugins/externaltools/tools/manager.py
index a17cbee..e843a47 100644
--- a/plugins/externaltools/tools/manager.py
+++ b/plugins/externaltools/tools/manager.py
@@ -41,8 +41,18 @@ class LanguagesPopup(Gtk.Window):
self.build()
self.init_languages(languages)
+ self.view.get_selection().select_path((0,))
+
+ def attach_to_widget(self, widget):
+ self.attach_widget = widget
+
+ def popup(self):
+ # show after moving the window to not produce visual flickering
self.show()
+ origin = self.attach_widget.get_window().get_origin()
+ self.move(origin[1], origin[2] - self.get_allocation().height)
+
self.grab_add()
self.keyboard = None
@@ -72,8 +82,6 @@ class LanguagesPopup(Gtk.Window):
Gdk.EventMask.SCROLL_MASK,
None, Gdk.CURRENT_TIME)
- self.view.get_selection().select_path((0,))
-
def build(self):
self.model = Gtk.ListStore(str, str, bool)
@@ -970,8 +978,8 @@ class Manager:
popup = LanguagesPopup(self.current_node.languages)
popup.set_transient_for(self.dialog)
- origin = button.get_window().get_origin()
- popup.move(origin[1], origin[2] - popup.get_allocation().height)
+ popup.attach_to_widget(button)
+ popup.popup()
popup.connect('destroy', self.update_languages)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]