As a first attempt, I created a PopupMenuItem that contains a SearchTab (sure, widths and such are all off but I just want a proof-of-concept to start from):
SearchMenuItem.prototype = { __proto__: PopupMenu.PopupBaseMenuItem.prototype, _init: function () { PopupMenu.PopupBaseMenuItem.prototype._init.call(this, {reactive: false}); /* display a SearchTab inside */ this._searchTab = new ViewSelector.SearchTab(); this.addActor(this._searchTab.title, {expand: true, span: -1}) /* add the search box */ this.addActor(this._searchTab.page, {expand: true, span: -1}) /* add the results page (I think) */ } } Then I add a new SearchMenuItem() to my popup menu and call `searchMenuItem.addSearchProvider(new ContactDisplay.ContactSearchProvider());`. I also set the width of the item to 1000 pixels just to make sure there's space to display results. When I search a term, I can press 'enter' and have the corresponding search result launched, so I know the search is working in the background. However, nothing displays in the popup menu item where I've added `this._searchTab.page`. (but the menu gets fatter as if it were allocating space were results). What can I do to get these results to show in the menu? Am I on the right track? (I guess down the track I will implement my own ContactSearchProvider similar to the ContactDisplay one, except that it returns PopupMenuItems. And perhaps implement my own SearchResultDisplay that is a PopupMenuSection?) cheers On 25 June 2012 12:19, Amy C <mathematical.cof...@gmail.com> wrote: > Hi all, > > I'm working on a little extension that shows your contacts (from > gnome-contacts) in the menu of a PanelMenu.SystemStatusButton. > (The vague idea is you can chat from the menu/open up a chat window by > clicking on the contact/other stuff). > > I've added a little St.Entry that lets you type in some terms to > search for contacts, and the idea is that the menu will then filter > out all the contacts matching the search terms. > > It has just struck me that all I want is the `contactDisplay` search > provider in the Overview, but to display the results as items in a > PopupMenu instead of the results you get in the Overview. > > Is there some way I can simply harness the code from search.js, > contactDisplay.js, searchDisplay.js etc to do the search functionality > for me? > > I notice that in contactSearchProvider.js, all ContactSearchProvider > does is implement a `createResultActor` method that returns a 'new > Contact(..)' (which is the St.Bin holding the contact's avatar, alias, > etc), and also implements `createResultContainerActor` that makes an > icon grid in which to show the results. > > I'd like to do something similar where my `createResultActor` returns > a `new ContactMenuItem(...)` which is just a PopupMenuItem, and > instead of the results being added to an icon grid, they're added to > the PopupMenu I specify. > > Is this feasible? Which classes would I need to override to achieve > this? SearchTab, ContactDisplay, ... (I suppose I could have a 'tab' > being a PopupMenuSection that just gets hidden/shown as necessary?) > > cheers! _______________________________________________ gnome-shell-list mailing list gnome-shell-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-shell-list