[Spice-devel] [PATCH spice-gtk 9/9] spicy: deal with spice+unix:// URI
Marc-André Lureau
marcandre.lureau at redhat.com
Tue Jan 13 08:38:28 PST 2015
---
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) {
int ret = connect_dialog(conn->session);
if (ret != 0) {
exit(0);
--
2.1.0
More information about the Spice-devel
mailing list