[postr] Clean up the code that manage the image selector



commit 2dc0cd883354ef434f4d16291dff8f2c80145579
Author: Francisco Rojas <frojas alumnos utalca cl>
Date:   Wed Nov 11 13:21:26 2009 -0300

    Clean up the code that manage the image selector
    
    Replace on_double_click_selection() and on_return_key_selection()
    for on_row_activated, which produces exactly the same result.
    
    Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>

 src/postr.py |   22 +++++-----------------
 1 files changed, 5 insertions(+), 17 deletions(-)
---
diff --git a/src/postr.py b/src/postr.py
index 788362e..6fce813 100644
--- a/src/postr.py
+++ b/src/postr.py
@@ -122,13 +122,9 @@ class Postr(UniqueApp):
         selection = self.thumbview.get_selection()
         selection.connect("changed", self.on_selection_changed)
 
-        self.thumbview.connect("button_press_event",
-                               self.on_double_click_selection,
+        self.thumbview.connect("row-activated",
+                               self.on_row_activated,
                                self.title_entry)
-        self.thumbview.connect("key-press-event",
-                               self.on_return_key_selection,
-                               self.title_entry)
-
         if has_gtkspell:
           gtkspell.Spell(self.desc_view)
 
@@ -940,18 +936,10 @@ class Postr(UniqueApp):
             d.addCallback(self.set_license, license)
         d.addCallbacks(self.upload, self.upload_error)
 
-    def on_double_click_selection(self, tree ,event, entry):
-        """This callback is used to focus the entry title after a
-           double click on one image."""
-        if event.type == gtk.gdk._2BUTTON_PRESS:
-            entry.grab_focus()
-
-    def on_return_key_selection(self, tree ,event, entry):
+    def on_row_activated(self, treeview, iter, path, entry):
         """This callback is used to focus the entry title after
-           Return key is pressed on the image list."""
-        if event.type == gtk.gdk.KEY_PRESS and \
-           event.keyval == gtk.keysyms.Return:
-            entry.grab_focus()
+            one row is activated."""
+        entry.grab_focus()
 
     def save_upload_set(self):
         dialog = gtk.FileChooserDialog(title=None,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]