Ticket #121: 0001-Allow-copying-of-links-by-right-click-Copy.patch

File 0001-Allow-copying-of-links-by-right-click-Copy.patch, 1.8 KB (added by SnapShot, 3 years ago)
  • src/guake.py

    From 250dff377ec23bbaf3a649192211ffda7a67d7cf Mon Sep 17 00:00:00 2001
    From: Aleksandar Krsteski <alekrsteski@gmail.com>
    Date: Tue, 17 Mar 2009 22:10:29 +0100
    Subject: [PATCH 1/2] Allow copying of links by right-click -> Copy.
    
    ---
     src/guake.py |   14 +++++++++++---
     1 files changed, 11 insertions(+), 3 deletions(-)
    
    diff --git a/src/guake.py b/src/guake.py
    index e3765fc..1ebc6f4 100644
    a b  
    415415        any match string is caught, another aplication is open to 
    416416        handle the matched resource uri. 
    417417        """ 
     418        self.matched_value = '' 
    418419        matched_string = self.match_check( 
    419420            int(event.x / self.get_char_width()), 
    420421            int(event.y / self.get_char_height())) 
     
    436437            # I'm temporarely using this little hammer because 
    437438            # gtk_show_uri seem to not be binded to python yet. 
    438439            open_uri(value) 
    439  
     440        elif event.button == 3 and matched_string: 
     441            self.matched_value = matched_string[0] 
    440442 
    441443class GuakeTerminalBox(gtk.HBox): 
    442444    """A box to group the terminal and a scrollbar. 
     
    790792        """Callback to copy text in the shown terminal. Called by the 
    791793        accel key. 
    792794        """ 
    793         pos = self.notebook.get_current_page() 
    794         self.term_list[pos].copy_clipboard() 
     795        current_term = self.term_list[self.notebook.get_current_page()] 
     796 
     797        if current_term.get_has_selection(): 
     798            current_term.copy_clipboard() 
     799        elif current_term.matched_value: 
     800            guake_clipboard = gtk.clipboard_get() 
     801            guake_clipboard.set_text(current_term.matched_value) 
     802 
    795803        return True 
    796804 
    797805    def accel_paste_clipboard(self, *args):