Merge lp:~tombeckmann/switchboard/fixing into lp:~elementary-pantheon/switchboard/switchboard
- fixing
- Merge into switchboard
Proposed by
Tom Beckmann
Status: | Merged |
---|---|
Merged at revision: | 286 |
Proposed branch: | lp:~tombeckmann/switchboard/fixing |
Merge into: | lp:~elementary-pantheon/switchboard/switchboard |
Diff against target: |
293 lines (+51/-83) 2 files modified
Switchboard/switchboard-app.vala (+45/-77) Switchboard/switchboard-categoryview.vala (+6/-6) |
To merge this branch: | bzr merge lp:~tombeckmann/switchboard/fixing |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cody Garver (community) | Approve | ||
Review via email: mp+120273@code.launchpad.net |
Commit message
Description of the change
This will remove the animation and fix the startup-
To post a comment you must log in.
- 287. By Tom Beckmann
-
Fix a show_all problem
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Switchboard/switchboard-app.vala' |
2 | --- Switchboard/switchboard-app.vala 2012-08-02 22:36:42 +0000 |
3 | +++ Switchboard/switchboard-app.vala 2012-08-19 00:04:23 +0000 |
4 | @@ -40,7 +40,6 @@ |
5 | } |
6 | |
7 | // Chrome widgets |
8 | - Granite.Widgets.AppMenu app_menu; |
9 | Gtk.ProgressBar progress_bar; |
10 | Gtk.Label progress_label; |
11 | Granite.Widgets.SearchBar search_box; |
12 | @@ -60,9 +59,6 @@ |
13 | Granite.Widgets.EmbeddedAlert alert_view; |
14 | Switchboard.CategoryView category_view; |
15 | |
16 | - public GtkClutter.Embed clutter; |
17 | - public GtkClutter.Actor overview; |
18 | - |
19 | // Plug data |
20 | bool socket_shown; |
21 | Gee.HashMap<string, string> current_plug = new Gee.HashMap<string, string>(); |
22 | @@ -80,18 +76,15 @@ |
23 | |
24 | main_window = new Gtk.Window(); |
25 | |
26 | - this.clutter = new GtkClutter.Embed (); |
27 | - |
28 | // Set up defaults |
29 | main_window.title = APP_TITLE; |
30 | main_window.icon_name = APP_ICON; |
31 | |
32 | // Set up window |
33 | - main_window.height_request = 500; |
34 | - main_window.width_request = 810; |
35 | + main_window.set_size_request (842, 468); |
36 | main_window.window_position = Gtk.WindowPosition.CENTER; |
37 | - main_window.destroy.connect(shut_down); |
38 | - setup_toolbar(); |
39 | + main_window.destroy.connect (shut_down); |
40 | + setup_toolbar (); |
41 | |
42 | // Set up socket |
43 | socket = new Gtk.Socket (); |
44 | @@ -113,6 +106,10 @@ |
45 | current_plug["title"] = ""; |
46 | current_plug["executable"] = ""; |
47 | |
48 | + category_view = new Switchboard.CategoryView(); |
49 | + category_view.plug_selected.connect((title, executable) => load_plug (title, executable)); |
50 | + category_view.margin_top = 12; |
51 | + |
52 | // Set up UI |
53 | vbox = new Gtk.VBox (false, 0); |
54 | vbox.pack_start (toolbar, false, false); |
55 | @@ -121,35 +118,22 @@ |
56 | vbox.pack_end (alert_view); |
57 | |
58 | main_window.add (vbox); |
59 | - vbox.pack_start (this.clutter); |
60 | + vbox.pack_start (category_view); |
61 | |
62 | main_window.set_application (this); |
63 | main_window.resizable = false; |
64 | main_window.show_all (); |
65 | - |
66 | + |
67 | + foreach (var label in category_view.category_labels.values) |
68 | + label.hide (); |
69 | + foreach (var view in category_view.category_views.values) |
70 | + view.hide (); |
71 | + |
72 | alert_view.hide(); |
73 | |
74 | vbox.pack_start (socket); |
75 | socket.hide (); |
76 | - |
77 | - category_view = new Switchboard.CategoryView(); |
78 | - category_view.plug_selected.connect((title, executable) => load_plug (title, executable)); |
79 | - category_view.margin_top = 12; |
80 | - |
81 | - this.overview = new GtkClutter.Actor.with_contents (category_view); |
82 | - this.overview.get_widget ().show (); |
83 | - |
84 | - this.clutter.get_stage ().add_child (this.overview); |
85 | - (this.clutter.get_stage () as Clutter.Stage).use_alpha = true; |
86 | - var bg_col = main_window.get_style_context ().get_background_color (Gtk.StateFlags.NORMAL); |
87 | - (this.clutter.get_stage () as Clutter.Stage).color = |
88 | - {(uint8) (bg_col.red*255), (uint8) (bg_col.green*255), (uint8) (bg_col.blue * 255), 255}; |
89 | - |
90 | - this.overview.add_constraint (new Clutter.BindConstraint (this.clutter.get_stage (), |
91 | - Clutter.BindCoordinate.WIDTH, 0)); |
92 | - this.overview.add_constraint (new Clutter.BindConstraint (this.clutter.get_stage (), |
93 | - Clutter.BindCoordinate.HEIGHT, 0)); |
94 | - |
95 | + |
96 | var any_plugs = false; |
97 | |
98 | foreach (string place in plug_places) |
99 | @@ -165,7 +149,7 @@ |
100 | if (plug_to_open != null) { |
101 | foreach (var plug in plugs) { |
102 | if (plug["id"] == plug_to_open) { |
103 | - load_plug (plug["title"], plug["exec"], true); |
104 | + load_plug (plug["title"], plug["exec"]); |
105 | found = true; |
106 | } |
107 | } |
108 | @@ -174,39 +158,34 @@ |
109 | } |
110 | } |
111 | |
112 | - Timeout.add (50, () => { |
113 | - foreach (var store in category_view.category_store.values) { |
114 | - // FIXME: workaround for misplaced icons |
115 | - store.foreach((model, path, iter) => { |
116 | - store.set_value (iter, 3, true); |
117 | - return false; |
118 | - }); |
119 | - } |
120 | - return false; |
121 | - }); |
122 | + foreach (var store in category_view.category_store.values) { |
123 | + store.foreach ((model, path, iter) => { |
124 | + store.set_value (iter, 3, true); |
125 | + return false; |
126 | + }); |
127 | + } |
128 | } |
129 | |
130 | void shut_down () { |
131 | - plug_closed(); |
132 | - Gtk.main_quit(); |
133 | + plug_closed (); |
134 | } |
135 | |
136 | public void hide_alert () { |
137 | - alert_view.hide(); |
138 | - this.clutter.show(); |
139 | + alert_view.hide (); |
140 | + category_view.show (); |
141 | } |
142 | |
143 | public void show_alert (string primary_text, string secondary_text, Gtk.MessageType type) { |
144 | - alert_view.set_alert(primary_text, secondary_text, null, true, type); |
145 | - alert_view.show(); |
146 | - this.clutter.hide(); |
147 | + alert_view.set_alert (primary_text, secondary_text, null, true, type); |
148 | + alert_view.show (); |
149 | + category_view.hide (); |
150 | } |
151 | |
152 | - public void load_plug (string title, string executable, bool suppress_animation = false) { |
153 | + public void load_plug (string title, string executable) { |
154 | debug ("Selected plug: title %s | executable %s", title, executable); |
155 | |
156 | // Launch plug's executable |
157 | - switch_to_socket (suppress_animation); |
158 | + switch_to_socket (); |
159 | main_window.title = @"$APP_TITLE - $title"; |
160 | if (current_plug["title"] != title) { |
161 | try { |
162 | @@ -249,28 +228,19 @@ |
163 | } |
164 | |
165 | // Switches to the socket view |
166 | - void switch_to_socket (bool suppress_animation = false) { |
167 | + void switch_to_socket () { |
168 | |
169 | socket_shown = true; |
170 | search_box.sensitive = false; |
171 | |
172 | - if (!suppress_animation) { |
173 | - this.overview.animate (Clutter.AnimationMode.EASE_IN_QUAD, 400, x:-clutter.get_stage ().width, |
174 | - opacity:0).completed.connect ( () => { |
175 | - clutter.hide (); |
176 | - socket.show_all (); |
177 | - }); |
178 | - } else { |
179 | - clutter.hide (); |
180 | - socket.show_all (); |
181 | - } |
182 | + category_view.hide (); |
183 | + socket.show_all (); |
184 | } |
185 | |
186 | // Switches back to the icons |
187 | bool switch_to_icons () { |
188 | socket.hide (); |
189 | - clutter.show_all (); |
190 | - this.overview.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 400, x:0.0f, opacity:255); |
191 | + category_view.show (); |
192 | |
193 | current_plug["title"] = ""; |
194 | socket_shown = false; |
195 | @@ -314,10 +284,11 @@ |
196 | try { |
197 | plug["title"] = kf.get_locale_string (head, "title"); |
198 | string? textdomain = null; |
199 | - foreach (var domain_key in SUPPORTED_GETTEXT_DOMAINS_KEYS) |
200 | + foreach (var domain_key in SUPPORTED_GETTEXT_DOMAINS_KEYS) { |
201 | if (kf.has_key (head, domain_key)) { |
202 | - textdomain = kf.get_string (head, domain_key); |
203 | - break; |
204 | + textdomain = kf.get_string (head, domain_key); |
205 | + break; |
206 | + } |
207 | } |
208 | if (textdomain != null) |
209 | plug["title"] = GLib.dgettext (textdomain, plug["title"]).dup (); |
210 | @@ -442,8 +413,6 @@ |
211 | toolbar = new Gtk.Toolbar (); |
212 | toolbar.get_style_context ().add_class ("primary-toolbar"); |
213 | |
214 | - var menu = new Gtk.Menu (); |
215 | - app_menu = create_appmenu(menu); |
216 | // Spacing |
217 | lspace.set_expand(true); |
218 | rspace.set_expand(true); |
219 | @@ -477,18 +446,17 @@ |
220 | navigation_button.set_sensitive(false); |
221 | |
222 | // Add everything to the toolbar |
223 | - toolbar.insert(navigation_button, 0); |
224 | - toolbar.insert(lspace, 1); |
225 | - toolbar.insert(progress_toolitem, 2); |
226 | - toolbar.insert(rspace, 3); |
227 | - toolbar.insert(find_toolitem, 4); |
228 | - toolbar.insert(app_menu, 5); |
229 | - toolbar.show_all(); |
230 | + toolbar.insert (navigation_button, -1); |
231 | + toolbar.insert (lspace, -1); |
232 | + toolbar.insert (progress_toolitem, -1); |
233 | + toolbar.insert (rspace, -1); |
234 | + toolbar.insert (find_toolitem, -1); |
235 | + toolbar.insert (create_appmenu (new Gtk.Menu ()), -1); |
236 | } |
237 | |
238 | public override void activate () {} |
239 | } |
240 | - |
241 | + |
242 | static const OptionEntry[] entries = { |
243 | { "open-plug", 'o', 0, OptionArg.STRING, ref plug_to_open, N_("Open a plug"), "PLUG_NAME" }, |
244 | { null } |
245 | |
246 | === modified file 'Switchboard/switchboard-categoryview.vala' |
247 | --- Switchboard/switchboard-categoryview.vala 2012-07-22 22:18:03 +0000 |
248 | +++ Switchboard/switchboard-categoryview.vala 2012-08-19 00:04:23 +0000 |
249 | @@ -19,7 +19,7 @@ |
250 | |
251 | public class CategoryView : Gtk.VBox { |
252 | |
253 | - Gee.HashMap<string, Gtk.VBox> category_labels = new Gee.HashMap<string, Gtk.VBox> (); |
254 | + public Gee.HashMap<string, Gtk.VBox> category_labels = new Gee.HashMap<string, Gtk.VBox> (); |
255 | public Gee.HashMap<string, Gtk.ListStore> category_store = new Gee.HashMap<string, Gtk.ListStore> (); |
256 | public Gee.HashMap<string, Gtk.IconView> category_views = new Gee.HashMap<string, Gtk.IconView> (); |
257 | Gtk.IconTheme theme = Gtk.IconTheme.get_default (); |
258 | @@ -41,13 +41,12 @@ |
259 | |
260 | var category_plugs = new Gtk.IconView.with_model (filtered); |
261 | // category_plugs. |
262 | + category_plugs.column_spacing = -20; |
263 | category_plugs.set_text_column (0); |
264 | category_plugs.set_pixbuf_column (1); |
265 | category_plugs.selection_changed.connect(() => on_selection_changed(category_plugs, filtered)); |
266 | |
267 | (category_plugs.get_cells ().nth_data (0) as Gtk.CellRendererText).wrap_mode = Pango.WrapMode.WORD; |
268 | - // (category_plugs.get_cells ().nth_data (0) as Gtk.CellRendererText).ellipsize = |
269 | - // Pango.EllipsizeMode.END; |
270 | |
271 | var bg_css = new Gtk.CssProvider (); |
272 | try { |
273 | @@ -89,7 +88,7 @@ |
274 | |
275 | Gdk.Pixbuf icon_pixbuf = null; |
276 | try { |
277 | - icon_pixbuf = theme.load_icon (plug["icon"], 32, Gtk.IconLookupFlags.GENERIC_FALLBACK); |
278 | + icon_pixbuf = theme.load_icon (plug["icon"], 48, Gtk.IconLookupFlags.GENERIC_FALLBACK); |
279 | } catch { |
280 | warning(_("Unable to load plug %s's icon: %s"), plug["title"], plug["icon"]); |
281 | return; // FIXME: if we get no icon, we probably dont want that one.. |
282 | @@ -97,8 +96,9 @@ |
283 | category_store[plug_down].append(out root); |
284 | |
285 | category_store[plug_down].set(root, 0, plug["title"], 1, icon_pixbuf, 2, plug["exec"], |
286 | - 3, false); |
287 | - category_labels[plug_down].show_all(); |
288 | + 3, true); |
289 | + category_labels[plug_down].show_all (); |
290 | + category_views[plug_down].show_all (); |
291 | } |
292 | |
293 | public void filter_plugs (string filter, SwitchboardApp switchboard) { |
It's OK to return to 48px icons because that's what they were BEFORE Tom changed them.
I do not agree that expanding the window size fixes the "show all" issue because the window is already too big for 800x600 machines. See bug #1035714.