From f6b01d969273f407b0fdc623aa6acc1986491512 Mon Sep 17 00:00:00 2001 From: Diego Escalante Urrelo Date: Tue, 9 Jan 2007 00:49:45 +0000 Subject: Opens images in a new browser window if EOG is not found. Bug #167595. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2007-01-09 Diego Escalante Urrelo * src/popup-commands.c: * lib/ephy-file-helpers.c: Opens images in a new browser window if EOG is not found. Bug #167595. Patch by Björn Lindqvist. svn path=/trunk/; revision=6811 --- ChangeLog | 8 ++++++++ lib/ephy-file-helpers.c | 6 ++---- src/popup-commands.c | 30 +++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8473bec6f..68a609495 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-01-09 Diego Escalante Urrelo + + * src/popup-commands.c: + * lib/ephy-file-helpers.c: + + Opens images in a new browser window if EOG is not found. Bug #167595. + Patch by Björn Lindqvist. + 2007-01-09 Diego Escalante Urrelo * src/ephy-history-window.c: diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c index 9bc6c04dc..1b30b4cab 100644 --- a/lib/ephy-file-helpers.c +++ b/lib/ephy-file-helpers.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright © 2002 Jorn Baayen * Copyright © 2003, 2004 Marco Pesenti Gritti @@ -1007,10 +1008,7 @@ ephy_file_launch_handler (const char *mime_type, gnome_vfs_mime_application_free (app); } else - { - /* FIXME: warn user? */ - g_warning ("No handler for found or file type is unsafe!\n"); - } + ret = FALSE; g_free (canonical); diff --git a/src/popup-commands.c b/src/popup-commands.c index c6dcaf969..64e0d0654 100644 --- a/src/popup-commands.c +++ b/src/popup-commands.c @@ -1,3 +1,4 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Copyright © 2000-2003 Marco Pesenti Gritti * @@ -367,22 +368,31 @@ popup_cmd_open_frame (GtkAction *action, g_free (location); } +/* Opens an image URI using its associated handler. Or, if that + * doesn't work, fallback to open the URI in a new browser window. + */ static void -image_open_uri (const char *address, - gboolean delete, +image_open_uri (const char *remote_address, + const char *local_address, guint32 user_time) { gboolean success; - success = ephy_file_launch_handler (NULL, address, user_time); + success = ephy_file_launch_handler (NULL, local_address, user_time); - if (delete && success) + if (!success) { - ephy_file_delete_on_exit (address); + ephy_shell_new_tab (ephy_shell, NULL, NULL, remote_address, + EPHY_NEW_TAB_OPEN_PAGE | + EPHY_NEW_TAB_IN_NEW_WINDOW); } - else if (delete) + + if (strcmp (remote_address, local_address) != 0) { - gnome_vfs_unlink (address); + if (success) + ephy_file_delete_on_exit (local_address); + else + gnome_vfs_unlink (local_address); } } @@ -390,13 +400,15 @@ static void save_source_completed_cb (EphyEmbedPersist *persist) { const char *dest; + const char *source; guint32 user_time; user_time = ephy_embed_persist_get_user_time (persist); dest = ephy_embed_persist_get_dest (persist); + source = ephy_embed_persist_get_source (persist); g_return_if_fail (dest != NULL); - image_open_uri (dest, TRUE, user_time); + image_open_uri (source, dest, user_time); } static void @@ -461,7 +473,7 @@ popup_cmd_open_image (GtkAction *action, if (strcmp (scheme, "file") == 0) { - image_open_uri (address, FALSE, + image_open_uri (address, address, gtk_get_current_event_time ()); } else -- cgit v1.2.3