Changeset a6068db7e023b88f35bcb5c41159c2bcef246390

Show
Ignore:
Timestamp:
06/16/08 00:02:58 (4 years ago)
Author:
Lincoln de Sousa <lincoln@…>
Children:
7ac816be36549bf563542b5505c34892ded445eb
Parents:
34f52bf2edf0226b779ae8c1da93df18c630233e
git-committer:
Lincoln de Sousa <lincoln@…> (06/16/08 00:02:58)
Message:

making the preferences treeview grab the focus and start editing
the cell with the keybinding

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/guake.py

    r34f52bf ra6068db  
    118118        treeview.set_model(model) 
    119119        treeview.set_rules_hint(True) 
     120        treeview.connect('button-press-event', self.start_editing_cb) 
    120121 
    121122        renderer = gtk.CellRendererText() 
     
    425426            file_chooser.set_preview_widget_active(False) 
    426427 
     428    def start_editing_cb(self, treeview, event): 
     429        """Make the treeview grab the focus and start editing the cell 
     430        that the user has clicked to avoid confusion with two or three 
     431        clicks before editing a keybinding. 
     432 
     433        Thanks to gnome-keybinding-properties.c =) 
     434        """ 
     435        if event.window != treeview.get_bin_window(): 
     436            return False 
     437 
     438        x, y = int(event.x), int(event.y) 
     439        path, column, cellx, celly = treeview.get_path_at_pos(x, y) 
     440        if path and len(path) > 1: 
     441            def real_cb(): 
     442                treeview.grab_focus() 
     443                treeview.set_cursor(path, column, True) 
     444            treeview.stop_emission('button-press-event') 
     445            gobject.idle_add(real_cb) 
     446 
     447        return True 
    427448 
    428449class Guake(SimpleGladeApp):