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 583690 - Setting keyboard shortcuts via mandatory gconf settings no longer works
Setting keyboard shortcuts via mandatory gconf settings no longer works
Status: RESOLVED FIXED
Product: gnome-terminal
Classification: Core
Component: Keybindings
git master
Other All
: Normal normal
: gnome-2-28
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-05-24 00:37 UTC by Josh Triplett
Modified: 2009-07-24 22:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GNOME_TERMINAL_DEBUG=accels gnome-terminal --disable-factory > gnome-terminal-debug-accels 2>&1 (4.56 KB, text/plain)
2009-06-16 01:00 UTC, Josh Triplett
Details

Description Josh Triplett 2009-05-24 00:37:08 UTC
Please describe the problem:
Since upgrading to gnome-terminal 2.24, my custom keyboard shortcuts for
new tab, next tab, and previous tab no longer work.

I don't know whether the fault lies with the new gnome-terminal, the new
gconf, or some interaction between the two; since the new gnome-terminal
requires the new gconf I can't easily test them in isolation.

Steps to reproduce:
The following steps will recreate the problem starting from a new user
account:

1) Create the file ~/.gconf.path, containing the following line:

xml:readonly:$(HOME)/.gconf.shared

2) Create the directory ~/.gconf.shared.

3) Create the file ~/.gconf.shared/%gconf-tree.xml, containing the
   following XML:

<?xml version="1.0"?>
<gconf>
        <dir name="apps">
                <dir name="gnome-terminal">
                        <dir name="keybindings">
                                <entry name="prev_tab" mtime="1202977397" type="string">
                                        <stringvalue>&lt;Alt&gt;Left</stringvalue>
                                </entry>
                                <entry name="next_tab" mtime="1202977397" type="string">
                                        <stringvalue>&lt;Alt&gt;Right</stringvalue>
                                </entry>
                                <entry name="new_tab" mtime="1202977397" type="string">
                                        <stringvalue>&lt;Control&gt;&lt;Alt&gt;n</stringvalue>
                                </entry>
                                <entry name="help" mtime="1202977397" type="string">
                                        <stringvalue>disabled</stringvalue>
                                </entry>
                        </dir>
                </dir>
        </dir>
</gconf>

4) Log out and log back in.

5) Start gnome-terminal.

6) Press Ctrl-Alt-n, which should open a new tab.  No new tab opens.

7) Open a new tab manually through the menu.  Press Alt-Left, which should
   switch back to the previous tab; it does not.

8) Look in the Tabs menu, and notice that "Next Tab" and "Previous Tab" have no
   keyboard shortcuts listed next to them.


Actual results:


Expected results:


Does this happen every time?
Yes, I can consistently reproduce this.

Other information:
Comment 1 Christian Persch 2009-05-24 11:12:09 UTC
2.24 is outdated; please try 2.26.

Your step 3 is rather strange; normally one doesn't set gconf settings this way. What's the output of this command:

gconftool-2 -R /apps/gnome-terminal/keybindings

?

If the keybindings editor shows no shortcut assigned for these actions, that means the settings could not be read from gconf.
Comment 2 Josh Triplett 2009-05-24 23:22:57 UTC
Debian doesn't have 2.26 yet, and I don't want to install GNOME apps outside the packaging system.

I originally set the settings in ~/.gconf.shared via gconftool-2; it just seemed easier for the purposes of reproducing the problem to give the relevant contents of the file. gconftool-2 shows the expected values for new_tab, next_tab, and prev_tab:

$ gconftool-2 -R /apps/gnome-terminal/keybindings | sort
 close_tab = <Ctrl><Shift>w
 close_window = <Ctrl><Shift>q
 copy = <Ctrl><Shift>c
 detach_tab = disabled
 full_screen = F11
 help = disabled
 move_tab_left = <Ctrl><Shift>Page_Up
 move_tab_right = <Ctrl><Shift>Page_Down
 new_profile = (no value set)
 new_tab = <Control><Alt>n
 new_window = <Ctrl><Shift>n
 next_tab = <Alt>Right
 paste = <Ctrl><Shift>v
 prev_tab = <Alt>Left
 reset = (no value set)
 reset_and_clear = (no value set)
 set_terminal_title = (no value set)
 switch_to_tab_1 = <Alt>1
 switch_to_tab_10 = (no value set)
 switch_to_tab_11 = (no value set)
 switch_to_tab_12 = (no value set)
 switch_to_tab_2 = <Alt>2
 switch_to_tab_3 = <Alt>3
 switch_to_tab_4 = <Alt>4
 switch_to_tab_5 = <Alt>5
 switch_to_tab_6 = <Alt>6
 switch_to_tab_7 = <Alt>7
 switch_to_tab_8 = <Alt>8
 switch_to_tab_9 = <Alt>9
 toggle_menubar = (no value set)
 zoom_in = <Ctrl>plus
 zoom_normal = <Ctrl>0
 zoom_out = <Ctrl>minus
Comment 3 Christian Persch 2009-06-10 13:12:15 UTC
Please try this again once you've upgraded to gnome 2.26.x's versions of vte, gnome-terminal and gconf, and re-open the bug if it's still reproducible.
Comment 4 Josh Triplett 2009-06-11 07:31:00 UTC
(In reply to comment #3)
> Please try this again once you've upgraded to gnome 2.26.x's versions of vte,
> gnome-terminal and gconf, and re-open the bug if it's still reproducible.

I just upgraded to gnome-terminal from 2.26 (Debian package 2.26.2-1).  I already had 2.26 versions of the other bits.

I can still reproduce this problem.  The keyboard shortcuts for new tab, next tab, and previous tab do not work after upgrading.  Yet the keyboard shortcuts dialog shows each of those keyboard shortcuts set to the key I configured via gconf, grayed out and disabled because I've effectively set them as mandatory settings.

Reopening the bug.
Comment 5 Christian Persch 2009-06-15 10:29:51 UTC
Hmm. Please re-build the g-t package configuring it with --enable-debug, then run g-t from an xterm like this:

GNOME_TERMINAL_DEBUG=accels gnome-terminal --disable-factory

and attach the debug output that this should produce.
Comment 6 Josh Triplett 2009-06-16 01:00:06 UTC
(In reply to comment #5)
> Hmm. Please re-build the g-t package configuring it with --enable-debug, then
> run g-t from an xterm like this:
> 
> GNOME_TERMINAL_DEBUG=accels gnome-terminal --disable-factory
> 
> and attach the debug output that this should produce.

Done.  Attaching...
Comment 7 Josh Triplett 2009-06-16 01:00:44 UTC
Created attachment 136682 [details]
GNOME_TERMINAL_DEBUG=accels gnome-terminal --disable-factory > gnome-terminal-debug-accels 2>&1
Comment 8 Josh Triplett 2009-06-29 01:17:27 UTC
Ping?  Any more information I can provide to help with this bug?
Comment 9 Christian Persch 2009-06-29 12:03:22 UTC
The debug output is exactly as expected, no difference what I get hereto (except as expected, where using different key combinations, of course). 
And changing the accels to ones from comment 0 works here.

So I have no idea why it wouldn't work on your system.
Comment 10 Josh Triplett 2009-07-02 16:19:47 UTC
Do the steps I described to reproduce the problem starting from a new user account work for you?
Comment 11 Josh Triplett 2009-07-02 16:50:34 UTC
I just tried a few experiments with 2.26, and I managed to find another useful detail.  If I remove the mandatory entries for keybindings from my .gconf.shared, I can then set the keybindings via gnome-terminal's keybindings dialog, and those keybindings work.  However, if I then put the mandatory entries back, the keybindings no longer work, even though "gconftool-2 -R /apps/gnome-terminal" gives *exactly* the same output either way.  It seems likely that gnome-terminal has some problem with mandatory entries for keybindings.
Comment 12 Josh Triplett 2009-07-02 16:53:14 UTC
Also, on a hopefully unrelated note: while reviewing the code in src/terminal-accels.c, I noticed this interesting bug:

static const char *
key_from_gconf_key (const char *gconf_key)
{
  const char *last_slash = strrchr (gconf_key, '/');
  if (last_slash)
    return last_slash++;
  return NULL;
}

last_slash++ doesn't do anything useful here.  Perhaps you wanted last_slash + 1?
Comment 13 Josh Triplett 2009-07-02 17:07:27 UTC
OK, I managed to track down the problem to this code in terminal-accels.c, in the keys_change_notify function:

  gconf_writable = gconf_entry_get_is_writable (entry);
  if (gconf_writable != key_entry->gconf_writable)
    {
      if (gconf_writable)
        gtk_accel_map_unlock_path (key_entry->accel_path);
      else
        gtk_accel_map_lock_path (key_entry->accel_path);
    }
  key_entry->gconf_writable = gconf_writable;

Here, if gconf_entry_get_is_writable returns false, keys_change_notify calls gtk_accel_map_lock_path.  keys_change_notify then later calls gtk_accel_map_change_entry to set the keybinding.  However, gtk_accel_map_change_entry will do nothing with the path locked.

To test this, I put an #if 0 block around the if shown above, preventing the calls to gtk_accel_map_lock_path.  The resulting gnome-terminal handled my mandatory keybindings just fine.
Comment 14 Josh Triplett 2009-07-21 00:31:24 UTC
Clarifying summary based on this new information.
Comment 15 Christian Persch 2009-07-22 16:26:41 UTC
Should be fixed on git master.
Comment 16 Josh Triplett 2009-07-23 05:04:29 UTC
(In reply to comment #15)
> Should be fixed on git master.

Awesome!  Thanks for the fix.

(For later cross-reference purposes: looks like the fix occurred in git commit b43fcdfd20c6eb4f972333080a435ba8567cc6fa)