Export DisplayName property on the packagekit session service

This commit is contained in:
Kalev Lember 2015-02-21 23:23:33 +01:00
parent d00ff84ad8
commit 38f3292e02
2 changed files with 72 additions and 1 deletions

View File

@ -0,0 +1,65 @@
From a9fd0d669b784426302f4b213f58a6b12c921f34 Mon Sep 17 00:00:00 2001
From: Kalev Lember <kalevlember@gmail.com>
Date: Tue, 17 Feb 2015 13:56:32 +0100
Subject: [PATCH] PK session service: Export our own name as a property
Export our own localized name as a DisplayName property so that other
apps could use it when displaying user facing strings.
---
src/gs-dbus-helper.c | 11 +++++++++++
src/org.freedesktop.PackageKit.Modify2.xml | 11 +++++++++++
2 files changed, 22 insertions(+)
diff --git a/src/gs-dbus-helper.c b/src/gs-dbus-helper.c
index a960981..9071367 100644
--- a/src/gs-dbus-helper.c
+++ b/src/gs-dbus-helper.c
@@ -685,6 +685,7 @@ bus_gotten_cb (GObject *source_object,
{
GsDbusHelper *dbus_helper = GS_DBUS_HELPER (user_data);
_cleanup_object_unref_ GDBusConnection *connection = NULL;
+ _cleanup_object_unref_ GDesktopAppInfo *app_info = NULL;
_cleanup_error_free_ GError *error = NULL;
connection = g_bus_get_finish (res, &error);
@@ -758,6 +759,16 @@ bus_gotten_cb (GObject *source_object,
g_signal_connect (dbus_helper->modify2_interface, "handle-install-printer-drivers",
G_CALLBACK (handle_modify2_install_printer_drivers), dbus_helper);
+ /* Look up our own localized name and export it as a property on the bus */
+ app_info = g_desktop_app_info_new ("org.gnome.Software.desktop");
+ if (app_info != NULL) {
+ const gchar *app_name = g_app_info_get_name (G_APP_INFO (app_info));
+ if (app_name != NULL)
+ g_object_set (G_OBJECT (dbus_helper->modify2_interface),
+ "display-name", app_name,
+ NULL);
+ }
+
if (!g_dbus_interface_skeleton_export (dbus_helper->modify2_interface,
connection,
"/org/freedesktop/PackageKit",
diff --git a/src/org.freedesktop.PackageKit.Modify2.xml b/src/org.freedesktop.PackageKit.Modify2.xml
index f320750..5d9f8a8 100644
--- a/src/org.freedesktop.PackageKit.Modify2.xml
+++ b/src/org.freedesktop.PackageKit.Modify2.xml
@@ -527,5 +527,16 @@
</doc:doc>
</arg>
</method>
+
+ <property name="DisplayName" type="s" access="read">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Translated, human readable name of the program implementing the interface, e.g. 'Software' for gnome-software.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ </property>
+
</interface>
</node>
--
2.3.0

View File

@ -7,7 +7,7 @@
Summary: A software center for GNOME
Name: gnome-software
Version: 3.15.90
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://wiki.gnome.org/Apps/Software
@ -15,7 +15,9 @@ Source0: http://download.gnome.org/sources/gnome-software/3.15/%{name}-%{versi
# Downstream patch to the list of unremovable system apps
Patch0: gnome-software-system-apps.patch
# Backported upstream patches
Patch1: 0001-extras-Fix-a-crash-when-reloading-the-page.patch
Patch2: 0001-PK-session-service-Export-our-own-name-as-a-property.patch
Requires: appstream-data
%if 0%{?fedora}
@ -53,6 +55,7 @@ and update software in the GNOME desktop.
%setup -q
%patch0 -p1 -b .system-apps
%patch1 -p1
%patch2 -p1
%build
%configure --disable-static
@ -111,6 +114,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/gnome-software/modulesets.d/*.xml
%changelog
* Sat Feb 21 2015 Kalev Lember <kalevlember@gmail.com> - 3.15.90-3
- Export DisplayName property on the packagekit session service
* Thu Feb 19 2015 Kalev Lember <kalevlember@gmail.com> - 3.15.90-2
- Backport a crash fix