aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-tab.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-07-23 02:23:06 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-07-23 02:23:06 +0800
commit868caf0359ab9f68e44657946851538aa4cf3e61 (patch)
treece05d7d342558f9e5a10297a50cd6a8104749a5d /src/ephy-tab.c
parentd55c3cc3045d0c3c0b9a6c59fdd315cda7510d98 (diff)
downloadgsoc2013-epiphany-868caf0359ab9f68e44657946851538aa4cf3e61.tar
gsoc2013-epiphany-868caf0359ab9f68e44657946851538aa4cf3e61.tar.gz
gsoc2013-epiphany-868caf0359ab9f68e44657946851538aa4cf3e61.tar.bz2
gsoc2013-epiphany-868caf0359ab9f68e44657946851538aa4cf3e61.tar.lz
gsoc2013-epiphany-868caf0359ab9f68e44657946851538aa4cf3e61.tar.xz
gsoc2013-epiphany-868caf0359ab9f68e44657946851538aa4cf3e61.tar.zst
gsoc2013-epiphany-868caf0359ab9f68e44657946851538aa4cf3e61.zip
Try to use more friendly description for cache prefs.
2003-07-22 Marco Pesenti Gritti <marco@it.gnome.org> * data/glade/prefs-dialog.glade: Try to use more friendly description for cache prefs. * src/ephy-tab.c: (open_link_in_new_tab), (ephy_tab_dom_mouse_click_cb): Middle click open in new tab for http, ftp and file, hope to not have missed any protocol that make sense.
Diffstat (limited to 'src/ephy-tab.c')
-rw-r--r--src/ephy-tab.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index d4256ff89..69a881007 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -872,20 +872,56 @@ ephy_tab_size_to_cb (EphyEmbed *embed, gint width, gint height,
g_list_free (tabs);
}
+static void
+open_link_in_new_tab (EphyTab *tab,
+ const char *link_address)
+{
+ GnomeVFSURI *uri;
+ const char *scheme;
+ EphyWindow *window;
+ gboolean new_tab = FALSE;
+
+ window = ephy_tab_get_window (tab);
+ g_return_if_fail (window != NULL);
+
+ uri = gnome_vfs_uri_new (link_address);
+ if (uri != NULL)
+ {
+ scheme = gnome_vfs_uri_get_scheme (uri);
+
+ new_tab = (strcmp (scheme, "http") == 0 ||
+ strcmp (scheme, "ftp") == 0 ||
+ strcmp (scheme, "file") == 0);
+
+ gnome_vfs_uri_unref (uri);
+ }
+
+ if (new_tab)
+ {
+ ephy_shell_new_tab (ephy_shell, window, tab,
+ link_address,
+ EPHY_NEW_TAB_OPEN_PAGE);
+ }
+ else
+ {
+ ephy_window_load_url (window, link_address);
+ }
+}
+
static gint
ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
EphyEmbedEvent *event,
EphyTab *tab)
{
- EphyWindow *window;
EphyEmbedEventType type;
EmbedEventContext context;
-
- g_assert (IS_EPHY_EMBED_EVENT(event));
+ EphyWindow *window;
window = ephy_tab_get_window (tab);
g_return_val_if_fail (window != NULL, FALSE);
+ g_assert (IS_EPHY_EMBED_EVENT(event));
+
ephy_embed_event_get_event_type (event, &type);
ephy_embed_event_get_context (event, &context);
@@ -893,11 +929,11 @@ ephy_tab_dom_mouse_click_cb (EphyEmbed *embed,
&& (context & EMBED_CONTEXT_LINK))
{
const GValue *value;
+ const char *link_address;
ephy_embed_event_get_property (event, "link", &value);
- ephy_shell_new_tab (ephy_shell, window, tab,
- g_value_get_string (value),
- EPHY_NEW_TAB_OPEN_PAGE);
+ link_address = g_value_get_string (value);
+ open_link_in_new_tab (tab, link_address);
}
else if (type == EPHY_EMBED_EVENT_MOUSE_BUTTON2 &&
eel_gconf_get_boolean (CONF_INTERFACE_MIDDLE_CLICK_OPEN_URL) &&