[gtk+] Use gtk_show_uri_on_window() in GtkLabel
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Use gtk_show_uri_on_window() in GtkLabel
- Date: Thu, 16 Feb 2017 15:44:43 +0000 (UTC)
commit 51010da740154204ef22a52677dba3364c25ea9e
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Feb 16 00:24:57 2017 +0000
Use gtk_show_uri_on_window() in GtkLabel
Avoid the deprecated gtk_show_uri(), and allow activating link in
sandboxed applications.
https://bugzilla.gnome.org/show_bug.cgi?id=778726
demos/gtk-demo/links.c | 2 +-
gtk/gtklabel.c | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/demos/gtk-demo/links.c b/demos/gtk-demo/links.c
index c896656..dcd7ba5 100644
--- a/demos/gtk-demo/links.c
+++ b/demos/gtk-demo/links.c
@@ -1,7 +1,7 @@
/* Links
*
* GtkLabel can show hyperlinks. The default action is to call
- * gtk_show_uri() on their URI, but it is possible to override
+ * gtk_show_uri_on_window() on their URI, but it is possible to override
* this with a custom handler.
*/
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index bc5ae4c..268f9c8 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -748,7 +748,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().
+ * which is to call gtk_show_uri_on_window().
*
* Returns: %TRUE if the link has been activated
*
@@ -6597,10 +6597,11 @@ gtk_label_activate_link (GtkLabel *label,
const gchar *uri)
{
GtkWidget *widget = GTK_WIDGET (label);
+ GtkWidget *top_level = gtk_widget_get_toplevel (widget);
+ guint32 timestamp = gtk_get_current_event_time ();
GError *error = NULL;
- if (!gtk_show_uri (gtk_widget_get_screen (widget),
- uri, gtk_get_current_event_time (), &error))
+ if (!gtk_show_uri_on_window (GTK_WINDOW (top_level), uri, timestamp, &error))
{
g_warning ("Unable to show '%s': %s", uri, error->message);
g_error_free (error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]