[gnome-software] Add apt: URL support



commit cb55c1e0b0c397b64cd03f0811428ed9c9e4406f
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Apr 26 11:13:01 2016 +0200

    Add apt: URL support

 src/gnome-software-local-file.desktop.in |    2 +-
 src/gs-application.c                     |   11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/gnome-software-local-file.desktop.in b/src/gnome-software-local-file.desktop.in
index 1be2ea3..1e3a284 100644
--- a/src/gnome-software-local-file.desktop.in
+++ b/src/gnome-software-local-file.desktop.in
@@ -8,4 +8,4 @@ Type=Application
 Icon=system-software-install
 StartupNotify=true
 NoDisplay=true
-MimeType=application/x-rpm;application/x-redhat-package-manager;application/x-deb;application/x-app-package;application/vnd.ms-cab-compressed;application/vnd.xdgapp;
+MimeType=application/x-rpm;application/x-redhat-package-manager;application/x-deb;application/x-app-package;application/vnd.ms-cab-compressed;application/vnd.xdgapp;x-scheme-handler/apt;
diff --git a/src/gs-application.c b/src/gs-application.c
index 6c7fdd9..51af5d9 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -912,6 +912,17 @@ gs_application_open (GApplication  *application,
                                                        "details",
                                                        g_variant_new ("(ss)", path, ""));
                }
+               if (g_strcmp0 (soup_uri_get_scheme (uri), "apt") == 0) {
+                       const gchar *path = soup_uri_get_path (uri);
+
+                       /* trim any leading slashes */
+                       while (*path == '/')
+                               path++;
+
+                       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]