Call gtk_show_uri() if no uri hook has been set. Patch by Emmanuele Bassi

* gtk/gtklinkbutton.c: Call gtk_show_uri() if no uri hook has
        been set. Patch by Emmanuele Bassi


svn path=/trunk/; revision=21853
This commit is contained in:
Matthias Clasen 2008-12-08 02:39:28 +00:00
parent 537576e0b4
commit 9ed0abb510
2 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2008-12-07 Matthias Clasen <mclasen@redhat.com>
Bug 554274 Add default hook for GtkLinkButton
* gtk/gtklinkbutton.c: Call gtk_show_uri() if no uri hook has
been set. Patch by Emmanuele Bassi
2008-12-07 Matthias Clasen <mclasen@redhat.com> 2008-12-07 Matthias Clasen <mclasen@redhat.com>
Bug 559325 documentation for gdk_display_get_window_at_pointer() Bug 559325 documentation for gdk_display_get_window_at_pointer()

View File

@ -474,6 +474,26 @@ gtk_link_button_clicked (GtkButton *button)
if (uri_func) if (uri_func)
(* uri_func) (link_button, link_button->priv->uri, uri_func_data); (* uri_func) (link_button, link_button->priv->uri, uri_func_data);
else
{
GdkScreen *screen;
GError *error;
if (gtk_widget_has_screen (GTK_WIDGET (button)));
screen = gtk_widget_get_screen (GTK_WIDGET (button));
else
screen = NULL;
error = NULL;
gtk_show_uri (screen, link_button->priv->uri, GDK_CURRENT_TIME, &error);
if (error)
{
g_warning ("Unable to show '%s': %s",
link_button->priv->uri,
error->message);
g_error_free (error);
}
}
gtk_link_button_set_visited (link_button, TRUE); gtk_link_button_set_visited (link_button, TRUE);
} }
@ -690,6 +710,8 @@ gtk_link_button_get_uri (GtkLinkButton *link_button)
* a #GtkLinkButton. This function is called before every callback registered * a #GtkLinkButton. This function is called before every callback registered
* for the "clicked" signal. * for the "clicked" signal.
* *
* If no uri hook has been set, GTK+ defaults to calling gtk_show_uri().
*
* Return value: the previously set hook function. * Return value: the previously set hook function.
* *
* Since: 2.10 * Since: 2.10