Re: [PATCH spice-gtk 9/9] spicy: deal with spice+unix:// URI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message -----
> On Tue, Jan 13, 2015 at 05:38:28PM +0100, Marc-André Lureau wrote:
> > ---
> >  gtk/spicy.c | 15 ++++++++++-----
> >  1 file changed, 10 insertions(+), 5 deletions(-)
> > 
> > diff --git a/gtk/spicy.c b/gtk/spicy.c
> > index 2fcd529..4c7d2c8 100644
> > --- a/gtk/spicy.c
> > +++ b/gtk/spicy.c
> > @@ -1193,10 +1193,14 @@ static void recent_add(SpiceSession *session)
> >      g_object_get(session, "uri", &uri, NULL);
> >      SPICE_DEBUG("%s: %s", __FUNCTION__, uri);
> >  
> > -    g_return_if_fail(g_str_has_prefix(uri, "spice://"));
> > -
> >      recent = gtk_recent_manager_get_default();
> > -    meta.display_name = uri + 8;
> > +    if (g_str_has_prefix(uri, "spice://"))
> > +        meta.display_name = uri + 8;
> > +    else if (g_str_has_prefix(uri, "spice+unix://"))
> > +        meta.display_name = uri + 13;
> > +    else
> > +        g_return_if_reached();
> > +
> >      if (!gtk_recent_manager_add_full(recent, uri, &meta))
> >          g_warning("Recent item couldn't be added successfully");
> >  
> > @@ -1788,7 +1792,7 @@ int main(int argc, char *argv[])
> >      GOptionContext *context;
> >      spice_connection *conn;
> >      gchar *conf_file, *conf;
> > -    char *host = NULL, *port = NULL, *tls_port = NULL;
> > +    char *host = NULL, *port = NULL, *tls_port = NULL, *unix_path = NULL;
> >  
> >  #if !GLIB_CHECK_VERSION(2,31,18)
> >      g_thread_init(NULL);
> > @@ -1853,13 +1857,14 @@ int main(int argc, char *argv[])
> >      spice_cmdline_session_setup(conn->session);
> >  
> >      g_object_get(conn->session,
> > +                 "unix-path", &unix_path,
> >                   "host", &host,
> >                   "port", &port,
> >                   "tls-port", &tls_port,
> >                   NULL);
> >      /* If user doesn't provide hostname and port, show the dialog window
> >         instead of connecting to server automatically */
> > -    if (host == NULL || (port == NULL && tls_port == NULL)) {
> > +    if (host == NULL && unix_path == NULL) {
> 
> Did you intentionally drop the port/tls_port test?

No, I guess I should write:

if ((host == NULL || (port == NULL && tls_port == NULL) && unix_path == NULL)

> You need to free 'unix_path' when you no longer need it.

right

> Looks good otherwise.
> 
> Christophe
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]