[gnome-software/wip/ubuntu-3-22: 8/27] Handle apt URLs of the form apt://packagename



commit cd756159c04c167006296619ed43be6d448e89f1
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Feb 2 14:22:52 2017 +1300

    Handle apt URLs of the form apt://packagename

 src/gs-application.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 8d170b8..e66042d 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -965,12 +965,18 @@ gs_application_open (GApplication  *application,
                                                        g_variant_new ("(ss)", path, ""));
                }
                if (g_strcmp0 (soup_uri_get_scheme (uri), "apt") == 0) {
+                       const gchar *host = soup_uri_get_host (uri);
                        const gchar *path = soup_uri_get_path (uri);
 
                        /* trim any leading slashes */
                        while (*path == '/')
                                path++;
 
+                       /* apt://foo -> scheme: apt, host: foo, path: / */
+                       /* apt:foo -> scheme: apt, host: (empty string), path: /foo */
+                       if (host != NULL && (strlen (host) > 0))
+                               path = host;
+
                        g_action_group_activate_action (G_ACTION_GROUP (app),
                                                        "details-pkg",
                                                        g_variant_new_string (path));


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