gtk2/docs/reference/gtk/migrating-GtkLinkButton.sgml
Stefan Kost 804a06b859 Bug 540967 – docs build slowly because of entities
* gtk/building.sgml:
	* gtk/changes-1.2.sgml:
	* gtk/changes-2.0.sgml:
	* gtk/compiling.sgml:
	* gtk/directfb.sgml:
	* gtk/glossary.xml:
	* gtk/gtk-docs.sgml:
	* gtk/gtk-query-immodules-2.0.xml:
	* gtk/gtk-update-icon-cache.xml:
	* gtk/migrating-GtkAboutDialog.sgml:
	* gtk/migrating-GtkAction.sgml:
	* gtk/migrating-GtkAssistant.sgml:
	* gtk/migrating-GtkBuilder.sgml:
	* gtk/migrating-GtkColorButton.sgml:
	* gtk/migrating-GtkComboBox.sgml:
	* gtk/migrating-GtkFileChooser.sgml:
	* gtk/migrating-GtkIconView.sgml:
	* gtk/migrating-GtkLinkButton.sgml:
	* gtk/migrating-GtkRecentChooser.sgml:
	* gtk/migrating-GtkTooltip.sgml:
	* gtk/migrating-checklist.sgml:
	* gtk/osx.sgml:
	* gtk/other_software.sgml:
	* gtk/question_index.sgml:
	* gtk/resources.sgml:
	* gtk/running.sgml:
	* gtk/text_widget.sgml:
	* gtk/tree_widget.sgml:
	* gtk/visual_index.xml:
	* gtk/windows.sgml:
	* gtk/x11.sgml:
	  Use xi:include to speed up doc-build. Remove some unused entities.


svn path=/trunk/; revision=20812
2008-07-10 03:27:56 +00:00

77 lines
2.2 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<chapter id="gtk-migrating-GtkLinkButton">
<title>Migrating from GnomeHRef to GtkLinkButton</title>
<para>
Since version 2.10, GTK+ provides the #GtkLinkButton widget as a
replacement for the <structname>GnomeHRef</structname> widget
in the libgnomeui library.
</para>
<para>
Porting an application from <structname>GnomeHRef</structname> to
#GtkLinkButton is very simple. #GtkLinkButton does not have a
default action for #GtkButton::clicked signal. So instead of simply
creating the widget
<informalexample><programlisting>
GtkWidget *button;
button = gnome_href_new (url, "");
</programlisting></informalexample>
you will have to handle the activation of the #GtkLinkButton, using
the ::clicked signal for instance
<informalexample><programlisting>
static void
link_button_clicked_cb (GtkWidget *widget,
gpointer data)
{
const gchar *link;
link = gtk_link_button_get_uri (GTK_LINK_BUTTON (widget));
open_browser_at_url (link);
}
/* ... */
GtkWidget *button;
button = gtk_link_button_new (url);
g_signal_connect (button, "clicked",
G_CALLBACK (link_button_clicked_cb), NULL);
</programlisting></informalexample>
If you have more than one #GtkLinkButton instead of connecting
a signal to each one, you can use a "hook function" which will be
called whenever a user activates a link button
<informalexample><programlisting>
static void
link_button_hook (GtkLinkButton *button,
const gchar *link,
gpointer user_data)
{
open_browser_at_url (link);
}
/* ... */
GtkWidget *button1 = gtk_link_button_new (uri1);
GtkWidget *button2 = gtk_link_button_new (uri2);
gtk_link_button_set_uri_hook (link_button_hook, NULL, NULL);
</programlisting></informalexample>
</para>
</chapter>
<!--
Local variables:
mode: sgml
sgml-parent-document: ("gtk-docs.sgml" "book" "part" "chapter")
End:
-->