aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-01-02 03:51:39 +0800
committerChristian Persch <chpe@src.gnome.org>2005-01-02 03:51:39 +0800
commitd8ef21e4e64809d0c244c6b68701505807620569 (patch)
tree3f8f720a344a28571de003f9dff2ad97a1946b3d /src
parent2a64029e3b463d91bde19fc14e53c34a81d4a1c9 (diff)
downloadgsoc2013-epiphany-d8ef21e4e64809d0c244c6b68701505807620569.tar.gz
gsoc2013-epiphany-d8ef21e4e64809d0c244c6b68701505807620569.tar.zst
gsoc2013-epiphany-d8ef21e4e64809d0c244c6b68701505807620569.zip
Grab focus on the active tab before removing a tab. Fixes bug #119461.
2005-01-01 Christian Persch <chpe@cvs.gnome.org> * src/ephy-notebook.c: (close_button_clicked_cb), (build_tab_label): * src/ephy-tab.c: (ephy_tab_grab_focus), (ephy_tab_class_init): Grab focus on the active tab before removing a tab. Fixes bug #119461.
Diffstat (limited to 'src')
-rw-r--r--src/ephy-notebook.c12
-rw-r--r--src/ephy-tab.c9
2 files changed, 21 insertions, 0 deletions
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index a3cae94cf..fafce396e 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -805,6 +805,15 @@ close_button_clicked_cb (GtkWidget *widget, GtkWidget *tab)
if (inhibited == FALSE)
{
+ GtkNotebook *gnotebook;
+ GtkWidget *active_tab;
+
+ gnotebook = GTK_NOTEBOOK (notebook);
+ active_tab = gtk_notebook_get_nth_page
+ (gnotebook, gtk_notebook_get_current_page (gnotebook));
+ /* focus the active tab, bug #119461 */
+ gtk_widget_grab_focus (active_tab);
+
ephy_notebook_remove_tab (notebook, EPHY_TAB (tab));
}
}
@@ -858,6 +867,9 @@ build_tab_label (EphyNotebook *nb, EphyTab *tab)
close_button = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (close_button),
GTK_RELIEF_NONE);
+ /* don't allow focus on the close button */
+ GTK_WIDGET_SET_FLAGS (close_button, GTK_CAN_FOCUS);
+ GTK_WIDGET_SET_FLAGS (close_button, GTK_CAN_DEFAULT);
close_icon_size = gtk_icon_size_from_name (EPHY_ICON_SIZE_TAB_BUTTON);
image = gtk_image_new_from_stock (EPHY_STOCK_CLOSE_TAB, close_icon_size);
gtk_container_add (GTK_CONTAINER (close_button), image);
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 3d15e36ba..9d42fc982 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -306,6 +306,14 @@ ephy_tab_map (GtkWidget *widget)
GTK_WIDGET_CLASS (parent_class)->map (widget);
}
+static void
+ephy_tab_grab_focus (GtkWidget *widget)
+{
+ EphyTab *tab = EPHY_TAB (widget);
+
+ ephy_embed_activate (ephy_tab_get_embed (tab));
+}
+
static EphyWindow *
ephy_tab_get_window (EphyTab *tab)
{
@@ -348,6 +356,7 @@ ephy_tab_class_init (EphyTabClass *class)
widget_class->size_allocate = ephy_tab_size_allocate;
widget_class->map = ephy_tab_map;
+ widget_class->grab_focus = ephy_tab_grab_focus;
g_object_class_install_property (object_class,
PROP_ADDRESS,