[maemo-commits] [maemo-commits] r13121 - in projects/haf/trunk/libhildonmime: . tests
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri Aug 10 16:55:33 EEST 2007
- Previous message: [maemo-commits] r13120 - in projects/haf/trunk/hildon-desktop: . src
- Next message: [maemo-commits] r13122 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: martyn Date: 2007-08-10 16:55:29 +0300 (Fri, 10 Aug 2007) New Revision: 13121 Modified: projects/haf/trunk/libhildonmime/ChangeLog projects/haf/trunk/libhildonmime/tests/test-uri.c Log: * tests/test-uri.c: (main): Add switch to get the mime type from an URI name (i.e. no probing, simple URI extension guess work). Modified: projects/haf/trunk/libhildonmime/ChangeLog =================================================================== --- projects/haf/trunk/libhildonmime/ChangeLog 2007-08-10 13:36:31 UTC (rev 13120) +++ projects/haf/trunk/libhildonmime/ChangeLog 2007-08-10 13:55:29 UTC (rev 13121) @@ -1,5 +1,10 @@ 2007-08-10 Martyn Russell <martyn at imendio.com> + * tests/test-uri.c: (main): Add switch to get the mime type from + an URI name (i.e. no probing, simple URI extension guess work). + +2007-08-10 Martyn Russell <martyn at imendio.com> + * debian/rules: Fix building with the new Scratchbox toolchain, fixes NB#65400. Modified: projects/haf/trunk/libhildonmime/tests/test-uri.c =================================================================== --- projects/haf/trunk/libhildonmime/tests/test-uri.c 2007-08-10 13:36:31 UTC (rev 13120) +++ projects/haf/trunk/libhildonmime/tests/test-uri.c 2007-08-10 13:55:29 UTC (rev 13121) @@ -38,6 +38,7 @@ static gchar *set_default_by_uri = NULL; static gchar *set_default_to_nothing = NULL; static gchar *get_scheme = NULL; +static gchar *get_mime_type = NULL; static gchar **open_uris = NULL; static GOptionEntry entries[] = @@ -97,6 +98,11 @@ &get_scheme, "Get the scheme from a URI like \"http://www.google.com\"", NULL }, + { "get-mime-type", 'y', + 0, G_OPTION_ARG_STRING, + &get_mime_type, + "Get the mime type from a URI like \"file:///home/martyn/file.swf\"", + NULL }, { "open-uri", 'u', 0, G_OPTION_ARG_STRING_ARRAY, &open_uris, @@ -121,7 +127,7 @@ if ((!use_default && !get_actions && !get_actions_by_uri && !get_default && !get_default_by_uri && !set_default && !set_default_by_uri && !set_default_to_nothing && - !get_scheme && !open_uris) || + !get_scheme && !get_mime_type && !open_uris) || (set_default && !get_default) || (is_default && !get_actions)) { g_printerr ("Usage: %s --help\n", argv[0]); @@ -422,6 +428,21 @@ g_free (scheme); } + if (get_mime_type) { + const gchar *mime_type = NULL; + + mime_type = gnome_vfs_get_mime_type_for_name (get_mime_type); + + if (!mime_type) { + g_printerr ("Could not get mime type from uri:'%s'\n", + get_mime_type); + return EXIT_FAILURE; + } + + g_print ("Mime type for URI:'%s' is '%s'\n", + get_mime_type, mime_type); + } + if (open_uris) { const gchar *uri; gint i = 0;
- Previous message: [maemo-commits] r13120 - in projects/haf/trunk/hildon-desktop: . src
- Next message: [maemo-commits] r13122 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]