[virt-tools-list] [PATCH virt-viewer v2 1/3] VirtViewerApp: create main window after constructor
Jonathon Jongsma
jjongsma at redhat.com
Thu Mar 19 16:16:10 UTC 2015
When using the configuration file to specify which remote monitors
should be enabled when using the --full-screen option, it sometimes left
additional displays enabled, or didn't place the displays on the right
monitor, or didn't fullscreen them.
Part of the problem was that we were creating the first display window before
loading the monitor mapping configuration from the settings file. So even if
the first display was disabled in the configuration, the first window will
still be created with an id of 0, and therefore didn't get set to fullscreen.
Moving the main window creation to the 'constructor' vfunc instead of the
object init func ensures that the configuration is all loaded before we attempt
to do any fullscreen autoconf.
Related: rhbz#1200750
---
src/virt-viewer-app.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 8bf728f..4f05b51 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1723,9 +1723,6 @@ virt_viewer_app_init (VirtViewerApp *self)
self->priv->config = g_key_file_new();
self->priv->config_file = g_build_filename(g_get_user_config_dir(),
"virt-viewer", "settings", NULL);
- self->priv->main_window = virt_viewer_app_window_new(self, 0);
- self->priv->main_notebook = GTK_WIDGET(virt_viewer_window_get_notebook(self->priv->main_window));
-
g_key_file_load_from_file(self->priv->config, self->priv->config_file,
G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS, &error);
@@ -1747,8 +1744,6 @@ virt_viewer_app_init (VirtViewerApp *self)
g_signal_connect(self, "notify::guest-name", G_CALLBACK(title_maybe_changed), NULL);
g_signal_connect(self, "notify::title", G_CALLBACK(title_maybe_changed), NULL);
g_signal_connect(self, "notify::guri", G_CALLBACK(title_maybe_changed), NULL);
-
- virt_viewer_window_set_zoom_level(self->priv->main_window, opt_zoom);
}
static void
@@ -1814,6 +1809,14 @@ virt_viewer_app_constructor (GType gtype,
obj = G_OBJECT_CLASS (virt_viewer_app_parent_class)->constructor (gtype, n_properties, properties);
self = VIRT_VIEWER_APP(obj);
+ self->priv->main_window = virt_viewer_app_window_new(self, 0);
+ self->priv->main_notebook = GTK_WIDGET(virt_viewer_window_get_notebook(self->priv->main_window));
+
+ virt_viewer_app_set_fullscreen(self, opt_fullscreen);
+ virt_viewer_app_set_hotkeys(self, opt_hotkeys);
+ virt_viewer_app_set_kiosk(self, opt_kiosk);
+ virt_viewer_window_set_zoom_level(self->priv->main_window, opt_zoom);
+
virt_viewer_set_insert_smartcard_accel(self, GDK_F8, GDK_SHIFT_MASK);
virt_viewer_set_remove_smartcard_accel(self, GDK_F9, GDK_SHIFT_MASK);
gtk_accel_map_add_entry("<virt-viewer>/view/toggle-fullscreen", GDK_F11, 0);
@@ -1823,10 +1826,6 @@ virt_viewer_app_constructor (GType gtype,
gtk_accel_map_add_entry("<virt-viewer>/view/zoom-in", GDK_plus, GDK_CONTROL_MASK);
gtk_accel_map_add_entry("<virt-viewer>/send/secure-attention", GDK_End, GDK_CONTROL_MASK | GDK_MOD1_MASK);
- virt_viewer_app_set_fullscreen(self, opt_fullscreen);
- virt_viewer_app_set_hotkeys(self, opt_hotkeys);
- virt_viewer_app_set_kiosk(self, opt_kiosk);
-
return obj;
}
--
2.1.0
More information about the virt-tools-list
mailing list