[gnome-software/wip/ubuntu-3-22: 9/19] Handle apt URLs of the form	apt://packagename
- From: Robert Ancell <rancell src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gnome-software/wip/ubuntu-3-22: 9/19] Handle apt URLs of the form	apt://packagename
 
- Date: Wed, 12 Jul 2017 04:47:08 +0000 (UTC)
 
commit d9f2e1effcd9dbef76fc0c878e48f0a31dbad41b
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]