[d-feet] Pressing "Enter" in the add connection combobox activates the connect action



commit d269ceacc92276b160a7e5ba8f9e458962af2234
Author: Florent Viard <fviard lacie com>
Date:   Thu Sep 16 10:34:19 2010 -0400

    Pressing "Enter" in the add connection combobox activates the connect action

 dfeet/_ui/addconnectiondialog.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/dfeet/_ui/addconnectiondialog.py b/dfeet/_ui/addconnectiondialog.py
index 83d78f7..8ad74a7 100644
--- a/dfeet/_ui/addconnectiondialog.py
+++ b/dfeet/_ui/addconnectiondialog.py
@@ -2,14 +2,18 @@ import gtk
 from uiloader import UILoader
 
 class AddConnectionDialog:
+    RESPONSE_CANCEL = -1
+    RESPONSE_CONNECT = 1
+
     def __init__(self, parent):
         ui = UILoader(UILoader.UI_ADDCONNECTIONDIALOG) 
 
         self.dialog = ui.get_root_widget()
         self.combo_entry = ui.get_widget('address_comboentry1')
         
-        self.dialog.add_button('gtk-cancel', -1)
-        self.dialog.add_button('gtk-connect', 1)
+        self.combo_entry.get_child().connect('activate', self.activate_combo)
+        self.dialog.add_button('gtk-cancel', self.RESPONSE_CANCEL)
+        self.dialog.add_button('gtk-connect', self.RESPONSE_CONNECT)
 
     def get_address(self):
         return self.combo_entry.get_active_text()
@@ -20,3 +24,7 @@ class AddConnectionDialog:
     def destroy(self):
         self.dialog.destroy()
 
+    def activate_combo(self, user_data):
+        self.dialog.response(self.RESPONSE_CONNECT)
+        return True
+



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