[epiphany] notebook: Reset activated radio item when rebuilding menu
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] notebook: Reset activated radio item when rebuilding menu
- Date: Sat, 11 Feb 2017 16:03:42 +0000 (UTC)
commit b66c1974ad7cc2f96d65e09be94cf17809b743c5
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sat Feb 11 10:02:39 2017 -0600
notebook: Reset activated radio item when rebuilding menu
This ensures the right radio item is active after closing the first tab
in the notebook.
src/ephy-notebook.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 88478eb..47ab34b 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -560,6 +560,10 @@ ephy_notebook_rebuild_tab_menu (EphyNotebook *notebook)
const char *text;
char *ellipsized_text;
int num_pages;
+ GtkWidget *window;
+ GActionGroup *group;
+ GAction *action;
+ gint current_page;
g_menu_remove_all (notebook->tab_menu);
@@ -575,6 +579,15 @@ ephy_notebook_rebuild_tab_menu (EphyNotebook *notebook)
g_free (ellipsized_text);
g_object_unref (item);
}
+
+ current_page = gtk_notebook_get_current_page (notebook);
+ if (current_page < 0)
+ return;
+
+ window = gtk_widget_get_toplevel (GTK_WIDGET (notebook));
+ group = gtk_widget_get_action_group (window, "win");
+ action = g_action_map_lookup_action (G_ACTION_MAP (group), "show-tab");
+ g_simple_action_set_state (G_SIMPLE_ACTION (action), g_variant_new_uint32 ((guint32)current_page));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]