summaryrefslogtreecommitdiff
path: root/gtk/gtklinkbutton.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2012-05-10 15:15:43 +0100
committerBastien Nocera <hadess@hadess.net>2012-05-10 15:22:31 +0100
commitc6a7a0889c34fae72953a8e74a5eca664f3bd99b (patch)
treed972a0465cae2f9d8648b27648a17020004b40ec /gtk/gtklinkbutton.c
parentc1cfcd03a550e0b79c563a2de3c9f6fb5f9b134f (diff)
downloadgtk+-c6a7a0889c34fae72953a8e74a5eca664f3bd99b.tar.gz
gtk: Fix warnings for some uses of GtkLinkButton
Not setting a URI but catching the activate-link signal is a valid use of GtkLinkButton, but we shouldn't allow showing a popup menu which offers to copy the URI if there's none.
Diffstat (limited to 'gtk/gtklinkbutton.c')
-rw-r--r--gtk/gtklinkbutton.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c
index 15a52f6a85..b5981c741f 100644
--- a/gtk/gtklinkbutton.c
+++ b/gtk/gtklinkbutton.c
@@ -526,7 +526,10 @@ gtk_link_button_button_press (GtkWidget *widget,
if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
- if (gdk_event_triggers_context_menu ((GdkEvent *) event))
+ /* Don't popup the menu if there's no URI set,
+ * otherwise the menu item will trigger a warning */
+ if (gdk_event_triggers_context_menu ((GdkEvent *) event) &&
+ GTK_LINK_BUTTON (widget)->priv->uri != NULL)
{
gtk_link_button_do_popup (GTK_LINK_BUTTON (widget), event);