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

[virt-tools-list] [PATCH v2 2/7] recent: get mime type from session



Do not use spice mime type for all kind of sessions, but depending on
what is actually being used.
---
 src/remote-viewer-main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/remote-viewer-main.c b/src/remote-viewer-main.c
index 704c615..527f5be 100644
--- a/src/remote-viewer-main.c
+++ b/src/remote-viewer-main.c
@@ -158,20 +158,18 @@ static gint connect_dialog(gchar **uri)
 }
 
 static void
-recent_add(gchar *uri)
+recent_add(gchar *uri, const gchar *mime_type)
 {
     GtkRecentManager *recent;
     GtkRecentData meta = {
-        .mime_type    = (char*)"application/x-spice",
         .app_name     = (char*)"remote-viewer",
         .app_exec     = (char*)"remote-viewer %u",
+        .mime_type    = (char*)mime_type,
     };
 
     if (uri == NULL)
         return;
 
-    g_return_if_fail(g_str_has_prefix(uri, "spice://") || g_str_has_prefix(uri, "vnc://"));
-
     recent = gtk_recent_manager_get_default();
     meta.display_name = uri;
     if (!gtk_recent_manager_add_full(recent, uri, &meta))
@@ -182,8 +180,9 @@ static void connected(VirtViewerSession *session,
                       VirtViewerApp *self G_GNUC_UNUSED)
 {
     gchar *uri = virt_viewer_session_get_uri(session);
+    const gchar *mime = virt_viewer_session_mime_type(session);
 
-    recent_add(uri);
+    recent_add(uri, mime);
     g_free(uri);
 }
 
-- 
1.7.11.7


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