aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-shell.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-07-29 01:52:51 +0800
committerChristian Persch <chpe@src.gnome.org>2005-07-29 01:52:51 +0800
commit90586b820dea7fdb2588b24939ae72514f87c73d (patch)
tree8388e597298991275745bcb53908ad39b740dfbf /src/ephy-shell.c
parenta6467707fdbf7e67dbea0ba685dd0ba5c0ffbfdb (diff)
downloadgsoc2013-epiphany-90586b820dea7fdb2588b24939ae72514f87c73d.tar
gsoc2013-epiphany-90586b820dea7fdb2588b24939ae72514f87c73d.tar.gz
gsoc2013-epiphany-90586b820dea7fdb2588b24939ae72514f87c73d.tar.bz2
gsoc2013-epiphany-90586b820dea7fdb2588b24939ae72514f87c73d.tar.lz
gsoc2013-epiphany-90586b820dea7fdb2588b24939ae72514f87c73d.tar.xz
gsoc2013-epiphany-90586b820dea7fdb2588b24939ae72514f87c73d.tar.zst
gsoc2013-epiphany-90586b820dea7fdb2588b24939ae72514f87c73d.zip
Work around gtkmozembed focus bug. Fixes bug #105153.
2005-07-28 Christian Persch <chpe@cvs.gnome.org> * configure.ac: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/mozilla-embed.cpp: * src/ephy-shell.c: (url_is_empty), (load_homepage), (ephy_shell_new_tab_full): Work around gtkmozembed focus bug. Fixes bug #105153.
Diffstat (limited to 'src/ephy-shell.c')
-rw-r--r--src/ephy-shell.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index f80114471..02aec0cbd 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -639,10 +639,25 @@ ephy_shell_new (void)
return EPHY_SHELL (g_object_new (EPHY_TYPE_SHELL, NULL));
}
-static void
+static gboolean
+url_is_empty (const char *location)
+{
+ gboolean is_empty = FALSE;
+
+ if (location == NULL || location[0] == '\0' ||
+ strcmp (location, "about:blank") == 0)
+ {
+ is_empty = TRUE;
+ }
+
+ return is_empty;
+}
+
+static gboolean
load_homepage (EphyEmbed *embed)
{
char *home;
+ gboolean is_empty;
home = eel_gconf_get_string(CONF_GENERAL_HOMEPAGE);
@@ -653,9 +668,13 @@ load_homepage (EphyEmbed *embed)
home = g_strdup ("about:blank");
}
+ is_empty = url_is_empty (home);
+
ephy_embed_load_url (embed, home);
g_free (home);
+
+ return is_empty;
}
/**
@@ -691,6 +710,7 @@ ephy_shell_new_tab_full (EphyShell *shell,
EphyEmbed *previous_embed = NULL;
GtkWidget *nb;
int position = -1;
+ gboolean is_empty = FALSE;
EphyToolbar *toolbar;
if (flags & EPHY_NEW_TAB_IN_NEW_WINDOW) in_new_window = TRUE;
@@ -749,14 +769,35 @@ ephy_shell_new_tab_full (EphyShell *shell,
flags & EPHY_NEW_TAB_NEW_PAGE)
{
ephy_toolbar_activate_location (toolbar);
- load_homepage (embed);
+ is_empty = load_homepage (embed);
}
else if (flags & EPHY_NEW_TAB_OPEN_PAGE)
{
g_assert (url != NULL);
ephy_embed_load_url (embed, url);
+ is_empty = url_is_empty (url);
}
+ /* Make sure the initial focus is somewhere sensible and not, for
+ * example, on the reload button.
+ */
+ if (in_new_window || jump_to)
+ {
+ /* If the location entry is blank, focus that, except if the
+ * page was a copy */
+ if (is_empty)
+ {
+ /* empty page, focus location entry */
+ toolbar = EPHY_TOOLBAR (ephy_window_get_toolbar (window));
+ ephy_toolbar_activate_location (toolbar);
+ }
+ else if (embed != NULL)
+ {
+ /* non-empty page, focus the page */
+ ephy_embed_activate (embed);
+ }
+ }
+
return tab;
}