gchar *icon_name = NULL;
gchar **icons, **cursor;
- if (!mime_type || !g_ascii_strcasecmp (mime_type, "application/octet-stream"))
+ if (!mime_type || g_ascii_strcasecmp (mime_type, "application/octet-stream") == 0)
mime_str = g_string_new (gnome_vfs_get_mime_type_for_name (name));
else {
mime_str = g_string_new (mime_type);
g_string_ascii_down (mime_str);
}
-
+
icons = hildon_mime_get_icon_names (mime_str->str, NULL);
+
for (cursor = icons; cursor; ++cursor) {
if (!g_ascii_strcasecmp (*cursor, "gnome-mime-message") ||
!g_ascii_strcasecmp (*cursor, "gnome-mime-message-rfc822")) {
*effective_mime_type = g_string_free (mime_str, FALSE);
else
g_string_free (mime_str, TRUE);
-
+
return icon_name;
}
g_return_val_if_fail (uri, FALSE);
if (!uri)
return FALSE;
-
- actions = hildon_uri_get_actions_by_uri (uri, -1, 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) {
- result = checked_hildon_uri_open (uri, action);
- break;
+
+ /* don't try to activate file: uri's -- they might confuse the user,
+ * and/or might have security implications */
+ if (!g_str_has_prefix (uri, "file:")) {
+
+ actions = hildon_uri_get_actions_by_uri (uri, -1, 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) {
+ result = checked_hildon_uri_open (uri, action);
+ break;
+ }
}
- }
+
+ /* if we could not open it with email, try something else */
+ if (!result)
+ result = checked_hildon_uri_open (uri, NULL);
+ }
- /* if we could not open it with email, try something else */
- if (!result)
- result = checked_hildon_uri_open (uri, NULL);
-
if (!result) {
ModestWindow *parent =
modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(), FALSE);
hildon_banner_show_information (parent ? GTK_WIDGET(parent): NULL, NULL,
_("mcen_ib_unsupported_link"));
- }
+ g_warning ("%s: cannot open uri '%s'", __FUNCTION__,uri);
+ }
return result;
}
gint result = 0;
DBusConnection *con;
gchar *uri_path = NULL;
-
+
uri_path = g_strconcat ("file://", path, NULL);
con = osso_get_dbus_connection (modest_maemo_utils_get_osso_context());
if (uri == NULL)
return FALSE;
-
+
actions_list = hildon_uri_get_actions_by_uri (uri, -1, NULL);
- if (actions_list != NULL) {
- GSList *node;
+ if (actions_list) {
+
GtkWidget *menu = gtk_menu_new ();
ModestPlatformPopupInfo *popup_info = g_new0 (ModestPlatformPopupInfo, 1);
- popup_info->actions = actions_list;
- popup_info->uri = g_strdup (uri);
-
- for (node = actions_list; node != NULL; node = g_slist_next (node)) {
- GtkWidget *menu_item;
- const gchar *action_name;
- const gchar *translation_domain;
- HildonURIAction *action = (HildonURIAction *) node->data;
- action_name = hildon_uri_action_get_name (action);
- translation_domain = hildon_uri_action_get_translation_domain (action);
- menu_item = gtk_menu_item_new_with_label (dgettext(translation_domain, action_name));
- g_object_set_data (G_OBJECT(menu_item), HILDON_OSSO_URI_ACTION, (gpointer)action_name); /* hack */
- g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (activate_uri_popup_item),
- popup_info);
-
- if (hildon_uri_is_default_action (action, NULL)) {
- gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
- } else {
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+ /* don't add actions for file: uri's -- they might confuse the user,
+ * and/or might have security implications
+ * we still allow to copy the url though
+ */
+ if (!g_str_has_prefix (uri, "file:")) {
+
+ GSList *node;
+ popup_info->actions = actions_list;
+ popup_info->uri = g_strdup (uri);
+
+ for (node = actions_list; node != NULL; node = g_slist_next (node)) {
+ GtkWidget *menu_item;
+ const gchar *action_name;
+ const gchar *translation_domain;
+ HildonURIAction *action = (HildonURIAction *) node->data;
+ action_name = hildon_uri_action_get_name (action);
+ translation_domain = hildon_uri_action_get_translation_domain (action);
+ menu_item = gtk_menu_item_new_with_label (dgettext(translation_domain, action_name));
+ g_object_set_data (G_OBJECT(menu_item), HILDON_OSSO_URI_ACTION, (gpointer)action_name); /* hack */
+ g_signal_connect (G_OBJECT (menu_item), "activate", G_CALLBACK (activate_uri_popup_item),
+ popup_info);
+
+ if (hildon_uri_is_default_action (action, NULL)) {
+ gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menu_item);
+ } else {
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
+ }
+ gtk_widget_show (menu_item);
}
- gtk_widget_show (menu_item);
}
/* always add the copy item */
- GtkWidget* menu_item = gtk_menu_item_new_with_label (dgettext("osso-uri", "uri_link_copy_link_location"));
+ GtkWidget* menu_item = gtk_menu_item_new_with_label (dgettext("osso-uri",
+ "uri_link_copy_link_location"));
g_object_set_data_full (G_OBJECT(menu_item), HILDON_OSSO_URI_ACTION,
g_strconcat (URI_ACTION_COPY, uri, NULL),
g_free);
} else {
hildon_banner_show_information (NULL, NULL, _("mcen_ib_unsupported_link"));
}
-
+
return TRUE;
}