mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/virt-viewer
synced 2025-12-29 08:42:19 +00:00
Fix rebuild of accelerators menu when loading from file
It's not enough to set the property to notify of its change. Add a virt_viewer_app_set_enable_accel() helper, and call it after the changes to accelerators are made when loading from file. I verified the menu is correctly built when connection from controller or command line too.
This commit is contained in:
parent
a6d5acdf6a
commit
529cd490b8
@ -1476,7 +1476,7 @@ virt_viewer_app_set_property (GObject *object, guint property_id,
|
||||
break;
|
||||
|
||||
case PROP_ENABLE_ACCEL:
|
||||
priv->enable_accel = g_value_get_boolean(value);
|
||||
virt_viewer_app_set_enable_accel(self, g_value_get_boolean(value));
|
||||
break;
|
||||
|
||||
case PROP_KIOSK:
|
||||
@ -1839,6 +1839,13 @@ virt_viewer_app_clear_hotkeys(VirtViewerApp *self)
|
||||
virt_viewer_set_remove_smartcard_accel(self, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
virt_viewer_app_set_enable_accel(VirtViewerApp *self, gboolean enable)
|
||||
{
|
||||
self->priv->enable_accel = enable;
|
||||
g_object_notify(G_OBJECT(self), "enable-accel");
|
||||
}
|
||||
|
||||
void
|
||||
virt_viewer_app_set_hotkeys(VirtViewerApp *self, const gchar *hotkeys_str)
|
||||
{
|
||||
@ -1851,12 +1858,12 @@ virt_viewer_app_set_hotkeys(VirtViewerApp *self, const gchar *hotkeys_str)
|
||||
|
||||
if (!hotkeys || g_strv_length(hotkeys) == 0) {
|
||||
g_strfreev(hotkeys);
|
||||
g_object_set(self, "enable-accel", FALSE, NULL);
|
||||
virt_viewer_app_set_enable_accel(self, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
virt_viewer_app_clear_hotkeys(self);
|
||||
g_object_set(self, "enable-accel", TRUE, NULL);
|
||||
virt_viewer_app_set_enable_accel(self, TRUE);
|
||||
|
||||
for (hotkey = hotkeys; *hotkey != NULL; hotkey++) {
|
||||
gchar *key = strstr(*hotkey, "=");
|
||||
|
||||
@ -102,6 +102,7 @@ void virt_viewer_app_clear_hotkeys(VirtViewerApp *app);
|
||||
gint virt_viewer_app_get_n_initial_displays(VirtViewerApp* self);
|
||||
gint virt_viewer_app_get_initial_monitor_for_display(VirtViewerApp* self, gint display);
|
||||
void virt_viewer_app_set_uuid_string(VirtViewerApp* self, const gchar* uuid_string);
|
||||
void virt_viewer_app_set_enable_accel(VirtViewerApp *app, gboolean enable);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@ -636,7 +636,6 @@ virt_viewer_file_fill_app(VirtViewerFile* self, VirtViewerApp *app, GError **err
|
||||
|
||||
|
||||
virt_viewer_app_clear_hotkeys(app);
|
||||
g_object_set(G_OBJECT(app), "enable-accel", TRUE, NULL);
|
||||
|
||||
{
|
||||
gchar *val;
|
||||
@ -661,6 +660,8 @@ virt_viewer_file_fill_app(VirtViewerFile* self, VirtViewerApp *app, GError **err
|
||||
}
|
||||
}
|
||||
|
||||
virt_viewer_app_set_enable_accel(app, TRUE);
|
||||
|
||||
if (virt_viewer_file_is_set(self, "fullscreen"))
|
||||
g_object_set(G_OBJECT(app), "fullscreen",
|
||||
virt_viewer_file_get_fullscreen(self), NULL);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user