Commit 5c57e51243f7685d0550fe1c2a59cd785a412273

Authored by unknown
2 parents 3db58636 d2ead3aa

Import upstream version 0.9.8+bzr3319

Showing 161 changed files with 20783 additions and 7278 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 161 files displayed.

CMakeLists.txt
... ... @@ -9,6 +9,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${COMPIZ_CMAKE_MODULE_PATH})
9 9  
10 10 include (CTest)
11 11  
  12 +set (MEMORYCHECK_COMMAND_OPTIONS --trace-children=yes)
12 13 set (MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_SOURCE_DIR}/tests/experimental-memcheck/compiz.supp CACHE FILEPATH "" FORCE)
13 14  
14 15 include (Dart)
... ...
cmake/CompizCommon.cmake
... ... @@ -457,14 +457,29 @@ function (compiz_translate_xml _src _dst)
457 457 find_program (INTLTOOL_MERGE_EXECUTABLE intltool-merge)
458 458 mark_as_advanced (FORCE INTLTOOL_MERGE_EXECUTABLE)
459 459  
  460 + set (_additional_arg
  461 + -x
  462 + -u
  463 + ${COMPIZ_I18N_DIR})
  464 +
  465 + foreach (_arg ${ARGN})
  466 + if ("${_arg}" STREQUAL "NOTRANSLATIONS")
  467 + set (_additional_arg
  468 + --no-translations
  469 + -x
  470 + -u)
  471 + endif ("${_arg}" STREQUAL "NOTRANSLATIONS")
  472 + endforeach (_arg ${ARGN})
  473 +
460 474 if (INTLTOOL_MERGE_EXECUTABLE
461 475 AND COMPIZ_I18N_DIR
462 476 AND EXISTS ${COMPIZ_I18N_DIR})
463 477 add_custom_command (
464 478 OUTPUT ${_dst}
465   - COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -x -u -c
  479 + COMMAND ${INTLTOOL_MERGE_EXECUTABLE}
  480 + -c
466 481 ${CMAKE_BINARY_DIR}/.intltool-merge-cache
467   - ${COMPIZ_I18N_DIR}
  482 + ${_additional_arg}
468 483 ${_src}
469 484 ${_dst}
470 485 DEPENDS ${_src}
... ...
compizconfig/CMakeLists.txt
... ... @@ -4,11 +4,24 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LIBCOMPIZCONFIG_CMAKE_MODULE_PATH}
4 4 set (COMPIZCONFIG_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/libcompizconfig/include)
5 5 set (COMPIZCONFIG_LIBRARY_DIRS ${CMAKE_CURRENT_BINARY_DIR}/libcompizconfig)
6 6  
  7 +option (USE_GCONF "Enable legacy GNOME 2.x option integration with GConf" ON)
  8 +
7 9 add_subdirectory (libcompizconfig)
8 10 add_subdirectory (compizconfig-python)
  11 +add_subdirectory (integration)
9 12 add_subdirectory (ccsm)
10   -add_subdirectory (gconf)
11   -add_subdirectory (gsettings)
  13 +
  14 +if (USE_GCONF)
  15 + add_subdirectory (gconf)
  16 +endif (USE_GCONF)
  17 +
  18 +if (USE_GSETTINGS)
  19 + add_subdirectory (gsettings)
  20 +endif (USE_GSETTINGS)
  21 +
  22 +if (COMPIZ_BUILD_TESTING)
  23 + add_subdirectory (mocks)
  24 +endif (COMPIZ_BUILD_TESTING)
12 25  
13 26 add_custom_target (pyclean)
14 27  
... ...
compizconfig/compizconfig-python/CMakeLists.txt
... ... @@ -62,17 +62,25 @@ add_dependencies (compizconfig_wrapper compizconfig)
62 62  
63 63 if (COMPIZ_BUILD_TESTING)
64 64  
  65 + find_program (BASH_EXECUTABLE bash)
65 66 find_program (PYTHON_EXECUTABLE python)
66 67 mark_as_advanced (FORCE PYTHON_EXECUTABLE)
67 68  
68 69 file (GLOB PYTHON_TESTS "tests/test_*.py")
69 70  
70   - if (PYTHON_EXECUTABLE)
  71 + if (PYTHON_EXECUTABLE AND
  72 + BASH_EXECUTABLE)
71 73 foreach (PYTHON_TEST_FILE ${PYTHON_TESTS})
72 74 get_filename_component (PYTHON_TEST ${PYTHON_TEST_FILE} NAME_WE)
73 75 message (STATUS "Adding test " ${PYTHON_TEST})
74   - add_test (NAME CompizConfigPython.${PYTHON_TEST} WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_TEST_FILE})
  76 + add_test (NAME CompizConfigPython.${PYTHON_TEST}
  77 + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
  78 + COMMAND ${BASH_EXECUTABLE}
  79 + ${CMAKE_SOURCE_DIR}/tests/util/run_with_ld_library_path.sh
  80 + ${CMAKE_BINARY_DIR}/compizconfig/libcompizconfig/src
  81 + ${PYTHON_EXECUTABLE} ${PYTHON_TEST_FILE})
75 82 endforeach (PYTHON_TEST_FILE)
76   - endif (PYTHON_EXECUTABLE)
  83 + endif (PYTHON_EXECUTABLE AND
  84 + BASH_EXECUTABLE)
77 85  
78 86 endif (COMPIZ_BUILD_TESTING)
... ...
compizconfig/compizconfig-python/setup.py
... ... @@ -31,8 +31,6 @@ def pkgconfig(*packages, **kw):
31 31 for t in tokens:
32 32 if '-L' in t[:2]:
33 33 kw.setdefault (flag_map.get ("-L"), []).append (t[2:])
34   - if not os.getenv ("COMPIZ_DISABLE_RPATH") is "1":
35   - kw.setdefault (flag_map.get ("-R"), []).append (t[2:])
36 34 elif '-I' in t[:2]:
37 35 kw.setdefault (flag_map.get ("-I"), []).append (t[2:])
38 36 elif '-l' in t[:2]:
... ...
compizconfig/compizconfig-python/src/compizconfig.pyx
... ... @@ -315,7 +315,7 @@ cdef extern void ccsSetProfile (CCSContext * context, char * name)
315 315 cdef extern char* ccsGetProfile (CCSContext * context)
316 316  
317 317 '''Backends'''
318   -cdef extern CCSBackendInfoList * ccsGetExistingBackends ()
  318 +cdef extern CCSBackendInfoList * ccsGetExistingBackends (CCSContext *)
319 319 cdef extern void ccsBackendInfoListFree (CCSBackendInfoList *, Bool freeObj)
320 320 cdef extern Bool ccsSetBackend (CCSContext * context, char * name)
321 321 cdef extern char* ccsGetBackend (CCSContext * context)
... ... @@ -603,6 +603,13 @@ cdef object DecodeValue (CCSSettingValue * value):
603 603 return "Unhandled"
604 604  
605 605 cdef class Setting:
  606 + """A python representation of a CCSSetting.
  607 +
  608 + You should not construct this object directly.
  609 + Use plugin.Screen['settingname'] instead
  610 +
  611 + """
  612 +
606 613 cdef CCSSetting * ccsSetting
607 614 cdef object info
608 615 cdef Plugin plugin
... ... @@ -723,6 +730,13 @@ cdef class SSGroup:
723 730 self.screen = value
724 731  
725 732 cdef class Plugin:
  733 + """A python representation of a CCSPlugin.
  734 +
  735 + You should not construct this object directly.
  736 + Use context.Plugins['pluginname'] instead
  737 +
  738 + """
  739 +
726 740 cdef CCSPlugin * ccsPlugin
727 741 cdef Context context
728 742 cdef object screen
... ... @@ -1104,6 +1118,19 @@ cdef class Backend:
1104 1118 return self.profileSupport
1105 1119  
1106 1120 cdef class Context:
  1121 + """A python representation of a CCSContext.
  1122 +
  1123 + This is the main entry-point into the compizconfig module.
  1124 + Typical usage:
  1125 +
  1126 + >>> context = Context()
  1127 + >>> plugin = context.Plugins['core']
  1128 + >>> setting = plugin.Screen['number_of_desktops']
  1129 + >>> print setting.Value
  1130 + 1
  1131 +
  1132 + """
  1133 +
1107 1134 cdef CCSContext * ccsContext
1108 1135 cdef object plugins
1109 1136 cdef object categories
... ... @@ -1207,7 +1234,7 @@ cdef class Context:
1207 1234 cdef CCSBackendInfoList * backendList
1208 1235 cdef CCSBackendInfoList * origBackendList
1209 1236 cdef CCSBackendInfo * backendInfo
1210   - origBackendList = backendList = ccsGetExistingBackends ()
  1237 + origBackendList = backendList = ccsGetExistingBackends (self.ccsContext)
1211 1238 while backendList != NULL:
1212 1239 backendInfo = <CCSBackendInfo *> backendList.data
1213 1240 info = (backendInfo.name, backendInfo.shortDesc,
... ...
compizconfig/compizconfig-python/tests/compiz_config_test.py
1 1 import os
  2 +import sys
  3 +import subprocess
  4 +
  5 +arch = subprocess.Popen (["uname", "-p"], stdout=subprocess.PIPE).communicate ()[0][:-1]
2 6  
3 7 os.environ["G_SLICE"] = "always-malloc"
4   -os.environ["COMPIZ_CONFIG_PROFILE"] = ""
5 8 os.environ["COMPIZ_METADATA_PATH"] = "generated/"
  9 +os.environ["COMPIZ_CONFIG_PROFILE"] = ""
  10 +os.environ["XDG_CONFIG_HOME"] = "compizconfig/libcompizconfig/config"
6 11 os.environ["LIBCOMPIZCONFIG_BACKEND_PATH"] = "compizconfig/libcompizconfig/backend/"
7 12 os.environ["XDG_DATA_DIRS"] = "generated/"
8 13  
9   -import sys
10   -import subprocess
11   -
12   -arch = subprocess.Popen (["uname", "-p"], stdout=subprocess.PIPE).communicate ()[0][:-1]
13   -
14 14 sys.path.insert (0, "compizconfig/compizconfig-python/build/lib.linux-%s-%s.%s/" % (arch, sys.version_info[0], sys.version_info[1]))
15 15  
16 16 import unittest
... ...
compizconfig/gconf/CMakeLists.txt
1   -project (compizconfig-backend-gconf)
  1 +if (USE_GCONF)
2 2  
3   -find_package (CompizConfig REQUIRED)
  3 + find_package (CompizConfig REQUIRED)
4 4  
5   -include (LibCompizConfigCommon)
  5 + include (LibCompizConfigCommon)
6 6  
7   -compizconfig_backend (gconf PKGDEPS glib-2.0 gconf-2.0)
  7 + include_directories (${CMAKE_SOURCE_DIR}/compizconfig/integration/gnome/include
  8 + ${CMAKE_SOURCE_DIR}/compizconfig/integration/gnome/gconf/include)
  9 + link_directories (${CMAKE_BINARY_DIR}/compizconfig/integration/gnome
  10 + ${CMAKE_BINARY_DIR}/compizconfig/integration/gnome/gconf)
  11 +
  12 + compizconfig_backend (gconf PKGDEPS glib-2.0 gconf-2.0 LIBRARIES
  13 + compizconfig_gnome_integration
  14 + compizconfig_gnome_integration_gconf_setting_factory
  15 + compizconfig_gnome_integration_gconf_integrated_setting)
  16 +endif (USE_GCONF)
... ...
compizconfig/gconf/src/gconf.c
... ... @@ -44,15 +44,9 @@
44 44 #include <gconf/gconf-client.h>
45 45 #include <gconf/gconf-value.h>
46 46  
47   -#define CompAltMask (1 << 16)
48   -#define CompMetaMask (1 << 17)
49   -#define CompSuperMask (1 << 18)
50   -#define CompHyperMask (1 << 19)
51   -#define CompModeSwitchMask (1 << 20)
52   -#define CompNumLockMask (1 << 21)
53   -#define CompScrollLockMask (1 << 22)
54   -
55   -#define METACITY "/apps/metacity"
  47 +#include "ccs_gnome_integration.h"
  48 +#include "ccs_gnome_integration_gconf_integrated_setting_factory.h"
  49 +
56 50 #define COMPIZ "/apps/compiz-1"
57 51 #define COMPIZCONFIG "/apps/compizconfig-1"
58 52 #define PROFILEPATH COMPIZCONFIG "/profiles"
... ... @@ -75,364 +69,54 @@
75 69 "%s/plugins/%s/%s/options/%s", COMPIZ, \
76 70 ccsPluginGetName (ccsSettingGetParent (setting)), keyName, ccsSettingGetName (setting));
77 71  
78   -static const char* watchedGnomeDirectories[] = {
79   - METACITY,
80   - "/desktop/gnome/applications/terminal",
81   - "/apps/panel/applets/window_list/prefs"
82   -};
83   -#define NUM_WATCHED_DIRS 3
84   -
85 72 static GConfClient *client = NULL;
86 73 static GConfEngine *conf = NULL;
87 74 static guint compizNotifyId;
88   -static guint gnomeNotifyIds[NUM_WATCHED_DIRS];
89 75 static char *currentProfile = NULL;
  76 +static CCSGNOMEValueChangeData valueChangeData =
  77 +{
  78 + NULL,
  79 + NULL,
  80 + NULL,
  81 + NULL
  82 +};
90 83  
91 84 /* some forward declarations */
92   -static Bool readInit (CCSContext * context);
93   -static void readSetting (CCSContext * context, CCSSetting * setting);
  85 +static Bool readInit (CCSBackend *backend, CCSContext * context);
  86 +static void readSetting (CCSBackend *backend, CCSContext * context, CCSSetting * setting);
94 87 static Bool readOption (CCSSetting * setting);
95   -static Bool writeInit (CCSContext * context);
96   -static void writeIntegratedOption (CCSContext *context, CCSSetting *setting,
97   - int index);
98   -
99   -typedef enum {
100   - OptionInt,
101   - OptionBool,
102   - OptionKey,
103   - OptionBell,
104   - OptionString,
105   - OptionSpecial,
106   -} SpecialOptionType;
107   -
108   -typedef struct _SpecialOption {
109   - const char* settingName;
110   - const char* pluginName;
111   - Bool screen;
112   - const char* gnomeName;
113   - SpecialOptionType type;
114   -} SpecialOption;
115   -
116   -const SpecialOption specialOptions[] = {
117   - {"run_key", "gnomecompat", FALSE,
118   - METACITY "/global_keybindings/panel_run_dialog", OptionKey},
119   - {"main_menu_key", "gnomecompat", FALSE,
120   - METACITY "/global_keybindings/panel_main_menu", OptionKey},
121   - {"run_command_screenshot_key", "gnomecompat", FALSE,
122   - METACITY "/global_keybindings/run_command_screenshot", OptionKey},
123   - {"run_command_window_screenshot_key", "gnomecompat", FALSE,
124   - METACITY "/global_keybindings/run_command_window_screenshot", OptionKey},
125   - {"run_command_terminal_key", "gnomecompat", FALSE,
126   - METACITY "/global_keybindings/run_command_terminal", OptionKey},
127   -
128   - {"toggle_window_maximized_key", "core", FALSE,
129   - METACITY "/window_keybindings/toggle_maximized", OptionKey},
130   - {"minimize_window_key", "core", FALSE,
131   - METACITY "/window_keybindings/minimize", OptionKey},
132   - {"maximize_window_key", "core", FALSE,
133   - METACITY "/window_keybindings/maximize", OptionKey},
134   - {"unmaximize_window_key", "core", FALSE,
135   - METACITY "/window_keybindings/unmaximize", OptionKey},
136   - {"maximize_window_horizontally_key", "core", FALSE,
137   - METACITY "/window_keybindings/maximize_horizontally", OptionKey},
138   - {"maximize_window_vertically_key", "core", FALSE,
139   - METACITY "/window_keybindings/maximize_vertically", OptionKey},
140   - {"raise_window_key", "core", FALSE,
141   - METACITY "/window_keybindings/raise", OptionKey},
142   - {"lower_window_key", "core", FALSE,
143   - METACITY "/window_keybindings/lower", OptionKey},
144   - {"close_window_key", "core", FALSE,
145   - METACITY "/window_keybindings/close", OptionKey},
146   - {"toggle_window_shaded_key", "core", FALSE,
147   - METACITY "/window_keybindings/toggle_shaded", OptionKey},
148   -
149   - {"show_desktop_key", "core", FALSE,
150   - METACITY "/global_keybindings/show_desktop", OptionKey},
151   -
152   - {"initiate_key", "move", FALSE,
153   - METACITY "/window_keybindings/begin_move", OptionKey},
154   - {"initiate_key", "resize", FALSE,
155   - METACITY "/window_keybindings/begin_resize", OptionKey},
156   - {"window_menu_key", "core", FALSE,
157   - METACITY "/window_keybindings/activate_window_menu", OptionKey},
158   -
159   - /* integration of Metacity's mouse_button_modifier option */
160   - {"initiate_button", "move", FALSE,
161   - METACITY "/window_keybindings/begin_move", OptionSpecial},
162   - {"initiate_button", "resize", FALSE,
163   - METACITY "/window_keybindings/begin_resize", OptionSpecial},
164   - {"window_menu_button", "core", FALSE,
165   - METACITY "/window_keybindings/activate_window_menu", OptionSpecial},
166   - {"mouse_button_modifier", NULL, FALSE,
167   - METACITY "/general/mouse_button_modifier", OptionSpecial},
168   - /* integration of the Metacity's option to swap mouse buttons */
169   - {"resize_with_right_button", NULL, FALSE,
170   - METACITY "/general/resize_with_right_button", OptionSpecial},
171   -
172   - {"visual_bell", "fade", TRUE,
173   - METACITY "/general/visual_bell", OptionBell},
174   - {"fullscreen_visual_bell", "fade", TRUE,
175   - METACITY "/general/visual_bell_type", OptionSpecial},
176   -
177   - {"next_key", "staticswitcher", FALSE,
178   - METACITY "/global_keybindings/switch_windows", OptionKey},
179   - {"prev_key", "staticswitcher", FALSE,
180   - METACITY "/global_keybindings/switch_windows_backward", OptionKey},
181   -
182   - {"toggle_sticky_key", "extrawm", FALSE,
183   - METACITY "/window_keybindings/toggle_on_all_workspaces", OptionKey},
184   - {"toggle_fullscreen_key", "extrawm", FALSE,
185   - METACITY "/window_keybindings/toggle_fullscreen", OptionKey},
186   -
187   - {"command0", "commands", FALSE,
188   - METACITY "/keybinding_commands/command_1", OptionString},
189   - {"command1", "commands", FALSE,
190   - METACITY "/keybinding_commands/command_2", OptionString},
191   - {"command2", "commands", FALSE,
192   - METACITY "/keybinding_commands/command_3", OptionString},
193   - {"command3", "commands", FALSE,
194   - METACITY "/keybinding_commands/command_4", OptionString},
195   - {"command4", "commands", FALSE,
196   - METACITY "/keybinding_commands/command_5", OptionString},
197   - {"command5", "commands", FALSE,
198   - METACITY "/keybinding_commands/command_6", OptionString},
199   - {"command6", "commands", FALSE,
200   - METACITY "/keybinding_commands/command_7", OptionString},
201   - {"command7", "commands", FALSE,
202   - METACITY "/keybinding_commands/command_8", OptionString},
203   - {"command8", "commands", FALSE,
204   - METACITY "/keybinding_commands/command_9", OptionString},
205   - {"command9", "commands", FALSE,
206   - METACITY "/keybinding_commands/command_10", OptionString},
207   - {"command10", "commands", FALSE,
208   - METACITY "/keybinding_commands/command_11", OptionString},
209   - {"command11", "commands", FALSE,
210   - METACITY "/keybinding_commands/command_12", OptionString},
211   -
212   - {"run_command0_key", "commands", FALSE,
213   - METACITY "/global_keybindings/run_command_1", OptionKey},
214   - {"run_command1_key", "commands", FALSE,
215   - METACITY "/global_keybindings/run_command_2", OptionKey},
216   - {"run_command2_key", "commands", FALSE,
217   - METACITY "/global_keybindings/run_command_3", OptionKey},
218   - {"run_command3_key", "commands", FALSE,
219   - METACITY "/global_keybindings/run_command_4", OptionKey},
220   - {"run_command4_key", "commands", FALSE,
221   - METACITY "/global_keybindings/run_command_5", OptionKey},
222   - {"run_command5_key", "commands", FALSE,
223   - METACITY "/global_keybindings/run_command_6", OptionKey},
224   - {"run_command6_key", "commands", FALSE,
225   - METACITY "/global_keybindings/run_command_7", OptionKey},
226   - {"run_command7_key", "commands", FALSE,
227   - METACITY "/global_keybindings/run_command_8", OptionKey},
228   - {"run_command8_key", "commands", FALSE,
229   - METACITY "/global_keybindings/run_command_9", OptionKey},
230   - {"run_command9_key", "commands", FALSE,
231   - METACITY "/global_keybindings/run_command_10", OptionKey},
232   - {"run_command10_key", "commands", FALSE,
233   - METACITY "/global_keybindings/run_command_11", OptionKey},
234   - {"run_command11_key", "commands", FALSE,
235   - METACITY "/global_keybindings/run_command_12", OptionKey},
236   -
237   - {"rotate_to_1_key", "rotate", FALSE,
238   - METACITY "/global_keybindings/switch_to_workspace_1", OptionKey},
239   - {"rotate_to_2_key", "rotate", FALSE,
240   - METACITY "/global_keybindings/switch_to_workspace_2", OptionKey},
241   - {"rotate_to_3_key", "rotate", FALSE,
242   - METACITY "/global_keybindings/switch_to_workspace_3", OptionKey},
243   - {"rotate_to_4_key", "rotate", FALSE,
244   - METACITY "/global_keybindings/switch_to_workspace_4", OptionKey},
245   - {"rotate_to_5_key", "rotate", FALSE,
246   - METACITY "/global_keybindings/switch_to_workspace_5", OptionKey},
247   - {"rotate_to_6_key", "rotate", FALSE,
248   - METACITY "/global_keybindings/switch_to_workspace_6", OptionKey},
249   - {"rotate_to_7_key", "rotate", FALSE,
250   - METACITY "/global_keybindings/switch_to_workspace_7", OptionKey},
251   - {"rotate_to_8_key", "rotate", FALSE,
252   - METACITY "/global_keybindings/switch_to_workspace_8", OptionKey},
253   - {"rotate_to_9_key", "rotate", FALSE,
254   - METACITY "/global_keybindings/switch_to_workspace_9", OptionKey},
255   - {"rotate_to_10_key", "rotate", FALSE,
256   - METACITY "/global_keybindings/switch_to_workspace_10", OptionKey},
257   - {"rotate_to_11_key", "rotate", FALSE,
258   - METACITY "/global_keybindings/switch_to_workspace_11", OptionKey},
259   - {"rotate_to_12_key", "rotate", FALSE,
260   - METACITY "/global_keybindings/switch_to_workspace_12", OptionKey},
261   -
262   - {"rotate_left_key", "rotate", FALSE,
263   - METACITY "/global_keybindings/switch_to_workspace_left", OptionKey},
264   - {"rotate_right_key", "rotate", FALSE,
265   - METACITY "/global_keybindings/switch_to_workspace_right", OptionKey},
266   -
267   - {"switch_to_1_key", "vpswitch", FALSE,
268   - METACITY "/global_keybindings/switch_to_workspace_1", OptionKey},
269   - {"switch_to_2_key", "vpswitch", FALSE,
270   - METACITY "/global_keybindings/switch_to_workspace_2", OptionKey},
271   - {"switch_to_3_key", "vpswitch", FALSE,
272   - METACITY "/global_keybindings/switch_to_workspace_3", OptionKey},
273   - {"switch_to_4_key", "vpswitch", FALSE,
274   - METACITY "/global_keybindings/switch_to_workspace_4", OptionKey},
275   - {"switch_to_5_key", "vpswitch", FALSE,
276   - METACITY "/global_keybindings/switch_to_workspace_5", OptionKey},
277   - {"switch_to_6_key", "vpswitch", FALSE,
278   - METACITY "/global_keybindings/switch_to_workspace_6", OptionKey},
279   - {"switch_to_7_key", "vpswitch", FALSE,
280   - METACITY "/global_keybindings/switch_to_workspace_7", OptionKey},
281   - {"switch_to_8_key", "vpswitch", FALSE,
282   - METACITY "/global_keybindings/switch_to_workspace_8", OptionKey},
283   - {"switch_to_9_key", "vpswitch", FALSE,
284   - METACITY "/global_keybindings/switch_to_workspace_9", OptionKey},
285   - {"switch_to_10_key", "vpswitch", FALSE,
286   - METACITY "/global_keybindings/switch_to_workspace_10", OptionKey},
287   - {"switch_to_11_key", "vpswitch", FALSE,
288   - METACITY "/global_keybindings/switch_to_workspace_11", OptionKey},
289   - {"switch_to_12_key", "vpswitch", FALSE,
290   - METACITY "/global_keybindings/switch_to_workspace_12", OptionKey},
291   -
292   - {"up_key", "wall", FALSE,
293   - METACITY "/global_keybindings/switch_to_workspace_up", OptionKey},
294   - {"down_key", "wall", FALSE,
295   - METACITY "/global_keybindings/switch_to_workspace_down", OptionKey},
296   - {"left_key", "wall", FALSE,
297   - METACITY "/global_keybindings/switch_to_workspace_left", OptionKey},
298   - {"right_key", "wall", FALSE,
299   - METACITY "/global_keybindings/switch_to_workspace_right", OptionKey},
300   - {"left_window_key", "wall", FALSE,
301   - METACITY "/window_keybindings/move_to_workspace_left", OptionKey},
302   - {"right_window_key", "wall", FALSE,
303   - METACITY "/window_keybindings/move_to_workspace_right", OptionKey},
304   - {"up_window_key", "wall", FALSE,
305   - METACITY "/window_keybindings/move_to_workspace_up", OptionKey},
306   - {"down_window_key", "wall", FALSE,
307   - METACITY "/window_keybindings/move_to_workspace_down", OptionKey},
308   -
309   - {"put_topleft_key", "put", FALSE,
310   - METACITY "/window_keybindings/move_to_corner_nw", OptionKey},
311   - {"put_topright_key", "put", FALSE,
312   - METACITY "/window_keybindings/move_to_corner_ne", OptionKey},
313   - {"put_bottomleft_key", "put", FALSE,
314   - METACITY "/window_keybindings/move_to_corner_sw", OptionKey},
315   - {"put_bottomright_key", "put", FALSE,
316   - METACITY "/window_keybindings/move_to_corner_se", OptionKey},
317   - {"put_left_key", "put", FALSE,
318   - METACITY "/window_keybindings/move_to_side_w", OptionKey},
319   - {"put_right_key", "put", FALSE,
320   - METACITY "/window_keybindings/move_to_side_e", OptionKey},
321   - {"put_top_key", "put", FALSE,
322   - METACITY "/window_keybindings/move_to_side_n", OptionKey},
323   - {"put_bottom_key", "put", FALSE,
324   - METACITY "/window_keybindings/move_to_side_s", OptionKey},
325   -
326   - {"rotate_to_1_window_key", "rotate", FALSE,
327   - METACITY "/window_keybindings/move_to_workspace_1", OptionKey},
328   - {"rotate_to_2_window_key", "rotate", FALSE,
329   - METACITY "/window_keybindings/move_to_workspace_2", OptionKey},
330   - {"rotate_to_3_window_key", "rotate", FALSE,
331   - METACITY "/window_keybindings/move_to_workspace_3", OptionKey},
332   - {"rotate_to_4_window_key", "rotate", FALSE,
333   - METACITY "/window_keybindings/move_to_workspace_4", OptionKey},
334   - {"rotate_to_5_window_key", "rotate", FALSE,
335   - METACITY "/window_keybindings/move_to_workspace_5", OptionKey},
336   - {"rotate_to_6_window_key", "rotate", FALSE,
337   - METACITY "/window_keybindings/move_to_workspace_6", OptionKey},
338   - {"rotate_to_7_window_key", "rotate", FALSE,
339   - METACITY "/window_keybindings/move_to_workspace_7", OptionKey},
340   - {"rotate_to_8_window_key", "rotate", FALSE,
341   - METACITY "/window_keybindings/move_to_workspace_8", OptionKey},
342   - {"rotate_to_9_window_key", "rotate", FALSE,
343   - METACITY "/window_keybindings/move_to_workspace_9", OptionKey},
344   - {"rotate_to_10_window_key", "rotate", FALSE,
345   - METACITY "/window_keybindings/move_to_workspace_10", OptionKey},
346   - {"rotate_to_11_window_key", "rotate", FALSE,
347   - METACITY "/window_keybindings/move_to_workspace_11", OptionKey},
348   - {"rotate_to_12_window_key", "rotate", FALSE,
349   - METACITY "/window_keybindings/move_to_workspace_12", OptionKey},
350   -
351   - {"rotate_left_window_key", "rotate", FALSE,
352   - METACITY "/window_keybindings/move_to_workspace_left", OptionKey},
353   - {"rotate_right_window_key", "rotate", FALSE,
354   - METACITY "/window_keybindings/move_to_workspace_right", OptionKey},
355   -
356   - {"command_screenshot", "gnomecompat", FALSE,
357   - METACITY "/keybinding_commands/command_screenshot", OptionString},
358   - {"command_window_screenshot", "gnomecompat", FALSE,
359   - METACITY "/keybinding_commands/command_window_screenshot", OptionString},
360   - {"command_terminal", "gnomecompat", FALSE,
361   - "/desktop/gnome/applications/terminal/exec", OptionString},
362   -
363   - {"current_viewport", "thumbnail", TRUE,
364   - "/apps/panel/applets/window_list/prefs/display_all_workspaces",
365   - OptionSpecial},
366   -
367   - {"autoraise", "core", FALSE,
368   - METACITY "/general/auto_raise", OptionBool},
369   - {"autoraise_delay", "core", FALSE,
370   - METACITY "/general/auto_raise_delay", OptionInt},
371   - {"raise_on_click", "core", FALSE,
372   - METACITY "/general/raise_on_click", OptionBool},
373   - {"click_to_focus", "core", FALSE,
374   - METACITY "/general/focus_mode", OptionSpecial},
375   -
376   - {"audible_bell", "core", FALSE,
377   - METACITY "/general/audible_bell", OptionBool},
378   - /*{"hsize", "core", TRUE,
379   - METACITY "/general/num_workspaces", OptionInt},*/
380   -};
381   -
382   -#define N_SOPTIONS (sizeof (specialOptions) / sizeof (struct _SpecialOption))
  88 +static Bool writeInit (CCSBackend *backend, CCSContext * context);
  89 +static void writeIntegratedOption (CCSContext *context, CCSSetting *setting, CCSIntegratedSetting *integrated);
383 90  
384   -static CCSSetting *
385   -findDisplaySettingForPlugin (CCSContext *context,
386   - const char *plugin,
387   - const char *setting)
  91 +static Bool
  92 +isIntegratedOption (CCSSetting *setting,
  93 + CCSIntegratedSetting **integrated)
388 94 {
389   - CCSPlugin *p;
390   - CCSSetting *s;
391   -
392   - p = ccsFindPlugin (context, plugin);
393   - if (!p)
394   - return NULL;
  95 + CCSPlugin *plugin = ccsSettingGetParent (setting);
  96 + const char *pluginName = ccsPluginGetName (plugin);
  97 + const char *settingName = ccsSettingGetName (setting);
  98 + CCSIntegratedSetting *tmp = ccsIntegrationGetIntegratedSetting (valueChangeData.integration, pluginName, settingName);
395 99  
396   - s = ccsFindSetting (p, setting);
397   - if (!s)
398   - return NULL;
  100 + if (integrated)
  101 + *integrated = tmp;
399 102  
400   - return s;
  103 + return tmp != NULL;
401 104 }
402 105  
403   -static Bool
404   -isIntegratedOption (CCSSetting *setting,
405   - int *index)
  106 +static void
  107 +updateSetting (CCSBackend *backend, CCSContext *context, CCSPlugin *plugin, CCSSetting *setting)
406 108 {
407   - unsigned int i;
  109 + CCSIntegratedSetting *integrated;
  110 + readInit (backend, context);
  111 + if (!readOption (setting))
  112 + ccsResetToDefault (setting, TRUE);
408 113  
409   - for (i = 0; i < N_SOPTIONS; i++)
  114 + if (ccsGetIntegrationEnabled (context) &&
  115 + isIntegratedOption (setting, &integrated))
410 116 {
411   - const SpecialOption *opt = &specialOptions[i];
412   -
413   - if (strcmp (ccsSettingGetName (setting), opt->settingName) != 0)
414   - continue;
415   -
416   - if (ccsPluginGetName (ccsSettingGetParent (setting)))
417   - {
418   - if (!opt->pluginName)
419   - continue;
420   - if (strcmp (ccsPluginGetName (ccsSettingGetParent (setting)), opt->pluginName) != 0)
421   - continue;
422   - }
423   - else
424   - {
425   - if (opt->pluginName)
426   - continue;
427   - }
428   -
429   - if (index)
430   - *index = i;
431   -
432   - return TRUE;
  117 + writeInit (backend, context);
  118 + writeIntegratedOption (context, setting, integrated);
433 119 }
434   -
435   - return FALSE;
436 120 }
437 121  
438 122 static void
... ... @@ -445,7 +129,6 @@ valueChanged (GConfClient *client,
445 129 char *keyName = (char*) gconf_entry_get_key (entry);
446 130 char *pluginName;
447 131 char *token;
448   - int index;
449 132 unsigned int screenNum;
450 133 CCSPlugin *plugin;
451 134 CCSSetting *setting;
... ... @@ -490,135 +173,35 @@ valueChanged (GConfClient *client,
490 173 if (!setting)
491 174 return;
492 175  
493   - readInit (context);
494   - if (!readOption (setting))
495   - ccsResetToDefault (setting, TRUE);
496   -
497   - if (ccsGetIntegrationEnabled (context) &&
498   - isIntegratedOption (setting, &index))
499   - {
500   - writeInit (context);
501   - writeIntegratedOption (context, setting, index);
502   - }
  176 + /* Passing null here is not optimal, but we are not
  177 + * maintaining gconf actively here */
  178 + updateSetting (NULL, context, plugin, setting);
503 179 }
504 180  
505 181 static void
506   -gnomeValueChanged (GConfClient *client,
507   - guint cnxn_id,
508   - GConfEntry *entry,
509   - gpointer user_data)
  182 +initClient (CCSBackend *backend, CCSContext *context)
510 183 {
511   - CCSContext *context = (CCSContext *)user_data;
512   - char *keyName = (char*) gconf_entry_get_key (entry);
513   - int i, last = 0, num = 0;
514   - Bool needInit = TRUE;
515   -
516   - if (!ccsGetIntegrationEnabled (context))
517   - return;
518   -
519   - /* we have to loop multiple times here, because one Gnome
520   - option may be integrated with multiple Compiz options */
521   -
522   - while (1)
523   - {
524   - for (i = last, num = -1; i < N_SOPTIONS; i++)
525   - {
526   - if (strcmp (specialOptions[i].gnomeName, keyName) == 0)
527   - {
528   - num = i;
529   - last = i + 1;
530   - break;
531   - }
532   - }
533   -
534   - if (num < 0)
535   - break;
536   -
537   - if ((strcmp (specialOptions[num].settingName,
538   - "mouse_button_modifier") == 0) ||
539   - (strcmp (specialOptions[num].settingName,
540   - "resize_with_right_button") == 0))
541   - {
542   - CCSSetting *s;
543   -
544   - if (needInit)
545   - {
546   - readInit (context);
547   - needInit = FALSE;
548   - }
549   -
550   - s = findDisplaySettingForPlugin (context, "core",
551   - "window_menu_button");
552   - if (s)
553   - readSetting (context, s);
554   -
555   - s = findDisplaySettingForPlugin (context, "move",
556   - "initiate_button");
557   - if (s)
558   - readSetting (context, s);
559   -
560   - s = findDisplaySettingForPlugin (context, "resize",
561   - "initiate_button");
562   - if (s)
563   - readSetting (context, s);
564   - }
565   - else
566   - {
567   - CCSPlugin *plugin = NULL;
568   - CCSSetting *setting;
569   - SpecialOption *opt = (SpecialOption *) &specialOptions[num];
570   -
571   - plugin = ccsFindPlugin (context, (char*) opt->pluginName);
572   - if (plugin)
573   - {
574   - for (i = 0; i < 1; i++)
575   - {
576   - setting = ccsFindSetting (plugin, (char*) opt->settingName);
577   -
578   - if (setting)
579   - {
580   - if (needInit)
581   - {
582   - readInit (context);
583   - needInit = FALSE;
584   - }
585   - readSetting (context, setting);
586   - }
587   -
588   - /* do not read display settings multiple
589   - times for multiscreen environments */
590   - }
591   - }
592   - }
593   - }
594   -}
  184 + client = gconf_client_get_for_engine (conf);
595 185  
596   -static void
597   -initClient (CCSContext *context)
598   -{
599   - int i;
  186 + valueChangeData.context = context;
  187 + valueChangeData.storage = ccsIntegratedSettingsStorageDefaultImplNew (&ccsDefaultObjectAllocator);
  188 + valueChangeData.factory = ccsGConfIntegratedSettingFactoryNew (client, &valueChangeData, &ccsDefaultObjectAllocator);
600 189  
601   - client = gconf_client_get_for_engine (conf);
  190 + valueChangeData.integration = ccsGNOMEIntegrationBackendNew (backend,
  191 + context,
  192 + valueChangeData.factory,
  193 + valueChangeData.storage,
  194 + &ccsDefaultObjectAllocator);
602 195  
603 196 compizNotifyId = gconf_client_notify_add (client, COMPIZ, valueChanged,
604 197 context, NULL, NULL);
605 198 gconf_client_add_dir (client, COMPIZ, GCONF_CLIENT_PRELOAD_NONE, NULL);
606   -
607   - for (i = 0; i < NUM_WATCHED_DIRS; i++)
608   - {
609   - gnomeNotifyIds[i] = gconf_client_notify_add (client,
610   - watchedGnomeDirectories[i],
611   - gnomeValueChanged, context,
612   - NULL, NULL);
613   - gconf_client_add_dir (client, watchedGnomeDirectories[i],
614   - GCONF_CLIENT_PRELOAD_NONE, NULL);
615   - }
616 199 }
617 200  
618 201 static void
619 202 finiClient (void)
620 203 {
621   - int i;
  204 + ccsIntegrationUnref (valueChangeData.integration);
622 205  
623 206 if (compizNotifyId)
624 207 {
... ... @@ -626,21 +209,12 @@ finiClient (void)
626 209 compizNotifyId = 0;
627 210 }
628 211 gconf_client_remove_dir (client, COMPIZ, NULL);
629   -
630   - for (i = 0; i < NUM_WATCHED_DIRS; i++)
631   - {
632   - if (gnomeNotifyIds[i])
633   - {
634   - gconf_client_notify_remove (client, gnomeNotifyIds[0]);
635   - gnomeNotifyIds[i] = 0;
636   - }
637   - gconf_client_remove_dir (client, watchedGnomeDirectories[i], NULL);
638   - }
639   -
640 212 gconf_client_suggest_sync (client, NULL);
641 213  
642 214 g_object_unref (client);
643 215 client = NULL;
  216 +
  217 + memset (&valueChangeData, 0, sizeof (CCSGNOMEValueChangeData));
644 218 }
645 219  
646 220 static void
... ... @@ -759,7 +333,8 @@ copyGconfRecursively (GConfEngine *conf,
759 333 }
760 334  
761 335 static void
762   -copyGconfTree (CCSContext *context,
  336 +copyGconfTree (CCSBackend *backend,
  337 + CCSContext *context,
763 338 const gchar *from,
764 339 const gchar *to,
765 340 Bool associate,
... ... @@ -778,7 +353,7 @@ copyGconfTree (CCSContext *context,
778 353  
779 354 gconf_engine_suggest_sync (conf, NULL);
780 355  
781   - initClient (context);
  356 + initClient (backend, context);
782 357 }
783 358  
784 359 static Bool
... ... @@ -868,17 +443,17 @@ readListValue (CCSSetting *setting,
868 443 case TypeString:
869 444 case TypeMatch:
870 445 {
871   - char **array = malloc (nItems * sizeof (char*));
  446 + gchar **array = malloc ((nItems + 1) * sizeof (char*));
872 447 if (!array)
873 448 break;
874 449  
875 450 for (; valueList; valueList = valueList->next, i++)
876 451 array[i] = strdup (gconf_value_get_string (valueList->data));
877   - list = ccsGetValueListFromStringArray (array, nItems, setting);
878   - for (i = 0; i < nItems; i++)
879   - if (array[i])
880   - free (array[i]);
881   - free (array);
  452 +
  453 + array[nItems] = NULL;
  454 +
  455 + list = ccsGetValueListFromStringArray ((const char **) array, nItems, setting);
  456 + g_strfreev (array);
882 457 }
883 458 break;
884 459 case TypeColor:
... ... @@ -912,224 +487,13 @@ readListValue (CCSSetting *setting,
912 487 return FALSE;
913 488 }
914 489  
915   -static unsigned int
916   -getGnomeMouseButtonModifier(void)
917   -{
918   - unsigned int modMask = 0;
919   - GError *err = NULL;
920   - char *value;
921   -
922   - value = gconf_client_get_string (client,
923   - METACITY "/general/mouse_button_modifier",
924   - &err);
925   -
926   - if (err)
927   - {
928   - g_error_free (err);
929   - return 0;
930   - }
931   -
932   - if (!value)
933   - return 0;
934   -
935   - modMask = ccsStringToModifiers (value);
936   - g_free (value);
937   -
938   - return modMask;
939   -}
940   -
941   -static unsigned int
942   -getButtonBindingForSetting (CCSContext *context,
943   - const char *plugin,
944   - const char *setting)
945   -{
946   - CCSSetting *s;
947   -
948   - s = findDisplaySettingForPlugin (context, plugin, setting);
949   - if (!s)
950   - return 0;
951   -
952   - if (ccsSettingGetType (s) != TypeButton)
953   - return 0;
954   -
955   - return ccsSettingGetValue (s)->value.asButton.button;
956   -}
957   -
958 490  
959 491 static Bool
960 492 readIntegratedOption (CCSContext *context,
961 493 CCSSetting *setting,
962   - int index)
  494 + CCSIntegratedSetting *integrated)
963 495 {
964   - GConfValue *gconfValue;
965   - GError *err = NULL;
966   - Bool ret = FALSE;
967   -
968   - gconfValue = gconf_client_get (client,
969   - specialOptions[index].gnomeName,
970   - &err);
971   -
972   - if (err)
973   - {
974   - g_error_free (err);
975   - return FALSE;
976   - }
977   -
978   - if (!gconfValue)
979   - return FALSE;
980   -
981   - switch (specialOptions[index].type) {
982   - case OptionInt:
983   - if (gconfValue->type == GCONF_VALUE_INT)
984   - {
985   - guint value;
986   -
987   - value = gconf_value_get_int (gconfValue);
988   - ccsSetInt (setting, value, TRUE);
989   - ret = TRUE;
990   - }
991   - break;
992   - case OptionBool:
993   - if (gconfValue->type == GCONF_VALUE_BOOL)
994   - {
995   - gboolean value;
996   -
997   - value = gconf_value_get_bool (gconfValue);
998   - ccsSetBool (setting, value ? TRUE : FALSE, TRUE);
999   - ret = TRUE;
1000   - }
1001   - break;
1002   - case OptionBell:
1003   - if (gconfValue->type == GCONF_VALUE_BOOL)
1004   - {
1005   - gboolean value;
1006   -
1007   - value = gconf_value_get_bool (gconfValue);
1008   - ccsSetBell (setting, value ? TRUE : FALSE, TRUE);
1009   -
1010   - ret = TRUE;
1011   - }
1012   - break;
1013   - case OptionString:
1014   - if (gconfValue->type == GCONF_VALUE_STRING)
1015   - {
1016   - const char *value;
1017   -
1018   - value = gconf_value_get_string (gconfValue);
1019   - if (value)
1020   - {
1021   - ccsSetString (setting, value, TRUE);
1022   - ret = TRUE;
1023   - }
1024   - }
1025   - break;
1026   - case OptionKey:
1027   - if (gconfValue->type == GCONF_VALUE_STRING)
1028   - {
1029   - const char *value;
1030   -
1031   - value = gconf_value_get_string (gconfValue);
1032   - if (value)
1033   - {
1034   - CCSSettingKeyValue key;
1035   -
1036