aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <diegoe@svn.gnome.org>2007-01-09 08:49:45 +0800
committerDiego Escalante Urrelo <diegoe@src.gnome.org>2007-01-09 08:49:45 +0800
commitf6b01d969273f407b0fdc623aa6acc1986491512 (patch)
tree9572875e966c498e2f7468b4ff42da0aef75ce5f /src
parentfc051e29f9dd21db6254ce75f17c97a4012bcf03 (diff)
downloadgsoc2013-epiphany-f6b01d969273f407b0fdc623aa6acc1986491512.tar.gz
gsoc2013-epiphany-f6b01d969273f407b0fdc623aa6acc1986491512.tar.zst
gsoc2013-epiphany-f6b01d969273f407b0fdc623aa6acc1986491512.zip
Opens images in a new browser window if EOG is not found. Bug #167595.
2007-01-09 Diego Escalante Urrelo <diegoe@svn.gnome.org> * 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
Diffstat (limited to 'src')
-rw-r--r--src/popup-commands.c30
1 files changed, 21 insertions, 9 deletions
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