[gnome-tweak-tool] AppChooser: Add a search button to header-bar



commit ebc6b70d7d48ec00cc07cc4c6581c3b05bb3955d
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Mon Apr 27 18:30:23 2015 +0100

    AppChooser: Add a search button to header-bar
    
    This gives a visual prompt that it's possible to search the list of
    applications.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747983

 gtweak/tweaks/tweak_group_startup.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_startup.py b/gtweak/tweaks/tweak_group_startup.py
index 142d5a9..3c6840a 100644
--- a/gtweak/tweaks/tweak_group_startup.py
+++ b/gtweak/tweaks/tweak_group_startup.py
@@ -20,7 +20,7 @@ import os.path
 import subprocess
 import logging
 
-from gi.repository import Gtk, Gdk, GLib, Gio
+from gi.repository import Gtk, Gdk, GLib, Gio, GObject
 
 from gtweak.tweakmodel import Tweak
 from gtweak.widgets import ListBoxTweakGroup, UI_BOX_SPACING
@@ -78,6 +78,17 @@ class _AppChooser(Gtk.Dialog):
         self.add_button(_("_Add"), Gtk.ResponseType.OK)
         self.set_default_response(Gtk.ResponseType.OK)
 
+        if self.props.use_header_bar:
+            searchbtn = Gtk.ToggleButton()
+            searchbtn.props.valign = Gtk.Align.CENTER
+            image = Gtk.Image(icon_name = "edit-find-symbolic", icon_size = Gtk.IconSize.MENU)
+            searchbtn.add(image)
+            context = searchbtn.get_style_context()
+            context.add_class("image-button")
+            context.remove_class("text-button")
+            self.get_header_bar().pack_end(searchbtn)
+            self._binding = searchbtn.bind_property("active", self.searchbar, "search-mode-enabled", 
GObject.BindingFlags.BIDIRECTIONAL)
+
         self.get_content_area().pack_start(self.searchbar, False, False, 0)
         self.get_content_area().pack_start(sw, True, True, 0)
         self.set_modal(True)


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