diff options
author | Joshua Lock <josh@linux.intel.com> | 2012-03-20 09:50:15 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-22 14:40:40 +0000 |
commit | c9202eb042672237d30c66acb159c2b6b77d07f3 (patch) | |
tree | c63f469b293dc8158679f813863bd49ec9997317 /bitbake/lib/bb | |
parent | b6817986df45c4064fdd311aa4f5152b4462b18a (diff) | |
download | poky-c9202eb042672237d30c66acb159c2b6b77d07f3.tar.gz |
ui/crumbs/hobwidget: add clear icon to search entries in HobNotebook
It's a common pattern on Gtk+ desktops to be able to clear a search/filter
entry using an icon in that entry.
(From Poky rev: 6394283522ef2f259397d8bd294291fb20354c8b)
(Bitbake rev: f55372d542995fd0797b11f42dcfdbe57858449a)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobwidget.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py index 4b0a0cf808..db52c47415 100644 --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py | |||
@@ -622,6 +622,8 @@ class HobNotebook(gtk.VBox): | |||
622 | self.search.set_style(style) | 622 | self.search.set_style(style) |
623 | self.search.set_text(name) | 623 | self.search.set_text(name) |
624 | self.search.set_editable(False) | 624 | self.search.set_editable(False) |
625 | self.search.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, gtk.STOCK_CLEAR) | ||
626 | self.search.connect("icon-release", self.set_search_entry_clear_cb) | ||
625 | self.search.show() | 627 | self.search.show() |
626 | self.align = gtk.Alignment(xalign=1.0, yalign=0.7) | 628 | self.align = gtk.Alignment(xalign=1.0, yalign=0.7) |
627 | self.align.add(self.search) | 629 | self.align.add(self.search) |
@@ -682,9 +684,16 @@ class HobNotebook(gtk.VBox): | |||
682 | style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.BLACK, False, False) | 684 | style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.BLACK, False, False) |
683 | search.set_style(style) | 685 | search.set_style(style) |
684 | 686 | ||
685 | def set_search_entry_reset_cb(self, search, event): | 687 | def reset_entry(self, entry): |
686 | style = search.get_style() | 688 | style = entry.get_style() |
687 | style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.GRAY, False, False) | 689 | style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.GRAY, False, False) |
688 | search.set_style(style) | 690 | entry.set_style(style) |
689 | search.set_text(self.search_name) | 691 | entry.set_text(self.search_name) |
690 | search.set_editable(False) | 692 | entry.set_editable(False) |
693 | |||
694 | def set_search_entry_reset_cb(self, search, event): | ||
695 | self.reset_entry(search) | ||
696 | |||
697 | def set_search_entry_clear_cb(self, search, icon_pos, event): | ||
698 | self.reset_entry(search) | ||
699 | |||