1
// Stephen Smally © 2012
2
// This program is free software; you can redistribute it and/or modify
3
// it under the terms of the GNU General Public License as published by
4
// the Free Software Foundation; either version 2 of the License, or
5
// (at your option) any later version.
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License for more details.
12
// You should have received a copy of the GNU General Public License
13
// along with this program; if not, write to the Free Software
14
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15
// MA 02110-1301, USA.
20
namespace Lsc.Widgets {
21
public class MainToolbar : Toolbar {
23
public signal void section_changed(int index);
26
public ToolButton back;
27
public RadioToolButton radio = null;
28
public SearchBar searchbar;
30
public void on_changed_radio (ToolButton widget) {
31
int index = get_children().index(widget)-1; // The radio position in the toolbar - 1
32
section_changed(index);
35
public MainToolbar () {
36
toolbar_style = ToolbarStyle.BOTH_HORIZ;
37
get_style_context().add_class("primary-toolbar");
40
back = new ToolButton.from_stock(Stock.GO_BACK);
43
ToolItem space_item = new ToolItem();
44
space_item.set_expand(true);
45
insert(space_item, -1);
47
searchbar = new SearchBar("Search apps...");
48
searchbar.text_changed_pause.connect((text) => {stdout.printf("%s\n", text); });
49
ToolItem searchbar_tool = new ToolItem();
50
searchbar_tool.add(searchbar);
51
insert(searchbar_tool, -1);