Merge lp:~ricotz/plank/gsettings into lp:plank

Proposed by Rico Tzschichholz
Status: Merged
Merged at revision: 1418
Proposed branch: lp:~ricotz/plank/gsettings
Merge into: lp:plank
Diff against target: 921 lines (+424/-149)
20 files modified
.bzrignore (+4/-0)
configure.ac (+3/-0)
data/Makefile.am (+15/-0)
data/net.launchpad.plank.gschema.xml.in.in (+132/-0)
docs/Makefile.am (+1/-0)
lib/DockController.vala (+2/-3)
lib/DockPreferences.vala (+18/-112)
lib/Factories/AbstractMain.vala (+1/-1)
lib/Factories/ItemFactory.vala (+3/-4)
lib/Items/ApplicationDockItemProvider.vala (+5/-11)
lib/Makefile.am (+1/-0)
lib/PositionManager.vala (+1/-2)
lib/Services/Settings.vala (+122/-0)
lib/libplank.symbols (+8/-4)
po/POTFILES.in (+1/-0)
po/POTFILES.skip (+1/-0)
po/plank.pot (+102/-8)
tests/Controller.vala (+2/-2)
tests/Makefile.am (+1/-1)
tests/Widgets.vala (+1/-1)
To merge this branch: bzr merge lp:~ricotz/plank/gsettings
Reviewer Review Type Date Requested Status
Docky Core Pending
Review via email: mp+271100@code.launchpad.net
To post a comment you must log in.
lp:~ricotz/plank/gsettings updated
1392. By Rico Tzschichholz

po: Update translations

1393. By Rico Tzschichholz

po: Update translations

1394. By Rico Tzschichholz

filedockitem: Correctly display filenames with underscores in folder-menu

1395. By Rico Tzschichholz

positionmanager: Just return primary_monitor if empty plug_name was given

1396. By Rico Tzschichholz

positionmanager: Add verbose output for monitor_geo_changed

1397. By Rico Tzschichholz

dockitemprovider: Insert items where the data was dropped

If there is currently no HoveredItem try to determine the nearest one as
drop-point.

1398. By Rico Tzschichholz

lib: Tweak method signature of file-monitor callbacks

1399. By Rico Tzschichholz

lib: FileMonitorEvent is a simple enum not a flag

1400. By Rico Tzschichholz

lib: Avoid some superfluous reference-taking

1401. By Rico Tzschichholz

plankdockitem: Open "preferences" on left-click instead of "about"

1402. By Rico Tzschichholz

defaultappprovider: Don't ignore opened applications if Wnck doesn't know

Better don't rely on Wnck if Bamf reported an opened application. If an
application is for whatever reason replacing or renaming its window on
startup we might drop it while Wnck reports a window-count of 0.

1403. By Rico Tzschichholz

transientdockitem: Delayed reloading of the window-icon if needed

If the window-icon was null on the first try then schedule a 2nd one.

1404. By Rico Tzschichholz

lib: Actually pass e.g. -lm to the linker by adding it to *_LIBADD

1405. By Rico Tzschichholz

po: Update translations

1406. By Rico Tzschichholz

Prepare 0.10.1 release

1407. By Rico Tzschichholz

Back to development

1408. By Rico Tzschichholz

build: Be more rebust for parallel building

1409. By Rico Tzschichholz

dockrenderer: Don't request a redraw if "transient_items" is empty

1410. By Rico Tzschichholz

dockrenderer: Use non-linear transition in/out the "zoom" state

Increase transition-time to 200ms and use cubic-easing.

1411. By Rico Tzschichholz

easing: Some optimization, avoid vala's struct-copying by using pointers

1412. By Rico Tzschichholz

build: Be more rebust for parallel building

1413. By Rico Tzschichholz

easing: Use proper codestyle for ANIMATION_MODES while it is a const

1414. By Rico Tzschichholz

dockrenderer: Factor out jump-calculation into easing_bounce

1415. By Rico Tzschichholz

dockrenderer: Define and use some internal constants

1416. By Rico Tzschichholz

po: Update translations

1417. By Rico Tzschichholz

Add docklets support (internal/private)

Based on initially proposed docky 3.0 branch

1418. By Rico Tzschichholz

Add GSettings support and transition DockPreferences to it

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2015-11-02 08:40:11 +0000
3+++ .bzrignore 2015-11-02 13:45:34 +0000
4@@ -69,4 +69,8 @@
5 tests/gmock-tests
6 tests/tests
7 data/plank.appdata.xml
8+data/gschemas.compiled
9+data/net.launchpad.plank.gschema.valid
10+data/net.launchpad.plank.gschema.xml
11+data/net.launchpad.plank.gschema.xml.in
12 data/plank.desktop
13
14=== modified file 'configure.ac'
15--- configure.ac 2015-11-02 08:40:11 +0000
16+++ configure.ac 2015-11-02 13:45:34 +0000
17@@ -63,6 +63,8 @@
18
19 LT_LIB_M
20
21+GLIB_GSETTINGS
22+
23 AC_SUBST([CFLAGS])
24 AC_SUBST([CPPFLAGS])
25 AC_SUBST([LDFLAGS])
26@@ -390,6 +392,7 @@
27 AC_CONFIG_FILES([
28 Makefile
29 data/Makefile
30+data/net.launchpad.plank.gschema.xml.in
31 data/apport/Makefile
32 data/icons/Makefile
33 data/themes/Makefile
34
35=== modified file 'data/Makefile.am'
36--- data/Makefile.am 2015-01-29 16:03:59 +0000
37+++ data/Makefile.am 2015-11-02 13:45:34 +0000
38@@ -12,6 +12,7 @@
39 EXTRA_DIST = \
40 application-default-icon.svg \
41 plank.appdata.xml.in \
42+ net.launchpad.plank.gschema.xml.in.in \
43 plank.desktop.in \
44 plank.gresource.xml \
45 poof.svg \
46@@ -21,6 +22,10 @@
47 CLEANFILES = \
48 plank.appdata.xml \
49 plank.desktop \
50+ $(gsettings_SCHEMAS) \
51+ gschemas.compiled \
52+ net.launchpad.plank.gschema.valid \
53+ net.launchpad.plank.gschema.xml.in \
54 $(NULL)
55
56 dist_man_MANS = \
57@@ -35,4 +40,14 @@
58 appdatadir = $(datadir)/appdata
59 appdata_DATA = plank.appdata.xml
60
61+gsettings_SCHEMAS = net.launchpad.plank.gschema.xml
62+
63 @INTLTOOL_XML_RULE@
64+
65+@GSETTINGS_RULES@
66+
67+gschemas.compiled: Makefile $(gsettings_SCHEMAS:.xml=.valid)
68+ $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --targetdir=$(builddir) $(builddir)
69+
70+all-local: gschemas.compiled
71+
72
73=== added file 'data/net.launchpad.plank.gschema.xml.in.in'
74--- data/net.launchpad.plank.gschema.xml.in.in 1970-01-01 00:00:00 +0000
75+++ data/net.launchpad.plank.gschema.xml.in.in 2015-11-02 13:45:34 +0000
76@@ -0,0 +1,132 @@
77+<schemalist>
78+ <enum id="PlankHideType">
79+ <value nick="none" value="0"/>
80+ <value nick="intelligent" value="1"/>
81+ <value nick="auto" value="2"/>
82+ <value nick="dodge-maximized" value="3"/>
83+ <value nick="window-dodge" value="4"/>
84+ <value nick="dodge-active" value="5"/>
85+ </enum>
86+
87+ <enum id="GtkAlignType">
88+ <value nick="fill" value="0"/>
89+ <value nick="start" value="1"/>
90+ <value nick="end" value="2"/>
91+ <value nick="center" value="3"/>
92+ </enum>
93+
94+ <enum id="GtkPositionType">
95+ <value nick="left" value="0"/>
96+ <value nick="right" value="1"/>
97+ <value nick="top" value="2"/>
98+ <value nick="bottom" value="3"/>
99+ </enum>
100+
101+
102+ <schema id="net.launchpad.plank" path="/net/launchpad/plank/">
103+ <child name="docks" schema="net.launchpad.plank.dock.settings"/>
104+ </schema>
105+
106+ <schema id="net.launchpad.plank.dock.settings" gettext-domain="@GETTEXT_PACKAGE@">
107+ <key name="alignment" enum='GtkAlignType'>
108+ <default>'center'</default>
109+ <_summary>The alignment for the dock on the monitor's edge.</_summary>
110+ <_description>fill, start, end, center</_description>
111+ </key>
112+ <key name="auto-pinning" type="b">
113+ <default>true</default>
114+ <_summary>Whether to automatically pin an application if it seems useful to do.</_summary>
115+ <_description></_description>
116+ </key>
117+ <key name="current-workspace-only" type="b">
118+ <default>false</default>
119+ <_summary>Whether to show only windows of the current workspace.</_summary>
120+ <_description></_description>
121+ </key>
122+ <key name="dock-items" type="as">
123+ <default>[]</default>
124+ <_summary>Array of dockitem-files on this dock. DO NOT MODIFY</_summary>
125+ <_description></_description>
126+ </key>
127+ <key name="hide-delay" type="i">
128+ <range min="0"/>
129+ <default>0</default>
130+ <_summary>Time (in ms) to wait before hiding the dock.</_summary>
131+ <_description></_description>
132+ </key>
133+ <key name="hide-mode" enum='PlankHideType'>
134+ <default>'intelligent'</default>
135+ <_summary>Hidemode of the dock.</_summary>
136+ <_description>none, intelligent, auto</_description>
137+ </key>
138+ <key name="icon-size" type="i">
139+ <range min="24" max="128"/>
140+ <default>48</default>
141+ <_summary>The size of dock icons (in pixels).</_summary>
142+ <_description></_description>
143+ </key>
144+ <key name="items-alignment" enum='GtkAlignType'>
145+ <default>'center'</default>
146+ <_summary>The alignment of the items in this dock.</_summary>
147+ <_description>fill, start, end, center</_description>
148+ </key>
149+ <key name="lock-items" type="b">
150+ <default>false</default>
151+ <_summary>Whether to prevent drag'n'drop actions and lock items on the dock.</_summary>
152+ <_description></_description>
153+ </key>
154+ <key name="monitor" type="s">
155+ <default>''</default>
156+ <_summary>The plug-name of the monitor for the dock to show on (e.g. DVI-I-1, HDMI1, LVDS1). Leave this empty to keep on the primary monitor.</_summary>
157+ <_description></_description>
158+ </key>
159+ <key name="offset" type="i">
160+ <range min="-100" max="100"/>
161+ <default>0</default>
162+ <_summary>The dock's position offset from center (in percent).</_summary>
163+ <_description></_description>
164+ </key>
165+ <key name="pinned-only" type="b">
166+ <default>false</default>
167+ <_summary>Whether to show only pinned applications. Useful for running more then one dock.</_summary>
168+ <_description></_description>
169+ </key>
170+ <key name="position" enum='GtkPositionType'>
171+ <default>'bottom'</default>
172+ <_summary>The position for the dock on the monitor.</_summary>
173+ <_description>left, right, top, bottom</_description>
174+ </key>
175+ <key name="pressure-reveal" type="b">
176+ <default>false</default>
177+ <_summary>Whether to use pressure-based revealing of the dock if the support is available.</_summary>
178+ <_description></_description>
179+ </key>
180+ <key name="show-dock-item" type="b">
181+ <default>true</default>
182+ <_summary>Whether to show the item for the dock itself.</_summary>
183+ <_description></_description>
184+ </key>
185+ <key name="theme" type="s">
186+ <default>'Default'</default>
187+ <_summary>The name of the dock's theme to use.</_summary>
188+ <_description></_description>
189+ </key>
190+ <key name="unhide-delay" type="i">
191+ <range min="0"/>
192+ <default>0</default>
193+ <_summary>Time (in ms) to wait before unhiding the dock.</_summary>
194+ <_description></_description>
195+ </key>
196+ <key name="zoom-enabled" type="b">
197+ <default>false</default>
198+ <_summary>Whether the dock will zoom when hovered.</_summary>
199+ <_description></_description>
200+ </key>
201+ <key name="zoom-percent" type="i">
202+ <range min="100" max="200"/>
203+ <default>150</default>
204+ <_summary>The dock's icon-zoom (in percent).</_summary>
205+ <_description></_description>
206+ </key>
207+ </schema>
208+</schemalist>
209
210=== modified file 'docs/Makefile.am'
211--- docs/Makefile.am 2015-07-16 08:24:10 +0000
212+++ docs/Makefile.am 2015-11-02 13:45:34 +0000
213@@ -54,6 +54,7 @@
214 $(top_srcdir)/lib/Services/Logger.vala \
215 $(top_srcdir)/lib/Services/Paths.vala \
216 $(top_srcdir)/lib/Services/Preferences.vala \
217+ $(top_srcdir)/lib/Services/Settings.vala \
218 $(top_srcdir)/lib/Services/System.vala \
219 $(top_srcdir)/lib/Services/Worker.vala \
220 $(top_srcdir)/lib/Widgets/CompositedWindow.vala \
221
222=== modified file 'lib/DockController.vala'
223--- lib/DockController.vala 2015-09-03 19:48:10 +0000
224+++ lib/DockController.vala 2015-11-02 13:45:34 +0000
225@@ -74,15 +74,14 @@
226 *
227 * @param config_folder the base-folder to load settings from and save them to
228 */
229- public DockController (File config_folder)
230+ public DockController (string dock_name, File config_folder)
231 {
232 // Make sure our config-directory exists
233 Paths.ensure_directory_exists (config_folder);
234
235 Logger.verbose ("DockController (config_folder = %s)", config_folder.get_path ());
236
237- Object (config_folder : config_folder,
238- prefs : new DockPreferences.with_file (config_folder.get_child ("settings")));
239+ Object (config_folder : config_folder, prefs : new DockPreferences (dock_name));
240 }
241
242 construct
243
244=== modified file 'lib/DockPreferences.vala'
245--- lib/DockPreferences.vala 2015-06-27 13:37:11 +0000
246+++ lib/DockPreferences.vala 2015-11-02 13:45:34 +0000
247@@ -24,8 +24,20 @@
248 /**
249 * Contains all preferences for docks.
250 */
251- public class DockPreferences : Preferences
252+ public class DockPreferences : Plank.Services.Settings
253 {
254+ static GLib.Settings create_settings (string schema_id, string? path = null)
255+ {
256+ //FIXME Only to make it run/work uninstalled from top_builddir
257+ Environment.set_variable ("GSETTINGS_SCHEMA_DIR", Environment.get_current_dir () + "/data", false);
258+
259+ var schema = GLib.SettingsSchemaSource.get_default ().lookup (schema_id, true);
260+ if (schema == null)
261+ error ("GSettingsSchema '%s' not found", schema_id);
262+
263+ return new GLib.Settings.full (schema, null, path);
264+ }
265+
266 public const int MIN_ICON_SIZE = 24;
267 public const int MAX_ICON_SIZE = 128;
268
269@@ -50,8 +62,8 @@
270 [Description(nick = "monitor", blurb = "The plug-name of the monitor for the dock to show on (e.g. DVI-I-1, HDMI1, LVDS1). Leave this empty to keep on the primary monitor.")]
271 public string Monitor { get; set; }
272
273- [Description(nick = "dock-items", blurb = "List of *.dockitem files on this dock. DO NOT MODIFY")]
274- public string DockItems { get; set; }
275+ [Description(nick = "dock-items", blurb = "Array of the dockitem-files on this dock. DO NOT MODIFY")]
276+ public string[] DockItems { get; set; }
277
278 [Description(nick = "position", blurb = "The position for the dock on the monitor. If 0, left. If 1, right. If 2, top. If 3, bottom.")]
279 public Gtk.PositionType Position { get; set; }
280@@ -92,25 +104,9 @@
281 /**
282 * {@inheritDoc}
283 */
284- public DockPreferences ()
285- {
286- base ();
287- }
288-
289- /**
290- * {@inheritDoc}
291- */
292- public DockPreferences.with_file (File file)
293- {
294- base.with_file (file);
295- }
296-
297- /**
298- * {@inheritDoc}
299- */
300- public DockPreferences.with_filename (string filename)
301- {
302- base.with_filename (filename);
303+ public DockPreferences (string name)
304+ {
305+ Object (settings: create_settings ("net.launchpad.plank.dock.settings", "/net/launchpad/plank/docks/%s/".printf (name)));
306 }
307
308 ~DockPreferences ()
309@@ -118,34 +114,6 @@
310 }
311
312 /**
313- * {@inheritDoc}
314- */
315- protected override void reset_properties ()
316- {
317- Logger.verbose ("DockPreferences.reset_properties ()");
318-
319- CurrentWorkspaceOnly = false;
320- IconSize = 48;
321- HideMode = HideType.INTELLIGENT;
322- UnhideDelay = 0;
323- HideDelay = 0;
324- Monitor = "";
325- DockItems = "";
326- Position = Gtk.PositionType.BOTTOM;
327- Offset = 0;
328- Theme = Plank.Drawing.Theme.DEFAULT_NAME;
329- Alignment = Gtk.Align.CENTER;
330- ItemsAlignment = Gtk.Align.CENTER;
331- LockItems = false;
332- PressureReveal = false;
333- PinnedOnly = false;
334- AutoPinning = true;
335- ShowDockItem = true;
336- ZoomEnabled = false;
337- ZoomPercent = 150;
338- }
339-
340- /**
341 * Increases the IconSize, if it is not already at its max.
342 */
343 public void increase_icon_size ()
344@@ -179,9 +147,6 @@
345 protected override void verify (string prop)
346 {
347 switch (prop) {
348- case "CurrentWorkspaceOnly":
349- break;
350-
351 case "IconSize":
352 if (IconSize < MIN_ICON_SIZE)
353 IconSize = MIN_ICON_SIZE;
354@@ -191,71 +156,12 @@
355 IconSize -= 1;
356 break;
357
358- case "HideMode":
359- break;
360-
361- case "UnhideDelay":
362- break;
363-
364- case "HideDelay":
365- break;
366-
367- case "Monitor":
368- // TODO Try to transition old setting
369- if (Monitor == "-1")
370- Monitor = "";
371- break;
372-
373- case "DockItems":
374- break;
375-
376- case "Position":
377- break;
378-
379- case "Offset":
380- if (Offset < -100)
381- Offset = -100;
382- else if (Offset > 100)
383- Offset = 100;
384- break;
385-
386 case "Theme":
387 if (Theme == "")
388 Theme = Plank.Drawing.Theme.DEFAULT_NAME;
389 else if (Theme.contains ("/"))
390 Theme = Theme.replace ("/", "");
391 break;
392-
393- case "Alignment":
394- break;
395-
396- case "ItemsAlignment":
397- break;
398-
399- case "LockItems":
400- break;
401-
402- case "PressureReveal":
403- break;
404-
405- case "PinnedOnly":
406- break;
407-
408- case "AutoPinning":
409- break;
410-
411- case "ShowDockItem":
412- break;
413-
414- case "ZoomEnabled":
415- break;
416-
417- case "ZoomPercent":
418- if (ZoomPercent < MIN_ICON_ZOOM)
419- ZoomPercent = MIN_ICON_ZOOM;
420- else if (ZoomPercent > MAX_ICON_ZOOM)
421- ZoomPercent = MAX_ICON_ZOOM;
422- break;
423 }
424 }
425 }
426
427=== modified file 'lib/Factories/AbstractMain.vala'
428--- lib/Factories/AbstractMain.vala 2015-07-20 09:03:45 +0000
429+++ lib/Factories/AbstractMain.vala 2015-11-02 13:45:34 +0000
430@@ -299,7 +299,7 @@
431 */
432 protected virtual void create_controller ()
433 {
434- controller = new DockController (Paths.AppConfigFolder.get_child (dock_name));
435+ controller = new DockController (dock_name, Paths.AppConfigFolder.get_child (dock_name));
436 controller.initialize ();
437
438 add_window (controller.window);
439
440=== modified file 'lib/Factories/ItemFactory.vala'
441--- lib/Factories/ItemFactory.vala 2015-10-07 13:31:26 +0000
442+++ lib/Factories/ItemFactory.vala 2015-11-02 13:45:34 +0000
443@@ -157,7 +157,7 @@
444 * @param ordering a ";;"-separated string to be used to order the loaded DockItems
445 * @return the new List of DockItems
446 */
447- public Gee.ArrayList<DockItem> load_items (GLib.File source_dir, string? ordering = null)
448+ public Gee.ArrayList<DockItem> load_items (GLib.File source_dir, string[]? ordering = null)
449 {
450 var result = new Gee.ArrayList<DockItem> ();
451
452@@ -204,7 +204,7 @@
453 var new_items = new Gee.ArrayList<DockItem> ();
454
455 foreach (var item in result) {
456- if (ordering.contains (item.DockItemFilename))
457+ if (item.DockItemFilename in ordering)
458 existing_items.add (item);
459 else
460 new_items.add (item);
461@@ -213,8 +213,7 @@
462 result.clear ();
463
464 // add saved dockitems based on their serialized order
465- var dockitems = ordering.split (";;");
466- foreach (unowned string dockitem in dockitems)
467+ foreach (unowned string dockitem in ordering)
468 foreach (var item in existing_items)
469 if (dockitem == item.DockItemFilename) {
470 result.add (item);
471
472=== modified file 'lib/Items/ApplicationDockItemProvider.vala'
473--- lib/Items/ApplicationDockItemProvider.vala 2015-10-07 13:31:26 +0000
474+++ lib/Items/ApplicationDockItemProvider.vala 2015-11-02 13:45:34 +0000
475@@ -277,11 +277,11 @@
476 /**
477 * Serializes the dockitem-filenames
478 *
479- * @return string containing all filesnames separated by ';;'
480+ * @return a array of string containing all filesnames
481 */
482- public string get_item_list_string ()
483+ public string[] get_item_list_string ()
484 {
485- string? item_list = null;
486+ var item_list = new Gee.ArrayList<string> ();
487 foreach (var element in internal_elements) {
488 unowned DockItem? item = (element as DockItem);
489 if (item == null || (item is TransientDockItem))
490@@ -289,17 +289,11 @@
491
492 var dock_item_filename = item.DockItemFilename;
493 if (dock_item_filename.length > 0) {
494- if (item_list != null)
495- item_list = "%s;;%s".printf (item_list, dock_item_filename);
496- else
497- item_list = (owned) dock_item_filename;
498+ item_list.add ((owned) dock_item_filename);
499 }
500 }
501
502- if (item_list == null)
503- return "";
504-
505- return item_list;
506+ return item_list.to_array ();
507 }
508
509 protected virtual void app_opened (Bamf.Application app)
510
511=== modified file 'lib/Makefile.am'
512--- lib/Makefile.am 2015-11-02 08:40:11 +0000
513+++ lib/Makefile.am 2015-11-02 13:45:34 +0000
514@@ -95,6 +95,7 @@
515 Services/Logger.vala \
516 Services/Paths.vala \
517 Services/Preferences.vala \
518+ Services/Settings.vala \
519 Services/System.vala \
520 Services/Worker.vala \
521 Widgets/CompositedWindow.vala \
522
523=== modified file 'lib/PositionManager.vala'
524--- lib/PositionManager.vala 2015-10-06 18:10:59 +0000
525+++ lib/PositionManager.vala 2015-11-02 13:45:34 +0000
526@@ -167,8 +167,6 @@
527 {
528 static_dock_region = {};
529 draw_values = new Gee.HashMap<DockElement, DockItemDrawValue> ();
530-
531- controller.prefs.notify.connect (prefs_changed);
532 }
533
534 /**
535@@ -179,6 +177,7 @@
536 {
537 unowned Gdk.Screen screen = controller.window.get_screen ();
538
539+ controller.prefs.notify.connect (prefs_changed);
540 screen.monitors_changed.connect (screen_changed);
541 screen.size_changed.connect (screen_changed);
542 screen.composited_changed.connect (screen_composited_changed);
543
544=== added file 'lib/Services/Settings.vala'
545--- lib/Services/Settings.vala 1970-01-01 00:00:00 +0000
546+++ lib/Services/Settings.vala 2015-11-02 13:45:34 +0000
547@@ -0,0 +1,122 @@
548+//
549+// Copyright (C) 2014 Rico Tzschichholz
550+//
551+// This program is free software: you can redistribute it and/or modify
552+// it under the terms of the GNU General Public License as published by
553+// the Free Software Foundation, either version 3 of the License, or
554+// (at your option) any later version.
555+//
556+// This program is distributed in the hope that it will be useful,
557+// but WITHOUT ANY WARRANTY; without even the implied warranty of
558+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
559+// GNU General Public License for more details.
560+//
561+// You should have received a copy of the GNU General Public License
562+// along with this program. If not, see <http://www.gnu.org/licenses/>.
563+//
564+
565+namespace Plank.Services
566+{
567+ /**
568+ * The base class for gsettings-based configuration classes. Defined properties will be bound
569+ * to the corresponing schema-key of the given schema-path. The property's nick-name must match
570+ * the schema-key.
571+ */
572+ public abstract class Settings : GLib.Object
573+ {
574+ [CCode (notify = false)]
575+ public GLib.Settings settings { get; construct; }
576+
577+ /**
578+ * {@inheritDoc}
579+ */
580+ public Settings (string schema)
581+ {
582+ Object (settings: new GLib.Settings (schema));
583+ }
584+
585+ /**
586+ * {@inheritDoc}
587+ */
588+ public Settings.with_path (string schema, string path)
589+ {
590+ Object (settings: new GLib.Settings.with_path (schema, path));
591+ }
592+
593+ construct
594+ {
595+ debug ("Bind '%s' to '%s'", get_type ().name (), settings.path);
596+
597+ unowned ParamSpec[] properties = get_class ().list_properties ();
598+
599+ // Bind available gsettings-keys to their class-properties
600+ foreach (unowned string key in settings.list_keys ()) {
601+ ParamSpec? property = null;
602+ foreach (unowned ParamSpec p in properties)
603+ if (p.get_nick () == key)
604+ property = p;
605+ if (property == null)
606+ continue;
607+
608+ unowned string name = property.get_name ();
609+ unowned string nick = property.get_nick ();
610+ var type = property.value_type;
611+
612+ Logger.verbose ("Bind '%s%s' to '%s.%s'", settings.path, nick, get_type ().name (), name);
613+ if (type.is_fundamental () || type.is_enum () || type.is_flags () || type == typeof(string[])) {
614+ settings.bind (nick, this, name, SettingsBindFlags.DEFAULT);
615+ } else {
616+ warning ("Binding of '%s' from type '%s' not supported yet!", name, type.name ());
617+ }
618+
619+ verify (name);
620+ }
621+ }
622+
623+ /**
624+ * Verify the property given by its name and change the property if necessary.
625+ *
626+ * @param name the name of the property
627+ */
628+ protected virtual void verify (string name)
629+ {
630+ // do nothing, this isnt abstract because we dont
631+ // want to force subclasses to implement this
632+ }
633+
634+ /**
635+ * Resets all properties to their default values.
636+ */
637+ protected void reset_all ()
638+ {
639+ foreach (unowned string key in settings.list_keys ())
640+ settings.reset (key);
641+ }
642+
643+ /**
644+ * Delays saving changes until apply() is called.
645+ */
646+ public void delay ()
647+ {
648+ if (settings.delay_apply)
649+ return;
650+
651+ Logger.verbose ("Settings.delay()");
652+
653+ settings.delay ();
654+ }
655+
656+ /**
657+ * If any settings were changed, apply them now.
658+ */
659+ public void apply ()
660+ {
661+ if (!settings.delay_apply)
662+ return;
663+
664+ Logger.verbose ("Settings.apply()");
665+
666+ settings.apply ();
667+ }
668+ }
669+}
670
671=== modified file 'lib/libplank.symbols'
672--- lib/libplank.symbols 2015-09-03 19:37:54 +0000
673+++ lib/libplank.symbols 2015-11-02 13:45:34 +0000
674@@ -31,8 +31,6 @@
675 plank_dock_controller_set_renderer
676 plank_dock_controller_set_window
677 plank_dock_preferences_construct
678-plank_dock_preferences_construct_with_file
679-plank_dock_preferences_construct_with_filename
680 plank_dock_preferences_decrease_icon_size
681 plank_dock_preferences_get_Alignment
682 plank_dock_preferences_get_AutoPinning
683@@ -57,8 +55,6 @@
684 plank_dock_preferences_increase_icon_size
685 plank_dock_preferences_is_horizontal_dock
686 plank_dock_preferences_new
687-plank_dock_preferences_new_with_file
688-plank_dock_preferences_new_with_filename
689 plank_dock_preferences_set_Alignment
690 plank_dock_preferences_set_AutoPinning
691 plank_dock_preferences_set_CurrentWorkspaceOnly
692@@ -597,6 +593,14 @@
693 plank_services_prefs_serializable_get_type
694 plank_services_prefs_serializable_prefs_deserialize
695 plank_services_prefs_serializable_prefs_serialize
696+plank_services_settings_apply
697+plank_services_settings_construct
698+plank_services_settings_construct_with_path
699+plank_services_settings_delay
700+plank_services_settings_get_settings
701+plank_services_settings_get_type
702+plank_services_settings_reset_all
703+plank_services_settings_verify
704 plank_services_system_get_type
705 plank_services_system_is_desktop_session
706 plank_services_system_launch
707
708=== modified file 'po/POTFILES.in'
709--- po/POTFILES.in 2015-01-04 13:41:19 +0000
710+++ po/POTFILES.in 2015-11-02 13:45:34 +0000
711@@ -1,3 +1,4 @@
712+data/net.launchpad.plank.gschema.xml.in.in
713 data/plank.appdata.xml.in
714 data/plank.desktop.in
715 [type: gettext/glade]data/ui/preferences.ui
716
717=== modified file 'po/POTFILES.skip'
718--- po/POTFILES.skip 2015-11-02 08:40:11 +0000
719+++ po/POTFILES.skip 2015-11-02 13:45:34 +0000
720@@ -1,3 +1,4 @@
721+data/net.launchpad.plank.gschema.xml.in
722 docklets/Clippy/ClippyDockItem.c
723 docklets/Clock/ClockDockItem.c
724 docklets/Desktop/DesktopDockItem.c
725
726=== modified file 'po/plank.pot'
727--- po/plank.pot 2015-07-16 11:48:57 +0000
728+++ po/plank.pot 2015-11-02 13:45:34 +0000
729@@ -8,7 +8,7 @@
730 msgstr ""
731 "Project-Id-Version: PACKAGE VERSION\n"
732 "Report-Msgid-Bugs-To: \n"
733-"POT-Creation-Date: 2015-07-16 13:47+0200\n"
734+"POT-Creation-Date: 2015-09-15 13:40+0200\n"
735 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
736 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
737 "Language-Team: LANGUAGE <LL@li.org>\n"
738@@ -17,6 +17,100 @@
739 "Content-Type: text/plain; charset=CHARSET\n"
740 "Content-Transfer-Encoding: 8bit\n"
741
742+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:1
743+msgid "The alignment for the dock on the monitor's edge."
744+msgstr ""
745+
746+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:2
747+msgid "fill, start, end, center"
748+msgstr ""
749+
750+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:3
751+msgid "Whether to automatically pin an application if it seems useful to do."
752+msgstr ""
753+
754+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:4
755+msgid "Whether to show only windows of the current workspace."
756+msgstr ""
757+
758+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:5
759+msgid "Array of dockitem-files on this dock. DO NOT MODIFY"
760+msgstr ""
761+
762+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:6
763+msgid "Time (in ms) to wait before hiding the dock."
764+msgstr ""
765+
766+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:7
767+msgid "Hidemode of the dock."
768+msgstr ""
769+
770+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:8
771+msgid "none, intelligent, auto"
772+msgstr ""
773+
774+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:9
775+msgid "The size of dock icons (in pixels)."
776+msgstr ""
777+
778+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:10
779+msgid "The alignment of the items in this dock."
780+msgstr ""
781+
782+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:11
783+msgid "Whether to prevent drag'n'drop actions and lock items on the dock."
784+msgstr ""
785+
786+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:12
787+msgid ""
788+"The plug-name of the monitor for the dock to show on (e.g. DVI-I-1, HDMI1, "
789+"LVDS1). Leave this empty to keep on the primary monitor."
790+msgstr ""
791+
792+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:13
793+msgid "The dock's position offset from center (in percent)."
794+msgstr ""
795+
796+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:14
797+msgid ""
798+"Whether to show only pinned applications. Useful for running more then one "
799+"dock."
800+msgstr ""
801+
802+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:15
803+msgid "The position for the dock on the monitor."
804+msgstr ""
805+
806+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:16
807+msgid "left, right, top, bottom"
808+msgstr ""
809+
810+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:17
811+msgid ""
812+"Whether to use pressure-based revealing of the dock if the support is "
813+"available."
814+msgstr ""
815+
816+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:18
817+msgid "Whether to show the item for the dock itself."
818+msgstr ""
819+
820+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:19
821+msgid "The name of the dock's theme to use."
822+msgstr ""
823+
824+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:20
825+msgid "Time (in ms) to wait before unhiding the dock."
826+msgstr ""
827+
828+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:21
829+msgid "Whether the dock will zoom when hovered."
830+msgstr ""
831+
832+#: ../data/net.launchpad.plank.gschema.xml.in.in.h:22
833+msgid "The dock's icon-zoom (in percent)."
834+msgstr ""
835+
836 #: ../data/plank.appdata.xml.in.h:1
837 msgid ""
838 "Plank is meant to be the simplest dock on the planet. The goal is to provide "
839@@ -176,28 +270,28 @@
840 msgid "Behaviour"
841 msgstr ""
842
843-#: ../lib/Items/ApplicationDockItem.vala:442
844-#: ../lib/Items/FileDockItem.vala:326 ../lib/Items/FileDockItem.vala:344
845+#: ../lib/Items/ApplicationDockItem.vala:454
846+#: ../lib/Items/FileDockItem.vala:328 ../lib/Items/FileDockItem.vala:346
847 msgid "_Keep in Dock"
848 msgstr ""
849
850-#: ../lib/Items/ApplicationDockItem.vala:450
851+#: ../lib/Items/ApplicationDockItem.vala:462
852 msgid "_Close All"
853 msgstr ""
854
855-#: ../lib/Items/ApplicationDockItem.vala:450
856+#: ../lib/Items/ApplicationDockItem.vala:462
857 msgid "_Close"
858 msgstr ""
859
860-#: ../lib/Items/FileDockItem.vala:331
861+#: ../lib/Items/FileDockItem.vala:333
862 msgid "_Open in File Browser"
863 msgstr ""
864
865-#: ../lib/Items/FileDockItem.vala:349
866+#: ../lib/Items/FileDockItem.vala:351
867 msgid "_Open"
868 msgstr ""
869
870-#: ../lib/Items/FileDockItem.vala:353
871+#: ../lib/Items/FileDockItem.vala:355
872 msgid "Open Containing _Folder"
873 msgstr ""
874
875
876=== modified file 'tests/Controller.vala'
877--- tests/Controller.vala 2015-05-17 11:04:46 +0000
878+++ tests/Controller.vala 2015-11-02 13:45:34 +0000
879@@ -59,7 +59,7 @@
880 provider.add (item);
881 assert (item.ref_count > 1);
882
883- controller = new DockController (config_folder);
884+ controller = new DockController (TEST_DOCK_NAME, config_folder);
885 controller.add (provider);
886 controller.initialize ();
887
888@@ -88,7 +88,7 @@
889 DockController controller;
890
891 File config_folder = Paths.AppConfigFolder.get_child (TEST_DOCK_NAME);
892- controller = new DockController (config_folder);
893+ controller = new DockController (TEST_DOCK_NAME, config_folder);
894 controller.initialize ();
895 }
896
897
898=== modified file 'tests/Makefile.am'
899--- tests/Makefile.am 2015-10-19 12:16:04 +0000
900+++ tests/Makefile.am 2015-11-02 13:45:34 +0000
901@@ -90,7 +90,7 @@
902 data \
903 $(NULL)
904
905-TESTS_ENVIRONMENT = HOME=$(abs_builddir)/home
906+TESTS_ENVIRONMENT = HOME=$(abs_builddir)/home GSETTINGS_SCHEMA_DIR=$(abs_top_builddir)/data
907
908 if HAVE_HEADLESS_TESTS
909 TESTS_ENVIRONMENT += $(XVFB_RUN) --auto-servernum --server-args="-screen 0 1280x1024x24" $(DBUS_LAUNCH)
910
911=== modified file 'tests/Widgets.vala'
912--- tests/Widgets.vala 2015-04-27 13:39:02 +0000
913+++ tests/Widgets.vala 2015-11-02 13:45:34 +0000
914@@ -106,7 +106,7 @@
915 PreferencesWindow window;
916 DockPreferences prefs;
917
918- prefs = new DockPreferences ();
919+ prefs = new DockPreferences ("test");
920 window = new PreferencesWindow (prefs);
921 window.show ();
922

Subscribers

People subscribed via source and target branches

to status/vote changes: