diff --git a/ChangeLog b/ChangeLog index 9b4010964b..eed8ef45af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-03-30 Emmanuele Bassi + + Add documentation for the GtkLinkButton (#336592) + + * docs/reference/tmpl/gtklinkbutton.sgml: Add description + of the GtkLinkButton. + + * docs/reference/gtk/migrating-GtkLinkButton.sgml: Guidelines + for migrating code from GnomeHRef to the GtkLinkButton. + + * docs/reference/gtk/gtk-docs.sgml: + * docs/reference/gtk/Makefile.am: Build glue for the porting + guide. + 2006-03-29 Matthias Clasen * gdk/gdk.symbols: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 9b4010964b..eed8ef45af 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +2006-03-30 Emmanuele Bassi + + Add documentation for the GtkLinkButton (#336592) + + * docs/reference/tmpl/gtklinkbutton.sgml: Add description + of the GtkLinkButton. + + * docs/reference/gtk/migrating-GtkLinkButton.sgml: Guidelines + for migrating code from GnomeHRef to the GtkLinkButton. + + * docs/reference/gtk/gtk-docs.sgml: + * docs/reference/gtk/Makefile.am: Build glue for the porting + guide. + 2006-03-29 Matthias Clasen * gdk/gdk.symbols: diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am index 78ee6dda7f..6396ea7e60 100644 --- a/docs/reference/gtk/Makefile.am +++ b/docs/reference/gtk/Makefile.am @@ -108,6 +108,8 @@ content_files = \ migrating-GtkAboutDialog.sgml \ migrating-GtkColorButton.sgml \ migrating-GtkAssistant.sgml \ + migrating-GtkRecentChooser.sgml \ + migrating-GtkLinkButton.sgml \ objects_grouped.sgml \ osx.sgml \ question_index.sgml \ @@ -131,6 +133,7 @@ expand_content_files = \ migrating-GtkColorButton.sgml \ migrating-GtkAssistant.sgml \ migrating-GtkRecentChooser.sgml \ + migrating-GtkLinkButton.sgml \ tree_widget.sgml \ text_widget.sgml \ question_index.sgml diff --git a/docs/reference/gtk/gtk-docs.sgml b/docs/reference/gtk/gtk-docs.sgml index 04d2796a95..794769b17e 100644 --- a/docs/reference/gtk/gtk-docs.sgml +++ b/docs/reference/gtk/gtk-docs.sgml @@ -210,6 +210,7 @@ + @@ -615,6 +616,7 @@ that is, GUI components such as GtkButton or >k-migrating-GtkColorButton; >k-migrating-GtkAssistant; >k-migrating-GtkRecentChooser; + >k-migrating-GtkLinkButton; diff --git a/docs/reference/gtk/migrating-GtkLinkButton.sgml b/docs/reference/gtk/migrating-GtkLinkButton.sgml new file mode 100644 index 0000000000..fe8ef22314 --- /dev/null +++ b/docs/reference/gtk/migrating-GtkLinkButton.sgml @@ -0,0 +1,72 @@ + + + Migrating from GnomeHRef to GtkLinkButton + + + Since version 2.10, GTK+ provides the #GtkLinkButton widget as a + replacement for the GnomeHRef widget + in the libgnomeui library. + + + + Porting an application from GnomeHRef to + #GtkLinkButton is very simple. #GtkLinkButton does not have a + default action for "clicked" signal. So instead of simply creating + the widget + + GtkWidget *button; + + button = gnome_href_new (url, ""); + + you will have to handle the activation of the #GtkLinkButton, using + the "clicked" signal for instance + + 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); + + 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 + + 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); + + + + + + + diff --git a/docs/reference/gtk/tmpl/gtklinkbutton.sgml b/docs/reference/gtk/tmpl/gtklinkbutton.sgml new file mode 100644 index 0000000000..68e6922f5f --- /dev/null +++ b/docs/reference/gtk/tmpl/gtklinkbutton.sgml @@ -0,0 +1,114 @@ + +GtkLinkButton + + +Create buttons bound to a URL + + + +A #GtkLinkButton is a #GtkButton with a hyperlink, similar to the one +used by web browsers, which triggers an action when clicked. It is useful +to show quick links to resources. + + + +A link button is created by calling either gtk_link_button_new() or +gtk_link_button_new_with_label(). If using the former, the URI you pass +to the constructor is used as a label for the widget. + + + +The URI bound to a #GtkLinkButton can be set specifically using +gtk_link_button_set_uri(), and retrieved using gtk_link_button_get_uri(). + + + +#GtkLinkButton offers a global hook, which is called when the used clicks +on it: see gtk_link_button_set_uri_hook(). + + + +#GtkLinkButton was added in GTK+ 2.10. + + + + +#GtkButton + + + + + + + + +The #GtkLinkButton struct contains private data only, and should be +manipulated using the functions below. + + + + + + + + + + + + + +@uri: +@Returns: + + + + + + + +@uri: +@label: +@Returns: + + + + + + + +@link_button: +@Returns: + + + + + + + +@link_button: +@uri: + + + + +The type of a function which is called when the #GtkLinkButton is +clicked. + + +@button: the #GtkLinkButton which was clicked +@link: the URI to which the clicked #GtkLinkButton points +@data: user data that was passed when the function was registered + with gtk_link_button_set_uri_hook() + + + + + + + +@func: +@data: +@destroy: +@Returns: + +