Adapt to changed Gtk.Window.set_geometry_hints() API

Unlike PyGTK [1], GTK3+pygi [2] wants GDK Geometry and WindowHints objects,
rather than individual values.

[1] http://developer.gnome.org/pygtk/stable/class-gtkwindow.html#method-gtkwindow--set-geometry-hints
[2] http://developer.gnome.org/gtk3/3.0/GtkWindow.html#gtk-window-set-geometry-hints

Signed-off-by: Simon Schampijer <simon@schampijer.de>
[replaced description, included fix-up commit]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
This commit is contained in:
Simon Schampijer 2011-10-29 12:20:30 +02:00
parent 10d7f7d3f9
commit 8efb7c3f93

View File

@ -57,6 +57,7 @@ from functools import partial
from gi.repository import GConf from gi.repository import GConf
from gi.repository import Gtk from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GObject from gi.repository import GObject
import dbus import dbus
import dbus.service import dbus.service
@ -484,11 +485,18 @@ class Activity(Window, Gtk.Container):
def _adapt_window_to_screen(self): def _adapt_window_to_screen(self):
screen = Gdk.Screen.get_default() screen = Gdk.Screen.get_default()
self.set_geometry_hints(None, geometry = Gdk.Geometry()
screen.get_width(), screen.get_height(), geometry.max_width = geometry.base_width = geometry.min_width = \
screen.get_width(), screen.get_height(), screen.get_width()
screen.get_width(), screen.get_height(), geometry.max_height = geometry.base_height = geometry.min_height = \
1, 1, 1, 1) screen.get_height()
geometry.width_inc = geometry.height_inc = geometry.min_aspect = \
geometry.max_aspect = 1
hints = Gdk.WindowHints(Gdk.WindowHints.ASPECT |
Gdk.WindowHints.BASE_SIZE |
Gdk.WindowHints.MAX_SIZE |
Gdk.WindowHints.MIN_SIZE)
self.set_geometry_hints(None, geometry, hints)
def __session_quit_requested_cb(self, session): def __session_quit_requested_cb(self, session):
self._quit_requested = True self._quit_requested = True