[gedit] tools: get manager size from configure-event signal
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] tools: get manager size from configure-event signal
- Date: Mon, 1 Apr 2013 16:43:31 +0000 (UTC)
commit 6c95d28a13ae87232346583a86ae525a22fcc651
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Apr 1 18:35:19 2013 +0200
tools: get manager size from configure-event signal
plugins/externaltools/tools/manager.py | 10 ++++++++++
plugins/externaltools/tools/tools.ui | 1 +
plugins/externaltools/tools/windowactivatable.py | 3 +--
3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/plugins/externaltools/tools/manager.py b/plugins/externaltools/tools/manager.py
index ef22de1..a97d82a 100644
--- a/plugins/externaltools/tools/manager.py
+++ b/plugins/externaltools/tools/manager.py
@@ -286,17 +286,22 @@ class Manager(GObject.Object):
GObject.Object.__init__(self)
self.datadir = datadir
self.dialog = None
+ self._size = (0, 0)
self._languages = {}
self._tool_rows = {}
self.build()
+ def get_final_size(self):
+ return self._size
+
def build(self):
callbacks = {
'on_action_add_tool_activated' : self.on_action_add_tool_activated,
'on_action_remove_tool_activated' : self.on_action_remove_tool_activated,
'on_tool_manager_dialog_response' : self.on_tool_manager_dialog_response,
'on_tool_manager_dialog_focus_out': self.on_tool_manager_dialog_focus_out,
+ 'on_tool_manager_dialog_configure_event': self.on_tool_manager_dialog_configure_event,
'on_accelerator_key_press' : self.on_accelerator_key_press,
'on_accelerator_focus_in' : self.on_accelerator_focus_in,
'on_accelerator_focus_out' : self.on_accelerator_focus_out,
@@ -880,6 +885,11 @@ class Manager(GObject.Object):
self.save_current_tool()
self.emit('tools-updated')
+ def on_tool_manager_dialog_configure_event(self, dialog, event):
+ if dialog.get_realized():
+ alloc = dialog.get_allocation()
+ self._size = (alloc.width, alloc.height)
+
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/tools.ui b/plugins/externaltools/tools/tools.ui
index 0481a56..d770d35 100644
--- a/plugins/externaltools/tools/tools.ui
+++ b/plugins/externaltools/tools/tools.ui
@@ -146,6 +146,7 @@
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
<signal name="focus-out-event" handler="on_tool_manager_dialog_focus_out" swapped="no"/>
+ <signal name="configure-event" handler="on_tool_manager_dialog_configure_event" swapped="no"/>
<signal name="response" handler="on_tool_manager_dialog_response" swapped="no"/>
<child internal-child="vbox">
<object class="GtkBox" id="tool-manager-dialog-vbox">
diff --git a/plugins/externaltools/tools/windowactivatable.py
b/plugins/externaltools/tools/windowactivatable.py
index c0a2cf5..ba62e2f 100644
--- a/plugins/externaltools/tools/windowactivatable.py
+++ b/plugins/externaltools/tools/windowactivatable.py
@@ -248,8 +248,7 @@ class WindowActivatable(GObject.Object, Gedit.WindowActivatable):
self._manager.tool_changed(tool, True)
def on_manager_destroy(self, dialog):
- alloc = dialog.get_allocation()
- self._manager_default_size = [alloc.width, alloc.height]
+ self._manager_default_size = self._manager.get_final_size()
self._manager = None
def on_manager_tools_updated(self, manager):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]