[hamster-applet] Add clear icon and change behavior of search entry. Fixes bug 617838.
- From: Toms Baugis <tbaugis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hamster-applet] Add clear icon and change behavior of search entry. Fixes bug 617838.
- Date: Sat, 8 May 2010 12:25:00 +0000 (UTC)
commit 7838fea29fcb83eb5757f524f15cad20981464b3
Author: Rodolphe Pelloux-Prayer <rodolphe damsy net>
Date: Sat May 8 10:59:57 2010 +0200
Add clear icon and change behavior of search entry. Fixes bug 617838.
data/overview.ui | 10 ++++++----
src/hamster/overview.py | 8 +++++++-
2 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/data/overview.ui b/data/overview.ui
index dc93e27..89e209f 100644
--- a/data/overview.ui
+++ b/data/overview.ui
@@ -4,7 +4,7 @@
<!-- interface-naming-policy project-wide -->
<!-- interface-local-resource-path /home/toms/cvs/hamster/data/art -->
<object class="GtkWindow" id="tabs_window">
- <property name="title" translatable="yes">Overview â?? Hamster</property>
+ <property name="title" translatable="yes">Overview — Hamster</property>
<property name="default_width">800</property>
<property name="default_height">600</property>
<signal name="configure_event" handler="on_tabs_window_configure_event"/>
@@ -238,10 +238,12 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">•</property>
- <property name="secondary_icon_stock">gtk-find</property>
+ <property name="primary_icon_stock">gtk-find</property>
+ <property name="secondary_icon_stock">gtk-clear</property>
+ <property name="secondary_icon_activatable">True</property>
<property name="primary_icon_sensitive">True</property>
- <property name="secondary_icon_sensitive">True</property>
- <signal name="activate" handler="on_search_activate"/>
+ <signal name="changed" handler="on_search_changed"/>
+ <signal name="icon_press" handler="on_search_icon_press"/>
</object>
</child>
</object>
diff --git a/src/hamster/overview.py b/src/hamster/overview.py
index 9e8b6c2..ede1847 100644
--- a/src/hamster/overview.py
+++ b/src/hamster/overview.py
@@ -200,7 +200,13 @@ class Overview(object):
def after_activity_update(self, widget):
self.search()
- def on_search_activate(self, widget):
+ def on_search_icon_press(self, widget, position, data):
+ if position == gtk.ENTRY_ICON_SECONDARY:
+ widget.set_text('')
+
+ def on_search_changed(self, widget):
+ has_text = widget.get_text_length() > 0
+ widget.set_icon_sensitive(gtk.ENTRY_ICON_SECONDARY, has_text)
self.search()
def on_report_button_clicked(self, widget):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]