/!\ Warning:
This is only a proposal at this time, and not approved for project-wide application.
This should not be applied before being officially turned into a GNOME Goal. NOTE this goal can only be applied during the 2.24 development cycle because we need gtk_show_uri which is in GTK 2.13.1

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&commat;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

gtk_show_uri (NULL, "ghelp:cheese", timestamp, &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 (dialog),
                                                                  "%s", error->message);
  g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
  gtk_window_present (GTK_WINDOW (dialog));

  g_error_free (error);
}

Opening a specific section like the intro for cheese can be done like this

gtk_show_uri (NULL, "ghelp:cheese?intro", timestamp, &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 (dialog),
                                                                  "%s", error->message);
  g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
  gtk_window_present (GTK_WINDOW (dialog));

  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

{i} 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.

Tarball

Status

Desktop

alacarte

to do

bug-buddy

to do

cheese

to do

control-center

to do

dasher

not needed

deskbar-applet

not needed

eel

not needed

ekiga

to do

eog

to do

epiphany

to do

evince

to do

evolution-data-server

not needed

evolution

to do

evolution-exchange

not needed

evolution-webcal

not needed

fast-user-switch-applet

to do

file-roller

done

gcalctool

to do

gconf-editor

to do

gdm

to do

gedit

done

gnome-applets

to do

gnome-backgrounds

not needed

gnome-desktop

not needed

gnome-doc-utils

not needed

gnome-games

to do

gnome-icon-theme

not needed

gnome-keyring

not needed

gnome-netstatus

to do

gnome-nettool

to do

gnome-mag

to do

gnome-media

to do

gnome-menus

to do

gnome-panel

to do

gnome-power-manager

to do

gnome-python-desktop

to do

gnome-screensaver

to do

gnome-session

to do

gnome-settings-daemon

to do

gnome-speech

to do

gnome-system-monitor

to do

gnome-system-tools

to do

gnome-terminal

to do

gnome-themes

not needed

gnome-user-docs

not needed

gnome-utils

to do

gnome-volume-manager

to do

gok

to do

gstreamer

to do

gst-plugins

to do

gtk-engines

not needed

gtkhtml

not needed

gtksourceview

not needed

gucharmap

to do

gvfs

not needed

libgail-gnome

not needed

libgnomekbd

to do

libgtop

not needed

libgweather

not needed

liboobs

not needed

librsvg

not needed

libsoup

not needed

libwnck

not needed

metacity

not needed

mousetweaks

to do

nautilus

to do

nautilus-cd-burner

to do

orca

not needed

pygtksourceview

not needed

seahorse

to do

sound-juicer

to do

swfdec-gnome

not needed

tomboy

not needed

totem-pl-parser

not needed

totem

patch

vino

to do

vinagre

patch

vte

not needed

yelp

to do

zenity

not needed

Desktop (to be deprecated)

libgnomeprint

not needed

libgnomeprintui

not needed

Platform

gtk+

not needed

Admin

pessulus

not needed

sabayon

not needed

Development Tools

accerciser

to do

anjuta

to do

devhelp

to do

gdl

not needed

glade3

to do

Other

brasero

to do

gthumb

to do

nemiver

to do

rhythmbox

to do

GnomeGoals/RemoveGnomeOpenGnomeHelp (last edited 2008-08-06 19:47:34 by JesseVanDenKieboom)