aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@src.gnome.org>2007-11-12 07:22:34 +0800
committerXan Lopez <xan@src.gnome.org>2007-11-12 07:22:34 +0800
commitde2c912fc1e7a43022933d03e095af3fcb90b775 (patch)
tree70f5860d3b5dbed7d70503350bc9c69c0aad9209
parenta212aa82d4a2ceed4079543269f39c87dd35dbe0 (diff)
downloadgsoc2013-epiphany-de2c912fc1e7a43022933d03e095af3fcb90b775.tar
gsoc2013-epiphany-de2c912fc1e7a43022933d03e095af3fcb90b775.tar.gz
gsoc2013-epiphany-de2c912fc1e7a43022933d03e095af3fcb90b775.tar.bz2
gsoc2013-epiphany-de2c912fc1e7a43022933d03e095af3fcb90b775.tar.lz
gsoc2013-epiphany-de2c912fc1e7a43022933d03e095af3fcb90b775.tar.xz
gsoc2013-epiphany-de2c912fc1e7a43022933d03e095af3fcb90b775.tar.zst
gsoc2013-epiphany-de2c912fc1e7a43022933d03e095af3fcb90b775.zip
Implement grab_focus in EphyBaseEmbed.
We still need a custom implementation in MozillaEmbed because the child of the embed won't exist until the widget is realized, so there is no point in grabbing focus until then. svn path=/trunk/; revision=7668
-rw-r--r--embed/ephy-base-embed.c12
-rw-r--r--embed/mozilla/mozilla-embed.cpp32
-rw-r--r--embed/webkit/webkit-embed.cpp7
3 files changed, 26 insertions, 25 deletions
diff --git a/embed/ephy-base-embed.c b/embed/ephy-base-embed.c
index aa82ed284..79e7146f3 100644
--- a/embed/ephy-base-embed.c
+++ b/embed/ephy-base-embed.c
@@ -147,6 +147,17 @@ ephy_base_embed_size_allocate (GtkWidget *widget,
}
static void
+ephy_base_embed_grab_focus (GtkWidget *widget)
+{
+ GtkWidget *child;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+
+ if (child)
+ gtk_widget_grab_focus (child);
+}
+
+static void
impl_set_typed_address (EphyEmbed *embed,
const char *address,
EphyEmbedAddressExpire expire)
@@ -367,6 +378,7 @@ ephy_base_embed_class_init (EphyBaseEmbedClass *klass)
widget_class->size_request = ephy_base_embed_size_request;
widget_class->size_allocate = ephy_base_embed_size_allocate;
+ widget_class->grab_focus = ephy_base_embed_grab_focus;
g_object_class_install_property (gobject_class,
PROP_SECURITY,
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 6a2af9279..6470a739d 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -145,23 +145,6 @@ G_DEFINE_TYPE_WITH_CODE (MozillaEmbed, mozilla_embed, EPHY_TYPE_BASE_EMBED,
ephy_command_manager_iface_init))
static void
-mozilla_embed_grab_focus (GtkWidget *widget)
-{
- GtkWidget *child;
-
- child = gtk_bin_get_child (GTK_BIN (widget));
-
- if (child != NULL)
- {
- gtk_widget_grab_focus (child);
- }
- else
- {
- g_warning ("Need to realize the embed before grabbing focus!\n");
- }
-}
-
-static void
impl_close (EphyEmbed *embed)
{
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED (embed)->priv;
@@ -223,6 +206,19 @@ mozilla_embed_size_allocate (GtkWidget *widget,
}
static void
+mozilla_embed_grab_focus (GtkWidget *widget)
+{
+ GtkWidget *child;
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+
+ if (child && GTK_WIDGET_REALIZED (child))
+ gtk_widget_grab_focus (child);
+ else
+ g_warning ("Need to realize the embed before grabbing focus!\n");
+}
+
+static void
mozilla_embed_class_init (MozillaEmbedClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -234,9 +230,9 @@ mozilla_embed_class_init (MozillaEmbedClass *klass)
gtk_object_class->destroy = mozilla_embed_destroy;
- widget_class->grab_focus = mozilla_embed_grab_focus;
widget_class->realize = mozilla_embed_realize;
widget_class->size_allocate = mozilla_embed_size_allocate;
+ widget_class->grab_focus = mozilla_embed_grab_focus;
g_type_class_add_private (object_class, sizeof(MozillaEmbedPrivate));
}
diff --git a/embed/webkit/webkit-embed.cpp b/embed/webkit/webkit-embed.cpp
index 63457dfe1..cbd9bb8ed 100644
--- a/embed/webkit/webkit-embed.cpp
+++ b/embed/webkit/webkit-embed.cpp
@@ -88,11 +88,6 @@ G_DEFINE_TYPE_WITH_CODE (WebKitEmbed, webkit_embed, EPHY_TYPE_BASE_EMBED,
ephy_command_manager_iface_init))
static void
-webkit_embed_grab_focus (GtkWidget *widget)
-{
-}
-
-static void
impl_close (EphyEmbed *embed)
{
gtk_widget_destroy (GTK_WIDGET (embed));
@@ -194,8 +189,6 @@ webkit_embed_class_init (WebKitEmbedClass *klass)
gtk_object_class->destroy = webkit_embed_destroy;
- widget_class->grab_focus = webkit_embed_grab_focus;
-
g_type_class_add_private (object_class, sizeof(WebKitEmbedPrivate));
}