Re: Is there someone working on a gnome_help_display replacement?

I made this little program to do some testing (and to learn C so sorry
for any programming errors)

./gnome-uri-opener "mailto:foo somewhere com"
./gnome-uri-opener "";

This command will open the default program that handles the uri.

cc `pkg-config --cflags --libs glib-2.0 gconf-2.0` gnome-uri-opener.c -o

lupusBE (Kristof Vansant Belgium)
#include <glib.h>
#include <glib/gi18n.h>
#include <gconf/gconf-client.h>

main (int argc, char **argv)
	GConfClient *settings;
	gchar *uri;
	gchar *command;
	uri = argv[1];
	g_printf("uri: %s\n", uri);
	if (g_str_has_prefix(uri,"http://";)){
		gchar *browser;
		settings = gconf_client_get_default();
		browser = gconf_client_get_string(settings,"/desktop/gnome/url-handlers/http/command", NULL);
		g_printf("Default browser: %s\n",browser);
		command = g_strdup_printf(browser,uri);

	if (g_str_has_prefix(uri,"mailto:";)){
		gchar *mail;
		settings = gconf_client_get_default();
		mail = gconf_client_get_string(settings,"/desktop/gnome/url-handlers/mailto/command",NULL);
    		g_printf("Default mail client: %s\n", mail);
		command = g_strdup_printf(mail,uri);
	g_printf("Fork: %s\n",command);
	return 0;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]