diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-01-14 02:09:54 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2011-01-14 02:20:12 +0100 |
commit | 4bd7d2c86397397b632c15a2deef19032e415358 (patch) | |
tree | 533ae69b7e38dd0a0094e5c51f72943e5096edf1 | |
parent | b2018477615a81a7c3f08257ab79f6c1936f9e09 (diff) |
gtk: spicy: make recent name similar to a URI without spice://
-rw-r--r-- | gtk/spice-channel.c | 2 | ||||
-rw-r--r-- | gtk/spicy.c | 13 |
2 files changed, 8 insertions, 7 deletions
diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 4efdd05..8d97212 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -682,8 +682,10 @@ static int spice_channel_read(SpiceChannel *channel, void *data, size_t length) g_assert(ret <= len); len -= ret; data = ((char*)data) + ret; +#if DEBUG if (len > 0) SPICE_DEBUG("still needs %" G_GSIZE_FORMAT, len); +#endif } return length; diff --git a/gtk/spicy.c b/gtk/spicy.c index 0a17340..ecf920a 100644 --- a/gtk/spicy.c +++ b/gtk/spicy.c @@ -758,25 +758,24 @@ static void destroy_spice_window(spice_window *win) static void recent_add(SpiceSession *session) { GtkRecentManager *recent; - char name[256]; GtkRecentData meta = { - .display_name = name, .mime_type = "application/x-spice", .app_name = "spicy", .app_exec = "spicy --uri=%u", }; - char *host, *port, *uri; + char *uri; - g_object_get(session, "uri", &uri, "host", &host, "port", &port, NULL); + g_object_get(session, "uri", &uri, NULL); SPICE_DEBUG("%s: %s", __FUNCTION__, uri); - snprintf(name, sizeof(name), "%s:%s", host, port); + + g_return_if_fail(g_str_has_prefix(uri, "spice://")); recent = gtk_recent_manager_get_default(); + meta.display_name = uri + 8; if (!gtk_recent_manager_add_full(recent, uri, &meta)) g_warning("Recent item couldn't be added successfully"); - g_free(host); - g_free(port); + g_free(uri); } static void main_channel_event(SpiceChannel *channel, SpiceChannelEvent event, |