[pitivi: 7/8] exportsettingswidget.py: remember window size



commit b90935ac0b8bd23e2700d14051a6094954554fc8
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Sat Aug 1 15:14:27 2009 -0700

    exportsettingswidget.py: remember window size
    closes bug 579237
    
    This commit is a little complicated because the glade dialogs seemed to be
    ignoring set_default_size. We connect to map event and use that to install
    an idle handler which actually sets the dialog size. This seems to be the only
    reliable way to set the size of this dialog.
    
    The idle handler also connects to the configure event -- we don't want to do this
    any earlier or the saved dialog size will be overwritten before the dialog is
    shown.

 pitivi/ui/exportsettingswidget.py |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/ui/exportsettingswidget.py b/pitivi/ui/exportsettingswidget.py
index 6520686..1a73bcd 100644
--- a/pitivi/ui/exportsettingswidget.py
+++ b/pitivi/ui/exportsettingswidget.py
@@ -29,7 +29,7 @@ from pitivi.log.loggable import Loggable
 from pitivi.encode import encoders_muxer_compatible, muxer_can_sink_raw_audio, muxer_can_sink_raw_video
 from glade import GladeWidget
 from gstwidget import GstElementSettingsDialog
-
+import gobject
 from gettext import gettext as _
 
 class ExportSettingsWidget(GladeWidget, Loggable):
@@ -315,7 +315,22 @@ class ExportSettingsWidget(GladeWidget, Loggable):
         self.acodeccbox.set_active(selected)
 
     def runSettingsDialog(self, factory, settings={}):
+        def configureEventCb(window, event):
+            self.app.settings.elementSettingsDialogWidth = event.width
+            self.app.settings.elementSettingsDialogHeight = event.height
+
+        def mapEventCb(window, event):
+            def reallySetWindowSize():
+                dialog.window.resize(self.app.settings.elementSettingsDialogWidth,
+                    self.app.settings.elementSettingsDialogHeight)
+                dialog.window.disconnect(mapEventId)
+                window.connect("configure-event", configureEventCb)
+                return False
+            gobject.idle_add(reallySetWindowSize)
+
         dialog = GstElementSettingsDialog(factory, settings)
+        mapEventId = dialog.window.connect("map-event", mapEventCb)
+
         if dialog.run() == gtk.RESPONSE_OK:
             dialog.hide()
             settings = dialog.getSettings()



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