Zim

Comment 5 for bug 134736

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Code below can be added in "zim/gui/__init__.py" just below the call "self.uimanager.ensure_update()" (around line 540) and will add a search entry in the toolbar. In my mind this removes the need for adding search to the side pane, but open to suggestions.

  ###
  space = gtk.SeparatorToolItem()
  space.set_draw(False)
  space.set_expand(True)
  self.mainwindow.toolbar.insert(space, -1)

  def inline_search(entry, *a):
   text = entry.get_text()
   if text:
    self.show_search(text)

  from zim.gui.widgets import InputEntry
  entry = InputEntry()
  if gtk.gtk_version >= (2, 16):
   entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, gtk.STOCK_FIND)
   entry.set_icon_activatable(gtk.ENTRY_ICON_SECONDARY, True)
   entry.set_icon_tooltip_text(gtk.ENTRY_ICON_SECONDARY, _('Search Pages...'))
  # FIXME would be nice to have function to set "Search" as grey background
  #entry.set_icon_to_clear()
  entry.connect('activate', inline_search)
  entry.connect('icon-release', inline_search)
  entry.show()
  item = gtk.ToolItem()
  item.add(entry)
  self.mainwindow.toolbar.insert(item, -1)
  ###