Merge lp:~l-admin-3/configurator/automatic-cleanup-branch into lp:configurator
- automatic-cleanup-branch
- Merge into trunk
Proposed by
Marcus Wichelmann
Status: | Needs review |
---|---|
Proposed branch: | lp:~l-admin-3/configurator/automatic-cleanup-branch |
Merge into: | lp:configurator |
Diff against target: |
3242 lines (+1558/-1479) 25 files modified
src/MainWindow.vala (+81/-78) src/Services/EventManager.vala (+45/-44) src/Services/Settings.vala (+36/-35) src/Utils.vala (+125/-101) src/Widgets/BrowserView.vala (+53/-51) src/Widgets/EventsView.vala (+63/-62) src/Widgets/Fields/ArrayInput.vala (+201/-199) src/Widgets/Fields/BoolInput.vala (+23/-23) src/Widgets/Fields/DoubleInput.vala (+24/-23) src/Widgets/Fields/Int64Input.vala (+25/-24) src/Widgets/Fields/IntegerInput.vala (+25/-24) src/Widgets/Fields/SelectInput.vala (+27/-26) src/Widgets/Fields/StringInput.vala (+31/-30) src/Widgets/Fields/UInt64Input.vala (+25/-24) src/Widgets/Fields/UIntegerInput.vala (+25/-24) src/Widgets/InfoScreen.vala (+66/-65) src/Widgets/Key.vala (+186/-180) src/Widgets/KeyInfo.vala (+118/-117) src/Widgets/KeyList.vala (+56/-54) src/Widgets/Schema.vala (+33/-32) src/Widgets/SchemaFolder.vala (+33/-32) src/Widgets/SchemaList.vala (+120/-115) src/Widgets/TitleBar.vala (+36/-35) src/config.vala (+20/-1) src/configurator.vala (+81/-80) |
To merge this branch: | bzr merge lp:~l-admin-3/configurator/automatic-cleanup-branch |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marcus Wichelmann | Pending | ||
Review via email: mp+266955@code.launchpad.net |
Commit message
Automatic code cleanup
Description of the change
Here are some code cleanups. ;)
The branch and this merge proposal are automatically generated.
The changes passed the thest-build.
To post a comment you must log in.
Unmerged revisions
- 76. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
Key.vala - 75. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
Schema. vala - 74. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
SchemaFolder. vala - 73. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
KeyInfo. vala - 72. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
SchemaList. vala - 71. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
Fields/ DoubleInput. vala - 70. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
Fields/ ArrayInput. vala - 69. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
Fields/ SelectInput. vala - 68. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
Fields/ IntegerInput. vala - 67. By Marcus Wichelmann
-
Cleanup: ./src/Widgets/
Fields/ StringInput. vala
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/MainWindow.vala' |
2 | --- src/MainWindow.vala 2015-04-04 19:12:47 +0000 |
3 | +++ src/MainWindow.vala 2015-08-04 19:27:32 +0000 |
4 | @@ -1,80 +1,83 @@ |
5 | -/* Copyright 2015 Marcus Wichelmann |
6 | -* |
7 | -* This file is part of Configurator. |
8 | -* |
9 | -* Configurator is free software: you can redistribute it |
10 | -* and/or modify it under the terms of the GNU General Public License as |
11 | -* published by the Free Software Foundation, either version 3 of the |
12 | -* License, or (at your option) any later version. |
13 | -* |
14 | -* Configurator is distributed in the hope that it will be |
15 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
16 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
17 | -* Public License for more details. |
18 | -* |
19 | -* You should have received a copy of the GNU General Public License along |
20 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
21 | -*/ |
22 | +/* |
23 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
24 | + * |
25 | + * This program is free software; you can redistribute it and/or |
26 | + * modify it under the terms of the GNU General Public |
27 | + * License as published by the Free Software Foundation; either |
28 | + * version 2 of the License, or (at your option) any later version. |
29 | + * |
30 | + * This program is distributed in the hope that it will be useful, |
31 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
32 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
33 | + * General Public License for more details. |
34 | + * |
35 | + * You should have received a copy of the GNU General Public |
36 | + * License along with this program; if not, write to the |
37 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
38 | + * Boston, MA 02111-1307, USA. |
39 | + */ |
40 | |
41 | namespace configurator { |
42 | - public class MainWindow : Gtk.Window { |
43 | - public configuratorApp app; |
44 | - |
45 | - private Gtk.Box box; |
46 | - |
47 | - private Widgets.TitleBar title_bar; |
48 | - |
49 | - private Gtk.Stack stack; |
50 | - |
51 | - private Widgets.BrowserView browser_view; |
52 | - private Widgets.EventsView events_view; |
53 | - |
54 | - public MainWindow (configuratorApp app) { |
55 | - this.app = app; |
56 | - this.set_application (app); |
57 | - |
58 | - this.set_size_request (1000, 650); |
59 | - this.set_has_resize_grip (false); |
60 | - this.window_position = Gtk.WindowPosition.CENTER; |
61 | - |
62 | - setup_ui (); |
63 | - |
64 | - if (Services.Settings.get_default ().maximized) |
65 | - this.maximize (); |
66 | - else |
67 | - this.unmaximize (); |
68 | - |
69 | - this.window_state_event.connect ((e) => { |
70 | - Services.Settings.get_default ().maximized = (get_window ().get_state () & Gdk.WindowState.MAXIMIZED) != 0; |
71 | - return false; |
72 | - }); |
73 | - |
74 | - this.show_all (); |
75 | - } |
76 | - |
77 | - private void setup_ui () { |
78 | - box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); |
79 | - |
80 | - title_bar = new Widgets.TitleBar (this); |
81 | - |
82 | - this.set_titlebar (title_bar); |
83 | - box.pack_start (title_bar, false, true); |
84 | - |
85 | - stack = new Gtk.Stack (); |
86 | - |
87 | - browser_view = new Widgets.BrowserView (); |
88 | - |
89 | - stack.add_titled (browser_view, "browser", _("Schemas")); |
90 | - |
91 | - events_view = new Widgets.EventsView (); |
92 | - |
93 | - stack.add_titled (events_view, "events", _("Events")); |
94 | - |
95 | - box.pack_start (stack, true, true); |
96 | - |
97 | - title_bar.show_stack (stack); |
98 | - |
99 | - this.add (box); |
100 | - } |
101 | - } |
102 | -} |
103 | + public class MainWindow : Gtk.Window { |
104 | + public configuratorApp app; |
105 | + |
106 | + private Gtk.Box box; |
107 | + |
108 | + private Widgets.TitleBar title_bar; |
109 | + |
110 | + private Gtk.Stack stack; |
111 | + |
112 | + private Widgets.BrowserView browser_view; |
113 | + private Widgets.EventsView events_view; |
114 | + |
115 | + public MainWindow (configuratorApp app) { |
116 | + this.app = app; |
117 | + this.set_application (app); |
118 | + |
119 | + this.set_size_request (1000, 650); |
120 | + this.set_has_resize_grip (false); |
121 | + this.window_position = Gtk.WindowPosition.CENTER; |
122 | + |
123 | + setup_ui (); |
124 | + |
125 | + if (Services.Settings.get_default ().maximized) { |
126 | + this.maximize (); |
127 | + } else { |
128 | + this.unmaximize (); |
129 | + } |
130 | + |
131 | + this.window_state_event.connect ((e) => { |
132 | + Services.Settings.get_default ().maximized = (get_window ().get_state () & Gdk.WindowState.MAXIMIZED) != 0; |
133 | + |
134 | + return false; |
135 | + }); |
136 | + |
137 | + this.show_all (); |
138 | + } |
139 | + |
140 | + private void setup_ui () { |
141 | + box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); |
142 | + |
143 | + title_bar = new Widgets.TitleBar (this); |
144 | + |
145 | + this.set_titlebar (title_bar); |
146 | + box.pack_start (title_bar, false, true); |
147 | + |
148 | + stack = new Gtk.Stack (); |
149 | + |
150 | + browser_view = new Widgets.BrowserView (); |
151 | + |
152 | + stack.add_titled (browser_view, "browser", _("Schemas")); |
153 | + |
154 | + events_view = new Widgets.EventsView (); |
155 | + |
156 | + stack.add_titled (events_view, "events", _("Events")); |
157 | + |
158 | + box.pack_start (stack, true, true); |
159 | + |
160 | + title_bar.show_stack (stack); |
161 | + |
162 | + this.add (box); |
163 | + } |
164 | + } |
165 | +} |
166 | \ No newline at end of file |
167 | |
168 | === modified file 'src/Services/EventManager.vala' |
169 | --- src/Services/EventManager.vala 2015-04-15 18:48:01 +0000 |
170 | +++ src/Services/EventManager.vala 2015-08-04 19:27:32 +0000 |
171 | @@ -1,46 +1,47 @@ |
172 | -/* Copyright 2015 Marcus Wichelmann |
173 | -* |
174 | -* This file is part of Configurator. |
175 | -* |
176 | -* Configurator is free software: you can redistribute it |
177 | -* and/or modify it under the terms of the GNU General Public License as |
178 | -* published by the Free Software Foundation, either version 3 of the |
179 | -* License, or (at your option) any later version. |
180 | -* |
181 | -* Configurator is distributed in the hope that it will be |
182 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
183 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
184 | -* Public License for more details. |
185 | -* |
186 | -* You should have received a copy of the GNU General Public License along |
187 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
188 | -*/ |
189 | +/* |
190 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
191 | + * |
192 | + * This program is free software; you can redistribute it and/or |
193 | + * modify it under the terms of the GNU General Public |
194 | + * License as published by the Free Software Foundation; either |
195 | + * version 2 of the License, or (at your option) any later version. |
196 | + * |
197 | + * This program is distributed in the hope that it will be useful, |
198 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
199 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
200 | + * General Public License for more details. |
201 | + * |
202 | + * You should have received a copy of the GNU General Public |
203 | + * License along with this program; if not, write to the |
204 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
205 | + * Boston, MA 02111-1307, USA. |
206 | + */ |
207 | |
208 | namespace configurator.Services { |
209 | - public enum EventType { |
210 | - KEY_CHANGED |
211 | - } |
212 | - |
213 | - public class EventManager : Object { |
214 | - public signal void event (EventType type, GLib.Settings settings, string key); |
215 | - |
216 | - public static EventManager? instance = null; |
217 | - |
218 | - public EventManager () { |
219 | - |
220 | - } |
221 | - |
222 | - public void key_changed (GLib.Settings settings, string key) { |
223 | - if (settings.schema_id != "org.pantheon.configurator") |
224 | - event (EventType.KEY_CHANGED, settings, key); |
225 | - } |
226 | - |
227 | - public static EventManager get_default () { |
228 | - if (instance == null) { |
229 | - instance = new EventManager (); |
230 | - } |
231 | - |
232 | - return instance; |
233 | - } |
234 | - } |
235 | -} |
236 | + public enum EventType { |
237 | + KEY_CHANGED |
238 | + } |
239 | + |
240 | + public class EventManager : Object { |
241 | + public signal void event (EventType type, GLib.Settings settings, string key); |
242 | + |
243 | + public static EventManager? instance = null; |
244 | + |
245 | + public EventManager () { |
246 | + } |
247 | + |
248 | + public void key_changed (GLib.Settings settings, string key) { |
249 | + if (settings.schema_id != "org.pantheon.configurator") { |
250 | + event (EventType.KEY_CHANGED, settings, key); |
251 | + } |
252 | + } |
253 | + |
254 | + public static EventManager get_default () { |
255 | + if (instance == null) { |
256 | + instance = new EventManager (); |
257 | + } |
258 | + |
259 | + return instance; |
260 | + } |
261 | + } |
262 | +} |
263 | \ No newline at end of file |
264 | |
265 | === modified file 'src/Services/Settings.vala' |
266 | --- src/Services/Settings.vala 2015-04-04 19:12:47 +0000 |
267 | +++ src/Services/Settings.vala 2015-08-04 19:27:32 +0000 |
268 | @@ -1,37 +1,38 @@ |
269 | -/* Copyright 2015 Marcus Wichelmann |
270 | -* |
271 | -* This file is part of Configurator. |
272 | -* |
273 | -* Configurator is free software: you can redistribute it |
274 | -* and/or modify it under the terms of the GNU General Public License as |
275 | -* published by the Free Software Foundation, either version 3 of the |
276 | -* License, or (at your option) any later version. |
277 | -* |
278 | -* Configurator is distributed in the hope that it will be |
279 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
280 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
281 | -* Public License for more details. |
282 | -* |
283 | -* You should have received a copy of the GNU General Public License along |
284 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
285 | -*/ |
286 | +/* |
287 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
288 | + * |
289 | + * This program is free software; you can redistribute it and/or |
290 | + * modify it under the terms of the GNU General Public |
291 | + * License as published by the Free Software Foundation; either |
292 | + * version 2 of the License, or (at your option) any later version. |
293 | + * |
294 | + * This program is distributed in the hope that it will be useful, |
295 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
296 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
297 | + * General Public License for more details. |
298 | + * |
299 | + * You should have received a copy of the GNU General Public |
300 | + * License along with this program; if not, write to the |
301 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
302 | + * Boston, MA 02111-1307, USA. |
303 | + */ |
304 | |
305 | namespace configurator.Services { |
306 | - public class Settings : Granite.Services.Settings { |
307 | - public bool maximized { get; set; } |
308 | - |
309 | - public static Settings? instance = null; |
310 | - |
311 | - public Settings () { |
312 | - base ("org.pantheon.configurator"); |
313 | - } |
314 | - |
315 | - public static Settings get_default () { |
316 | - if (instance == null) { |
317 | - instance = new Settings (); |
318 | - } |
319 | - |
320 | - return instance; |
321 | - } |
322 | - } |
323 | -} |
324 | + public class Settings : Granite.Services.Settings { |
325 | + public bool maximized { get; set; } |
326 | + |
327 | + public static Settings? instance = null; |
328 | + |
329 | + public Settings () { |
330 | + base ("org.pantheon.configurator"); |
331 | + } |
332 | + |
333 | + public static Settings get_default () { |
334 | + if (instance == null) { |
335 | + instance = new Settings (); |
336 | + } |
337 | + |
338 | + return instance; |
339 | + } |
340 | + } |
341 | +} |
342 | \ No newline at end of file |
343 | |
344 | === modified file 'src/Utils.vala' |
345 | --- src/Utils.vala 2015-04-12 12:50:47 +0000 |
346 | +++ src/Utils.vala 2015-08-04 19:27:32 +0000 |
347 | @@ -1,103 +1,127 @@ |
348 | -/* Copyright 2015 Marcus Wichelmann |
349 | -* |
350 | -* This file is part of Configurator. |
351 | -* |
352 | -* Configurator is free software: you can redistribute it |
353 | -* and/or modify it under the terms of the GNU General Public License as |
354 | -* published by the Free Software Foundation, either version 3 of the |
355 | -* License, or (at your option) any later version. |
356 | -* |
357 | -* Configurator is distributed in the hope that it will be |
358 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
359 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
360 | -* Public License for more details. |
361 | -* |
362 | -* You should have received a copy of the GNU General Public License along |
363 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
364 | -*/ |
365 | +/* |
366 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
367 | + * |
368 | + * This program is free software; you can redistribute it and/or |
369 | + * modify it under the terms of the GNU General Public |
370 | + * License as published by the Free Software Foundation; either |
371 | + * version 2 of the License, or (at your option) any later version. |
372 | + * |
373 | + * This program is distributed in the hope that it will be useful, |
374 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
375 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
376 | + * General Public License for more details. |
377 | + * |
378 | + * You should have received a copy of the GNU General Public |
379 | + * License along with this program; if not, write to the |
380 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
381 | + * Boston, MA 02111-1307, USA. |
382 | + */ |
383 | |
384 | namespace configurator.Utils { |
385 | - public string type_to_string (VariantType variant_type) { |
386 | - var type = variant_type.dup_string (); |
387 | - |
388 | - if (type.has_prefix ("a") && type.length >= 2) |
389 | - return "Array of %s".printf (dup_type_to_string (type.substring (1)).down ()); |
390 | - |
391 | - return dup_type_to_string (type); |
392 | - } |
393 | - |
394 | - public string dup_type_to_string (string type) { |
395 | - switch (type) { |
396 | - case "b": |
397 | - return "Boolean"; |
398 | - case "y": |
399 | - return "Byte"; |
400 | - case "n": |
401 | - return "Integer"; |
402 | - case "q": |
403 | - return "Unsigned integer"; |
404 | - case "i": |
405 | - return "Int32"; |
406 | - case "u": |
407 | - return "Unsigned Int32"; |
408 | - case "x": |
409 | - return "Int64"; |
410 | - case "t": |
411 | - return "Unsigned Int64"; |
412 | - case "h": |
413 | - return "Handle"; |
414 | - case "s": |
415 | - case "o": |
416 | - case "g": |
417 | - return "String"; |
418 | - } |
419 | - |
420 | - return "\"%s\"".printf (type); |
421 | - } |
422 | - |
423 | - public string variant_to_string (Variant variant) { |
424 | - var type = variant.get_type ().dup_string (); |
425 | - |
426 | - switch (type) { |
427 | - case "b": |
428 | - return variant.get_boolean () ? _("Enabled") : _("Disabled"); |
429 | - case "y": |
430 | - return variant.get_byte ().to_string (); |
431 | - case "n": |
432 | - return variant.get_int16 ().to_string (); |
433 | - case "q": |
434 | - return variant.get_uint16 ().to_string (); |
435 | - case "i": |
436 | - return variant.get_int32 ().to_string (); |
437 | - case "u": |
438 | - return variant.get_uint32 ().to_string (); |
439 | - case "x": |
440 | - return variant.get_int64 ().to_string (); |
441 | - case "t": |
442 | - return variant.get_uint64 ().to_string (); |
443 | - case "h": |
444 | - return variant.get_handle ().to_string (); |
445 | - case "s": |
446 | - case "o": |
447 | - case "g": |
448 | - return "\"%s\"".printf (variant.get_string ().to_string ()); |
449 | - case "as": |
450 | - var strings = variant.get_strv (); |
451 | - var text = ""; |
452 | - |
453 | - if (strings.length == 0) |
454 | - return _("Empty array"); |
455 | - |
456 | - for (int i = 0; i < strings.length; i++) { |
457 | - text += "\"%s\"".printf (strings[i]); |
458 | - |
459 | - if (i < strings.length -1) |
460 | - text += ", "; |
461 | - } |
462 | - |
463 | - return text; |
464 | - } |
465 | - |
466 | - return _("Preview not supported."); |
467 | - } |
468 | -} |
469 | + public string type_to_string (VariantType variant_type) { |
470 | + var type = variant_type.dup_string (); |
471 | + |
472 | + if (type.has_prefix ("a") && type.length >= 2) { |
473 | + return "Array of %s".printf (dup_type_to_string (type.substring (1)).down ()); |
474 | + } |
475 | + |
476 | + return dup_type_to_string (type); |
477 | + } |
478 | + |
479 | + public string dup_type_to_string (string type) { |
480 | + switch (type) { |
481 | + case "b": |
482 | + |
483 | + return "Boolean"; |
484 | + case "y": |
485 | + |
486 | + return "Byte"; |
487 | + case "n": |
488 | + |
489 | + return "Integer"; |
490 | + case "q": |
491 | + |
492 | + return "Unsigned integer"; |
493 | + case "i": |
494 | + |
495 | + return "Int32"; |
496 | + case "u": |
497 | + |
498 | + return "Unsigned Int32"; |
499 | + case "x": |
500 | + |
501 | + return "Int64"; |
502 | + case "t": |
503 | + |
504 | + return "Unsigned Int64"; |
505 | + case "h": |
506 | + |
507 | + return "Handle"; |
508 | + case "s": |
509 | + case "o": |
510 | + case "g": |
511 | + |
512 | + return "String"; |
513 | + } |
514 | + |
515 | + return "\"%s\"".printf (type); |
516 | + } |
517 | + |
518 | + public string variant_to_string (Variant variant) { |
519 | + var type = variant.get_type ().dup_string (); |
520 | + |
521 | + switch (type) { |
522 | + case "b": |
523 | + |
524 | + return variant.get_boolean () ? _("Enabled") : _("Disabled"); |
525 | + case "y": |
526 | + |
527 | + return variant.get_byte ().to_string (); |
528 | + case "n": |
529 | + |
530 | + return variant.get_int16 ().to_string (); |
531 | + case "q": |
532 | + |
533 | + return variant.get_uint16 ().to_string (); |
534 | + case "i": |
535 | + |
536 | + return variant.get_int32 ().to_string (); |
537 | + case "u": |
538 | + |
539 | + return variant.get_uint32 ().to_string (); |
540 | + case "x": |
541 | + |
542 | + return variant.get_int64 ().to_string (); |
543 | + case "t": |
544 | + |
545 | + return variant.get_uint64 ().to_string (); |
546 | + case "h": |
547 | + |
548 | + return variant.get_handle ().to_string (); |
549 | + case "s": |
550 | + case "o": |
551 | + case "g": |
552 | + |
553 | + return "\"%s\"".printf (variant.get_string ().to_string ()); |
554 | + case "as": |
555 | + var strings = variant.get_strv (); |
556 | + var text = ""; |
557 | + |
558 | + if (strings.length == 0) { |
559 | + return _("Empty array"); |
560 | + } |
561 | + |
562 | + for (int i = 0; i < strings.length; i++) { |
563 | + text += "\"%s\"".printf (strings[i]); |
564 | + |
565 | + if (i < strings.length - 1) { |
566 | + text += ", "; |
567 | + } |
568 | + } |
569 | + |
570 | + return text; |
571 | + } |
572 | + |
573 | + return _("Preview not supported."); |
574 | + } |
575 | +} |
576 | \ No newline at end of file |
577 | |
578 | === modified file 'src/Widgets/BrowserView.vala' |
579 | --- src/Widgets/BrowserView.vala 2015-04-16 17:11:58 +0000 |
580 | +++ src/Widgets/BrowserView.vala 2015-08-04 19:27:32 +0000 |
581 | @@ -1,53 +1,55 @@ |
582 | -/* Copyright 2015 Marcus Wichelmann |
583 | -* |
584 | -* This file is part of Configurator. |
585 | -* |
586 | -* Configurator is free software: you can redistribute it |
587 | -* and/or modify it under the terms of the GNU General Public License as |
588 | -* published by the Free Software Foundation, either version 3 of the |
589 | -* License, or (at your option) any later version. |
590 | -* |
591 | -* Configurator is distributed in the hope that it will be |
592 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
593 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
594 | -* Public License for more details. |
595 | -* |
596 | -* You should have received a copy of the GNU General Public License along |
597 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
598 | -*/ |
599 | +/* |
600 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
601 | + * |
602 | + * This program is free software; you can redistribute it and/or |
603 | + * modify it under the terms of the GNU General Public |
604 | + * License as published by the Free Software Foundation; either |
605 | + * version 2 of the License, or (at your option) any later version. |
606 | + * |
607 | + * This program is distributed in the hope that it will be useful, |
608 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
609 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
610 | + * General Public License for more details. |
611 | + * |
612 | + * You should have received a copy of the GNU General Public |
613 | + * License along with this program; if not, write to the |
614 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
615 | + * Boston, MA 02111-1307, USA. |
616 | + */ |
617 | |
618 | namespace configurator.Widgets { |
619 | - public class BrowserView : Gtk.Paned { |
620 | - private SchemaList schema_list; |
621 | - |
622 | - private Gtk.ScrolledWindow scrolled; |
623 | - private KeyList key_list; |
624 | - |
625 | - public BrowserView () { |
626 | - schema_list = new SchemaList (); |
627 | - schema_list.set_size_request (200, -1); |
628 | - schema_list.item_selected.connect ((item) => { |
629 | - if (item.get_type () == typeof (Schema)) |
630 | - key_list.show_keys_for_schema ((item as Schema).get_schema ()); |
631 | - else if (item.get_type () == typeof (SchemaFolder)) |
632 | - key_list.show_keys_for_schema ((item as SchemaFolder).get_schema ()); |
633 | - else |
634 | - key_list.clear_list (); |
635 | - }); |
636 | - |
637 | - this.pack1 (schema_list, false, false); |
638 | - |
639 | - scrolled = new Gtk.ScrolledWindow (null, null); |
640 | - scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER; |
641 | - |
642 | - key_list = new KeyList (); |
643 | - key_list.valign = Gtk.Align.START; |
644 | - key_list.margin_start = 12; |
645 | - key_list.margin_end = 12; |
646 | - |
647 | - scrolled.add (key_list); |
648 | - |
649 | - this.pack2 (scrolled, true, false); |
650 | - } |
651 | - } |
652 | -} |
653 | + public class BrowserView : Gtk.Paned { |
654 | + private SchemaList schema_list; |
655 | + |
656 | + private Gtk.ScrolledWindow scrolled; |
657 | + private KeyList key_list; |
658 | + |
659 | + public BrowserView () { |
660 | + schema_list = new SchemaList (); |
661 | + schema_list.set_size_request (200, -1); |
662 | + schema_list.item_selected.connect ((item) => { |
663 | + if (item.get_type () == typeof (Schema)) { |
664 | + key_list.show_keys_for_schema ((item as Schema).get_schema ()); |
665 | + } else if (item.get_type () == typeof (SchemaFolder)) { |
666 | + key_list.show_keys_for_schema ((item as SchemaFolder).get_schema ()); |
667 | + } else { |
668 | + key_list.clear_list (); |
669 | + } |
670 | + }); |
671 | + |
672 | + this.pack1 (schema_list, false, false); |
673 | + |
674 | + scrolled = new Gtk.ScrolledWindow (null, null); |
675 | + scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER; |
676 | + |
677 | + key_list = new KeyList (); |
678 | + key_list.valign = Gtk.Align.START; |
679 | + key_list.margin_start = 12; |
680 | + key_list.margin_end = 12; |
681 | + |
682 | + scrolled.add (key_list); |
683 | + |
684 | + this.pack2 (scrolled, true, false); |
685 | + } |
686 | + } |
687 | +} |
688 | \ No newline at end of file |
689 | |
690 | === modified file 'src/Widgets/EventsView.vala' |
691 | --- src/Widgets/EventsView.vala 2015-04-14 22:17:42 +0000 |
692 | +++ src/Widgets/EventsView.vala 2015-08-04 19:27:32 +0000 |
693 | @@ -1,64 +1,65 @@ |
694 | -/* Copyright 2015 Marcus Wichelmann |
695 | -* |
696 | -* This file is part of Configurator. |
697 | -* |
698 | -* Configurator is free software: you can redistribute it |
699 | -* and/or modify it under the terms of the GNU General Public License as |
700 | -* published by the Free Software Foundation, either version 3 of the |
701 | -* License, or (at your option) any later version. |
702 | -* |
703 | -* Configurator is distributed in the hope that it will be |
704 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
705 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
706 | -* Public License for more details. |
707 | -* |
708 | -* You should have received a copy of the GNU General Public License along |
709 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
710 | -*/ |
711 | +/* |
712 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
713 | + * |
714 | + * This program is free software; you can redistribute it and/or |
715 | + * modify it under the terms of the GNU General Public |
716 | + * License as published by the Free Software Foundation; either |
717 | + * version 2 of the License, or (at your option) any later version. |
718 | + * |
719 | + * This program is distributed in the hope that it will be useful, |
720 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
721 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
722 | + * General Public License for more details. |
723 | + * |
724 | + * You should have received a copy of the GNU General Public |
725 | + * License along with this program; if not, write to the |
726 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
727 | + * Boston, MA 02111-1307, USA. |
728 | + */ |
729 | |
730 | namespace configurator.Widgets { |
731 | - public class EventsView : Gtk.Box { |
732 | - private Gtk.Stack stack; |
733 | - |
734 | - private InfoScreen info_screen; |
735 | - |
736 | - private Gtk.ScrolledWindow scrolled; |
737 | - private KeyList key_list; |
738 | - |
739 | - public EventsView () { |
740 | - stack = new Gtk.Stack (); |
741 | - |
742 | - info_screen = new InfoScreen (_("No events logged yet"), |
743 | - _("On this page you'll see a list of settings-keys that have changed since you have started this application.") + "\n\n" + |
744 | - _("You could use this feature to search for keys that are changed by the preferences of another program. Thanks to the code-examples you're then\nable to integrate these keys into your own applications and scripts."), |
745 | - "dialog-information"); |
746 | - |
747 | - stack.add_named (info_screen, "info-screen"); |
748 | - |
749 | - scrolled = new Gtk.ScrolledWindow (null, null); |
750 | - scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER; |
751 | - |
752 | - key_list = new KeyList (); |
753 | - key_list.valign = Gtk.Align.START; |
754 | - key_list.margin_start = 12; |
755 | - key_list.margin_end = 12; |
756 | - |
757 | - scrolled.add (key_list); |
758 | - |
759 | - stack.add_named (scrolled, "key-list"); |
760 | - |
761 | - this.pack_start (stack, true, true); |
762 | - |
763 | - Services.EventManager.get_default ().event.connect ((type, settings, key) => { |
764 | - if (type == Services.EventType.KEY_CHANGED) { |
765 | - stack.set_visible_child_name ("key-list"); |
766 | - |
767 | - key_list.add_item (settings, key, true, false, true); |
768 | - key_list.show_all (); |
769 | - } else { |
770 | - warning (_("Unsupported event type \"%s\""), type.to_string ()); |
771 | - } |
772 | - }); |
773 | - } |
774 | - } |
775 | -} |
776 | + public class EventsView : Gtk.Box { |
777 | + private Gtk.Stack stack; |
778 | + |
779 | + private InfoScreen info_screen; |
780 | + |
781 | + private Gtk.ScrolledWindow scrolled; |
782 | + private KeyList key_list; |
783 | + |
784 | + public EventsView () { |
785 | + stack = new Gtk.Stack (); |
786 | + |
787 | + info_screen = new InfoScreen (_("No events logged yet"), |
788 | + _("On this page you'll see a list of settings-keys that have changed since you have started this application.") + "\n\n" + |
789 | + _("You could use this feature to search for keys that are changed by the preferences of another program. Thanks to the code-examples you're then\nable to integrate these keys into your own applications and scripts."), |
790 | + "dialog-information"); |
791 | + |
792 | + stack.add_named (info_screen, "info-screen"); |
793 | + |
794 | + scrolled = new Gtk.ScrolledWindow (null, null); |
795 | + scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER; |
796 | + |
797 | + key_list = new KeyList (); |
798 | + key_list.valign = Gtk.Align.START; |
799 | + key_list.margin_start = 12; |
800 | + key_list.margin_end = 12; |
801 | + |
802 | + scrolled.add (key_list); |
803 | + |
804 | + stack.add_named (scrolled, "key-list"); |
805 | + |
806 | + this.pack_start (stack, true, true); |
807 | + |
808 | + Services.EventManager.get_default ().event.connect ((type, settings, key) => { |
809 | + if (type == Services.EventType.KEY_CHANGED) { |
810 | + stack.set_visible_child_name ("key-list"); |
811 | + |
812 | + key_list.add_item (settings, key, true, false, true); |
813 | + key_list.show_all (); |
814 | + } else { |
815 | + warning (_("Unsupported event type \"%s\""), type.to_string ()); |
816 | + } |
817 | + }); |
818 | + } |
819 | + } |
820 | +} |
821 | \ No newline at end of file |
822 | |
823 | === modified file 'src/Widgets/Fields/ArrayInput.vala' |
824 | --- src/Widgets/Fields/ArrayInput.vala 2015-04-15 18:56:01 +0000 |
825 | +++ src/Widgets/Fields/ArrayInput.vala 2015-08-04 19:27:32 +0000 |
826 | @@ -1,201 +1,203 @@ |
827 | -/* Copyright 2015 Marcus Wichelmann |
828 | -* |
829 | -* This file is part of Configurator. |
830 | -* |
831 | -* Configurator is free software: you can redistribute it |
832 | -* and/or modify it under the terms of the GNU General Public License as |
833 | -* published by the Free Software Foundation, either version 3 of the |
834 | -* License, or (at your option) any later version. |
835 | -* |
836 | -* Configurator is distributed in the hope that it will be |
837 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
838 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
839 | -* Public License for more details. |
840 | -* |
841 | -* You should have received a copy of the GNU General Public License along |
842 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
843 | -*/ |
844 | +/* |
845 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
846 | + * |
847 | + * This program is free software; you can redistribute it and/or |
848 | + * modify it under the terms of the GNU General Public |
849 | + * License as published by the Free Software Foundation; either |
850 | + * version 2 of the License, or (at your option) any later version. |
851 | + * |
852 | + * This program is distributed in the hope that it will be useful, |
853 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
854 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
855 | + * General Public License for more details. |
856 | + * |
857 | + * You should have received a copy of the GNU General Public |
858 | + * License along with this program; if not, write to the |
859 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
860 | + * Boston, MA 02111-1307, USA. |
861 | + */ |
862 | |
863 | namespace configurator.Widgets.Fields { |
864 | - public class ArrayInput : Gtk.Button { |
865 | - private Gtk.Popover popover; |
866 | - |
867 | - private Gtk.Box box; |
868 | - |
869 | - private Gtk.ListBox listbox; |
870 | - |
871 | - private Gtk.ActionBar action_bar; |
872 | - |
873 | - private Gtk.Entry add_entry; |
874 | - private Gtk.Button add_button; |
875 | - |
876 | - public ArrayInput (Settings settings, string key) { |
877 | - popover = new Gtk.Popover (this); |
878 | - |
879 | - this.clicked.connect (() => popover.show_all ()); |
880 | - |
881 | - box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); |
882 | - |
883 | - listbox = new Gtk.ListBox (); |
884 | - listbox.margin_top = 3; |
885 | - listbox.margin_bottom = 3; |
886 | - |
887 | - box.pack_start (listbox, true, true); |
888 | - |
889 | - action_bar = new Gtk.ActionBar (); |
890 | - |
891 | - add_entry = new Gtk.Entry (); |
892 | - add_entry.hexpand = true; |
893 | - add_entry.placeholder_text = _("New element"); |
894 | - |
895 | - action_bar.pack_start (add_entry); |
896 | - |
897 | - add_button = new Gtk.Button.from_icon_name ("list-add-symbolic", Gtk.IconSize.BUTTON); |
898 | - add_button.clicked.connect (() => { |
899 | - Variant? new_child = null; |
900 | - |
901 | - var type = settings.get_value (key).get_type ().dup_string (); |
902 | - |
903 | - assert (type.has_prefix ("a") && type.length == 2); |
904 | - |
905 | - switch (type.substring (1)) { |
906 | - case "b": |
907 | - new_child = new Variant.boolean (add_entry.text.down () == "true" || add_entry.text.down () == "on" || add_entry.text.down () == "enabled" || add_entry.text.down () == _("Enabled").down ()); |
908 | - break; |
909 | - case "y": |
910 | - new_child = new Variant.byte ((uchar)int.parse (add_entry.text)); |
911 | - break; |
912 | - case "n": |
913 | - new_child = new Variant.int16 ((int16)int.parse (add_entry.text)); |
914 | - break; |
915 | - case "q": |
916 | - new_child = new Variant.uint16 ((uint16)int.parse (add_entry.text)); |
917 | - break; |
918 | - case "i": |
919 | - new_child = new Variant.int32 ((int32)int.parse (add_entry.text)); |
920 | - break; |
921 | - case "u": |
922 | - new_child = new Variant.uint32 ((uint32)int.parse (add_entry.text)); |
923 | - break; |
924 | - case "x": |
925 | - new_child = new Variant.int64 ((int64)int.parse (add_entry.text)); |
926 | - break; |
927 | - case "t": |
928 | - new_child = new Variant.uint64 ((uint64)int.parse (add_entry.text)); |
929 | - break; |
930 | - case "h": |
931 | - new_child = new Variant.int32 ((int32)int.parse (add_entry.text)); |
932 | - break; |
933 | - case "s": |
934 | - case "o": |
935 | - case "g": |
936 | - new_child = new Variant.string (add_entry.text); |
937 | - break; |
938 | - default: |
939 | - warning (_("Unsupported type \"%s\". Can't create new entry."), type); |
940 | - break; |
941 | - } |
942 | - |
943 | - if (new_child != null) { |
944 | - var childs = settings.get_value (key).n_children (); |
945 | - Variant[] new_child_list = new Variant[childs + 1]; |
946 | - |
947 | - for (int c = 0; c < childs; c++) { |
948 | - new_child_list[c] = settings.get_value (key).get_child_value (c); |
949 | - } |
950 | - |
951 | - new_child_list[childs] = new_child; |
952 | - |
953 | - var new_val = new Variant.array (new_child.get_type (), new_child_list); |
954 | - |
955 | - settings.set_value (key, new_val); |
956 | - |
957 | - add_entry.text = ""; |
958 | - } |
959 | - }); |
960 | - |
961 | - action_bar.pack_end (add_button); |
962 | - |
963 | - box.pack_end (action_bar, true, false); |
964 | - |
965 | - popover.add (box); |
966 | - |
967 | - display_value (settings, key, settings.get_value (key)); |
968 | - |
969 | - settings.changed.connect ((k) => { |
970 | - if (k == key) { |
971 | - listbox.get_children ().foreach ((item) => listbox.remove (item)); |
972 | - display_value (settings, key, settings.get_value (key)); |
973 | - } |
974 | - }); |
975 | - } |
976 | - |
977 | - private void display_value (Settings settings, string key, Variant val) { |
978 | - assert (val.is_container ()); |
979 | - |
980 | - var childs = val.n_children (); |
981 | - |
982 | - this.label = _("%s elements").printf (childs.to_string ()); |
983 | - |
984 | - if (childs < 1) { |
985 | - var no_items_label = new Gtk.Label (_("No items found.")); |
986 | - no_items_label.get_style_context ().add_class ("h3"); |
987 | - no_items_label.hexpand = true; |
988 | - no_items_label.vexpand = true; |
989 | - no_items_label.halign = Gtk.Align.CENTER; |
990 | - no_items_label.valign = Gtk.Align.CENTER; |
991 | - no_items_label.margin_start = 6; |
992 | - no_items_label.margin_end = 6; |
993 | - no_items_label.set_size_request (-1, 60); |
994 | - no_items_label.sensitive = false; |
995 | - |
996 | - listbox.add (no_items_label); |
997 | - } else { |
998 | - for (int i = 0; i < childs; i++) { |
999 | - var child_index = i; |
1000 | - var child = val.get_child_value (child_index); |
1001 | - |
1002 | - var item = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6); |
1003 | - item.margin_start = 6; |
1004 | - item.margin_end = 6; |
1005 | - |
1006 | - var item_number = new Gtk.Label ("<b>%s</b>".printf (child_index.to_string ())); |
1007 | - item_number.use_markup = true; |
1008 | - item_number.halign = Gtk.Align.END; |
1009 | - item_number.valign = Gtk.Align.CENTER; |
1010 | - |
1011 | - item.pack_start (item_number, false, false); |
1012 | - |
1013 | - var item_content = new Gtk.Label (Utils.variant_to_string (child)); |
1014 | - item_content.halign = Gtk.Align.START; |
1015 | - item_content.valign = Gtk.Align.CENTER; |
1016 | - |
1017 | - item.pack_start (item_content, true, true); |
1018 | - |
1019 | - var item_remove_button = new Gtk.Button.from_icon_name ("list-remove-symbolic", Gtk.IconSize.BUTTON); |
1020 | - item_remove_button.relief = Gtk.ReliefStyle.NONE; |
1021 | - item_remove_button.clicked.connect (() => { |
1022 | - Variant[] new_child_list = new Variant[childs - 1]; |
1023 | - var new_child_list_counter = 0; |
1024 | - |
1025 | - for (int c = 0; c < childs; c++) { |
1026 | - if (c != child_index) { |
1027 | - new_child_list[new_child_list_counter++] = val.get_child_value (c); |
1028 | - } |
1029 | - } |
1030 | - |
1031 | - var new_val = new Variant.array (child.get_type (), new_child_list); |
1032 | - |
1033 | - settings.set_value (key, new_val); |
1034 | - }); |
1035 | - |
1036 | - item.pack_end (item_remove_button, false, false); |
1037 | - |
1038 | - listbox.add (item); |
1039 | - } |
1040 | - } |
1041 | - |
1042 | - listbox.show_all (); |
1043 | - } |
1044 | - } |
1045 | -} |
1046 | + public class ArrayInput : Gtk.Button { |
1047 | + private Gtk.Popover popover; |
1048 | + |
1049 | + private Gtk.Box box; |
1050 | + |
1051 | + private Gtk.ListBox listbox; |
1052 | + |
1053 | + private Gtk.ActionBar action_bar; |
1054 | + |
1055 | + private Gtk.Entry add_entry; |
1056 | + private Gtk.Button add_button; |
1057 | + |
1058 | + public ArrayInput (Settings settings, string key) { |
1059 | + popover = new Gtk.Popover (this); |
1060 | + |
1061 | + this.clicked.connect (() => popover.show_all ()); |
1062 | + |
1063 | + box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); |
1064 | + |
1065 | + listbox = new Gtk.ListBox (); |
1066 | + listbox.margin_top = 3; |
1067 | + listbox.margin_bottom = 3; |
1068 | + |
1069 | + box.pack_start (listbox, true, true); |
1070 | + |
1071 | + action_bar = new Gtk.ActionBar (); |
1072 | + |
1073 | + add_entry = new Gtk.Entry (); |
1074 | + add_entry.hexpand = true; |
1075 | + add_entry.placeholder_text = _("New element"); |
1076 | + |
1077 | + action_bar.pack_start (add_entry); |
1078 | + |
1079 | + add_button = new Gtk.Button.from_icon_name ("list-add-symbolic", Gtk.IconSize.BUTTON); |
1080 | + add_button.clicked.connect (() => { |
1081 | + Variant? new_child = null; |
1082 | + |
1083 | + var type = settings.get_value (key).get_type ().dup_string (); |
1084 | + |
1085 | + assert (type.has_prefix ("a") && type.length == 2); |
1086 | + |
1087 | + switch (type.substring (1)) { |
1088 | + case "b" : |
1089 | + new_child = new Variant.boolean (add_entry.text.down () == "true" || add_entry.text.down () == "on" || add_entry.text.down () == "enabled" || add_entry.text.down () == _("Enabled").down ()); |
1090 | + break; |
1091 | + case "y": |
1092 | + new_child = new Variant.byte ((uchar)int.parse (add_entry.text)); |
1093 | + break; |
1094 | + case "n": |
1095 | + new_child = new Variant.int16 ((int16)int.parse (add_entry.text)); |
1096 | + break; |
1097 | + case "q": |
1098 | + new_child = new Variant.uint16 ((uint16)int.parse (add_entry.text)); |
1099 | + break; |
1100 | + case "i": |
1101 | + new_child = new Variant.int32 ((int32)int.parse (add_entry.text)); |
1102 | + break; |
1103 | + case "u": |
1104 | + new_child = new Variant.uint32 ((uint32)int.parse (add_entry.text)); |
1105 | + break; |
1106 | + case "x": |
1107 | + new_child = new Variant.int64 ((int64)int.parse (add_entry.text)); |
1108 | + break; |
1109 | + case "t": |
1110 | + new_child = new Variant.uint64 ((uint64)int.parse (add_entry.text)); |
1111 | + break; |
1112 | + case "h": |
1113 | + new_child = new Variant.int32 ((int32)int.parse (add_entry.text)); |
1114 | + break; |
1115 | + case "s": |
1116 | + case "o": |
1117 | + case "g": |
1118 | + new_child = new Variant.string (add_entry.text); |
1119 | + break; |
1120 | + default: |
1121 | + warning (_("Unsupported type \"%s\". Can't create new entry."), type); |
1122 | + break; |
1123 | + } |
1124 | + |
1125 | + if (new_child != null) { |
1126 | + var childs = settings.get_value (key).n_children (); |
1127 | + Variant[] new_child_list = new Variant[childs + 1]; |
1128 | + |
1129 | + for (int c = 0; c < childs; c++) { |
1130 | + new_child_list[c] = settings.get_value (key).get_child_value (c); |
1131 | + } |
1132 | + |
1133 | + new_child_list[childs] = new_child; |
1134 | + |
1135 | + var new_val = new Variant.array (new_child.get_type (), new_child_list); |
1136 | + |
1137 | + settings.set_value (key, new_val); |
1138 | + |
1139 | + add_entry.text = ""; |
1140 | + } |
1141 | + }); |
1142 | + |
1143 | + action_bar.pack_end (add_button); |
1144 | + |
1145 | + box.pack_end (action_bar, true, false); |
1146 | + |
1147 | + popover.add (box); |
1148 | + |
1149 | + display_value (settings, key, settings.get_value (key)); |
1150 | + |
1151 | + settings.changed.connect ((k) => { |
1152 | + if (k == key) { |
1153 | + listbox.get_children ().foreach ((item) => listbox.remove (item)); |
1154 | + |
1155 | + display_value (settings, key, settings.get_value (key)); |
1156 | + } |
1157 | + }); |
1158 | + } |
1159 | + |
1160 | + private void display_value (Settings settings, string key, Variant val) { |
1161 | + assert (val.is_container ()); |
1162 | + |
1163 | + var childs = val.n_children (); |
1164 | + |
1165 | + this.label = _("%s elements").printf (childs.to_string ()); |
1166 | + |
1167 | + if (childs < 1) { |
1168 | + var no_items_label = new Gtk.Label (_("No items found.")); |
1169 | + no_items_label.get_style_context ().add_class ("h3"); |
1170 | + no_items_label.hexpand = true; |
1171 | + no_items_label.vexpand = true; |
1172 | + no_items_label.halign = Gtk.Align.CENTER; |
1173 | + no_items_label.valign = Gtk.Align.CENTER; |
1174 | + no_items_label.margin_start = 6; |
1175 | + no_items_label.margin_end = 6; |
1176 | + no_items_label.set_size_request (-1, 60); |
1177 | + no_items_label.sensitive = false; |
1178 | + |
1179 | + listbox.add (no_items_label); |
1180 | + } else { |
1181 | + for (int i = 0; i < childs; i++) { |
1182 | + var child_index = i; |
1183 | + var child = val.get_child_value (child_index); |
1184 | + |
1185 | + var item = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6); |
1186 | + item.margin_start = 6; |
1187 | + item.margin_end = 6; |
1188 | + |
1189 | + var item_number = new Gtk.Label ("<b>%s</b>".printf (child_index.to_string ())); |
1190 | + item_number.use_markup = true; |
1191 | + item_number.halign = Gtk.Align.END; |
1192 | + item_number.valign = Gtk.Align.CENTER; |
1193 | + |
1194 | + item.pack_start (item_number, false, false); |
1195 | + |
1196 | + var item_content = new Gtk.Label (Utils.variant_to_string (child)); |
1197 | + item_content.halign = Gtk.Align.START; |
1198 | + item_content.valign = Gtk.Align.CENTER; |
1199 | + |
1200 | + item.pack_start (item_content, true, true); |
1201 | + |
1202 | + var item_remove_button = new Gtk.Button.from_icon_name ("list-remove-symbolic", Gtk.IconSize.BUTTON); |
1203 | + item_remove_button.relief = Gtk.ReliefStyle.NONE; |
1204 | + item_remove_button.clicked.connect (() => { |
1205 | + Variant[] new_child_list = new Variant[childs - 1]; |
1206 | + var new_child_list_counter = 0; |
1207 | + |
1208 | + for (int c = 0; c < childs; c++) { |
1209 | + if (c != child_index) { |
1210 | + new_child_list[new_child_list_counter++] = val.get_child_value (c); |
1211 | + } |
1212 | + } |
1213 | + |
1214 | + var new_val = new Variant.array (child.get_type (), new_child_list); |
1215 | + |
1216 | + settings.set_value (key, new_val); |
1217 | + }); |
1218 | + |
1219 | + item.pack_end (item_remove_button, false, false); |
1220 | + |
1221 | + listbox.add (item); |
1222 | + } |
1223 | + } |
1224 | + |
1225 | + listbox.show_all (); |
1226 | + } |
1227 | + } |
1228 | +} |
1229 | \ No newline at end of file |
1230 | |
1231 | === modified file 'src/Widgets/Fields/BoolInput.vala' |
1232 | --- src/Widgets/Fields/BoolInput.vala 2015-04-10 23:54:28 +0000 |
1233 | +++ src/Widgets/Fields/BoolInput.vala 2015-08-04 19:27:32 +0000 |
1234 | @@ -1,25 +1,25 @@ |
1235 | -/* Copyright 2015 Marcus Wichelmann |
1236 | -* |
1237 | -* This file is part of Configurator. |
1238 | -* |
1239 | -* Configurator is free software: you can redistribute it |
1240 | -* and/or modify it under the terms of the GNU General Public License as |
1241 | -* published by the Free Software Foundation, either version 3 of the |
1242 | -* License, or (at your option) any later version. |
1243 | -* |
1244 | -* Configurator is distributed in the hope that it will be |
1245 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1246 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1247 | -* Public License for more details. |
1248 | -* |
1249 | -* You should have received a copy of the GNU General Public License along |
1250 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1251 | -*/ |
1252 | +/* |
1253 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1254 | + * |
1255 | + * This program is free software; you can redistribute it and/or |
1256 | + * modify it under the terms of the GNU General Public |
1257 | + * License as published by the Free Software Foundation; either |
1258 | + * version 2 of the License, or (at your option) any later version. |
1259 | + * |
1260 | + * This program is distributed in the hope that it will be useful, |
1261 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1262 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1263 | + * General Public License for more details. |
1264 | + * |
1265 | + * You should have received a copy of the GNU General Public |
1266 | + * License along with this program; if not, write to the |
1267 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1268 | + * Boston, MA 02111-1307, USA. |
1269 | + */ |
1270 | |
1271 | namespace configurator.Widgets.Fields { |
1272 | - public class BoolInput : Gtk.Switch { |
1273 | - public BoolInput () { |
1274 | - |
1275 | - } |
1276 | - } |
1277 | -} |
1278 | + public class BoolInput : Gtk.Switch { |
1279 | + public BoolInput () { |
1280 | + } |
1281 | + } |
1282 | +} |
1283 | \ No newline at end of file |
1284 | |
1285 | === modified file 'src/Widgets/Fields/DoubleInput.vala' |
1286 | --- src/Widgets/Fields/DoubleInput.vala 2015-04-10 23:54:28 +0000 |
1287 | +++ src/Widgets/Fields/DoubleInput.vala 2015-08-04 19:27:32 +0000 |
1288 | @@ -1,25 +1,26 @@ |
1289 | -/* Copyright 2015 Marcus Wichelmann |
1290 | -* |
1291 | -* This file is part of Configurator. |
1292 | -* |
1293 | -* Configurator is free software: you can redistribute it |
1294 | -* and/or modify it under the terms of the GNU General Public License as |
1295 | -* published by the Free Software Foundation, either version 3 of the |
1296 | -* License, or (at your option) any later version. |
1297 | -* |
1298 | -* Configurator is distributed in the hope that it will be |
1299 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1300 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1301 | -* Public License for more details. |
1302 | -* |
1303 | -* You should have received a copy of the GNU General Public License along |
1304 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1305 | -*/ |
1306 | +/* |
1307 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1308 | + * |
1309 | + * This program is free software; you can redistribute it and/or |
1310 | + * modify it under the terms of the GNU General Public |
1311 | + * License as published by the Free Software Foundation; either |
1312 | + * version 2 of the License, or (at your option) any later version. |
1313 | + * |
1314 | + * This program is distributed in the hope that it will be useful, |
1315 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1316 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1317 | + * General Public License for more details. |
1318 | + * |
1319 | + * You should have received a copy of the GNU General Public |
1320 | + * License along with this program; if not, write to the |
1321 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1322 | + * Boston, MA 02111-1307, USA. |
1323 | + */ |
1324 | |
1325 | namespace configurator.Widgets.Fields { |
1326 | - public class DoubleInput : Gtk.Entry { |
1327 | - public DoubleInput () { |
1328 | - this.secondary_icon_tooltip_text = _("Not a number"); |
1329 | - } |
1330 | - } |
1331 | -} |
1332 | + public class DoubleInput : Gtk.Entry { |
1333 | + public DoubleInput () { |
1334 | + this.secondary_icon_tooltip_text = _("Not a number"); |
1335 | + } |
1336 | + } |
1337 | +} |
1338 | \ No newline at end of file |
1339 | |
1340 | === modified file 'src/Widgets/Fields/Int64Input.vala' |
1341 | --- src/Widgets/Fields/Int64Input.vala 2015-04-16 15:28:17 +0000 |
1342 | +++ src/Widgets/Fields/Int64Input.vala 2015-08-04 19:27:32 +0000 |
1343 | @@ -1,26 +1,27 @@ |
1344 | -/* Copyright 2015 Marcus Wichelmann |
1345 | -* |
1346 | -* This file is part of Configurator. |
1347 | -* |
1348 | -* Configurator is free software: you can redistribute it |
1349 | -* and/or modify it under the terms of the GNU General Public License as |
1350 | -* published by the Free Software Foundation, either version 3 of the |
1351 | -* License, or (at your option) any later version. |
1352 | -* |
1353 | -* Configurator is distributed in the hope that it will be |
1354 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1355 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1356 | -* Public License for more details. |
1357 | -* |
1358 | -* You should have received a copy of the GNU General Public License along |
1359 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1360 | -*/ |
1361 | +/* |
1362 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1363 | + * |
1364 | + * This program is free software; you can redistribute it and/or |
1365 | + * modify it under the terms of the GNU General Public |
1366 | + * License as published by the Free Software Foundation; either |
1367 | + * version 2 of the License, or (at your option) any later version. |
1368 | + * |
1369 | + * This program is distributed in the hope that it will be useful, |
1370 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1371 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1372 | + * General Public License for more details. |
1373 | + * |
1374 | + * You should have received a copy of the GNU General Public |
1375 | + * License along with this program; if not, write to the |
1376 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1377 | + * Boston, MA 02111-1307, USA. |
1378 | + */ |
1379 | |
1380 | namespace configurator.Widgets.Fields { |
1381 | - public class Int64Input : Gtk.SpinButton { |
1382 | - public Int64Input () { |
1383 | - this.set_range (int64.MIN, int64.MAX); |
1384 | - this.set_increments (1, 1); |
1385 | - } |
1386 | - } |
1387 | -} |
1388 | + public class Int64Input : Gtk.SpinButton { |
1389 | + public Int64Input () { |
1390 | + this.set_range (int64.MIN, int64.MAX); |
1391 | + this.set_increments (1, 1); |
1392 | + } |
1393 | + } |
1394 | +} |
1395 | \ No newline at end of file |
1396 | |
1397 | === modified file 'src/Widgets/Fields/IntegerInput.vala' |
1398 | --- src/Widgets/Fields/IntegerInput.vala 2015-04-10 23:54:28 +0000 |
1399 | +++ src/Widgets/Fields/IntegerInput.vala 2015-08-04 19:27:32 +0000 |
1400 | @@ -1,26 +1,27 @@ |
1401 | -/* Copyright 2015 Marcus Wichelmann |
1402 | -* |
1403 | -* This file is part of Configurator. |
1404 | -* |
1405 | -* Configurator is free software: you can redistribute it |
1406 | -* and/or modify it under the terms of the GNU General Public License as |
1407 | -* published by the Free Software Foundation, either version 3 of the |
1408 | -* License, or (at your option) any later version. |
1409 | -* |
1410 | -* Configurator is distributed in the hope that it will be |
1411 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1412 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1413 | -* Public License for more details. |
1414 | -* |
1415 | -* You should have received a copy of the GNU General Public License along |
1416 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1417 | -*/ |
1418 | +/* |
1419 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1420 | + * |
1421 | + * This program is free software; you can redistribute it and/or |
1422 | + * modify it under the terms of the GNU General Public |
1423 | + * License as published by the Free Software Foundation; either |
1424 | + * version 2 of the License, or (at your option) any later version. |
1425 | + * |
1426 | + * This program is distributed in the hope that it will be useful, |
1427 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1428 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1429 | + * General Public License for more details. |
1430 | + * |
1431 | + * You should have received a copy of the GNU General Public |
1432 | + * License along with this program; if not, write to the |
1433 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1434 | + * Boston, MA 02111-1307, USA. |
1435 | + */ |
1436 | |
1437 | namespace configurator.Widgets.Fields { |
1438 | - public class IntegerInput : Gtk.SpinButton { |
1439 | - public IntegerInput () { |
1440 | - this.set_range (int.MIN, int.MAX); |
1441 | - this.set_increments (1, 1); |
1442 | - } |
1443 | - } |
1444 | -} |
1445 | + public class IntegerInput : Gtk.SpinButton { |
1446 | + public IntegerInput () { |
1447 | + this.set_range (int.MIN, int.MAX); |
1448 | + this.set_increments (1, 1); |
1449 | + } |
1450 | + } |
1451 | +} |
1452 | \ No newline at end of file |
1453 | |
1454 | === modified file 'src/Widgets/Fields/SelectInput.vala' |
1455 | --- src/Widgets/Fields/SelectInput.vala 2015-04-13 19:41:24 +0000 |
1456 | +++ src/Widgets/Fields/SelectInput.vala 2015-08-04 19:27:32 +0000 |
1457 | @@ -1,28 +1,29 @@ |
1458 | -/* Copyright 2015 Marcus Wichelmann |
1459 | -* |
1460 | -* This file is part of Configurator. |
1461 | -* |
1462 | -* Configurator is free software: you can redistribute it |
1463 | -* and/or modify it under the terms of the GNU General Public License as |
1464 | -* published by the Free Software Foundation, either version 3 of the |
1465 | -* License, or (at your option) any later version. |
1466 | -* |
1467 | -* Configurator is distributed in the hope that it will be |
1468 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1469 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1470 | -* Public License for more details. |
1471 | -* |
1472 | -* You should have received a copy of the GNU General Public License along |
1473 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1474 | -*/ |
1475 | +/* |
1476 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1477 | + * |
1478 | + * This program is free software; you can redistribute it and/or |
1479 | + * modify it under the terms of the GNU General Public |
1480 | + * License as published by the Free Software Foundation; either |
1481 | + * version 2 of the License, or (at your option) any later version. |
1482 | + * |
1483 | + * This program is distributed in the hope that it will be useful, |
1484 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1485 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1486 | + * General Public License for more details. |
1487 | + * |
1488 | + * You should have received a copy of the GNU General Public |
1489 | + * License along with this program; if not, write to the |
1490 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1491 | + * Boston, MA 02111-1307, USA. |
1492 | + */ |
1493 | |
1494 | namespace configurator.Widgets.Fields { |
1495 | - public class SelectInput : Gtk.ComboBoxText { |
1496 | - public SelectInput (Variant options) { |
1497 | - for (int i = 0; i < options.n_children (); i++) { |
1498 | - var option = options.get_child_value (i).get_string (); |
1499 | - this.append (option, option); |
1500 | - } |
1501 | - } |
1502 | - } |
1503 | -} |
1504 | + public class SelectInput : Gtk.ComboBoxText { |
1505 | + public SelectInput (Variant options) { |
1506 | + for (int i = 0; i < options.n_children (); i++) { |
1507 | + var option = options.get_child_value (i).get_string (); |
1508 | + this.append (option, option); |
1509 | + } |
1510 | + } |
1511 | + } |
1512 | +} |
1513 | \ No newline at end of file |
1514 | |
1515 | === modified file 'src/Widgets/Fields/StringInput.vala' |
1516 | --- src/Widgets/Fields/StringInput.vala 2015-04-10 23:54:28 +0000 |
1517 | +++ src/Widgets/Fields/StringInput.vala 2015-08-04 19:27:32 +0000 |
1518 | @@ -1,33 +1,34 @@ |
1519 | -/* Copyright 2015 Marcus Wichelmann |
1520 | -* |
1521 | -* This file is part of Configurator. |
1522 | -* |
1523 | -* Configurator is free software: you can redistribute it |
1524 | -* and/or modify it under the terms of the GNU General Public License as |
1525 | -* published by the Free Software Foundation, either version 3 of the |
1526 | -* License, or (at your option) any later version. |
1527 | -* |
1528 | -* Configurator is distributed in the hope that it will be |
1529 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1530 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1531 | -* Public License for more details. |
1532 | -* |
1533 | -* You should have received a copy of the GNU General Public License along |
1534 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1535 | -*/ |
1536 | +/* |
1537 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1538 | + * |
1539 | + * This program is free software; you can redistribute it and/or |
1540 | + * modify it under the terms of the GNU General Public |
1541 | + * License as published by the Free Software Foundation; either |
1542 | + * version 2 of the License, or (at your option) any later version. |
1543 | + * |
1544 | + * This program is distributed in the hope that it will be useful, |
1545 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1546 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1547 | + * General Public License for more details. |
1548 | + * |
1549 | + * You should have received a copy of the GNU General Public |
1550 | + * License along with this program; if not, write to the |
1551 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1552 | + * Boston, MA 02111-1307, USA. |
1553 | + */ |
1554 | |
1555 | namespace configurator.Widgets.Fields { |
1556 | - public class StringInput : Gtk.Entry { |
1557 | - public StringInput () { |
1558 | - this.changed.connect (() => { |
1559 | - var color = Gdk.RGBA (); |
1560 | + public class StringInput : Gtk.Entry { |
1561 | + public StringInput () { |
1562 | + this.changed.connect (() => { |
1563 | + var color = Gdk.RGBA (); |
1564 | |
1565 | - if (color.parse (this.text)) { |
1566 | - this.override_color (Gtk.StateFlags.NORMAL, color); |
1567 | - } else { |
1568 | - this.override_color (Gtk.StateFlags.NORMAL, null); |
1569 | - } |
1570 | - }); |
1571 | - } |
1572 | - } |
1573 | -} |
1574 | + if (color.parse (this.text)) { |
1575 | + this.override_color (Gtk.StateFlags.NORMAL, color); |
1576 | + } else { |
1577 | + this.override_color (Gtk.StateFlags.NORMAL, null); |
1578 | + } |
1579 | + }); |
1580 | + } |
1581 | + } |
1582 | +} |
1583 | \ No newline at end of file |
1584 | |
1585 | === modified file 'src/Widgets/Fields/UInt64Input.vala' |
1586 | --- src/Widgets/Fields/UInt64Input.vala 2015-04-16 15:28:17 +0000 |
1587 | +++ src/Widgets/Fields/UInt64Input.vala 2015-08-04 19:27:32 +0000 |
1588 | @@ -1,26 +1,27 @@ |
1589 | -/* Copyright 2015 Marcus Wichelmann |
1590 | -* |
1591 | -* This file is part of Configurator. |
1592 | -* |
1593 | -* Configurator is free software: you can redistribute it |
1594 | -* and/or modify it under the terms of the GNU General Public License as |
1595 | -* published by the Free Software Foundation, either version 3 of the |
1596 | -* License, or (at your option) any later version. |
1597 | -* |
1598 | -* Configurator is distributed in the hope that it will be |
1599 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1600 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1601 | -* Public License for more details. |
1602 | -* |
1603 | -* You should have received a copy of the GNU General Public License along |
1604 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1605 | -*/ |
1606 | +/* |
1607 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1608 | + * |
1609 | + * This program is free software; you can redistribute it and/or |
1610 | + * modify it under the terms of the GNU General Public |
1611 | + * License as published by the Free Software Foundation; either |
1612 | + * version 2 of the License, or (at your option) any later version. |
1613 | + * |
1614 | + * This program is distributed in the hope that it will be useful, |
1615 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1616 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1617 | + * General Public License for more details. |
1618 | + * |
1619 | + * You should have received a copy of the GNU General Public |
1620 | + * License along with this program; if not, write to the |
1621 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1622 | + * Boston, MA 02111-1307, USA. |
1623 | + */ |
1624 | |
1625 | namespace configurator.Widgets.Fields { |
1626 | - public class UInt64Input : Gtk.SpinButton { |
1627 | - public UInt64Input () { |
1628 | - this.set_range (uint64.MIN, uint64.MAX); |
1629 | - this.set_increments (1, 1); |
1630 | - } |
1631 | - } |
1632 | -} |
1633 | + public class UInt64Input : Gtk.SpinButton { |
1634 | + public UInt64Input () { |
1635 | + this.set_range (uint64.MIN, uint64.MAX); |
1636 | + this.set_increments (1, 1); |
1637 | + } |
1638 | + } |
1639 | +} |
1640 | \ No newline at end of file |
1641 | |
1642 | === modified file 'src/Widgets/Fields/UIntegerInput.vala' |
1643 | --- src/Widgets/Fields/UIntegerInput.vala 2015-04-10 23:54:28 +0000 |
1644 | +++ src/Widgets/Fields/UIntegerInput.vala 2015-08-04 19:27:32 +0000 |
1645 | @@ -1,26 +1,27 @@ |
1646 | -/* Copyright 2015 Marcus Wichelmann |
1647 | -* |
1648 | -* This file is part of Configurator. |
1649 | -* |
1650 | -* Configurator is free software: you can redistribute it |
1651 | -* and/or modify it under the terms of the GNU General Public License as |
1652 | -* published by the Free Software Foundation, either version 3 of the |
1653 | -* License, or (at your option) any later version. |
1654 | -* |
1655 | -* Configurator is distributed in the hope that it will be |
1656 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1657 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1658 | -* Public License for more details. |
1659 | -* |
1660 | -* You should have received a copy of the GNU General Public License along |
1661 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1662 | -*/ |
1663 | +/* |
1664 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1665 | + * |
1666 | + * This program is free software; you can redistribute it and/or |
1667 | + * modify it under the terms of the GNU General Public |
1668 | + * License as published by the Free Software Foundation; either |
1669 | + * version 2 of the License, or (at your option) any later version. |
1670 | + * |
1671 | + * This program is distributed in the hope that it will be useful, |
1672 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1673 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1674 | + * General Public License for more details. |
1675 | + * |
1676 | + * You should have received a copy of the GNU General Public |
1677 | + * License along with this program; if not, write to the |
1678 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1679 | + * Boston, MA 02111-1307, USA. |
1680 | + */ |
1681 | |
1682 | namespace configurator.Widgets.Fields { |
1683 | - public class UIntegerInput : Gtk.SpinButton { |
1684 | - public UIntegerInput () { |
1685 | - this.set_range (uint.MIN, uint.MAX); |
1686 | - this.set_increments (1, 1); |
1687 | - } |
1688 | - } |
1689 | -} |
1690 | + public class UIntegerInput : Gtk.SpinButton { |
1691 | + public UIntegerInput () { |
1692 | + this.set_range (uint.MIN, uint.MAX); |
1693 | + this.set_increments (1, 1); |
1694 | + } |
1695 | + } |
1696 | +} |
1697 | \ No newline at end of file |
1698 | |
1699 | === modified file 'src/Widgets/InfoScreen.vala' |
1700 | --- src/Widgets/InfoScreen.vala 2015-04-14 17:16:32 +0000 |
1701 | +++ src/Widgets/InfoScreen.vala 2015-08-04 19:27:32 +0000 |
1702 | @@ -1,67 +1,68 @@ |
1703 | -/* Copyright 2015 Marcus Wichelmann |
1704 | -* |
1705 | -* This file is part of Configurator. |
1706 | -* |
1707 | -* Configurator is free software: you can redistribute it |
1708 | -* and/or modify it under the terms of the GNU General Public License as |
1709 | -* published by the Free Software Foundation, either version 3 of the |
1710 | -* License, or (at your option) any later version. |
1711 | -* |
1712 | -* Configurator is distributed in the hope that it will be |
1713 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1714 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1715 | -* Public License for more details. |
1716 | -* |
1717 | -* You should have received a copy of the GNU General Public License along |
1718 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1719 | -*/ |
1720 | +/* |
1721 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1722 | + * |
1723 | + * This program is free software; you can redistribute it and/or |
1724 | + * modify it under the terms of the GNU General Public |
1725 | + * License as published by the Free Software Foundation; either |
1726 | + * version 2 of the License, or (at your option) any later version. |
1727 | + * |
1728 | + * This program is distributed in the hope that it will be useful, |
1729 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1730 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1731 | + * General Public License for more details. |
1732 | + * |
1733 | + * You should have received a copy of the GNU General Public |
1734 | + * License along with this program; if not, write to the |
1735 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1736 | + * Boston, MA 02111-1307, USA. |
1737 | + */ |
1738 | |
1739 | namespace configurator.Widgets { |
1740 | - public class InfoScreen : Gtk.Frame { |
1741 | - private Gtk.Grid grid; |
1742 | - |
1743 | - private Gtk.Image image; |
1744 | - private Gtk.Label title; |
1745 | - private Gtk.Label description; |
1746 | - |
1747 | - // Stolen from my other application: switchboard-plug-notifications ;) |
1748 | - public InfoScreen (string header, string desc, string icon_name) { |
1749 | - this.expand = true; |
1750 | - this.get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); |
1751 | - this.shadow_type = Gtk.ShadowType.NONE; |
1752 | - |
1753 | - grid = new Gtk.Grid (); |
1754 | - grid.vexpand = false; |
1755 | - grid.valign = Gtk.Align.CENTER; |
1756 | - grid.halign = Gtk.Align.CENTER; |
1757 | - grid.border_width = 24; |
1758 | - grid.row_spacing = 12; |
1759 | - grid.column_spacing = 12; |
1760 | - |
1761 | - image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG); |
1762 | - image.valign = Gtk.Align.START; |
1763 | - image.halign = Gtk.Align.END; |
1764 | - |
1765 | - grid.attach (image, 0, 0, 1, 2); |
1766 | - |
1767 | - title = new Gtk.Label (header); |
1768 | - title.halign = Gtk.Align.START; |
1769 | - title.set_line_wrap (true); |
1770 | - title.justify = Gtk.Justification.FILL; |
1771 | - title.get_style_context ().add_class ("h2"); |
1772 | - |
1773 | - grid.attach (title, 1, 0, 1, 1); |
1774 | - |
1775 | - description = new Gtk.Label (desc); |
1776 | - description.halign = Gtk.Align.START; |
1777 | - description.set_line_wrap (true); |
1778 | - description.justify = Gtk.Justification.FILL; |
1779 | - |
1780 | - grid.attach (description, 1, 1, 1, 1); |
1781 | - |
1782 | - grid.show_all (); |
1783 | - |
1784 | - this.add (grid); |
1785 | - } |
1786 | - } |
1787 | -} |
1788 | + public class InfoScreen : Gtk.Frame { |
1789 | + private Gtk.Grid grid; |
1790 | + |
1791 | + private Gtk.Image image; |
1792 | + private Gtk.Label title; |
1793 | + private Gtk.Label description; |
1794 | + |
1795 | + /* Stolen from my other application: switchboard-plug-notifications ;) */ |
1796 | + public InfoScreen (string header, string desc, string icon_name) { |
1797 | + this.expand = true; |
1798 | + this.get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW); |
1799 | + this.shadow_type = Gtk.ShadowType.NONE; |
1800 | + |
1801 | + grid = new Gtk.Grid (); |
1802 | + grid.vexpand = false; |
1803 | + grid.valign = Gtk.Align.CENTER; |
1804 | + grid.halign = Gtk.Align.CENTER; |
1805 | + grid.border_width = 24; |
1806 | + grid.row_spacing = 12; |
1807 | + grid.column_spacing = 12; |
1808 | + |
1809 | + image = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.DIALOG); |
1810 | + image.valign = Gtk.Align.START; |
1811 | + image.halign = Gtk.Align.END; |
1812 | + |
1813 | + grid.attach (image, 0, 0, 1, 2); |
1814 | + |
1815 | + title = new Gtk.Label (header); |
1816 | + title.halign = Gtk.Align.START; |
1817 | + title.set_line_wrap (true); |
1818 | + title.justify = Gtk.Justification.FILL; |
1819 | + title.get_style_context ().add_class ("h2"); |
1820 | + |
1821 | + grid.attach (title, 1, 0, 1, 1); |
1822 | + |
1823 | + description = new Gtk.Label (desc); |
1824 | + description.halign = Gtk.Align.START; |
1825 | + description.set_line_wrap (true); |
1826 | + description.justify = Gtk.Justification.FILL; |
1827 | + |
1828 | + grid.attach (description, 1, 1, 1, 1); |
1829 | + |
1830 | + grid.show_all (); |
1831 | + |
1832 | + this.add (grid); |
1833 | + } |
1834 | + } |
1835 | +} |
1836 | \ No newline at end of file |
1837 | |
1838 | === modified file 'src/Widgets/Key.vala' |
1839 | --- src/Widgets/Key.vala 2015-04-16 15:28:17 +0000 |
1840 | +++ src/Widgets/Key.vala 2015-08-04 19:27:32 +0000 |
1841 | @@ -1,182 +1,188 @@ |
1842 | -/* Copyright 2015 Marcus Wichelmann |
1843 | -* |
1844 | -* This file is part of Configurator. |
1845 | -* |
1846 | -* Configurator is free software: you can redistribute it |
1847 | -* and/or modify it under the terms of the GNU General Public License as |
1848 | -* published by the Free Software Foundation, either version 3 of the |
1849 | -* License, or (at your option) any later version. |
1850 | -* |
1851 | -* Configurator is distributed in the hope that it will be |
1852 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
1853 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
1854 | -* Public License for more details. |
1855 | -* |
1856 | -* You should have received a copy of the GNU General Public License along |
1857 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
1858 | -*/ |
1859 | +/* |
1860 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
1861 | + * |
1862 | + * This program is free software; you can redistribute it and/or |
1863 | + * modify it under the terms of the GNU General Public |
1864 | + * License as published by the Free Software Foundation; either |
1865 | + * version 2 of the License, or (at your option) any later version. |
1866 | + * |
1867 | + * This program is distributed in the hope that it will be useful, |
1868 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1869 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1870 | + * General Public License for more details. |
1871 | + * |
1872 | + * You should have received a copy of the GNU General Public |
1873 | + * License along with this program; if not, write to the |
1874 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1875 | + * Boston, MA 02111-1307, USA. |
1876 | + */ |
1877 | |
1878 | namespace configurator.Widgets { |
1879 | - public class Key : Gtk.Grid { |
1880 | - private Gtk.Image info_image; |
1881 | - private Gtk.ToggleButton info_button; |
1882 | - |
1883 | - private Gtk.Label label_name; |
1884 | - private Gtk.Label label_description; |
1885 | - |
1886 | - private Gtk.Widget? widg = null; |
1887 | - |
1888 | - private Gtk.Revealer revealer; |
1889 | - private KeyInfo key_info; |
1890 | - |
1891 | - private Gtk.Separator separator; |
1892 | - |
1893 | - private Gtk.Image readonly_image; |
1894 | - |
1895 | - public Key (Settings settings, string name, SettingsSchemaKey key, bool live, bool show_schema) { |
1896 | - this.column_spacing = 12; |
1897 | - this.margin_top = 18; |
1898 | - |
1899 | - info_image = new Gtk.Image.from_icon_name ("help-info-symbolic", Gtk.IconSize.BUTTON); |
1900 | - info_image.margin = 0; |
1901 | - |
1902 | - info_button = new Gtk.ToggleButton (); |
1903 | - info_button.image = info_image; |
1904 | - info_button.vexpand = true; |
1905 | - info_button.valign = Gtk.Align.CENTER; |
1906 | - info_button.halign = Gtk.Align.START; |
1907 | - info_button.toggled.connect (() => revealer.set_reveal_child (info_button.active)); |
1908 | - |
1909 | - this.attach (info_button, 0, 0, 1, 2); |
1910 | - |
1911 | - label_name = new Gtk.Label (show_schema ? "%s -> <b>%s</b>".printf (settings.schema_id, name) : "<b>%s</b>".printf (name)); |
1912 | - label_name.get_style_context ().add_class ("h3"); |
1913 | - label_name.use_markup = true; |
1914 | - label_name.selectable = true; |
1915 | - label_name.wrap = true; |
1916 | - label_name.halign = Gtk.Align.START; |
1917 | - label_name.valign = Gtk.Align.END; |
1918 | - label_name.hexpand = true; |
1919 | - |
1920 | - this.attach (label_name, 1, 0, 1, 1); |
1921 | - |
1922 | - if (key.get_summary () != null) { |
1923 | - label_description = new Gtk.Label (key.get_summary ()); |
1924 | - label_description.use_markup = true; |
1925 | - label_description.selectable = true; |
1926 | - label_description.wrap = true; |
1927 | - label_description.halign = Gtk.Align.START; |
1928 | - label_description.valign = Gtk.Align.START; |
1929 | - label_description.hexpand = true; |
1930 | - |
1931 | - this.attach (label_description, 1, 1, 1, 1); |
1932 | - } else { |
1933 | - label_name.valign = Gtk.Align.CENTER; |
1934 | - } |
1935 | - |
1936 | - var type = key.get_value_type ().dup_string (); |
1937 | - |
1938 | - if (type == "b") { |
1939 | - widg = new Fields.BoolInput (); |
1940 | - |
1941 | - settings.bind (name, widg, "active", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
1942 | - } else if (type == "s") { |
1943 | - if (key.get_range ().get_child_value (0).get_string () == "enum") { |
1944 | - widg = new Fields.SelectInput (key.get_range ().get_child_value (1).get_variant ()); |
1945 | - |
1946 | - settings.bind (name, widg, "active_id", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
1947 | - } else { |
1948 | - widg = new Fields.StringInput (); |
1949 | - widg.set_size_request (350, -1); |
1950 | - |
1951 | - settings.bind (name, widg, "text", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
1952 | - } |
1953 | - } else if (type == "i") { |
1954 | - widg = new Fields.IntegerInput (); |
1955 | - |
1956 | - settings.bind (name, widg, "value", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
1957 | - } else if (type == "u") { |
1958 | - widg = new Fields.UIntegerInput (); |
1959 | - |
1960 | - settings.bind (name, widg, "value", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
1961 | - } else if (type == "x") { |
1962 | - widg = new Fields.Int64Input (); |
1963 | - |
1964 | - settings.bind (name, widg, "value", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
1965 | - } else if (type == "t") { |
1966 | - widg = new Fields.UInt64Input (); |
1967 | - |
1968 | - settings.bind (name, widg, "value", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
1969 | - } else if (type == "d") { |
1970 | - // FIXME: The SpinButton gets very big when setting the Min- and Max- values for double. |
1971 | - //widg = new Gtk.SpinButton.with_range (double.MIN, double.MAX, double.EPSILON); |
1972 | - |
1973 | - widg = new Fields.DoubleInput (); |
1974 | - widg.set_size_request (350, -1); |
1975 | - |
1976 | - (widg as Gtk.Entry).text = settings.get_double (name).to_string (); |
1977 | - |
1978 | - if (live) { |
1979 | - (widg as Gtk.Entry).changed.connect (() => { |
1980 | - double parsed; |
1981 | - if (double.try_parse ((widg as Gtk.Entry).text, out parsed)) { |
1982 | - settings.set_double (name, parsed); |
1983 | - (widg as Gtk.Entry).set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, null); |
1984 | - } else { |
1985 | - (widg as Gtk.Entry).set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, "dialog-warning-symbolic"); |
1986 | - } |
1987 | - }); |
1988 | - |
1989 | - settings.changed.connect ((key) => { |
1990 | - if (key == name) |
1991 | - (widg as Gtk.Entry).text = settings.get_double (name).to_string (); |
1992 | - }); |
1993 | - } |
1994 | - } else if (type.has_prefix ("a") && type.length == 2) { |
1995 | - widg = new Fields.ArrayInput (settings, name); |
1996 | - } else { |
1997 | - widg = new Gtk.Label (_("This settings type is not supported yet.")); |
1998 | - widg.get_style_context ().add_class ("h3"); |
1999 | - |
2000 | - warning (_("Unsupported type \"%s\" in %s->%s"), type, settings.schema_id, name); |
2001 | - } |
2002 | - |
2003 | - if (widg != null) { |
2004 | - widg.vexpand = true; |
2005 | - widg.valign = Gtk.Align.CENTER; |
2006 | - widg.halign = Gtk.Align.END; |
2007 | - widg.sensitive = live; |
2008 | - |
2009 | - this.attach (widg, 2, 0, 1, 2); |
2010 | - } |
2011 | - |
2012 | - revealer = new Gtk.Revealer (); |
2013 | - revealer.transition_type = Gtk.RevealerTransitionType.SLIDE_DOWN; |
2014 | - |
2015 | - key_info = new KeyInfo (settings, name, key); |
2016 | - |
2017 | - revealer.add (key_info); |
2018 | - |
2019 | - this.attach (revealer, 0, 2, 3, 1); |
2020 | - |
2021 | - separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL); |
2022 | - separator.margin_top = 18; |
2023 | - |
2024 | - this.attach (separator, 0, 3, 3, 1); |
2025 | - |
2026 | - if (!settings.is_writable (name)) { |
2027 | - if (widg != null) |
2028 | - widg.sensitive = false; |
2029 | - |
2030 | - key_info.set_reset_enabled (false); |
2031 | - |
2032 | - readonly_image = new Gtk.Image.from_icon_name ("changes-prevent-symbolic", Gtk.IconSize.BUTTON); |
2033 | - readonly_image.vexpand = true; |
2034 | - readonly_image.valign = Gtk.Align.CENTER; |
2035 | - readonly_image.halign = Gtk.Align.END; |
2036 | - |
2037 | - this.attach (readonly_image, 3, 0, 1, 2); |
2038 | - } |
2039 | - } |
2040 | - } |
2041 | -} |
2042 | + public class Key : Gtk.Grid { |
2043 | + private Gtk.Image info_image; |
2044 | + private Gtk.ToggleButton info_button; |
2045 | + |
2046 | + private Gtk.Label label_name; |
2047 | + private Gtk.Label label_description; |
2048 | + |
2049 | + private Gtk.Widget? widg = null; |
2050 | + |
2051 | + private Gtk.Revealer revealer; |
2052 | + private KeyInfo key_info; |
2053 | + |
2054 | + private Gtk.Separator separator; |
2055 | + |
2056 | + private Gtk.Image readonly_image; |
2057 | + |
2058 | + public Key (Settings settings, string name, SettingsSchemaKey key, bool live, bool show_schema) { |
2059 | + this.column_spacing = 12; |
2060 | + this.margin_top = 18; |
2061 | + |
2062 | + info_image = new Gtk.Image.from_icon_name ("help-info-symbolic", Gtk.IconSize.BUTTON); |
2063 | + info_image.margin = 0; |
2064 | + |
2065 | + info_button = new Gtk.ToggleButton (); |
2066 | + info_button.image = info_image; |
2067 | + info_button.vexpand = true; |
2068 | + info_button.valign = Gtk.Align.CENTER; |
2069 | + info_button.halign = Gtk.Align.START; |
2070 | + info_button.toggled.connect (() => revealer.set_reveal_child (info_button.active)); |
2071 | + |
2072 | + this.attach (info_button, 0, 0, 1, 2); |
2073 | + |
2074 | + label_name = new Gtk.Label (show_schema ? "%s -> <b>%s</b>".printf (settings.schema_id, name) : "<b>%s</b>".printf (name)); |
2075 | + label_name.get_style_context ().add_class ("h3"); |
2076 | + label_name.use_markup = true; |
2077 | + label_name.selectable = true; |
2078 | + label_name.wrap = true; |
2079 | + label_name.halign = Gtk.Align.START; |
2080 | + label_name.valign = Gtk.Align.END; |
2081 | + label_name.hexpand = true; |
2082 | + |
2083 | + this.attach (label_name, 1, 0, 1, 1); |
2084 | + |
2085 | + if (key.get_summary () != null) { |
2086 | + label_description = new Gtk.Label (key.get_summary ()); |
2087 | + label_description.use_markup = true; |
2088 | + label_description.selectable = true; |
2089 | + label_description.wrap = true; |
2090 | + label_description.halign = Gtk.Align.START; |
2091 | + label_description.valign = Gtk.Align.START; |
2092 | + label_description.hexpand = true; |
2093 | + |
2094 | + this.attach (label_description, 1, 1, 1, 1); |
2095 | + } else { |
2096 | + label_name.valign = Gtk.Align.CENTER; |
2097 | + } |
2098 | + |
2099 | + var type = key.get_value_type ().dup_string (); |
2100 | + |
2101 | + if (type == "b") { |
2102 | + widg = new Fields.BoolInput (); |
2103 | + |
2104 | + settings.bind (name, widg, "active", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
2105 | + } else if (type == "s") { |
2106 | + if (key.get_range ().get_child_value (0).get_string () == "enum") { |
2107 | + widg = new Fields.SelectInput (key.get_range ().get_child_value (1).get_variant ()); |
2108 | + |
2109 | + settings.bind (name, widg, "active_id", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
2110 | + } else { |
2111 | + widg = new Fields.StringInput (); |
2112 | + widg.set_size_request (350, -1); |
2113 | + |
2114 | + settings.bind (name, widg, "text", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
2115 | + } |
2116 | + } else if (type == "i") { |
2117 | + widg = new Fields.IntegerInput (); |
2118 | + |
2119 | + settings.bind (name, widg, "value", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
2120 | + } else if (type == "u") { |
2121 | + widg = new Fields.UIntegerInput (); |
2122 | + |
2123 | + settings.bind (name, widg, "value", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
2124 | + } else if (type == "x") { |
2125 | + widg = new Fields.Int64Input (); |
2126 | + |
2127 | + settings.bind (name, widg, "value", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
2128 | + } else if (type == "t") { |
2129 | + widg = new Fields.UInt64Input (); |
2130 | + |
2131 | + settings.bind (name, widg, "value", live ? GLib.SettingsBindFlags.DEFAULT : GLib.SettingsBindFlags.GET_NO_CHANGES); |
2132 | + } else if (type == "d") { |
2133 | + /* |
2134 | + * FIXME: The SpinButton gets very big when setting the Min- and Max- values for double. |
2135 | + * widg = new Gtk.SpinButton.with_range (double.MIN, double.MAX, double.EPSILON); |
2136 | + */ |
2137 | + |
2138 | + widg = new Fields.DoubleInput (); |
2139 | + widg.set_size_request (350, -1); |
2140 | + |
2141 | + (widg as Gtk.Entry).text = settings.get_double (name).to_string (); |
2142 | + |
2143 | + if (live) { |
2144 | + (widg as Gtk.Entry).changed.connect (() => { |
2145 | + double parsed; |
2146 | + |
2147 | + if (double.try_parse ((widg as Gtk.Entry).text, out parsed)) { |
2148 | + settings.set_double (name, parsed); |
2149 | + (widg as Gtk.Entry).set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, null); |
2150 | + } else { |
2151 | + (widg as Gtk.Entry).set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, "dialog-warning-symbolic"); |
2152 | + } |
2153 | + }); |
2154 | + |
2155 | + settings.changed.connect ((key) => { |
2156 | + if (key == name) { |
2157 | + (widg as Gtk.Entry).text = settings.get_double (name).to_string (); |
2158 | + } |
2159 | + }); |
2160 | + } |
2161 | + } else if (type.has_prefix ("a") && type.length == 2) { |
2162 | + widg = new Fields.ArrayInput (settings, name); |
2163 | + } else { |
2164 | + widg = new Gtk.Label (_("This settings type is not supported yet.")); |
2165 | + widg.get_style_context ().add_class ("h3"); |
2166 | + |
2167 | + warning (_("Unsupported type \"%s\" in %s->%s"), type, settings.schema_id, name); |
2168 | + } |
2169 | + |
2170 | + if (widg != null) { |
2171 | + widg.vexpand = true; |
2172 | + widg.valign = Gtk.Align.CENTER; |
2173 | + widg.halign = Gtk.Align.END; |
2174 | + widg.sensitive = live; |
2175 | + |
2176 | + this.attach (widg, 2, 0, 1, 2); |
2177 | + } |
2178 | + |
2179 | + revealer = new Gtk.Revealer (); |
2180 | + revealer.transition_type = Gtk.RevealerTransitionType.SLIDE_DOWN; |
2181 | + |
2182 | + key_info = new KeyInfo (settings, name, key); |
2183 | + |
2184 | + revealer.add (key_info); |
2185 | + |
2186 | + this.attach (revealer, 0, 2, 3, 1); |
2187 | + |
2188 | + separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL); |
2189 | + separator.margin_top = 18; |
2190 | + |
2191 | + this.attach (separator, 0, 3, 3, 1); |
2192 | + |
2193 | + if (!settings.is_writable (name)) { |
2194 | + if (widg != null) { |
2195 | + widg.sensitive = false; |
2196 | + } |
2197 | + |
2198 | + key_info.set_reset_enabled (false); |
2199 | + |
2200 | + readonly_image = new Gtk.Image.from_icon_name ("changes-prevent-symbolic", Gtk.IconSize.BUTTON); |
2201 | + readonly_image.vexpand = true; |
2202 | + readonly_image.valign = Gtk.Align.CENTER; |
2203 | + readonly_image.halign = Gtk.Align.END; |
2204 | + |
2205 | + this.attach (readonly_image, 3, 0, 1, 2); |
2206 | + } |
2207 | + } |
2208 | + } |
2209 | +} |
2210 | \ No newline at end of file |
2211 | |
2212 | === modified file 'src/Widgets/KeyInfo.vala' |
2213 | --- src/Widgets/KeyInfo.vala 2015-04-11 11:06:14 +0000 |
2214 | +++ src/Widgets/KeyInfo.vala 2015-08-04 19:27:32 +0000 |
2215 | @@ -1,119 +1,120 @@ |
2216 | -/* Copyright 2015 Marcus Wichelmann |
2217 | -* |
2218 | -* This file is part of Configurator. |
2219 | -* |
2220 | -* Configurator is free software: you can redistribute it |
2221 | -* and/or modify it under the terms of the GNU General Public License as |
2222 | -* published by the Free Software Foundation, either version 3 of the |
2223 | -* License, or (at your option) any later version. |
2224 | -* |
2225 | -* Configurator is distributed in the hope that it will be |
2226 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
2227 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
2228 | -* Public License for more details. |
2229 | -* |
2230 | -* You should have received a copy of the GNU General Public License along |
2231 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
2232 | -*/ |
2233 | +/* |
2234 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
2235 | + * |
2236 | + * This program is free software; you can redistribute it and/or |
2237 | + * modify it under the terms of the GNU General Public |
2238 | + * License as published by the Free Software Foundation; either |
2239 | + * version 2 of the License, or (at your option) any later version. |
2240 | + * |
2241 | + * This program is distributed in the hope that it will be useful, |
2242 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2243 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2244 | + * General Public License for more details. |
2245 | + * |
2246 | + * You should have received a copy of the GNU General Public |
2247 | + * License along with this program; if not, write to the |
2248 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2249 | + * Boston, MA 02111-1307, USA. |
2250 | + */ |
2251 | |
2252 | namespace configurator.Widgets { |
2253 | - public class KeyInfo : Gtk.Grid { |
2254 | - private Gtk.Label type_label; |
2255 | - private Gtk.Label type_field; |
2256 | - |
2257 | - private Gtk.Label default_label; |
2258 | - private Gtk.Label default_field; |
2259 | - |
2260 | - private Gtk.Label code_label; |
2261 | - private Gtk.Label code_field; |
2262 | - |
2263 | - private Gtk.Label command_label; |
2264 | - private Gtk.Label command_field; |
2265 | - |
2266 | - private Gtk.Label description_label; |
2267 | - private Gtk.Label description_field; |
2268 | - |
2269 | - private Gtk.Button reset_button; |
2270 | - |
2271 | - public KeyInfo (Settings settings, string name, SettingsSchemaKey key) { |
2272 | - this.column_spacing = 12; |
2273 | - this.row_spacing = 12; |
2274 | - this.margin_top = 18; |
2275 | - |
2276 | - type_label = new Gtk.Label (_("<b>Property type</b>")); |
2277 | - type_label.use_markup = true; |
2278 | - type_label.halign = Gtk.Align.END; |
2279 | - this.attach (type_label, 0, 0, 1, 1); |
2280 | - |
2281 | - type_field = new Gtk.Label (Utils.type_to_string (key.get_value_type ())); |
2282 | - type_field.use_markup = true; |
2283 | - type_field.selectable = true; |
2284 | - type_field.wrap = true; |
2285 | - type_field.halign = Gtk.Align.START; |
2286 | - type_field.hexpand = true; |
2287 | - this.attach (type_field, 1, 0, 1, 1); |
2288 | - |
2289 | - default_label = new Gtk.Label (_("<b>Default value</b>")); |
2290 | - default_label.use_markup = true; |
2291 | - default_label.halign = Gtk.Align.END; |
2292 | - this.attach (default_label, 0, 1, 1, 1); |
2293 | - |
2294 | - default_field = new Gtk.Label (Utils.variant_to_string (key.get_default_value ())); |
2295 | - default_field.use_markup = true; |
2296 | - default_field.selectable = true; |
2297 | - default_field.wrap = true; |
2298 | - default_field.halign = Gtk.Align.START; |
2299 | - default_field.hexpand = true; |
2300 | - this.attach (default_field, 1, 1, 1, 1); |
2301 | - |
2302 | - code_label = new Gtk.Label (_("<b>Vala code</b>")); |
2303 | - code_label.use_markup = true; |
2304 | - code_label.halign = Gtk.Align.END; |
2305 | - this.attach (code_label, 0, 2, 1, 1); |
2306 | - |
2307 | - code_field = new Gtk.Label ("<tt><span foreground=\"#000000\" stretch=\"condensed\"><span foreground=\"#FF420B\" weight=\"bold\">var</span> val = <span foreground=\"#FF420B\" weight=\"bold\">new</span> Settings (<span foreground=\"#13A50B\">\"%s\"</span>).get_value (<span foreground=\"#13A50B\">\"%s\"</span>);</span></tt>".printf (settings.schema_id, name)); |
2308 | - code_field.use_markup = true; |
2309 | - code_field.selectable = true; |
2310 | - code_field.wrap = true; |
2311 | - code_field.halign = Gtk.Align.START; |
2312 | - code_field.hexpand = true; |
2313 | - this.attach (code_field, 1, 2, 1, 1); |
2314 | - |
2315 | - command_label = new Gtk.Label (_("<b>Command</b>")); |
2316 | - command_label.use_markup = true; |
2317 | - command_label.halign = Gtk.Align.END; |
2318 | - this.attach (command_label, 0, 3, 1, 1); |
2319 | - |
2320 | - command_field = new Gtk.Label ("<tt><span foreground=\"#000000\" stretch=\"condensed\">dconf read %s</span></tt>".printf (settings.path + name)); |
2321 | - command_field.use_markup = true; |
2322 | - command_field.selectable = true; |
2323 | - command_field.wrap = true; |
2324 | - command_field.halign = Gtk.Align.START; |
2325 | - command_field.hexpand = true; |
2326 | - this.attach (command_field, 1, 3, 1, 1); |
2327 | - |
2328 | - description_label = new Gtk.Label (_("<b>Description</b>")); |
2329 | - description_label.use_markup = true; |
2330 | - description_label.halign = Gtk.Align.END; |
2331 | - this.attach (description_label, 0, 4, 1, 1); |
2332 | - |
2333 | - description_field = new Gtk.Label (key.get_description ()); |
2334 | - description_field.use_markup = true; |
2335 | - description_field.selectable = true; |
2336 | - description_field.wrap = true; |
2337 | - description_field.halign = Gtk.Align.START; |
2338 | - description_field.hexpand = true; |
2339 | - this.attach (description_field, 1, 4, 1, 1); |
2340 | - |
2341 | - reset_button = new Gtk.Button.with_label (_("Reset to default")); |
2342 | - reset_button.get_style_context ().add_class ("destructive-action"); |
2343 | - reset_button.halign = Gtk.Align.END; |
2344 | - reset_button.clicked.connect (() => settings.reset (name)); |
2345 | - this.attach (reset_button, 0, 5, 2, 1); |
2346 | - } |
2347 | - |
2348 | - public void set_reset_enabled (bool enabled) { |
2349 | - reset_button.sensitive = enabled; |
2350 | - } |
2351 | - } |
2352 | -} |
2353 | + public class KeyInfo : Gtk.Grid { |
2354 | + private Gtk.Label type_label; |
2355 | + private Gtk.Label type_field; |
2356 | + |
2357 | + private Gtk.Label default_label; |
2358 | + private Gtk.Label default_field; |
2359 | + |
2360 | + private Gtk.Label code_label; |
2361 | + private Gtk.Label code_field; |
2362 | + |
2363 | + private Gtk.Label command_label; |
2364 | + private Gtk.Label command_field; |
2365 | + |
2366 | + private Gtk.Label description_label; |
2367 | + private Gtk.Label description_field; |
2368 | + |
2369 | + private Gtk.Button reset_button; |
2370 | + |
2371 | + public KeyInfo (Settings settings, string name, SettingsSchemaKey key) { |
2372 | + this.column_spacing = 12; |
2373 | + this.row_spacing = 12; |
2374 | + this.margin_top = 18; |
2375 | + |
2376 | + type_label = new Gtk.Label (_("<b>Property type</b>")); |
2377 | + type_label.use_markup = true; |
2378 | + type_label.halign = Gtk.Align.END; |
2379 | + this.attach (type_label, 0, 0, 1, 1); |
2380 | + |
2381 | + type_field = new Gtk.Label (Utils.type_to_string (key.get_value_type ())); |
2382 | + type_field.use_markup = true; |
2383 | + type_field.selectable = true; |
2384 | + type_field.wrap = true; |
2385 | + type_field.halign = Gtk.Align.START; |
2386 | + type_field.hexpand = true; |
2387 | + this.attach (type_field, 1, 0, 1, 1); |
2388 | + |
2389 | + default_label = new Gtk.Label (_("<b>Default value</b>")); |
2390 | + default_label.use_markup = true; |
2391 | + default_label.halign = Gtk.Align.END; |
2392 | + this.attach (default_label, 0, 1, 1, 1); |
2393 | + |
2394 | + default_field = new Gtk.Label (Utils.variant_to_string (key.get_default_value ())); |
2395 | + default_field.use_markup = true; |
2396 | + default_field.selectable = true; |
2397 | + default_field.wrap = true; |
2398 | + default_field.halign = Gtk.Align.START; |
2399 | + default_field.hexpand = true; |
2400 | + this.attach (default_field, 1, 1, 1, 1); |
2401 | + |
2402 | + code_label = new Gtk.Label (_("<b>Vala code</b>")); |
2403 | + code_label.use_markup = true; |
2404 | + code_label.halign = Gtk.Align.END; |
2405 | + this.attach (code_label, 0, 2, 1, 1); |
2406 | + |
2407 | + code_field = new Gtk.Label ("<tt><span foreground=\"#000000\" stretch=\"condensed\"><span foreground=\"#FF420B\" weight=\"bold\">var</span> val = <span foreground=\"#FF420B\" weight=\"bold\">new</span> Settings (<span foreground=\"#13A50B\">\"%s\"</span>).get_value (<span foreground=\"#13A50B\">\"%s\"</span>);</span></tt>".printf (settings.schema_id, name)); |
2408 | + code_field.use_markup = true; |
2409 | + code_field.selectable = true; |
2410 | + code_field.wrap = true; |
2411 | + code_field.halign = Gtk.Align.START; |
2412 | + code_field.hexpand = true; |
2413 | + this.attach (code_field, 1, 2, 1, 1); |
2414 | + |
2415 | + command_label = new Gtk.Label (_("<b>Command</b>")); |
2416 | + command_label.use_markup = true; |
2417 | + command_label.halign = Gtk.Align.END; |
2418 | + this.attach (command_label, 0, 3, 1, 1); |
2419 | + |
2420 | + command_field = new Gtk.Label ("<tt><span foreground=\"#000000\" stretch=\"condensed\">dconf read %s</span></tt>".printf (settings.path + name)); |
2421 | + command_field.use_markup = true; |
2422 | + command_field.selectable = true; |
2423 | + command_field.wrap = true; |
2424 | + command_field.halign = Gtk.Align.START; |
2425 | + command_field.hexpand = true; |
2426 | + this.attach (command_field, 1, 3, 1, 1); |
2427 | + |
2428 | + description_label = new Gtk.Label (_("<b>Description</b>")); |
2429 | + description_label.use_markup = true; |
2430 | + description_label.halign = Gtk.Align.END; |
2431 | + this.attach (description_label, 0, 4, 1, 1); |
2432 | + |
2433 | + description_field = new Gtk.Label (key.get_description ()); |
2434 | + description_field.use_markup = true; |
2435 | + description_field.selectable = true; |
2436 | + description_field.wrap = true; |
2437 | + description_field.halign = Gtk.Align.START; |
2438 | + description_field.hexpand = true; |
2439 | + this.attach (description_field, 1, 4, 1, 1); |
2440 | + |
2441 | + reset_button = new Gtk.Button.with_label (_("Reset to default")); |
2442 | + reset_button.get_style_context ().add_class ("destructive-action"); |
2443 | + reset_button.halign = Gtk.Align.END; |
2444 | + reset_button.clicked.connect (() => settings.reset (name)); |
2445 | + this.attach (reset_button, 0, 5, 2, 1); |
2446 | + } |
2447 | + |
2448 | + public void set_reset_enabled (bool enabled) { |
2449 | + reset_button.sensitive = enabled; |
2450 | + } |
2451 | + } |
2452 | +} |
2453 | \ No newline at end of file |
2454 | |
2455 | === modified file 'src/Widgets/KeyList.vala' |
2456 | --- src/Widgets/KeyList.vala 2015-04-04 19:12:47 +0000 |
2457 | +++ src/Widgets/KeyList.vala 2015-08-04 19:27:32 +0000 |
2458 | @@ -1,56 +1,58 @@ |
2459 | -/* Copyright 2015 Marcus Wichelmann |
2460 | -* |
2461 | -* This file is part of Configurator. |
2462 | -* |
2463 | -* Configurator is free software: you can redistribute it |
2464 | -* and/or modify it under the terms of the GNU General Public License as |
2465 | -* published by the Free Software Foundation, either version 3 of the |
2466 | -* License, or (at your option) any later version. |
2467 | -* |
2468 | -* Configurator is distributed in the hope that it will be |
2469 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
2470 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
2471 | -* Public License for more details. |
2472 | -* |
2473 | -* You should have received a copy of the GNU General Public License along |
2474 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
2475 | -*/ |
2476 | +/* |
2477 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
2478 | + * |
2479 | + * This program is free software; you can redistribute it and/or |
2480 | + * modify it under the terms of the GNU General Public |
2481 | + * License as published by the Free Software Foundation; either |
2482 | + * version 2 of the License, or (at your option) any later version. |
2483 | + * |
2484 | + * This program is distributed in the hope that it will be useful, |
2485 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2486 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2487 | + * General Public License for more details. |
2488 | + * |
2489 | + * You should have received a copy of the GNU General Public |
2490 | + * License along with this program; if not, write to the |
2491 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2492 | + * Boston, MA 02111-1307, USA. |
2493 | + */ |
2494 | |
2495 | namespace configurator.Widgets { |
2496 | - public class KeyList : Gtk.Box { |
2497 | - public KeyList () { |
2498 | - this.orientation = Gtk.Orientation.VERTICAL; |
2499 | - } |
2500 | - |
2501 | - public void show_keys_for_schema (Settings schema) { |
2502 | - clear_list (); |
2503 | - |
2504 | - var keys = schema.list_keys (); |
2505 | - |
2506 | - for (int i = 0; i < keys.length; i++) { |
2507 | - add_item (schema, keys[i]); |
2508 | - } |
2509 | - |
2510 | - this.show_all (); |
2511 | - } |
2512 | - |
2513 | - public void add_item (Settings settings, string key, bool to_end = false, bool live = true, bool show_schema = false) { |
2514 | - var item = new Key (settings, key, settings.settings_schema.get_key (key), live, show_schema); |
2515 | - |
2516 | - if (to_end) |
2517 | - this.pack_end (item, false, false); |
2518 | - else |
2519 | - this.pack_start (item, false, false); |
2520 | - } |
2521 | - |
2522 | - public void clear_list () { |
2523 | - var childs = this.get_children (); |
2524 | - |
2525 | - for (int i = 0; i < childs.length (); i++) { |
2526 | - this.remove (childs.nth_data (i)); |
2527 | - } |
2528 | - |
2529 | - this.show_all (); |
2530 | - } |
2531 | - } |
2532 | -} |
2533 | + public class KeyList : Gtk.Box { |
2534 | + public KeyList () { |
2535 | + this.orientation = Gtk.Orientation.VERTICAL; |
2536 | + } |
2537 | + |
2538 | + public void show_keys_for_schema (Settings schema) { |
2539 | + clear_list (); |
2540 | + |
2541 | + var keys = schema.list_keys (); |
2542 | + |
2543 | + for (int i = 0; i < keys.length; i++) { |
2544 | + add_item (schema, keys[i]); |
2545 | + } |
2546 | + |
2547 | + this.show_all (); |
2548 | + } |
2549 | + |
2550 | + public void add_item (Settings settings, string key, bool to_end = false, bool live = true, bool show_schema = false) { |
2551 | + var item = new Key (settings, key, settings.settings_schema.get_key (key), live, show_schema); |
2552 | + |
2553 | + if (to_end) { |
2554 | + this.pack_end (item, false, false); |
2555 | + } else { |
2556 | + this.pack_start (item, false, false); |
2557 | + } |
2558 | + } |
2559 | + |
2560 | + public void clear_list () { |
2561 | + var childs = this.get_children (); |
2562 | + |
2563 | + for (int i = 0; i < childs.length (); i++) { |
2564 | + this.remove (childs.nth_data (i)); |
2565 | + } |
2566 | + |
2567 | + this.show_all (); |
2568 | + } |
2569 | + } |
2570 | +} |
2571 | \ No newline at end of file |
2572 | |
2573 | === modified file 'src/Widgets/Schema.vala' |
2574 | --- src/Widgets/Schema.vala 2015-04-04 19:12:47 +0000 |
2575 | +++ src/Widgets/Schema.vala 2015-08-04 19:27:32 +0000 |
2576 | @@ -1,34 +1,35 @@ |
2577 | -/* Copyright 2015 Marcus Wichelmann |
2578 | -* |
2579 | -* This file is part of Configurator. |
2580 | -* |
2581 | -* Configurator is free software: you can redistribute it |
2582 | -* and/or modify it under the terms of the GNU General Public License as |
2583 | -* published by the Free Software Foundation, either version 3 of the |
2584 | -* License, or (at your option) any later version. |
2585 | -* |
2586 | -* Configurator is distributed in the hope that it will be |
2587 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
2588 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
2589 | -* Public License for more details. |
2590 | -* |
2591 | -* You should have received a copy of the GNU General Public License along |
2592 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
2593 | -*/ |
2594 | +/* |
2595 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
2596 | + * |
2597 | + * This program is free software; you can redistribute it and/or |
2598 | + * modify it under the terms of the GNU General Public |
2599 | + * License as published by the Free Software Foundation; either |
2600 | + * version 2 of the License, or (at your option) any later version. |
2601 | + * |
2602 | + * This program is distributed in the hope that it will be useful, |
2603 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2604 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2605 | + * General Public License for more details. |
2606 | + * |
2607 | + * You should have received a copy of the GNU General Public |
2608 | + * License along with this program; if not, write to the |
2609 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2610 | + * Boston, MA 02111-1307, USA. |
2611 | + */ |
2612 | |
2613 | namespace configurator.Widgets { |
2614 | - public class Schema : Granite.Widgets.SourceList.Item { |
2615 | - private Settings settings; |
2616 | - |
2617 | - public Schema (string schema, string name) { |
2618 | - this.settings = new Settings (schema); |
2619 | - this.name = name; |
2620 | - |
2621 | - settings.changed.connect ((key) => Services.EventManager.get_default ().key_changed (settings, key)); |
2622 | - } |
2623 | - |
2624 | - public Settings get_schema () { |
2625 | - return settings; |
2626 | - } |
2627 | - } |
2628 | -} |
2629 | + public class Schema : Granite.Widgets.SourceList.Item { |
2630 | + private Settings settings; |
2631 | + |
2632 | + public Schema (string schema, string name) { |
2633 | + this.settings = new Settings (schema); |
2634 | + this.name = name; |
2635 | + |
2636 | + settings.changed.connect ((key) => Services.EventManager.get_default ().key_changed (settings, key)); |
2637 | + } |
2638 | + |
2639 | + public Settings get_schema () { |
2640 | + return settings; |
2641 | + } |
2642 | + } |
2643 | +} |
2644 | \ No newline at end of file |
2645 | |
2646 | === modified file 'src/Widgets/SchemaFolder.vala' |
2647 | --- src/Widgets/SchemaFolder.vala 2015-04-16 17:26:51 +0000 |
2648 | +++ src/Widgets/SchemaFolder.vala 2015-08-04 19:27:32 +0000 |
2649 | @@ -1,34 +1,35 @@ |
2650 | -/* Copyright 2015 Marcus Wichelmann |
2651 | -* |
2652 | -* This file is part of Configurator. |
2653 | -* |
2654 | -* Configurator is free software: you can redistribute it |
2655 | -* and/or modify it under the terms of the GNU General Public License as |
2656 | -* published by the Free Software Foundation, either version 3 of the |
2657 | -* License, or (at your option) any later version. |
2658 | -* |
2659 | -* Configurator is distributed in the hope that it will be |
2660 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
2661 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
2662 | -* Public License for more details. |
2663 | -* |
2664 | -* You should have received a copy of the GNU General Public License along |
2665 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
2666 | -*/ |
2667 | +/* |
2668 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
2669 | + * |
2670 | + * This program is free software; you can redistribute it and/or |
2671 | + * modify it under the terms of the GNU General Public |
2672 | + * License as published by the Free Software Foundation; either |
2673 | + * version 2 of the License, or (at your option) any later version. |
2674 | + * |
2675 | + * This program is distributed in the hope that it will be useful, |
2676 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2677 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2678 | + * General Public License for more details. |
2679 | + * |
2680 | + * You should have received a copy of the GNU General Public |
2681 | + * License along with this program; if not, write to the |
2682 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2683 | + * Boston, MA 02111-1307, USA. |
2684 | + */ |
2685 | |
2686 | namespace configurator.Widgets { |
2687 | - public class SchemaFolder : Granite.Widgets.SourceList.ExpandableItem { |
2688 | - private Settings settings; |
2689 | - |
2690 | - public SchemaFolder (string schema, string name) { |
2691 | - this.settings = new Settings (schema); |
2692 | - this.name = name; |
2693 | - |
2694 | - settings.changed.connect ((key) => Services.EventManager.get_default ().key_changed (settings, key)); |
2695 | - } |
2696 | - |
2697 | - public Settings get_schema () { |
2698 | - return settings; |
2699 | - } |
2700 | - } |
2701 | -} |
2702 | + public class SchemaFolder : Granite.Widgets.SourceList.ExpandableItem { |
2703 | + private Settings settings; |
2704 | + |
2705 | + public SchemaFolder (string schema, string name) { |
2706 | + this.settings = new Settings (schema); |
2707 | + this.name = name; |
2708 | + |
2709 | + settings.changed.connect ((key) => Services.EventManager.get_default ().key_changed (settings, key)); |
2710 | + } |
2711 | + |
2712 | + public Settings get_schema () { |
2713 | + return settings; |
2714 | + } |
2715 | + } |
2716 | +} |
2717 | \ No newline at end of file |
2718 | |
2719 | === modified file 'src/Widgets/SchemaList.vala' |
2720 | --- src/Widgets/SchemaList.vala 2015-04-16 17:11:58 +0000 |
2721 | +++ src/Widgets/SchemaList.vala 2015-08-04 19:27:32 +0000 |
2722 | @@ -1,117 +1,122 @@ |
2723 | -/* Copyright 2015 Marcus Wichelmann |
2724 | -* |
2725 | -* This file is part of Configurator. |
2726 | -* |
2727 | -* Configurator is free software: you can redistribute it |
2728 | -* and/or modify it under the terms of the GNU General Public License as |
2729 | -* published by the Free Software Foundation, either version 3 of the |
2730 | -* License, or (at your option) any later version. |
2731 | -* |
2732 | -* Configurator is distributed in the hope that it will be |
2733 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
2734 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
2735 | -* Public License for more details. |
2736 | -* |
2737 | -* You should have received a copy of the GNU General Public License along |
2738 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
2739 | -*/ |
2740 | +/* |
2741 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
2742 | + * |
2743 | + * This program is free software; you can redistribute it and/or |
2744 | + * modify it under the terms of the GNU General Public |
2745 | + * License as published by the Free Software Foundation; either |
2746 | + * version 2 of the License, or (at your option) any later version. |
2747 | + * |
2748 | + * This program is distributed in the hope that it will be useful, |
2749 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2750 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2751 | + * General Public License for more details. |
2752 | + * |
2753 | + * You should have received a copy of the GNU General Public |
2754 | + * License along with this program; if not, write to the |
2755 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2756 | + * Boston, MA 02111-1307, USA. |
2757 | + */ |
2758 | |
2759 | namespace configurator.Widgets { |
2760 | - public class SchemaList : Granite.Widgets.SourceList { |
2761 | - private Granite.Widgets.SourceList.ExpandableItem root_item; |
2762 | - |
2763 | - private List<string> schemas; |
2764 | - |
2765 | - private Gee.ArrayList<string> proc_schemas; |
2766 | - |
2767 | - public SchemaList () { |
2768 | - root_item = new Granite.Widgets.SourceList.ExpandableItem (); |
2769 | - |
2770 | - this.root = root_item; |
2771 | - |
2772 | - try { |
2773 | - string[] data; |
2774 | - |
2775 | - var source = new SettingsSchemaSource.from_directory ("/usr/share/glib-2.0/schemas/", null, false); |
2776 | - source.list_schemas (true, out data, null); |
2777 | - |
2778 | - schemas = new List<string> (); |
2779 | - |
2780 | - int i = 0; |
2781 | - while (data[i] != null) { |
2782 | - schemas.append (data[i]); |
2783 | - i++; |
2784 | - } |
2785 | - |
2786 | - schemas.sort ((a, b) => { |
2787 | - return a.collate (b); |
2788 | - }); |
2789 | - |
2790 | - proc_schemas = new Gee.ArrayList<string> (); |
2791 | - |
2792 | - fill_folder ("", root_item, 0); |
2793 | - } catch (Error e) { |
2794 | - warning (e.message); |
2795 | - } |
2796 | - } |
2797 | - |
2798 | - private bool fill_folder (string folder, Granite.Widgets.SourceList.ExpandableItem parent_item, int level) { |
2799 | - int sub_items = 0; |
2800 | - |
2801 | - foreach (string schema in schemas) { |
2802 | - if (!proc_schemas.contains (schema)) { |
2803 | - if (schema.has_prefix (folder) && is_schema (schema)) { |
2804 | - var parts = schema.split ("."); |
2805 | - var is_folder = false; |
2806 | - |
2807 | - if (parts.length > level + 1) { |
2808 | - var folder_path = schema.substring (0, schema.length - (parts[parts.length - 1].length + 1)); |
2809 | - var folder_name = parts[level]; |
2810 | - Granite.Widgets.SourceList.ExpandableItem folder_item; |
2811 | - |
2812 | - if (is_in_schema_list (folder_path)) |
2813 | - folder_item = new SchemaFolder (folder_path, folder_name); |
2814 | - else |
2815 | - folder_item = new Granite.Widgets.SourceList.ExpandableItem (folder_name); |
2816 | - |
2817 | - is_folder = fill_folder (folder != "" ? folder + "." + folder_name : folder_name, folder_item, level + 1); |
2818 | - |
2819 | - if (is_folder) |
2820 | - parent_item.add (folder_item); |
2821 | - } |
2822 | - |
2823 | - if (!is_folder && parts.length > 0) { |
2824 | - var schema_item = new Schema (schema, parts[parts.length -1]); |
2825 | - parent_item.add (schema_item); |
2826 | - } |
2827 | - |
2828 | - proc_schemas.add (schema); |
2829 | - |
2830 | - sub_items++; |
2831 | - } |
2832 | - } |
2833 | - } |
2834 | - |
2835 | - return sub_items > 0; |
2836 | - } |
2837 | - |
2838 | - private bool is_schema (string s) { |
2839 | - foreach (string schema in schemas) { |
2840 | - if (schema.length != s.length && schema.has_prefix (s)) { |
2841 | - return false; |
2842 | - } |
2843 | - } |
2844 | - |
2845 | - return true; |
2846 | - } |
2847 | - |
2848 | - private bool is_in_schema_list (string s) { |
2849 | - foreach (string schema in schemas) { |
2850 | - if (schema == s) |
2851 | - return true; |
2852 | - } |
2853 | - |
2854 | - return false; |
2855 | - } |
2856 | - } |
2857 | -} |
2858 | + public class SchemaList : Granite.Widgets.SourceList { |
2859 | + private Granite.Widgets.SourceList.ExpandableItem root_item; |
2860 | + |
2861 | + private List<string> schemas; |
2862 | + |
2863 | + private Gee.ArrayList<string> proc_schemas; |
2864 | + |
2865 | + public SchemaList () { |
2866 | + root_item = new Granite.Widgets.SourceList.ExpandableItem (); |
2867 | + |
2868 | + this.root = root_item; |
2869 | + |
2870 | + try { |
2871 | + string[] data; |
2872 | + |
2873 | + var source = new SettingsSchemaSource.from_directory ("/usr/share/glib-2.0/schemas/", null, false); |
2874 | + source.list_schemas (true, out data, null); |
2875 | + |
2876 | + schemas = new List<string> (); |
2877 | + |
2878 | + int i = 0; |
2879 | + |
2880 | + while (data[i] != null) { |
2881 | + schemas.append (data[i]); |
2882 | + i++; |
2883 | + } |
2884 | + |
2885 | + schemas.sort ((a, b) => { |
2886 | + return a.collate (b); |
2887 | + }); |
2888 | + |
2889 | + proc_schemas = new Gee.ArrayList<string> (); |
2890 | + |
2891 | + fill_folder ("", root_item, 0); |
2892 | + } catch (Error e) { |
2893 | + warning (e.message); |
2894 | + } |
2895 | + } |
2896 | + |
2897 | + private bool fill_folder (string folder, Granite.Widgets.SourceList.ExpandableItem parent_item, int level) { |
2898 | + int sub_items = 0; |
2899 | + |
2900 | + foreach (string schema in schemas) { |
2901 | + if (!proc_schemas.contains (schema)) { |
2902 | + if (schema.has_prefix (folder) && is_schema (schema)) { |
2903 | + var parts = schema.split ("."); |
2904 | + var is_folder = false; |
2905 | + |
2906 | + if (parts.length > level + 1) { |
2907 | + var folder_path = schema.substring (0, schema.length - (parts[parts.length - 1].length + 1)); |
2908 | + var folder_name = parts[level]; |
2909 | + Granite.Widgets.SourceList.ExpandableItem folder_item; |
2910 | + |
2911 | + if (is_in_schema_list (folder_path)) { |
2912 | + folder_item = new SchemaFolder (folder_path, folder_name); |
2913 | + } else { |
2914 | + folder_item = new Granite.Widgets.SourceList.ExpandableItem (folder_name); |
2915 | + } |
2916 | + |
2917 | + is_folder = fill_folder (folder != "" ? folder + "." + folder_name : folder_name, folder_item, level + 1); |
2918 | + |
2919 | + if (is_folder) { |
2920 | + parent_item.add (folder_item); |
2921 | + } |
2922 | + } |
2923 | + |
2924 | + if (!is_folder && parts.length > 0) { |
2925 | + var schema_item = new Schema (schema, parts[parts.length - 1]); |
2926 | + parent_item.add (schema_item); |
2927 | + } |
2928 | + |
2929 | + proc_schemas.add (schema); |
2930 | + |
2931 | + sub_items++; |
2932 | + } |
2933 | + } |
2934 | + } |
2935 | + |
2936 | + return sub_items > 0; |
2937 | + } |
2938 | + |
2939 | + private bool is_schema (string s) { |
2940 | + foreach (string schema in schemas) { |
2941 | + if (schema.length != s.length && schema.has_prefix (s)) { |
2942 | + return false; |
2943 | + } |
2944 | + } |
2945 | + |
2946 | + return true; |
2947 | + } |
2948 | + |
2949 | + private bool is_in_schema_list (string s) { |
2950 | + foreach (string schema in schemas) { |
2951 | + if (schema == s) { |
2952 | + return true; |
2953 | + } |
2954 | + } |
2955 | + |
2956 | + return false; |
2957 | + } |
2958 | + } |
2959 | +} |
2960 | \ No newline at end of file |
2961 | |
2962 | === modified file 'src/Widgets/TitleBar.vala' |
2963 | --- src/Widgets/TitleBar.vala 2015-07-02 14:44:26 +0000 |
2964 | +++ src/Widgets/TitleBar.vala 2015-08-04 19:27:32 +0000 |
2965 | @@ -1,37 +1,38 @@ |
2966 | -/* Copyright 2015 Marcus Wichelmann |
2967 | -* |
2968 | -* This file is part of Configurator. |
2969 | -* |
2970 | -* Configurator is free software: you can redistribute it |
2971 | -* and/or modify it under the terms of the GNU General Public License as |
2972 | -* published by the Free Software Foundation, either version 3 of the |
2973 | -* License, or (at your option) any later version. |
2974 | -* |
2975 | -* Configurator is distributed in the hope that it will be |
2976 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
2977 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
2978 | -* Public License for more details. |
2979 | -* |
2980 | -* You should have received a copy of the GNU General Public License along |
2981 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
2982 | -*/ |
2983 | +/* |
2984 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
2985 | + * |
2986 | + * This program is free software; you can redistribute it and/or |
2987 | + * modify it under the terms of the GNU General Public |
2988 | + * License as published by the Free Software Foundation; either |
2989 | + * version 2 of the License, or (at your option) any later version. |
2990 | + * |
2991 | + * This program is distributed in the hope that it will be useful, |
2992 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2993 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2994 | + * General Public License for more details. |
2995 | + * |
2996 | + * You should have received a copy of the GNU General Public |
2997 | + * License along with this program; if not, write to the |
2998 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
2999 | + * Boston, MA 02111-1307, USA. |
3000 | + */ |
3001 | |
3002 | namespace configurator.Widgets { |
3003 | - public class TitleBar : Gtk.HeaderBar { |
3004 | - private Gtk.StackSwitcher stack_switcher; |
3005 | - |
3006 | - public TitleBar (MainWindow parent) { |
3007 | - this.get_style_context ().add_class ("primary-toolbar"); |
3008 | - this.show_close_button = true; |
3009 | - this.set_title (_("Configurator")); |
3010 | - |
3011 | - stack_switcher = new Gtk.StackSwitcher (); |
3012 | - |
3013 | - this.set_custom_title (stack_switcher); |
3014 | - } |
3015 | - |
3016 | - public void show_stack (Gtk.Stack stack) { |
3017 | - stack_switcher.set_stack (stack); |
3018 | - } |
3019 | - } |
3020 | -} |
3021 | + public class TitleBar : Gtk.HeaderBar { |
3022 | + private Gtk.StackSwitcher stack_switcher; |
3023 | + |
3024 | + public TitleBar (MainWindow parent) { |
3025 | + this.get_style_context ().add_class ("primary-toolbar"); |
3026 | + this.show_close_button = true; |
3027 | + this.set_title (_("Configurator")); |
3028 | + |
3029 | + stack_switcher = new Gtk.StackSwitcher (); |
3030 | + |
3031 | + this.set_custom_title (stack_switcher); |
3032 | + } |
3033 | + |
3034 | + public void show_stack (Gtk.Stack stack) { |
3035 | + stack_switcher.set_stack (stack); |
3036 | + } |
3037 | + } |
3038 | +} |
3039 | \ No newline at end of file |
3040 | |
3041 | === modified file 'src/config.vala' |
3042 | --- src/config.vala 2015-04-04 19:12:47 +0000 |
3043 | +++ src/config.vala 2015-08-04 19:27:32 +0000 |
3044 | @@ -1,3 +1,22 @@ |
3045 | +/* |
3046 | + * Copyright (c) 2011-2015 elementary Developers (https://launchpad.net/elementary) |
3047 | + * |
3048 | + * This program is free software; you can redistribute it and/or |
3049 | + * modify it under the terms of the GNU General Public |
3050 | + * License as published by the Free Software Foundation; either |
3051 | + * version 2 of the License, or (at your option) any later version. |
3052 | + * |
3053 | + * This program is distributed in the hope that it will be useful, |
3054 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3055 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3056 | + * General Public License for more details. |
3057 | + * |
3058 | + * You should have received a copy of the GNU General Public |
3059 | + * License along with this program; if not, write to the |
3060 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
3061 | + * Boston, MA 02111-1307, USA. |
3062 | + */ |
3063 | + |
3064 | namespace Constants { |
3065 | public const string DATADIR = "/usr/share/configurator"; |
3066 | public const string PKGDATADIR = "/usr/share/configurator/configurator"; |
3067 | @@ -6,4 +25,4 @@ |
3068 | public const string VERSION = "0.1"; |
3069 | public const string VERSION_INFO = "Release"; |
3070 | public const string INSTALL_PREFIX = "/usr"; |
3071 | -} |
3072 | +} |
3073 | \ No newline at end of file |
3074 | |
3075 | === modified file 'src/configurator.vala' |
3076 | --- src/configurator.vala 2015-04-15 22:45:03 +0000 |
3077 | +++ src/configurator.vala 2015-08-04 19:27:32 +0000 |
3078 | @@ -1,82 +1,83 @@ |
3079 | -/* Copyright 2015 Marcus Wichelmann |
3080 | -* |
3081 | -* This file is part of Configurator. |
3082 | -* |
3083 | -* Configurator is free software: you can redistribute it |
3084 | -* and/or modify it under the terms of the GNU General Public License as |
3085 | -* published by the Free Software Foundation, either version 3 of the |
3086 | -* License, or (at your option) any later version. |
3087 | -* |
3088 | -* Configurator is distributed in the hope that it will be |
3089 | -* useful, but WITHOUT ANY WARRANTY; without Configurator the implied warranty of |
3090 | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
3091 | -* Public License for more details. |
3092 | -* |
3093 | -* You should have received a copy of the GNU General Public License along |
3094 | -* with Configurator. If not, see http://www.gnu.org/licenses/. |
3095 | -*/ |
3096 | +/* |
3097 | + * Copyright (c) 2011-2015 Marcus Wichelmann |
3098 | + * |
3099 | + * This program is free software; you can redistribute it and/or |
3100 | + * modify it under the terms of the GNU General Public |
3101 | + * License as published by the Free Software Foundation; either |
3102 | + * version 2 of the License, or (at your option) any later version. |
3103 | + * |
3104 | + * This program is distributed in the hope that it will be useful, |
3105 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3106 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3107 | + * General Public License for more details. |
3108 | + * |
3109 | + * You should have received a copy of the GNU General Public |
3110 | + * License along with this program; if not, write to the |
3111 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
3112 | + * Boston, MA 02111-1307, USA. |
3113 | + */ |
3114 | |
3115 | namespace configurator { |
3116 | - public class configuratorApp : Granite.Application { |
3117 | - public MainWindow window; |
3118 | - |
3119 | - construct { |
3120 | - // App-Properties |
3121 | - program_name = "Configurator"; |
3122 | - exec_name = "configurator"; |
3123 | - |
3124 | - build_data_dir = Constants.DATADIR; |
3125 | - build_pkg_data_dir = Constants.PKGDATADIR; |
3126 | - build_release_name = Constants.RELEASE_NAME; |
3127 | - build_version = Constants.VERSION; |
3128 | - build_version_info = Constants.VERSION_INFO; |
3129 | - |
3130 | - app_years = "2015"; |
3131 | - app_icon = "configurator"; |
3132 | - app_launcher = "configurator.desktop"; |
3133 | - application_id = "net.launchpad.configurator"; |
3134 | - main_url = "https://launchpad.net/configurator"; |
3135 | - bug_url = "https://bugs.launchpad.net/configurator"; |
3136 | - help_url = "https://answers.launchpad.net/configurator"; |
3137 | - translate_url = "https://translations.launchpad.net/configurator"; |
3138 | - about_authors = {"Marcus Wichelmann <admin@marcusw.de>"}; |
3139 | - about_documenters = {"Marcus Wichelmann <admin@marcusw.de>"}; |
3140 | - about_artists = {"Marcus Wichelmann <admin@marcusw.de>"}; |
3141 | - about_comments = _("A tool to edit your system-settings in elementary OS."); |
3142 | - about_translators = "Launchpad Translators"; |
3143 | - } |
3144 | - |
3145 | - public configuratorApp () { |
3146 | - // Translations |
3147 | - Intl.setlocale (LocaleCategory.ALL, ""); |
3148 | - string langpack_dir = Path.build_filename (Constants.INSTALL_PREFIX, "share", "locale"); |
3149 | - Intl.bindtextdomain (Constants.GETTEXT_PACKAGE, langpack_dir); |
3150 | - Intl.bind_textdomain_codeset (Constants.GETTEXT_PACKAGE, "UTF-8"); |
3151 | - Intl.textdomain (Constants.GETTEXT_PACKAGE); |
3152 | - |
3153 | - // Debug service |
3154 | - Granite.Services.Logger.initialize ("configurator"); |
3155 | - Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.DEBUG; |
3156 | - } |
3157 | - |
3158 | - public override void activate () { |
3159 | - if (get_windows () == null) { |
3160 | - window = new MainWindow (this); |
3161 | - window.show_all (); |
3162 | - } else { |
3163 | - window.present (); |
3164 | - } |
3165 | - } |
3166 | - |
3167 | - public override void open (File[] files, string hint) { |
3168 | - // Do nothing |
3169 | - } |
3170 | - |
3171 | - public static void main (string[] args) { |
3172 | - Gtk.init (ref args); |
3173 | - |
3174 | - var app = new configurator.configuratorApp (); |
3175 | - app.run (args); |
3176 | - } |
3177 | - } |
3178 | -} |
3179 | + public class configuratorApp : Granite.Application { |
3180 | + public MainWindow window; |
3181 | + |
3182 | + construct { |
3183 | + /* App-Properties */ |
3184 | + program_name = "Configurator"; |
3185 | + exec_name = "configurator"; |
3186 | + |
3187 | + build_data_dir = Constants.DATADIR; |
3188 | + build_pkg_data_dir = Constants.PKGDATADIR; |
3189 | + build_release_name = Constants.RELEASE_NAME; |
3190 | + build_version = Constants.VERSION; |
3191 | + build_version_info = Constants.VERSION_INFO; |
3192 | + |
3193 | + app_years = "2015"; |
3194 | + app_icon = "configurator"; |
3195 | + app_launcher = "configurator.desktop"; |
3196 | + application_id = "net.launchpad.configurator"; |
3197 | + main_url = "https://launchpad.net/configurator"; |
3198 | + bug_url = "https://bugs.launchpad.net/configurator"; |
3199 | + help_url = "https://answers.launchpad.net/configurator"; |
3200 | + translate_url = "https://translations.launchpad.net/configurator"; |
3201 | + about_authors = { "Marcus Wichelmann <admin@marcusw.de>" }; |
3202 | + about_documenters = { "Marcus Wichelmann <admin@marcusw.de>" }; |
3203 | + about_artists = { "Marcus Wichelmann <admin@marcusw.de>" }; |
3204 | + about_comments = _("A tool to edit your system-settings in elementary OS."); |
3205 | + about_translators = "Launchpad Translators"; |
3206 | + } |
3207 | + |
3208 | + public configuratorApp () { |
3209 | + /* Translations */ |
3210 | + Intl.setlocale (LocaleCategory.ALL, ""); |
3211 | + string langpack_dir = Path.build_filename (Constants.INSTALL_PREFIX, "share", "locale"); |
3212 | + Intl.bindtextdomain (Constants.GETTEXT_PACKAGE, langpack_dir); |
3213 | + Intl.bind_textdomain_codeset (Constants.GETTEXT_PACKAGE, "UTF-8"); |
3214 | + Intl.textdomain (Constants.GETTEXT_PACKAGE); |
3215 | + |
3216 | + /* Debug service */ |
3217 | + Granite.Services.Logger.initialize ("configurator"); |
3218 | + Granite.Services.Logger.DisplayLevel = Granite.Services.LogLevel.DEBUG; |
3219 | + } |
3220 | + |
3221 | + public override void activate () { |
3222 | + if (get_windows () == null) { |
3223 | + window = new MainWindow (this); |
3224 | + window.show_all (); |
3225 | + } else { |
3226 | + window.present (); |
3227 | + } |
3228 | + } |
3229 | + |
3230 | + public override void open (File[] files, string hint) { |
3231 | + /* Do nothing */ |
3232 | + } |
3233 | + |
3234 | + public static void main (string[] args) { |
3235 | + Gtk.init (ref args); |
3236 | + |
3237 | + var app = new configurator.configuratorApp (); |
3238 | + app.run (args); |
3239 | + } |
3240 | + } |
3241 | +} |
3242 | \ No newline at end of file |