Merge lp:~muktupavels/compiz/gwd-remove-settings-storage-interface into lp:compiz/0.9.12
- gwd-remove-settings-storage-interface
- Merge into 0.9.12
Proposed by
Alberts Muktupāvels
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | 4013 |
Merged at revision: | 4018 |
Proposed branch: | lp:~muktupavels/compiz/gwd-remove-settings-storage-interface |
Merge into: | lp:compiz/0.9.12 |
Prerequisite: | lp:~muktupavels/compiz/remove-use-gsettings-option |
Diff against target: |
1843 lines (+453/-1177) 10 files modified
gtk/window-decorator/CMakeLists.txt (+1/-5) gtk/window-decorator/gwd-settings-storage-interface.c (+0/-70) gtk/window-decorator/gwd-settings-storage-interface.h (+0/-63) gtk/window-decorator/gwd-settings-storage.c (+396/-541) gtk/window-decorator/gwd-settings-storage.h (+44/-40) gtk/window-decorator/settings.c (+4/-15) gtk/window-decorator/tests/CMakeLists.txt (+0/-8) gtk/window-decorator/tests/compiz_gwd_mock_settings_storage.cpp (+0/-195) gtk/window-decorator/tests/compiz_gwd_mock_settings_storage.h (+0/-80) gtk/window-decorator/tests/test_gwd_settings.cpp (+8/-160) |
To merge this branch: | bzr merge lp:~muktupavels/compiz/gwd-remove-settings-storage-interface |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Approve | ||
Sam Spilsbury | Approve | ||
Review via email:
|
Commit message
Remove GWDSettingsStor
Description of the change
Remove GWDSettingsStor
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Yeah, cleanup appreciated.
Thanks.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'gtk/window-decorator/CMakeLists.txt' |
2 | --- gtk/window-decorator/CMakeLists.txt 2016-05-12 13:05:25 +0000 |
3 | +++ gtk/window-decorator/CMakeLists.txt 2016-05-12 13:05:25 +0000 |
4 | @@ -35,9 +35,6 @@ |
5 | add_library (gtk_window_decorator_settings STATIC |
6 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings.c) |
7 | |
8 | - add_library (gtk_window_decorator_settings_storage_interface STATIC |
9 | - ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings-storage-interface.c) |
10 | - |
11 | add_library (gtk_window_decorator_settings_writable_interface STATIC |
12 | ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings-writable-interface.c) |
13 | |
14 | @@ -49,12 +46,11 @@ |
15 | gtk_window_decorator_settings_interface |
16 | gtk_window_decorator_settings_writable_interface |
17 | gtk_window_decorator_settings |
18 | - gtk_window_decorator_settings_storage_interface |
19 | gtk_window_decorator_metacity_window_decoration_util |
20 | gtk_window_decorator_cairo_window_decoration_util) |
21 | |
22 | add_library (gtk_window_decorator_settings_storage_gsettings STATIC |
23 | - ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings-storage-gsettings.c) |
24 | + ${CMAKE_CURRENT_SOURCE_DIR}/gwd-settings-storage.c) |
25 | |
26 | compiz_pkg_check_modules (GSETTINGS gio-2.0 glib-2.0) |
27 | |
28 | |
29 | === removed file 'gtk/window-decorator/gwd-settings-storage-interface.c' |
30 | --- gtk/window-decorator/gwd-settings-storage-interface.c 2016-02-22 12:27:13 +0000 |
31 | +++ gtk/window-decorator/gwd-settings-storage-interface.c 1970-01-01 00:00:00 +0000 |
32 | @@ -1,70 +0,0 @@ |
33 | -/* |
34 | - * Copyright © 2012 Canonical Ltd |
35 | - * |
36 | - * This program is free software; you can redistribute it and/or modify |
37 | - * it under the terms of the GNU General Public License as published by |
38 | - * the Free Software Foundation; either version 2 of the License, or |
39 | - * (at your option) any later version. |
40 | - * |
41 | - * This program is distributed in the hope that it will be useful, |
42 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
43 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
44 | - * GNU General Public License for more details. |
45 | - * |
46 | - * You should have received a copy of the GNU General Public License |
47 | - * along with this program; if not, write to the Free Software Foundation, |
48 | - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
49 | - * |
50 | - * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
51 | - */ |
52 | -#include "gwd-settings-storage-interface.h" |
53 | - |
54 | -static void gwd_settings_storage_interface_default_init (GWDSettingsStorageInterface *settings_interface); |
55 | - |
56 | -G_DEFINE_INTERFACE (GWDSettingsStorage, gwd_settings_storage_interface, G_TYPE_OBJECT); |
57 | - |
58 | -static void gwd_settings_storage_interface_default_init (GWDSettingsStorageInterface *settings_interface) |
59 | -{ |
60 | -} |
61 | - |
62 | -gboolean gwd_settings_storage_update_use_tooltips (GWDSettingsStorage *settings) |
63 | -{ |
64 | - GWDSettingsStorageInterface *interface = GWD_SETTINGS_STORAGE_GET_INTERFACE (settings); |
65 | - return (*interface->update_use_tooltips) (settings); |
66 | -} |
67 | - |
68 | -gboolean gwd_settings_storage_update_blur (GWDSettingsStorage *settings) |
69 | -{ |
70 | - GWDSettingsStorageInterface *interface = GWD_SETTINGS_STORAGE_GET_INTERFACE (settings); |
71 | - return (*interface->update_blur) (settings); |
72 | -} |
73 | - |
74 | -gboolean gwd_settings_storage_update_metacity_theme (GWDSettingsStorage *settings) |
75 | -{ |
76 | - GWDSettingsStorageInterface *interface = GWD_SETTINGS_STORAGE_GET_INTERFACE (settings); |
77 | - return (*interface->update_metacity_theme) (settings); |
78 | -} |
79 | - |
80 | -gboolean gwd_settings_storage_update_opacity (GWDSettingsStorage *settings) |
81 | -{ |
82 | - GWDSettingsStorageInterface *interface = GWD_SETTINGS_STORAGE_GET_INTERFACE (settings); |
83 | - return (*interface->update_opacity) (settings); |
84 | -} |
85 | - |
86 | -gboolean gwd_settings_storage_update_button_layout (GWDSettingsStorage *settings) |
87 | -{ |
88 | - GWDSettingsStorageInterface *interface = GWD_SETTINGS_STORAGE_GET_INTERFACE (settings); |
89 | - return (*interface->update_button_layout) (settings); |
90 | -} |
91 | - |
92 | -gboolean gwd_settings_storage_update_font (GWDSettingsStorage *settings) |
93 | -{ |
94 | - GWDSettingsStorageInterface *interface = GWD_SETTINGS_STORAGE_GET_INTERFACE (settings); |
95 | - return (*interface->update_font) (settings); |
96 | -} |
97 | - |
98 | -gboolean gwd_settings_storage_update_titlebar_actions (GWDSettingsStorage *settings) |
99 | -{ |
100 | - GWDSettingsStorageInterface *interface = GWD_SETTINGS_STORAGE_GET_INTERFACE (settings); |
101 | - return (*interface->update_titlebar_actions) (settings); |
102 | -} |
103 | |
104 | === removed file 'gtk/window-decorator/gwd-settings-storage-interface.h' |
105 | --- gtk/window-decorator/gwd-settings-storage-interface.h 2016-02-22 12:27:13 +0000 |
106 | +++ gtk/window-decorator/gwd-settings-storage-interface.h 1970-01-01 00:00:00 +0000 |
107 | @@ -1,63 +0,0 @@ |
108 | -/* |
109 | - * Copyright © 2012 Canonical Ltd |
110 | - * |
111 | - * This program is free software; you can redistribute it and/or modify |
112 | - * it under the terms of the GNU General Public License as published by |
113 | - * the Free Software Foundation; either version 2 of the License, or |
114 | - * (at your option) any later version. |
115 | - * |
116 | - * This program is distributed in the hope that it will be useful, |
117 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
118 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
119 | - * GNU General Public License for more details. |
120 | - * |
121 | - * You should have received a copy of the GNU General Public License |
122 | - * along with this program; if not, write to the Free Software Foundation, |
123 | - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
124 | - * |
125 | - * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
126 | - */ |
127 | -#ifndef _COMPIZ_GWD_SETTINGS_STORAGE_INTERFACE_H |
128 | -#define _COMPIZ_GWD_SETTINGS_STORAGE_INTERFACE_H |
129 | - |
130 | -#include <glib-object.h> |
131 | -#include <gwd-fwd.h> |
132 | - |
133 | -G_BEGIN_DECLS |
134 | - |
135 | -#define GWD_SETTINGS_STORAGE_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ |
136 | - GWD_TYPE_SETTINGS_STORAGE_INTERFACE, \ |
137 | - GWDSettingsStorage)) |
138 | -#define GWD_SETTINGS_STORAGE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE (obj, \ |
139 | - GWD_TYPE_SETTINGS_STORAGE_INTERFACE, \ |
140 | - GWDSettingsStorageInterface)) |
141 | -#define GWD_TYPE_SETTINGS_STORAGE_INTERFACE (gwd_settings_storage_interface_get_type ()) |
142 | - |
143 | -typedef struct _GWDSettingsStorageInterface GWDSettingsStorageInterface; |
144 | - |
145 | -struct _GWDSettingsStorageInterface |
146 | -{ |
147 | - GTypeInterface parent; |
148 | - |
149 | - gboolean (*update_use_tooltips) (GWDSettingsStorage *settings); |
150 | - gboolean (*update_blur) (GWDSettingsStorage *settings); |
151 | - gboolean (*update_metacity_theme) (GWDSettingsStorage *settings); |
152 | - gboolean (*update_opacity) (GWDSettingsStorage *settings); |
153 | - gboolean (*update_button_layout) (GWDSettingsStorage *settings); |
154 | - gboolean (*update_font) (GWDSettingsStorage *settings); |
155 | - gboolean (*update_titlebar_actions) (GWDSettingsStorage *settings); |
156 | -}; |
157 | - |
158 | -gboolean gwd_settings_storage_update_use_tooltips (GWDSettingsStorage *settings); |
159 | -gboolean gwd_settings_storage_update_blur (GWDSettingsStorage *settings); |
160 | -gboolean gwd_settings_storage_update_metacity_theme (GWDSettingsStorage *settings); |
161 | -gboolean gwd_settings_storage_update_opacity (GWDSettingsStorage *settings); |
162 | -gboolean gwd_settings_storage_update_button_layout (GWDSettingsStorage *settings); |
163 | -gboolean gwd_settings_storage_update_font (GWDSettingsStorage *settings); |
164 | -gboolean gwd_settings_storage_update_titlebar_actions (GWDSettingsStorage *settings); |
165 | - |
166 | -GType gwd_settings_storage_interface_get_type (void); |
167 | - |
168 | -G_END_DECLS |
169 | - |
170 | -#endif |
171 | |
172 | === renamed file 'gtk/window-decorator/gwd-settings-storage-gsettings.c' => 'gtk/window-decorator/gwd-settings-storage.c' |
173 | --- gtk/window-decorator/gwd-settings-storage-gsettings.c 2016-03-11 14:43:02 +0000 |
174 | +++ gtk/window-decorator/gwd-settings-storage.c 2016-05-12 13:05:25 +0000 |
175 | @@ -25,8 +25,7 @@ |
176 | #include <string.h> |
177 | |
178 | #include "gwd-settings-writable-interface.h" |
179 | -#include "gwd-settings-storage-interface.h" |
180 | -#include "gwd-settings-storage-gsettings.h" |
181 | +#include "gwd-settings-storage.h" |
182 | |
183 | const gchar * ORG_COMPIZ_GWD = "org.compiz.gwd"; |
184 | const gchar * ORG_GNOME_METACITY = "org.gnome.metacity"; |
185 | @@ -57,593 +56,449 @@ |
186 | const gchar * ORG_MATE_MARCO_GENERAL_TITLEBAR_FONT = "titlebar-font"; |
187 | const gchar * ORG_MATE_MARCO_GENERAL_BUTTON_LAYOUT = "button-layout"; |
188 | |
189 | -#define GWD_SETTINGS_STORAGE_GSETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GWD_TYPE_SETTINGS_STORAGE_GSETTINGS, GWDSettingsStorageGSettings)); |
190 | -#define GWD_SETTINGS_STORAGE_GSETTINGS_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GWD_TYPE_SETTINGS_STORAGE_GSETTINGS, GWDSettingsStorageGSettingsClass)); |
191 | -#define GWD_IS_MOCK_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GWD_TYPE_SETTINGS_STORAGE_GSETTINGS)); |
192 | -#define GWD_IS_MOCK_SETTINGS_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), GWD_TYPE_SETTINGS_STORAGE_GSETTINGS)); |
193 | -#define GWD_SETTINGS_STORAGE_GSETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GWD_TYPE_SETTINGS_STORAGE_GSETTINGS, GWDSettingsStorageGSettingsClass)); |
194 | - |
195 | -typedef struct _GWDSettingsStorageGSettings |
196 | -{ |
197 | - GObject parent; |
198 | -} GWDSettingsStorageGSettings; |
199 | - |
200 | -typedef struct _GWDSettingsStorageGSettingsClass |
201 | -{ |
202 | - GObjectClass parent_class; |
203 | -} GWDSettingsStorageGSettingsClass; |
204 | - |
205 | -static void gwd_settings_storage_gsettings_interface_init (GWDSettingsStorageInterface *interface); |
206 | - |
207 | -G_DEFINE_TYPE_WITH_CODE (GWDSettingsStorageGSettings, gwd_settings_storage_gsettings, G_TYPE_OBJECT, |
208 | - G_IMPLEMENT_INTERFACE (GWD_TYPE_SETTINGS_STORAGE_INTERFACE, |
209 | - gwd_settings_storage_gsettings_interface_init)) |
210 | - |
211 | -#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GWD_TYPE_SETTINGS_STORAGE_GSETTINGS, GWDSettingsStorageGSettingsPrivate)) |
212 | +struct _GWDSettingsStorage |
213 | +{ |
214 | + GObject parent; |
215 | + |
216 | + GWDSettingsWritable *writable; |
217 | + gboolean connect; |
218 | + |
219 | + GSettings *gwd; |
220 | + GSettings *desktop; |
221 | + GSettings *metacity; |
222 | + GSettings *marco; |
223 | + |
224 | + gboolean is_mate_desktop; |
225 | +}; |
226 | |
227 | enum |
228 | { |
229 | - GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_DESKTOP_GSETTINGS = 1, |
230 | - GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_METACITY_GSETTINGS = 2, |
231 | - GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_MARCO_GSETTINGS = 3, |
232 | - GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_GWD_GSETTINGS = 4, |
233 | - GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_WRITABLE_SETTINGS = 5 |
234 | + PROP_0, |
235 | + |
236 | + PROP_WRITABLE, |
237 | + PROP_CONNECT, |
238 | + |
239 | + LAST_PROP |
240 | }; |
241 | |
242 | -typedef struct _GWDSettingsStorageGSettingsPrivate |
243 | -{ |
244 | - GSettings *desktop; |
245 | - GSettings *metacity; |
246 | - |
247 | - GSettings *marco; |
248 | - gboolean is_mate_desktop; |
249 | - |
250 | - GSettings *gwd; |
251 | - GWDSettingsWritable *writable; |
252 | -} GWDSettingsStorageGSettingsPrivate; |
253 | - |
254 | -static gboolean |
255 | -gwd_settings_storage_gsettings_update_use_tooltips (GWDSettingsStorage *settings) |
256 | -{ |
257 | - GWDSettingsStorageGSettings *storage = GWD_SETTINGS_STORAGE_GSETTINGS (settings); |
258 | - GWDSettingsStorageGSettingsPrivate *priv = GET_PRIVATE (storage); |
259 | - |
260 | - if (!priv->gwd) |
261 | - return FALSE; |
262 | - |
263 | - return gwd_settings_writable_use_tooltips_changed (priv->writable, |
264 | - g_settings_get_boolean (priv->gwd, |
265 | - ORG_COMPIZ_GWD_KEY_USE_TOOLTIPS)); |
266 | -} |
267 | - |
268 | -static gboolean |
269 | -gwd_settings_storage_gsettings_update_blur (GWDSettingsStorage *settings) |
270 | -{ |
271 | - GWDSettingsStorageGSettings *storage = GWD_SETTINGS_STORAGE_GSETTINGS (settings); |
272 | - GWDSettingsStorageGSettingsPrivate *priv = GET_PRIVATE (storage); |
273 | - |
274 | - if (!priv->gwd) |
275 | - return FALSE; |
276 | - |
277 | - return gwd_settings_writable_blur_changed (priv->writable, |
278 | - g_settings_get_string (priv->gwd, |
279 | - ORG_COMPIZ_GWD_KEY_BLUR_TYPE)); |
280 | -} |
281 | - |
282 | -static gboolean |
283 | -gwd_settings_storage_gsettings_update_metacity_theme (GWDSettingsStorage *settings) |
284 | -{ |
285 | - GWDSettingsStorageGSettings *storage; |
286 | - GWDSettingsStorageGSettingsPrivate *priv; |
287 | +static GParamSpec *storage_properties[LAST_PROP] = { NULL }; |
288 | + |
289 | +G_DEFINE_TYPE (GWDSettingsStorage, gwd_settings_storage, G_TYPE_OBJECT) |
290 | + |
291 | +static inline GSettings * |
292 | +get_settings_no_abort (const gchar *schema) |
293 | +{ |
294 | + GSettingsSchemaSource *source; |
295 | + GSettings *settings; |
296 | + |
297 | + source = g_settings_schema_source_get_default (); |
298 | + settings = NULL; |
299 | + |
300 | + if (g_settings_schema_source_lookup (source, schema, TRUE)) |
301 | + settings = g_settings_new (schema); |
302 | + |
303 | + return settings; |
304 | +} |
305 | + |
306 | +static inline gchar * |
307 | +translate_dashes_to_underscores (const gchar *original) |
308 | +{ |
309 | + gint i = 0; |
310 | + gchar *copy = g_strdup (original); |
311 | + |
312 | + if (!copy) |
313 | + return NULL; |
314 | + |
315 | + for (; i < strlen (copy); ++i) { |
316 | + if (copy[i] == '-') |
317 | + copy[i] = '_'; |
318 | + } |
319 | + |
320 | + return copy; |
321 | +} |
322 | + |
323 | +static void |
324 | +org_compiz_gwd_settings_changed (GSettings *settings, |
325 | + const gchar *key, |
326 | + GWDSettingsStorage *storage) |
327 | +{ |
328 | + if (strcmp (key, ORG_COMPIZ_GWD_KEY_MOUSE_WHEEL_ACTION) == 0) |
329 | + gwd_settings_storage_update_titlebar_actions (storage); |
330 | + else if (strcmp (key, ORG_COMPIZ_GWD_KEY_BLUR_TYPE) == 0) |
331 | + gwd_settings_storage_update_blur (storage); |
332 | + else if (strcmp (key, ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME) == 0) |
333 | + gwd_settings_storage_update_metacity_theme (storage); |
334 | + else if (strcmp (key, ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_OPACITY) == 0 || |
335 | + strcmp (key, ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_SHADE_OPACITY) == 0 || |
336 | + strcmp (key, ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_OPACITY) == 0 || |
337 | + strcmp (key, ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_SHADE_OPACITY) == 0) |
338 | + gwd_settings_storage_update_opacity (storage); |
339 | + else if (strcmp (key, ORG_COMPIZ_GWD_KEY_USE_TOOLTIPS) == 0) |
340 | + gwd_settings_storage_update_use_tooltips (storage); |
341 | +} |
342 | + |
343 | +static void |
344 | +org_gnome_desktop_wm_preferences_settings_changed (GSettings *settings, |
345 | + const gchar *key, |
346 | + GWDSettingsStorage *storage) |
347 | +{ |
348 | + if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_USES_SYSTEM_FONT) == 0 || |
349 | + strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_FONT) == 0) |
350 | + gwd_settings_storage_update_font (storage); |
351 | + else if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_FONT) == 0) |
352 | + gwd_settings_storage_update_font (storage); |
353 | + else if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_DOUBLE_CLICK_TITLEBAR) == 0 || |
354 | + strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_MIDDLE_CLICK_TITLEBAR) == 0 || |
355 | + strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_RIGHT_CLICK_TITLEBAR) == 0) |
356 | + gwd_settings_storage_update_titlebar_actions (storage); |
357 | + else if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_THEME) == 0) |
358 | + gwd_settings_storage_update_metacity_theme (storage); |
359 | + else if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_BUTTON_LAYOUT) == 0) |
360 | + gwd_settings_storage_update_button_layout (storage); |
361 | +} |
362 | + |
363 | +static void |
364 | +org_gnome_metacity_settings_changed (GSettings *settings, |
365 | + const gchar *key, |
366 | + GWDSettingsStorage *storage) |
367 | +{ |
368 | + if (strcmp (key, ORG_GNOME_METACITY_THEME) == 0) |
369 | + gwd_settings_storage_update_metacity_theme (storage); |
370 | +} |
371 | + |
372 | +static void |
373 | +org_mate_marco_general_settings_changed (GSettings *settings, |
374 | + const gchar *key, |
375 | + GWDSettingsStorage *storage) |
376 | +{ |
377 | + if (strcmp (key, ORG_MATE_MARCO_GENERAL_TITLEBAR_USES_SYSTEM_FONT) == 0 || |
378 | + strcmp (key, ORG_MATE_MARCO_GENERAL_TITLEBAR_FONT) == 0) |
379 | + gwd_settings_storage_update_font (storage); |
380 | + else if (strcmp (key, ORG_MATE_MARCO_GENERAL_TITLEBAR_FONT) == 0) |
381 | + gwd_settings_storage_update_font (storage); |
382 | + else if (strcmp (key, ORG_MATE_MARCO_GENERAL_ACTION_DOUBLE_CLICK_TITLEBAR) == 0 || |
383 | + strcmp (key, ORG_MATE_MARCO_GENERAL_ACTION_MIDDLE_CLICK_TITLEBAR) == 0 || |
384 | + strcmp (key, ORG_MATE_MARCO_GENERAL_ACTION_RIGHT_CLICK_TITLEBAR) == 0) |
385 | + gwd_settings_storage_update_titlebar_actions (storage); |
386 | + else if (strcmp (key, ORG_MATE_MARCO_GENERAL_THEME) == 0) |
387 | + gwd_settings_storage_update_metacity_theme (storage); |
388 | + else if (strcmp (key, ORG_MATE_MARCO_GENERAL_BUTTON_LAYOUT) == 0) |
389 | + gwd_settings_storage_update_button_layout (storage); |
390 | +} |
391 | + |
392 | +static void |
393 | +gwd_settings_storage_constructed (GObject *object) |
394 | +{ |
395 | + GWDSettingsStorage *storage; |
396 | + |
397 | + storage = GWD_SETTINGS_STORAGE (object); |
398 | + |
399 | + G_OBJECT_CLASS (gwd_settings_storage_parent_class)->constructed (object); |
400 | + |
401 | + if (storage->gwd && storage->connect) { |
402 | + g_signal_connect (storage->gwd, "changed", |
403 | + G_CALLBACK (org_compiz_gwd_settings_changed), |
404 | + storage); |
405 | + } |
406 | + |
407 | + if (storage->desktop && storage->connect) { |
408 | + g_signal_connect (storage->desktop, "changed", |
409 | + G_CALLBACK (org_gnome_desktop_wm_preferences_settings_changed), |
410 | + storage); |
411 | + } |
412 | + |
413 | + if (storage->metacity && storage->connect) { |
414 | + g_signal_connect (storage->metacity, "changed", |
415 | + G_CALLBACK (org_gnome_metacity_settings_changed), |
416 | + storage); |
417 | + } |
418 | + |
419 | + if (storage->marco && storage->connect) { |
420 | + g_signal_connect (storage->marco, "changed", |
421 | + G_CALLBACK (org_mate_marco_general_settings_changed), |
422 | + storage); |
423 | + } |
424 | +} |
425 | + |
426 | +static void |
427 | +gwd_settings_storage_dispose (GObject *object) |
428 | +{ |
429 | + GWDSettingsStorage *storage; |
430 | + |
431 | + storage = GWD_SETTINGS_STORAGE (object); |
432 | + |
433 | + g_clear_object (&storage->writable); |
434 | + |
435 | + g_clear_object (&storage->gwd); |
436 | + g_clear_object (&storage->desktop); |
437 | + g_clear_object (&storage->metacity); |
438 | + g_clear_object (&storage->marco); |
439 | + |
440 | + G_OBJECT_CLASS (gwd_settings_storage_parent_class)->dispose (object); |
441 | +} |
442 | + |
443 | +static void |
444 | +gwd_settings_storage_set_property (GObject *object, |
445 | + guint property_id, |
446 | + const GValue *value, |
447 | + GParamSpec *pspec) |
448 | +{ |
449 | + GWDSettingsStorage *storage; |
450 | + |
451 | + storage = GWD_SETTINGS_STORAGE (object); |
452 | + |
453 | + switch (property_id) { |
454 | + case PROP_WRITABLE: |
455 | + storage->writable = g_value_dup_object (value); |
456 | + break; |
457 | + |
458 | + case PROP_CONNECT: |
459 | + storage->connect = g_value_get_boolean (value); |
460 | + break; |
461 | + |
462 | + default: |
463 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); |
464 | + break; |
465 | + } |
466 | +} |
467 | + |
468 | +static void |
469 | +gwd_settings_storage_class_init (GWDSettingsStorageClass *storage_class) |
470 | +{ |
471 | + GObjectClass *object_class; |
472 | + |
473 | + object_class = G_OBJECT_CLASS (storage_class); |
474 | + |
475 | + object_class->constructed = gwd_settings_storage_constructed; |
476 | + object_class->dispose = gwd_settings_storage_dispose; |
477 | + object_class->set_property = gwd_settings_storage_set_property; |
478 | + |
479 | + storage_properties[PROP_WRITABLE] = |
480 | + g_param_spec_object ("writable", "GWDWritableSettings", |
481 | + "A GWDWritableSettings object", |
482 | + GWD_TYPE_WRITABLE_SETTINGS_INTERFACE, |
483 | + G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | |
484 | + G_PARAM_STATIC_STRINGS); |
485 | + |
486 | + storage_properties[PROP_CONNECT] = |
487 | + g_param_spec_boolean ("connect", "Connect", "Connect", |
488 | + TRUE, |
489 | + G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | |
490 | + G_PARAM_STATIC_STRINGS); |
491 | + |
492 | + g_object_class_install_properties (object_class, LAST_PROP, |
493 | + storage_properties); |
494 | +} |
495 | + |
496 | +void |
497 | +gwd_settings_storage_init (GWDSettingsStorage *storage) |
498 | +{ |
499 | + storage->gwd = get_settings_no_abort (ORG_COMPIZ_GWD); |
500 | + storage->desktop = get_settings_no_abort (ORG_GNOME_DESKTOP_WM_PREFERENCES); |
501 | + storage->metacity = get_settings_no_abort (ORG_GNOME_METACITY); |
502 | + storage->marco = get_settings_no_abort (ORG_MATE_MARCO_GENERAL); |
503 | + |
504 | + if (storage->marco) { |
505 | + const gchar *xdg_current_desktop; |
506 | + |
507 | + xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP"); |
508 | + |
509 | + if (xdg_current_desktop) { |
510 | + gchar **desktops; |
511 | + gint i; |
512 | + |
513 | + desktops = g_strsplit (xdg_current_desktop, ":", -1); |
514 | + |
515 | + for (i = 0; desktops[i] != NULL; i++) { |
516 | + if (g_strcmp0 (desktops[i], "MATE") == 0) { |
517 | + storage->is_mate_desktop = TRUE; |
518 | + break; |
519 | + } |
520 | + } |
521 | + |
522 | + g_strfreev (desktops); |
523 | + } |
524 | + } |
525 | +} |
526 | + |
527 | +GWDSettingsStorage * |
528 | +gwd_settings_storage_new (GWDSettingsWritable *writable, |
529 | + gboolean connect) |
530 | +{ |
531 | + return g_object_new (GWD_TYPE_SETTINGS_STORAGE, |
532 | + "writable", writable, |
533 | + "connect", connect, |
534 | + NULL); |
535 | +} |
536 | + |
537 | +gboolean |
538 | +gwd_settings_storage_update_use_tooltips (GWDSettingsStorage *storage) |
539 | +{ |
540 | + gboolean use_tooltips; |
541 | + |
542 | + if (!storage->gwd) |
543 | + return FALSE; |
544 | + |
545 | + use_tooltips = g_settings_get_boolean (storage->gwd, ORG_COMPIZ_GWD_KEY_USE_TOOLTIPS); |
546 | + |
547 | + return gwd_settings_writable_use_tooltips_changed (storage->writable, use_tooltips); |
548 | +} |
549 | + |
550 | +gboolean |
551 | +gwd_settings_storage_update_blur (GWDSettingsStorage *storage) |
552 | +{ |
553 | + gchar *blur_type; |
554 | + |
555 | + if (!storage->gwd) |
556 | + return FALSE; |
557 | + |
558 | + blur_type = g_settings_get_string (storage->gwd, ORG_COMPIZ_GWD_KEY_BLUR_TYPE); |
559 | + |
560 | + return gwd_settings_writable_blur_changed (storage->writable, blur_type); |
561 | +} |
562 | + |
563 | +gboolean |
564 | +gwd_settings_storage_update_metacity_theme (GWDSettingsStorage *storage) |
565 | +{ |
566 | gboolean use_metacity_theme; |
567 | gchar *theme; |
568 | |
569 | - storage = GWD_SETTINGS_STORAGE_GSETTINGS (settings); |
570 | - priv = GET_PRIVATE (storage); |
571 | - |
572 | - if (!priv->gwd) |
573 | + if (!storage->gwd) |
574 | return FALSE; |
575 | |
576 | - use_metacity_theme = g_settings_get_boolean (priv->gwd, ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME); |
577 | + use_metacity_theme = g_settings_get_boolean (storage->gwd, ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME); |
578 | |
579 | - if (priv->is_mate_desktop) |
580 | - theme = g_settings_get_string (priv->marco, ORG_MATE_MARCO_GENERAL_THEME); |
581 | - else if (priv->metacity) |
582 | - theme = g_settings_get_string (priv->metacity, ORG_GNOME_METACITY_THEME); |
583 | + if (storage->is_mate_desktop) |
584 | + theme = g_settings_get_string (storage->marco, ORG_MATE_MARCO_GENERAL_THEME); |
585 | + else if (storage->metacity) |
586 | + theme = g_settings_get_string (storage->metacity, ORG_GNOME_METACITY_THEME); |
587 | else |
588 | - return FALSE; |
589 | + return FALSE; |
590 | |
591 | - return gwd_settings_writable_metacity_theme_changed (priv->writable, |
592 | + return gwd_settings_writable_metacity_theme_changed (storage->writable, |
593 | use_metacity_theme, |
594 | theme); |
595 | } |
596 | |
597 | -static gboolean |
598 | -gwd_settings_storage_gsettings_update_opacity (GWDSettingsStorage *settings) |
599 | +gboolean |
600 | +gwd_settings_storage_update_opacity (GWDSettingsStorage *storage) |
601 | { |
602 | - GWDSettingsStorageGSettings *storage = GWD_SETTINGS_STORAGE_GSETTINGS (settings); |
603 | - GWDSettingsStorageGSettingsPrivate *priv = GET_PRIVATE (storage); |
604 | - |
605 | - if (!priv->gwd) |
606 | - return FALSE; |
607 | - |
608 | - return gwd_settings_writable_opacity_changed (priv->writable, |
609 | - g_settings_get_double (priv->gwd, |
610 | - ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_OPACITY), |
611 | - g_settings_get_double (priv->gwd, |
612 | - ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_OPACITY), |
613 | - g_settings_get_boolean (priv->gwd, |
614 | - ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_SHADE_OPACITY), |
615 | - g_settings_get_boolean (priv->gwd, |
616 | - ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_SHADE_OPACITY)); |
617 | + gdouble active; |
618 | + gdouble inactive; |
619 | + gboolean active_shade; |
620 | + gboolean inactive_shade; |
621 | + |
622 | + if (!storage->gwd) |
623 | + return FALSE; |
624 | + |
625 | + active = g_settings_get_double (storage->gwd, ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_OPACITY); |
626 | + inactive = g_settings_get_double (storage->gwd, ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_OPACITY); |
627 | + active_shade = g_settings_get_boolean (storage->gwd, ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_SHADE_OPACITY); |
628 | + inactive_shade = g_settings_get_boolean (storage->gwd, ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_SHADE_OPACITY); |
629 | + |
630 | + return gwd_settings_writable_opacity_changed (storage->writable, active, inactive, |
631 | + active_shade, inactive_shade); |
632 | } |
633 | |
634 | -static gboolean |
635 | -gwd_settings_storage_gsettings_update_button_layout (GWDSettingsStorage *settings) |
636 | +gboolean |
637 | +gwd_settings_storage_update_button_layout (GWDSettingsStorage *storage) |
638 | { |
639 | - GWDSettingsStorageGSettings *storage = GWD_SETTINGS_STORAGE_GSETTINGS (settings); |
640 | - GWDSettingsStorageGSettingsPrivate *priv = GET_PRIVATE (storage); |
641 | gchar *button_layout; |
642 | |
643 | - if (priv->is_mate_desktop) |
644 | - button_layout = g_settings_get_string (priv->marco, ORG_MATE_MARCO_GENERAL_BUTTON_LAYOUT); |
645 | - else if (priv->desktop) |
646 | - button_layout = g_settings_get_string (priv->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_BUTTON_LAYOUT); |
647 | + if (storage->is_mate_desktop) |
648 | + button_layout = g_settings_get_string (storage->marco, ORG_MATE_MARCO_GENERAL_BUTTON_LAYOUT); |
649 | + else if (storage->desktop) |
650 | + button_layout = g_settings_get_string (storage->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_BUTTON_LAYOUT); |
651 | else |
652 | - return FALSE; |
653 | + return FALSE; |
654 | |
655 | - return gwd_settings_writable_button_layout_changed (priv->writable, |
656 | - button_layout); |
657 | + return gwd_settings_writable_button_layout_changed (storage->writable, button_layout); |
658 | } |
659 | |
660 | -static gboolean |
661 | -gwd_settings_storage_gsettings_update_font (GWDSettingsStorage *settings) |
662 | +gboolean |
663 | +gwd_settings_storage_update_font (GWDSettingsStorage *storage) |
664 | { |
665 | - GWDSettingsStorageGSettings *storage = GWD_SETTINGS_STORAGE_GSETTINGS (settings); |
666 | - GWDSettingsStorageGSettingsPrivate *priv = GET_PRIVATE (storage); |
667 | gchar *titlebar_font; |
668 | gboolean titlebar_system_font; |
669 | |
670 | - if (priv->is_mate_desktop) { |
671 | - titlebar_font = g_settings_get_string (priv->marco, ORG_MATE_MARCO_GENERAL_TITLEBAR_FONT); |
672 | - titlebar_system_font = g_settings_get_boolean (priv->marco, ORG_MATE_MARCO_GENERAL_TITLEBAR_USES_SYSTEM_FONT); |
673 | - } else if (priv->desktop) { |
674 | - titlebar_font = g_settings_get_string (priv->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_FONT); |
675 | - titlebar_system_font = g_settings_get_boolean (priv->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_USES_SYSTEM_FONT); |
676 | + if (storage->is_mate_desktop) { |
677 | + titlebar_font = g_settings_get_string (storage->marco, ORG_MATE_MARCO_GENERAL_TITLEBAR_FONT); |
678 | + titlebar_system_font = g_settings_get_boolean (storage->marco, ORG_MATE_MARCO_GENERAL_TITLEBAR_USES_SYSTEM_FONT); |
679 | + } else if (storage->desktop) { |
680 | + titlebar_font = g_settings_get_string (storage->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_FONT); |
681 | + titlebar_system_font = g_settings_get_boolean (storage->desktop, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_USES_SYSTEM_FONT); |
682 | } else |
683 | - return FALSE; |
684 | - |
685 | - return gwd_settings_writable_font_changed (priv->writable, |
686 | - titlebar_system_font, |
687 | - titlebar_font); |
688 | -} |
689 | - |
690 | -static inline gchar * |
691 | -translate_dashes_to_underscores (const gchar *original) |
692 | -{ |
693 | - gint i = 0; |
694 | - gchar *copy = g_strdup (original); |
695 | - |
696 | - if (!copy) |
697 | - return NULL; |
698 | - |
699 | - for (; i < strlen (copy); ++i) |
700 | - { |
701 | - if (copy[i] == '-') |
702 | - copy[i] = '_'; |
703 | - } |
704 | - |
705 | - return copy; |
706 | -} |
707 | - |
708 | -static gboolean |
709 | -gwd_settings_storage_gsettings_update_titlebar_actions (GWDSettingsStorage *settings) |
710 | -{ |
711 | - GWDSettingsStorageGSettings *storage = GWD_SETTINGS_STORAGE_GSETTINGS (settings); |
712 | - GWDSettingsStorageGSettingsPrivate *priv = GET_PRIVATE (storage); |
713 | - gchar *double_click_action, *middle_click_action, *right_click_action; |
714 | - |
715 | - if (!priv->gwd) |
716 | - return FALSE; |
717 | - |
718 | - if (priv->is_mate_desktop) { |
719 | - double_click_action = translate_dashes_to_underscores (g_settings_get_string (priv->marco, |
720 | + return FALSE; |
721 | + |
722 | + return gwd_settings_writable_font_changed (storage->writable, |
723 | + titlebar_system_font, |
724 | + titlebar_font); |
725 | +} |
726 | + |
727 | +gboolean |
728 | +gwd_settings_storage_update_titlebar_actions (GWDSettingsStorage *storage) |
729 | +{ |
730 | + gchar *double_click_action; |
731 | + gchar *middle_click_action; |
732 | + gchar *right_click_action; |
733 | + |
734 | + if (!storage->gwd) |
735 | + return FALSE; |
736 | + |
737 | + if (storage->is_mate_desktop) { |
738 | + double_click_action = translate_dashes_to_underscores (g_settings_get_string (storage->marco, |
739 | ORG_MATE_MARCO_GENERAL_ACTION_DOUBLE_CLICK_TITLEBAR)); |
740 | - middle_click_action = translate_dashes_to_underscores (g_settings_get_string (priv->marco, |
741 | + middle_click_action = translate_dashes_to_underscores (g_settings_get_string (storage->marco, |
742 | ORG_MATE_MARCO_GENERAL_ACTION_MIDDLE_CLICK_TITLEBAR)); |
743 | - right_click_action = translate_dashes_to_underscores (g_settings_get_string (priv->marco, |
744 | + right_click_action = translate_dashes_to_underscores (g_settings_get_string (storage->marco, |
745 | ORG_MATE_MARCO_GENERAL_ACTION_RIGHT_CLICK_TITLEBAR)); |
746 | - } else if (priv->desktop) { |
747 | - double_click_action = translate_dashes_to_underscores (g_settings_get_string (priv->desktop, |
748 | + } else if (storage->desktop) { |
749 | + double_click_action = translate_dashes_to_underscores (g_settings_get_string (storage->desktop, |
750 | ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_DOUBLE_CLICK_TITLEBAR)); |
751 | - middle_click_action = translate_dashes_to_underscores (g_settings_get_string (priv->desktop, |
752 | + middle_click_action = translate_dashes_to_underscores (g_settings_get_string (storage->desktop, |
753 | ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_MIDDLE_CLICK_TITLEBAR)); |
754 | - right_click_action = translate_dashes_to_underscores (g_settings_get_string (priv->desktop, |
755 | + right_click_action = translate_dashes_to_underscores (g_settings_get_string (storage->desktop, |
756 | ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_RIGHT_CLICK_TITLEBAR)); |
757 | } else |
758 | - return FALSE; |
759 | + return FALSE; |
760 | |
761 | - return gwd_settings_writable_titlebar_actions_changed (priv->writable, |
762 | + return gwd_settings_writable_titlebar_actions_changed (storage->writable, |
763 | double_click_action, |
764 | middle_click_action, |
765 | right_click_action, |
766 | - g_settings_get_string (priv->gwd, |
767 | + g_settings_get_string (storage->gwd, |
768 | ORG_COMPIZ_GWD_KEY_MOUSE_WHEEL_ACTION)); |
769 | |
770 | if (double_click_action) |
771 | - g_free (double_click_action); |
772 | + g_free (double_click_action); |
773 | |
774 | if (middle_click_action) |
775 | - g_free (middle_click_action); |
776 | + g_free (middle_click_action); |
777 | |
778 | if (right_click_action) |
779 | - g_free (right_click_action); |
780 | -} |
781 | - |
782 | -static void |
783 | -gwd_settings_storage_gsettings_interface_init (GWDSettingsStorageInterface *interface) |
784 | -{ |
785 | - interface->update_use_tooltips = gwd_settings_storage_gsettings_update_use_tooltips; |
786 | - interface->update_blur = gwd_settings_storage_gsettings_update_blur; |
787 | - interface->update_metacity_theme = gwd_settings_storage_gsettings_update_metacity_theme; |
788 | - interface->update_opacity = gwd_settings_storage_gsettings_update_opacity; |
789 | - interface->update_button_layout = gwd_settings_storage_gsettings_update_button_layout; |
790 | - interface->update_font = gwd_settings_storage_gsettings_update_font; |
791 | - interface->update_titlebar_actions = gwd_settings_storage_gsettings_update_titlebar_actions; |
792 | -} |
793 | - |
794 | -static void |
795 | -gwd_settings_storage_gsettings_set_property (GObject *object, |
796 | - guint property_id, |
797 | - const GValue *value, |
798 | - GParamSpec *pspec) |
799 | -{ |
800 | - GWDSettingsStorageGSettingsPrivate *priv = GET_PRIVATE (object); |
801 | - |
802 | - switch (property_id) |
803 | - { |
804 | - case GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_DESKTOP_GSETTINGS: |
805 | - if (priv->desktop) |
806 | - g_object_unref (priv->desktop); |
807 | - |
808 | - priv->desktop = g_value_dup_object (value); |
809 | - break; |
810 | - case GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_METACITY_GSETTINGS: |
811 | - if (priv->metacity) |
812 | - g_object_unref (priv->metacity); |
813 | - |
814 | - priv->metacity = g_value_dup_object (value); |
815 | - break; |
816 | - case GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_MARCO_GSETTINGS: |
817 | - if (priv->marco) |
818 | - g_object_unref (priv->marco); |
819 | - |
820 | - priv->marco = g_value_dup_object (value); |
821 | - break; |
822 | - case GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_GWD_GSETTINGS: |
823 | - if (priv->gwd) |
824 | - g_object_unref (priv->gwd); |
825 | - |
826 | - priv->gwd = g_value_dup_object (value); |
827 | - break; |
828 | - case GWD_SETTINGS_STORAGE_GSETTINGS_PROPERTY_WRITABLE_SETTINGS: |
829 | - priv->writable = g_value_get_pointer (value); |
830 | - break; |
831 | - default: |
832 | - g_assert_not_reached (); |
833 | - } |
834 | -} |
835 | - |
836 | -static void |
837 | -gwd_settings_storage_gsettings_dispose (GObject *object) |
838 | -{ |
839 | - GWDSettingsStorageGSettingsPrivate *priv = GET_PRIVATE (object); |
840 | - |
841 | - G_OBJECT_CLASS (gwd_settings_storage_gsettings_parent_class)->dispose (object); |
842 | - |
843 | - if (priv->desktop) |
844 | - g_object_unref (priv->desktop); |
845 | - |
846 | - if (priv->metacity) |
847 | - g_object_unref (priv->metacity); |
848 | - |
849 | - if (priv->marco) |
850 | - g_object_unref (priv->marco); |
851 | - |
852 | - if (priv->gwd) |
853 | - g_object_unref (priv->gwd); |
854 | -} |
855 | - |
856 | -static void |
857 | -gwd_settings_storage_gsettings_finalize (GObject *object) |
858 | -{ |
859 | - G_OBJECT_CLASS (gwd_settings_storage_gsettings_parent_class)->finalize (object); |
860 | -} |
861 | - |
862 | -static void |
863 | -gwd_settings_storage_gsettings_class_init (GWDSettingsStorageGSettingsClass *klass) |
864 | -{ |
865 | - GObjectClass *object_class = G_OBJECT_CLASS (klass); |
866 | - GParamSpec *properties[] = |
867 | - { |
868 | - NULL, |
869 | - g_param_spec_object ("desktop-gsettings", |
870 | - ORG_GNOME_DESKTOP_WM_PREFERENCES, |
871 | - "GSettings Object for org.gnome.desktop.wm.preferences", |
872 | - G_TYPE_SETTINGS, |
873 | - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY), |
874 | - g_param_spec_object ("metacity-gsettings", |
875 | - ORG_GNOME_METACITY, |
876 | - "GSettings Object for org.gnome.metacity", |
877 | - G_TYPE_SETTINGS, |
878 | - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY), |
879 | - g_param_spec_object ("marco-gsettings", |
880 | - ORG_MATE_MARCO_GENERAL, |
881 | - "GSettings Object for org.mate.Marco.general", |
882 | - G_TYPE_SETTINGS, |
883 | - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY), |
884 | - g_param_spec_object ("gwd-gsettings", |
885 | - ORG_COMPIZ_GWD, |
886 | - "GSettings Object for org.compiz.gwd", |
887 | - G_TYPE_SETTINGS, |
888 | - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY), |
889 | - g_param_spec_pointer ("writable-settings", |
890 | - "GWDWritableSettings", |
891 | - "A GWDWritableSettings object", |
892 | - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY) |
893 | - }; |
894 | - |
895 | - g_type_class_add_private (klass, sizeof (GWDSettingsStorageGSettingsPrivate)); |
896 | - |
897 | - object_class->dispose = gwd_settings_storage_gsettings_dispose; |
898 | - object_class->finalize = gwd_settings_storage_gsettings_finalize; |
899 | - object_class->set_property = gwd_settings_storage_gsettings_set_property; |
900 | - |
901 | - g_object_class_install_properties (object_class, |
902 | - sizeof (properties) / sizeof (properties[0]), |
903 | - properties); |
904 | -} |
905 | - |
906 | -void gwd_settings_storage_gsettings_init (GWDSettingsStorageGSettings *self) |
907 | -{ |
908 | -} |
909 | - |
910 | -GWDSettingsStorage * |
911 | -gwd_settings_storage_gsettings_new (GSettings *desktop, |
912 | - GSettings *metacity, |
913 | - GSettings *marco, |
914 | - GSettings *gwd, |
915 | - GWDSettingsWritable *writable) |
916 | -{ |
917 | - static const guint gwd_settings_storage_gsettings_n_construction_params = 5; |
918 | - GParameter param[gwd_settings_storage_gsettings_n_construction_params]; |
919 | - |
920 | - GValue desktop_value = G_VALUE_INIT; |
921 | - GValue metacity_value = G_VALUE_INIT; |
922 | - GValue marco_value = G_VALUE_INIT; |
923 | - GValue gwd_value = G_VALUE_INIT; |
924 | - GValue writable_value = G_VALUE_INIT; |
925 | - |
926 | - GWDSettingsStorage *storage = NULL; |
927 | - GWDSettingsStorageGSettingsPrivate *priv; |
928 | - |
929 | - g_return_val_if_fail (writable != NULL, NULL); |
930 | - |
931 | - g_value_init (&desktop_value, G_TYPE_OBJECT); |
932 | - g_value_init (&metacity_value, G_TYPE_OBJECT); |
933 | - g_value_init (&marco_value, G_TYPE_OBJECT); |
934 | - g_value_init (&gwd_value, G_TYPE_OBJECT); |
935 | - g_value_init (&writable_value, G_TYPE_POINTER); |
936 | - |
937 | - g_value_take_object (&desktop_value, desktop); |
938 | - g_value_take_object (&metacity_value, metacity); |
939 | - g_value_take_object (&marco_value, marco); |
940 | - g_value_take_object (&gwd_value, gwd); |
941 | - g_value_set_pointer (&writable_value, writable); |
942 | - |
943 | - param[0].name = "desktop-gsettings"; |
944 | - param[0].value = desktop_value; |
945 | - param[1].name = "metacity-gsettings"; |
946 | - param[1].value = metacity_value; |
947 | - param[2].name = "marco-gsettings"; |
948 | - param[2].value = marco_value; |
949 | - param[3].name = "gwd-gsettings"; |
950 | - param[3].value = gwd_value; |
951 | - param[4].name = "writable-settings"; |
952 | - param[4].value = writable_value; |
953 | - |
954 | - storage = GWD_SETTINGS_STORAGE_INTERFACE (g_object_newv (GWD_TYPE_SETTINGS_STORAGE_GSETTINGS, |
955 | - gwd_settings_storage_gsettings_n_construction_params, |
956 | - param)); |
957 | - |
958 | - g_value_unset (&desktop_value); |
959 | - g_value_unset (&metacity_value); |
960 | - g_value_unset (&marco_value); |
961 | - g_value_unset (&gwd_value); |
962 | - g_value_unset (&writable_value); |
963 | - |
964 | - priv = GET_PRIVATE (storage); |
965 | - priv->is_mate_desktop = FALSE; |
966 | - |
967 | - if (marco) { |
968 | - const gchar *xdg_current_desktop; |
969 | - |
970 | - xdg_current_desktop = g_getenv ("XDG_CURRENT_DESKTOP"); |
971 | - if (xdg_current_desktop) { |
972 | - gchar **desktops; |
973 | - gint i; |
974 | - |
975 | - desktops = g_strsplit (xdg_current_desktop, ":", -1); |
976 | - for (i = 0; desktops[i] != NULL; i++) { |
977 | - if (g_strcmp0 (desktops[i], "MATE") == 0) { |
978 | - priv->is_mate_desktop = TRUE; |
979 | - break; |
980 | - } |
981 | - } |
982 | - |
983 | - g_strfreev (desktops); |
984 | - } |
985 | - } |
986 | - |
987 | - return storage; |
988 | -} |
989 | - |
990 | -/* Factory methods */ |
991 | - |
992 | -static inline GSettings * |
993 | -get_settings_no_abort (const gchar *schema) |
994 | -{ |
995 | - GSettings *settings = NULL; |
996 | - |
997 | - if (g_settings_schema_source_lookup (g_settings_schema_source_get_default(), schema, TRUE)) { |
998 | - settings = g_settings_new (schema); |
999 | - } |
1000 | - |
1001 | - return settings; |
1002 | -} |
1003 | - |
1004 | -static void |
1005 | -org_compiz_gwd_settings_changed (GSettings *settings, |
1006 | - const gchar *key, |
1007 | - gpointer user_data) |
1008 | -{ |
1009 | - GWDSettingsStorage *storage = GWD_SETTINGS_STORAGE_INTERFACE (user_data); |
1010 | - |
1011 | - if (strcmp (key, ORG_COMPIZ_GWD_KEY_MOUSE_WHEEL_ACTION) == 0) |
1012 | - gwd_settings_storage_update_titlebar_actions (storage); |
1013 | - else if (strcmp (key, ORG_COMPIZ_GWD_KEY_BLUR_TYPE) == 0) |
1014 | - gwd_settings_storage_update_blur (storage); |
1015 | - else if (strcmp (key, ORG_COMPIZ_GWD_KEY_USE_METACITY_THEME) == 0) |
1016 | - gwd_settings_storage_update_metacity_theme (storage); |
1017 | - else if (strcmp (key, ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_OPACITY) == 0 || |
1018 | - strcmp (key, ORG_COMPIZ_GWD_KEY_METACITY_THEME_INACTIVE_SHADE_OPACITY) == 0 || |
1019 | - strcmp (key, ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_OPACITY) == 0 || |
1020 | - strcmp (key, ORG_COMPIZ_GWD_KEY_METACITY_THEME_ACTIVE_SHADE_OPACITY) == 0) |
1021 | - gwd_settings_storage_update_opacity (storage); |
1022 | - else if (strcmp (key, ORG_COMPIZ_GWD_KEY_USE_TOOLTIPS) == 0) |
1023 | - gwd_settings_storage_update_use_tooltips (storage); |
1024 | -} |
1025 | - |
1026 | -void |
1027 | -gwd_connect_org_compiz_gwd_settings (GSettings *settings, |
1028 | - GWDSettingsStorage *storage) |
1029 | -{ |
1030 | - if (!settings) |
1031 | - return; |
1032 | - |
1033 | - g_signal_connect (settings, "changed", (GCallback) org_compiz_gwd_settings_changed, storage); |
1034 | -} |
1035 | - |
1036 | -GSettings * |
1037 | -gwd_get_org_compiz_gwd_settings () |
1038 | -{ |
1039 | - return get_settings_no_abort (ORG_COMPIZ_GWD); |
1040 | -} |
1041 | - |
1042 | -static void |
1043 | -org_gnome_metacity_settings_changed (GSettings *settings, |
1044 | - const gchar *key, |
1045 | - gpointer user_data) |
1046 | -{ |
1047 | - GWDSettingsStorage *storage; |
1048 | - |
1049 | - storage = GWD_SETTINGS_STORAGE_INTERFACE (user_data); |
1050 | - |
1051 | - if (strcmp (key, ORG_GNOME_METACITY_THEME) == 0) |
1052 | - gwd_settings_storage_update_metacity_theme (storage); |
1053 | -} |
1054 | - |
1055 | -void |
1056 | -gwd_connect_org_gnome_metacity_settings (GSettings *settings, |
1057 | - GWDSettingsStorage *storage) |
1058 | -{ |
1059 | - if (!settings) |
1060 | - return; |
1061 | - |
1062 | - g_signal_connect (settings, "changed", (GCallback) org_gnome_metacity_settings_changed, storage); |
1063 | -} |
1064 | - |
1065 | -GSettings * |
1066 | -gwd_get_org_gnome_metacity_settings () |
1067 | -{ |
1068 | - return get_settings_no_abort (ORG_GNOME_METACITY); |
1069 | -} |
1070 | - |
1071 | -static void |
1072 | -org_gnome_desktop_wm_keybindings_settings_changed (GSettings *settings, |
1073 | - const gchar *key, |
1074 | - gpointer user_data) |
1075 | -{ |
1076 | - GWDSettingsStorage *storage = GWD_SETTINGS_STORAGE_INTERFACE (user_data); |
1077 | - |
1078 | - if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_USES_SYSTEM_FONT) == 0 || |
1079 | - strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_FONT) == 0) |
1080 | - gwd_settings_storage_update_font (storage); |
1081 | - else if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_TITLEBAR_FONT) == 0) |
1082 | - gwd_settings_storage_update_font (storage); |
1083 | - else if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_DOUBLE_CLICK_TITLEBAR) == 0 || |
1084 | - strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_MIDDLE_CLICK_TITLEBAR) == 0 || |
1085 | - strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_ACTION_RIGHT_CLICK_TITLEBAR) == 0) |
1086 | - gwd_settings_storage_update_titlebar_actions (storage); |
1087 | - else if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_THEME) == 0) |
1088 | - gwd_settings_storage_update_metacity_theme (storage); |
1089 | - else if (strcmp (key, ORG_GNOME_DESKTOP_WM_PREFERENCES_BUTTON_LAYOUT) == 0) |
1090 | - gwd_settings_storage_update_button_layout (storage); |
1091 | -} |
1092 | - |
1093 | -void |
1094 | -gwd_connect_org_gnome_desktop_wm_preferences_settings (GSettings *settings, |
1095 | - GWDSettingsStorage *storage) |
1096 | -{ |
1097 | - if (!settings) |
1098 | - return; |
1099 | - |
1100 | - g_signal_connect (settings, "changed", |
1101 | - (GCallback) org_gnome_desktop_wm_keybindings_settings_changed, storage); |
1102 | -} |
1103 | - |
1104 | -GSettings * |
1105 | -gwd_get_org_gnome_desktop_wm_preferences_settings () |
1106 | -{ |
1107 | - return get_settings_no_abort (ORG_GNOME_DESKTOP_WM_PREFERENCES); |
1108 | -} |
1109 | - |
1110 | -static void |
1111 | -org_mate_marco_general_settings_changed (GSettings *settings, |
1112 | - const gchar *key, |
1113 | - gpointer user_data) |
1114 | -{ |
1115 | - GWDSettingsStorage *storage; |
1116 | - |
1117 | - storage = GWD_SETTINGS_STORAGE_INTERFACE (user_data); |
1118 | - |
1119 | - if (strcmp (key, ORG_MATE_MARCO_GENERAL_TITLEBAR_USES_SYSTEM_FONT) == 0 || |
1120 | - strcmp (key, ORG_MATE_MARCO_GENERAL_TITLEBAR_FONT) == 0) |
1121 | - gwd_settings_storage_update_font (storage); |
1122 | - else if (strcmp (key, ORG_MATE_MARCO_GENERAL_TITLEBAR_FONT) == 0) |
1123 | - gwd_settings_storage_update_font (storage); |
1124 | - else if (strcmp (key, ORG_MATE_MARCO_GENERAL_ACTION_DOUBLE_CLICK_TITLEBAR) == 0 || |
1125 | - strcmp (key, ORG_MATE_MARCO_GENERAL_ACTION_MIDDLE_CLICK_TITLEBAR) == 0 || |
1126 | - strcmp (key, ORG_MATE_MARCO_GENERAL_ACTION_RIGHT_CLICK_TITLEBAR) == 0) |
1127 | - gwd_settings_storage_update_titlebar_actions (storage); |
1128 | - else if (strcmp (key, ORG_MATE_MARCO_GENERAL_THEME) == 0) |
1129 | - gwd_settings_storage_update_metacity_theme (storage); |
1130 | - else if (strcmp (key, ORG_MATE_MARCO_GENERAL_BUTTON_LAYOUT) == 0) |
1131 | - gwd_settings_storage_update_button_layout (storage); |
1132 | -} |
1133 | - |
1134 | -void |
1135 | -gwd_connect_org_mate_marco_general_settings (GSettings *settings, |
1136 | - GWDSettingsStorage *storage) |
1137 | -{ |
1138 | - if (!settings) |
1139 | - return; |
1140 | - |
1141 | - g_signal_connect (settings, "changed", (GCallback) org_mate_marco_general_settings_changed, storage); |
1142 | -} |
1143 | - |
1144 | -GSettings * |
1145 | -gwd_get_org_mate_marco_general_settings () |
1146 | -{ |
1147 | - return get_settings_no_abort (ORG_MATE_MARCO_GENERAL); |
1148 | + g_free (right_click_action); |
1149 | +} |
1150 | + |
1151 | +GSettings * |
1152 | +gwd_get_org_compiz_gwd_settings (GWDSettingsStorage *storage) |
1153 | +{ |
1154 | + return storage->gwd; |
1155 | +} |
1156 | + |
1157 | +GSettings * |
1158 | +gwd_get_org_gnome_desktop_wm_preferences_settings (GWDSettingsStorage *storage) |
1159 | +{ |
1160 | + return storage->desktop; |
1161 | +} |
1162 | + |
1163 | +GSettings * |
1164 | +gwd_get_org_gnome_metacity_settings (GWDSettingsStorage *storage) |
1165 | +{ |
1166 | + return storage->metacity; |
1167 | +} |
1168 | + |
1169 | +GSettings * |
1170 | +gwd_get_org_mate_marco_general_settings (GWDSettingsStorage *storage) |
1171 | +{ |
1172 | + return storage->marco; |
1173 | } |
1174 | |
1175 | === renamed file 'gtk/window-decorator/gwd-settings-storage-gsettings.h' => 'gtk/window-decorator/gwd-settings-storage.h' |
1176 | --- gtk/window-decorator/gwd-settings-storage-gsettings.h 2016-03-11 14:43:02 +0000 |
1177 | +++ gtk/window-decorator/gwd-settings-storage.h 2016-05-12 13:05:25 +0000 |
1178 | @@ -17,52 +17,15 @@ |
1179 | * |
1180 | * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
1181 | */ |
1182 | -#ifndef _COMPIZ_GWD_SETTINGS_STORAGE_GSETTINGS_H |
1183 | -#define _COMPIZ_GWD_SETTINGS_STORAGE_GSETTINGS_H |
1184 | + |
1185 | +#ifndef GWD_SETTINGS_STORAGE_H |
1186 | +#define GWD_SETTINGS_STORAGE_H |
1187 | |
1188 | #include <glib-object.h> |
1189 | #include <gwd-fwd.h> |
1190 | |
1191 | G_BEGIN_DECLS |
1192 | |
1193 | -#define GWD_TYPE_SETTINGS_STORAGE_GSETTINGS (gwd_settings_storage_gsettings_get_type ()) |
1194 | -GType gwd_settings_storage_gsettings_get_type (); |
1195 | - |
1196 | -GWDSettingsStorage * |
1197 | -gwd_settings_storage_gsettings_new (GSettings *orgGNOMEDesktopSettings, |
1198 | - GSettings *metacitySettings, |
1199 | - GSettings *marcoSettings, |
1200 | - GSettings *gwdSettings, |
1201 | - GWDSettingsWritable *writableSettings); |
1202 | - |
1203 | -void |
1204 | -gwd_connect_org_compiz_gwd_settings (GSettings *settings, |
1205 | - GWDSettingsStorage *storage); |
1206 | - |
1207 | -GSettings * |
1208 | -gwd_get_org_compiz_gwd_settings (); |
1209 | - |
1210 | -void |
1211 | -gwd_connect_org_gnome_metacity_settings (GSettings *settings, |
1212 | - GWDSettingsStorage *storage); |
1213 | - |
1214 | -GSettings * |
1215 | -gwd_get_org_gnome_metacity_settings (); |
1216 | - |
1217 | -void |
1218 | -gwd_connect_org_gnome_desktop_wm_preferences_settings (GSettings *settings, |
1219 | - GWDSettingsStorage *storage); |
1220 | - |
1221 | -GSettings * |
1222 | -gwd_get_org_gnome_desktop_wm_preferences_settings (); |
1223 | - |
1224 | -void |
1225 | -gwd_connect_org_mate_marco_general_settings (GSettings *settings, |
1226 | - GWDSettingsStorage *storage); |
1227 | - |
1228 | -GSettings * |
1229 | -gwd_get_org_mate_marco_general_settings (); |
1230 | - |
1231 | extern const gchar * ORG_COMPIZ_GWD; |
1232 | extern const gchar * ORG_GNOME_METACITY; |
1233 | extern const gchar * ORG_GNOME_DESKTOP_WM_PREFERENCES; |
1234 | @@ -92,6 +55,47 @@ |
1235 | extern const gchar * ORG_MATE_MARCO_GENERAL_TITLEBAR_FONT; |
1236 | extern const gchar * ORG_MATE_MARCO_GENERAL_BUTTON_LAYOUT; |
1237 | |
1238 | +#define GWD_TYPE_SETTINGS_STORAGE gwd_settings_storage_get_type () |
1239 | +G_DECLARE_FINAL_TYPE (GWDSettingsStorage, gwd_settings_storage, |
1240 | + GWD, SETTINGS_STORAGE, GObject) |
1241 | + |
1242 | +GWDSettingsStorage * |
1243 | +gwd_settings_storage_new (GWDSettingsWritable *writable, |
1244 | + gboolean connect); |
1245 | + |
1246 | +gboolean |
1247 | +gwd_settings_storage_update_use_tooltips (GWDSettingsStorage *storage); |
1248 | + |
1249 | +gboolean |
1250 | +gwd_settings_storage_update_blur (GWDSettingsStorage *storage); |
1251 | + |
1252 | +gboolean |
1253 | +gwd_settings_storage_update_metacity_theme (GWDSettingsStorage *storage); |
1254 | + |
1255 | +gboolean |
1256 | +gwd_settings_storage_update_opacity (GWDSettingsStorage *storage); |
1257 | + |
1258 | +gboolean |
1259 | +gwd_settings_storage_update_button_layout (GWDSettingsStorage *storage); |
1260 | + |
1261 | +gboolean |
1262 | +gwd_settings_storage_update_font (GWDSettingsStorage *storage); |
1263 | + |
1264 | +gboolean |
1265 | +gwd_settings_storage_update_titlebar_actions (GWDSettingsStorage *storage); |
1266 | + |
1267 | +GSettings * |
1268 | +gwd_get_org_compiz_gwd_settings (GWDSettingsStorage *storage); |
1269 | + |
1270 | +GSettings * |
1271 | +gwd_get_org_gnome_desktop_wm_preferences_settings (GWDSettingsStorage *storage); |
1272 | + |
1273 | +GSettings * |
1274 | +gwd_get_org_gnome_metacity_settings (GWDSettingsStorage *storage); |
1275 | + |
1276 | +GSettings * |
1277 | +gwd_get_org_mate_marco_general_settings (GWDSettingsStorage *storage); |
1278 | + |
1279 | G_END_DECLS |
1280 | |
1281 | #endif |
1282 | |
1283 | === modified file 'gtk/window-decorator/settings.c' |
1284 | --- gtk/window-decorator/settings.c 2016-05-12 13:05:25 +0000 |
1285 | +++ gtk/window-decorator/settings.c 2016-05-12 13:05:25 +0000 |
1286 | @@ -21,8 +21,7 @@ |
1287 | |
1288 | #include "gtk-window-decorator.h" |
1289 | #include "gwd-settings-writable-interface.h" |
1290 | -#include "gwd-settings-storage-interface.h" |
1291 | -#include "gwd-settings-storage-gsettings.h" |
1292 | +#include "gwd-settings-storage.h" |
1293 | #include "gwd-settings-xproperty-storage.h" |
1294 | |
1295 | GWDSettingsStorage *storage = NULL; |
1296 | @@ -30,20 +29,9 @@ |
1297 | |
1298 | gboolean |
1299 | init_settings (GWDSettingsWritable *writable, |
1300 | - WnckScreen *screen) |
1301 | + WnckScreen *screen) |
1302 | { |
1303 | - GSettings *compiz = gwd_get_org_compiz_gwd_settings (); |
1304 | - GSettings *metacity = gwd_get_org_gnome_metacity_settings (); |
1305 | - GSettings *gnome = gwd_get_org_gnome_desktop_wm_preferences_settings (); |
1306 | - GSettings *marco = gwd_get_org_mate_marco_general_settings (); |
1307 | - |
1308 | - storage = gwd_settings_storage_gsettings_new (gnome, metacity, marco, compiz, writable); |
1309 | - |
1310 | - gwd_connect_org_compiz_gwd_settings (compiz, storage); |
1311 | - gwd_connect_org_gnome_metacity_settings (metacity, storage); |
1312 | - gwd_connect_org_gnome_desktop_wm_preferences_settings (gnome, storage); |
1313 | - gwd_connect_org_mate_marco_general_settings (marco, storage); |
1314 | - |
1315 | + storage = gwd_settings_storage_new (writable, TRUE); |
1316 | xprop_storage = gwd_settings_xproperty_storage_new (writable); |
1317 | |
1318 | gwd_settings_storage_update_metacity_theme (storage); |
1319 | @@ -53,6 +41,7 @@ |
1320 | gwd_settings_storage_update_titlebar_actions (storage); |
1321 | gwd_settings_storage_update_blur (storage); |
1322 | gwd_settings_storage_update_use_tooltips (storage); |
1323 | + |
1324 | gwd_process_decor_shadow_property_update (); |
1325 | |
1326 | return TRUE; |
1327 | |
1328 | === modified file 'gtk/window-decorator/tests/CMakeLists.txt' |
1329 | --- gtk/window-decorator/tests/CMakeLists.txt 2016-05-12 13:05:25 +0000 |
1330 | +++ gtk/window-decorator/tests/CMakeLists.txt 2016-05-12 13:05:25 +0000 |
1331 | @@ -18,12 +18,6 @@ |
1332 | link_directories (${CMAKE_CURRENT_BINARY_DIR} |
1333 | ${CMAKE_CURRENT_BINARY_DIR}/..) |
1334 | |
1335 | - add_library (gtk_window_decorator_mock_settings_storage STATIC |
1336 | - ${CMAKE_CURRENT_SOURCE_DIR}/compiz_gwd_mock_settings_storage.cpp) |
1337 | - |
1338 | - target_link_libraries (gtk_window_decorator_mock_settings_storage |
1339 | - gtk_window_decorator_settings_storage_interface) |
1340 | - |
1341 | add_library (gtk_window_decorator_mock_settings STATIC |
1342 | ${CMAKE_CURRENT_SOURCE_DIR}/compiz_gwd_mock_settings.cpp) |
1343 | |
1344 | @@ -49,13 +43,11 @@ |
1345 | gtk_window_decorator_settings |
1346 | gtk_window_decorator_mock_settings |
1347 | gtk_window_decorator_mock_settings_writable |
1348 | - gtk_window_decorator_mock_settings_storage |
1349 | gtk_window_decorator_mock_settings_notified) |
1350 | |
1351 | set (COMPIZ_TEST_GWD_SETTINGS_COVERAGE_TARGETS |
1352 | gtk_window_decorator_settings |
1353 | gtk_window_decorator_settings_interface |
1354 | - gtk_window_decorator_settings_storage_interface |
1355 | gtk_window_decorator_settings_notified_interface) |
1356 | |
1357 | set (_desktop_gschema_name org.gnome.desktop.wm.preferences) |
1358 | |
1359 | === removed file 'gtk/window-decorator/tests/compiz_gwd_mock_settings_storage.cpp' |
1360 | --- gtk/window-decorator/tests/compiz_gwd_mock_settings_storage.cpp 2016-02-22 12:27:13 +0000 |
1361 | +++ gtk/window-decorator/tests/compiz_gwd_mock_settings_storage.cpp 1970-01-01 00:00:00 +0000 |
1362 | @@ -1,195 +0,0 @@ |
1363 | -/* |
1364 | - * Copyright © 2012 Canonical Ltd |
1365 | - * |
1366 | - * This program is free software; you can redistribute it and/or modify |
1367 | - * it under the terms of the GNU General Public License as published by |
1368 | - * the Free Software Foundation; either version 2 of the License, or |
1369 | - * (at your option) any later version. |
1370 | - * |
1371 | - * This program is distributed in the hope that it will be useful, |
1372 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1373 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1374 | - * GNU General Public License for more details. |
1375 | - * |
1376 | - * You should have received a copy of the GNU General Public License |
1377 | - * along with this program; if not, write to the Free Software Foundation, |
1378 | - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1379 | - * |
1380 | - * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
1381 | - */ |
1382 | -#include <gtest/gtest.h> |
1383 | -#include <gmock/gmock.h> |
1384 | - |
1385 | -#include <glib-object.h> |
1386 | - |
1387 | -#include "gwd-settings-storage-interface.h" |
1388 | -#include "compiz_gwd_mock_settings_storage.h" |
1389 | - |
1390 | -#define GWD_MOCK_SETTINGS_STORAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GWD_TYPE_MOCK_SETTINGS_STORAGE, GWDMockSettingsStorage)); |
1391 | -#define GWD_MOCK_SETTINGS_STORAGE_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GWD_TYPE_MOCK_SETTINGS_STORAGE, GWDMockSettingsStorageClass)); |
1392 | -#define GWD_IS_MOCK_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GWD_TYPE_MOCK_SETTINGS_STORAGE)); |
1393 | -#define GWD_IS_MOCK_SETTINGS_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), GWD_TYPE_MOCK_SETTINGS_STORAGE)); |
1394 | -#define GWD_MOCK_SETTINGS_STORAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GWD_TYPE_MOCK_SETTINGS_STORAGE, GWDMockSettingsStorageClass)); |
1395 | - |
1396 | -typedef struct _GWDMockSettingsStorage |
1397 | -{ |
1398 | - GObject parent; |
1399 | -} GWDMockSettingsStorage; |
1400 | - |
1401 | -typedef struct _GWDMockSettingsStorageClass |
1402 | -{ |
1403 | - GObjectClass parent_class; |
1404 | -} GWDMockSettingsStorageClass; |
1405 | - |
1406 | -static void gwd_mock_settings_storage_interface_init (GWDSettingsStorageInterface *interface); |
1407 | - |
1408 | -G_DEFINE_TYPE_WITH_CODE (GWDMockSettingsStorage, gwd_mock_settings_storage, G_TYPE_OBJECT, |
1409 | - G_IMPLEMENT_INTERFACE (GWD_TYPE_SETTINGS_STORAGE_INTERFACE, |
1410 | - gwd_mock_settings_storage_interface_init)) |
1411 | - |
1412 | -#define GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GWD_TYPE_MOCK_SETTINGS_STORAGE, GWDMockSettingsStoragePrivate)) |
1413 | - |
1414 | -enum |
1415 | -{ |
1416 | - GWD_MOCK_SETTINGS_STORAGE_PROPERTY_GMOCK_INTERFACE = 1 |
1417 | -}; |
1418 | - |
1419 | -typedef struct _GWDMockSettingsStoragePrivate |
1420 | -{ |
1421 | - GWDMockSettingsStorageGMockInterface *mock; |
1422 | -} GWDMockSettingsStoragePrivate; |
1423 | - |
1424 | -gboolean gwd_mock_settings_storage_update_use_tooltips (GWDSettingsStorage *settings) |
1425 | -{ |
1426 | - GWDMockSettingsStorage *settingsStorageMock = GWD_MOCK_SETTINGS_STORAGE (settings); |
1427 | - GWDMockSettingsStorageGMockInterface *settingsGMock = GET_PRIVATE (settingsStorageMock)->mock; |
1428 | - return settingsGMock->updateUseTooltips (); |
1429 | -} |
1430 | - |
1431 | -gboolean gwd_mock_settings_storage_update_blur (GWDSettingsStorage *settings) |
1432 | -{ |
1433 | - GWDMockSettingsStorage *settingsStorageMock = GWD_MOCK_SETTINGS_STORAGE (settings); |
1434 | - GWDMockSettingsStorageGMockInterface *settingsGMock = GET_PRIVATE (settingsStorageMock)->mock; |
1435 | - return settingsGMock->updateBlur (); |
1436 | -} |
1437 | - |
1438 | -gboolean gwd_mock_settings_storage_update_metacity_theme (GWDSettingsStorage *settings) |
1439 | -{ |
1440 | - GWDMockSettingsStorage *settingsStorageMock = GWD_MOCK_SETTINGS_STORAGE (settings); |
1441 | - GWDMockSettingsStorageGMockInterface *settingsGMock = GET_PRIVATE (settingsStorageMock)->mock; |
1442 | - return settingsGMock->updateMetacityTheme (); |
1443 | -} |
1444 | - |
1445 | -gboolean gwd_mock_settings_storage_update_opacity (GWDSettingsStorage *settings) |
1446 | -{ |
1447 | - GWDMockSettingsStorage *settingsStorageMock = GWD_MOCK_SETTINGS_STORAGE (settings); |
1448 | - GWDMockSettingsStorageGMockInterface *settingsGMock = GET_PRIVATE (settingsStorageMock)->mock; |
1449 | - return settingsGMock->updateOpacity (); |
1450 | -} |
1451 | - |
1452 | -gboolean gwd_mock_settings_storage_update_button_layout (GWDSettingsStorage *settings) |
1453 | -{ |
1454 | - GWDMockSettingsStorage *settingsStorageMock = GWD_MOCK_SETTINGS_STORAGE (settings); |
1455 | - GWDMockSettingsStorageGMockInterface *settingsGMock = GET_PRIVATE (settingsStorageMock)->mock; |
1456 | - return settingsGMock->updateButtonLayout (); |
1457 | -} |
1458 | - |
1459 | -gboolean gwd_mock_settings_storage_update_font (GWDSettingsStorage *settings) |
1460 | -{ |
1461 | - GWDMockSettingsStorage *settingsStorageMock = GWD_MOCK_SETTINGS_STORAGE (settings); |
1462 | - GWDMockSettingsStorageGMockInterface *settingsGMock = GET_PRIVATE (settingsStorageMock)->mock; |
1463 | - return settingsGMock->updateFont (); |
1464 | -} |
1465 | - |
1466 | -gboolean gwd_mock_settings_storage_update_titlebar_actions (GWDSettingsStorage *settings) |
1467 | -{ |
1468 | - GWDMockSettingsStorage *settingsStorageMock = GWD_MOCK_SETTINGS_STORAGE (settings); |
1469 | - GWDMockSettingsStorageGMockInterface *settingsGMock = GET_PRIVATE (settingsStorageMock)->mock; |
1470 | - return settingsGMock->updateTitlebarActions (); |
1471 | -} |
1472 | - |
1473 | -static void gwd_mock_settings_storage_interface_init (GWDSettingsStorageInterface *interface) |
1474 | -{ |
1475 | - interface->update_use_tooltips = gwd_mock_settings_storage_update_use_tooltips; |
1476 | - interface->update_blur = gwd_mock_settings_storage_update_blur; |
1477 | - interface->update_metacity_theme = gwd_mock_settings_storage_update_metacity_theme; |
1478 | - interface->update_opacity = gwd_mock_settings_storage_update_opacity; |
1479 | - interface->update_button_layout = gwd_mock_settings_storage_update_button_layout; |
1480 | - interface->update_font = gwd_mock_settings_storage_update_font; |
1481 | - interface->update_titlebar_actions = gwd_mock_settings_storage_update_titlebar_actions; |
1482 | -} |
1483 | - |
1484 | -static void gwd_mock_settings_storage_set_property (GObject *object, |
1485 | - guint property_id, |
1486 | - const GValue *value, |
1487 | - GParamSpec *pspec) |
1488 | -{ |
1489 | - GWDMockSettingsStoragePrivate *priv = GET_PRIVATE (object); |
1490 | - |
1491 | - switch (property_id) |
1492 | - { |
1493 | - case GWD_MOCK_SETTINGS_STORAGE_PROPERTY_GMOCK_INTERFACE: |
1494 | - if (!priv->mock) |
1495 | - priv->mock = reinterpret_cast <GWDMockSettingsStorageGMockInterface *> (g_value_get_pointer (value)); |
1496 | - break; |
1497 | - default: |
1498 | - g_assert_not_reached (); |
1499 | - } |
1500 | -} |
1501 | - |
1502 | -static void gwd_mock_settings_storage_dispose (GObject *object) |
1503 | -{ |
1504 | - GWDMockSettingsStorageGMockInterface *settingsGMock = GET_PRIVATE (object)->mock; |
1505 | - G_OBJECT_CLASS (gwd_mock_settings_storage_parent_class)->dispose (object); |
1506 | - settingsGMock->dispose (); |
1507 | -} |
1508 | - |
1509 | -static void gwd_mock_settings_storage_finalize (GObject *object) |
1510 | -{ |
1511 | - GWDMockSettingsStorageGMockInterface *settingsGMock = GET_PRIVATE (object)->mock; |
1512 | - G_OBJECT_CLASS (gwd_mock_settings_storage_parent_class)->finalize (object); |
1513 | - settingsGMock->finalize (); |
1514 | -} |
1515 | - |
1516 | -static void gwd_mock_settings_storage_class_init (GWDMockSettingsStorageClass *klass) |
1517 | -{ |
1518 | - GObjectClass *object_class = G_OBJECT_CLASS (klass); |
1519 | - |
1520 | - g_type_class_add_private (klass, sizeof (GWDMockSettingsStoragePrivate)); |
1521 | - |
1522 | - object_class->dispose = gwd_mock_settings_storage_dispose; |
1523 | - object_class->finalize = gwd_mock_settings_storage_finalize; |
1524 | - object_class->set_property = gwd_mock_settings_storage_set_property; |
1525 | - |
1526 | - g_object_class_install_property (object_class, |
1527 | - GWD_MOCK_SETTINGS_STORAGE_PROPERTY_GMOCK_INTERFACE, |
1528 | - g_param_spec_pointer ("gmock-interface", |
1529 | - "Google Mock Interface", |
1530 | - "Google Mock Interface", |
1531 | - static_cast <GParamFlags> (G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY))); |
1532 | -} |
1533 | - |
1534 | -void gwd_mock_settings_storage_init (GWDMockSettingsStorage *self) |
1535 | -{ |
1536 | -} |
1537 | - |
1538 | -GWDSettingsStorage * |
1539 | -gwd_mock_settings_storage_new (GWDMockSettingsStorageGMockInterface *gmock) |
1540 | -{ |
1541 | - GValue gmock_interface_v = G_VALUE_INIT; |
1542 | - |
1543 | - g_value_init (&gmock_interface_v, G_TYPE_POINTER); |
1544 | - |
1545 | - g_value_set_pointer (&gmock_interface_v, reinterpret_cast <gpointer> (gmock)); |
1546 | - |
1547 | - GParameter param[1] = |
1548 | - { |
1549 | - { "gmock-interface", gmock_interface_v } |
1550 | - }; |
1551 | - |
1552 | - GWDSettingsStorage *storage = GWD_SETTINGS_STORAGE_INTERFACE (g_object_newv (GWD_TYPE_MOCK_SETTINGS_STORAGE, 1, param)); |
1553 | - |
1554 | - g_value_unset (&gmock_interface_v); |
1555 | - |
1556 | - return storage; |
1557 | -} |
1558 | |
1559 | === removed file 'gtk/window-decorator/tests/compiz_gwd_mock_settings_storage.h' |
1560 | --- gtk/window-decorator/tests/compiz_gwd_mock_settings_storage.h 2012-09-06 10:08:25 +0000 |
1561 | +++ gtk/window-decorator/tests/compiz_gwd_mock_settings_storage.h 1970-01-01 00:00:00 +0000 |
1562 | @@ -1,80 +0,0 @@ |
1563 | -/* |
1564 | - * Copyright © 2012 Canonical Ltd |
1565 | - * |
1566 | - * This program is free software; you can redistribute it and/or modify |
1567 | - * it under the terms of the GNU General Public License as published by |
1568 | - * the Free Software Foundation; either version 2 of the License, or |
1569 | - * (at your option) any later version. |
1570 | - * |
1571 | - * This program is distributed in the hope that it will be useful, |
1572 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1573 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1574 | - * GNU General Public License for more details. |
1575 | - * |
1576 | - * You should have received a copy of the GNU General Public License |
1577 | - * along with this program; if not, write to the Free Software Foundation, |
1578 | - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1579 | - * |
1580 | - * Authored By: Sam Spilsbury <sam.spilsbury@canonical.com> |
1581 | - */ |
1582 | -#ifndef _COMPIZ_GWD_MOCK_SETTINGS_STORAGE_H |
1583 | -#define _COMPIZ_GWD_MOCK_SETTINGS_STORAGE_H |
1584 | - |
1585 | -#include <gtest/gtest.h> |
1586 | -#include <gmock/gmock.h> |
1587 | - |
1588 | -#include <glib-object.h> |
1589 | - |
1590 | -typedef struct _GWDSettingsStorage GWDSettingsStorage; |
1591 | - |
1592 | -class GWDMockSettingsStorageGMockInterface; |
1593 | - |
1594 | -G_BEGIN_DECLS |
1595 | - |
1596 | -#define GWD_TYPE_MOCK_SETTINGS_STORAGE (gwd_mock_settings_storage_get_type ()) |
1597 | -GType gwd_mock_settings_storage_get_type (); |
1598 | - |
1599 | -GWDSettingsStorage * |
1600 | -gwd_mock_settings_storage_new (GWDMockSettingsStorageGMockInterface *); |
1601 | - |
1602 | -G_END_DECLS |
1603 | - |
1604 | -class GWDMockSettingsStorageGMockInterface |
1605 | -{ |
1606 | - public: |
1607 | - |
1608 | - virtual ~GWDMockSettingsStorageGMockInterface () {} |
1609 | - |
1610 | - virtual gboolean updateUseTooltips () = 0; |
1611 | - virtual gboolean updateDraggableBorderWidth () = 0; |
1612 | - virtual gboolean updateAttachModalDialogs () = 0; |
1613 | - virtual gboolean updateBlur () = 0; |
1614 | - virtual gboolean updateMetacityTheme () = 0; |
1615 | - virtual gboolean updateOpacity () = 0; |
1616 | - virtual gboolean updateButtonLayout () = 0; |
1617 | - virtual gboolean updateFont () = 0; |
1618 | - virtual gboolean updateTitlebarActions () = 0; |
1619 | - |
1620 | - virtual void dispose () = 0; |
1621 | - virtual void finalize () = 0; |
1622 | -}; |
1623 | - |
1624 | -class GWDMockSettingsStorageGMock : |
1625 | - public GWDMockSettingsStorageGMockInterface |
1626 | -{ |
1627 | - public: |
1628 | - |
1629 | - MOCK_METHOD0 (updateUseTooltips, gboolean ()); |
1630 | - MOCK_METHOD0 (updateDraggableBorderWidth, gboolean ()); |
1631 | - MOCK_METHOD0 (updateAttachModalDialogs, gboolean ()); |
1632 | - MOCK_METHOD0 (updateBlur, gboolean ()); |
1633 | - MOCK_METHOD0 (updateMetacityTheme, gboolean ()); |
1634 | - MOCK_METHOD0 (updateOpacity, gboolean ()); |
1635 | - MOCK_METHOD0 (updateButtonLayout, gboolean ()); |
1636 | - MOCK_METHOD0 (updateFont, gboolean ()); |
1637 | - MOCK_METHOD0 (updateTitlebarActions, gboolean ()); |
1638 | - MOCK_METHOD0 (dispose, void ()); |
1639 | - MOCK_METHOD0 (finalize, void ()); |
1640 | -}; |
1641 | - |
1642 | -#endif |
1643 | |
1644 | === modified file 'gtk/window-decorator/tests/test_gwd_settings.cpp' |
1645 | --- gtk/window-decorator/tests/test_gwd_settings.cpp 2016-05-12 13:05:25 +0000 |
1646 | +++ gtk/window-decorator/tests/test_gwd_settings.cpp 2016-05-12 13:05:25 +0000 |
1647 | @@ -43,16 +43,14 @@ |
1648 | |
1649 | #include "gwd-settings-interface.h" |
1650 | #include "gwd-settings.h" |
1651 | -#include "gwd-settings-storage-gsettings.h" |
1652 | +#include "gwd-settings-storage.h" |
1653 | #include "gwd-settings-writable-interface.h" |
1654 | -#include "gwd-settings-storage-interface.h" |
1655 | #include "gwd-settings-notified-interface.h" |
1656 | |
1657 | #include "decoration.h" |
1658 | |
1659 | #include "compiz_gwd_mock_settings.h" |
1660 | #include "compiz_gwd_mock_settings_writable.h" |
1661 | -#include "compiz_gwd_mock_settings_storage.h" |
1662 | #include "compiz_gwd_mock_settings_notified.h" |
1663 | |
1664 | using ::testing::TestWithParam; |
1665 | @@ -1288,152 +1286,6 @@ |
1666 | gwd_settings_storage_update_titlebar_actions (storage); |
1667 | } |
1668 | |
1669 | -class GWDMockSettingsStorageFactoryWrapper : |
1670 | - public GWDSettingsStorageFactoryWrapperInterface |
1671 | -{ |
1672 | - public: |
1673 | - |
1674 | - virtual void SetUp (GWDSettingsWritable *writable) |
1675 | - { |
1676 | - mWritable = writable; |
1677 | - mStorageMock.reset (new GWDMockSettingsStorageGMock ()); |
1678 | - mStorage.reset (gwd_mock_settings_storage_new (mStorageMock.get ()), |
1679 | - boost::bind (gwd_settings_storage_unref, _1)); |
1680 | - } |
1681 | - |
1682 | - virtual GWDSettingsStorage * GetStorage () |
1683 | - { |
1684 | - return mStorage.get (); |
1685 | - } |
1686 | - |
1687 | - virtual void SetUseTooltips (gboolean useTooltips) |
1688 | - { |
1689 | - EXPECT_CALL (*mStorageMock, updateUseTooltips ()) |
1690 | - .WillOnce ( |
1691 | - InvokeFunctor ( |
1692 | - boost::bind ( |
1693 | - gwd_settings_writable_use_tooltips_changed, mWritable, useTooltips))); |
1694 | - } |
1695 | - |
1696 | - virtual void SetBlur (const std::string &blurType) |
1697 | - { |
1698 | - EXPECT_CALL (*mStorageMock, updateBlur ()) |
1699 | - .WillOnce ( |
1700 | - InvokeFunctor ( |
1701 | - boost::bind ( |
1702 | - gwd_settings_writable_blur_changed, mWritable, blurType.c_str ()))); |
1703 | - } |
1704 | - |
1705 | - virtual void SetOpacity (gdouble activeOpacity, |
1706 | - gdouble inactiveOpacity, |
1707 | - gboolean activeShadeOpacity, |
1708 | - gboolean inactiveShadeOpacity) |
1709 | - { |
1710 | - EXPECT_CALL (*mStorageMock, updateOpacity ()) |
1711 | - .WillOnce ( |
1712 | - InvokeFunctor ( |
1713 | - boost::bind ( |
1714 | - gwd_settings_writable_opacity_changed, |
1715 | - mWritable, |
1716 | - activeOpacity, |
1717 | - inactiveOpacity, |
1718 | - activeShadeOpacity, |
1719 | - inactiveShadeOpacity))); |
1720 | - } |
1721 | - |
1722 | - virtual void SetMetacityTheme (gboolean useMetacityTheme, |
1723 | - const std::string &metacityTheme) |
1724 | - { |
1725 | - EXPECT_CALL (*mStorageMock, updateMetacityTheme ()) |
1726 | - .WillOnce ( |
1727 | - InvokeFunctor ( |
1728 | - boost::bind ( |
1729 | - gwd_settings_writable_metacity_theme_changed, |
1730 | - mWritable, |
1731 | - useMetacityTheme, |
1732 | - metacityTheme.c_str ()))); |
1733 | - } |
1734 | - |
1735 | - virtual void SetButtonLayout (const std::string &buttonLayout) |
1736 | - { |
1737 | - EXPECT_CALL (*mStorageMock, updateButtonLayout ()) |
1738 | - .WillOnce ( |
1739 | - InvokeFunctor ( |
1740 | - boost::bind ( |
1741 | - gwd_settings_writable_button_layout_changed, mWritable, buttonLayout.c_str ()))); |
1742 | - } |
1743 | - |
1744 | - virtual void SetFont (gboolean useSystemFont, const std::string &titlebarFont) |
1745 | - { |
1746 | - EXPECT_CALL (*mStorageMock, updateFont ()) |
1747 | - .WillOnce ( |
1748 | - InvokeFunctor ( |
1749 | - boost::bind ( |
1750 | - gwd_settings_writable_font_changed, |
1751 | - mWritable, |
1752 | - useSystemFont, |
1753 | - titlebarFont.c_str ()))); |
1754 | - } |
1755 | - |
1756 | - virtual void SetTitlebarActions (const std::string &doubleClickAction, |
1757 | - const std::string &middleClickAction, |
1758 | - const std::string &rightClickAction, |
1759 | - const std::string &mouseWheelAction) |
1760 | - { |
1761 | - EXPECT_CALL (*mStorageMock, updateTitlebarActions ()) |
1762 | - .WillOnce ( |
1763 | - InvokeFunctor ( |
1764 | - boost::bind ( |
1765 | - gwd_settings_writable_titlebar_actions_changed, |
1766 | - mWritable, |
1767 | - doubleClickAction.c_str (), |
1768 | - middleClickAction.c_str (), |
1769 | - rightClickAction.c_str (), |
1770 | - mouseWheelAction.c_str ()))); |
1771 | - } |
1772 | - |
1773 | - virtual void TearDown () |
1774 | - { |
1775 | - if (mStorage) |
1776 | - { |
1777 | - EXPECT_CALL (*mStorageMock, dispose ()); |
1778 | - EXPECT_CALL (*mStorageMock, finalize ()); |
1779 | - } |
1780 | - |
1781 | - mStorage.reset (); |
1782 | - mStorageMock.reset (); |
1783 | - } |
1784 | - |
1785 | - private: |
1786 | - |
1787 | - GWDSettingsWritable *mWritable; |
1788 | - boost::shared_ptr <GWDMockSettingsStorageGMock> mStorageMock; |
1789 | - boost::shared_ptr <GWDSettingsStorage> mStorage; |
1790 | -}; |
1791 | - |
1792 | -INSTANTIATE_TEST_CASE_P (MockStorageUpdates, GWDSettingsTestStorageUpdates, |
1793 | - ::testing::Values (boost::shared_ptr <GWDSettingsStorageFactoryWrapperInterface> (new GWDMockSettingsStorageFactoryWrapper ()))); |
1794 | - |
1795 | -class GWDSettingsStorageGSettingsTest : |
1796 | - public GWDSettingsTestCommon |
1797 | -{ |
1798 | -}; |
1799 | - |
1800 | -TEST_F (GWDSettingsStorageGSettingsTest, TestNoDeathOnConnectingSignalToNULLObject) |
1801 | -{ |
1802 | - boost::shared_ptr <GWDMockSettingsStorageGMock> mStorageMock (new GWDMockSettingsStorageGMock ()); |
1803 | - boost::shared_ptr <GWDSettingsStorage> mStorage (gwd_mock_settings_storage_new (mStorageMock.get ()), |
1804 | - boost::bind (gwd_settings_storage_unref, _1)); |
1805 | - |
1806 | - gwd_connect_org_compiz_gwd_settings (NULL, mStorage.get ()); |
1807 | - gwd_connect_org_gnome_metacity_settings (NULL, mStorage.get ()); |
1808 | - gwd_connect_org_gnome_desktop_wm_preferences_settings (NULL, mStorage.get ()); |
1809 | - gwd_connect_org_mate_marco_general_settings (NULL, mStorage.get ()); |
1810 | - |
1811 | - EXPECT_CALL (*mStorageMock, dispose ()); |
1812 | - EXPECT_CALL (*mStorageMock, finalize ()); |
1813 | -} |
1814 | - |
1815 | class GWDSettingsStorageGSettingsFactoryWrapper : |
1816 | public GWDSettingsStorageFactoryWrapperInterface |
1817 | { |
1818 | @@ -1444,18 +1296,14 @@ |
1819 | gsliceEnv.SetUpEnv (); |
1820 | gsettingsEnv.SetUpEnv (MOCK_PATH); |
1821 | |
1822 | + mStorage.reset (gwd_settings_storage_new (writable, FALSE), |
1823 | + boost::bind (gwd_settings_storage_unref, _1)); |
1824 | + |
1825 | /* We do not need to keep a reference to these */ |
1826 | - mGWDSettings = gwd_get_org_compiz_gwd_settings (); |
1827 | - mMetacitySettings = gwd_get_org_gnome_metacity_settings (); |
1828 | - mDesktopSettings = gwd_get_org_gnome_desktop_wm_preferences_settings (); |
1829 | - mMarcoSettings = gwd_get_org_mate_marco_general_settings (); |
1830 | - |
1831 | - mStorage.reset (gwd_settings_storage_gsettings_new (mDesktopSettings, |
1832 | - mMetacitySettings, |
1833 | - mMarcoSettings, |
1834 | - mGWDSettings, |
1835 | - writable), |
1836 | - boost::bind (gwd_settings_storage_unref, _1)); |
1837 | + mGWDSettings = gwd_get_org_compiz_gwd_settings (GetStorage ()); |
1838 | + mMetacitySettings = gwd_get_org_gnome_metacity_settings (GetStorage ()); |
1839 | + mDesktopSettings = gwd_get_org_gnome_desktop_wm_preferences_settings (GetStorage ()); |
1840 | + mMarcoSettings = gwd_get_org_mate_marco_general_settings (GetStorage ()); |
1841 | } |
1842 | |
1843 | virtual GWDSettingsStorage * GetStorage () |
Makes sense to me - I must have had grander visions at the time I wrote this, but there's no sense keeping the abstraction these days.