[Spice-devel] [PATCH spice-gtk 4/9] session: add unix-path property

Christophe Fergeau cfergeau at redhat.com
Mon Jan 26 09:33:09 PST 2015


On Tue, Jan 13, 2015 at 05:38:23PM +0100, Marc-André Lureau wrote:
> ---
>  gtk/spice-session.c | 35 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/gtk/spice-session.c b/gtk/spice-session.c
> index 7971f3c..83d8568 100644
> --- a/gtk/spice-session.c
> +++ b/gtk/spice-session.c
> @@ -45,6 +45,7 @@ struct channel {
>  
>  struct _SpiceSessionPrivate {
>      char              *host;
> +    char              *unix_path;
>      char              *port;
>      char              *tls_port;
>      char              *username;
> @@ -197,7 +198,8 @@ enum {
>      PROP_PROXY,
>      PROP_SECURE_CHANNELS,
>      PROP_SHARED_DIR,
> -    PROP_USERNAME
> +    PROP_USERNAME,
> +    PROP_UNIX_PATH,
>  };
>  
>  /* signals */
> @@ -318,6 +320,7 @@ spice_session_finalize(GObject *gobject)
>      SpiceSessionPrivate *s = session->priv;
>  
>      /* release stuff */
> +    g_free(s->unix_path);
>      g_free(s->host);
>      g_free(s->port);
>      g_free(s->tls_port);
> @@ -524,6 +527,9 @@ static void spice_session_get_property(GObject    *gobject,
>      case PROP_HOST:
>          g_value_set_string(value, s->host);
>  	break;
> +    case PROP_UNIX_PATH:
> +        g_value_set_string(value, s->unix_path);
> +        break;
>      case PROP_PORT:
>          g_value_set_string(value, s->port);
>  	break;
> @@ -635,6 +641,10 @@ static void spice_session_set_property(GObject      *gobject,
>          g_free(s->host);
>          s->host = g_value_dup_string(value);
>          break;
> +    case PROP_UNIX_PATH:
> +        g_free(s->unix_path);
> +        s->unix_path = g_value_dup_string(value);
> +        break;
>      case PROP_PORT:
>          g_free(s->port);
>          s->port = g_value_dup_string(value);
> @@ -779,6 +789,23 @@ static void spice_session_class_init(SpiceSessionClass *klass)
>                               G_PARAM_STATIC_STRINGS));
>  
>      /**
> +     * SpiceSession:unix-path:
> +     *
> +     * Path of the Unix socket to connect to
> +     *
> +     * Since: 0.28
> +     **/
> +    g_object_class_install_property
> +        (gobject_class, PROP_UNIX_PATH,
> +         g_param_spec_string("unix-path",
> +                             "Unix path",
> +                             "Unix path",
> +                             NULL,
> +                             G_PARAM_READWRITE |
> +                             G_PARAM_CONSTRUCT |
> +                             G_PARAM_STATIC_STRINGS));
> +
> +    /**
>       * SpiceSession:port:
>       *
>       * Port to connect to for unencrypted sessions
> @@ -1359,6 +1386,7 @@ SpiceSession *spice_session_new_from_session(SpiceSession *session)
>      g_clear_object(&c->proxy);
>  
>      g_warn_if_fail(c->host == NULL);
> +    g_warn_if_fail(c->unix_path == NULL);
>      g_warn_if_fail(c->tls_port == NULL);
>      g_warn_if_fail(c->username == NULL);
>      g_warn_if_fail(c->password == NULL);
> @@ -1371,6 +1399,7 @@ SpiceSession *spice_session_new_from_session(SpiceSession *session)
>  
>      g_object_get(session,
>                   "host", &c->host,
> +                 "unix-path", &c->unix_path,
>                   "tls-port", &c->tls_port,
>                   "username", &c->username,
>                   "password", &c->password,
> @@ -1536,6 +1565,10 @@ void spice_session_start_migrating(SpiceSession *session,
>      s->tls_port = m->tls_port;
>      m->tls_port = tmp;
>  
> +    tmp = s->unix_path;
> +    s->unix_path = m->unix_path;
> +    m->unix_path = tmp;
> +

Not directly related to that patch, but a function/macro to swap the 2
strings would be useful.

ACK.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150126/a62d68fd/attachment.sig>


More information about the Spice-devel mailing list