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);
|