[gtk/show-uri-async] gtk: Port all users to the new gtk_show_uri()



commit 432b741ab7d23fb7a95550e11d40cb3e045d09ff
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Apr 11 21:58:19 2020 -0400

    gtk: Port all users to the new gtk_show_uri()
    
    We were only handling the error in one place anyway.

 gtk/gtkaboutdialog.c           | 29 +++--------------------------
 gtk/gtkfilechooserwidget.c     |  2 +-
 gtk/gtklabel.c                 |  9 ++-------
 gtk/gtklinkbutton.c            | 18 +++---------------
 gtk/gtkprintoperation-portal.c |  2 +-
 gtk/gtkprintoperation-unix.c   |  2 +-
 6 files changed, 11 insertions(+), 51 deletions(-)
---
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c
index 577eb6e633..1c33631696 100644
--- a/gtk/gtkaboutdialog.c
+++ b/gtk/gtkaboutdialog.c
@@ -77,7 +77,7 @@
  * All parts of the dialog are optional.
  *
  * About dialogs often contain links and email addresses. GtkAboutDialog
- * displays these as clickable links. By default, it calls gtk_show_uri_on_window()
+ * displays these as clickable links. By default, it calls gtk_show_uri()
  * when a user clicks one. The behaviour can be overridden with the
  * #GtkAboutDialog::activate-link signal.
  *
@@ -345,7 +345,7 @@ gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
    *
    * The signal which gets emitted to activate a URI.
    * Applications may connect to it to override the default behaviour,
-   * which is to call gtk_show_uri_on_window().
+   * which is to call gtk_show_uri().
    *
    * Returns: %TRUE if the link has been activated
    */
@@ -979,30 +979,7 @@ static gboolean
 gtk_about_dialog_activate_link (GtkAboutDialog *about,
                                 const gchar    *uri)
 {
-  GError *error = NULL;
-
-  if (!gtk_show_uri_on_window (GTK_WINDOW (about), uri, GDK_CURRENT_TIME, &error))
-    {
-      GtkWidget *dialog;
-
-      dialog = gtk_message_dialog_new (GTK_WINDOW (about),
-                                       GTK_DIALOG_DESTROY_WITH_PARENT |
-                                       GTK_DIALOG_MODAL,
-                                       GTK_MESSAGE_ERROR,
-                                       GTK_BUTTONS_CLOSE,
-                                       "%s", _("Could not show link"));
-      gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                                "%s", error->message);
-      g_error_free (error);
-
-      g_signal_connect (dialog, "response",
-                        G_CALLBACK (gtk_widget_destroy), NULL);
-
-      G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-      gtk_window_present (GTK_WINDOW (dialog));
-      G_GNUC_END_IGNORE_DEPRECATIONS
-    }
-
+  gtk_show_uri (GTK_WINDOW (about), uri, GDK_CURRENT_TIME);
   return TRUE;
 }
 
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index c7f6b34c31..05e9cbe75e 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -1502,7 +1502,7 @@ open_folder_cb (GSimpleAction *action,
       gchar *uri;
 
       uri = g_file_get_uri (file);
-      gtk_show_uri_on_window (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME, NULL);
+      gtk_show_uri (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME);
       g_free (uri);
     }
 
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 6f6efaec64..992bc9cc69 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -740,7 +740,7 @@ gtk_label_class_init (GtkLabelClass *class)
      *
      * The signal which gets emitted to activate a URI.
      * Applications may connect to it to override the default behaviour,
-     * which is to call gtk_show_uri_on_window().
+     * which is to call gtk_show_uri().
      *
      * Returns: %TRUE if the link has been activated
      */
@@ -5816,16 +5816,11 @@ gtk_label_activate_link (GtkLabel    *label,
 {
   GtkWidget *widget = GTK_WIDGET (label);
   GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
-  GError *error = NULL;
 
   if (!GTK_IS_WINDOW (toplevel))
     return FALSE;
 
-  if (!gtk_show_uri_on_window (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME, &error))
-    {
-      g_warning ("Unable to show '%s': %s", uri, error->message);
-      g_error_free (error);
-    }
+  gtk_show_uri (GTK_WINDOW (toplevel), uri, GDK_CURRENT_TIME);
 
   return TRUE;
 }
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c
index b99ae2a0d4..ee82086798 100644
--- a/gtk/gtklinkbutton.c
+++ b/gtk/gtklinkbutton.c
@@ -38,7 +38,7 @@
  * The URI bound to a GtkLinkButton can be set specifically using
  * gtk_link_button_set_uri(), and retrieved using gtk_link_button_get_uri().
  *
- * By default, GtkLinkButton calls gtk_show_uri_on_window() when the button is
+ * By default, GtkLinkButton calls gtk_show_uri() when the button is
  * clicked. This behaviour can be overridden by connecting to the
  * #GtkLinkButton::activate-link signal and returning %TRUE from the
  * signal handler.
@@ -209,7 +209,7 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass)
    * The ::activate-link signal is emitted each time the #GtkLinkButton
    * has been clicked.
    *
-   * The default handler will call gtk_show_uri_on_window() with the URI stored inside
+   * The default handler will call gtk_show_uri() with the URI stored inside
    * the #GtkLinkButton:uri property.
    *
    * To override the default behavior, you can connect to the ::activate-link
@@ -495,22 +495,10 @@ gtk_link_button_activate_link (GtkLinkButton *link_button)
 {
   GtkLinkButtonPrivate *priv = gtk_link_button_get_instance_private (link_button);
   GtkWidget *toplevel;
-  GError *error;
 
   toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (link_button)));
 
-  error = NULL;
-  gtk_show_uri_on_window (GTK_WINDOW (toplevel), priv->uri, GDK_CURRENT_TIME, &error);
-  if (error)
-    {
-      g_warning ("Unable to show '%s': %s",
-                 priv->uri,
-                 error->message);
-      g_error_free (error);
-
-      return FALSE;
-    }
-
+  gtk_show_uri (GTK_WINDOW (toplevel), priv->uri, GDK_CURRENT_TIME);
   gtk_link_button_set_visited (link_button, TRUE);
 
   return TRUE;
diff --git a/gtk/gtkprintoperation-portal.c b/gtk/gtkprintoperation-portal.c
index 93cb8724e2..eb155a78b6 100644
--- a/gtk/gtkprintoperation-portal.c
+++ b/gtk/gtkprintoperation-portal.c
@@ -672,6 +672,6 @@ gtk_print_operation_portal_launch_preview (GtkPrintOperation *op,
   char *uri;
 
   uri = g_filename_to_uri (filename, NULL, NULL);
-  gtk_show_uri_on_window (parent, uri, GDK_CURRENT_TIME, NULL);
+  gtk_show_uri (parent, uri, GDK_CURRENT_TIME);
   g_free (uri);
 }
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c
index 16ca75cf1b..45584d28bd 100644
--- a/gtk/gtkprintoperation-unix.c
+++ b/gtk/gtkprintoperation-unix.c
@@ -312,7 +312,7 @@ gtk_print_operation_unix_launch_preview (GtkPrintOperation *op,
       g_error_free (error);
       error = NULL;
       uri = g_filename_to_uri (filename, NULL, NULL);
-      gtk_show_uri_on_window (parent, uri, GDK_CURRENT_TIME, &error);
+      gtk_show_uri (parent, uri, GDK_CURRENT_TIME);
       g_free (uri);
     }
 


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