|
35 | 35 | show_dialog_with_icon, |
36 | 36 | load_theme, |
37 | 37 | is_theme_light, |
| 38 | + resize_window_to_reasonable, |
38 | 39 | ) |
39 | 40 | from ..widgets.gtk_widgets import ProgressBarDialog, ViewportHandler |
40 | 41 | from ..widgets.utils import open_url_in_disposable |
|
58 | 59 | import gi |
59 | 60 |
|
60 | 61 | gi.require_version("Gtk", "3.0") |
61 | | -from gi.repository import Gtk, GLib, GObject, Gio, Gdk |
| 62 | +from gi.repository import Gtk, GLib, GObject, Gio |
62 | 63 |
|
63 | 64 | logger = logging.getLogger("qubes-global-config") |
64 | 65 |
|
@@ -299,27 +300,7 @@ def do_activate(self, *args, **kwargs): |
299 | 300 | self.perform_setup() |
300 | 301 | assert self.main_window |
301 | 302 | self.main_window.show() |
302 | | - # resize to screen size |
303 | | - if ( |
304 | | - self.main_window.get_allocated_width() |
305 | | - > self.main_window.get_screen().get_width() |
306 | | - ): |
307 | | - width = int(self.main_window.get_screen().get_width() * 0.9) |
308 | | - else: |
309 | | - # try to have at least 1100 pixels |
310 | | - width = min(int(self.main_window.get_screen().get_width() * 0.9), 1100) |
311 | | - if ( |
312 | | - self.main_window.get_allocated_height() |
313 | | - > self.main_window.get_screen().get_height() * 0.9 |
314 | | - ): |
315 | | - height = int(self.main_window.get_screen().get_height() * 0.9) |
316 | | - else: |
317 | | - height = self.main_window.get_allocated_height() |
318 | | - self.main_window.resize(width, height) |
319 | | - self.main_window.set_position(Gtk.WindowPosition.CENTER_ALWAYS) |
320 | | - self.main_window.set_gravity(Gdk.Gravity.CENTER) |
321 | | - self.main_window.move(0, 0) |
322 | | - self.main_window.set_position(Gtk.WindowPosition.CENTER) |
| 303 | + resize_window_to_reasonable(self.main_window) |
323 | 304 |
|
324 | 305 | # open at specified location |
325 | 306 | if self.open_at: |
|
0 commit comments