[gnome-clocks] Select a location when pressing "Enter" in the entry
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-clocks] Select a location when pressing "Enter" in the entry
- Date: Sat, 18 Aug 2012 10:13:53 +0000 (UTC)
commit 7230c7f556b35c36d718f662624a8c483945534b
Author: Paolo Borelli <pborelli gnome org>
Date: Sat Aug 18 12:07:15 2012 +0200
Select a location when pressing "Enter" in the entry
Also use set_response_sensitive instead of manually getting the widget
gnomeclocks/widgets.py | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/gnomeclocks/widgets.py b/gnomeclocks/widgets.py
index ced2026..5a2d820 100644
--- a/gnomeclocks/widgets.py
+++ b/gnomeclocks/widgets.py
@@ -60,10 +60,11 @@ class NewWorldClockDialog(Gtk.Dialog):
'edit-clear-symbolic')
self.searchEntry.set_icon_from_gicon(
Gtk.EntryIconPosition.SECONDARY, self.find_gicon)
+ self.searchEntry.set_activates_default(True)
self.add_buttons(_("Cancel"), 0, _("Add"), 1)
- widget = self.get_widget_for_response(1)
- widget.set_sensitive(False)
+ self.set_default_response(1)
+ self.set_response_sensitive(1, False)
box.pack_start(self.label, False, False, 6)
box.pack_start(self.searchEntry, False, False, 3)
@@ -85,7 +86,6 @@ class NewWorldClockDialog(Gtk.Dialog):
def _set_city(self, widget):
location = self.searchEntry.get_location()
- widget = self.get_widget_for_response(1)
if self.searchEntry.get_text() == '':
self.searchEntry.set_icon_from_gicon(
Gtk.EntryIconPosition.SECONDARY, self.find_gicon)
@@ -93,9 +93,9 @@ class NewWorldClockDialog(Gtk.Dialog):
self.searchEntry.set_icon_from_gicon(
Gtk.EntryIconPosition.SECONDARY, self.clear_gicon)
if location:
- widget.set_sensitive(True)
+ self.set_response_sensitive(1, True)
else:
- widget.set_sensitive(False)
+ self.set_response_sensitive(1, False)
def get_selection(self):
return self.location
@@ -106,9 +106,7 @@ class NewWorldClockDialog(Gtk.Dialog):
self.searchEntry.set_text('')
self.searchEntry.set_icon_from_gicon(
Gtk.EntryIconPosition.SECONDARY, self.find_gicon)
- widget = self.get_widget_for_response(1)
- widget.set_sensitive(False)
-
+ self.set_response_sensitive(1, False)
class DigitalClock():
def __init__(self, location):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]