[gnome-music] window: store window size and position outside main thread
- From: Vadim Rutkovsky <vrutkovsky src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music] window: store window size and position outside main thread
- Date: Thu, 5 Mar 2015 11:20:01 +0000 (UTC)
commit c7daecd1879c0a10da969f38c73f876f4de9722d
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date: Thu Mar 5 12:18:23 2015 +0100
window: store window size and position outside main thread
Also make sure we store view's init state properly to avoid
additional populate() calls
https://bugzilla.gnome.org/show_bug.cgi?id=745651
gnomemusic/view.py | 2 ++
gnomemusic/window.py | 8 ++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/view.py b/gnomemusic/view.py
index 4164d65..5750975 100644
--- a/gnomemusic/view.py
+++ b/gnomemusic/view.py
@@ -288,6 +288,7 @@ class Albums(ViewContainer):
def _on_changes_pending(self, data=None):
if (self._init and self.header_bar._selectionMode is False):
self._offset = 0
+ self._init = True
self.model.clear()
self.populate()
grilo.changes_pending['Albums'] = False
@@ -1486,6 +1487,7 @@ class Search(ViewContainer):
@log
def populate(self):
+ self._init = True
self.window._init_loading_notification()
self.header_bar.set_state(ToolbarState.MAIN)
diff --git a/gnomemusic/window.py b/gnomemusic/window.py
index d1596d8..f2bc7e2 100644
--- a/gnomemusic/window.py
+++ b/gnomemusic/window.py
@@ -89,7 +89,7 @@ class Window(Gtk.ApplicationWindow):
self._setup_view()
self.connect("window-state-event", self._on_window_state_event)
- self.connect("configure-event", self._on_configure_event)
+ self.configure_event_handler = self.connect("configure-event", self._on_configure_event)
self.proxy = Gio.DBusProxy.new_sync(Gio.bus_get_sync(Gio.BusType.SESSION, None),
Gio.DBusProxyFlags.NONE,
@@ -131,8 +131,12 @@ class Window(Gtk.ApplicationWindow):
self.toolbar._select_button.set_sensitive(True)
self.toolbar.show_stack()
- @log
def _on_configure_event(self, widget, event):
+ with self.handler_block(self.configure_event_handler):
+ GLib.idle_add(self.store_window_size_and_position, widget, priority=GLib.PRIORITY_LOW)
+
+ @log
+ def store_window_size_and_position(self, widget):
size = widget.get_size()
self.settings.set_value('window-size', GLib.Variant('ai', [size[0], size[1]]))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]