Merge lp:~muktupavels/compiz/gwd-remove-settings-writable into lp:compiz/0.9.12
- gwd-remove-settings-writable
- Merge into 0.9.12
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | 4045 |
Merged at revision: | 4035 |
Proposed branch: | lp:~muktupavels/compiz/gwd-remove-settings-writable |
Merge into: | lp:compiz/0.9.12 |
Prerequisite: | lp:~muktupavels/compiz/gwd-remove-global-button-layout-variables |
Diff against target: |
2788 lines (+533/-1641) 17 files modified
gtk/window-decorator/CMakeLists.txt (+0/-4) gtk/window-decorator/gtk-window-decorator.c (+7/-13) gtk/window-decorator/gtk-window-decorator.h (+1/-2) gtk/window-decorator/gwd-fwd.h (+0/-1) gtk/window-decorator/gwd-settings-storage.c (+32/-33) gtk/window-decorator/gwd-settings-storage.h (+30/-30) gtk/window-decorator/gwd-settings-writable-interface.c (+0/-137) gtk/window-decorator/gwd-settings-writable-interface.h (+0/-138) gtk/window-decorator/gwd-settings-xproperty-storage.c (+28/-29) gtk/window-decorator/gwd-settings-xproperty-storage.h (+2/-1) gtk/window-decorator/gwd-settings.c (+268/-373) gtk/window-decorator/gwd-settings.h (+67/-11) gtk/window-decorator/settings.c (+3/-4) gtk/window-decorator/tests/CMakeLists.txt (+1/-8) gtk/window-decorator/tests/compiz_gwd_mock_settings_writable.cpp (+0/-278) gtk/window-decorator/tests/compiz_gwd_mock_settings_writable.h (+0/-104) gtk/window-decorator/tests/test_gwd_settings.cpp (+94/-475) |
To merge this branch: | bzr merge lp:~muktupavels/compiz/gwd-remove-settings-writable |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sam Spilsbury | Approve | ||
Review via email: mp+295245@code.launchpad.net |
Commit message
Remove GWDSettingsWrit
Description of the change
Remove GWDSettingsWrit
- 4040. By Alberts Muktupāvels
-
Remove now unused code from tests.
- 4041. By Alberts Muktupāvels
-
Remove also files...
Sam Spilsbury (smspillaz) wrote : | # |
- 4042. By Alberts Muktupāvels
-
Merge changes from lp:~albertsmuktupavels/compiz/gwd-remove-global-button-layout-variables.
- 4043. By Alberts Muktupāvels
-
Add space in gwd-settings-
storage. h. - 4044. By Alberts Muktupāvels
-
Tests: re-align parameters.
Alberts Muktupāvels (muktupavels) wrote : | # |
"Any reason to change this to -1?"
It is needed to know if blur type was set from command-line.
Branch updated.
Sam Spilsbury (smspillaz) wrote : | # |
> "Any reason to change this to -1?"
> It is needed to know if blur type was set from command-line.
>
> Branch updated.
Perhaps a constant is worth using then - something like const gint BLUR_TYPE_UNSET;
- 4045. By Alberts Muktupāvels
-
Add BLUR_TYPE_UNSET.
Alberts Muktupāvels (muktupavels) wrote : | # |
> > "Any reason to change this to -1?"
> > It is needed to know if blur type was set from command-line.
> >
> > Branch updated.
>
> Perhaps a constant is worth using then - something like const gint
> BLUR_TYPE_UNSET;
Ok, updated. Anything else?
Preview Diff
1 | === modified file 'gtk/window-decorator/CMakeLists.txt' |
2 | --- gtk/window-decorator/CMakeLists.txt 2016-05-21 09:47:09 +0000 |
3 | +++ gtk/window-decorator/CMakeLists.txt 2016-05-21 09:47:09 +0000 |
4 | @@ -32,11 +32,7 @@ |
5 | add_library (gtk_window_decorator_settings STATIC |
6 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings.c) |
7 | |
8 | - add_library (gtk_window_decorator_settings_writable_interface STATIC |
9 | - ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings-writable-interface.c) |
10 | - |
11 | set (GTK_WINDOW_DECORATOR_ADDITIONAL_LIBRARIES |
12 | - gtk_window_decorator_settings_writable_interface |
13 | gtk_window_decorator_settings |
14 | gtk_window_decorator_metacity_window_decoration_util |
15 | gtk_window_decorator_cairo_window_decoration_util) |
16 | |
17 | === modified file 'gtk/window-decorator/gtk-window-decorator.c' |
18 | --- gtk/window-decorator/gtk-window-decorator.c 2016-05-21 09:47:09 +0000 |
19 | +++ gtk/window-decorator/gtk-window-decorator.c 2016-05-21 09:47:09 +0000 |
20 | @@ -25,10 +25,8 @@ |
21 | |
22 | #include "gtk-window-decorator.h" |
23 | #include "gwd-metacity-window-decoration-util.h" |
24 | -#include "gwd-settings-writable-interface.h" |
25 | #include "gwd-settings.h" |
26 | |
27 | -GWDSettingsWritable *writable; |
28 | GWDSettings *settings; |
29 | GWDTheme *gwd_theme; |
30 | |
31 | @@ -195,7 +193,7 @@ |
32 | decor_frame_t *bare_p, *switcher_p; |
33 | |
34 | const char *option_meta_theme = NULL; |
35 | - gint option_blur_type = 0; |
36 | + gint option_blur_type = BLUR_TYPE_UNSET; |
37 | |
38 | program_name = argv[0]; |
39 | |
40 | @@ -324,14 +322,11 @@ |
41 | |
42 | initialize_decorations (); |
43 | |
44 | - writable = GWD_SETTINGS_WRITABLE_INTERFACE (gwd_settings_new (option_blur_type != BLUR_TYPE_NONE ? &option_blur_type : NULL, |
45 | - option_meta_theme ? &option_meta_theme : NULL)); |
46 | + settings = gwd_settings_new (option_blur_type, option_meta_theme); |
47 | |
48 | - if (!writable) |
49 | + if (!settings) |
50 | return 1; |
51 | |
52 | - settings = GWD_SETTINGS (writable); |
53 | - |
54 | g_signal_connect (settings, "update-decorations", |
55 | G_CALLBACK (update_decorations_cb), NULL); |
56 | g_signal_connect (settings, "update-frames", |
57 | @@ -339,9 +334,9 @@ |
58 | g_signal_connect (settings, "update-metacity-theme", |
59 | G_CALLBACK (update_metacity_theme_cb), NULL); |
60 | |
61 | - gwd_settings_writable_freeze_updates (writable); |
62 | + gwd_settings_freeze_updates (settings); |
63 | |
64 | - init_settings (writable); |
65 | + init_settings (settings); |
66 | |
67 | for (i = 0; i < 3; ++i) |
68 | { |
69 | @@ -360,9 +355,8 @@ |
70 | |
71 | if (!create_tooltip_window ()) |
72 | { |
73 | - g_object_unref (writable); |
74 | + g_object_unref (settings); |
75 | |
76 | - free (settings); |
77 | fprintf (stderr, "%s, Couldn't create tooltip window\n", argv[0]); |
78 | return 1; |
79 | } |
80 | @@ -410,7 +404,7 @@ |
81 | WINDOW_DECORATION_TYPE_WINDOW); |
82 | |
83 | /* Update the decorations based on the settings */ |
84 | - gwd_settings_writable_thaw_updates (writable); |
85 | + gwd_settings_thaw_updates (settings); |
86 | |
87 | /* Keep the default, bare and switcher decorations around |
88 | * since otherwise they will be spuriously recreated */ |
89 | |
90 | === modified file 'gtk/window-decorator/gtk-window-decorator.h' |
91 | --- gtk/window-decorator/gtk-window-decorator.h 2016-05-21 09:47:09 +0000 |
92 | +++ gtk/window-decorator/gtk-window-decorator.h 2016-05-21 09:47:09 +0000 |
93 | @@ -102,7 +102,6 @@ |
94 | extern gboolean minimal; |
95 | |
96 | extern GWDSettings *settings; |
97 | -extern GWDSettingsWritable *writable; |
98 | |
99 | extern GWDTheme *gwd_theme; |
100 | |
101 | @@ -742,7 +741,7 @@ |
102 | gpointer user_data); |
103 | |
104 | void |
105 | -init_settings (GWDSettingsWritable *writable); |
106 | +init_settings (GWDSettings *settings); |
107 | |
108 | void |
109 | fini_settings (); |
110 | |
111 | === modified file 'gtk/window-decorator/gwd-fwd.h' |
112 | --- gtk/window-decorator/gwd-fwd.h 2016-05-21 09:47:09 +0000 |
113 | +++ gtk/window-decorator/gwd-fwd.h 2016-05-21 09:47:09 +0000 |
114 | @@ -25,7 +25,6 @@ |
115 | G_BEGIN_DECLS |
116 | |
117 | typedef struct _GWDSettings GWDSettings; |
118 | -typedef struct _GWDSettingsWritable GWDSettingsWritable; |
119 | typedef struct _GWDSettingsStorage GWDSettingsStorage; |
120 | typedef struct _GWDSettingsXPropertyStorage GWDSettingsXPropertyStorage; |
121 | |
122 | |
123 | === modified file 'gtk/window-decorator/gwd-settings-storage.c' |
124 | --- gtk/window-decorator/gwd-settings-storage.c 2016-05-21 09:47:09 +0000 |
125 | +++ gtk/window-decorator/gwd-settings-storage.c 2016-05-21 09:47:09 +0000 |
126 | @@ -24,7 +24,7 @@ |
127 | |
128 | #include <string.h> |
129 | |
130 | -#include "gwd-settings-writable-interface.h" |
131 | +#include "gwd-settings.h" |
132 | #include "gwd-settings-storage.h" |
133 | |
134 | const gchar * ORG_COMPIZ_GWD = "org.compiz.gwd"; |
135 | @@ -58,24 +58,24 @@ |
136 | |
137 | struct _GWDSettingsStorage |
138 | { |
139 | - GObject parent; |
140 | - |
141 | - GWDSettingsWritable *writable; |
142 | - gboolean connect; |
143 | - |
144 | - GSettings *gwd; |
145 | - GSettings *desktop; |
146 | - GSettings *metacity; |
147 | - GSettings *marco; |
148 | - |
149 | - gboolean is_mate_desktop; |
150 | + GObject parent; |
151 | + |
152 | + GWDSettings *settings; |
153 | + gboolean connect; |
154 | + |
155 | + GSettings *gwd; |
156 | + GSettings *desktop; |
157 | + GSettings *metacity; |
158 | + GSettings *marco; |
159 | + |
160 | + gboolean is_mate_desktop; |
161 | }; |
162 | |
163 | enum |
164 | { |
165 | PROP_0, |
166 | |
167 | - PROP_WRITABLE, |
168 | + PROP_SETTINGS, |
169 | PROP_CONNECT, |
170 | |
171 | LAST_PROP |
172 | @@ -221,7 +221,7 @@ |
173 | |
174 | storage = GWD_SETTINGS_STORAGE (object); |
175 | |
176 | - g_clear_object (&storage->writable); |
177 | + g_clear_object (&storage->settings); |
178 | |
179 | g_clear_object (&storage->gwd); |
180 | g_clear_object (&storage->desktop); |
181 | @@ -242,8 +242,8 @@ |
182 | storage = GWD_SETTINGS_STORAGE (object); |
183 | |
184 | switch (property_id) { |
185 | - case PROP_WRITABLE: |
186 | - storage->writable = g_value_dup_object (value); |
187 | + case PROP_SETTINGS: |
188 | + storage->settings = g_value_dup_object (value); |
189 | break; |
190 | |
191 | case PROP_CONNECT: |
192 | @@ -267,10 +267,9 @@ |
193 | object_class->dispose = gwd_settings_storage_dispose; |
194 | object_class->set_property = gwd_settings_storage_set_property; |
195 | |
196 | - storage_properties[PROP_WRITABLE] = |
197 | - g_param_spec_object ("writable", "GWDWritableSettings", |
198 | - "A GWDWritableSettings object", |
199 | - GWD_TYPE_WRITABLE_SETTINGS_INTERFACE, |
200 | + storage_properties[PROP_SETTINGS] = |
201 | + g_param_spec_object ("settings", "GWDSettings", "GWDSettings", |
202 | + GWD_TYPE_SETTINGS, |
203 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | |
204 | G_PARAM_STATIC_STRINGS); |
205 | |
206 | @@ -316,11 +315,11 @@ |
207 | } |
208 | |
209 | GWDSettingsStorage * |
210 | -gwd_settings_storage_new (GWDSettingsWritable *writable, |
211 | - gboolean connect) |
212 | +gwd_settings_storage_new (GWDSettings *settings, |
213 | + gboolean connect) |
214 | { |
215 | return g_object_new (GWD_TYPE_SETTINGS_STORAGE, |
216 | - "writable", writable, |
217 | + "settings", settings, |
218 | "connect", connect, |
219 | NULL); |
220 | } |
221 | @@ -335,7 +334,7 @@ |
222 | |
223 | use_tooltips = g_settings_get_boolean (storage->gwd, ORG_COMPIZ_GWD_KEY_USE_TOOLTIPS); |
224 | |
225 | - return gwd_settings_writable_use_tooltips_changed (storage->writable, use_tooltips); |
226 | + return gwd_settings_use_tooltips_changed (storage->settings, use_tooltips); |
227 | } |
228 | |
229 | gboolean |
230 | @@ -348,7 +347,7 @@ |
231 | return FALSE; |
232 | |
233 | blur_type = g_settings_get_string (storage->gwd, ORG_COMPIZ_GWD_KEY_BLUR_TYPE); |
234 | - retval = gwd_settings_writable_blur_changed (storage->writable, blur_type); |
235 | + retval = gwd_settings_blur_changed (storage->settings, blur_type); |
236 | g_free (blur_type); |
237 | |
238 | return retval; |
239 | @@ -373,7 +372,7 @@ |
240 | else |
241 | return FALSE; |
242 | |
243 | - retval = gwd_settings_writable_metacity_theme_changed (storage->writable, use_metacity_theme, theme); |
244 | + retval = gwd_settings_metacity_theme_changed (storage->settings, use_metacity_theme, theme); |
245 | g_free (theme); |
246 | |
247 | return retval; |
248 | @@ -395,8 +394,8 @@ |
249 | active_shade = g_settings_get_boolean (storage->gwd, ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_SHADE_OPACITY); |
250 | inactive_shade = g_settings_get_boolean (storage->gwd, ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_SHADE_OPACITY); |
251 | |
252 | - return gwd_settings_writable_opacity_changed (storage->writable, active, inactive, |
253 | - active_shade, inactive_shade); |
254 | + return gwd_settings_opacity_changed (storage->settings, active, inactive, |
255 | + active_shade, inactive_shade); |
256 | } |
257 | |
258 | gboolean |
259 | @@ -412,7 +411,7 @@ |
260 | else |
261 | return FALSE; |
262 | |
263 | - retval = gwd_settings_writable_button_layout_changed (storage->writable, button_layout); |
264 | + retval = gwd_settings_button_layout_changed (storage->settings, button_layout); |
265 | g_free (button_layout); |
266 | |
267 | return retval; |
268 | @@ -434,7 +433,7 @@ |
269 | } else |
270 | return FALSE; |
271 | |
272 | - retval = gwd_settings_writable_font_changed (storage->writable, titlebar_system_font, titlebar_font); |
273 | + retval = gwd_settings_font_changed (storage->settings, titlebar_system_font, titlebar_font); |
274 | g_free (titlebar_font); |
275 | |
276 | return retval; |
277 | @@ -469,9 +468,9 @@ |
278 | |
279 | mouse_wheel_action = g_settings_get_string (storage->gwd, ORG_COMPIZ_GWD_KEY_MOUSE_WHEEL_ACTION); |
280 | |
281 | - retval = gwd_settings_writable_titlebar_actions_changed (storage->writable, double_click_action, |
282 | - middle_click_action, right_click_action, |
283 | - mouse_wheel_action); |
284 | + retval = gwd_settings_titlebar_actions_changed (storage->settings, double_click_action, |
285 | + middle_click_action, right_click_action, |
286 | + mouse_wheel_action); |
287 | |
288 | g_free (double_click_action); |
289 | g_free (middle_click_action); |
290 | |
291 | === modified file 'gtk/window-decorator/gwd-settings-storage.h' |
292 | --- gtk/window-decorator/gwd-settings-storage.h 2016-05-21 09:47:09 +0000 |
293 | +++ gtk/window-decorator/gwd-settings-storage.h 2016-05-21 09:47:09 +0000 |
294 | @@ -60,41 +60,41 @@ |
295 | GWD, SETTINGS_STORAGE, GObject) |
296 | |
297 | GWDSettingsStorage * |
298 | -gwd_settings_storage_new (GWDSettingsWritable *writable, |
299 | - gboolean connect); |
300 | - |
301 | -gboolean |
302 | -gwd_settings_storage_update_use_tooltips (GWDSettingsStorage *storage); |
303 | - |
304 | -gboolean |
305 | -gwd_settings_storage_update_blur (GWDSettingsStorage *storage); |
306 | - |
307 | -gboolean |
308 | -gwd_settings_storage_update_metacity_theme (GWDSettingsStorage *storage); |
309 | - |
310 | -gboolean |
311 | -gwd_settings_storage_update_opacity (GWDSettingsStorage *storage); |
312 | - |
313 | -gboolean |
314 | -gwd_settings_storage_update_button_layout (GWDSettingsStorage *storage); |
315 | - |
316 | -gboolean |
317 | -gwd_settings_storage_update_font (GWDSettingsStorage *storage); |
318 | +gwd_settings_storage_new (GWDSettings *settings, |
319 | + gboolean connect); |
320 | + |
321 | +gboolean |
322 | +gwd_settings_storage_update_use_tooltips (GWDSettingsStorage *storage); |
323 | + |
324 | +gboolean |
325 | +gwd_settings_storage_update_blur (GWDSettingsStorage *storage); |
326 | + |
327 | +gboolean |
328 | +gwd_settings_storage_update_metacity_theme (GWDSettingsStorage *storage); |
329 | + |
330 | +gboolean |
331 | +gwd_settings_storage_update_opacity (GWDSettingsStorage *storage); |
332 | + |
333 | +gboolean |
334 | +gwd_settings_storage_update_button_layout (GWDSettingsStorage *storage); |
335 | + |
336 | +gboolean |
337 | +gwd_settings_storage_update_font (GWDSettingsStorage *storage); |
338 | |
339 | gboolean |
340 | gwd_settings_storage_update_titlebar_actions (GWDSettingsStorage *storage); |
341 | |
342 | GSettings * |
343 | -gwd_get_org_compiz_gwd_settings (GWDSettingsStorage *storage); |
344 | - |
345 | -GSettings * |
346 | -gwd_get_org_gnome_desktop_wm_preferences_settings (GWDSettingsStorage *storage); |
347 | - |
348 | -GSettings * |
349 | -gwd_get_org_gnome_metacity_settings (GWDSettingsStorage *storage); |
350 | - |
351 | -GSettings * |
352 | -gwd_get_org_mate_marco_general_settings (GWDSettingsStorage *storage); |
353 | +gwd_get_org_compiz_gwd_settings (GWDSettingsStorage *storage); |
354 | + |
355 | +GSettings * |
356 | +gwd_get_org_gnome_desktop_wm_preferences_settings (GWDSettingsStorage *storage); |
357 | + |
358 | +GSettings * |
359 | +gwd_get_org_gnome_metacity_settings (GWDSettingsStorage *storage); |
360 | + |
361 | +GSettings * |
362 | +gwd_get_org_mate_marco_general_settings (GWDSettingsStorage *storage); |
363 | |
364 | G_END_DECLS |
365 | |
366 | |
367 | === removed file 'gtk/window-decorator/gwd-settings-writable-interface.c' |
368 | --- gtk/window-decorator/gwd-settings-writable-interface.c 2016-02-22 12:27:13 +0000 |
369 | +++ gtk/window-decorator/gwd-settings-writable-interface.c 1970-01-01 00:00:00 +0000 |
370 | @@ -1,137 +0,0 @@ |
371 | -/* |
372 | - * Copyright © 2012 Canonical Ltd |
373 | - * |
374 | - * This program is free software; you can redistribute it and/or modify |
375 | - * it under the terms of the GNU General Public License as published by |
376 | - * the Free Software Foundation; either version 2 of the License, or |
377 | - * (at your option) any later version. |
378 | - * |
379 | - * This program is distributed in the hope that it will be useful, |
380 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
381 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
382 | - * GNU General Public License for more details. |
383 | - * |
384 | - * You should have received a copy of the GNU General Public License |
385 | - * along with this program; if not, write to the Free Software Foundation, |
386 | - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
387 | - * |
388 | - * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
389 | - */ |
390 | -#include "gwd-settings-writable-interface.h" |
391 | - |
392 | -static void gwd_settings_writable_interface_default_init (GWDSettingsWritableInterface *settings_interface); |
393 | - |
394 | -G_DEFINE_INTERFACE (GWDSettingsWritable, gwd_settings_writable_interface, G_TYPE_OBJECT); |
395 | - |
396 | -static void gwd_settings_writable_interface_default_init (GWDSettingsWritableInterface *settings_interface) |
397 | -{ |
398 | -} |
399 | - |
400 | -void |
401 | -gwd_settings_writable_freeze_updates (GWDSettingsWritable *settings) |
402 | -{ |
403 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
404 | - (*iface->freeze_updates) (settings); |
405 | -} |
406 | - |
407 | -void |
408 | -gwd_settings_writable_thaw_updates (GWDSettingsWritable *settings) |
409 | -{ |
410 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
411 | - (*iface->thaw_updates) (settings); |
412 | -} |
413 | - |
414 | -gboolean |
415 | -gwd_settings_writable_shadow_property_changed (GWDSettingsWritable *settings, |
416 | - gdouble active_shadow_radius, |
417 | - gdouble active_shadow_opacity, |
418 | - gdouble active_shadow_offset_x, |
419 | - gdouble active_shadow_offset_y, |
420 | - const gchar *active_shadow_color, |
421 | - gdouble inactive_shadow_radius, |
422 | - gdouble inactive_shadow_opacity, |
423 | - gdouble inactive_shadow_offset_x, |
424 | - gdouble inactive_shadow_offset_y, |
425 | - const gchar *inactive_shadow_color) |
426 | -{ |
427 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
428 | - return (*iface->shadow_property_changed) (settings, |
429 | - active_shadow_radius, |
430 | - active_shadow_opacity, |
431 | - active_shadow_offset_x, |
432 | - active_shadow_offset_y, |
433 | - active_shadow_color, |
434 | - inactive_shadow_radius, |
435 | - inactive_shadow_opacity, |
436 | - inactive_shadow_offset_x, |
437 | - inactive_shadow_offset_y, |
438 | - inactive_shadow_color); |
439 | -} |
440 | - |
441 | -gboolean |
442 | -gwd_settings_writable_use_tooltips_changed (GWDSettingsWritable *settings, |
443 | - gboolean use_tooltips) |
444 | -{ |
445 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
446 | - return (*iface->use_tooltips_changed) (settings, use_tooltips); |
447 | -} |
448 | - |
449 | -gboolean |
450 | -gwd_settings_writable_blur_changed (GWDSettingsWritable *settings, |
451 | - const gchar *blur_type) |
452 | -{ |
453 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
454 | - return (*iface->blur_changed) (settings, blur_type); |
455 | -} |
456 | - |
457 | -gboolean |
458 | -gwd_settings_writable_metacity_theme_changed (GWDSettingsWritable *settings, |
459 | - gboolean use_metacity_theme, |
460 | - const gchar *metacity_theme) |
461 | -{ |
462 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
463 | - return (*iface->metacity_theme_changed) (settings, use_metacity_theme, metacity_theme); |
464 | -} |
465 | - |
466 | -gboolean |
467 | -gwd_settings_writable_opacity_changed (GWDSettingsWritable *settings, |
468 | - gdouble active_opacity, |
469 | - gdouble inactive_opacity, |
470 | - gboolean active_shade_opacity, |
471 | - gboolean inactive_shade_opacity) |
472 | -{ |
473 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
474 | - return (*iface->opacity_changed) (settings, active_opacity, inactive_opacity, active_shade_opacity, inactive_shade_opacity); |
475 | -} |
476 | - |
477 | -gboolean |
478 | -gwd_settings_writable_button_layout_changed (GWDSettingsWritable *settings, |
479 | - const gchar *button_layout) |
480 | -{ |
481 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
482 | - return (*iface->button_layout_changed) (settings, button_layout); |
483 | -} |
484 | - |
485 | -gboolean |
486 | -gwd_settings_writable_font_changed (GWDSettingsWritable *settings, |
487 | - gboolean titlebar_uses_system_font, |
488 | - const gchar *titlebar_font) |
489 | -{ |
490 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
491 | - return (*iface->font_changed) (settings, titlebar_uses_system_font, titlebar_font); |
492 | -} |
493 | - |
494 | -gboolean |
495 | -gwd_settings_writable_titlebar_actions_changed (GWDSettingsWritable *settings, |
496 | - const gchar *action_double_click_titlebar, |
497 | - const gchar *action_middle_click_titlebar, |
498 | - const gchar *action_right_click_titlebar, |
499 | - const gchar *mouse_wheel_action) |
500 | -{ |
501 | - GWDSettingsWritableInterface *iface = GWD_SETTINGS_WRITABLE_GET_INTERFACE (settings); |
502 | - return (*iface->titlebar_actions_changed) (settings, |
503 | - action_double_click_titlebar, |
504 | - action_middle_click_titlebar, |
505 | - action_right_click_titlebar, |
506 | - mouse_wheel_action); |
507 | -} |
508 | |
509 | === removed file 'gtk/window-decorator/gwd-settings-writable-interface.h' |
510 | --- gtk/window-decorator/gwd-settings-writable-interface.h 2016-02-22 12:27:13 +0000 |
511 | +++ gtk/window-decorator/gwd-settings-writable-interface.h 1970-01-01 00:00:00 +0000 |
512 | @@ -1,138 +0,0 @@ |
513 | -/* |
514 | - * Copyright © 2012 Canonical Ltd |
515 | - * |
516 | - * This program is free software; you can redistribute it and/or modify |
517 | - * it under the terms of the GNU General Public License as published by |
518 | - * the Free Software Foundation; either version 2 of the License, or |
519 | - * (at your option) any later version. |
520 | - * |
521 | - * This program is distributed in the hope that it will be useful, |
522 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
523 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
524 | - * GNU General Public License for more details. |
525 | - * |
526 | - * You should have received a copy of the GNU General Public License |
527 | - * along with this program; if not, write to the Free Software Foundation, |
528 | - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
529 | - * |
530 | - * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
531 | - */ |
532 | -#ifndef _COMPIZ_GWD_SETTINGS_WRITABLE_INTERFACE_H |
533 | -#define _COMPIZ_GWD_SETTINGS_WRITABLE_INTERFACE_H |
534 | - |
535 | -#include <glib-object.h> |
536 | -#include <gwd-fwd.h> |
537 | - |
538 | -G_BEGIN_DECLS |
539 | - |
540 | -#define GWD_SETTINGS_WRITABLE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ |
541 | - GWD_TYPE_WRITABLE_SETTINGS_INTERFACE, \ |
542 | - GWDSettingsWritable)) |
543 | -#define GWD_SETTINGS_WRITABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE (obj, \ |
544 | - GWD_TYPE_WRITABLE_SETTINGS_INTERFACE, \ |
545 | - GWDSettingsWritableInterface)) |
546 | -#define GWD_TYPE_WRITABLE_SETTINGS_INTERFACE (gwd_settings_writable_interface_get_type ()) |
547 | - |
548 | -typedef struct _GWDSettingsWritableInterface GWDSettingsWritableInterface; |
549 | - |
550 | -struct _GWDSettingsWritableInterface |
551 | -{ |
552 | - GTypeInterface parent; |
553 | - |
554 | - void (*freeze_updates) (GWDSettingsWritable *settings); |
555 | - void (*thaw_updates) (GWDSettingsWritable *settings); |
556 | - gboolean (*shadow_property_changed) (GWDSettingsWritable *settings, |
557 | - gdouble active_shadow_radius, |
558 | - gdouble active_shadow_opacity, |
559 | - gdouble active_shadow_offset_x, |
560 | - gdouble active_shadow_offset_y, |
561 | - const gchar *active_shadow_color, |
562 | - gdouble inactive_shadow_radius, |
563 | - gdouble inactive_shadow_opacity, |
564 | - gdouble inactive_shadow_offset_x, |
565 | - gdouble inactive_shadow_offset_y, |
566 | - const gchar *inactive_shadow_color); |
567 | - gboolean (*use_tooltips_changed) (GWDSettingsWritable *settings, |
568 | - gboolean new_value); |
569 | - gboolean (*blur_changed) (GWDSettingsWritable *settings, |
570 | - const gchar *type); |
571 | - gboolean (*metacity_theme_changed) (GWDSettingsWritable *settings, |
572 | - gboolean use_metacity_theme, |
573 | - const gchar *metacity_theme); |
574 | - gboolean (*opacity_changed) (GWDSettingsWritable *settings, |
575 | - gdouble active_opacity, |
576 | - gdouble inactive_opacity, |
577 | - gboolean active_shade_opacity, |
578 | - gboolean inactive_shade_opacity); |
579 | - gboolean (*button_layout_changed) (GWDSettingsWritable *settings, |
580 | - const gchar *button_layout); |
581 | - gboolean (*font_changed) (GWDSettingsWritable *settings, |
582 | - gboolean titlebar_uses_system_font, |
583 | - const gchar *titlebar_font); |
584 | - gboolean (*titlebar_actions_changed) (GWDSettingsWritable *settings, |
585 | - const gchar *action_double_click_titlebar, |
586 | - const gchar *action_middle_click_titlebar, |
587 | - const gchar *action_right_click_titlebar, |
588 | - const gchar *mouse_wheel_action); |
589 | -}; |
590 | - |
591 | -void |
592 | -gwd_settings_writable_freeze_updates (GWDSettingsWritable *settings); |
593 | - |
594 | -void |
595 | -gwd_settings_writable_thaw_updates (GWDSettingsWritable *settings); |
596 | - |
597 | -gboolean |
598 | -gwd_settings_writable_shadow_property_changed (GWDSettingsWritable *settings, |
599 | - gdouble active_shadow_radius, |
600 | - gdouble active_shadow_opacity, |
601 | - gdouble active_shadow_offset_x, |
602 | - gdouble active_shadow_offset_y, |
603 | - const gchar *active_shadow_color, |
604 | - gdouble inactive_shadow_radius, |
605 | - gdouble inactive_shadow_opacity, |
606 | - gdouble inactive_shadow_offset_x, |
607 | - gdouble inactive_shadow_offset_y, |
608 | - const gchar *inactive_shadow_color); |
609 | - |
610 | -gboolean |
611 | -gwd_settings_writable_use_tooltips_changed (GWDSettingsWritable *settings, |
612 | - gboolean use_tooltips); |
613 | - |
614 | -gboolean |
615 | -gwd_settings_writable_blur_changed (GWDSettingsWritable *settings, |
616 | - const gchar *blur_type); |
617 | - |
618 | -gboolean |
619 | -gwd_settings_writable_metacity_theme_changed (GWDSettingsWritable *settings, |
620 | - gboolean use_metacity_theme, |
621 | - const gchar *metacity_theme); |
622 | - |
623 | -gboolean |
624 | -gwd_settings_writable_opacity_changed (GWDSettingsWritable *settings, |
625 | - gdouble active_opacity, |
626 | - gdouble inactive_opacity, |
627 | - gboolean active_shade_opacity, |
628 | - gboolean inactive_shade_opacity); |
629 | - |
630 | -gboolean |
631 | -gwd_settings_writable_button_layout_changed (GWDSettingsWritable *settings, |
632 | - const gchar *button_layout); |
633 | - |
634 | -gboolean |
635 | -gwd_settings_writable_font_changed (GWDSettingsWritable *settings, |
636 | - gboolean titlebar_uses_system_font, |
637 | - const gchar *titlebar_font); |
638 | - |
639 | -gboolean |
640 | -gwd_settings_writable_titlebar_actions_changed (GWDSettingsWritable *settings, |
641 | - const gchar *action_double_click_titlebar, |
642 | - const gchar *action_middle_click_titlebar, |
643 | - const gchar *action_right_click_titlebar, |
644 | - const gchar *mouse_wheel_action); |
645 | - |
646 | -GType gwd_settings_writable_interface_get_type (void); |
647 | - |
648 | -G_END_DECLS |
649 | - |
650 | -#endif |
651 | |
652 | === modified file 'gtk/window-decorator/gwd-settings-xproperty-storage.c' |
653 | --- gtk/window-decorator/gwd-settings-xproperty-storage.c 2016-02-29 15:32:42 +0000 |
654 | +++ gtk/window-decorator/gwd-settings-xproperty-storage.c 2016-05-21 09:47:09 +0000 |
655 | @@ -22,24 +22,24 @@ |
656 | #include <string.h> |
657 | |
658 | #include "gtk-window-decorator.h" |
659 | -#include "gwd-settings-writable-interface.h" |
660 | +#include "gwd-settings.h" |
661 | #include "gwd-settings-xproperty-storage.h" |
662 | |
663 | struct _GWDSettingsXPropertyStorage |
664 | { |
665 | - GObject parent; |
666 | - |
667 | - GWDSettingsWritable *writable; |
668 | - |
669 | - Display *xdpy; |
670 | - Window root; |
671 | + GObject parent; |
672 | + |
673 | + GWDSettings *settings; |
674 | + |
675 | + Display *xdpy; |
676 | + Window root; |
677 | }; |
678 | |
679 | enum |
680 | { |
681 | PROP_0, |
682 | |
683 | - PROP_WRITABLE_SETTINGS, |
684 | + PROP_SETTINGS, |
685 | |
686 | LAST_PROP |
687 | }; |
688 | @@ -56,7 +56,7 @@ |
689 | |
690 | storage = GWD_SETTINGS_XPROPERTY_STORAGE (object); |
691 | |
692 | - g_clear_object (&storage->writable); |
693 | + g_clear_object (&storage->settings); |
694 | |
695 | G_OBJECT_CLASS (gwd_settings_xproperty_storage_parent_class)->dispose (object); |
696 | } |
697 | @@ -72,9 +72,9 @@ |
698 | storage = GWD_SETTINGS_XPROPERTY_STORAGE (object); |
699 | |
700 | switch (property_id) { |
701 | - case PROP_WRITABLE_SETTINGS: |
702 | - g_return_if_fail (!storage->writable); |
703 | - storage->writable = g_value_dup_object (value); |
704 | + case PROP_SETTINGS: |
705 | + g_return_if_fail (!storage->settings); |
706 | + storage->settings = g_value_dup_object (value); |
707 | break; |
708 | |
709 | default: |
710 | @@ -93,10 +93,9 @@ |
711 | object_class->dispose = gwd_settings_xproperty_storage_dispose; |
712 | object_class->set_property = gwd_settings_xproperty_storage_set_property; |
713 | |
714 | - storage_properties[PROP_WRITABLE_SETTINGS] = |
715 | - g_param_spec_object ("writable-settings", "GWDSettingsWritable", |
716 | - "An object that implements GWDSettingsWritable", |
717 | - GWD_TYPE_WRITABLE_SETTINGS_INTERFACE, |
718 | + storage_properties[PROP_SETTINGS] = |
719 | + g_param_spec_object ("settings", "GWDSettings", "GWDSettings", |
720 | + GWD_TYPE_SETTINGS, |
721 | G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | |
722 | G_PARAM_STATIC_STRINGS); |
723 | |
724 | @@ -116,10 +115,10 @@ |
725 | } |
726 | |
727 | GWDSettingsXPropertyStorage * |
728 | -gwd_settings_xproperty_storage_new (GWDSettingsWritable *writable) |
729 | +gwd_settings_xproperty_storage_new (GWDSettings *settings) |
730 | { |
731 | return g_object_new (GWD_TYPE_SETTINGS_XPROPERTY_STORAGE, |
732 | - "writable-settings", writable, |
733 | + "settings", settings, |
734 | NULL); |
735 | } |
736 | |
737 | @@ -201,15 +200,15 @@ |
738 | } |
739 | } |
740 | |
741 | - return gwd_settings_writable_shadow_property_changed (storage->writable, |
742 | - (gdouble) MAX (0.0, MIN (aradius, 48.0)), |
743 | - (gdouble) MAX (0.0, MIN (aopacity, 6.0)), |
744 | - (gdouble) MAX (-16, MIN (ax_off, 16)), |
745 | - (gdouble) MAX (-16, MIN (ay_off, 16)), |
746 | - active_shadow_color, |
747 | - (gdouble) MAX (0.0, MIN (iradius, 48.0)), |
748 | - (gdouble) MAX (0.0, MIN (iopacity, 6.0)), |
749 | - (gdouble) MAX (-16, MIN (ix_off, 16)), |
750 | - (gdouble) MAX (-16, MIN (iy_off, 16)), |
751 | - inactive_shadow_color); |
752 | + return gwd_settings_shadow_property_changed (storage->settings, |
753 | + (gdouble) MAX (0.0, MIN (aradius, 48.0)), |
754 | + (gdouble) MAX (0.0, MIN (aopacity, 6.0)), |
755 | + (gdouble) MAX (-16, MIN (ax_off, 16)), |
756 | + (gdouble) MAX (-16, MIN (ay_off, 16)), |
757 | + active_shadow_color, |
758 | + (gdouble) MAX (0.0, MIN (iradius, 48.0)), |
759 | + (gdouble) MAX (0.0, MIN (iopacity, 6.0)), |
760 | + (gdouble) MAX (-16, MIN (ix_off, 16)), |
761 | + (gdouble) MAX (-16, MIN (iy_off, 16)), |
762 | + inactive_shadow_color); |
763 | } |
764 | |
765 | === modified file 'gtk/window-decorator/gwd-settings-xproperty-storage.h' |
766 | --- gtk/window-decorator/gwd-settings-xproperty-storage.h 2016-02-29 15:32:42 +0000 |
767 | +++ gtk/window-decorator/gwd-settings-xproperty-storage.h 2016-05-21 09:47:09 +0000 |
768 | @@ -22,6 +22,7 @@ |
769 | #define GWD_SETTINGS_XPROPERTY_STORAGE_H |
770 | |
771 | #include <glib-object.h> |
772 | +#include <gwd-fwd.h> |
773 | |
774 | G_BEGIN_DECLS |
775 | |
776 | @@ -30,7 +31,7 @@ |
777 | GWD, SETTINGS_XPROPERTY_STORAGE, GObject) |
778 | |
779 | GWDSettingsXPropertyStorage * |
780 | -gwd_settings_xproperty_storage_new (GWDSettingsWritable *writable); |
781 | +gwd_settings_xproperty_storage_new (GWDSettings *settings); |
782 | |
783 | gboolean |
784 | gwd_settings_xproperty_storage_update_all (GWDSettingsXPropertyStorage *storage); |
785 | |
786 | === modified file 'gtk/window-decorator/gwd-settings.c' |
787 | --- gtk/window-decorator/gwd-settings.c 2016-05-21 09:47:09 +0000 |
788 | +++ gtk/window-decorator/gwd-settings.c 2016-05-21 09:47:09 +0000 |
789 | @@ -26,7 +26,6 @@ |
790 | #include <stdio.h> |
791 | |
792 | #include "gwd-settings.h" |
793 | -#include "gwd-settings-writable-interface.h" |
794 | #include "decoration.h" |
795 | |
796 | const gboolean USE_TOOLTIPS_DEFAULT = FALSE; |
797 | @@ -132,11 +131,7 @@ |
798 | |
799 | static guint settings_signals[LAST_SIGNAL] = { 0 }; |
800 | |
801 | -static void gwd_settings_writable_interface_init (GWDSettingsWritableInterface *interface); |
802 | - |
803 | -G_DEFINE_TYPE_WITH_CODE (GWDSettings, gwd_settings, G_TYPE_OBJECT, |
804 | - G_IMPLEMENT_INTERFACE (GWD_TYPE_WRITABLE_SETTINGS_INTERFACE, |
805 | - gwd_settings_writable_interface_init)) |
806 | +G_DEFINE_TYPE (GWDSettings, gwd_settings, G_TYPE_OBJECT) |
807 | |
808 | static void |
809 | update_decorations (GWDSettings *settings) |
810 | @@ -200,229 +195,6 @@ |
811 | settings->notify_funcs = NULL; |
812 | } |
813 | |
814 | -gboolean |
815 | -gwd_settings_shadow_property_changed (GWDSettingsWritable *writable, |
816 | - gdouble active_shadow_radius, |
817 | - gdouble active_shadow_opacity, |
818 | - gdouble active_shadow_offset_x, |
819 | - gdouble active_shadow_offset_y, |
820 | - const gchar *active_shadow_color, |
821 | - gdouble inactive_shadow_radius, |
822 | - gdouble inactive_shadow_opacity, |
823 | - gdouble inactive_shadow_offset_x, |
824 | - gdouble inactive_shadow_offset_y, |
825 | - const gchar *inactive_shadow_color) |
826 | -{ |
827 | - GWDSettings *settings = GWD_SETTINGS (writable); |
828 | - |
829 | - decor_shadow_options_t active_shadow, inactive_shadow; |
830 | - unsigned int c[4]; |
831 | - gboolean changed = FALSE; |
832 | - |
833 | - active_shadow.shadow_radius = active_shadow_radius; |
834 | - active_shadow.shadow_opacity = active_shadow_opacity; |
835 | - active_shadow.shadow_offset_x = active_shadow_offset_x; |
836 | - active_shadow.shadow_offset_y = active_shadow_offset_y; |
837 | - |
838 | - if (sscanf (active_shadow_color, "#%2x%2x%2x%2x", |
839 | - &c[0], &c[1], &c[2], &c[3]) == 4) { |
840 | - active_shadow.shadow_color[0] = c[0] << 8 | c[0]; |
841 | - active_shadow.shadow_color[1] = c[1] << 8 | c[1]; |
842 | - active_shadow.shadow_color[2] = c[2] << 8 | c[2]; |
843 | - } else { |
844 | - return FALSE; |
845 | - } |
846 | - |
847 | - if (sscanf (inactive_shadow_color, "#%2x%2x%2x%2x", |
848 | - &c[0], &c[1], &c[2], &c[3]) == 4) { |
849 | - inactive_shadow.shadow_color[0] = c[0] << 8 | c[0]; |
850 | - inactive_shadow.shadow_color[1] = c[1] << 8 | c[1]; |
851 | - inactive_shadow.shadow_color[2] = c[2] << 8 | c[2]; |
852 | - } else { |
853 | - return FALSE; |
854 | - } |
855 | - |
856 | - inactive_shadow.shadow_radius = inactive_shadow_radius; |
857 | - inactive_shadow.shadow_opacity = inactive_shadow_opacity; |
858 | - inactive_shadow.shadow_offset_x = inactive_shadow_offset_x; |
859 | - inactive_shadow.shadow_offset_y = inactive_shadow_offset_y; |
860 | - |
861 | - if (decor_shadow_options_cmp (&settings->inactive_shadow, &inactive_shadow)) { |
862 | - changed |= TRUE; |
863 | - settings->inactive_shadow = inactive_shadow; |
864 | - } |
865 | - |
866 | - if (decor_shadow_options_cmp (&settings->active_shadow, &active_shadow)) { |
867 | - changed |= TRUE; |
868 | - settings->active_shadow = active_shadow; |
869 | - } |
870 | - |
871 | - if (changed) { |
872 | - append_to_notify_funcs (settings, update_decorations); |
873 | - release_notify_funcs (settings); |
874 | - } |
875 | - |
876 | - return changed; |
877 | -} |
878 | - |
879 | -static gboolean |
880 | -gwd_settings_use_tooltips_changed (GWDSettingsWritable *writable, |
881 | - gboolean use_tooltips) |
882 | -{ |
883 | - GWDSettings *settings = GWD_SETTINGS (writable); |
884 | - |
885 | - if (settings->use_tooltips == use_tooltips) |
886 | - return FALSE; |
887 | - |
888 | - settings->use_tooltips = use_tooltips; |
889 | - |
890 | - append_to_notify_funcs (settings, update_decorations); |
891 | - release_notify_funcs (settings); |
892 | - |
893 | - return TRUE; |
894 | -} |
895 | - |
896 | -static gboolean |
897 | -gwd_settings_blur_changed (GWDSettingsWritable *writable, |
898 | - const gchar *type) |
899 | - |
900 | -{ |
901 | - GWDSettings *settings = GWD_SETTINGS (writable); |
902 | - gint new_type = -1; |
903 | - |
904 | - if (settings->cmdline_opts & CMDLINE_BLUR) |
905 | - return FALSE; |
906 | - |
907 | - if (strcmp (type, "titlebar") == 0) |
908 | - new_type = BLUR_TYPE_TITLEBAR; |
909 | - else if (strcmp (type, "all") == 0) |
910 | - new_type = BLUR_TYPE_ALL; |
911 | - else if (strcmp (type, "none") == 0) |
912 | - new_type = BLUR_TYPE_NONE; |
913 | - |
914 | - if (new_type == -1) |
915 | - return FALSE; |
916 | - |
917 | - if (settings->blur_type == new_type) |
918 | - return FALSE; |
919 | - |
920 | - settings->blur_type = new_type; |
921 | - |
922 | - append_to_notify_funcs (settings, update_decorations); |
923 | - release_notify_funcs (settings); |
924 | - |
925 | - return TRUE; |
926 | -} |
927 | - |
928 | -static gboolean |
929 | -gwd_settings_metacity_theme_changed (GWDSettingsWritable *writable, |
930 | - gboolean use_metacity_theme, |
931 | - const gchar *metacity_theme) |
932 | -{ |
933 | - GWDSettings *settings = GWD_SETTINGS (writable); |
934 | - |
935 | - if (settings->cmdline_opts & CMDLINE_THEME) |
936 | - return FALSE; |
937 | - |
938 | - if (!metacity_theme) |
939 | - return FALSE; |
940 | - |
941 | - if (use_metacity_theme) { |
942 | - if (g_strcmp0 (metacity_theme, settings->metacity_theme) == 0) |
943 | - return FALSE; |
944 | - |
945 | - g_free (settings->metacity_theme); |
946 | - settings->metacity_theme = g_strdup (metacity_theme); |
947 | - } else { |
948 | - g_free (settings->metacity_theme); |
949 | - settings->metacity_theme = g_strdup (""); |
950 | - } |
951 | - |
952 | - append_to_notify_funcs (settings, update_metacity_theme); |
953 | - append_to_notify_funcs (settings, update_decorations); |
954 | - release_notify_funcs (settings); |
955 | - |
956 | - return TRUE; |
957 | -} |
958 | - |
959 | -static gboolean |
960 | -gwd_settings_opacity_changed (GWDSettingsWritable *writable, |
961 | - gdouble active_opacity, |
962 | - gdouble inactive_opacity, |
963 | - gboolean active_shade_opacity, |
964 | - gboolean inactive_shade_opacity) |
965 | -{ |
966 | - GWDSettings *settings = GWD_SETTINGS (writable); |
967 | - |
968 | - if (settings->metacity_active_opacity == active_opacity && |
969 | - settings->metacity_inactive_opacity == inactive_opacity && |
970 | - settings->metacity_active_shade_opacity == active_shade_opacity && |
971 | - settings->metacity_inactive_shade_opacity == inactive_shade_opacity) |
972 | - return FALSE; |
973 | - |
974 | - settings->metacity_active_opacity = active_opacity; |
975 | - settings->metacity_inactive_opacity = inactive_opacity; |
976 | - settings->metacity_active_shade_opacity = active_shade_opacity; |
977 | - settings->metacity_inactive_shade_opacity = inactive_shade_opacity; |
978 | - |
979 | - append_to_notify_funcs (settings, update_decorations); |
980 | - release_notify_funcs (settings); |
981 | - |
982 | - return TRUE; |
983 | -} |
984 | - |
985 | -static gboolean |
986 | -gwd_settings_button_layout_changed (GWDSettingsWritable *writable, |
987 | - const gchar *button_layout) |
988 | -{ |
989 | - GWDSettings *settings = GWD_SETTINGS (writable); |
990 | - |
991 | - if (!button_layout) |
992 | - return FALSE; |
993 | - |
994 | - if (g_strcmp0 (settings->metacity_button_layout, button_layout) == 0) |
995 | - return FALSE; |
996 | - |
997 | - g_free (settings->metacity_button_layout); |
998 | - settings->metacity_button_layout = g_strdup (button_layout); |
999 | - |
1000 | - append_to_notify_funcs (settings, update_metacity_button_layout); |
1001 | - append_to_notify_funcs (settings, update_decorations); |
1002 | - release_notify_funcs (settings); |
1003 | - |
1004 | - return TRUE; |
1005 | -} |
1006 | - |
1007 | -static gboolean |
1008 | -gwd_settings_font_changed (GWDSettingsWritable *writable, |
1009 | - gboolean titlebar_uses_system_font, |
1010 | - const gchar *titlebar_font) |
1011 | -{ |
1012 | - GWDSettings *settings = GWD_SETTINGS (writable); |
1013 | - const gchar *no_font = NULL; |
1014 | - const gchar *use_font = NULL; |
1015 | - |
1016 | - if (!titlebar_font) |
1017 | - return FALSE; |
1018 | - |
1019 | - if (titlebar_uses_system_font) |
1020 | - use_font = no_font; |
1021 | - else |
1022 | - use_font = titlebar_font; |
1023 | - |
1024 | - if (g_strcmp0 (settings->titlebar_font, use_font) == 0) |
1025 | - return FALSE; |
1026 | - |
1027 | - g_free (settings->titlebar_font); |
1028 | - settings->titlebar_font = use_font ? g_strdup (use_font) : NULL; |
1029 | - |
1030 | - append_to_notify_funcs (settings, update_decorations); |
1031 | - append_to_notify_funcs (settings, update_frames); |
1032 | - release_notify_funcs (settings); |
1033 | - |
1034 | - return TRUE; |
1035 | -} |
1036 | - |
1037 | static gboolean |
1038 | get_click_action_value (const gchar *action, |
1039 | gint *action_value, |
1040 | @@ -479,66 +251,6 @@ |
1041 | return TRUE; |
1042 | } |
1043 | |
1044 | -static gboolean |
1045 | -gwd_settings_actions_changed (GWDSettingsWritable *writable, |
1046 | - const gchar *action_double_click_titlebar, |
1047 | - const gchar *action_middle_click_titlebar, |
1048 | - const gchar *action_right_click_titlebar, |
1049 | - const gchar *mouse_wheel_action) |
1050 | -{ |
1051 | - GWDSettings *settings = GWD_SETTINGS (writable); |
1052 | - gboolean ret = FALSE; |
1053 | - |
1054 | - ret |= get_click_action_value (action_double_click_titlebar, |
1055 | - &settings->titlebar_double_click_action, |
1056 | - DOUBLE_CLICK_ACTION_DEFAULT); |
1057 | - ret |= get_click_action_value (action_middle_click_titlebar, |
1058 | - &settings->titlebar_middle_click_action, |
1059 | - MIDDLE_CLICK_ACTION_DEFAULT); |
1060 | - ret |= get_click_action_value (action_right_click_titlebar, |
1061 | - &settings->titlebar_right_click_action, |
1062 | - RIGHT_CLICK_ACTION_DEFAULT); |
1063 | - ret |= get_wheel_action_value (mouse_wheel_action, |
1064 | - &settings->mouse_wheel_action, |
1065 | - WHEEL_ACTION_DEFAULT); |
1066 | - |
1067 | - return ret; |
1068 | -} |
1069 | - |
1070 | -static void |
1071 | -gwd_settings_freeze_updates (GWDSettingsWritable *writable) |
1072 | -{ |
1073 | - GWDSettings *settings = GWD_SETTINGS (writable); |
1074 | - |
1075 | - ++settings->freeze_count; |
1076 | -} |
1077 | - |
1078 | -static void |
1079 | -gwd_settings_thaw_updates (GWDSettingsWritable *writable) |
1080 | -{ |
1081 | - GWDSettings *settings = GWD_SETTINGS (writable); |
1082 | - |
1083 | - if (settings->freeze_count) |
1084 | - --settings->freeze_count; |
1085 | - |
1086 | - release_notify_funcs (settings); |
1087 | -} |
1088 | - |
1089 | -static void |
1090 | -gwd_settings_writable_interface_init (GWDSettingsWritableInterface *interface) |
1091 | -{ |
1092 | - interface->shadow_property_changed = gwd_settings_shadow_property_changed; |
1093 | - interface->use_tooltips_changed = gwd_settings_use_tooltips_changed; |
1094 | - interface->blur_changed = gwd_settings_blur_changed; |
1095 | - interface->metacity_theme_changed = gwd_settings_metacity_theme_changed; |
1096 | - interface->opacity_changed = gwd_settings_opacity_changed; |
1097 | - interface->button_layout_changed = gwd_settings_button_layout_changed; |
1098 | - interface->font_changed = gwd_settings_font_changed; |
1099 | - interface->titlebar_actions_changed = gwd_settings_actions_changed; |
1100 | - interface->freeze_updates = gwd_settings_freeze_updates; |
1101 | - interface->thaw_updates = gwd_settings_thaw_updates; |
1102 | -} |
1103 | - |
1104 | static void |
1105 | gwd_settings_finalize (GObject *object) |
1106 | { |
1107 | @@ -860,92 +572,25 @@ |
1108 | append_to_notify_funcs (settings, update_decorations); |
1109 | } |
1110 | |
1111 | -static gboolean |
1112 | -set_blur_construction_value (gint *blur, |
1113 | - GParameter *params, |
1114 | - GValue *blur_value) |
1115 | -{ |
1116 | - if (blur) { |
1117 | - g_value_set_int (blur_value, *blur); |
1118 | - |
1119 | - params->name = "blur"; |
1120 | - params->value = *blur_value; |
1121 | - |
1122 | - return TRUE; |
1123 | - } |
1124 | - |
1125 | - return FALSE; |
1126 | -} |
1127 | - |
1128 | -static gboolean |
1129 | -set_metacity_theme_construction_value (const gchar **metacity_theme, |
1130 | - GParameter *params, |
1131 | - GValue *metacity_theme_value) |
1132 | -{ |
1133 | - if (metacity_theme) { |
1134 | - g_value_set_string (metacity_theme_value, *metacity_theme); |
1135 | - |
1136 | - params->name = "metacity-theme"; |
1137 | - params->value = *metacity_theme_value; |
1138 | - |
1139 | - return TRUE; |
1140 | - } |
1141 | - |
1142 | - return FALSE; |
1143 | -} |
1144 | - |
1145 | -static guint |
1146 | -set_flag_and_increment (guint n_param, |
1147 | - guint *flags, |
1148 | - guint flag) |
1149 | -{ |
1150 | - if (!flags) |
1151 | - return n_param; |
1152 | - |
1153 | - *flags |= flag; |
1154 | - return n_param + 1; |
1155 | -} |
1156 | - |
1157 | GWDSettings * |
1158 | -gwd_settings_new (gint *blur, |
1159 | - const gchar **metacity_theme) |
1160 | +gwd_settings_new (gint blur, |
1161 | + const gchar *metacity_theme) |
1162 | { |
1163 | - /* Always N command line parameters + 2 for command line options enum */ |
1164 | - const guint gwd_settings_impl_n_construction_params = 4; |
1165 | - GParameter param[gwd_settings_impl_n_construction_params]; |
1166 | - GWDSettings *settings = NULL; |
1167 | - |
1168 | - int n_param = 0; |
1169 | - guint cmdline_opts = 0; |
1170 | - |
1171 | - GValue blur_value = G_VALUE_INIT; |
1172 | - GValue metacity_theme_value = G_VALUE_INIT; |
1173 | - GValue cmdline_opts_value = G_VALUE_INIT; |
1174 | - |
1175 | - g_value_init (&blur_value, G_TYPE_INT); |
1176 | - g_value_init (&metacity_theme_value, G_TYPE_STRING); |
1177 | - g_value_init (&cmdline_opts_value, G_TYPE_INT); |
1178 | - |
1179 | - if (set_blur_construction_value (blur, ¶m[n_param], &blur_value)) |
1180 | - n_param = set_flag_and_increment (n_param, &cmdline_opts, CMDLINE_BLUR); |
1181 | - |
1182 | - if (set_metacity_theme_construction_value (metacity_theme, ¶m[n_param], &metacity_theme_value)) |
1183 | - n_param = set_flag_and_increment (n_param, &cmdline_opts, CMDLINE_THEME); |
1184 | - |
1185 | - g_value_set_int (&cmdline_opts_value, cmdline_opts); |
1186 | - |
1187 | - param[n_param].name = "cmdline-options"; |
1188 | - param[n_param].value = cmdline_opts_value; |
1189 | - |
1190 | - ++n_param; |
1191 | - |
1192 | - settings = g_object_newv (GWD_TYPE_SETTINGS, n_param, param); |
1193 | - |
1194 | - g_value_unset (&blur_value); |
1195 | - g_value_unset (&metacity_theme_value); |
1196 | - g_value_unset (&cmdline_opts_value); |
1197 | - |
1198 | - return settings; |
1199 | + guint cmdline_opts; |
1200 | + |
1201 | + cmdline_opts = 0; |
1202 | + |
1203 | + if (blur != BLUR_TYPE_UNSET) |
1204 | + cmdline_opts |= CMDLINE_BLUR; |
1205 | + |
1206 | + if (metacity_theme != NULL) |
1207 | + cmdline_opts |= CMDLINE_THEME; |
1208 | + |
1209 | + return g_object_new (GWD_TYPE_SETTINGS, |
1210 | + "blur", blur != BLUR_TYPE_UNSET ? blur : BLUR_TYPE_DEFAULT, |
1211 | + "metacity-theme", metacity_theme ? metacity_theme : METACITY_THEME_DEFAULT, |
1212 | + "cmdline-options", cmdline_opts, |
1213 | + NULL); |
1214 | } |
1215 | |
1216 | const gchar * |
1217 | @@ -965,3 +610,253 @@ |
1218 | { |
1219 | return settings->titlebar_font; |
1220 | } |
1221 | + |
1222 | +void |
1223 | +gwd_settings_freeze_updates (GWDSettings *settings) |
1224 | +{ |
1225 | + ++settings->freeze_count; |
1226 | +} |
1227 | + |
1228 | +void |
1229 | +gwd_settings_thaw_updates (GWDSettings *settings) |
1230 | +{ |
1231 | + if (settings->freeze_count) |
1232 | + --settings->freeze_count; |
1233 | + |
1234 | + release_notify_funcs (settings); |
1235 | +} |
1236 | + |
1237 | +gboolean |
1238 | +gwd_settings_shadow_property_changed (GWDSettings *settings, |
1239 | + gdouble active_shadow_radius, |
1240 | + gdouble active_shadow_opacity, |
1241 | + gdouble active_shadow_offset_x, |
1242 | + gdouble active_shadow_offset_y, |
1243 | + const gchar *active_shadow_color, |
1244 | + gdouble inactive_shadow_radius, |
1245 | + gdouble inactive_shadow_opacity, |
1246 | + gdouble inactive_shadow_offset_x, |
1247 | + gdouble inactive_shadow_offset_y, |
1248 | + const gchar *inactive_shadow_color) |
1249 | +{ |
1250 | + decor_shadow_options_t active_shadow, inactive_shadow; |
1251 | + unsigned int c[4]; |
1252 | + gboolean changed = FALSE; |
1253 | + |
1254 | + active_shadow.shadow_radius = active_shadow_radius; |
1255 | + active_shadow.shadow_opacity = active_shadow_opacity; |
1256 | + active_shadow.shadow_offset_x = active_shadow_offset_x; |
1257 | + active_shadow.shadow_offset_y = active_shadow_offset_y; |
1258 | + |
1259 | + if (sscanf (active_shadow_color, "#%2x%2x%2x%2x", |
1260 | + &c[0], &c[1], &c[2], &c[3]) == 4) { |
1261 | + active_shadow.shadow_color[0] = c[0] << 8 | c[0]; |
1262 | + active_shadow.shadow_color[1] = c[1] << 8 | c[1]; |
1263 | + active_shadow.shadow_color[2] = c[2] << 8 | c[2]; |
1264 | + } else { |
1265 | + return FALSE; |
1266 | + } |
1267 | + |
1268 | + if (sscanf (inactive_shadow_color, "#%2x%2x%2x%2x", |
1269 | + &c[0], &c[1], &c[2], &c[3]) == 4) { |
1270 | + inactive_shadow.shadow_color[0] = c[0] << 8 | c[0]; |
1271 | + inactive_shadow.shadow_color[1] = c[1] << 8 | c[1]; |
1272 | + inactive_shadow.shadow_color[2] = c[2] << 8 | c[2]; |
1273 | + } else { |
1274 | + return FALSE; |
1275 | + } |
1276 | + |
1277 | + inactive_shadow.shadow_radius = inactive_shadow_radius; |
1278 | + inactive_shadow.shadow_opacity = inactive_shadow_opacity; |
1279 | + inactive_shadow.shadow_offset_x = inactive_shadow_offset_x; |
1280 | + inactive_shadow.shadow_offset_y = inactive_shadow_offset_y; |
1281 | + |
1282 | + if (decor_shadow_options_cmp (&settings->inactive_shadow, &inactive_shadow)) { |
1283 | + changed |= TRUE; |
1284 | + settings->inactive_shadow = inactive_shadow; |
1285 | + } |
1286 | + |
1287 | + if (decor_shadow_options_cmp (&settings->active_shadow, &active_shadow)) { |
1288 | + changed |= TRUE; |
1289 | + settings->active_shadow = active_shadow; |
1290 | + } |
1291 | + |
1292 | + if (changed) { |
1293 | + append_to_notify_funcs (settings, update_decorations); |
1294 | + release_notify_funcs (settings); |
1295 | + } |
1296 | + |
1297 | + return changed; |
1298 | +} |
1299 | + |
1300 | +gboolean |
1301 | +gwd_settings_use_tooltips_changed (GWDSettings *settings, |
1302 | + gboolean use_tooltips) |
1303 | +{ |
1304 | + if (settings->use_tooltips == use_tooltips) |
1305 | + return FALSE; |
1306 | + |
1307 | + settings->use_tooltips = use_tooltips; |
1308 | + |
1309 | + append_to_notify_funcs (settings, update_decorations); |
1310 | + release_notify_funcs (settings); |
1311 | + |
1312 | + return TRUE; |
1313 | +} |
1314 | + |
1315 | +gboolean |
1316 | +gwd_settings_blur_changed (GWDSettings *settings, |
1317 | + const gchar *type) |
1318 | +{ |
1319 | + gint new_type = BLUR_TYPE_UNSET; |
1320 | + |
1321 | + if (settings->cmdline_opts & CMDLINE_BLUR) |
1322 | + return FALSE; |
1323 | + |
1324 | + if (strcmp (type, "titlebar") == 0) |
1325 | + new_type = BLUR_TYPE_TITLEBAR; |
1326 | + else if (strcmp (type, "all") == 0) |
1327 | + new_type = BLUR_TYPE_ALL; |
1328 | + else if (strcmp (type, "none") == 0) |
1329 | + new_type = BLUR_TYPE_NONE; |
1330 | + |
1331 | + if (new_type == BLUR_TYPE_UNSET) |
1332 | + return FALSE; |
1333 | + |
1334 | + if (settings->blur_type == new_type) |
1335 | + return FALSE; |
1336 | + |
1337 | + settings->blur_type = new_type; |
1338 | + |
1339 | + append_to_notify_funcs (settings, update_decorations); |
1340 | + release_notify_funcs (settings); |
1341 | + |
1342 | + return TRUE; |
1343 | +} |
1344 | + |
1345 | +gboolean |
1346 | +gwd_settings_metacity_theme_changed (GWDSettings *settings, |
1347 | + gboolean use_metacity_theme, |
1348 | + const gchar *metacity_theme) |
1349 | +{ |
1350 | + if (settings->cmdline_opts & CMDLINE_THEME) |
1351 | + return FALSE; |
1352 | + |
1353 | + if (!metacity_theme) |
1354 | + return FALSE; |
1355 | + |
1356 | + if (use_metacity_theme) { |
1357 | + if (g_strcmp0 (metacity_theme, settings->metacity_theme) == 0) |
1358 | + return FALSE; |
1359 | + |
1360 | + g_free (settings->metacity_theme); |
1361 | + settings->metacity_theme = g_strdup (metacity_theme); |
1362 | + } else { |
1363 | + g_free (settings->metacity_theme); |
1364 | + settings->metacity_theme = g_strdup (""); |
1365 | + } |
1366 | + |
1367 | + append_to_notify_funcs (settings, update_metacity_theme); |
1368 | + append_to_notify_funcs (settings, update_decorations); |
1369 | + release_notify_funcs (settings); |
1370 | + |
1371 | + return TRUE; |
1372 | +} |
1373 | + |
1374 | +gboolean |
1375 | +gwd_settings_opacity_changed (GWDSettings *settings, |
1376 | + gdouble active_opacity, |
1377 | + gdouble inactive_opacity, |
1378 | + gboolean active_shade_opacity, |
1379 | + gboolean inactive_shade_opacity) |
1380 | +{ |
1381 | + if (settings->metacity_active_opacity == active_opacity && |
1382 | + settings->metacity_inactive_opacity == inactive_opacity && |
1383 | + settings->metacity_active_shade_opacity == active_shade_opacity && |
1384 | + settings->metacity_inactive_shade_opacity == inactive_shade_opacity) |
1385 | + return FALSE; |
1386 | + |
1387 | + settings->metacity_active_opacity = active_opacity; |
1388 | + settings->metacity_inactive_opacity = inactive_opacity; |
1389 | + settings->metacity_active_shade_opacity = active_shade_opacity; |
1390 | + settings->metacity_inactive_shade_opacity = inactive_shade_opacity; |
1391 | + |
1392 | + append_to_notify_funcs (settings, update_decorations); |
1393 | + release_notify_funcs (settings); |
1394 | + |
1395 | + return TRUE; |
1396 | +} |
1397 | + |
1398 | +gboolean |
1399 | +gwd_settings_button_layout_changed (GWDSettings *settings, |
1400 | + const gchar *button_layout) |
1401 | +{ |
1402 | + if (!button_layout) |
1403 | + return FALSE; |
1404 | + |
1405 | + if (g_strcmp0 (settings->metacity_button_layout, button_layout) == 0) |
1406 | + return FALSE; |
1407 | + |
1408 | + g_free (settings->metacity_button_layout); |
1409 | + settings->metacity_button_layout = g_strdup (button_layout); |
1410 | + |
1411 | + append_to_notify_funcs (settings, update_metacity_button_layout); |
1412 | + append_to_notify_funcs (settings, update_decorations); |
1413 | + release_notify_funcs (settings); |
1414 | + |
1415 | + return TRUE; |
1416 | +} |
1417 | + |
1418 | +gboolean |
1419 | +gwd_settings_font_changed (GWDSettings *settings, |
1420 | + gboolean titlebar_uses_system_font, |
1421 | + const gchar *titlebar_font) |
1422 | +{ |
1423 | + const gchar *no_font = NULL; |
1424 | + const gchar *use_font = NULL; |
1425 | + |
1426 | + if (!titlebar_font) |
1427 | + return FALSE; |
1428 | + |
1429 | + if (titlebar_uses_system_font) |
1430 | + use_font = no_font; |
1431 | + else |
1432 | + use_font = titlebar_font; |
1433 | + |
1434 | + if (g_strcmp0 (settings->titlebar_font, use_font) == 0) |
1435 | + return FALSE; |
1436 | + |
1437 | + g_free (settings->titlebar_font); |
1438 | + settings->titlebar_font = use_font ? g_strdup (use_font) : NULL; |
1439 | + |
1440 | + append_to_notify_funcs (settings, update_decorations); |
1441 | + append_to_notify_funcs (settings, update_frames); |
1442 | + release_notify_funcs (settings); |
1443 | + |
1444 | + return TRUE; |
1445 | +} |
1446 | + |
1447 | +gboolean |
1448 | +gwd_settings_titlebar_actions_changed (GWDSettings *settings, |
1449 | + const gchar *action_double_click_titlebar, |
1450 | + const gchar *action_middle_click_titlebar, |
1451 | + const gchar *action_right_click_titlebar, |
1452 | + const gchar *mouse_wheel_action) |
1453 | +{ |
1454 | + gboolean ret = FALSE; |
1455 | + |
1456 | + ret |= get_click_action_value (action_double_click_titlebar, |
1457 | + &settings->titlebar_double_click_action, |
1458 | + DOUBLE_CLICK_ACTION_DEFAULT); |
1459 | + ret |= get_click_action_value (action_middle_click_titlebar, |
1460 | + &settings->titlebar_middle_click_action, |
1461 | + MIDDLE_CLICK_ACTION_DEFAULT); |
1462 | + ret |= get_click_action_value (action_right_click_titlebar, |
1463 | + &settings->titlebar_right_click_action, |
1464 | + RIGHT_CLICK_ACTION_DEFAULT); |
1465 | + ret |= get_wheel_action_value (mouse_wheel_action, |
1466 | + &settings->mouse_wheel_action, |
1467 | + WHEEL_ACTION_DEFAULT); |
1468 | + |
1469 | + return ret; |
1470 | +} |
1471 | |
1472 | === modified file 'gtk/window-decorator/gwd-settings.h' |
1473 | --- gtk/window-decorator/gwd-settings.h 2016-05-21 09:47:09 +0000 |
1474 | +++ gtk/window-decorator/gwd-settings.h 2016-05-21 09:47:09 +0000 |
1475 | @@ -30,6 +30,7 @@ |
1476 | |
1477 | enum |
1478 | { |
1479 | + BLUR_TYPE_UNSET = -1, |
1480 | BLUR_TYPE_NONE = 0, |
1481 | BLUR_TYPE_TITLEBAR = 1, |
1482 | BLUR_TYPE_ALL = 2 |
1483 | @@ -87,17 +88,72 @@ |
1484 | G_DECLARE_FINAL_TYPE (GWDSettings, gwd_settings, GWD, SETTINGS, GObject) |
1485 | |
1486 | GWDSettings * |
1487 | -gwd_settings_new (gint *blur, |
1488 | - const gchar **metacity_theme); |
1489 | - |
1490 | -const gchar * |
1491 | -gwd_settings_get_metacity_button_layout (GWDSettings *settings); |
1492 | - |
1493 | -const gchar * |
1494 | -gwd_settings_get_metacity_theme (GWDSettings *settings); |
1495 | - |
1496 | -const gchar * |
1497 | -gwd_settings_get_titlebar_font (GWDSettings *settings); |
1498 | +gwd_settings_new (gint blur, |
1499 | + const gchar *metacity_theme); |
1500 | + |
1501 | +const gchar * |
1502 | +gwd_settings_get_metacity_button_layout (GWDSettings *settings); |
1503 | + |
1504 | +const gchar * |
1505 | +gwd_settings_get_metacity_theme (GWDSettings *settings); |
1506 | + |
1507 | +const gchar * |
1508 | +gwd_settings_get_titlebar_font (GWDSettings *settings); |
1509 | + |
1510 | +void |
1511 | +gwd_settings_freeze_updates (GWDSettings *settings); |
1512 | + |
1513 | +void |
1514 | +gwd_settings_thaw_updates (GWDSettings *settings); |
1515 | + |
1516 | +gboolean |
1517 | +gwd_settings_shadow_property_changed (GWDSettings *settings, |
1518 | + gdouble active_shadow_radius, |
1519 | + gdouble active_shadow_opacity, |
1520 | + gdouble active_shadow_offset_x, |
1521 | + gdouble active_shadow_offset_y, |
1522 | + const gchar *active_shadow_color, |
1523 | + gdouble inactive_shadow_radius, |
1524 | + gdouble inactive_shadow_opacity, |
1525 | + gdouble inactive_shadow_offset_x, |
1526 | + gdouble inactive_shadow_offset_y, |
1527 | + const gchar *inactive_shadow_color); |
1528 | + |
1529 | +gboolean |
1530 | +gwd_settings_use_tooltips_changed (GWDSettings *settings, |
1531 | + gboolean use_tooltips); |
1532 | + |
1533 | +gboolean |
1534 | +gwd_settings_blur_changed (GWDSettings *settings, |
1535 | + const gchar *blur_type); |
1536 | + |
1537 | +gboolean |
1538 | +gwd_settings_metacity_theme_changed (GWDSettings *settings, |
1539 | + gboolean use_metacity_theme, |
1540 | + const gchar *metacity_theme); |
1541 | + |
1542 | +gboolean |
1543 | +gwd_settings_opacity_changed (GWDSettings *settings, |
1544 | + gdouble active_opacity, |
1545 | + gdouble inactive_opacity, |
1546 | + gboolean active_shade_opacity, |
1547 | + gboolean inactive_shade_opacity); |
1548 | + |
1549 | +gboolean |
1550 | +gwd_settings_button_layout_changed (GWDSettings *settings, |
1551 | + const gchar *button_layout); |
1552 | + |
1553 | +gboolean |
1554 | +gwd_settings_font_changed (GWDSettings *settings, |
1555 | + gboolean titlebar_uses_system_font, |
1556 | + const gchar *titlebar_font); |
1557 | + |
1558 | +gboolean |
1559 | +gwd_settings_titlebar_actions_changed (GWDSettings *settings, |
1560 | + const gchar *action_double_click_titlebar, |
1561 | + const gchar *action_middle_click_titlebar, |
1562 | + const gchar *action_right_click_titlebar, |
1563 | + const gchar *mouse_wheel_action); |
1564 | |
1565 | G_END_DECLS |
1566 | |
1567 | |
1568 | === modified file 'gtk/window-decorator/settings.c' |
1569 | --- gtk/window-decorator/settings.c 2016-05-21 09:47:09 +0000 |
1570 | +++ gtk/window-decorator/settings.c 2016-05-21 09:47:09 +0000 |
1571 | @@ -20,7 +20,6 @@ |
1572 | */ |
1573 | |
1574 | #include "gtk-window-decorator.h" |
1575 | -#include "gwd-settings-writable-interface.h" |
1576 | #include "gwd-settings-storage.h" |
1577 | #include "gwd-settings-xproperty-storage.h" |
1578 | |
1579 | @@ -28,10 +27,10 @@ |
1580 | GWDSettingsXPropertyStorage *xprop_storage = NULL; |
1581 | |
1582 | void |
1583 | -init_settings (GWDSettingsWritable *writable) |
1584 | +init_settings (GWDSettings *settings) |
1585 | { |
1586 | - storage = gwd_settings_storage_new (writable, TRUE); |
1587 | - xprop_storage = gwd_settings_xproperty_storage_new (writable); |
1588 | + storage = gwd_settings_storage_new (settings, TRUE); |
1589 | + xprop_storage = gwd_settings_xproperty_storage_new (settings); |
1590 | |
1591 | gwd_settings_storage_update_metacity_theme (storage); |
1592 | gwd_settings_storage_update_opacity (storage); |
1593 | |
1594 | === modified file 'gtk/window-decorator/tests/CMakeLists.txt' |
1595 | --- gtk/window-decorator/tests/CMakeLists.txt 2016-05-21 09:47:09 +0000 |
1596 | +++ gtk/window-decorator/tests/CMakeLists.txt 2016-05-21 09:47:09 +0000 |
1597 | @@ -18,18 +18,11 @@ |
1598 | link_directories (${CMAKE_CURRENT_BINARY_DIR} |
1599 | ${CMAKE_CURRENT_BINARY_DIR}/..) |
1600 | |
1601 | - add_library (gtk_window_decorator_mock_settings_writable STATIC |
1602 | - ${CMAKE_CURRENT_SOURCE_DIR}/compiz_gwd_mock_settings_writable.cpp) |
1603 | - |
1604 | - target_link_libraries (gtk_window_decorator_mock_settings_writable |
1605 | - gtk_window_decorator_settings_writable_interface) |
1606 | - |
1607 | add_executable (compiz_test_gwd_settings |
1608 | ${CMAKE_CURRENT_SOURCE_DIR}/test_gwd_settings.cpp) |
1609 | |
1610 | set (COMPIZ_TEST_GWD_SETTINGS_ADDITIONAL_LIBRARIES |
1611 | - gtk_window_decorator_settings |
1612 | - gtk_window_decorator_mock_settings_writable) |
1613 | + gtk_window_decorator_settings) |
1614 | |
1615 | set (COMPIZ_TEST_GWD_SETTINGS_COVERAGE_TARGETS |
1616 | gtk_window_decorator_settings) |
1617 | |
1618 | === removed file 'gtk/window-decorator/tests/compiz_gwd_mock_settings_writable.cpp' |
1619 | --- gtk/window-decorator/tests/compiz_gwd_mock_settings_writable.cpp 2016-02-22 12:27:13 +0000 |
1620 | +++ gtk/window-decorator/tests/compiz_gwd_mock_settings_writable.cpp 1970-01-01 00:00:00 +0000 |
1621 | @@ -1,278 +0,0 @@ |
1622 | -/* |
1623 | - * Copyright © 2012 Canonical Ltd |
1624 | - * |
1625 | - * This program is free software; you can redistribute it and/or modify |
1626 | - * it under the terms of the GNU General Public License as published by |
1627 | - * the Free Software Foundation; either version 2 of the License, or |
1628 | - * (at your option) any later version. |
1629 | - * |
1630 | - * This program is distributed in the hope that it will be useful, |
1631 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1632 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1633 | - * GNU General Public License for more details. |
1634 | - * |
1635 | - * You should have received a copy of the GNU General Public License |
1636 | - * along with this program; if not, write to the Free Software Foundation, |
1637 | - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1638 | - * |
1639 | - * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
1640 | - */ |
1641 | -#include <gtest/gtest.h> |
1642 | -#include <gmock/gmock.h> |
1643 | - |
1644 | -#include <glib-object.h> |
1645 | - |
1646 | -#include "gwd-settings-writable-interface.h" |
1647 | -#include "compiz_gwd_mock_settings_writable.h" |
1648 | - |
1649 | -#define GWD_MOCK_SETTINGS_WRITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GWD_TYPE_MOCK_SETTINGS_WRITABLE, GWDMockSettingsWritable)); |
1650 | -#define GWD_MOCK_SETTINGS_WRITABLE_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GWD_TYPE_MOCK_SETTINGS_WRITABLE, GWDMockSettingsWritableClass)); |
1651 | -#define GWD_IS_MOCK_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GWD_TYPE_MOCK_SETTINGS_WRITABLE)); |
1652 | -#define GWD_IS_MOCK_SETTINGS_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), GWD_TYPE_MOCK_SETTINGS_WRITABLE)); |
1653 | -#define GWD_MOCK_SETTINGS_WRITABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GWD_TYPE_MOCK_SETTINGS_WRITABLE, GWDMockSettingsWritableClass)); |
1654 | - |
1655 | -typedef struct _GWDMockSettingsWritable |
1656 | -{ |
1657 | - GObject parent; |
1658 | -} GWDMockSettingsWritable; |
1659 | - |
1660 | -typedef struct _GWDMockSettingsWritableClass |
1661 | -{ |
1662 | - GObjectClass parent_class; |
1663 | -} GWDMockSettingsWritableClass; |
1664 | - |
1665 | -static void gwd_mock_settings_writable_interface_init (GWDSettingsWritableInterface *interface); |
1666 | - |
1667 | -G_DEFINE_TYPE_WITH_CODE (GWDMockSettingsWritable, gwd_mock_settings_writable, G_TYPE_OBJECT, |
1668 | - G_IMPLEMENT_INTERFACE (GWD_TYPE_WRITABLE_SETTINGS_INTERFACE, |
1669 | - gwd_mock_settings_writable_interface_init)) |
1670 | - |
1671 | -#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GWD_TYPE_MOCK_SETTINGS_WRITABLE, GWDMockSettingsWritablePrivate)) |
1672 | - |
1673 | -enum |
1674 | -{ |
1675 | - GWD_MOCK_SETTINGS_WRITABLE_PROPERTY_GMOCK_INTERFACE = 1 |
1676 | -}; |
1677 | - |
1678 | -typedef struct _GWDMockSettingsWritablePrivate |
1679 | -{ |
1680 | - GWDMockSettingsWritableGMockInterface *mock; |
1681 | -} GWDMockSettingsWritablePrivate; |
1682 | - |
1683 | -void |
1684 | -gwd_mock_settings_writable_freeze_updates (GWDSettingsWritable *settings) |
1685 | -{ |
1686 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1687 | - return gmockSettingsWritable->freezeUpdates (); |
1688 | -} |
1689 | - |
1690 | -void |
1691 | -gwd_mock_settings_writable_thaw_updates (GWDSettingsWritable *settings) |
1692 | -{ |
1693 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1694 | - return gmockSettingsWritable->thawUpdates (); |
1695 | -} |
1696 | - |
1697 | -gboolean |
1698 | -gwd_mock_settings_writable_shadow_property_changed (GWDSettingsWritable *settings, |
1699 | - gdouble active_shadow_radius, |
1700 | - gdouble active_shadow_opacity, |
1701 | - gdouble active_shadow_offset_x, |
1702 | - gdouble active_shadow_offset_y, |
1703 | - const gchar *active_shadow_color, |
1704 | - gdouble inactive_shadow_radius, |
1705 | - gdouble inactive_shadow_opacity, |
1706 | - gdouble inactive_shadow_offset_x, |
1707 | - gdouble inactive_shadow_offset_y, |
1708 | - const gchar *inactive_shadow_color) |
1709 | -{ |
1710 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1711 | - return gmockSettingsWritable->shadowPropertyChanged (active_shadow_radius, |
1712 | - active_shadow_opacity, |
1713 | - active_shadow_offset_x, |
1714 | - active_shadow_offset_y, |
1715 | - active_shadow_color, |
1716 | - inactive_shadow_radius, |
1717 | - inactive_shadow_opacity, |
1718 | - inactive_shadow_offset_x, |
1719 | - inactive_shadow_offset_y, |
1720 | - inactive_shadow_color); |
1721 | -} |
1722 | - |
1723 | -gboolean |
1724 | -gwd_mock_settings_writable_use_tooltips_changed (GWDSettingsWritable *settings, |
1725 | - gboolean use_tooltips) |
1726 | -{ |
1727 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1728 | - return gmockSettingsWritable->useTooltipsChanged (use_tooltips); |
1729 | -} |
1730 | - |
1731 | -gboolean |
1732 | -gwd_mock_settings_writable_blur_changed (GWDSettingsWritable *settings, |
1733 | - const gchar *blur_type) |
1734 | -{ |
1735 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1736 | - return gmockSettingsWritable->blurChanged (blur_type); |
1737 | -} |
1738 | - |
1739 | -gboolean |
1740 | -gwd_mock_settings_writable_metacity_theme_changed (GWDSettingsWritable *settings, |
1741 | - gboolean use_metacity_theme, |
1742 | - const gchar *metacity_theme) |
1743 | -{ |
1744 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1745 | - return gmockSettingsWritable->metacityThemeChanged (use_metacity_theme, metacity_theme); |
1746 | -} |
1747 | - |
1748 | -gboolean |
1749 | -gwd_mock_settings_writable_opacity_changed (GWDSettingsWritable *settings, |
1750 | - gdouble inactive_opacity, |
1751 | - gdouble active_opacity, |
1752 | - gboolean inactive_shade_opacity, |
1753 | - gboolean active_shade_opacity) |
1754 | -{ |
1755 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1756 | - return gmockSettingsWritable->opacityChanged (inactive_opacity, active_opacity, inactive_shade_opacity, active_shade_opacity); |
1757 | -} |
1758 | - |
1759 | -gboolean |
1760 | -gwd_mock_settings_writable_button_layout_changed (GWDSettingsWritable *settings, |
1761 | - const gchar *button_layout) |
1762 | -{ |
1763 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1764 | - return gmockSettingsWritable->buttonLayoutChanged (button_layout); |
1765 | -} |
1766 | - |
1767 | -gboolean |
1768 | -gwd_mock_settings_writable_font_changed (GWDSettingsWritable *settings, |
1769 | - gboolean titlebar_uses_system_font, |
1770 | - const gchar *titlebar_font) |
1771 | -{ |
1772 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1773 | - return gmockSettingsWritable->fontChanged (titlebar_uses_system_font, titlebar_font); |
1774 | -} |
1775 | - |
1776 | -gboolean |
1777 | -gwd_mock_settings_writable_titlebar_actions_changed (GWDSettingsWritable *settings, |
1778 | - const gchar *action_double_click_titlebar, |
1779 | - const gchar *action_middle_click_titlebar, |
1780 | - const gchar *action_right_click_titlebar, |
1781 | - const gchar *mouse_wheel_action) |
1782 | -{ |
1783 | - GWDMockSettingsWritableGMockInterface *gmockSettingsWritable = GET_PRIVATE (settings)->mock; |
1784 | - return gmockSettingsWritable->titlebarActionsChanged (action_double_click_titlebar, |
1785 | - action_middle_click_titlebar, |
1786 | - action_right_click_titlebar, |
1787 | - mouse_wheel_action); |
1788 | -} |
1789 | - |
1790 | -static void gwd_mock_settings_writable_interface_init (GWDSettingsWritableInterface *interface) |
1791 | -{ |
1792 | - interface->shadow_property_changed = gwd_mock_settings_writable_shadow_property_changed; |
1793 | - interface->use_tooltips_changed = gwd_mock_settings_writable_use_tooltips_changed; |
1794 | - interface->blur_changed = gwd_mock_settings_writable_blur_changed; |
1795 | - interface->metacity_theme_changed = gwd_mock_settings_writable_metacity_theme_changed; |
1796 | - interface->opacity_changed = gwd_mock_settings_writable_opacity_changed; |
1797 | - interface->button_layout_changed = gwd_mock_settings_writable_button_layout_changed; |
1798 | - interface->font_changed = gwd_mock_settings_writable_font_changed; |
1799 | - interface->titlebar_actions_changed = gwd_mock_settings_writable_titlebar_actions_changed; |
1800 | - interface->freeze_updates = gwd_mock_settings_writable_freeze_updates; |
1801 | - interface->thaw_updates = gwd_mock_settings_writable_thaw_updates; |
1802 | -} |
1803 | - |
1804 | -static GObject * gwd_mock_settings_writable_constructor (GType type, |
1805 | - guint n_construction_properties, |
1806 | - GObjectConstructParam *construction_properties) |
1807 | -{ |
1808 | - GObject *object = G_OBJECT_CLASS (gwd_mock_settings_writable_parent_class)->constructor (type, n_construction_properties, construction_properties); |
1809 | - GWDMockSettingsWritablePrivate *priv = GET_PRIVATE (object); |
1810 | - guint i = 0; |
1811 | - |
1812 | - for (; i < n_construction_properties; ++i) |
1813 | - { |
1814 | - if (g_strcmp0 (construction_properties[i].pspec->name, "gmock-interface") == 0) |
1815 | - { |
1816 | - priv->mock = reinterpret_cast <GWDMockSettingsWritableGMockInterface *> (g_value_get_pointer (construction_properties[i].value)); |
1817 | - } |
1818 | - else |
1819 | - g_assert_not_reached (); |
1820 | - } |
1821 | - |
1822 | - return object; |
1823 | -} |
1824 | - |
1825 | -static void gwd_mock_settings_writable_set_property (GObject *object, |
1826 | - guint property_id, |
1827 | - const GValue *value, |
1828 | - GParamSpec *pspec) |
1829 | -{ |
1830 | - GWDMockSettingsWritablePrivate *priv = GET_PRIVATE (object); |
1831 | - |
1832 | - switch (property_id) |
1833 | - { |
1834 | - case GWD_MOCK_SETTINGS_WRITABLE_PROPERTY_GMOCK_INTERFACE: |
1835 | - if (!priv->mock) |
1836 | - priv->mock = reinterpret_cast <GWDMockSettingsWritableGMockInterface *> (g_value_get_pointer (value)); |
1837 | - break; |
1838 | - default: |
1839 | - g_assert_not_reached (); |
1840 | - } |
1841 | -} |
1842 | - |
1843 | -static void gwd_mock_settings_writable_dispose (GObject *object) |
1844 | -{ |
1845 | - GWDMockSettingsWritableGMockInterface *settingsGMock = GET_PRIVATE (object)->mock; |
1846 | - G_OBJECT_CLASS (gwd_mock_settings_writable_parent_class)->dispose (object); |
1847 | - settingsGMock->dispose (); |
1848 | -} |
1849 | - |
1850 | -static void gwd_mock_settings_writable_finalize (GObject *object) |
1851 | -{ |
1852 | - GWDMockSettingsWritableGMockInterface *settingsGMock = GET_PRIVATE (object)->mock; |
1853 | - G_OBJECT_CLASS (gwd_mock_settings_writable_parent_class)->finalize (object); |
1854 | - settingsGMock->finalize (); |
1855 | -} |
1856 | - |
1857 | -static void gwd_mock_settings_writable_class_init (GWDMockSettingsWritableClass *klass) |
1858 | -{ |
1859 | - GObjectClass *object_class = G_OBJECT_CLASS (klass); |
1860 | - |
1861 | - g_type_class_add_private (klass, sizeof (GWDMockSettingsWritablePrivate)); |
1862 | - |
1863 | - object_class->dispose = gwd_mock_settings_writable_dispose; |
1864 | - object_class->finalize = gwd_mock_settings_writable_finalize; |
1865 | - object_class->constructor = gwd_mock_settings_writable_constructor; |
1866 | - object_class->set_property = gwd_mock_settings_writable_set_property; |
1867 | - |
1868 | - g_object_class_install_property (object_class, |
1869 | - GWD_MOCK_SETTINGS_WRITABLE_PROPERTY_GMOCK_INTERFACE, |
1870 | - g_param_spec_pointer ("gmock-interface", |
1871 | - "Google Mock Interface", |
1872 | - "Google Mock Interface", |
1873 | - static_cast <GParamFlags> (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY))); |
1874 | -} |
1875 | - |
1876 | -void gwd_mock_settings_writable_init (GWDMockSettingsWritable *self) |
1877 | -{ |
1878 | -} |
1879 | - |
1880 | -GWDSettingsWritable * |
1881 | -gwd_mock_settings_writable_new (GWDMockSettingsWritableGMockInterface *gmock) |
1882 | -{ |
1883 | - GValue gmock_interface_v = G_VALUE_INIT; |
1884 | - |
1885 | - g_value_init (&gmock_interface_v, G_TYPE_POINTER); |
1886 | - |
1887 | - g_value_set_pointer (&gmock_interface_v, reinterpret_cast <gpointer> (gmock)); |
1888 | - |
1889 | - GParameter param[1] = |
1890 | - { |
1891 | - { "gmock-interface", gmock_interface_v } |
1892 | - }; |
1893 | - |
1894 | - GWDSettingsWritable *writable = GWD_SETTINGS_WRITABLE_INTERFACE (g_object_newv (GWD_TYPE_MOCK_SETTINGS_WRITABLE, 1, param)); |
1895 | - |
1896 | - g_value_unset (&gmock_interface_v); |
1897 | - |
1898 | - return writable; |
1899 | -} |
1900 | |
1901 | === removed file 'gtk/window-decorator/tests/compiz_gwd_mock_settings_writable.h' |
1902 | --- gtk/window-decorator/tests/compiz_gwd_mock_settings_writable.h 2016-02-22 12:27:13 +0000 |
1903 | +++ gtk/window-decorator/tests/compiz_gwd_mock_settings_writable.h 1970-01-01 00:00:00 +0000 |
1904 | @@ -1,104 +0,0 @@ |
1905 | -/* |
1906 | - * Copyright © 2012 Canonical Ltd |
1907 | - * |
1908 | - * This program is free software; you can redistribute it and/or modify |
1909 | - * it under the terms of the GNU General Public License as published by |
1910 | - * the Free Software Foundation; either version 2 of the License, or |
1911 | - * (at your option) any later version. |
1912 | - * |
1913 | - * This program is distributed in the hope that it will be useful, |
1914 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1915 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1916 | - * GNU General Public License for more details. |
1917 | - * |
1918 | - * You should have received a copy of the GNU General Public License |
1919 | - * along with this program; if not, write to the Free Software Foundation, |
1920 | - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1921 | - * |
1922 | - * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
1923 | - */ |
1924 | -#ifndef _COMPIZ_GWD_MOCK_SETTINGS_WRITABLE_H |
1925 | -#define _COMPIZ_GWD_MOCK_SETTINGS_WRITABLE_H |
1926 | - |
1927 | -#include <gtest/gtest.h> |
1928 | -#include <gmock/gmock.h> |
1929 | - |
1930 | -#include <glib-object.h> |
1931 | - |
1932 | -typedef struct _GWDSettingsWritable GWDSettingsWritable; |
1933 | - |
1934 | -class GWDMockSettingsWritableGMockInterface; |
1935 | - |
1936 | -G_BEGIN_DECLS |
1937 | - |
1938 | -#define GWD_TYPE_MOCK_SETTINGS_WRITABLE (gwd_mock_settings_writable_get_type ()) |
1939 | -GType gwd_mock_settings_writable_get_type (); |
1940 | - |
1941 | -GWDSettingsWritable * |
1942 | -gwd_mock_settings_writable_new (GWDMockSettingsWritableGMockInterface *); |
1943 | - |
1944 | -G_END_DECLS |
1945 | - |
1946 | -class GWDMockSettingsWritableGMockInterface |
1947 | -{ |
1948 | - public: |
1949 | - |
1950 | - virtual ~GWDMockSettingsWritableGMockInterface () {} |
1951 | - |
1952 | - virtual void freezeUpdates() = 0; |
1953 | - virtual void thawUpdates () = 0; |
1954 | - virtual gboolean shadowPropertyChanged (gdouble active_shadow_radius, |
1955 | - gdouble active_shadow_opacity, |
1956 | - gdouble active_shadow_offset_x, |
1957 | - gdouble active_shadow_offset_y, |
1958 | - const gchar *active_shadow_color, |
1959 | - gdouble inactive_shadow_radius, |
1960 | - gdouble inactive_shadow_opacity, |
1961 | - gdouble inactive_shadow_offset_x, |
1962 | - gdouble inactive_shadow_offset_y, |
1963 | - const gchar *inactive_shadow_color) = 0; |
1964 | - virtual gboolean useTooltipsChanged (gboolean newValue) = 0; |
1965 | - virtual gboolean blurChanged (const gchar *type) = 0; |
1966 | - virtual gboolean metacityThemeChanged (gboolean useMetacityTheme, const gchar *metacityTheme) = 0; |
1967 | - virtual gboolean opacityChanged (gdouble inactiveOpacity, |
1968 | - gdouble activeOpacity, |
1969 | - gboolean inactiveShadeOpacity, |
1970 | - gboolean activeShadeOpacity) = 0; |
1971 | - virtual gboolean buttonLayoutChanged (const gchar *buttonLayout) = 0; |
1972 | - virtual gboolean fontChanged (gboolean useSystemFont, |
1973 | - const gchar *titlebarFont) = 0; |
1974 | - virtual gboolean titlebarActionsChanged (const gchar *doubleClickAction, |
1975 | - const gchar *middleClickAction, |
1976 | - const gchar *rightClickAction, |
1977 | - const gchar *mouseWheelAction) = 0; |
1978 | - |
1979 | - |
1980 | - virtual void dispose () = 0; |
1981 | - virtual void finalize () = 0; |
1982 | -}; |
1983 | - |
1984 | -class GWDMockSettingsWritableGMock : |
1985 | - public GWDMockSettingsWritableGMockInterface |
1986 | -{ |
1987 | - public: |
1988 | - |
1989 | - MOCK_METHOD0 (freezeUpdates, void ()); |
1990 | - MOCK_METHOD0 (thawUpdates, void ()); |
1991 | - MOCK_METHOD10 (shadowPropertyChanged, gboolean (gdouble, gdouble, gdouble, gdouble, const gchar *, |
1992 | - gdouble, gdouble, gdouble, gdouble, const gchar *)); |
1993 | - MOCK_METHOD1 (useTooltipsChanged, gboolean (gboolean)); |
1994 | - MOCK_METHOD1 (blurChanged, gboolean (const gchar *)); |
1995 | - MOCK_METHOD2 (metacityThemeChanged, gboolean (gboolean, const gchar *)); |
1996 | - MOCK_METHOD4 (opacityChanged, gboolean (gdouble, gdouble, gboolean, gboolean)); |
1997 | - MOCK_METHOD1 (buttonLayoutChanged, gboolean (const gchar *)); |
1998 | - MOCK_METHOD2 (fontChanged, gboolean (gboolean, const gchar *)); |
1999 | - MOCK_METHOD4 (titlebarActionsChanged, gboolean (const gchar *, |
2000 | - const gchar *, |
2001 | - const gchar *, |
2002 | - const gchar *)); |
2003 | - |
2004 | - MOCK_METHOD0 (dispose, void ()); |
2005 | - MOCK_METHOD0 (finalize, void ()); |
2006 | -}; |
2007 | - |
2008 | -#endif |
2009 | |
2010 | === modified file 'gtk/window-decorator/tests/test_gwd_settings.cpp' |
2011 | --- gtk/window-decorator/tests/test_gwd_settings.cpp 2016-05-21 09:47:09 +0000 |
2012 | +++ gtk/window-decorator/tests/test_gwd_settings.cpp 2016-05-21 09:47:09 +0000 |
2013 | @@ -43,12 +43,9 @@ |
2014 | |
2015 | #include "gwd-settings.h" |
2016 | #include "gwd-settings-storage.h" |
2017 | -#include "gwd-settings-writable-interface.h" |
2018 | |
2019 | #include "decoration.h" |
2020 | |
2021 | -#include "compiz_gwd_mock_settings_writable.h" |
2022 | - |
2023 | using ::testing::TestWithParam; |
2024 | using ::testing::Eq; |
2025 | using ::testing::Return; |
2026 | @@ -245,23 +242,8 @@ |
2027 | CompizGLibGSliceOffEnv env; |
2028 | }; |
2029 | |
2030 | -class GWDMockSettingsWritableTest : |
2031 | - public GWDSettingsTestCommon |
2032 | -{ |
2033 | -}; |
2034 | - |
2035 | namespace |
2036 | { |
2037 | - void gwd_settings_storage_unref (GWDSettingsStorage *storage) |
2038 | - { |
2039 | - g_object_unref (G_OBJECT (storage)); |
2040 | - } |
2041 | - |
2042 | - void gwd_settings_writable_unref (GWDSettingsWritable *writable) |
2043 | - { |
2044 | - g_object_unref (G_OBJECT (writable)); |
2045 | - } |
2046 | - |
2047 | void gwd_settings_unref (GWDSettings *settings) |
2048 | { |
2049 | g_object_unref (G_OBJECT (settings)); |
2050 | @@ -297,79 +279,6 @@ |
2051 | }; |
2052 | } |
2053 | |
2054 | -TEST_F(GWDMockSettingsWritableTest, TestMock) |
2055 | -{ |
2056 | - GWDMockSettingsWritableGMock writableGMock; |
2057 | - boost::shared_ptr <GWDSettingsWritable> writableMock (gwd_mock_settings_writable_new (&writableGMock), |
2058 | - boost::bind (gwd_settings_writable_unref, _1)); |
2059 | - |
2060 | - |
2061 | - EXPECT_CALL (writableGMock, freezeUpdates ()); |
2062 | - EXPECT_CALL (writableGMock, thawUpdates ()); |
2063 | - EXPECT_CALL (writableGMock, shadowPropertyChanged (testing_values::ACTIVE_SHADOW_RADIUS_VALUE, |
2064 | - testing_values::ACTIVE_SHADOW_OPACITY_VALUE, |
2065 | - testing_values::ACTIVE_SHADOW_OFFSET_X_VALUE, |
2066 | - testing_values::ACTIVE_SHADOW_OFFSET_Y_VALUE, |
2067 | - Eq (testing_values::ACTIVE_SHADOW_COLOR_STR_VALUE), |
2068 | - testing_values::INACTIVE_SHADOW_RADIUS_VALUE, |
2069 | - testing_values::INACTIVE_SHADOW_OPACITY_VALUE, |
2070 | - testing_values::INACTIVE_SHADOW_OFFSET_X_VALUE, |
2071 | - testing_values::INACTIVE_SHADOW_OFFSET_Y_VALUE, |
2072 | - Eq (testing_values::INACTIVE_SHADOW_COLOR_STR_VALUE))).WillOnce (Return (TRUE)); |
2073 | - EXPECT_CALL (writableGMock, useTooltipsChanged (testing_values::USE_TOOLTIPS_VALUE)).WillOnce (Return (TRUE)); |
2074 | - EXPECT_CALL (writableGMock, blurChanged (Eq (testing_values::BLUR_TYPE_TITLEBAR_VALUE))).WillOnce (Return (TRUE)); |
2075 | - EXPECT_CALL (writableGMock, metacityThemeChanged (TRUE, Eq (testing_values::METACITY_THEME_VALUE))).WillOnce (Return (TRUE)); |
2076 | - EXPECT_CALL (writableGMock, opacityChanged (testing_values::ACTIVE_OPACITY_VALUE, |
2077 | - testing_values::INACTIVE_OPACITY_VALUE, |
2078 | - testing_values::ACTIVE_SHADE_OPACITY_VALUE, |
2079 | - testing_values::INACTIVE_SHADE_OPACITY_VALUE)).WillOnce (Return (TRUE)); |
2080 | - EXPECT_CALL (writableGMock, buttonLayoutChanged (Eq (testing_values::BUTTON_LAYOUT_VALUE))).WillOnce (Return (TRUE)); |
2081 | - EXPECT_CALL (writableGMock, fontChanged (testing_values::USE_SYSTEM_FONT_VALUE, |
2082 | - testing_values::TITLEBAR_FONT_VALUE.c_str ())).WillOnce (Return (TRUE)); |
2083 | - EXPECT_CALL (writableGMock, titlebarActionsChanged (Eq (testing_values::TITLEBAR_ACTION_MAX), |
2084 | - Eq (testing_values::TITLEBAR_ACTION_MENU), |
2085 | - Eq (testing_values::TITLEBAR_ACTION_LOWER), |
2086 | - Eq (testing_values::TITLEBAR_ACTION_SHADE))).WillOnce (Return (TRUE)); |
2087 | - |
2088 | - EXPECT_CALL (writableGMock, dispose ()); |
2089 | - EXPECT_CALL (writableGMock, finalize ()); |
2090 | - |
2091 | - gwd_settings_writable_freeze_updates (writableMock.get ()); |
2092 | - gwd_settings_writable_thaw_updates (writableMock.get ()); |
2093 | - |
2094 | - EXPECT_THAT (gwd_settings_writable_shadow_property_changed (writableMock.get (), |
2095 | - testing_values::ACTIVE_SHADOW_RADIUS_VALUE, |
2096 | - testing_values::ACTIVE_SHADOW_OPACITY_VALUE, |
2097 | - testing_values::ACTIVE_SHADOW_OFFSET_X_VALUE, |
2098 | - testing_values::ACTIVE_SHADOW_OFFSET_Y_VALUE, |
2099 | - testing_values::ACTIVE_SHADOW_COLOR_STR_VALUE.c_str (), |
2100 | - testing_values::INACTIVE_SHADOW_RADIUS_VALUE, |
2101 | - testing_values::INACTIVE_SHADOW_OPACITY_VALUE, |
2102 | - testing_values::INACTIVE_SHADOW_OFFSET_X_VALUE, |
2103 | - testing_values::INACTIVE_SHADOW_OFFSET_Y_VALUE, |
2104 | - testing_values::INACTIVE_SHADOW_COLOR_STR_VALUE.c_str ()), IsTrue ()); |
2105 | - EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (writableMock.get (), testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2106 | - EXPECT_THAT (gwd_settings_writable_blur_changed (writableMock.get (), testing_values::BLUR_TYPE_TITLEBAR_VALUE.c_str ()), IsTrue ()); |
2107 | - EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (writableMock.get (), |
2108 | - testing_values::USE_METACITY_THEME_VALUE, |
2109 | - testing_values::METACITY_THEME_VALUE.c_str ()), IsTrue ()); |
2110 | - EXPECT_THAT (gwd_settings_writable_opacity_changed (writableMock.get (), |
2111 | - testing_values::ACTIVE_OPACITY_VALUE, |
2112 | - testing_values::INACTIVE_OPACITY_VALUE, |
2113 | - testing_values::ACTIVE_SHADE_OPACITY_VALUE, |
2114 | - testing_values::INACTIVE_SHADE_OPACITY_VALUE), IsTrue ()); |
2115 | - EXPECT_THAT (gwd_settings_writable_button_layout_changed (writableMock.get (), |
2116 | - testing_values::BUTTON_LAYOUT_VALUE.c_str ()), IsTrue ()); |
2117 | - EXPECT_THAT (gwd_settings_writable_font_changed (writableMock.get (), |
2118 | - testing_values::USE_SYSTEM_FONT_VALUE, |
2119 | - testing_values::TITLEBAR_FONT_VALUE.c_str ()), IsTrue ()); |
2120 | - EXPECT_THAT (gwd_settings_writable_titlebar_actions_changed (writableMock.get (), |
2121 | - testing_values::TITLEBAR_ACTION_MAX.c_str (), |
2122 | - testing_values::TITLEBAR_ACTION_MENU.c_str (), |
2123 | - testing_values::TITLEBAR_ACTION_LOWER.c_str (), |
2124 | - testing_values::TITLEBAR_ACTION_SHADE.c_str ()), IsTrue ()); |
2125 | -} |
2126 | - |
2127 | class GWDMockSettingsNotifiedGMock |
2128 | { |
2129 | public: |
2130 | @@ -429,7 +338,7 @@ |
2131 | { |
2132 | GWDSettingsTestCommon::SetUp (); |
2133 | |
2134 | - mSettings.reset (gwd_settings_new (NULL, NULL), boost::bind (gwd_settings_unref, _1)); |
2135 | + mSettings.reset (gwd_settings_new (BLUR_TYPE_UNSET, NULL), boost::bind (gwd_settings_unref, _1)); |
2136 | mGMockNotified.reset (new StrictMock <GWDMockSettingsNotifiedGMock> (mSettings)); |
2137 | |
2138 | ExpectAllNotificationsOnce (); |
2139 | @@ -449,7 +358,7 @@ |
2140 | EXPECT_CALL (*mGMockNotified, updateFrames ()).Times (1); |
2141 | EXPECT_CALL (*mGMockNotified, updateDecorations ()).Times (1); |
2142 | |
2143 | - gwd_settings_writable_thaw_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ())); |
2144 | + gwd_settings_thaw_updates (mSettings.get ()); |
2145 | } |
2146 | |
2147 | }; |
2148 | @@ -466,51 +375,51 @@ |
2149 | /* We're just using use_tooltips here as an example */ |
2150 | TEST_F(GWDSettingsTest, TestFreezeUpdatesNoUpdates) |
2151 | { |
2152 | - gwd_settings_writable_freeze_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ())); |
2153 | - EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2154 | - testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2155 | + gwd_settings_freeze_updates (mSettings.get ()); |
2156 | + EXPECT_THAT (gwd_settings_use_tooltips_changed (mSettings.get (), |
2157 | + testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2158 | } |
2159 | |
2160 | /* We're just using use_tooltips here as an example */ |
2161 | TEST_F(GWDSettingsTest, TestFreezeUpdatesNoUpdatesThawUpdatesAllUpdates) |
2162 | { |
2163 | - gwd_settings_writable_freeze_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ())); |
2164 | - EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2165 | - testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2166 | + gwd_settings_freeze_updates (mSettings.get ()); |
2167 | + EXPECT_THAT (gwd_settings_use_tooltips_changed (mSettings.get (), |
2168 | + testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2169 | |
2170 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2171 | - gwd_settings_writable_thaw_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ())); |
2172 | + gwd_settings_thaw_updates (mSettings.get ()); |
2173 | } |
2174 | |
2175 | /* We're just using use_tooltips here as an example */ |
2176 | TEST_F(GWDSettingsTest, TestFreezeUpdatesNoUpdatesThawUpdatesAllUpdatesNoDupes) |
2177 | { |
2178 | - gwd_settings_writable_freeze_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ())); |
2179 | - EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2180 | - testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2181 | - EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2182 | - !testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2183 | - EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2184 | - testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2185 | + gwd_settings_freeze_updates (mSettings.get ()); |
2186 | + EXPECT_THAT (gwd_settings_use_tooltips_changed (mSettings.get (), |
2187 | + testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2188 | + EXPECT_THAT (gwd_settings_use_tooltips_changed (mSettings.get (), |
2189 | + !testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2190 | + EXPECT_THAT (gwd_settings_use_tooltips_changed (mSettings.get (), |
2191 | + testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2192 | |
2193 | EXPECT_CALL (*mGMockNotified, updateDecorations ()).Times (1); |
2194 | - gwd_settings_writable_thaw_updates (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ())); |
2195 | + gwd_settings_thaw_updates (mSettings.get ()); |
2196 | } |
2197 | |
2198 | TEST_F(GWDSettingsTest, TestShadowPropertyChanged) |
2199 | { |
2200 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2201 | - EXPECT_THAT (gwd_settings_writable_shadow_property_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2202 | - testing_values::ACTIVE_SHADOW_OPACITY_VALUE, |
2203 | - testing_values::ACTIVE_SHADOW_RADIUS_VALUE, |
2204 | - testing_values::ACTIVE_SHADOW_OFFSET_X_VALUE, |
2205 | - testing_values::ACTIVE_SHADOW_OFFSET_Y_VALUE, |
2206 | - testing_values::ACTIVE_SHADOW_COLOR_STR_VALUE.c_str (), |
2207 | - testing_values::INACTIVE_SHADOW_OPACITY_VALUE, |
2208 | - testing_values::INACTIVE_SHADOW_RADIUS_VALUE, |
2209 | - testing_values::INACTIVE_SHADOW_OFFSET_X_VALUE, |
2210 | - testing_values::INACTIVE_SHADOW_OFFSET_Y_VALUE, |
2211 | - testing_values::INACTIVE_SHADOW_COLOR_STR_VALUE.c_str ()), IsTrue ()); |
2212 | + EXPECT_THAT (gwd_settings_shadow_property_changed (mSettings.get (), |
2213 | + testing_values::ACTIVE_SHADOW_OPACITY_VALUE, |
2214 | + testing_values::ACTIVE_SHADOW_RADIUS_VALUE, |
2215 | + testing_values::ACTIVE_SHADOW_OFFSET_X_VALUE, |
2216 | + testing_values::ACTIVE_SHADOW_OFFSET_Y_VALUE, |
2217 | + testing_values::ACTIVE_SHADOW_COLOR_STR_VALUE.c_str (), |
2218 | + testing_values::INACTIVE_SHADOW_OPACITY_VALUE, |
2219 | + testing_values::INACTIVE_SHADOW_RADIUS_VALUE, |
2220 | + testing_values::INACTIVE_SHADOW_OFFSET_X_VALUE, |
2221 | + testing_values::INACTIVE_SHADOW_OFFSET_Y_VALUE, |
2222 | + testing_values::INACTIVE_SHADOW_COLOR_STR_VALUE.c_str ()), IsTrue ()); |
2223 | |
2224 | AutoUnsetGValue activeShadowValue (G_TYPE_POINTER); |
2225 | AutoUnsetGValue inactiveShadowValue (G_TYPE_POINTER); |
2226 | @@ -554,24 +463,24 @@ |
2227 | |
2228 | TEST_F(GWDSettingsTest, TestShadowPropertyChangedIsDefault) |
2229 | { |
2230 | - EXPECT_THAT (gwd_settings_writable_shadow_property_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2231 | - ACTIVE_SHADOW_RADIUS_DEFAULT, |
2232 | - ACTIVE_SHADOW_OPACITY_DEFAULT, |
2233 | - ACTIVE_SHADOW_OFFSET_X_DEFAULT, |
2234 | - ACTIVE_SHADOW_OFFSET_Y_DEFAULT, |
2235 | - ACTIVE_SHADOW_COLOR_DEFAULT, |
2236 | - INACTIVE_SHADOW_RADIUS_DEFAULT, |
2237 | - INACTIVE_SHADOW_OPACITY_DEFAULT, |
2238 | - INACTIVE_SHADOW_OFFSET_X_DEFAULT, |
2239 | - INACTIVE_SHADOW_OFFSET_Y_DEFAULT, |
2240 | - INACTIVE_SHADOW_COLOR_DEFAULT), IsFalse ()); |
2241 | + EXPECT_THAT (gwd_settings_shadow_property_changed (mSettings.get (), |
2242 | + ACTIVE_SHADOW_RADIUS_DEFAULT, |
2243 | + ACTIVE_SHADOW_OPACITY_DEFAULT, |
2244 | + ACTIVE_SHADOW_OFFSET_X_DEFAULT, |
2245 | + ACTIVE_SHADOW_OFFSET_Y_DEFAULT, |
2246 | + ACTIVE_SHADOW_COLOR_DEFAULT, |
2247 | + INACTIVE_SHADOW_RADIUS_DEFAULT, |
2248 | + INACTIVE_SHADOW_OPACITY_DEFAULT, |
2249 | + INACTIVE_SHADOW_OFFSET_X_DEFAULT, |
2250 | + INACTIVE_SHADOW_OFFSET_Y_DEFAULT, |
2251 | + INACTIVE_SHADOW_COLOR_DEFAULT), IsFalse ()); |
2252 | } |
2253 | |
2254 | TEST_F(GWDSettingsTest, TestUseTooltipsChanged) |
2255 | { |
2256 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2257 | - EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2258 | - testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2259 | + EXPECT_THAT (gwd_settings_use_tooltips_changed (mSettings.get (), |
2260 | + testing_values::USE_TOOLTIPS_VALUE), IsTrue ()); |
2261 | |
2262 | AutoUnsetGValue useTooltipsValue (G_TYPE_BOOLEAN); |
2263 | GValue &useTooltipsGValue = useTooltipsValue; |
2264 | @@ -586,15 +495,15 @@ |
2265 | |
2266 | TEST_F(GWDSettingsTest, TestUseTooltipsChangedIsDefault) |
2267 | { |
2268 | - EXPECT_THAT (gwd_settings_writable_use_tooltips_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2269 | - USE_TOOLTIPS_DEFAULT), IsFalse ()); |
2270 | + EXPECT_THAT (gwd_settings_use_tooltips_changed (mSettings.get (), |
2271 | + USE_TOOLTIPS_DEFAULT), IsFalse ()); |
2272 | } |
2273 | |
2274 | TEST_F(GWDSettingsTest, TestBlurChangedTitlebar) |
2275 | { |
2276 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2277 | - EXPECT_THAT (gwd_settings_writable_blur_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2278 | - testing_values::BLUR_TYPE_TITLEBAR_VALUE.c_str ()), IsTrue ()); |
2279 | + EXPECT_THAT (gwd_settings_blur_changed (mSettings.get (), |
2280 | + testing_values::BLUR_TYPE_TITLEBAR_VALUE.c_str ()), IsTrue ()); |
2281 | |
2282 | AutoUnsetGValue blurValue (G_TYPE_INT); |
2283 | GValue &blurGValue = blurValue; |
2284 | @@ -610,8 +519,8 @@ |
2285 | TEST_F(GWDSettingsTest, TestBlurChangedAll) |
2286 | { |
2287 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2288 | - EXPECT_THAT (gwd_settings_writable_blur_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2289 | - testing_values::BLUR_TYPE_ALL_VALUE.c_str ()), IsTrue ()); |
2290 | + EXPECT_THAT (gwd_settings_blur_changed (mSettings.get (), |
2291 | + testing_values::BLUR_TYPE_ALL_VALUE.c_str ()), IsTrue ()); |
2292 | |
2293 | AutoUnsetGValue blurValue (G_TYPE_INT); |
2294 | GValue &blurGValue = blurValue; |
2295 | @@ -626,8 +535,8 @@ |
2296 | |
2297 | TEST_F(GWDSettingsTest, TestBlurChangedNone) |
2298 | { |
2299 | - EXPECT_THAT (gwd_settings_writable_blur_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2300 | - testing_values::BLUR_TYPE_NONE_VALUE.c_str ()), IsFalse ()); |
2301 | + EXPECT_THAT (gwd_settings_blur_changed (mSettings.get (), |
2302 | + testing_values::BLUR_TYPE_NONE_VALUE.c_str ()), IsFalse ()); |
2303 | |
2304 | AutoUnsetGValue blurValue (G_TYPE_INT); |
2305 | GValue &blurGValue = blurValue; |
2306 | @@ -644,11 +553,11 @@ |
2307 | { |
2308 | gint blurType = testing_values::BLUR_TYPE_ALL_INT_VALUE; |
2309 | |
2310 | - mSettings.reset (gwd_settings_new (&blurType, NULL), |
2311 | + mSettings.reset (gwd_settings_new (blurType, NULL), |
2312 | boost::bind (gwd_settings_unref, _1)); |
2313 | |
2314 | - EXPECT_THAT (gwd_settings_writable_blur_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2315 | - testing_values::BLUR_TYPE_NONE_VALUE.c_str ()), IsFalse ()); |
2316 | + EXPECT_THAT (gwd_settings_blur_changed (mSettings.get (), |
2317 | + testing_values::BLUR_TYPE_NONE_VALUE.c_str ()), IsFalse ()); |
2318 | |
2319 | AutoUnsetGValue blurValue (G_TYPE_INT); |
2320 | GValue &blurGValue = blurValue; |
2321 | @@ -665,9 +574,9 @@ |
2322 | { |
2323 | EXPECT_CALL (*mGMockNotified, updateMetacityTheme ()); |
2324 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2325 | - EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2326 | - testing_values::USE_METACITY_THEME_VALUE, |
2327 | - testing_values::METACITY_THEME_VALUE.c_str ()), IsTrue ()); |
2328 | + EXPECT_THAT (gwd_settings_metacity_theme_changed (mSettings.get (), |
2329 | + testing_values::USE_METACITY_THEME_VALUE, |
2330 | + testing_values::METACITY_THEME_VALUE.c_str ()), IsTrue ()); |
2331 | |
2332 | AutoUnsetGValue metacityThemeValue (G_TYPE_STRING); |
2333 | GValue &metacityThemeGValue = metacityThemeValue; |
2334 | @@ -684,9 +593,9 @@ |
2335 | { |
2336 | EXPECT_CALL (*mGMockNotified, updateMetacityTheme ()); |
2337 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2338 | - EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2339 | - testing_values::NO_USE_METACITY_THEME_VALUE, |
2340 | - testing_values::METACITY_THEME_VALUE.c_str ()), IsTrue ()); |
2341 | + EXPECT_THAT (gwd_settings_metacity_theme_changed (mSettings.get (), |
2342 | + testing_values::NO_USE_METACITY_THEME_VALUE, |
2343 | + testing_values::METACITY_THEME_VALUE.c_str ()), IsTrue ()); |
2344 | |
2345 | AutoUnsetGValue metacityThemeValue (G_TYPE_STRING); |
2346 | GValue &metacityThemeGValue = metacityThemeValue; |
2347 | @@ -701,21 +610,21 @@ |
2348 | |
2349 | TEST_F(GWDSettingsTest, TestMetacityThemeChangedIsDefault) |
2350 | { |
2351 | - EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2352 | - testing_values::USE_METACITY_THEME_VALUE, |
2353 | - METACITY_THEME_DEFAULT), IsFalse ()); |
2354 | + EXPECT_THAT (gwd_settings_metacity_theme_changed (mSettings.get (), |
2355 | + testing_values::USE_METACITY_THEME_VALUE, |
2356 | + METACITY_THEME_DEFAULT), IsFalse ()); |
2357 | } |
2358 | |
2359 | TEST_F(GWDSettingsTest, TestMetacityThemeSetCommandLine) |
2360 | { |
2361 | const gchar *metacityTheme = "Ambiance"; |
2362 | |
2363 | - mSettings.reset (gwd_settings_new (NULL, &metacityTheme), |
2364 | + mSettings.reset (gwd_settings_new (BLUR_TYPE_UNSET, metacityTheme), |
2365 | boost::bind (gwd_settings_unref, _1)); |
2366 | |
2367 | - EXPECT_THAT (gwd_settings_writable_metacity_theme_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2368 | - testing_values::USE_METACITY_THEME_VALUE, |
2369 | - testing_values::METACITY_THEME_VALUE.c_str ()), IsFalse ()); |
2370 | + EXPECT_THAT (gwd_settings_metacity_theme_changed (mSettings.get (), |
2371 | + testing_values::USE_METACITY_THEME_VALUE, |
2372 | + testing_values::METACITY_THEME_VALUE.c_str ()), IsFalse ()); |
2373 | |
2374 | AutoUnsetGValue metacityThemeValue (G_TYPE_STRING); |
2375 | GValue &metacityThemeGValue = metacityThemeValue; |
2376 | @@ -731,11 +640,11 @@ |
2377 | TEST_F(GWDSettingsTest, TestMetacityOpacityChanged) |
2378 | { |
2379 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2380 | - EXPECT_THAT (gwd_settings_writable_opacity_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2381 | - testing_values::ACTIVE_OPACITY_VALUE, |
2382 | - testing_values::INACTIVE_OPACITY_VALUE, |
2383 | - testing_values::ACTIVE_SHADE_OPACITY_VALUE, |
2384 | - testing_values::INACTIVE_SHADE_OPACITY_VALUE), IsTrue ()); |
2385 | + EXPECT_THAT (gwd_settings_opacity_changed (mSettings.get (), |
2386 | + testing_values::ACTIVE_OPACITY_VALUE, |
2387 | + testing_values::INACTIVE_OPACITY_VALUE, |
2388 | + testing_values::ACTIVE_SHADE_OPACITY_VALUE, |
2389 | + testing_values::INACTIVE_SHADE_OPACITY_VALUE), IsTrue ()); |
2390 | |
2391 | AutoUnsetGValue metacityInactiveOpacityValue (G_TYPE_DOUBLE); |
2392 | AutoUnsetGValue metacityActiveOpacityValue (G_TYPE_DOUBLE); |
2393 | @@ -772,19 +681,19 @@ |
2394 | |
2395 | TEST_F(GWDSettingsTest, TestMetacityOpacityChangedIsDefault) |
2396 | { |
2397 | - EXPECT_THAT (gwd_settings_writable_opacity_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2398 | - METACITY_ACTIVE_OPACITY_DEFAULT, |
2399 | - METACITY_INACTIVE_OPACITY_DEFAULT, |
2400 | - METACITY_ACTIVE_SHADE_OPACITY_DEFAULT, |
2401 | - METACITY_INACTIVE_SHADE_OPACITY_DEFAULT), IsFalse ()); |
2402 | + EXPECT_THAT (gwd_settings_opacity_changed (mSettings.get (), |
2403 | + METACITY_ACTIVE_OPACITY_DEFAULT, |
2404 | + METACITY_INACTIVE_OPACITY_DEFAULT, |
2405 | + METACITY_ACTIVE_SHADE_OPACITY_DEFAULT, |
2406 | + METACITY_INACTIVE_SHADE_OPACITY_DEFAULT), IsFalse ()); |
2407 | } |
2408 | |
2409 | TEST_F(GWDSettingsTest, TestButtonLayoutChanged) |
2410 | { |
2411 | EXPECT_CALL (*mGMockNotified, updateMetacityButtonLayout ()); |
2412 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2413 | - EXPECT_THAT (gwd_settings_writable_button_layout_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2414 | - testing_values::BUTTON_LAYOUT_VALUE.c_str ()), IsTrue ()); |
2415 | + EXPECT_THAT (gwd_settings_button_layout_changed (mSettings.get (), |
2416 | + testing_values::BUTTON_LAYOUT_VALUE.c_str ()), IsTrue ()); |
2417 | |
2418 | AutoUnsetGValue buttonLayoutValue (G_TYPE_STRING); |
2419 | GValue &buttonLayoutGValue = buttonLayoutValue; |
2420 | @@ -799,17 +708,17 @@ |
2421 | |
2422 | TEST_F(GWDSettingsTest, TestButtonLayoutChangedIsDefault) |
2423 | { |
2424 | - EXPECT_THAT (gwd_settings_writable_button_layout_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2425 | - METACITY_BUTTON_LAYOUT_DEFAULT), IsFalse ()); |
2426 | + EXPECT_THAT (gwd_settings_button_layout_changed (mSettings.get (), |
2427 | + METACITY_BUTTON_LAYOUT_DEFAULT), IsFalse ()); |
2428 | } |
2429 | |
2430 | TEST_F(GWDSettingsTest, TestTitlebarFontChanged) |
2431 | { |
2432 | EXPECT_CALL (*mGMockNotified, updateFrames ()); |
2433 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2434 | - EXPECT_THAT (gwd_settings_writable_font_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2435 | - testing_values::NO_USE_SYSTEM_FONT_VALUE, |
2436 | - testing_values::TITLEBAR_FONT_VALUE.c_str ()), IsTrue ()); |
2437 | + EXPECT_THAT (gwd_settings_font_changed (mSettings.get (), |
2438 | + testing_values::NO_USE_SYSTEM_FONT_VALUE, |
2439 | + testing_values::TITLEBAR_FONT_VALUE.c_str ()), IsTrue ()); |
2440 | |
2441 | AutoUnsetGValue fontValue (G_TYPE_STRING); |
2442 | GValue &fontGValue = fontValue; |
2443 | @@ -826,9 +735,9 @@ |
2444 | { |
2445 | EXPECT_CALL (*mGMockNotified, updateFrames ()); |
2446 | EXPECT_CALL (*mGMockNotified, updateDecorations ()); |
2447 | - EXPECT_THAT (gwd_settings_writable_font_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2448 | - testing_values::USE_SYSTEM_FONT_VALUE, |
2449 | - testing_values::TITLEBAR_FONT_VALUE.c_str ()), IsTrue ()); |
2450 | + EXPECT_THAT (gwd_settings_font_changed (mSettings.get (), |
2451 | + testing_values::USE_SYSTEM_FONT_VALUE, |
2452 | + testing_values::TITLEBAR_FONT_VALUE.c_str ()), IsTrue ()); |
2453 | |
2454 | AutoUnsetGValue fontValue (G_TYPE_STRING); |
2455 | GValue &fontGValue = fontValue; |
2456 | @@ -844,9 +753,9 @@ |
2457 | |
2458 | TEST_F(GWDSettingsTest, TestTitlebarFontChangedIsDefault) |
2459 | { |
2460 | - EXPECT_THAT (gwd_settings_writable_font_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2461 | - testing_values::NO_USE_SYSTEM_FONT_VALUE, |
2462 | - TITLEBAR_FONT_DEFAULT), IsFalse ()); |
2463 | + EXPECT_THAT (gwd_settings_font_changed (mSettings.get (), |
2464 | + testing_values::NO_USE_SYSTEM_FONT_VALUE, |
2465 | + TITLEBAR_FONT_DEFAULT), IsFalse ()); |
2466 | } |
2467 | |
2468 | namespace |
2469 | @@ -889,7 +798,7 @@ |
2470 | virtual void SetUp () |
2471 | { |
2472 | GWDSettingsTestCommon::SetUp (); |
2473 | - mSettings.reset (gwd_settings_new (NULL, NULL), |
2474 | + mSettings.reset (gwd_settings_new (BLUR_TYPE_UNSET, NULL), |
2475 | boost::bind (gwd_settings_unref, _1)); |
2476 | } |
2477 | |
2478 | @@ -900,11 +809,11 @@ |
2479 | |
2480 | TEST_P(GWDSettingsTestClickActions, TestClickActionsAndMouseActions) |
2481 | { |
2482 | - gwd_settings_writable_titlebar_actions_changed (GWD_SETTINGS_WRITABLE_INTERFACE (mSettings.get ()), |
2483 | - GetParam ().titlebarAction ().c_str (), |
2484 | - GetParam ().titlebarAction ().c_str (), |
2485 | - GetParam ().titlebarAction ().c_str (), |
2486 | - GetParam ().mouseWheelAction ().c_str ()); |
2487 | + gwd_settings_titlebar_actions_changed (mSettings.get (), |
2488 | + GetParam ().titlebarAction ().c_str (), |
2489 | + GetParam ().titlebarAction ().c_str (), |
2490 | + GetParam ().titlebarAction ().c_str (), |
2491 | + GetParam ().mouseWheelAction ().c_str ()); |
2492 | |
2493 | AutoUnsetGValue doubleClickActionValue (G_TYPE_INT); |
2494 | AutoUnsetGValue middleClickActionValue (G_TYPE_INT); |
2495 | @@ -967,293 +876,3 @@ |
2496 | testing_values::MOUSE_WHEEL_ACTION_SHADE, |
2497 | CLICK_ACTION_MENU, |
2498 | WHEEL_ACTION_SHADE))); |
2499 | - |
2500 | -class GWDSettingsStorageFactoryWrapperInterface |
2501 | -{ |
2502 | - public: |
2503 | - |
2504 | - typedef boost::shared_ptr <GWDSettingsStorageFactoryWrapperInterface> Ptr; |
2505 | - virtual ~GWDSettingsStorageFactoryWrapperInterface () {} |
2506 | - |
2507 | - virtual void SetUp (GWDSettingsWritable *writable) = 0; |
2508 | - virtual GWDSettingsStorage * GetStorage () = 0; |
2509 | - virtual void SetUseTooltips (gboolean useTooltips) = 0; |
2510 | - virtual void SetBlur (const std::string &blurType) = 0; |
2511 | - virtual void SetOpacity (gdouble activeOpacity, |
2512 | - gdouble inactiveOpacity, |
2513 | - gboolean activeShadeOpacity, |
2514 | - gboolean inactiveShadeOpacity) = 0; |
2515 | - virtual void SetMetacityTheme (gboolean useMetacityTheme, |
2516 | - const std::string &metacityTheme) = 0; |
2517 | - virtual void SetButtonLayout (const std::string &buttonLayout) = 0; |
2518 | - virtual void SetFont (gboolean useSystemFont, const std::string &titlebarFont) = 0; |
2519 | - virtual void SetTitlebarActions (const std::string &doubleClickAction, |
2520 | - const std::string &middleClickAction, |
2521 | - const std::string &rightClickAction, |
2522 | - const std::string &mouseWheelAction) = 0; |
2523 | - virtual void TearDown () = 0; |
2524 | -}; |
2525 | - |
2526 | -class GWDSettingsTestStorageUpdates : |
2527 | - public GWDSettingsTestCommon, |
2528 | - public ::testing::WithParamInterface <GWDSettingsStorageFactoryWrapperInterface::Ptr> |
2529 | -{ |
2530 | - public: |
2531 | - |
2532 | - virtual void SetUp () |
2533 | - { |
2534 | - GWDSettingsTestCommon::SetUp (); |
2535 | - mSettingsMock.reset (new GWDMockSettingsWritableGMock ()); |
2536 | - mSettings.reset (gwd_mock_settings_writable_new (mSettingsMock.get ()), |
2537 | - boost::bind (gwd_settings_writable_unref, _1)); |
2538 | - |
2539 | - GetParam ()->SetUp (mSettings.get ()); |
2540 | - } |
2541 | - |
2542 | - virtual void TearDown () |
2543 | - { |
2544 | - EXPECT_CALL (*mSettingsMock, dispose ()); |
2545 | - EXPECT_CALL (*mSettingsMock, finalize ()); |
2546 | - |
2547 | - GetParam ()->TearDown (); |
2548 | - GWDSettingsTestCommon::TearDown (); |
2549 | - } |
2550 | - |
2551 | - protected: |
2552 | - |
2553 | - boost::shared_ptr <GWDMockSettingsWritableGMock> mSettingsMock; |
2554 | - boost::shared_ptr <GWDSettingsWritable> mSettings; |
2555 | -}; |
2556 | - |
2557 | -ACTION_P (InvokeFunctor, p) { return p (); } |
2558 | - |
2559 | -TEST_P (GWDSettingsTestStorageUpdates, TestInstantiation) |
2560 | -{ |
2561 | -} |
2562 | - |
2563 | -TEST_P (GWDSettingsTestStorageUpdates, TestSetUseTooltips) |
2564 | -{ |
2565 | - GWDSettingsStorage *storage = GetParam ()->GetStorage (); |
2566 | - GetParam ()->SetUseTooltips (testing_values::USE_TOOLTIPS_VALUE); |
2567 | - |
2568 | - EXPECT_CALL (*mSettingsMock, useTooltipsChanged (testing_values::USE_TOOLTIPS_VALUE)); |
2569 | - |
2570 | - gwd_settings_storage_update_use_tooltips (storage); |
2571 | -} |
2572 | - |
2573 | -TEST_P (GWDSettingsTestStorageUpdates, TestSetBlur) |
2574 | -{ |
2575 | - GWDSettingsStorage *storage = GetParam ()->GetStorage (); |
2576 | - GetParam ()->SetBlur (testing_values::BLUR_TYPE_ALL_VALUE); |
2577 | - |
2578 | - EXPECT_CALL (*mSettingsMock, blurChanged (Eq (testing_values::BLUR_TYPE_ALL_VALUE))); |
2579 | - |
2580 | - gwd_settings_storage_update_blur (storage); |
2581 | -} |
2582 | - |
2583 | -TEST_P (GWDSettingsTestStorageUpdates, TestSetButtonLayout) |
2584 | -{ |
2585 | - GWDSettingsStorage *storage = GetParam ()->GetStorage (); |
2586 | - GetParam ()->SetButtonLayout (testing_values::BUTTON_LAYOUT_VALUE); |
2587 | - |
2588 | - EXPECT_CALL (*mSettingsMock, buttonLayoutChanged (Eq (testing_values::BUTTON_LAYOUT_VALUE))); |
2589 | - |
2590 | - gwd_settings_storage_update_button_layout (storage); |
2591 | -} |
2592 | - |
2593 | -TEST_P (GWDSettingsTestStorageUpdates, TestSetOpacity) |
2594 | -{ |
2595 | - GWDSettingsStorage *storage = GetParam ()->GetStorage (); |
2596 | - GetParam ()->SetOpacity (testing_values::ACTIVE_OPACITY_VALUE, |
2597 | - testing_values::INACTIVE_OPACITY_VALUE, |
2598 | - testing_values::ACTIVE_SHADE_OPACITY_VALUE, |
2599 | - testing_values::INACTIVE_SHADE_OPACITY_VALUE); |
2600 | - |
2601 | - EXPECT_CALL (*mSettingsMock, opacityChanged (testing_values::ACTIVE_OPACITY_VALUE, |
2602 | - testing_values::INACTIVE_OPACITY_VALUE, |
2603 | - testing_values::ACTIVE_SHADE_OPACITY_VALUE, |
2604 | - testing_values::INACTIVE_SHADE_OPACITY_VALUE)); |
2605 | - |
2606 | - gwd_settings_storage_update_opacity (storage); |
2607 | -} |
2608 | - |
2609 | -TEST_P (GWDSettingsTestStorageUpdates, TestSetMetacityTheme) |
2610 | -{ |
2611 | - GWDSettingsStorage *storage = GetParam ()->GetStorage (); |
2612 | - GetParam ()->SetMetacityTheme (testing_values::USE_METACITY_THEME_VALUE, |
2613 | - testing_values::METACITY_THEME_VALUE); |
2614 | - |
2615 | - EXPECT_CALL (*mSettingsMock, metacityThemeChanged (testing_values::USE_METACITY_THEME_VALUE, |
2616 | - Eq (testing_values::METACITY_THEME_VALUE))); |
2617 | - |
2618 | - gwd_settings_storage_update_metacity_theme (storage); |
2619 | -} |
2620 | - |
2621 | -TEST_P (GWDSettingsTestStorageUpdates, TestSetFont) |
2622 | -{ |
2623 | - GWDSettingsStorage *storage = GetParam ()->GetStorage (); |
2624 | - GetParam ()->SetFont (testing_values::USE_SYSTEM_FONT_VALUE, |
2625 | - testing_values::TITLEBAR_FONT_VALUE); |
2626 | - |
2627 | - EXPECT_CALL (*mSettingsMock, fontChanged (testing_values::USE_SYSTEM_FONT_VALUE, |
2628 | - Eq (testing_values::TITLEBAR_FONT_VALUE))); |
2629 | - |
2630 | - gwd_settings_storage_update_font (storage); |
2631 | -} |
2632 | - |
2633 | -TEST_P (GWDSettingsTestStorageUpdates, TestSetTitlebarActions) |
2634 | -{ |
2635 | - GWDSettingsStorage *storage = GetParam ()->GetStorage (); |
2636 | - GetParam ()->SetTitlebarActions (testing_values::TITLEBAR_ACTION_LOWER, |
2637 | - testing_values::TITLEBAR_ACTION_MAX, |
2638 | - testing_values::TITLEBAR_ACTION_MENU, |
2639 | - testing_values::TITLEBAR_ACTION_SHADE); |
2640 | - |
2641 | - EXPECT_CALL (*mSettingsMock, titlebarActionsChanged (Eq (testing_values::TITLEBAR_ACTION_LOWER), |
2642 | - Eq (testing_values::TITLEBAR_ACTION_MAX), |
2643 | - Eq (testing_values::TITLEBAR_ACTION_MENU), |
2644 | - Eq (testing_values::TITLEBAR_ACTION_SHADE))); |
2645 | - |
2646 | - gwd_settings_storage_update_titlebar_actions (storage); |
2647 | -} |
2648 | - |
2649 | -class GWDSettingsStorageGSettingsFactoryWrapper : |
2650 | - public GWDSettingsStorageFactoryWrapperInterface |
2651 | -{ |
2652 | - public: |
2653 | - |
2654 | - virtual void SetUp (GWDSettingsWritable *writable) |
2655 | - { |
2656 | - gsliceEnv.SetUpEnv (); |
2657 | - gsettingsEnv.SetUpEnv (MOCK_PATH); |
2658 | - |
2659 | - mStorage.reset (gwd_settings_storage_new (writable, FALSE), |
2660 | - boost::bind (gwd_settings_storage_unref, _1)); |
2661 | - |
2662 | - /* We do not need to keep a reference to these */ |
2663 | - mGWDSettings = gwd_get_org_compiz_gwd_settings (GetStorage ()); |
2664 | - mMetacitySettings = gwd_get_org_gnome_metacity_settings (GetStorage ()); |
2665 | - mDesktopSettings = gwd_get_org_gnome_desktop_wm_preferences_settings (GetStorage ()); |
2666 | - mMarcoSettings = gwd_get_org_mate_marco_general_settings (GetStorage ()); |
2667 | - } |
2668 | - |
2669 | - virtual GWDSettingsStorage * GetStorage () |
2670 | - { |
2671 | - return mStorage.get (); |
2672 | - } |
2673 | - |
2674 | - virtual void SetUseTooltips (gboolean useTooltips) |
2675 | - { |
2676 | - g_settings_set_boolean (mGWDSettings, ORG_COMPIZ_GWD_KEY_USE_TOOLTIPS, useTooltips); |
2677 | - } |
2678 | - |
2679 | - virtual void SetBlur (const std::string &blurType) |
2680 | - { |
2681 | - g_settings_set_string (mGWDSettings, ORG_COMPIZ_GWD_KEY_BLUR_TYPE, blurType.c_str ()); |
2682 | - } |
2683 | - |
2684 | - virtual void SetOpacity (gdouble activeOpacity, |
2685 | - gdouble inactiveOpacity, |
2686 | - gboolean activeShadeOpacity, |
2687 | - gboolean inactiveShadeOpacity) |
2688 | - { |
2689 | - g_settings_set_double (mGWDSettings, ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_OPACITY, activeOpacity); |
2690 | - g_settings_set_double (mGWDSettings, ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_OPACITY, inactiveOpacity); |
2691 | - g_settings_set_boolean (mGWDSettings, ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_SHADE_OPACITY, activeShadeOpacity); |
2692 | - g_settings_set_boolean (mGWDSettings, ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_SHADE_OPACITY, inactiveShadeOpacity); |
2693 | - } |
2694 | - |
2695 | - virtual void SetMetacityTheme (gboolean useMetacityTheme, |
2696 | - const std::string &metacityTheme) |
2697 | - { |
2698 | - g_settings_set_boolean (mGWDSettings, ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME, useMetacityTheme); |
2699 | - g_settings_set_string (mDesktopSettings, ORG_GNOME_DESKTOP_WM_PREFERENCES_THEME, metacityTheme.c_str ()); |
2700 | - g_settings_set_string (mMarcoSettings, ORG_MATE_MARCO_GENERAL_THEME, metacityTheme.c_str ()); |
2701 | - } |
2702 | - |
2703 | - virtual void SetButtonLayout (const std::string &buttonLayout) |
2704 | - { |
2705 | - g_settings_set_string (mDesktopSettings, |
2706 | - ORG_GNOME_DESKTOP_WM_PREFERENCES_BUTTON_LAYOUT, |
2707 | - buttonLayout.c_str ()); |
2708 | - g_settings_set_string (mMarcoSettings, |
2709 | - ORG_MATE_MARCO_GENERAL_BUTTON_LAYOUT, |
2710 | - buttonLayout.c_str ()); |
2711 | - } |
2712 | - |
2713 | - virtual void SetFont (gboolean useSystemFont, const std::string &titlebarFont) |
2714 | - { |
2715 | - g_settings_set_boolean (mDesktopSettings, |
2716 | - ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_USES_SYSTEM_FONT, |
2717 | - useSystemFont); |
2718 | - g_settings_set_string (mDesktopSettings, |
2719 | - ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_FONT, |
2720 | - titlebarFont.c_str ()); |
2721 | - g_settings_set_boolean (mMarcoSettings, |
2722 | - ORG_MATE_MARCO_GENERAL_TITLEBAR_USES_SYSTEM_FONT, |
2723 | - useSystemFont); |
2724 | - g_settings_set_string (mMarcoSettings, |
2725 | - ORG_MATE_MARCO_GENERAL_TITLEBAR_FONT, |
2726 | - titlebarFont.c_str ()); |
2727 | - } |
2728 | - |
2729 | - virtual void SetTitlebarActions (const std::string &doubleClickAction, |
2730 | - const std::string &middleClickAction, |
2731 | - const std::string &rightClickAction, |
2732 | - const std::string &mouseWheelAction) |
2733 | - { |
2734 | - std::string translatedDC (doubleClickAction); |
2735 | - std::string translatedMC (middleClickAction); |
2736 | - std::string translatedRC (rightClickAction); |
2737 | - |
2738 | - boost::replace_all (translatedDC, "_", "-"); |
2739 | - boost::replace_all (translatedMC, "_", "-"); |
2740 | - boost::replace_all (translatedRC, "_", "-"); |
2741 | - |
2742 | - g_settings_set_string (mDesktopSettings, |
2743 | - ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_DOUBLE_CLICK_TITLEBAR, |
2744 | - translatedDC.c_str ()); |
2745 | - g_settings_set_string (mDesktopSettings, |
2746 | - ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_MIDDLE_CLICK_TITLEBAR, |
2747 | - translatedMC.c_str ()); |
2748 | - g_settings_set_string (mDesktopSettings, |
2749 | - ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_RIGHT_CLICK_TITLEBAR, |
2750 | - translatedRC.c_str ()); |
2751 | - g_settings_set_string (mMarcoSettings, |
2752 | - ORG_MATE_MARCO_GENERAL_ACTION_DOUBLE_CLICK_TITLEBAR, |
2753 | - translatedDC.c_str ()); |
2754 | - g_settings_set_string (mMarcoSettings, |
2755 | - ORG_MATE_MARCO_GENERAL_ACTION_MIDDLE_CLICK_TITLEBAR, |
2756 | - translatedMC.c_str ()); |
2757 | - g_settings_set_string (mMarcoSettings, |
2758 | - ORG_MATE_MARCO_GENERAL_ACTION_RIGHT_CLICK_TITLEBAR, |
2759 | - translatedRC.c_str ()); |
2760 | - g_settings_set_string (mGWDSettings, |
2761 | - ORG_COMPIZ_GWD_KEY_MOUSE_WHEEL_ACTION, |
2762 | - mouseWheelAction.c_str ()); |
2763 | - } |
2764 | - |
2765 | - virtual void TearDown () |
2766 | - { |
2767 | - mStorage.reset (); |
2768 | - mGWDSettings = NULL; |
2769 | - mMetacitySettings = NULL; |
2770 | - mDesktopSettings = NULL; |
2771 | - mMarcoSettings = NULL; |
2772 | - gsettingsEnv.TearDownEnv (); |
2773 | - gsliceEnv.TearDownEnv (); |
2774 | - } |
2775 | - |
2776 | - private: |
2777 | - |
2778 | - GSettings *mGWDSettings; |
2779 | - GSettings *mMetacitySettings; |
2780 | - GSettings *mDesktopSettings; |
2781 | - GSettings *mMarcoSettings; |
2782 | - boost::shared_ptr <GWDSettingsStorage> mStorage; |
2783 | - CompizGLibGSliceOffEnv gsliceEnv; |
2784 | - CompizGLibGSettingsMemoryBackendTestingEnv gsettingsEnv; |
2785 | -}; |
2786 | - |
2787 | -INSTANTIATE_TEST_CASE_P (GSettingsStorageUpdates, GWDSettingsTestStorageUpdates, |
2788 | - ::testing::Values (boost::shared_ptr <GWDSettingsStorageFactoryWrapperInterface> (new GWDSettingsStorageGSettingsFactoryWrapper ()))); |
More or less looks fine to me. I suppose with the simplifications, we don't really need to be testing that setting a value sets a value.
Minor nits in the diff comments but that's it.