X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmaemo%2Fmodest-platform.c;h=455e12b1482cd3797b88f9e7137d1be11ca47ab8;hp=4a6a6a31019ef8f78f6cabed3637c63fc72491ef;hb=ff5c90409a7511dcf1839d988f7b9e4467fa55f9;hpb=40e92875620a12ce1d34126c9a9c6bce97b21e6c diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index 4a6a6a3..455e12b 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -171,7 +171,7 @@ guess_mime_type_from_name (const gchar* name) return octet_stream; for (i = 0; i != G_N_ELEMENTS(mime_map); ++i) { - if (g_ascii_strcasecmp (mime_map[i][0], ext + 1)) /* +1: ignore '.'*/ + if (!g_ascii_strcasecmp (mime_map[i][0], ext + 1)) /* +1: ignore '.'*/ return mime_map[i][1]; } return octet_stream; @@ -189,7 +189,7 @@ modest_platform_get_file_icon_name (const gchar* name, const gchar* mime_type, g_return_val_if_fail (name || mime_type, NULL); - if (!mime_type || g_ascii_strcasecmp (mime_type, "application/octet-stream")) + if (!mime_type || !g_ascii_strcasecmp (mime_type, "application/octet-stream")) mime_str = g_string_new (guess_mime_type_from_name(name)); else { mime_str = g_string_new (mime_type); @@ -233,23 +233,33 @@ modest_platform_activate_uri (const gchar *uri) } gboolean -modest_platform_activate_file (const gchar *path) +modest_platform_activate_file (const gchar *path, const gchar *mime_type) { gint result; DBusConnection *con; gchar *uri_path = NULL; + GString *mime_str = NULL; + + if (!mime_type || !g_ascii_strcasecmp (mime_type, "application/octet-stream")) + mime_str = g_string_new (guess_mime_type_from_name(path)); + else { + mime_str = g_string_new (mime_type); + g_string_ascii_down (mime_str); + } uri_path = g_strconcat ("file://", path, NULL); con = osso_get_dbus_connection (osso_context); #ifdef MODEST_HILDON_VERSION_0 - result = osso_mime_open_file (con, uri_path); + result = osso_mime_open_file_with_mime_type (con, uri_path, mime_str->str); + g_string_free (mime_str, TRUE); if (result != 1) hildon_banner_show_information (NULL, NULL, _("mcen_ni_noregistered_viewer")); return result != 1; #else - result = hildon_mime_open_file (con, uri_path); + result = hildon_mime_open_file_with_mime_type (con, uri_path, mime_str->str); + g_string_free (mime_str, TRUE); if (result != 1) hildon_banner_show_information (NULL, NULL, _("mcen_ni_noregistered_viewer"));