[gnome-flashback] notifications: use gtk_show_uri_on_window to show links



commit be4a359bf8869be98317e8197b00b8b07769d422
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Sep 8 10:03:39 2020 +0300

    notifications: use gtk_show_uri_on_window to show links
    
    https://bugs.debian.org/969778

 gnome-flashback/libnotifications/gf-bubble.c | 30 ++++++++--------------------
 1 file changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/gnome-flashback/libnotifications/gf-bubble.c b/gnome-flashback/libnotifications/gf-bubble.c
index 289fc2ab..eabb4fe5 100644
--- a/gnome-flashback/libnotifications/gf-bubble.c
+++ b/gnome-flashback/libnotifications/gf-bubble.c
@@ -71,34 +71,20 @@ activate_link_cb (GtkLabel *label,
                   GfBubble *bubble)
 {
   GfBubblePrivate *priv;
-  gchar *escaped_uri;
-  gchar *found;
-  gchar *cmd;
+  GError *error;
 
   priv = gf_bubble_get_instance_private (bubble);
 
   priv->url_clicked_lock = TRUE;
 
-  escaped_uri = g_shell_quote (uri);
-  found = NULL;
-  cmd = NULL;
-
-  if ((found = g_find_program_in_path ("gvfs-open")) != NULL)
-    cmd = g_strdup_printf ("gvfs-open %s", escaped_uri);
-  else if ((found = g_find_program_in_path ("xdg-open")) != NULL)
-    cmd = g_strdup_printf ("xdg-open %s", escaped_uri);
-  else if ((found = g_find_program_in_path ("firefox")) != NULL)
-    cmd = g_strdup_printf ("firefox %s", escaped_uri);
-  else
-    g_warning ("Unable to find a browser.");
-
-  g_free (escaped_uri);
-  g_free (found);
-
-  if (cmd != NULL)
+  error = NULL;
+  if (!gtk_show_uri_on_window (GTK_WINDOW (bubble),
+                               uri,
+                               gtk_get_current_event_time (),
+                               &error))
     {
-      g_spawn_command_line_async (cmd, NULL);
-      g_free (cmd);
+      g_warning ("Could not show link: %s", error->message);
+      g_error_free (error);
     }
 
   return TRUE;


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