Merge lp:~3v1n0/unity-control-center/grouped-compiz-gsettings-support-x into lp:unity-control-center/16.04

Proposed by Marco Trevisan (Treviño) on 2017-07-04
Status: Approved
Approved by: Sebastien Bacher on 2017-11-17
Approved revision: 12869
Proposed branch: lp:~3v1n0/unity-control-center/grouped-compiz-gsettings-support-x
Merge into: lp:unity-control-center/16.04
Prerequisite: lp:~ci-train-bot/unity-control-center/unity-control-center-ubuntu-xenial-2462
Diff against target: 740 lines (+380/-84)
2 files modified
debian/changelog (+9/-0)
panels/appearance/cc-appearance-panel.c (+371/-84)
To merge this branch: bzr merge lp:~3v1n0/unity-control-center/grouped-compiz-gsettings-support-x
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve on 2017-08-09
Unity Control Center development team 2017-07-04 Pending
Review via email: mp+326789@code.launchpad.net

This proposal supersedes a proposal from 2017-06-27.

Commit Message

Appearance: create GroupedGSettings class to manage group of gsettings sharing the schema

Settings might have the same schema, but different path. With this class we manage them
all at once. In this case we use this to correctly read the setting values depending on
the compiz profile we're actually using.

To post a comment you must log in.
Andrea Azzarone (azzar1) wrote :

+1

review: Approve
Sebastien Bacher (seb128) wrote :

looks fine but is there is a need to SRU those changes to xenial?

Marco Trevisan (Treviño) (3v1n0) wrote :

> looks fine but is there is a need to SRU those changes to xenial?

This is part of the work needed to get proper lowgfx setup working, and to fix issues with settings not being properly preserved between the two modes.

Now, being Xenial the main target for unity7 at this point, I think it just make sense to put the fixes we have there.
As they're proved to run fine in the current dev releases for a while.

Unmerged revisions

12869. By Marco Trevisan (Treviño) on 2017-07-18

Appearance: set show-desktop to false when resetting the settings

12868. By Marco Trevisan (Treviño) on 2017-07-18

Merging with lp:unity-control-center/16.04

12867. By Marco Trevisan (Treviño) on 2017-07-06

appearance: fix a typo causing not using the proper variable on vsize

Not triggering a bug for how the code is made, though.

12866. By Marco Trevisan (Treviño) on 2017-07-06

GroupedGSettings: ensure we ref the variant's before setting them

Otherwise when we set floating references they get consumed
by the first call to g_settings_set_value and the value becomes
invalid. Thus we need to remove the floating reference, and
manually ref and unref.

12865. By Marco Trevisan (Treviño) on 2017-06-27

Appearance: create GroupedGSettings class to manage group of gsettings sharing the schema

Settings might have the same schema, but different path. With this class we manage them
all at once. In this case we use this to correctly read the setting values depending on
the compiz profile we're actually using.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2017-02-14 09:17:30 +0000
3+++ debian/changelog 2017-07-18 17:03:55 +0000
4@@ -1,3 +1,12 @@
5+unity-control-center (15.04.0+16.04.20160705-0ubuntu2) UNRELEASED; urgency=medium
6+
7+ * Appearance: create GroupedGSettings class to manage group of
8+ gsettings sharing the schema (LP: #1700600)
9+ * Appearance: set show-desktop to false when resetting the settings
10+ (LP: #1705063)
11+
12+ -- Marco Trevisan (Treviño) <mail@3v1n0.net> Tue, 27 Jun 2017 18:12:20 +0200
13+
14 unity-control-center (15.04.0+16.04.20170214-0ubuntu1) xenial; urgency=medium
15
16 [ Iain Lane ]
17
18=== modified file 'panels/appearance/cc-appearance-panel.c'
19--- panels/appearance/cc-appearance-panel.c 2016-07-05 14:26:25 +0000
20+++ panels/appearance/cc-appearance-panel.c 2017-07-18 17:03:55 +0000
21@@ -5,15 +5,15 @@
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation, either version 2 of the License, or
24 * (at your option) any later version.
25- *
26+ *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU General Public License for more details.
31- *
32+ *
33 * You should have received a copy of the GNU General Public License
34 * along with this program. If not, see <http://www.gnu.org/licenses/>.
35- *
36+ *
37 * Author: Thomas Wood <thomas.wood@intel.com>
38 *
39 */
40@@ -55,6 +55,10 @@
41 #define APPEARANCE_PANEL_PRIVATE(o) \
42 (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_APPEARANCE_PANEL, CcAppearancePanelPrivate))
43
44+typedef struct _GroupedGSettings GroupedGSettings;
45+typedef struct _GroupedGSettingsClass GroupedGSettingsClass;
46+typedef struct _GroupedGSettingsPrivate GroupedGSettingsPrivate;
47+
48 struct _CcAppearancePanelPrivate
49 {
50 GtkBuilder *builder;
51@@ -70,11 +74,15 @@
52 GSettings *settings;
53 GSettings *interface_settings;
54 GSettings *wm_theme_settings;
55- GSettings *unity_settings;
56- GSettings *compizcore_settings;
57 GSettings *unity_own_settings;
58 GSettings *unity_launcher_settings;
59
60+ GroupedGSettings *unity_compiz_gs;
61+ GroupedGSettings *compizcore_compiz_gs;
62+ GSettings *compiz_settings;
63+ GSettings *compizcore_settings;
64+ GSettings *unity_settings;
65+
66 GnomeDesktopThumbnailFactory *thumb_factory;
67
68 CcAppearanceItem *current_background;
69@@ -98,7 +106,13 @@
70 #endif
71 };
72
73-#define UNITY_GSETTINGS_SCHEMA "org.compiz.unityshell"
74+#define COMPIZ_GSETTINGS_SCHEMA "org.compiz"
75+#define COMPIZ_CURRENT_PROFILE_KEY "current-profile"
76+
77+#define UNITY_NORMAL_PROFILE "unity"
78+#define UNITY_LOWGFX_PROFILE "unity-lowgfx"
79+
80+#define UNITY_GSETTINGS_SCHEMA COMPIZ_GSETTINGS_SCHEMA ".unityshell"
81 #define UNITY_PROFILE_PATH "/org/compiz/profiles/%s/plugins/"
82 #define UNITY_GSETTINGS_PATH UNITY_PROFILE_PATH"unityshell/"
83 #define UNITY_ICONSIZE_KEY "icon-size"
84@@ -107,7 +121,7 @@
85 #define UNITY_LAUNCHERREVEAL_KEY "reveal-trigger"
86 #define CANONICAL_DESKTOP_INTERFACE "com.canonical.desktop.interface"
87
88-#define COMPIZCORE_GSETTINGS_SCHEMA "org.compiz.core"
89+#define COMPIZCORE_GSETTINGS_SCHEMA COMPIZ_GSETTINGS_SCHEMA ".core"
90 #define COMPIZCORE_GSETTINGS_PATH UNITY_PROFILE_PATH"core/"
91 #define COMPIZCORE_HSIZE_KEY "hsize"
92 #define COMPIZCORE_VSIZE_KEY "vsize"
93@@ -211,12 +225,30 @@
94 priv->wm_theme_settings = NULL;
95 }
96
97+ if (priv->unity_compiz_gs)
98+ {
99+ g_object_unref (priv->unity_compiz_gs);
100+ priv->unity_compiz_gs = NULL;
101+ }
102+
103+ if (priv->compizcore_compiz_gs)
104+ {
105+ g_object_unref (priv->compizcore_compiz_gs);
106+ priv->compizcore_compiz_gs = NULL;
107+ }
108+
109 if (priv->unity_settings)
110 {
111 g_object_unref (priv->unity_settings);
112 priv->unity_settings = NULL;
113 }
114
115+ if (priv->compiz_settings)
116+ {
117+ g_object_unref (priv->compiz_settings);
118+ priv->compiz_settings = NULL;
119+ }
120+
121 if (priv->compizcore_settings)
122 {
123 g_object_unref (priv->compizcore_settings);
124@@ -291,6 +323,245 @@
125 {
126 }
127
128+/* Implementation of GroupedGSettings a class to manage multiple gsettings
129+ * who share schema but with different paths
130+ */
131+#define IS_GSETTINGS_GROUPED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), \
132+ grouped_gsettings_get_type ()))
133+
134+GType grouped_gsettings_get_type (void) G_GNUC_CONST;
135+
136+struct _GroupedGSettings {
137+ GObject parent_instance;
138+ GroupedGSettingsPrivate *priv;
139+};
140+
141+struct _GroupedGSettingsClass {
142+ GObjectClass parent_class;
143+};
144+
145+struct _GroupedGSettingsPrivate
146+{
147+ GList *settings_list;
148+ GSettings *default_gs;
149+ GSettings **remote_gs;
150+};
151+
152+G_DEFINE_TYPE (GroupedGSettings, grouped_gsettings, G_TYPE_OBJECT)
153+
154+static void
155+grouped_gsettings_dispose (GObject *object)
156+{
157+ GroupedGSettings *self = (GroupedGSettings *) object;
158+
159+ if (self->priv->settings_list)
160+ {
161+ g_list_free_full (self->priv->settings_list, g_object_unref);
162+ self->priv->settings_list = NULL;
163+ }
164+
165+ if (G_OBJECT_CLASS (grouped_gsettings_parent_class))
166+ G_OBJECT_CLASS (grouped_gsettings_parent_class)->dispose (object);
167+}
168+
169+static void
170+grouped_gsettings_class_init (GroupedGSettingsClass *klass)
171+{
172+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
173+
174+ g_type_class_add_private (klass, sizeof (GroupedGSettingsPrivate));
175+
176+ gobject_class->dispose = grouped_gsettings_dispose;
177+
178+ g_signal_new ("changed", G_TYPE_FROM_CLASS (klass),
179+ G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0,
180+ NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE,
181+ 1, G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
182+}
183+
184+static void
185+grouped_gsettings_init (GroupedGSettings *self)
186+{
187+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, grouped_gsettings_get_type (),
188+ GroupedGSettingsPrivate);
189+}
190+
191+static void
192+on_default_settings_changed (GSettings *settings,
193+ gchar *key,
194+ GroupedGSettings *self)
195+{
196+ gchar *signal = g_strdup_printf ("changed::%s", key);
197+ g_signal_emit_by_name (self, signal, key);
198+ g_free (signal);
199+}
200+
201+static GSettings *
202+grouped_gsettings_peek_default (GroupedGSettings *self)
203+{
204+ g_return_val_if_fail (IS_GSETTINGS_GROUPED (self), NULL);
205+ return self->priv->default_gs;
206+}
207+
208+static void
209+grouped_gsettings_set_default_profile (GroupedGSettings *self,
210+ const gchar *profile)
211+{
212+ GList *l;
213+ GroupedGSettingsPrivate *priv;
214+
215+ g_return_if_fail (IS_GSETTINGS_GROUPED (self));
216+ g_return_if_fail (profile);
217+
218+ priv = self->priv;
219+
220+ for (l = priv->settings_list; l; l = l->next)
221+ {
222+ GSettings *settings;
223+ const gchar *settings_profile;
224+
225+ settings = l->data;
226+ settings_profile = g_object_get_data (G_OBJECT (settings), "profile");
227+
228+ if (g_strcmp0 (settings_profile, profile) == 0)
229+ {
230+ if (priv->default_gs == settings)
231+ {
232+ return;
233+ }
234+
235+ if (priv->default_gs)
236+ {
237+ g_signal_handlers_block_by_func (priv->default_gs,
238+ on_default_settings_changed, self);
239+ }
240+
241+ priv->default_gs = settings;
242+ g_signal_handlers_unblock_by_func (settings,
243+ on_default_settings_changed, self);
244+
245+ if (priv->remote_gs)
246+ {
247+ if (G_IS_SETTINGS (*priv->remote_gs))
248+ g_object_unref (*priv->remote_gs);
249+
250+ *priv->remote_gs = g_object_ref (settings);
251+ }
252+
253+ return;
254+ }
255+ }
256+}
257+
258+static void
259+grouped_gsettings_reset (GroupedGSettings *self, const gchar *key)
260+{
261+ g_return_if_fail (IS_GSETTINGS_GROUPED (self));
262+ g_list_foreach (self->priv->settings_list,
263+ (GFunc) g_settings_reset, (gpointer) key);
264+}
265+
266+static void
267+grouped_gsettings_set_value (GroupedGSettings *self,
268+ const gchar *key,
269+ GVariant *value)
270+{
271+ GList *l;
272+
273+ g_return_if_fail (IS_GSETTINGS_GROUPED (self));
274+ g_return_if_fail (g_variant_get_type (value));
275+
276+ g_variant_ref_sink (value);
277+
278+ for (l = self->priv->settings_list; l; l = l->next)
279+ g_settings_set_value (G_SETTINGS (l->data), key, value);
280+
281+ g_variant_unref (value);
282+}
283+
284+static GSettings *
285+grouped_gsettings_add (GroupedGSettings *self,
286+ GSettingsSchema *settings_schema,
287+ const gchar *settings_path,
288+ const gchar *profile,
289+ GSettings **remote_settings)
290+{
291+ GSettings *settings;
292+
293+ g_return_val_if_fail (IS_GSETTINGS_GROUPED (self), NULL);
294+
295+ settings = g_settings_new_full (settings_schema, /*backend*/ NULL, settings_path);
296+ self->priv->settings_list = g_list_prepend (self->priv->settings_list, settings);
297+ self->priv->remote_gs = remote_settings;
298+
299+ g_signal_connect (settings, "changed", G_CALLBACK (on_default_settings_changed), self);
300+ g_signal_handlers_block_by_func (settings, on_default_settings_changed, self);
301+
302+ if (!profile)
303+ {
304+ profile = settings_path;
305+ }
306+
307+ g_object_set_data_full (G_OBJECT (settings), "profile",
308+ (gpointer) g_strdup (profile), g_free);
309+
310+ if (!self->priv->default_gs)
311+ {
312+ grouped_gsettings_set_default_profile (self, profile);
313+ }
314+
315+ return settings;
316+}
317+
318+
319+static GSettings *
320+compiz_grouped_gsettings_add (GroupedGSettings *self,
321+ GSettingsSchema *settings_schema,
322+ const gchar *settings_base_path,
323+ const gchar *compiz_profile,
324+ GSettings **remote_settings)
325+{
326+ GSettings *settings;
327+ gchar *settings_path;
328+
329+ compiz_profile = compiz_profile ? compiz_profile : UNITY_NORMAL_PROFILE;
330+ settings_path = g_strdup_printf (settings_base_path, compiz_profile);
331+ settings = grouped_gsettings_add (self, settings_schema, settings_path,
332+ compiz_profile, remote_settings);
333+ g_free (settings_path);
334+
335+ return settings;
336+}
337+
338+GroupedGSettings *
339+compiz_grouped_gsettings_new (GSettingsSchema *settings_schema,
340+ GSettings *compiz_settings,
341+ const gchar *settings_base_path,
342+ GSettings **remote_settings)
343+{
344+ GroupedGSettings *ggs;
345+ GSettings *settings;
346+ gchar *compiz_profile;
347+
348+ g_return_val_if_fail (settings_base_path, NULL);
349+
350+ ggs = g_object_new (grouped_gsettings_get_type (), NULL);
351+ compiz_profile = g_settings_get_string (compiz_settings,
352+ COMPIZ_CURRENT_PROFILE_KEY);
353+
354+ compiz_grouped_gsettings_add (ggs, settings_schema, settings_base_path,
355+ UNITY_NORMAL_PROFILE, remote_settings);
356+ compiz_grouped_gsettings_add (ggs, settings_schema, settings_base_path,
357+ UNITY_LOWGFX_PROFILE, remote_settings);
358+
359+ grouped_gsettings_set_default_profile (ggs, compiz_profile);
360+ g_free (compiz_profile);
361+
362+ return ggs;
363+}
364+
365+/* GroupedGSettings definition end */
366+
367 static void
368 source_update_edit_box (CcAppearancePanelPrivate *priv,
369 gboolean initial)
370@@ -1387,11 +1658,11 @@
371 }
372
373 static void
374-ext_iconsize_changed_callback (GSettings* settings,
375- guint key,
376+ext_iconsize_changed_callback (GroupedGSettings* compiz_gs,
377+ gchar *key,
378 gpointer user_data)
379 {
380- iconsize_widget_refresh (GTK_ADJUSTMENT (user_data), settings);
381+ iconsize_widget_refresh (GTK_ADJUSTMENT (user_data), grouped_gsettings_peek_default (compiz_gs));
382 }
383
384 static gchar *
385@@ -1401,9 +1672,9 @@
386 }
387
388 static void
389-on_iconsize_changed (GtkAdjustment *adj, GSettings *unity_settings)
390+on_iconsize_changed (GtkAdjustment *adj, CcAppearancePanel *self)
391 {
392- g_settings_set_int (unity_settings, UNITY_ICONSIZE_KEY, (gint)gtk_adjustment_get_value (adj) * 2);
393+ grouped_gsettings_set_value (self->priv->unity_compiz_gs, UNITY_ICONSIZE_KEY, g_variant_new_int32 ((gint) gtk_adjustment_get_value (adj) * 2));
394 }
395
396 static void
397@@ -1459,8 +1730,8 @@
398 }
399
400 static void
401-ext_hidelauncher_changed_callback (GSettings* settings,
402- guint key,
403+ext_hidelauncher_changed_callback (GroupedGSettings* compiz_gs,
404+ gchar *key,
405 gpointer user_data)
406 {
407 hidelauncher_widget_refresh (CC_APPEARANCE_PANEL (user_data));
408@@ -1485,7 +1756,7 @@
409 }
410
411 /* 3d */
412- g_settings_set_int (self->priv->unity_settings, UNITY_LAUNCHERHIDE_KEY, value);
413+ grouped_gsettings_set_value (self->priv->unity_compiz_gs, UNITY_LAUNCHERHIDE_KEY, g_variant_new_int32 (value));
414 hidelauncher_set_sensitivity_reveal (self, (value != -1));
415 }
416
417@@ -1507,8 +1778,8 @@
418 }
419
420 static void
421-ext_reveallauncher_changed_callback (GSettings* settings,
422- guint key,
423+ext_reveallauncher_changed_callback (GroupedGSettings* compiz_gs,
424+ gchar *key,
425 gpointer user_data)
426 {
427 reveallauncher_widget_refresh (CC_APPEARANCE_PANEL (user_data));
428@@ -1526,7 +1797,7 @@
429 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("unity_reveal_spot_left"))))
430 reveal_spot = 0;
431
432- g_settings_set_int (priv->unity_settings, UNITY_LAUNCHERREVEAL_KEY, reveal_spot);
433+ grouped_gsettings_set_value (priv->unity_compiz_gs, UNITY_LAUNCHERREVEAL_KEY, g_variant_new_int32 (reveal_spot));
434 reveallauncher_widget_refresh (self);
435 }
436
437@@ -1538,11 +1809,11 @@
438 }
439
440 static void
441-ext_launchersensitivity_changed_callback (GSettings* settings,
442- guint key,
443+ext_launchersensitivity_changed_callback (GroupedGSettings* compiz_gs,
444+ gchar *key,
445 gpointer user_data)
446 {
447- launcher_sensitivity_widget_refresh (GTK_ADJUSTMENT (user_data), settings);
448+ launcher_sensitivity_widget_refresh (GTK_ADJUSTMENT (user_data), grouped_gsettings_peek_default (compiz_gs));
449 }
450
451 static void
452@@ -1552,7 +1823,7 @@
453 CcAppearancePanelPrivate *priv = self->priv;
454 gdouble value = gtk_adjustment_get_value (adj);
455
456- g_settings_set_double (priv->unity_settings, UNITY_LAUNCHERSENSITIVITY_KEY, value);
457+ grouped_gsettings_set_value (priv->unity_compiz_gs, UNITY_LAUNCHERSENSITIVITY_KEY, g_variant_new_double (value));
458 }
459
460 gboolean
461@@ -1577,12 +1848,12 @@
462 }
463
464 static void
465-ext_enableworkspaces_changed_callback (GSettings* settings,
466- guint key,
467+ext_enableworkspaces_changed_callback (GroupedGSettings* compiz_gs,
468+ gchar *key,
469 gpointer user_data)
470 {
471 g_idle_add((GSourceFunc) enable_workspaces_widget_refresh, user_data);
472-}
473+}
474
475 static void
476 on_enable_workspaces_changed (GtkToggleButton *button, gpointer user_data)
477@@ -1597,8 +1868,8 @@
478 hsize = vsize = 2;
479 }
480
481- g_settings_set_int (priv->compizcore_settings, COMPIZCORE_HSIZE_KEY, hsize);
482- g_settings_set_int (priv->compizcore_settings, COMPIZCORE_VSIZE_KEY, hsize);
483+ grouped_gsettings_set_value (priv->compizcore_compiz_gs, COMPIZCORE_HSIZE_KEY, g_variant_new_int32 (hsize));
484+ grouped_gsettings_set_value (priv->compizcore_compiz_gs, COMPIZCORE_VSIZE_KEY, g_variant_new_int32 (vsize));
485 }
486
487 static void
488@@ -1625,8 +1896,8 @@
489 }
490
491 static void
492-ext_enableshowdesktop_changed_callback (GSettings* settings,
493- guint key,
494+ext_enableshowdesktop_changed_callback (GroupedGSettings* compiz_gs,
495+ gchar *key,
496 gpointer user_data)
497 {
498 enable_showdesktop_widget_refresh (user_data);
499@@ -1691,19 +1962,15 @@
500 if (!self->priv->unity_own_settings)
501 return FALSE;
502
503- gchar** unity_keys;
504- gchar** key;
505-
506- unity_keys = g_settings_list_keys (self->priv->unity_own_settings);
507-
508- for (key = unity_keys; *key; ++key)
509- {
510- if (g_strcmp0 (*key, key_name) == 0)
511- return TRUE;
512- }
513-
514- g_strfreev (unity_keys);
515- return FALSE;
516+ GSettingsSchema *unity_schema;
517+ gboolean has_key;
518+
519+ g_object_get (self->priv->unity_own_settings,
520+ "settings-schema", &unity_schema, NULL);
521+ has_key = g_settings_schema_has_key (unity_schema, key_name);
522+ g_settings_schema_unref (unity_schema);
523+
524+ return has_key;
525 }
526
527 static void
528@@ -1728,8 +1995,8 @@
529 }
530
531 static void
532-ext_menulocation_changed_callback (GSettings* settings,
533- guint key,
534+ext_menulocation_changed_callback (GroupedGSettings* compiz_gs,
535+ gchar *key,
536 gpointer user_data)
537 {
538 menulocation_widget_refresh (CC_APPEARANCE_PANEL (user_data));
539@@ -1768,9 +2035,9 @@
540 }
541
542 static void
543-ext_menuvisibility_changed_callback (GSettings* settings,
544- guint key,
545- gpointer user_data)
546+ext_menuvisibility_changed_callback (GroupedGSettings* compiz_gs,
547+ gchar *key,
548+ gpointer user_data)
549 {
550 menuvisibility_widget_refresh (CC_APPEARANCE_PANEL (user_data));
551 }
552@@ -1787,17 +2054,41 @@
553 }
554
555 static void
556+ext_compiz_profile_changed_callback (GSettings* compiz_settings,
557+ gchar *key,
558+ gpointer user_data)
559+{
560+ CcAppearancePanel *self = user_data;
561+ gchar *compiz_profile;
562+ gboolean low_enabled;
563+
564+ compiz_profile = g_settings_get_string (compiz_settings, COMPIZ_CURRENT_PROFILE_KEY);
565+
566+ if (g_strcmp0 (compiz_profile, UNITY_NORMAL_PROFILE) != 0 &&
567+ g_strcmp0 (compiz_profile, UNITY_LOWGFX_PROFILE) != 0)
568+ {
569+ g_free (compiz_profile);
570+ return;
571+ }
572+
573+ grouped_gsettings_set_default_profile (self->priv->unity_compiz_gs, compiz_profile);
574+ grouped_gsettings_set_default_profile (self->priv->compizcore_compiz_gs, compiz_profile);
575+
576+ g_free (compiz_profile);
577+}
578+
579+static void
580 on_restore_defaults_page2_clicked (GtkButton *button, gpointer user_data)
581 {
582 CcAppearancePanel *self = CC_APPEARANCE_PANEL (user_data);
583 CcAppearancePanelPrivate *priv = self->priv;
584
585 /* reset defaut for the profile and get the default */
586- g_settings_reset (priv->unity_settings, UNITY_LAUNCHERHIDE_KEY);
587- g_settings_reset (priv->unity_settings, UNITY_LAUNCHERSENSITIVITY_KEY);
588- g_settings_reset (priv->unity_settings, UNITY_LAUNCHERREVEAL_KEY);
589- g_settings_reset (priv->compizcore_settings, COMPIZCORE_HSIZE_KEY);
590- g_settings_reset (priv->compizcore_settings, COMPIZCORE_VSIZE_KEY);
591+ grouped_gsettings_reset (priv->unity_compiz_gs, UNITY_LAUNCHERHIDE_KEY);
592+ grouped_gsettings_reset (priv->unity_compiz_gs, UNITY_LAUNCHERSENSITIVITY_KEY);
593+ grouped_gsettings_reset (priv->unity_compiz_gs, UNITY_LAUNCHERREVEAL_KEY);
594+ grouped_gsettings_reset (priv->compizcore_compiz_gs, COMPIZCORE_HSIZE_KEY);
595+ grouped_gsettings_reset (priv->compizcore_compiz_gs, COMPIZCORE_VSIZE_KEY);
596
597 if (unity_own_setting_exists (self, UNITY_INTEGRATED_MENUS_KEY))
598 g_settings_reset (priv->unity_own_settings, UNITY_INTEGRATED_MENUS_KEY);
599@@ -1806,7 +2097,7 @@
600 g_settings_reset (priv->unity_own_settings, UNITY_ALWAYS_SHOW_MENUS_KEY);
601
602 GtkToggleButton *showdesktop = GTK_TOGGLE_BUTTON (WID ("check_showdesktop_in_launcher"));
603- gtk_toggle_button_set_active(showdesktop, TRUE);
604+ gtk_toggle_button_set_active(showdesktop, FALSE);
605 }
606
607 /* <hacks> */
608@@ -1847,20 +2138,6 @@
609 }
610
611 /* </hacks> */
612-
613-static gchar *
614-compiz_profile_gsettings_path (const gchar *path)
615-{
616- const gchar *profile = "unity";
617-
618- if (g_strcmp0 (g_getenv ("COMPIZ_CONFIG_PROFILE"), "ubuntu-lowgfx") == 0)
619- {
620- profile = "unity-lowgfx";
621- }
622-
623- return g_strdup_printf (path, profile);
624-}
625-
626 static void
627 setup_unity_settings (CcAppearancePanel *self)
628 {
629@@ -1871,59 +2148,69 @@
630 GtkScale* launcher_sensitivity_scale;
631 GSettingsSchema *schema;
632 GSettingsSchemaSource* source;
633- gchar *settings_path;
634
635 source = g_settings_schema_source_get_default ();
636 schema = g_settings_schema_source_lookup (source, UNITY_OWN_GSETTINGS_SCHEMA, TRUE);
637 if (schema)
638 {
639- priv->unity_own_settings = g_settings_new (UNITY_OWN_GSETTINGS_SCHEMA);
640+ priv->unity_own_settings = g_settings_new_full (schema, /*backend*/ NULL, /*path*/ NULL);
641+ g_settings_schema_unref (schema);
642+ }
643+ schema = g_settings_schema_source_lookup (source, COMPIZ_GSETTINGS_SCHEMA, TRUE);
644+ if (schema)
645+ {
646+ priv->compiz_settings = g_settings_new_full (schema, /*backend*/ NULL, /*path*/ NULL);
647 g_settings_schema_unref (schema);
648 }
649 schema = g_settings_schema_source_lookup (source, UNITY_LAUNCHER_GSETTINGS_SCHEMA, TRUE);
650 if (schema)
651 {
652- priv->unity_launcher_settings = g_settings_new (UNITY_LAUNCHER_GSETTINGS_SCHEMA);
653+ priv->unity_launcher_settings = g_settings_new_full (schema, /*backend*/ NULL, /*path*/ NULL);
654 g_settings_schema_unref (schema);
655 }
656 schema = g_settings_schema_source_lookup (source, UNITY_GSETTINGS_SCHEMA, TRUE);
657 if (schema)
658 {
659- settings_path = compiz_profile_gsettings_path (UNITY_GSETTINGS_PATH);
660- priv->unity_settings = g_settings_new_with_path (UNITY_GSETTINGS_SCHEMA, settings_path);
661+ priv->unity_compiz_gs = compiz_grouped_gsettings_new (schema,
662+ priv->compiz_settings,
663+ UNITY_GSETTINGS_PATH,
664+ &priv->unity_settings);
665 g_settings_schema_unref (schema);
666- g_free (settings_path);
667 }
668 schema = g_settings_schema_source_lookup (source, COMPIZCORE_GSETTINGS_SCHEMA, TRUE);
669 if (schema)
670 {
671- settings_path = compiz_profile_gsettings_path (COMPIZCORE_GSETTINGS_PATH);
672- priv->compizcore_settings = g_settings_new_with_path (COMPIZCORE_GSETTINGS_SCHEMA, settings_path);
673+ priv->compizcore_compiz_gs = compiz_grouped_gsettings_new (schema,
674+ priv->compiz_settings,
675+ COMPIZCORE_GSETTINGS_PATH,
676+ &priv->compizcore_settings);
677 g_settings_schema_unref (schema);
678- g_free (settings_path);
679 }
680
681- if (!priv->unity_settings || !priv->compizcore_settings || !priv->unity_own_settings || !priv->unity_launcher_settings)
682+ if (!priv->unity_compiz_gs || !priv->compizcore_compiz_gs || !priv->unity_own_settings || !priv->unity_launcher_settings)
683 return;
684
685+ g_signal_connect (priv->compiz_settings, "changed::" COMPIZ_CURRENT_PROFILE_KEY,
686+ G_CALLBACK (ext_compiz_profile_changed_callback), self);
687+
688 /* Icon size change - we halve the sizes so we can only get even values*/
689 iconsize_adj = gtk_adjustment_new (DEFAULT_ICONSIZE / 2, MIN_ICONSIZE / 2, MAX_ICONSIZE / 2, 1, 4, 0);
690 iconsize_scale = GTK_SCALE (WID ("unity-iconsize-scale"));
691 gtk_range_set_adjustment (GTK_RANGE (iconsize_scale), iconsize_adj);
692 gtk_scale_add_mark (iconsize_scale, DEFAULT_ICONSIZE / 2, GTK_POS_BOTTOM, NULL);
693- g_signal_connect (priv->unity_settings, "changed::" UNITY_ICONSIZE_KEY,
694+ g_signal_connect (priv->unity_compiz_gs, "changed::" UNITY_ICONSIZE_KEY,
695 G_CALLBACK (ext_iconsize_changed_callback), iconsize_adj);
696
697 g_signal_connect (G_OBJECT (iconsize_scale), "format-value",
698 G_CALLBACK (on_iconsize_format_value), NULL);
699 g_signal_connect (iconsize_adj, "value_changed",
700- G_CALLBACK (on_iconsize_changed), priv->unity_settings);
701+ G_CALLBACK (on_iconsize_changed), self);
702 g_signal_connect (G_OBJECT (iconsize_scale), "scroll-event",
703 G_CALLBACK (on_scale_scroll_event), NULL);
704 iconsize_widget_refresh (iconsize_adj, priv->unity_settings);
705
706 /* Reveal spot setting */
707- g_signal_connect (priv->unity_settings, "changed::" UNITY_LAUNCHERREVEAL_KEY,
708+ g_signal_connect (priv->unity_compiz_gs, "changed::" UNITY_LAUNCHERREVEAL_KEY,
709 G_CALLBACK (ext_reveallauncher_changed_callback), self);
710 g_signal_connect (WID ("unity_reveal_spot_topleft"), "toggled",
711 G_CALLBACK (on_reveallauncher_changed), self);
712@@ -1936,7 +2223,7 @@
713 launcher_sensitivity_scale = GTK_SCALE (WID ("unity-launcher-sensitivity"));
714 gtk_range_set_adjustment (GTK_RANGE (launcher_sensitivity_scale), launcher_sensitivity_adj);
715 gtk_scale_add_mark (launcher_sensitivity_scale, 2, GTK_POS_BOTTOM, NULL);
716- g_signal_connect (priv->unity_settings, "changed::" UNITY_LAUNCHERSENSITIVITY_KEY,
717+ g_signal_connect (priv->unity_compiz_gs, "changed::" UNITY_LAUNCHERSENSITIVITY_KEY,
718 G_CALLBACK (ext_launchersensitivity_changed_callback), launcher_sensitivity_adj);
719 g_signal_connect (launcher_sensitivity_adj, "value_changed",
720 G_CALLBACK (on_launchersensitivity_changed), self);
721@@ -1945,16 +2232,16 @@
722 launcher_sensitivity_widget_refresh (launcher_sensitivity_adj, priv->unity_settings);
723
724 /* Autohide launcher setting */
725- g_signal_connect (priv->unity_settings, "changed::" UNITY_LAUNCHERHIDE_KEY,
726+ g_signal_connect (priv->unity_compiz_gs, "changed::" UNITY_LAUNCHERHIDE_KEY,
727 G_CALLBACK (ext_hidelauncher_changed_callback), self);
728 g_signal_connect (WID ("unity_launcher_autohide"), "notify::active",
729 G_CALLBACK (on_hidelauncher_changed), self);
730 hidelauncher_widget_refresh (self);
731
732 /* Enabling workspaces */
733- g_signal_connect (priv->compizcore_settings, "changed::" COMPIZCORE_HSIZE_KEY,
734+ g_signal_connect (priv->compizcore_compiz_gs, "changed::" COMPIZCORE_HSIZE_KEY,
735 G_CALLBACK (ext_enableworkspaces_changed_callback), self);
736- g_signal_connect (priv->compizcore_settings, "changed::" COMPIZCORE_VSIZE_KEY,
737+ g_signal_connect (priv->compizcore_compiz_gs, "changed::" COMPIZCORE_VSIZE_KEY,
738 G_CALLBACK (ext_enableworkspaces_changed_callback), self);
739 g_signal_connect (WID ("check_enable_workspaces"), "toggled",
740 G_CALLBACK (on_enable_workspaces_changed), self);

Subscribers

People subscribed via source and target branches