[gnome-software/wip/kalev/x-scheme-handler/appstream] Support x-scheme-handler/appstream mime type
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/kalev/x-scheme-handler/appstream] Support x-scheme-handler/appstream mime type
- Date: Fri, 23 Oct 2015 16:31:18 +0000 (UTC)
commit b6b434b63f80f19172feadcfbe7f28774e812736
Author: Kalev Lember <klember redhat com>
Date: Fri Oct 23 18:25:48 2015 +0200
Support x-scheme-handler/appstream mime type
XXX: untested
src/gs-application.c | 28 ++++++++++++++++++++++++++++
src/org.gnome.Software.desktop.in | 3 ++-
2 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index f07f32d..0dbcda8 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -29,6 +29,7 @@
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <gio/gdesktopappinfo.h>
+#include <libsoup/soup.h>
#include <packagekit-glib2/packagekit.h>
#ifdef GDK_WINDOWING_X11
@@ -690,12 +691,38 @@ gs_application_handle_local_options (GApplication *app, GVariantDict *options)
}
static void
+gs_application_open (GApplication *application,
+ GFile **files,
+ gint n_files,
+ const gchar *hint)
+{
+ GsApplication *app = GS_APPLICATION (application);
+ gint i;
+
+ for (i = 0; i < n_files; i++) {
+ g_autofree gchar *str = g_file_get_uri (files[i]);
+ g_autoptr(SoupURI) uri = NULL;
+
+ uri = soup_uri_new (str);
+ if (uri == NULL)
+ continue;
+
+ if (g_strcmp0 (soup_uri_get_scheme (uri), "appstream") == 0) {
+ g_action_group_activate_action (G_ACTION_GROUP (app),
+ "details",
+ g_variant_new ("(ss)", soup_uri_get_path (uri), ""));
+ }
+ }
+}
+
+static void
gs_application_class_init (GsApplicationClass *class)
{
G_OBJECT_CLASS (class)->dispose = gs_application_dispose;
G_APPLICATION_CLASS (class)->startup = gs_application_startup;
G_APPLICATION_CLASS (class)->activate = gs_application_activate;
G_APPLICATION_CLASS (class)->handle_local_options = gs_application_handle_local_options;
+ G_APPLICATION_CLASS (class)->open = gs_application_open;
G_APPLICATION_CLASS (class)->dbus_register = gs_application_dbus_register;
G_APPLICATION_CLASS (class)->dbus_unregister = gs_application_dbus_unregister;
}
@@ -706,6 +733,7 @@ gs_application_new (void)
g_set_prgname("org.gnome.Software");
return g_object_new (GS_APPLICATION_TYPE,
"application-id", "org.gnome.Software",
+ "flags", G_APPLICATION_HANDLES_OPEN,
"inactivity-timeout", 12000,
NULL);
}
diff --git a/src/org.gnome.Software.desktop.in b/src/org.gnome.Software.desktop.in
index 849a14c..f416fbb 100644
--- a/src/org.gnome.Software.desktop.in
+++ b/src/org.gnome.Software.desktop.in
@@ -2,12 +2,13 @@
_Name=Software
_Comment=Add, remove or update software on this computer
Icon=gnome-software
-Exec=gnome-software
+Exec=gnome-software %U
Terminal=false
Type=Application
Categories=GNOME;GTK;System;PackageManager;
_Keywords=Updates;Upgrade;Sources;Repositories;Preferences;Install;Uninstall;Program;Software;App;Store;
StartupNotify=true
+MimeType=x-scheme-handler/appstream;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=gnome-software
X-GNOME-Bugzilla-Component=gnome-software
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]