[Spice-devel] [PATCH spice-gtk 1/3] spice-session: add disable-inputs-sequence property

Pavel Grunt pgrunt at redhat.com
Fri Nov 7 06:28:52 PST 2014


String property defining key sequence for disabling inputs
---
 gtk/spice-session-priv.h |  3 +++
 gtk/spice-session.c      | 45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)

diff --git a/gtk/spice-session-priv.h b/gtk/spice-session-priv.h
index da43866..60e032e 100644
--- a/gtk/spice-session-priv.h
+++ b/gtk/spice-session-priv.h
@@ -111,6 +111,7 @@ struct _SpiceSessionPrivate {
     uint32_t          display_channels_count;
     guint8            uuid[16];
     gchar             *name;
+    gchar             *disable_inputs_sequence;
 
     /* associated objects */
     SpiceAudio        *audio_manager;
@@ -173,6 +174,8 @@ guint32 spice_session_get_playback_latency(SpiceSession *session);
 void spice_session_sync_playback_latency(SpiceSession *session);
 const gchar* spice_session_get_shared_dir(SpiceSession *session);
 void spice_session_set_shared_dir(SpiceSession *session, const gchar *dir);
+const gchar* spice_session_get_disable_inputs_sequence(SpiceSession *session);
+void spice_session_set_disable_inputs_sequence(SpiceSession *session, const gchar *sequence);
 
 G_END_DECLS
 
diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index 88bcacd..65427b4 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -112,6 +112,7 @@ enum {
     PROP_PROXY,
     PROP_SECURE_CHANNELS,
     PROP_SHARED_DIR,
+    PROP_DISABLE_INPUTS_SEQUENCE,
     PROP_USERNAME
 };
 
@@ -228,6 +229,7 @@ spice_session_finalize(GObject *gobject)
     g_strfreev(s->disable_effects);
     g_strfreev(s->secure_channels);
     g_free(s->shared_dir);
+    g_free(s->disable_inputs_sequence);
 
     g_clear_pointer(&s->images, cache_unref);
     glz_decoder_window_destroy(s->glz_window);
@@ -512,6 +514,9 @@ static void spice_session_get_property(GObject    *gobject,
     case PROP_SHARED_DIR:
         g_value_set_string(value, spice_session_get_shared_dir(session));
         break;
+    case PROP_DISABLE_INPUTS_SEQUENCE:
+        g_value_set_string(value, spice_session_get_disable_inputs_sequence(session));
+        break;
     default:
 	G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
 	break;
@@ -641,6 +646,9 @@ static void spice_session_set_property(GObject      *gobject,
     case PROP_SHARED_DIR:
         spice_session_set_shared_dir(session, g_value_get_string(value));
         break;
+    case PROP_DISABLE_INPUTS_SEQUENCE:
+        spice_session_set_disable_inputs_sequence(session, g_value_get_string(value));
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
         break;
@@ -1216,6 +1224,22 @@ static void spice_session_class_init(SpiceSessionClass *klass)
                              G_PARAM_CONSTRUCT |
                              G_PARAM_STATIC_STRINGS));
 
+    /**
+     * SpiceSession:disable-inputs-sequence:
+     *
+     * Key sequence for disabling inputs
+     *
+     * Since: 0.27
+     **/
+    g_object_class_install_property
+        (gobject_class, PROP_DISABLE_INPUTS_SEQUENCE,
+         g_param_spec_string("disable-inputs-sequence",
+                             "Disable inputs sequence",
+                             "Disable inputs sequence",
+                             NULL,
+                             G_PARAM_READWRITE |
+                             G_PARAM_STATIC_STRINGS));
+
     g_type_class_add_private(klass, sizeof(SpiceSessionPrivate));
 }
 
@@ -2253,6 +2277,27 @@ void spice_session_set_shared_dir(SpiceSession *session, const gchar *dir)
     s->shared_dir = g_strdup(dir);
 }
 
+G_GNUC_INTERNAL
+const gchar* spice_session_get_disable_inputs_sequence(SpiceSession *session)
+{
+    SpiceSessionPrivate *s = session->priv;
+
+    g_return_val_if_fail(s != NULL, NULL);
+
+    return s->disable_inputs_sequence;
+}
+
+G_GNUC_INTERNAL
+void spice_session_set_disable_inputs_sequence(SpiceSession *session, const gchar *sequence)
+{
+    SpiceSessionPrivate *s = session->priv;
+
+    g_return_if_fail(sequence != NULL);
+    g_return_if_fail(s != NULL);
+
+    g_free(s->disable_inputs_sequence);
+    s->disable_inputs_sequence = g_strdup(sequence);
+}
 /**
  * spice_session_get_proxy_uri:
  * @session: a #SpiceSession
-- 
1.9.3



More information about the Spice-devel mailing list