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 "http://www.gnome.org";

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
gnome-uri-opener

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

int 
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);
	g_spawn_command_line_async(command,NULL);
	return 0;
}



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