[nautilus] nautilus-mime-actions.c: New PackageKit DBus API
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] nautilus-mime-actions.c: New PackageKit DBus API
- Date: Sun, 26 Apr 2020 13:39:17 +0000 (UTC)
commit 2615aeed447e29040b6b76e83ce3e5b652575f60
Author: Romeo Calota <mail romeocalota me>
Date: Thu Apr 23 21:30:15 2020 +0300
nautilus-mime-actions.c: New PackageKit DBus API
When a user opens a file of a type that no installed application can open
a dialog pops up with the option to search for a suitable application
in GNOME Software.
When the user clicks the "Search in Software" button an extra notification
pops up asking to confirm searching for the app which is unnecessary and
potentialy confusing.
The fix consists of migrating to the new org.freedesktop.PackageKit.Modify2
D-Bus API that handles this use-case without a second user prompt.
Closes #1299
src/nautilus-mime-actions.c | 34 +++++++++-------------------------
1 file changed, 9 insertions(+), 25 deletions(-)
---
diff --git a/src/nautilus-mime-actions.c b/src/nautilus-mime-actions.c
index 6be01fd05..26468c597 100644
--- a/src/nautilus-mime-actions.c
+++ b/src/nautilus-mime-actions.c
@@ -23,9 +23,6 @@
#include <eel/eel-stock-dialogs.h>
#include <eel/eel-string.h>
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkx.h>
-#endif
#include <glib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
@@ -1201,33 +1198,20 @@ static void
search_for_application_mime_type (ActivateParametersInstall *parameters_install,
const gchar *mime_type)
{
- GdkWindow *window;
- guint xid = 0;
- const char *mime_types[2];
+ gchar *desktop_startup_id;
g_assert (parameters_install->proxy != NULL);
-#ifdef GDK_WINDOWING_X11
- if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
- {
- /* get XID from parent window */
- window = gtk_widget_get_window (GTK_WIDGET (parameters_install->parent_window));
- if (window != NULL)
- {
- xid = GDK_WINDOW_XID (window);
- }
- }
-#endif
-
- mime_types[0] = mime_type;
- mime_types[1] = NULL;
+ desktop_startup_id = g_strdup_printf ("_TIME%i", gtk_get_current_event_time ());
g_dbus_proxy_call (parameters_install->proxy,
"InstallMimeTypes",
- g_variant_new ("(u^ass)",
- xid,
- mime_types,
- "hide-confirm-search"),
+ g_variant_new_parsed ("([%s], %s, %s, [{%s, %v}])",
+ mime_type,
+ "hide-confirm-search",
+ APPLICATION_ID,
+ "desktop-startup-id",
+ g_variant_new_take_string (desktop_startup_id)),
G_DBUS_CALL_FLAGS_NONE,
G_MAXINT /* no timeout */,
NULL /* cancellable */,
@@ -1373,7 +1357,7 @@ application_unhandled_uri (ActivateParameters *parameters,
NULL,
"org.freedesktop.PackageKit",
"/org/freedesktop/PackageKit",
- "org.freedesktop.PackageKit.Modify",
+ "org.freedesktop.PackageKit.Modify2",
NULL,
pk_proxy_appeared_cb,
parameters_install);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]