[meld] meldwindow: Move window size to GSettings
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] meldwindow: Move window size to GSettings
- Date: Fri, 6 Dec 2013 23:26:36 +0000 (UTC)
commit c5284bf9648a9769055b263ee91c271d565d493b
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sat Dec 7 08:08:45 2013 +1000
meldwindow: Move window size to GSettings
data/ui/meldapp.ui | 2 +-
meld/meldwindow.py | 16 ++++++++++------
2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/data/ui/meldapp.ui b/data/ui/meldapp.ui
index b3c24ec..6314f44 100644
--- a/data/ui/meldapp.ui
+++ b/data/ui/meldapp.ui
@@ -7,7 +7,7 @@
<property name="title" translatable="yes">Meld</property>
<property name="icon_name">meld</property>
<signal name="delete-event" handler="on_delete_event" swapped="no"/>
- <signal name="size-allocate" handler="on_size_allocate" swapped="no"/>
+ <signal name="configure-event" handler="on_configure_event" swapped="no"/>
<child>
<object class="GtkVBox" id="appvbox">
<property name="visible">True</property>
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index ef53bc8..0d4f9cc 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -18,8 +18,9 @@
import os
from gettext import gettext as _
-from gi.repository import Gio
from gi.repository import Gdk
+from gi.repository import Gio
+from gi.repository import GLib
from gi.repository import Gtk
from gi.repository import GObject
@@ -205,8 +206,8 @@ class MeldWindow(gnomeglade.Component):
self.idle_hooked = 0
self.scheduler = task.LifoScheduler()
self.scheduler.connect("runnable", self.on_scheduler_runnable)
- self.widget.set_default_size(app.prefs.window_size_x,
- app.prefs.window_size_y)
+ window_size = settings.get_value('window-size')
+ self.widget.set_default_size(window_size[0], window_size[1])
self.ui.ensure_update()
self.diff_handler = None
self.undo_handlers = tuple()
@@ -408,9 +409,12 @@ class MeldWindow(gnomeglade.Component):
self.actiongroup.get_action("PrevChange").set_sensitive(have_prev)
self.actiongroup.get_action("NextChange").set_sensitive(have_next)
- def on_size_allocate(self, window, rect):
- app.prefs.window_size_x = rect.width
- app.prefs.window_size_y = rect.height
+ def on_configure_event(self, window, event):
+ state = event.window.get_state()
+ nosave = Gdk.WindowState.FULLSCREEN | Gdk.WindowState.MAXIMIZED
+ if not (state & nosave):
+ variant = GLib.Variant('(ii)', (event.width, event.height))
+ settings.set_value('window-size', variant)
def on_menu_file_new_activate(self, menuitem):
self.append_new_comparison()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]