GNOME Goal: Replace gnome_help and gnome-open calls with gtk_show_uri
Currently many GNOME apps still use gnome_help calls and code that uses launching of gnome-open to open files. The gnome_help API and the gnome-open are part of the libgnome library which is deprecated.
GTK+ 2.13.1 contains a new API call gtk_show_uri to replace gnome_help and gnome-open. Programs that don't depend on libgnome usually spawn xdg-open. Replacing that with gtk_show_uri is a cleaner solution.
/** * gtk_show_uri: * @screen: screen to show the uri on or %NULL for the default screen * @uri: the uri to show * @timestamp: a timestamp to prevent focus stealing. * @error: a #GError that is returned in case of errors * * This is a convenience function for launching the default application * to show the uri. The uri must be of a form understood by GIO. Typical * examples are * <simplelist> * <member><filename>file:///home/gnome/pict.jpg</filename></member> * <member><filename>http://www.gnome.org</filename></member> * <member><filename>mailto:me@gnome.org</filename></member> * </simplelist> * Ideally the timestamp is taken from the event triggering * the gtk_show_uri() call. If timestamp is not known you can take * %GDK_CURRENT_TIME. * * This function can be used as a replacement for gnome_vfs_url_show() * and gnome_url_show(). * * Returns: %TRUE on success, %FALSE on error. * * Since: 2.14 */
Opening help file with gtk_show_uri
E.g opening the help for cheese can be done like this
screen = gtk_widget_get_screen (cheese_window->window); gtk_show_uri (screen, "ghelp:cheese", gtk_get_current_event_time (), &error); if (error != NULL) { GtkWidget *d; d = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", _("Unable to open help file")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d), "%s", error->message); g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_window_present (GTK_WINDOW (d)); g_error_free (error); }
Opening a specific section like the intro for cheese can be done like this
screen = gtk_widget_get_screen (cheese_window->window); gtk_show_uri (screen, "ghelp:cheese?intro", gtk_get_current_event_time (), &error); if (error != NULL) { GtkWidget *d; d = gtk_message_dialog_new (GTK_WINDOW (cheese_window->window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s", _("Unable to open help file")); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (d), "%s", error->message); g_signal_connect (d, "response", G_CALLBACK (gtk_widget_destroy), NULL); gtk_window_present (GTK_WINDOW (d)); g_error_free (error); }
Note that for the timestamp to pass to gtk_show_uri, you should take the event time as taken from the GdkEventKey, GdkEventButton etc event that triggers the action, or use gtk_get_current_event_time(). Only as a last resort should GDK_CURRENT_TIME be used.
Comments
Status of this goal
Note: Updated automatical stats can be found at http://www.gnome.org/~fpeters/reports/gnome_help.html
Tip: If you choose to work on a module, create the bug report on the GNOME bugzilla. This way people will know someone already works on it, and won't duplicate the work you're doing. |
State |
Markup |
todo |
<: #ff8080> todo |
patch |
<: #ffc849> [[GnomeBug:xxxxx|patch]] |
done |
<: #80ff80> [[GnomeBug:xxxxx|done]] |
not needed |
<: #80ff80> not needed |
Above are the states and corresponding markup to update the modules state table below.
Warning: |
Tarball |
Status |
|
Desktop |
||
alacarte |
Uses python: gnome.help_display_desktop |
|
bug-buddy |
not needed |
|
done |
||
dasher |
||
not needed |
||
Need to retain older GTK+ compatibility |
||
done |
||
not needed |
||
done |
||
evolution-data-server |
not needed |
|
evolution-exchange |
not needed |
|
evolution-webcal |
not needed |
|
file-roller |
done |
|
gcalctool |
||
gconf-editor |
not needed |
|
not needed |
||
done |
||
gnome-backgrounds |
not needed |
|
done |
||
gnome-desktop |
not needed |
|
not needed |
||
done |
||
gnome-icon-theme |
not needed |
|
gnome-keyring |
not needed |
|
gnome-netstatus |
done |
|
gnome-nettool |
not needed |
|
gnome-mag |
not needed |
|
not needed |
Only in gnome-cd and cddb-slave2 (that are deprecated) |
|
gnome-menus |
not needed |
|
not needed |
||
gnome-power-manager |
done |
|
gnome-python-desktop |
not needed |
|
done |
||
gnome-session |
done |
|
gnome-settings-daemon |
not needed |
|
not needed |
||
gnome-system-monitor |
done |
|
not needed |
||
gnome-terminal |
not needed |
|
not needed |
||
gnome-user-docs |
not needed |
|
not needed |
||
not needed |
||
gst-plugins |
not needed |
|
not needed |
||
gtkhtml |
not needed |
|
not needed |
||
not needed |
||
gvfs |
not needed |
|
hamster-applet |
not needed |
|
libgail-gnome |
not needed |
|
libgnomekbd |
not needed |
|
libgtop |
not needed |
|
libgweather |
not needed |
|
liboobs |
not needed |
|
librsvg |
not needed |
|
not needed |
||
libwnck |
not needed |
|
metacity |
not needed |
|
mousetweaks |
not needed |
|
done |
||
Uses python: gnome.help_display_with_doc_id() |
||
pygtksourceview |
not needed |
|
swfdec-gnome |
not needed |
|
tomboy |
||
totem-pl-parser |
not needed |
|
vino |
||
vinagre |
||
vte |
not needed |
|
done |
||
not needed |
||
Desktop (to be deprecated) |
||
libgnomeprint |
not needed |
|
libgnomeprintui |
not needed |
|
Platform |
||
not needed |
||
Admin |
||
sabayon |
not needed |
|
Development Tools |
||
accerciser |
not needed |
|
anjuta |
not needed |
|
devhelp |
||
gdl |
not needed |
|
glade3 |
not needed |
|
Other |
||
abiword |
gnome_help with a #ifdef, but link to use gtk_show_uri only |
|
ghex |
||
glom |
not needed |
|
Gnumeric |
not needed |
|
goffice |
not needed |
|
GParted |
||
gthumb |
||
nemiver |
not needed |
|
planner |
||
rhythmbox |
not needed |