Merge lp:~elementary-apps/switchboard/fix-bug-1039269 into lp:~elementary-pantheon/switchboard/switchboard
- fix-bug-1039269
- Merge into switchboard
Status: | Merged |
---|---|
Approved by: | Akshay Shekher |
Approved revision: | 415 |
Merged at revision: | 411 |
Proposed branch: | lp:~elementary-apps/switchboard/fix-bug-1039269 |
Merge into: | lp:~elementary-pantheon/switchboard/switchboard |
Diff against target: |
367 lines (+108/-49) 3 files modified
CMakeLists.txt (+1/-0) src/NavigationButton.vala (+50/-0) src/Switchboard.vala (+57/-49) |
To merge this branch: | bzr merge lp:~elementary-apps/switchboard/fix-bug-1039269 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Akshay Shekher (community) | Approve | ||
Review via email: mp+197454@code.launchpad.net |
Commit message
Use a back-arrow shaped button with text instead of a simple button. Fixes bug #1039269.
Description of the change
https:/
Rewrote that with fixed bzr conflicts.
Akshay Shekher (voldyman) wrote : | # |
David Gomes (davidgomes) wrote : | # |
Don't make it WIP when it needs fixing, I'll fix it later today.
On Dec 3, 2013 2:54 AM, "Akshay Shekher" <email address hidden> wrote:
> The proposal to merge lp:~elementary-apps/switchboard/fix-bug-1039269 into
> lp:switchboard has been updated.
>
> Status: Needs review => Work in progress
>
> For more details, see:
>
> https:/
> --
>
> https:/
> Your team elementary Apps team is subscribed to branch
> lp:~elementary-apps/switchboard/fix-bug-1039269.
>
- 413. By David Gomes
-
Fixed license header.
Akshay Shekher (voldyman) wrote : | # |
the code look fine, i just a few suggestions.
rename the file from Buttons.vala to NavigationButto
In the signal search_box.changed you partially changed the closure, you could also fix the spacing of the bracket on line 294.
since when are we giving the copyright to elementary LLC instead of elementary Developers or <insert project name here> developers?
- 414. By David Gomes
-
Fixed file name and some code style.
David Gomes (davidgomes) wrote : | # |
Done, and we've been doing that since the Isis cycle began, supposedly.
Julián Unrrein (junrrein) wrote : | # |
Rename Buttons.vala in diff line 8 too.
- 415. By David Gomes
-
Fixed file name in CMakeLists.txt.
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2013-09-30 06:42:11 +0000 | |||
3 | +++ CMakeLists.txt 2013-12-03 14:31:03 +0000 | |||
4 | @@ -74,6 +74,7 @@ | |||
5 | 74 | src/Resources.vala | 74 | src/Resources.vala |
6 | 75 | src/DesktopLauncher.vala | 75 | src/DesktopLauncher.vala |
7 | 76 | src/EmbeddedAlert.vala | 76 | src/EmbeddedAlert.vala |
8 | 77 | src/NavigationButton.vala | ||
9 | 77 | PACKAGES | 78 | PACKAGES |
10 | 78 | granite | 79 | granite |
11 | 79 | gee-1.0 | 80 | gee-1.0 |
12 | 80 | 81 | ||
13 | === added file 'src/NavigationButton.vala' | |||
14 | --- src/NavigationButton.vala 1970-01-01 00:00:00 +0000 | |||
15 | +++ src/NavigationButton.vala 2013-12-03 14:31:03 +0000 | |||
16 | @@ -0,0 +1,50 @@ | |||
17 | 1 | /*** | ||
18 | 2 | BEGIN LICENSE | ||
19 | 3 | |||
20 | 4 | Copyright (C) 2013 elementary, LLC. | ||
21 | 5 | This program is free software: you can redistribute it and/or modify it | ||
22 | 6 | under the terms of the GNU Lesser General Public License version 3, as | ||
23 | 7 | published by the Free Software Foundation. | ||
24 | 8 | |||
25 | 9 | This program is distributed in the hope that it will be useful, but | ||
26 | 10 | WITHOUT ANY WARRANTY; without even the implied warranties of | ||
27 | 11 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
28 | 12 | PURPOSE. See the GNU General Public License for more details. | ||
29 | 13 | |||
30 | 14 | You should have received a copy of the GNU General Public License along | ||
31 | 15 | with this program. If not, see <http://www.gnu.org/licenses> | ||
32 | 16 | |||
33 | 17 | END LICENSE | ||
34 | 18 | ***/ | ||
35 | 19 | |||
36 | 20 | namespace Switchboard { | ||
37 | 21 | |||
38 | 22 | public class NavigationButton : Gtk.Button { | ||
39 | 23 | |||
40 | 24 | private Gtk.Label text; | ||
41 | 25 | |||
42 | 26 | public NavigationButton () { | ||
43 | 27 | can_focus = false; | ||
44 | 28 | valign = Gtk.Align.CENTER; | ||
45 | 29 | vexpand = false; | ||
46 | 30 | |||
47 | 31 | Gtk.Box button_b = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); | ||
48 | 32 | var icon = new Gtk.Image.from_icon_name ("go-previous-symbolic", | ||
49 | 33 | Gtk.IconSize.MENU); | ||
50 | 34 | text = new Gtk.Label (""); | ||
51 | 35 | |||
52 | 36 | button_b.pack_start (icon, true, true, 2); | ||
53 | 37 | button_b.pack_start (text, true, true, 2); | ||
54 | 38 | |||
55 | 39 | this.add (button_b); | ||
56 | 40 | } | ||
57 | 41 | |||
58 | 42 | public string get_text () { | ||
59 | 43 | return text.label; | ||
60 | 44 | } | ||
61 | 45 | |||
62 | 46 | public void set_text (string text) { | ||
63 | 47 | this.text.label = text; | ||
64 | 48 | } | ||
65 | 49 | } | ||
66 | 50 | } | ||
67 | 0 | 51 | ||
68 | === modified file 'src/Switchboard.vala' | |||
69 | --- src/Switchboard.vala 2013-09-26 08:05:15 +0000 | |||
70 | +++ src/Switchboard.vala 2013-12-03 14:31:03 +0000 | |||
71 | @@ -21,7 +21,7 @@ | |||
72 | 21 | 21 | ||
73 | 22 | [DBus (name = "org.elementary.switchboard")] | 22 | [DBus (name = "org.elementary.switchboard")] |
74 | 23 | public class SwitchboardApp : Granite.Application { | 23 | public class SwitchboardApp : Granite.Application { |
76 | 24 | 24 | ||
77 | 25 | construct { | 25 | construct { |
78 | 26 | application_id = "org.elementary.Switchboard"; | 26 | application_id = "org.elementary.Switchboard"; |
79 | 27 | program_name = "Switchboard"; | 27 | program_name = "Switchboard"; |
80 | @@ -45,15 +45,15 @@ | |||
81 | 45 | Gtk.Label progress_label; | 45 | Gtk.Label progress_label; |
82 | 46 | Gtk.SearchEntry search_box; | 46 | Gtk.SearchEntry search_box; |
83 | 47 | Gtk.Toolbar toolbar; | 47 | Gtk.Toolbar toolbar; |
85 | 48 | Gtk.ToolButton navigation_button; | 48 | Switchboard.NavigationButton navigation_button; |
86 | 49 | // Public so we can hide it after show_all() | 49 | // Public so we can hide it after show_all() |
87 | 50 | public Gtk.ToolItem progress_toolitem; | 50 | public Gtk.ToolItem progress_toolitem; |
88 | 51 | // These two wrap the progress bar | 51 | // These two wrap the progress bar |
89 | 52 | Gtk.ToolItem lspace = new Gtk.ToolItem (); | 52 | Gtk.ToolItem lspace = new Gtk.ToolItem (); |
90 | 53 | Gtk.ToolItem rspace = new Gtk.ToolItem (); | 53 | Gtk.ToolItem rspace = new Gtk.ToolItem (); |
92 | 54 | 54 | ||
93 | 55 | Gtk.Spinner loading; | 55 | Gtk.Spinner loading; |
95 | 56 | 56 | ||
96 | 57 | Gtk.Window main_window; | 57 | Gtk.Window main_window; |
97 | 58 | 58 | ||
98 | 59 | // Content area widgets | 59 | // Content area widgets |
99 | @@ -70,15 +70,16 @@ | |||
100 | 70 | 70 | ||
101 | 71 | string[] plug_places = {"/usr/share/plugs/", | 71 | string[] plug_places = {"/usr/share/plugs/", |
102 | 72 | "/usr/lib/plugs/", | 72 | "/usr/lib/plugs/", |
104 | 73 | "/usr/local/share/plugs/", | 73 | "/usr/local/share/plugs/", |
105 | 74 | "/usr/local/lib/plugs/"}; | 74 | "/usr/local/lib/plugs/"}; |
106 | 75 | string search_box_buffer = ""; | 75 | string search_box_buffer = ""; |
107 | 76 | 76 | ||
108 | 77 | private const string[] SUPPORTED_GETTEXT_DOMAINS_KEYS = {"X-Ubuntu-Gettext-Domain", "X-GNOME-Gettext-Domain"}; | 77 | private const string[] SUPPORTED_GETTEXT_DOMAINS_KEYS = {"X-Ubuntu-Gettext-Domain", "X-GNOME-Gettext-Domain"}; |
109 | 78 | 78 | ||
113 | 79 | public SwitchboardApp () { | 79 | string all_settings_label = _("All Settings"); |
114 | 80 | } | 80 | |
115 | 81 | 81 | public SwitchboardApp () { } | |
116 | 82 | |||
117 | 82 | void build () { | 83 | void build () { |
118 | 83 | main_window = new Gtk.Window(); | 84 | main_window = new Gtk.Window(); |
119 | 84 | 85 | ||
120 | @@ -149,6 +150,8 @@ | |||
121 | 149 | category_view.recalculate_columns (width); | 150 | category_view.recalculate_columns (width); |
122 | 150 | }); | 151 | }); |
123 | 151 | 152 | ||
124 | 153 | navigation_button.hide (); | ||
125 | 154 | |||
126 | 152 | foreach (var label in category_view.category_labels.values) | 155 | foreach (var label in category_view.category_labels.values) |
127 | 153 | label.hide (); | 156 | label.hide (); |
128 | 154 | foreach (var view in category_view.category_views.values) | 157 | foreach (var view in category_view.category_views.values) |
129 | @@ -188,7 +191,7 @@ | |||
130 | 188 | } else { | 191 | } else { |
131 | 189 | update_libunity_quicklist (); | 192 | update_libunity_quicklist (); |
132 | 190 | } | 193 | } |
134 | 191 | 194 | ||
135 | 192 | bool found = false; | 195 | bool found = false; |
136 | 193 | if (plug_to_open != null) { | 196 | if (plug_to_open != null) { |
137 | 194 | foreach (var plug in plugs) { | 197 | foreach (var plug in plugs) { |
138 | @@ -201,17 +204,17 @@ | |||
139 | 201 | critical ("Couldn't find %s among the loaded settings.", plug_to_open); | 204 | critical ("Couldn't find %s among the loaded settings.", plug_to_open); |
140 | 202 | } | 205 | } |
141 | 203 | } | 206 | } |
143 | 204 | 207 | ||
144 | 205 | foreach (var store in category_view.category_store.values) { | 208 | foreach (var store in category_view.category_store.values) { |
145 | 206 | store.foreach ((model, path, iter) => { | 209 | store.foreach ((model, path, iter) => { |
146 | 207 | store.set_value (iter, 3, true); | 210 | store.set_value (iter, 3, true); |
147 | 208 | return false; | 211 | return false; |
148 | 209 | }); | 212 | }); |
149 | 210 | } | 213 | } |
151 | 211 | 214 | ||
152 | 212 | progress_toolitem.hide (); | 215 | progress_toolitem.hide (); |
153 | 213 | } | 216 | } |
155 | 214 | 217 | ||
156 | 215 | void shut_down () { | 218 | void shut_down () { |
157 | 216 | plug_closed (); | 219 | plug_closed (); |
158 | 217 | } | 220 | } |
159 | @@ -236,15 +239,17 @@ | |||
160 | 236 | // The plug is already selected | 239 | // The plug is already selected |
161 | 237 | debug(_("Closing plug \"%s\" in Switchboard controller..."), current_plug["title"]); | 240 | debug(_("Closing plug \"%s\" in Switchboard controller..."), current_plug["title"]); |
162 | 238 | plug_closed (); | 241 | plug_closed (); |
164 | 239 | 242 | ||
165 | 240 | string[] cmd_exploded = (executable!=null)?executable.split (" "):null; | 243 | string[] cmd_exploded = (executable!=null)?executable.split (" "):null; |
166 | 241 | GLib.Process.spawn_async (File.new_for_path (cmd_exploded[0]).get_parent (). | 244 | GLib.Process.spawn_async (File.new_for_path (cmd_exploded[0]).get_parent (). |
167 | 242 | get_path (), cmd_exploded, null, SpawnFlags.SEARCH_PATH, null, null); | 245 | get_path (), cmd_exploded, null, SpawnFlags.SEARCH_PATH, null, null); |
169 | 243 | 246 | ||
170 | 244 | // ensure the button is sensitive; it might be the first plug loaded | 247 | // ensure the button is sensitive; it might be the first plug loaded |
171 | 245 | if (!@extern) { | 248 | if (!@extern) { |
174 | 246 | navigation_button.set_sensitive(true); | 249 | navigation_button.set_sensitive (true); |
175 | 247 | navigation_button.set_icon_name ("go-home"); | 250 | navigation_button.set_text (all_settings_label); |
176 | 251 | navigation_button.show (); | ||
177 | 252 | |||
178 | 248 | current_plug["title"] = title; | 253 | current_plug["title"] = title; |
179 | 249 | current_plug["executable"] = executable; | 254 | current_plug["executable"] = executable; |
180 | 250 | switch_to_socket (); | 255 | switch_to_socket (); |
181 | @@ -252,10 +257,11 @@ | |||
182 | 252 | } | 257 | } |
183 | 253 | } catch { warning(_("Failed to launch plug: title %s | executable %s"), title, executable); } | 258 | } catch { warning(_("Failed to launch plug: title %s | executable %s"), title, executable); } |
184 | 254 | } else { | 259 | } else { |
187 | 255 | navigation_button.set_sensitive(true); | 260 | navigation_button.set_sensitive (true); |
188 | 256 | navigation_button.set_icon_name ("go-home"); | 261 | navigation_button.set_text (all_settings_label); |
189 | 262 | navigation_button.show (); | ||
190 | 257 | } | 263 | } |
192 | 258 | 264 | ||
193 | 259 | if (@extern) { | 265 | if (@extern) { |
194 | 260 | switch_to_icons (); | 266 | switch_to_icons (); |
195 | 261 | } | 267 | } |
196 | @@ -268,20 +274,17 @@ | |||
197 | 268 | 274 | ||
198 | 269 | // Handles clicking the navigation button | 275 | // Handles clicking the navigation button |
199 | 270 | void handle_navigation_button_clicked () { | 276 | void handle_navigation_button_clicked () { |
202 | 271 | string icon_name = navigation_button.get_icon_name (); | 277 | if (navigation_button.get_text () != current_plug["title"]) { |
201 | 272 | if (icon_name == "go-home") { | ||
203 | 273 | switch_to_icons(); | 278 | switch_to_icons(); |
207 | 274 | navigation_button.set_icon_name ("go-previous"); | 279 | navigation_button.set_text (current_plug["title"]); |
208 | 275 | } | 280 | } else { |
206 | 276 | else { | ||
209 | 277 | load_plug (current_plug["title"], current_plug["executable"], current_plug["extern"] == "1"); | 281 | load_plug (current_plug["title"], current_plug["executable"], current_plug["extern"] == "1"); |
211 | 278 | navigation_button.set_icon_name ("go-home"); | 282 | navigation_button.set_text (all_settings_label); |
212 | 279 | } | 283 | } |
213 | 280 | } | 284 | } |
214 | 281 | 285 | ||
215 | 282 | // Switches to the socket view | 286 | // Switches to the socket view |
216 | 283 | void switch_to_socket () { | 287 | void switch_to_socket () { |
217 | 284 | |||
218 | 285 | socket_shown = true; | 288 | socket_shown = true; |
219 | 286 | search_box.sensitive = false; | 289 | search_box.sensitive = false; |
220 | 287 | 290 | ||
221 | @@ -289,13 +292,13 @@ | |||
222 | 289 | socket.hide (); | 292 | socket.hide (); |
223 | 290 | loading.show_all (); | 293 | loading.show_all (); |
224 | 291 | } | 294 | } |
226 | 292 | 295 | ||
227 | 293 | // Switches back to the icons | 296 | // Switches back to the icons |
228 | 294 | bool switch_to_icons () { | 297 | bool switch_to_icons () { |
229 | 295 | socket.hide (); | 298 | socket.hide (); |
230 | 296 | loading.hide (); | 299 | loading.hide (); |
231 | 297 | category_view.show (); | 300 | category_view.show (); |
233 | 298 | 301 | ||
234 | 299 | socket_shown = false; | 302 | socket_shown = false; |
235 | 300 | 303 | ||
236 | 301 | // Reset state | 304 | // Reset state |
237 | @@ -305,9 +308,9 @@ | |||
238 | 305 | progress_label.set_text(""); | 308 | progress_label.set_text(""); |
239 | 306 | progress_bar.fraction = 0.0; | 309 | progress_bar.fraction = 0.0; |
240 | 307 | progress_toolitem.visible = false; | 310 | progress_toolitem.visible = false; |
242 | 308 | 311 | ||
243 | 309 | plug_closed (); | 312 | plug_closed (); |
245 | 310 | 313 | ||
246 | 311 | return true; | 314 | return true; |
247 | 312 | } | 315 | } |
248 | 313 | 316 | ||
249 | @@ -341,7 +344,7 @@ | |||
250 | 341 | exec = Path.build_filename(parent, exec); | 344 | exec = Path.build_filename(parent, exec); |
251 | 342 | plug["extern"] = "0"; | 345 | plug["extern"] = "0"; |
252 | 343 | } | 346 | } |
254 | 344 | 347 | ||
255 | 345 | plug["exec"] = exec; | 348 | plug["exec"] = exec; |
256 | 346 | } catch (Error e) { warning("Couldn't read exec field in file %s, %s", keyfile, e.message); } | 349 | } catch (Error e) { warning("Couldn't read exec field in file %s, %s", keyfile, e.message); } |
257 | 347 | try { plug["icon"] = kf.get_string (head, "icon"); | 350 | try { plug["icon"] = kf.get_string (head, "icon"); |
258 | @@ -385,7 +388,7 @@ | |||
259 | 385 | keyfiles.append(keyfile); | 388 | keyfiles.append(keyfile); |
260 | 386 | } | 389 | } |
261 | 387 | } | 390 | } |
263 | 388 | 391 | ||
264 | 389 | var directory = File.new_for_path (path); | 392 | var directory = File.new_for_path (path); |
265 | 390 | if (!directory.query_exists ()) { | 393 | if (!directory.query_exists ()) { |
266 | 391 | return null; | 394 | return null; |
267 | @@ -396,7 +399,7 @@ | |||
268 | 396 | FileInfo file_info; | 399 | FileInfo file_info; |
269 | 397 | while ((file_info = enumerator.next_file ()) != null) { | 400 | while ((file_info = enumerator.next_file ()) != null) { |
270 | 398 | string file_path = Path.build_filename(path, file_info.get_name()); | 401 | string file_path = Path.build_filename(path, file_info.get_name()); |
272 | 399 | if (file_info.get_file_type() == GLib.FileType.REGULAR && | 402 | if (file_info.get_file_type() == GLib.FileType.REGULAR && |
273 | 400 | is_plug_file(file_info.get_name())) { | 403 | is_plug_file(file_info.get_name())) { |
274 | 401 | keyfiles.append(file_path); | 404 | keyfiles.append(file_path); |
275 | 402 | } else if(file_info.get_file_type() == GLib.FileType.DIRECTORY) { | 405 | } else if(file_info.get_file_type() == GLib.FileType.DIRECTORY) { |
276 | @@ -404,7 +407,7 @@ | |||
277 | 404 | } | 407 | } |
278 | 405 | } | 408 | } |
279 | 406 | } catch { warning(_(@"Unable to iterate over enumerated plug directory \"$path\"'s contents")); } | 409 | } catch { warning(_(@"Unable to iterate over enumerated plug directory \"$path\"'s contents")); } |
281 | 407 | 410 | ||
282 | 408 | return keyfiles; | 411 | return keyfiles; |
283 | 409 | } | 412 | } |
284 | 410 | 413 | ||
285 | @@ -496,12 +499,15 @@ | |||
286 | 496 | // Searchbar | 499 | // Searchbar |
287 | 497 | search_box = new Gtk.SearchEntry (); | 500 | search_box = new Gtk.SearchEntry (); |
288 | 498 | search_box.set_placeholder_text (_("Search Settings")); | 501 | search_box.set_placeholder_text (_("Search Settings")); |
293 | 499 | search_box.activate.connect(() => search_box_activated()); | 502 | search_box.activate.connect (() => search_box_activated ()); |
294 | 500 | search_box.changed.connect(() => { | 503 | |
295 | 501 | category_view.filter_plugs(search_box.get_text (), this); | 504 | search_box.changed.connect (() => { |
296 | 502 | search_box_text_changed(); | 505 | category_view.filter_plugs (search_box.get_text (), this); |
297 | 506 | search_box_text_changed (); | ||
298 | 503 | }); | 507 | }); |
299 | 508 | |||
300 | 504 | search_box.sensitive = (count_plugs () > 0); | 509 | search_box.sensitive = (count_plugs () > 0); |
301 | 510 | search_box.margin = 5; | ||
302 | 505 | var find_toolitem = new Gtk.ToolItem (); | 511 | var find_toolitem = new Gtk.ToolItem (); |
303 | 506 | find_toolitem.add(search_box); | 512 | find_toolitem.add(search_box); |
304 | 507 | find_toolitem.margin_right = 6; | 513 | find_toolitem.margin_right = 6; |
305 | @@ -516,19 +522,21 @@ | |||
306 | 516 | }); | 522 | }); |
307 | 517 | 523 | ||
308 | 518 | // Nav button | 524 | // Nav button |
311 | 519 | navigation_button = new Gtk.ToolButton (null, null); | 525 | navigation_button = new NavigationButton (); |
310 | 520 | navigation_button.set_icon_name ("go-previous"); | ||
312 | 521 | navigation_button.clicked.connect (handle_navigation_button_clicked); | 526 | navigation_button.clicked.connect (handle_navigation_button_clicked); |
314 | 522 | navigation_button.set_sensitive(false); | 527 | navigation_button.margin = 5; |
315 | 523 | 528 | ||
316 | 524 | // Add everything to the toolbar | 529 | // Add everything to the toolbar |
318 | 525 | toolbar.insert (navigation_button, -1); | 530 | |
319 | 531 | Gtk.ToolItem tool = new Gtk.ToolItem (); | ||
320 | 532 | tool.add (navigation_button); | ||
321 | 533 | toolbar.insert (tool, -1); | ||
322 | 526 | toolbar.insert (lspace, -1); | 534 | toolbar.insert (lspace, -1); |
323 | 527 | toolbar.insert (progress_toolitem, -1); | 535 | toolbar.insert (progress_toolitem, -1); |
324 | 528 | toolbar.insert (rspace, -1); | 536 | toolbar.insert (rspace, -1); |
325 | 529 | toolbar.insert (find_toolitem, -1); | 537 | toolbar.insert (find_toolitem, -1); |
326 | 530 | } | 538 | } |
328 | 531 | 539 | ||
329 | 532 | public override void activate () { | 540 | public override void activate () { |
330 | 533 | // If app is already running, present the current window. | 541 | // If app is already running, present the current window. |
331 | 534 | if (get_windows () != null) { | 542 | if (get_windows () != null) { |
332 | @@ -594,29 +602,29 @@ | |||
333 | 594 | message(_(@"Welcome to $APP_TITLE")); | 602 | message(_(@"Welcome to $APP_TITLE")); |
334 | 595 | message(_(@"Version: $VERSION")); | 603 | message(_(@"Version: $VERSION")); |
335 | 596 | message(_("Report any issues/bugs you mind find to lp:switchboard")); | 604 | message(_("Report any issues/bugs you mind find to lp:switchboard")); |
337 | 597 | 605 | ||
338 | 598 | Gtk.init (ref args); | 606 | Gtk.init (ref args); |
340 | 599 | 607 | ||
341 | 600 | var context = new OptionContext(""); | 608 | var context = new OptionContext(""); |
342 | 601 | context.add_main_entries(entries, "switchboard "); | 609 | context.add_main_entries(entries, "switchboard "); |
343 | 602 | context.add_group(Gtk.get_option_group(true)); | 610 | context.add_group(Gtk.get_option_group(true)); |
344 | 603 | try { | 611 | try { |
345 | 604 | context.parse(ref args); | 612 | context.parse(ref args); |
346 | 605 | } catch(Error e) { warning (e.message); } | 613 | } catch(Error e) { warning (e.message); } |
348 | 606 | 614 | ||
349 | 607 | // In the future, the plug_root_dir should be overridable by CLI flags. | 615 | // In the future, the plug_root_dir should be overridable by CLI flags. |
350 | 608 | var switchboard_app = new SwitchboardApp (); | 616 | var switchboard_app = new SwitchboardApp (); |
352 | 609 | 617 | ||
353 | 610 | GLib.Bus.own_name (BusType.SESSION, "org.elementary.switchboard", | 618 | GLib.Bus.own_name (BusType.SESSION, "org.elementary.switchboard", |
354 | 611 | BusNameOwnerFlags.NONE, | 619 | BusNameOwnerFlags.NONE, |
356 | 612 | (conn) => { | 620 | (conn) => { |
357 | 613 | try { | 621 | try { |
358 | 614 | conn.register_object("/org/elementary/switchboard", switchboard_app); | 622 | conn.register_object("/org/elementary/switchboard", switchboard_app); |
359 | 615 | } catch (IOError e) { warning (e.message); } | 623 | } catch (IOError e) { warning (e.message); } |
360 | 616 | }, | 624 | }, |
361 | 617 | () => {}, | 625 | () => {}, |
362 | 618 | () => {logger.notification(_("Switchboard already running. Exiting..")); Process.exit(1);}); | 626 | () => {logger.notification(_("Switchboard already running. Exiting..")); Process.exit(1);}); |
364 | 619 | 627 | ||
365 | 620 | return switchboard_app.run (args); | 628 | return switchboard_app.run (args); |
366 | 621 | } | 629 | } |
367 | 622 | } | 630 | } |
please add src/Buttons.vala to the repo.