[gimp] Bug 762279 - "Tip of the day" links opens two links



commit dc33afd95b0a7aec7f6a8a4bf69eb8f0eccf7faf
Author: Michael Natterer <mitch gimp org>
Date:   Sun Mar 20 20:29:43 2016 +0100

    Bug 762279 - "Tip of the day" links opens two links
    
    Fix this the brute force way, don't look it's ugly...

 app/dialogs/tips-dialog.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/app/dialogs/tips-dialog.c b/app/dialogs/tips-dialog.c
index e0fd927..2072804 100644
--- a/app/dialogs/tips-dialog.c
+++ b/app/dialogs/tips-dialog.c
@@ -42,6 +42,17 @@ enum
   RESPONSE_NEXT     = 2
 };
 
+
+/* eek, see bug 762279 */
+GtkLinkButtonUriFunc
+gtk_link_button_set_uri_hook      (GtkLinkButtonUriFunc func,
+                                   gpointer             data,
+                                   GDestroyNotify       destroy);
+static void  tips_uri_hook        (GtkLinkButton *button,
+                                   const gchar   *link_,
+                                   gpointer       user_data);
+
+
 static void  tips_dialog_set_tip  (GimpTip       *tip);
 static void  tips_dialog_response (GtkWidget     *dialog,
                                    gint           response);
@@ -194,6 +205,9 @@ tips_dialog_create (Gimp *gimp)
   gtk_widget_show (more_button);
   gtk_box_pack_start (GTK_BOX (hbox), more_button, FALSE, FALSE, 0);
 
+  /* this is deprecated but better than showing two URIs, see bug #762279 */
+  gtk_link_button_set_uri_hook (tips_uri_hook, NULL, NULL);
+
   g_signal_connect (more_button, "clicked",
                     G_CALLBACK (more_button_clicked),
                     gimp);
@@ -246,9 +260,7 @@ tips_dialog_set_tip (GimpTip *tip)
 
   gtk_label_set_markup (GTK_LABEL (tip_label), tip->text);
 
-  /*  set the URI to unset the "visited" state  */
-  gtk_link_button_set_uri (GTK_LINK_BUTTON (more_button),
-                           "http://docs.gimp.org/";);
+  gtk_link_button_set_visited (GTK_LINK_BUTTON (more_button), FALSE);
 
   gtk_widget_set_sensitive (more_button, tip->help_id != NULL);
 }
@@ -259,6 +271,16 @@ more_button_clicked (GtkWidget *button,
 {
   GimpTip *tip = current_tip->data;
 
+  g_signal_stop_emission_by_name (button, "clicked");
+
   if (tip->help_id)
     gimp_help (gimp, NULL, NULL, tip->help_id);
 }
+
+static void
+tips_uri_hook (GtkLinkButton *button,
+               const gchar   *link_,
+               gpointer       user_data)
+{
+  /* do nothing */
+}


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