52
52
// Window properties
53
this.title = "Slingshot"; // Do I need this?
53
this.title = "Slingshot";
54
54
this.skip_pager_hint = true;
55
55
this.skip_taskbar_hint = true;
56
56
this.set_type_hint (Gdk.WindowTypeHint.NORMAL);
57
57
this.set_keep_above (true);
59
// No time to have slingshot resizable.
58
60
this.resizable = false;
59
61
this.app_paintable = true;
85
87
private void setup_ui () {
87
// Add container wrapper
88
wrapper = new EventBox ();
89
wrapper.set_visible_window (false);
89
// Create the base container
92
90
var container = new VBox (false, 0);
93
wrapper.add (container);
96
93
var top = new HBox (false, 10);
103
100
category_switcher.set_active (0);
106
102
searchbar = new SearchBar (_("Start typing to search"));
108
104
//top.pack_start (category_switcher, true, true, 15);
109
105
top.pack_start (searchbar, false, true, 0);
111
container.pack_start (top, false, true, 15);
113
107
// Get the current size of the view
114
108
int width, height;
115
109
get_size (out width, out height);
117
111
// Make icon grid and populate
118
112
grid = new Widgets.Grid (height / 180, width / 128);
114
// Create the layout which works like pages
119
115
pages = new Layout (null, null);
120
116
pages.put (grid, 0, 0);
121
pages.app_paintable = true;
122
pages.set_visual (get_screen ().get_rgba_visual());
123
117
pages.get_style_context ().add_provider (style_provider, 600);
124
118
pages.get_style_context ().add_class ("scrollwindow");
126
pages.set_visual (get_screen ().get_rgba_visual());
128
container.pack_start (Utils.set_padding (pages, 0, 9, 0, 9), true, true, 0);
120
// Create the page switcher
130
121
page_switcher = new Switcher ();
131
122
page_switcher.append ("1");
124
// This function must be after creating the page switcher
127
container.pack_start (top, false, true, 15);
128
container.pack_start (Utils.set_padding (pages, 0, 9, 0, 9), true, true, 0);
132
129
container.pack_start (page_switcher, false, true, 15);
136
this.add (Utils.set_padding (wrapper, 15, 15, 1, 15));
130
this.add (Utils.set_padding (container, 15, 15, 1, 15));
146
140
this.draw.connect (this.draw_background);
147
141
searchbar.changed.connect (this.search);
143
page_switcher.active_changed.connect (() => {
145
if (page_switcher.active > page_switcher.old_active)
146
this.page_right (page_switcher.active - page_switcher.old_active);
148
this.page_left (page_switcher.old_active - page_switcher.active);
149
152
// Auto-update settings when changed
150
153
Slingshot.settings.changed.connect (read_settings);
168
171
cr.line_to (35.0, 0.0 + offset);
169
172
cr.line_to (50.0, 15.0 + offset);
170
173
// Create the rounded square
171
cr.arc (0 + size.width - radius - offset, 15.0 + radius + offset,
174
cr.arc (0 + size.width - radius - offset, 15.0 + radius + offset,
172
175
radius, Math.PI * 1.5, Math.PI * 2);
173
cr.arc (0 + size.width - radius - offset, 0 + size.height - radius - offset,
176
cr.arc (0 + size.width - radius - offset, 0 + size.height - radius - offset,
174
177
radius, 0, Math.PI * 0.5);
175
cr.arc (0 + radius + offset, 0 + size.height - radius - offset,
178
cr.arc (0 + radius + offset, 0 + size.height - radius - offset,
176
179
radius, Math.PI * 0.5, Math.PI);
177
cr.arc (0 + radius + offset, 15 + radius + offset, radius, Math.PI, Math.PI * 1.5);
180
cr.arc (0 + radius + offset, 15 + radius + offset, radius, Math.PI, Math.PI * 1.5);
179
182
cr.set_source_rgba (0.1, 0.1, 0.1, 0.95);
180
183
cr.fill_preserve ();
182
// Add a little vertical gradient
183
/*var linear_stroke = new Cairo.Pattern.linear (0, 0, 0, size.height);
184
linear_stroke.add_color_stop_rgba (0.0, 1.0, 1.0, 1.0, 0.0);
185
linear_stroke.add_color_stop_rgba (0.5, 1.0, 1.0, 1.0, 0.0);
186
linear_stroke.add_color_stop_rgba (1.0, 0.9, 0.9, 0.9, 0.2);
187
cr.set_source (linear_stroke);
189
*/ // I don't like it anymore
191
185
// Paint a little lighter border
192
186
cr.set_source_rgba (1.0, 1.0, 1.0, 1.0);
193
187
cr.set_line_width (1.0);