[virt-tools-list] [PATCH] Reading cursor-release hotkey set-up from settings file
Snir Sheriber
ssheribe at redhat.com
Mon Oct 26 16:58:22 UTC 2015
While opening nested remote-viewers, cursor-release doesn't effect the
inner remote-viewer (hotkey for both is identical)
Checking for cursor release setup in the settings file,
overriding existing command line and vv file setups
RHBZ #889962
---
src/virt-viewer-app.c | 27 +++++++++++++++++++++++++++
src/virt-viewer-app.h | 1 +
2 files changed, 28 insertions(+)
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 0670358..9bb32ee 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1294,6 +1294,7 @@ virt_viewer_app_activate(VirtViewerApp *self, GError **error)
priv->grabbed = FALSE;
virt_viewer_app_update_title(self);
+ virt_viewer_app_remote_cursor_set_from_file(self);
return ret;
}
@@ -2575,6 +2576,32 @@ gboolean virt_viewer_app_get_session_cancelled(VirtViewerApp *self)
{
return self->priv->cancelled;
}
+void
+virt_viewer_app_remote_cursor_set_from_file(VirtViewerApp *self)
+{
+ /*
+ * This function read cursor-release hotkey
+ * from the "settings" file and overrides any
+ * previous cursor-release hotkey setup
+ */
+ GError *error = NULL;
+ gchar *strconcat=NULL;
+ gchar *hotkeys_str=g_key_file_get_string(self->priv->config,
+ "virt-viewer", "release-cursor", &error);
+ if (error) {
+ if (error->code != G_KEY_FILE_ERROR_GROUP_NOT_FOUND
+ && error->code != G_KEY_FILE_ERROR_KEY_NOT_FOUND)
+ g_warning("Error reading release-cursor value: %s", error->message);
+ g_clear_error(&error);
+ } else {
+ strconcat=g_strconcat("release-cursor=",hotkeys_str,NULL);
+ virt_viewer_app_set_hotkeys(self, strconcat);
+ g_free(strconcat);
+ }
+ g_free(hotkeys_str);
+
+
+}
/*
* Local variables:
diff --git a/src/virt-viewer-app.h b/src/virt-viewer-app.h
index bbbc9b4..8bc46e8 100644
--- a/src/virt-viewer-app.h
+++ b/src/virt-viewer-app.h
@@ -103,6 +103,7 @@ void virt_viewer_app_set_enable_accel(VirtViewerApp *app, gboolean enable);
void virt_viewer_app_show_preferences(VirtViewerApp *app, GtkWidget *parent);
void virt_viewer_app_set_menus_sensitive(VirtViewerApp *self, gboolean sensitive);
gboolean virt_viewer_app_get_session_cancelled(VirtViewerApp *self);
+void virt_viewer_app_remote_cursor_set_from_file(VirtViewerApp *self);
G_END_DECLS
--
2.4.3
More information about the virt-tools-list
mailing list