From: Dirk-Jan C. Binnema Date: Mon, 18 Jun 2007 12:32:32 +0000 (+0000) Subject: * fix the uri activation, bug NB#58220 X-Git-Tag: git_migration_finished~3238 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=964fa297ed3f4e25f31b46cd8e12235201684f2c * fix the uri activation, bug NB#58220 pmo-trunk-r2278 --- diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index c621008..85c2833 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -218,22 +218,87 @@ modest_platform_get_file_icon_name (const gchar* name, const gchar* mime_type, return icon_name; } + + + +#ifdef MODEST_HILDON_VERSION_0 + gboolean modest_platform_activate_uri (const gchar *uri) { - gboolean result; + OssoURIAction *action; + gboolean result = FALSE; + GSList *actions, *iter = NULL; + const gchar *scheme; + + g_return_val_if_fail (uri, FALSE); + if (!uri) + return FALSE; -#ifdef MODEST_HILDON_VERSION_0 - result = osso_uri_open (uri, NULL, NULL); -#else - result = hildon_uri_open (uri, NULL, NULL); -#endif + /* the default action should be email */ + scheme = osso_uri_get_scheme_from_uri (uri, NULL); + actions = osso_uri_get_actions (scheme, NULL); + + for (iter = actions; iter; iter = g_slist_next (iter)) { + action = (OssoURIAction*) iter->data; + if (action && strcmp (hildon_uri_action_get_service (action), "com.nokia.modest") == 0) { + GError *err = NULL; + result = osso_uri_open (uri, action, &err); + if (!result && err) { + g_printerr ("modest: modest_platform_activate_uri : %s", + err->message ? err->message : "unknown error"); + g_error_free (err); + } + break; + } + } + + if (!result) + hildon_banner_show_information (NULL, NULL, _("mcen_ib_unsupported_link")); + return result; +} + +#else /* MODEST_HILDON_VERSION_0*/ + + +gboolean +modest_platform_activate_uri (const gchar *uri) +{ + HildonURIAction *action; + gboolean result = FALSE; + GSList *actions, *iter = NULL; + const gchar *scheme; + + g_return_val_if_fail (uri, FALSE); + if (!uri) + return FALSE; + /* the default action should be email */ + scheme = hildon_uri_get_scheme_from_uri (uri, NULL); + actions = hildon_uri_get_actions (scheme, NULL); + + for (iter = actions; iter; iter = g_slist_next (iter)) { + action = (HildonURIAction*) iter->data; + if (action && strcmp (hildon_uri_action_get_service (action), "com.nokia.modest") == 0) { + GError *err = NULL; + result = hildon_uri_open (uri, action, &err); + if (!result && err) { + g_printerr ("modest: modest_platform_activate_uri : %s", + err->message ? err->message : "unknown error"); + g_error_free (err); + } + break; + } + } + if (!result) hildon_banner_show_information (NULL, NULL, _("mcen_ib_unsupported_link")); return result; } + +#endif /* MODEST_HILDON_VERSION_0*/ + gboolean modest_platform_activate_file (const gchar *path, const gchar *mime_type) {