After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668702 - Bring back Alt+# accelerators.
Bring back Alt+# accelerators.
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Tabs
3.3.x
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-26 01:09 UTC by Diego Escalante Urrelo (not reading bugmail)
Modified: 2012-01-31 18:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ephy-window: restore alt+# accels to switch tabs (5.80 KB, patch)
2012-01-27 04:11 UTC, Diego Escalante Urrelo (not reading bugmail)
reviewed Details | Review
ephy-window: restore alt+# accels to switch tabs (3.78 KB, patch)
2012-01-30 21:52 UTC, Diego Escalante Urrelo (not reading bugmail)
reviewed Details | Review
ephy-window: restore alt+# accels to switch tabs (4.54 KB, patch)
2012-01-31 17:39 UTC, Diego Escalante Urrelo (not reading bugmail)
none Details | Review
ephy-window: restore alt+# accels to switch tabs (4.26 KB, patch)
2012-01-31 17:58 UTC, Diego Escalante Urrelo (not reading bugmail)
accepted-commit_now Details | Review
ephy-window: restore alt+# accels to switch tabs (4.26 KB, patch)
2012-01-31 18:15 UTC, Diego Escalante Urrelo (not reading bugmail)
committed Details | Review

Description Diego Escalante Urrelo (not reading bugmail) 2012-01-26 01:09:39 UTC
Switching tabs can be really frustrating without accelerators.

I understand Web wants to remove the visual clutter of tabs, but the Alt+# accelerators would still be useful as a power-user feature.

Any objection? I would like to bring this back using the relevant parts removed in:

commit fdf7054db6d84b554b3ea52ed60d065f211765e0
Author: Xan Lopez <xan@igalia.com>
Date:   Mon Dec 5 00:21:40 2011 +0100

    ephy-window: remove the tabs menu
    
    It is not present in the new design. The Alt+<num> accelerators are
    dying with it, but it will be pretty easy to bring them back if
    needed.
Comment 1 Xan Lopez 2012-01-26 09:37:40 UTC
Sure, go ahead.
Comment 2 Diego Escalante Urrelo (not reading bugmail) 2012-01-27 04:11:10 UTC
Created attachment 206238 [details] [review]
ephy-window: restore alt+# accels to switch tabs

Based on code from gedit-window.c, create a GtkAction for each tab from
1 to 10.
Comment 3 Xan Lopez 2012-01-30 19:17:56 UTC
Review of attachment 206238 [details] [review]:

I don't think we want a GtkRadioAction or any of the idle stuff here. This won't have any UI, you just want 10 pure accels. Or am I missing something?
Comment 4 Diego Escalante Urrelo (not reading bugmail) 2012-01-30 21:52:51 UTC
Created attachment 206474 [details] [review]
ephy-window: restore alt+# accels to switch tabs

Create 10 fixed GtkActions that react to the alt+# accelerators.
Based on code from gedit-window.c.

=

Much simpler approach following comments on jabber.

My comments:
 - do I /need/ something like destroy_tab_accels()? Other groups don't do it.
 - atoi() is safe enough, right?
 - should I move this to setup_ui_manager()?
 - GtkNotebook does nothing if the page requested doesn't exist.

What do you think now?
Comment 5 Xan Lopez 2012-01-31 12:19:50 UTC
Review of attachment 206474 [details] [review]:

::: src/ephy-window.c
@@ +1321,3 @@
+	/* Tab accels */
+	action_group = gtk_action_group_new ("TabAccelsActions");
+	gtk_action_group_set_translation_domain (action_group, NULL);

Isn't NULL the default?

@@ +2962,3 @@
+
+	gtk_notebook_set_current_page (priv->notebook, tab_number);
+}

I think it's much safer to have a small method that updates the sensitivity of the actions when you add/remove a tab, based on the number of tabs. Relying on GtkNotebook silently doing nothing seems a bit adventurous.

@@ +2973,3 @@
+	id = gtk_ui_manager_new_merge_id (priv->manager);
+
+	for (i = 0; i < 10; i++)

a #define instead of just '10', since yo use it in more than one place.

@@ +3018,3 @@
+
+	g_list_free (actions);
+}

I think since you add the action group to the UI manager you probably don't need to do this. Either that or we are leaking everything in EphyWindow currently...
Comment 6 Diego Escalante Urrelo (not reading bugmail) 2012-01-31 17:39:14 UTC
Created attachment 206535 [details] [review]
ephy-window: restore alt+# accels to switch tabs

Create 10 fixed GtkActions that react to the alt+# accelerators.
Based on code from gedit-window.c.

=

Updated for comments.
Comment 7 Diego Escalante Urrelo (not reading bugmail) 2012-01-31 17:58:34 UTC
Created attachment 206536 [details] [review]
ephy-window: restore alt+# accels to switch tabs

Create 10 fixed GtkActions that react to the alt+# accelerators.
Based on code from gedit-window.c.

=

Updated yet again with Xan comments.
Comment 8 Xan Lopez 2012-01-31 18:02:35 UTC
Review of attachment 206536 [details] [review]:

Looks good to me, two nitpicks.

::: src/ephy-window.c
@@ +2525,3 @@
+	actions = gtk_action_group_list_actions (priv->tab_accels_action_group);
+	pages = gtk_notebook_get_n_pages (priv->notebook);
+	i = 0;

Initialize it when you declare it?

@@ +2532,3 @@
+		gtk_action_set_sensitive (action, (i < pages));
+		i++;
+	}

I like an empty line here, silly detail.
Comment 9 Diego Escalante Urrelo (not reading bugmail) 2012-01-31 18:15:45 UTC
Created attachment 206538 [details] [review]
ephy-window: restore alt+# accels to switch tabs

Create 10 fixed GtkActions that react to the alt+# accelerators.
Based on code from gedit-window.c.

=

Nitpicks solved!
Comment 10 Diego Escalante Urrelo (not reading bugmail) 2012-01-31 18:34:49 UTC
Attachment 206538 [details] pushed as 9ead439 - ephy-window: restore alt+# accels to switch tabs