Ticket #128: 0214-Modified-the-dbus-add_tab-function-to-accept-a-strin.patch

File 0214-Modified-the-dbus-add_tab-function-to-accept-a-strin.patch, 4.0 KB (added by bsteinfeld, 4 years ago)

The patch file formatted by git-format-patch

  • src/dbusiface.py

    From adba792d6664434f461847cbd12c1496af80ff62 Mon Sep 17 00:00:00 2001
    From: Bradley Steinfeld <bradley@bradley-server.(none)>
    Date: Fri, 3 Apr 2009 07:50:34 -0400
    Subject: [GUAKE PATCH 214/214] Modified the dbus add_tab function to accept a string parameter
     denoting the initial directory of said new tab.
     This change is partially hacked (I originally made these
     changes on an old version of guake which had different parameters
     for the "add_tab" function. Thus when I migrated my code to V4.0
     I simply used a instance variable to pass the data), but seems
     to be working!
    
    This is a useful change because it allows the enduser to open
    a new tab on a specific folder via dbus. For example, one now
    has the ability to add an action in Nautilus which opens a
    new tab in Nautilus' current directory (like similar
    functionality for gnome terminal).
    
    Signed-off-by: Bradley Steinfeld <bradley@bsteinfeld.com>
    ---
    :100644 100644 ddc966a... 6750070... M	src/dbusiface.py
    :100644 100644 a71cb04... 1cb564b... M	src/guake.py
     src/dbusiface.py |   10 ++++++++--
     src/guake.py     |   17 ++++++++++++-----
     2 files changed, 20 insertions(+), 7 deletions(-)
    
    diff --git a/src/dbusiface.py b/src/dbusiface.py
    index ddc966a..6750070 100644
    a b  
    3636    def show_hide(self): 
    3737        self.guake.show_hide() 
    3838 
    39     @dbus.service.method('org.gnome.Guake.DBusInterface') 
    40     def add_tab(self): 
     39    @dbus.service.method('org.gnome.Guake.DBusInterface', in_signature='s', out_signature='') 
     40    def add_tab(self, directory): 
     41        self.guake.directory = directory 
    4142        self.guake.add_tab() 
     43        #self.guake.term_list[last_added].feed_child('cd ' + directory + '\n') 
     44 
     45        if not self.guake.window.get_property('visible'): 
     46            self.guake.show() 
     47            self.guake.set_terminal_focus() 
    4248 
    4349    @dbus.service.method('org.gnome.Guake.DBusInterface') 
    4450    def show_about(self): 
  • src/guake.py

    diff --git a/src/guake.py b/src/guake.py
    index a71cb04..1cb564b 100644
    a b  
    114114        """If the gconf var show_resizer be changed, this method will 
    115115        be called and will show/hide the resizer. 
    116116        """ 
    117         if entry.value.get_bool(): 
     117        if entry.value == None or entry.value.get_bool(): 
    118118            self.guake.resizer.show() 
    119119        else: 
    120120            self.guake.resizer.hide() 
     
    194194        default or to the choosen font in style/font/style in all 
    195195        terminals open. 
    196196        """ 
    197         if entry.value.get_bool(): 
     197        if entry.value == None or entry.value.get_bool(): 
    198198            key = GNOME_FONT_PATH 
    199199        else: 
    200200            key = KEY('/style/font/style') 
     
    300300 
    301301        keys = ['toggle_fullscreen', 'new_tab', 'close_tab', 'rename_tab', 
    302302                'previous_tab', 'next_tab', 'clipboard_copy', 'clipboard_paste', 
    303                 'quit', 
    304                 ] 
     303                'quit'] 
    305304        for key in keys: 
    306305            notify_add(LKEY(key), self.reload_accelerators) 
    307306            self.client.notify(LKEY(key)) 
     
    527526        # holds the timestamp of the losefocus event 
    528527        self.losefocus_time = 0 
    529528 
     529        # Keeps track of new directory to open to 
     530        self.directory = None 
     531 
    530532        # double click stuff 
    531533        def double_click(hbox, event): 
    532534            """Handles double clicks on tabs area and when receive 
     
    918920        if login_shell: 
    919921            params['argv'] = ['-'] 
    920922 
    921         params['directory'] = self.get_current_dir() 
     923        if self.directory == None: 
     924            params['directory'] = self.get_current_dir() 
     925        else: 
     926            params['directory'] = self.directory 
     927            self.directory = None 
     928 
    922929        params['loglastlog'] = login_shell 
    923930 
    924931        return params