[gnome-photos] base-item, export-notification: Use GAppLaunchContexts to launch apps



commit 94f0521503c3ef8d3505bc1b138230146cf12820
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jan 18 13:37:50 2018 +0100

    base-item, export-notification: Use GAppLaunchContexts to launch apps
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759413

 src/photos-base-item.c           | 14 ++++++++++----
 src/photos-export-notification.c |  6 +++++-
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 7c6197c1..cf2acbc6 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -605,11 +605,17 @@ photos_base_item_default_open (PhotosBaseItem *self, GtkWindow *parent, guint32
 
   if (priv->default_app != NULL)
     {
-      g_autoptr (GError) error = NULL;
+      g_autoptr (GAppLaunchContext) ctx = NULL;
 
-      photos_glib_app_info_launch_uri (priv->default_app, priv->uri, NULL, &error);
-      if (error != NULL)
-        g_warning ("Unable to show URI %s: %s", priv->uri, error->message);
+      ctx = photos_utils_new_app_launch_context_from_widget (GTK_WIDGET (parent));
+
+      {
+        g_autoptr (GError) error = NULL;
+
+        photos_glib_app_info_launch_uri (priv->default_app, priv->uri, ctx, &error);
+        if (error != NULL)
+          g_warning ("Unable to show URI %s: %s", priv->uri, error->message);
+      }
     }
   else
     {
diff --git a/src/photos-export-notification.c b/src/photos-export-notification.c
index 759ac614..ff57b55c 100644
--- a/src/photos-export-notification.c
+++ b/src/photos-export-notification.c
@@ -30,6 +30,7 @@
 #include "photos-export-notification.h"
 #include "photos-icons.h"
 #include "photos-notification-manager.h"
+#include "photos-utils.h"
 
 
 struct _PhotosExportNotification
@@ -82,18 +83,21 @@ photos_export_notification_destroy (PhotosExportNotification *self)
 static void
 photos_export_notification_analyze (PhotosExportNotification *self)
 {
+  GAppLaunchContext *ctx = NULL;
   GDesktopAppInfo *analyzer;
   GError *error = NULL;
 
   analyzer = g_desktop_app_info_new ("org.gnome.baobab.desktop");
+  ctx = photos_utils_new_app_launch_context_from_widget (GTK_WIDGET (self));
 
-  if (!g_app_info_launch (G_APP_INFO (analyzer), NULL, NULL, &error))
+  if (!g_app_info_launch (G_APP_INFO (analyzer), NULL, ctx, &error))
     {
       g_warning ("Unable to launch disk usage analyzer: %s", error->message);
       g_error_free (error);
     }
 
   photos_export_notification_destroy (self);
+  g_clear_object (&ctx);
   g_object_unref (analyzer);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]