Merge lp:~hikiko/unity-control-center/unity-control-center.lowgfx into lp:unity-control-center
- unity-control-center.lowgfx
- Merge into trunk
Proposed by
Eleni Maria Stea
Status: | Merged |
---|---|
Merged at revision: | 12886 |
Proposed branch: | lp:~hikiko/unity-control-center/unity-control-center.lowgfx |
Merge into: | lp:unity-control-center |
Diff against target: |
892 lines (+378/-61) 21 files modified
configure.ac (+1/-0) panels/appearance/Makefile.am (+4/-3) panels/appearance/appearance.ui (+132/-33) panels/appearance/cc-appearance-panel.c (+219/-3) panels/bluetooth/Makefile.am (+1/-1) panels/bluetooth/gnome-bluetooth/wizard/Makefile.am (+1/-1) panels/color/Makefile.am (+1/-1) panels/datetime/Makefile.am (+1/-1) panels/display/Makefile.am (+1/-1) panels/info/Makefile.am (+2/-2) panels/keyboard/Makefile.am (+1/-1) panels/mouse/Makefile.am (+2/-2) panels/network/Makefile.am (+1/-1) panels/power/Makefile.am (+1/-1) panels/printers/Makefile.am (+1/-1) panels/region/Makefile.am (+1/-1) panels/screen/Makefile.am (+1/-1) panels/universal-access/Makefile.am (+1/-1) panels/wacom/Makefile.am (+2/-2) panels/wacom/calibrator/Makefile.am (+2/-2) shell/Makefile.am (+2/-2) |
To merge this branch: | bzr merge lp:~hikiko/unity-control-center/unity-control-center.lowgfx |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Marco Trevisan (Treviño) | Needs Fixing | ||
Review via email: mp+314696@code.launchpad.net |
Commit message
Low Graphics Mode option:
https:/
Needs unity branch: lp:~hikiko/unity/unity.lowgfx-2017
Description of the change
Low Graphics Mode option:
https:/
Needs unity branch: lp:~hikiko/unity/unity.lowgfx-2017
To post a comment you must log in.
- 12883. By Eleni Maria Stea
-
replaced deprecated INCLUDES with AM_CPPFLAGS to fix warnings at configure
- 12884. By Eleni Maria Stea
-
replaced INCLUDES with AM_CPPFLAGS to fix warning
- 12885. By Eleni Maria Stea
-
* use libcompizconfig to make sure compiz uses flat file configuration
before we apply changes to Default.ini* renamed Low Graphics Mode section to Graphics Mode
- 12886. By Eleni Maria Stea
-
fixes
- 12887. By Eleni Maria Stea
-
take the backend into account
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'configure.ac' |
2 | --- configure.ac 2016-02-16 15:26:59 +0000 |
3 | +++ configure.ac 2017-02-02 17:33:35 +0000 |
4 | @@ -172,6 +172,7 @@ |
5 | pwquality |
6 | accountsservice >= $ACCOUNTSSERVICE_REQUIRED_VERSION) |
7 | PKG_CHECK_MODULES(BLUETOOTH_PANEL, $COMMON_MODULES) |
8 | +PKG_CHECK_MODULES(COMPIZCONFIG, $COMMON_MODULES libcompizconfig) |
9 | |
10 | AM_PROG_VALAC([0.20.0]) |
11 | |
12 | |
13 | === modified file 'panels/appearance/Makefile.am' |
14 | --- panels/appearance/Makefile.am 2014-01-28 22:26:00 +0000 |
15 | +++ panels/appearance/Makefile.am 2017-02-02 17:33:35 +0000 |
16 | @@ -13,9 +13,10 @@ |
17 | slideshowemblemdir = $(datadir)/icons/hicolor/scalable/emblems/ |
18 | dist_slideshowemblem_DATA = ucc-slideshow-emblem.svg |
19 | |
20 | -INCLUDES = \ |
21 | +AM_CPPFLAGS = \ |
22 | $(PANEL_CFLAGS) \ |
23 | $(APPEARANCE_PANEL_CFLAGS) \ |
24 | + $(COMPIZCONFIG_CFLAGS) \ |
25 | -DG_LOG_DOMAIN="\"$(PACKAGE)\"" \ |
26 | -DLOCALEDIR="\"$(datadir)/locale\"" \ |
27 | -DPKGDATADIR="\"$(uidir)\"" \ |
28 | @@ -48,11 +49,11 @@ |
29 | bg-colors-source.h |
30 | |
31 | libappearance_la_LIBADD = $(PANEL_LIBS) $(APPEARANCE_PANEL_LIBS) |
32 | -libappearance_la_LDFLAGS = $(PANEL_LDFLAGS) |
33 | +libappearance_la_LDFLAGS = $(PANEL_LDFLAGS) $(COMPIZCONFIG_LIBS) |
34 | |
35 | if WITH_LIBSOCIALWEB |
36 | libappearance_la_SOURCES += bg-flickr-source.c bg-flickr-source.h |
37 | -INCLUDES += $(SOCIALWEB_CFLAGS) |
38 | +AM_CPPFLAGS += $(SOCIALWEB_CFLAGS) |
39 | libappearance_la_LIBADD += $(SOCIALWEB_LIBS) |
40 | endif |
41 | |
42 | |
43 | === modified file 'panels/appearance/appearance.ui' |
44 | --- panels/appearance/appearance.ui 2016-01-28 16:15:49 +0000 |
45 | +++ panels/appearance/appearance.ui 2017-02-02 17:33:35 +0000 |
46 | @@ -1,7 +1,10 @@ |
47 | <?xml version="1.0" encoding="UTF-8"?> |
48 | -<!-- Generated with glade 3.16.1 --> |
49 | +<!-- Generated with glade 3.20.0 --> |
50 | <interface> |
51 | <requires lib="gtk+" version="3.0"/> |
52 | + <object class="GtkSizeGroup" id="sizegroup"> |
53 | + <property name="mode">vertical</property> |
54 | + </object> |
55 | <object class="GtkListStore" id="sources-liststore"> |
56 | <columns> |
57 | <!-- column-name source-name --> |
58 | @@ -84,9 +87,9 @@ |
59 | <object class="GtkLabel" id="label1"> |
60 | <property name="visible">True</property> |
61 | <property name="can_focus">False</property> |
62 | - <property name="xalign">0</property> |
63 | <property name="label" translatable="yes"><b>Background</b></property> |
64 | <property name="use_markup">True</property> |
65 | + <property name="xalign">0</property> |
66 | </object> |
67 | <packing> |
68 | <property name="expand">False</property> |
69 | @@ -175,6 +178,19 @@ |
70 | </packing> |
71 | </child> |
72 | <child> |
73 | + <object class="GtkLabel" id="slide-label"> |
74 | + <property name="visible">True</property> |
75 | + <property name="can_focus">False</property> |
76 | + <property name="label" translatable="yes" comments="This refers to a slideshow background">Changes throughout the day</property> |
77 | + <property name="xalign">0</property> |
78 | + </object> |
79 | + <packing> |
80 | + <property name="expand">False</property> |
81 | + <property name="fill">True</property> |
82 | + <property name="position">1</property> |
83 | + </packing> |
84 | + </child> |
85 | + <child> |
86 | <object class="GtkLabel" id="strut"> |
87 | <property name="visible">True</property> |
88 | <property name="can_focus">False</property> |
89 | @@ -186,19 +202,6 @@ |
90 | <property name="position">1</property> |
91 | </packing> |
92 | </child> |
93 | - <child> |
94 | - <object class="GtkLabel" id="slide-label"> |
95 | - <property name="visible">True</property> |
96 | - <property name="can_focus">False</property> |
97 | - <property name="xalign">0</property> |
98 | - <property name="label" translatable="yes" comments="This refers to a slideshow background">Changes throughout the day</property> |
99 | - </object> |
100 | - <packing> |
101 | - <property name="expand">False</property> |
102 | - <property name="fill">True</property> |
103 | - <property name="position">1</property> |
104 | - </packing> |
105 | - </child> |
106 | </object> |
107 | <packing> |
108 | <property name="expand">True</property> |
109 | @@ -454,10 +457,10 @@ |
110 | <object class="GtkLabel" id="theme-label"> |
111 | <property name="visible">True</property> |
112 | <property name="can_focus">False</property> |
113 | - <property name="xalign">0</property> |
114 | <property name="xpad">6</property> |
115 | <property name="label" translatable="yes"><b>Theme</b></property> |
116 | <property name="use_markup">True</property> |
117 | + <property name="xalign">0</property> |
118 | <accessibility> |
119 | <relation type="label-for" target="theme-selector"/> |
120 | </accessibility> |
121 | @@ -521,10 +524,10 @@ |
122 | <object class="GtkLabel" id="unity-iconsize-label"> |
123 | <property name="visible">True</property> |
124 | <property name="can_focus">False</property> |
125 | - <property name="xalign">0</property> |
126 | <property name="xpad">6</property> |
127 | <property name="label" translatable="yes"><b>Launcher icon size</b></property> |
128 | <property name="use_markup">True</property> |
129 | + <property name="xalign">0</property> |
130 | <accessibility> |
131 | <relation type="label-for" target="unity-iconsize-scale"/> |
132 | </accessibility> |
133 | @@ -602,9 +605,9 @@ |
134 | <object class="GtkLabel" id="label4"> |
135 | <property name="visible">True</property> |
136 | <property name="can_focus">False</property> |
137 | - <property name="xalign">0</property> |
138 | <property name="label" translatable="yes"><b>Auto-hide the Launcher</b></property> |
139 | <property name="use_markup">True</property> |
140 | + <property name="xalign">0</property> |
141 | <accessibility> |
142 | <relation type="label-for" target="unity_launcher_autohide"/> |
143 | </accessibility> |
144 | @@ -619,9 +622,9 @@ |
145 | <object class="GtkLabel" id="label2"> |
146 | <property name="visible">True</property> |
147 | <property name="can_focus">False</property> |
148 | - <property name="xalign">0</property> |
149 | <property name="label" translatable="yes"><span size="small">The launcher will reveal when moving the pointer to the defined hot spot.</span></property> |
150 | <property name="use_markup">True</property> |
151 | + <property name="xalign">0</property> |
152 | </object> |
153 | <packing> |
154 | <property name="expand">False</property> |
155 | @@ -640,8 +643,8 @@ |
156 | <object class="GtkLabel" id="unity_reveal_label"> |
157 | <property name="visible">True</property> |
158 | <property name="can_focus">False</property> |
159 | - <property name="xalign">0</property> |
160 | <property name="label" translatable="yes">Reveal location:</property> |
161 | + <property name="xalign">0</property> |
162 | <accessibility> |
163 | <relation type="label-for" target="unity_reveal_spot_left"/> |
164 | <relation type="label-for" target="unity_reveal_spot_topleft"/> |
165 | @@ -829,10 +832,10 @@ |
166 | <child> |
167 | <object class="GtkLabel" id="unity-label-external-tool"> |
168 | <property name="can_focus">False</property> |
169 | - <property name="xalign">0</property> |
170 | <property name="xpad">12</property> |
171 | <property name="label" translatable="yes">Some settings have been overriden by an external program, press "Restore Default Behaviors" to reset the behavior and return control to this panel.</property> |
172 | <property name="wrap">True</property> |
173 | + <property name="xalign">0</property> |
174 | </object> |
175 | <packing> |
176 | <property name="expand">False</property> |
177 | @@ -936,9 +939,9 @@ |
178 | <object class="GtkLabel" id="label3"> |
179 | <property name="visible">True</property> |
180 | <property name="can_focus">False</property> |
181 | - <property name="xalign">0</property> |
182 | <property name="label" translatable="yes"><b>Show the menus for a window</b></property> |
183 | <property name="use_markup">True</property> |
184 | + <property name="xalign">0</property> |
185 | <accessibility> |
186 | <relation type="label-for" target="unity_global_menus"/> |
187 | <relation type="label-for" target="unity_local_menus"/> |
188 | @@ -1012,9 +1015,9 @@ |
189 | <object class="GtkLabel" id="label5"> |
190 | <property name="visible">True</property> |
191 | <property name="can_focus">False</property> |
192 | - <property name="xalign">0</property> |
193 | <property name="label" translatable="yes"><b>Menus visibility</b></property> |
194 | <property name="use_markup">True</property> |
195 | + <property name="xalign">0</property> |
196 | <accessibility> |
197 | <relation type="label-for" target="unity_global_menus"/> |
198 | <relation type="label-for" target="unity_local_menus"/> |
199 | @@ -1106,6 +1109,111 @@ |
200 | </packing> |
201 | </child> |
202 | <child> |
203 | + <object class="GtkBox" id="low_gfx_box"> |
204 | + <property name="height_request">36</property> |
205 | + <property name="visible">True</property> |
206 | + <property name="can_focus">False</property> |
207 | + <property name="margin_left">12</property> |
208 | + <property name="orientation">vertical</property> |
209 | + <property name="spacing">12</property> |
210 | + <child> |
211 | + <object class="GtkLabel" id="label7"> |
212 | + <property name="visible">True</property> |
213 | + <property name="can_focus">False</property> |
214 | + <property name="label" translatable="yes"><b>Graphics Mode</b></property> |
215 | + <property name="use_markup">True</property> |
216 | + <property name="xalign">0</property> |
217 | + <accessibility> |
218 | + <relation type="label-for" target="unity_global_menus"/> |
219 | + <relation type="label-for" target="unity_local_menus"/> |
220 | + </accessibility> |
221 | + </object> |
222 | + <packing> |
223 | + <property name="expand">False</property> |
224 | + <property name="fill">True</property> |
225 | + <property name="position">0</property> |
226 | + </packing> |
227 | + </child> |
228 | + <child> |
229 | + <object class="GtkBox" id="unity_lowgfx"> |
230 | + <property name="visible">True</property> |
231 | + <property name="can_focus">False</property> |
232 | + <child> |
233 | + <object class="GtkLabel" id="unity_lowgfx_label"> |
234 | + <property name="visible">True</property> |
235 | + <property name="can_focus">False</property> |
236 | + <property name="xpad">5</property> |
237 | + <property name="label" translatable="yes">Appearance and other effects:</property> |
238 | + <property name="xalign">0.5899999737739563</property> |
239 | + </object> |
240 | + <packing> |
241 | + <property name="expand">False</property> |
242 | + <property name="fill">True</property> |
243 | + <property name="position">0</property> |
244 | + </packing> |
245 | + </child> |
246 | + <child> |
247 | + <object class="GtkRadioButton" id="unity_lowgfx_enable"> |
248 | + <property name="label" translatable="yes">Limited Effects </property> |
249 | + <property name="visible">True</property> |
250 | + <property name="can_focus">True</property> |
251 | + <property name="receives_default">False</property> |
252 | + <property name="margin_left">5</property> |
253 | + <property name="xalign">1</property> |
254 | + <property name="active">True</property> |
255 | + <property name="draw_indicator">True</property> |
256 | + <property name="group">unity_lowgfx_disable</property> |
257 | + </object> |
258 | + <packing> |
259 | + <property name="expand">False</property> |
260 | + <property name="fill">True</property> |
261 | + <property name="position">1</property> |
262 | + </packing> |
263 | + </child> |
264 | + <child> |
265 | + <object class="GtkRadioButton" id="unity_lowgfx_disable"> |
266 | + <property name="label" translatable="yes">Full effects</property> |
267 | + <property name="visible">True</property> |
268 | + <property name="can_focus">True</property> |
269 | + <property name="receives_default">False</property> |
270 | + <property name="margin_left">6</property> |
271 | + <property name="xalign">1</property> |
272 | + <property name="active">True</property> |
273 | + <property name="draw_indicator">True</property> |
274 | + <property name="group">unity_lowgfx_enable</property> |
275 | + </object> |
276 | + <packing> |
277 | + <property name="expand">False</property> |
278 | + <property name="fill">True</property> |
279 | + <property name="position">2</property> |
280 | + </packing> |
281 | + </child> |
282 | + </object> |
283 | + <packing> |
284 | + <property name="expand">False</property> |
285 | + <property name="fill">True</property> |
286 | + <property name="position">1</property> |
287 | + </packing> |
288 | + </child> |
289 | + </object> |
290 | + <packing> |
291 | + <property name="expand">False</property> |
292 | + <property name="fill">True</property> |
293 | + <property name="position">5</property> |
294 | + </packing> |
295 | + </child> |
296 | + <child> |
297 | + <object class="GtkSeparator" id="separator5"> |
298 | + <property name="visible">True</property> |
299 | + <property name="can_focus">False</property> |
300 | + </object> |
301 | + <packing> |
302 | + <property name="expand">False</property> |
303 | + <property name="fill">True</property> |
304 | + <property name="position">6</property> |
305 | + </packing> |
306 | + </child> |
307 | + <child> |
308 | <object class="GtkBox" id="box5"> |
309 | <property name="height_request">36</property> |
310 | <property name="visible">True</property> |
311 | @@ -1133,7 +1241,7 @@ |
312 | <packing> |
313 | <property name="expand">False</property> |
314 | <property name="fill">True</property> |
315 | - <property name="position">7</property> |
316 | + <property name="position">8</property> |
317 | </packing> |
318 | </child> |
319 | </object> |
320 | @@ -1155,13 +1263,4 @@ |
321 | </object> |
322 | </child> |
323 | </object> |
324 | - <object class="GtkSizeGroup" id="sizegroup"> |
325 | - <property name="mode">vertical</property> |
326 | - <widgets> |
327 | - <widget name="sources-combobox"/> |
328 | - <widget name="heading-hbox"/> |
329 | - <widget name="slide-label"/> |
330 | - <widget name="strut"/> |
331 | - </widgets> |
332 | - </object> |
333 | </interface> |
334 | |
335 | === modified file 'panels/appearance/cc-appearance-panel.c' |
336 | --- panels/appearance/cc-appearance-panel.c 2016-07-05 14:26:25 +0000 |
337 | +++ panels/appearance/cc-appearance-panel.c 2017-02-02 17:33:35 +0000 |
338 | @@ -5,24 +5,28 @@ |
339 | * it under the terms of the GNU General Public License as published by |
340 | * the Free Software Foundation, either version 2 of the License, or |
341 | * (at your option) any later version. |
342 | - * |
343 | + * |
344 | * This program is distributed in the hope that it will be useful, |
345 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
346 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
347 | * GNU General Public License for more details. |
348 | - * |
349 | + * |
350 | * You should have received a copy of the GNU General Public License |
351 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
352 | - * |
353 | + * |
354 | * Author: Thomas Wood <thomas.wood@intel.com> |
355 | * |
356 | */ |
357 | |
358 | #include <config.h> |
359 | |
360 | +#include <errno.h> |
361 | #include <string.h> |
362 | #include <glib/gi18n-lib.h> |
363 | +#include <glib/gprintf.h> |
364 | +#include <glib/gstdio.h> |
365 | #include <gdesktop-enums.h> |
366 | +#include <ccs.h> |
367 | |
368 | #include "cc-appearance-panel.h" |
369 | #include "bg-wallpapers-source.h" |
370 | @@ -118,6 +122,7 @@ |
371 | #define UNITY_INTEGRATED_MENUS_KEY "integrated-menus" |
372 | #define UNITY_ALWAYS_SHOW_MENUS_KEY "always-show-menus" |
373 | #define SHOW_DESKTOP_UNITY_FAVORITE_STR "unity://desktop-icon" |
374 | +#define UNITY_LOWGFX "lowgfx" |
375 | |
376 | #define MIN_ICONSIZE 16.0 |
377 | #define MAX_ICONSIZE 64.0 |
378 | @@ -128,6 +133,157 @@ |
379 | |
380 | #define WID(y) (GtkWidget *) gtk_builder_get_object (priv->builder, y) |
381 | |
382 | +static CCSContext *ccs_context; |
383 | +static char *ccs_backend; |
384 | +static gboolean init_ccs_context () |
385 | +{ |
386 | + GdkScreen *screen = gdk_screen_get_default (); |
387 | + g_assert (screen); |
388 | + |
389 | + if (!(ccs_context = ccsContextNew (gdk_screen_get_number (screen), |
390 | + &ccsDefaultInterfaceTable))) |
391 | + { |
392 | + fprintf (stderr, "CCS error: Failed to initialize context.\n"); |
393 | + return FALSE; |
394 | + } |
395 | + |
396 | + return TRUE; |
397 | +} |
398 | + |
399 | +static void finalize_ccs_context () |
400 | +{ |
401 | + ccsFreeContext(ccs_context); |
402 | +} |
403 | + |
404 | +static gboolean copy_file_to (const gchar *f1, const gchar *f2) |
405 | +{ |
406 | + FILE *fp1, *fp2; |
407 | + char buf[4096]; |
408 | + int sz; |
409 | + gboolean res = TRUE; |
410 | + |
411 | + if (!(fp1 = fopen (f1, "r"))) |
412 | + { |
413 | + fprintf (stderr, "Failed to open %s for reading: %s.\n", f1, strerror (errno)); |
414 | + return FALSE; |
415 | + } |
416 | + |
417 | + if (!(fp2 = fopen (f2, "w"))) |
418 | + { |
419 | + fprintf (stderr, "Failed to open %s for writing: %s.\n", f2, strerror (errno)); |
420 | + fclose (fp1); |
421 | + return FALSE; |
422 | + } |
423 | + |
424 | + while ((sz = fread (buf, 1, sizeof buf, fp1)) > 0) |
425 | + { |
426 | + if (fwrite (buf, 1, sz, fp2) != sz) |
427 | + { |
428 | + res = FALSE; |
429 | + break; |
430 | + } |
431 | + } |
432 | + |
433 | + fclose (fp1); |
434 | + fclose (fp2); |
435 | + |
436 | + return res; |
437 | +} |
438 | + |
439 | +static gboolean toggle_lowgfx_profile (gboolean enable_lowgfx) |
440 | +{ |
441 | + if (enable_lowgfx) |
442 | + { |
443 | + ccsSetProfile (ccs_context, "unity-lowgfx"); |
444 | + ccsSetIntegrationEnabled (ccs_context, TRUE); |
445 | + ccsSetPluginListAutoSort (ccs_context, TRUE); |
446 | + } |
447 | + else |
448 | + { |
449 | + ccsSetProfile (ccs_context, "unity"); |
450 | + ccsSetIntegrationEnabled (ccs_context, TRUE); |
451 | + ccsSetPluginListAutoSort (ccs_context, TRUE); |
452 | + } |
453 | + |
454 | + return TRUE; |
455 | +} |
456 | + |
457 | +static gboolean toggle_lowgfx_ini_settings (gboolean enable_lowgfx) |
458 | +{ |
459 | + gchar *home_dir = g_get_home_dir (); |
460 | + |
461 | + gchar *default_ini = g_strconcat (home_dir, "/.config/compiz-1/compizconfig/Default.ini", NULL); |
462 | + gchar *system_lowgfx_ini = strdup ("/etc/compizconfig/unity-lowgfx.ini"); |
463 | + gchar *system_unity_ini = strdup ("/etc/compizconfig/unity.ini"); |
464 | + |
465 | + g_assert (g_file_test (system_unity_ini, G_FILE_TEST_EXISTS)); |
466 | + |
467 | + if (!g_file_test (system_lowgfx_ini, G_FILE_TEST_EXISTS)) |
468 | + { |
469 | + g_warning ("File %s not found.", system_lowgfx_ini); |
470 | + goto error; |
471 | + } |
472 | + |
473 | + if (!g_file_test (default_ini, G_FILE_TEST_EXISTS)) |
474 | + { |
475 | + if (!copy_file_to (system_unity_ini, default_ini)) |
476 | + goto error; |
477 | + } |
478 | + |
479 | + ccsSetProfile (ccs_context, "Default"); |
480 | + if (g_strcmp0 (ccsGetProfile (ccs_context), "Default")) |
481 | + { |
482 | + goto error; |
483 | + } |
484 | + |
485 | + if (enable_lowgfx) |
486 | + { |
487 | + if (!copy_file_to (system_lowgfx_ini, default_ini)) |
488 | + goto error; |
489 | + } |
490 | + else |
491 | + { |
492 | + if (!copy_file_to (system_unity_ini, default_ini)) |
493 | + goto error; |
494 | + } |
495 | + |
496 | + g_free (system_unity_ini); |
497 | + g_free (system_lowgfx_ini); |
498 | + g_free (default_ini); |
499 | + return TRUE; |
500 | + |
501 | +error: |
502 | + g_free (system_unity_ini); |
503 | + g_free (system_lowgfx_ini); |
504 | + g_free (default_ini); |
505 | + return FALSE; |
506 | +} |
507 | + |
508 | +static gboolean toggle_lowgfx (gboolean enable_lowgfx) |
509 | +{ |
510 | + if (!g_file_test ("/etc/compizconfig/unity-lowgfx.ini", G_FILE_TEST_EXISTS)) |
511 | + return FALSE; |
512 | + |
513 | + ccs_backend = ccsGetBackend (ccs_context); |
514 | + if (!g_strcmp0 (ccs_backend, "ini")) |
515 | + { |
516 | + return toggle_lowgfx_ini_settings (enable_lowgfx); |
517 | + } |
518 | + else |
519 | + { |
520 | + if (!g_strcmp0 (ccs_backend, "gsettings")) |
521 | + { |
522 | + return toggle_lowgfx_profile (enable_lowgfx); |
523 | + } |
524 | + else |
525 | + { |
526 | + return FALSE; |
527 | + } |
528 | + } |
529 | + |
530 | + return TRUE; |
531 | +} |
532 | + |
533 | static void |
534 | cc_appearance_panel_get_property (GObject *object, |
535 | guint property_id, |
536 | @@ -270,6 +426,8 @@ |
537 | priv->current_background = NULL; |
538 | } |
539 | |
540 | + finalize_ccs_context (); |
541 | + |
542 | G_OBJECT_CLASS (cc_appearance_panel_parent_class)->finalize (object); |
543 | } |
544 | |
545 | @@ -1787,6 +1945,49 @@ |
546 | } |
547 | |
548 | static void |
549 | +lowgfx_widget_refresh (CcAppearancePanel *self) |
550 | +{ |
551 | + CcAppearancePanelPrivate *priv = self->priv; |
552 | + gboolean has_setting = unity_own_setting_exists(self, UNITY_LOWGFX); |
553 | + gboolean profile_exists = g_file_test ("/etc/compizconfig/unity-lowgfx.ini", G_FILE_TEST_EXISTS); |
554 | + |
555 | + gtk_widget_set_sensitive (WID ("unity_lowgfx"), has_setting && profile_exists); |
556 | + |
557 | + gboolean enable_lowgfx = g_settings_get_boolean (priv->unity_own_settings, UNITY_LOWGFX); |
558 | + if (!toggle_lowgfx (enable_lowgfx)) { |
559 | + gtk_widget_set_sensitive (WID ("unity_lowgfx"), FALSE); |
560 | + } |
561 | + |
562 | + if (enable_lowgfx == TRUE) |
563 | + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("unity_lowgfx_enable")), TRUE); |
564 | + else |
565 | + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (WID ("unity_lowgfx_disable")), TRUE); |
566 | +} |
567 | + |
568 | +static void |
569 | +on_lowgfx_changed (GtkToggleButton *button, |
570 | + gpointer user_data) |
571 | +{ |
572 | + CcAppearancePanel *self = CC_APPEARANCE_PANEL (user_data); |
573 | + CcAppearancePanelPrivate *priv = self->priv; |
574 | + |
575 | + gboolean enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (WID ("unity_lowgfx_enable"))); |
576 | + g_settings_set_boolean (priv->unity_own_settings, UNITY_LOWGFX, enabled); |
577 | + |
578 | + if (!toggle_lowgfx (enabled)) { |
579 | + gtk_widget_set_sensitive (WID ("unity_lowgfx"), FALSE); |
580 | + } |
581 | +} |
582 | + |
583 | +static void |
584 | +ext_lowgfx_changed_callback (GSettings* settings, |
585 | + guint key, |
586 | + gpointer user_data) |
587 | +{ |
588 | + lowgfx_widget_refresh (CC_APPEARANCE_PANEL (user_data)); |
589 | +} |
590 | + |
591 | +static void |
592 | on_restore_defaults_page2_clicked (GtkButton *button, gpointer user_data) |
593 | { |
594 | CcAppearancePanel *self = CC_APPEARANCE_PANEL (user_data); |
595 | @@ -1805,6 +2006,9 @@ |
596 | if (unity_own_setting_exists (self, UNITY_ALWAYS_SHOW_MENUS_KEY)) |
597 | g_settings_reset (priv->unity_own_settings, UNITY_ALWAYS_SHOW_MENUS_KEY); |
598 | |
599 | + if (unity_own_setting_exists (self, UNITY_LOWGFX)) |
600 | + g_settings_reset (priv->unity_own_settings, UNITY_LOWGFX); |
601 | + |
602 | GtkToggleButton *showdesktop = GTK_TOGGLE_BUTTON (WID ("check_showdesktop_in_launcher")); |
603 | gtk_toggle_button_set_active(showdesktop, TRUE); |
604 | } |
605 | @@ -1985,9 +2189,19 @@ |
606 | G_CALLBACK (on_menuvisibility_changed), self); |
607 | menuvisibility_widget_refresh (self); |
608 | |
609 | + |
610 | + /* Low gfx */ |
611 | + g_signal_connect (priv->unity_own_settings, "changed::" UNITY_OWN_GSETTINGS_SCHEMA, G_CALLBACK (ext_lowgfx_changed_callback), self); |
612 | + g_signal_connect (WID ("unity_lowgfx_enable"), "toggled", |
613 | + G_CALLBACK (on_lowgfx_changed), self); |
614 | + g_signal_connect (WID ("unity_lowgfx_disable"), "toggled", |
615 | + G_CALLBACK (on_lowgfx_changed), self); |
616 | + lowgfx_widget_refresh (self); |
617 | + |
618 | /* Restore defaut on second page */ |
619 | g_signal_connect (WID ("button-restore-unitybehavior"), "clicked", |
620 | G_CALLBACK (on_restore_defaults_page2_clicked), self); |
621 | + |
622 | } |
623 | |
624 | static void |
625 | @@ -2001,6 +2215,8 @@ |
626 | GtkListStore *store; |
627 | GtkStyleContext *context; |
628 | |
629 | + init_ccs_context(); |
630 | + |
631 | priv = self->priv = APPEARANCE_PANEL_PRIVATE (self); |
632 | |
633 | priv->builder = gtk_builder_new (); |
634 | |
635 | === modified file 'panels/bluetooth/Makefile.am' |
636 | --- panels/bluetooth/Makefile.am 2015-03-03 11:08:17 +0000 |
637 | +++ panels/bluetooth/Makefile.am 2017-02-02 17:33:35 +0000 |
638 | @@ -6,7 +6,7 @@ |
639 | ccpanelsdir = $(PANELS_DIR) |
640 | ccpanels_LTLIBRARIES = libbluetooth.la |
641 | |
642 | -INCLUDES = \ |
643 | +AM_CPPFLAGS = \ |
644 | $(PANEL_CFLAGS) \ |
645 | $(BLUETOOTH_PANEL_CFLAGS) \ |
646 | -I$(srcdir)/gnome-bluetooth/lib \ |
647 | |
648 | === modified file 'panels/bluetooth/gnome-bluetooth/wizard/Makefile.am' |
649 | --- panels/bluetooth/gnome-bluetooth/wizard/Makefile.am 2015-03-03 11:08:17 +0000 |
650 | +++ panels/bluetooth/gnome-bluetooth/wizard/Makefile.am 2017-02-02 17:33:35 +0000 |
651 | @@ -20,7 +20,7 @@ |
652 | ui_DATA = wizard.ui |
653 | uidir = $(pkgdatadir) |
654 | |
655 | -INCLUDES = \ |
656 | +AM_CPPFLAGS = \ |
657 | -I$(srcdir)/../lib \ |
658 | -DLOCALEDIR="\"$(datadir)/locale\"" |
659 | |
660 | |
661 | === modified file 'panels/color/Makefile.am' |
662 | --- panels/color/Makefile.am 2013-11-29 06:28:37 +0000 |
663 | +++ panels/color/Makefile.am 2017-02-02 17:33:35 +0000 |
664 | @@ -2,7 +2,7 @@ |
665 | |
666 | cappletname = color |
667 | |
668 | -INCLUDES = \ |
669 | +AM_CPPFLAGS = \ |
670 | $(PANEL_CFLAGS) \ |
671 | $(COLOR_PANEL_CFLAGS) \ |
672 | -DGNOMECC_UI_DIR="\"$(uidir)\"" \ |
673 | |
674 | === modified file 'panels/datetime/Makefile.am' |
675 | --- panels/datetime/Makefile.am 2014-02-10 22:51:08 +0000 |
676 | +++ panels/datetime/Makefile.am 2017-02-02 17:33:35 +0000 |
677 | @@ -17,7 +17,7 @@ |
678 | iconsscalabledir = $(datadir)/icons/hicolor/scalable/apps |
679 | dist_iconsscalable_DATA = icons/scalable/unity-datetime-panel.svg |
680 | |
681 | -INCLUDES = \ |
682 | +AM_CPPFLAGS = \ |
683 | $(PANEL_CFLAGS) \ |
684 | $(DATETIME_PANEL_CFLAGS) \ |
685 | -DLOCALEDIR="\"$(datadir)/locale\"" \ |
686 | |
687 | === modified file 'panels/display/Makefile.am' |
688 | --- panels/display/Makefile.am 2014-02-14 07:43:49 +0000 |
689 | +++ panels/display/Makefile.am 2017-02-02 17:33:35 +0000 |
690 | @@ -43,7 +43,7 @@ |
691 | Desktop_in_files = unity-display-panel.desktop.in |
692 | desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) |
693 | |
694 | -INCLUDES = $(PANEL_CFLAGS) \ |
695 | +AM_CPPFLAGS = $(PANEL_CFLAGS) \ |
696 | $(DISPLAY_PANEL_CFLAGS) \ |
697 | -DSBINDIR="\"$(sbindir)\"" \ |
698 | -DUIDIR="\"$(uidir)\"" \ |
699 | |
700 | === modified file 'panels/info/Makefile.am' |
701 | --- panels/info/Makefile.am 2014-02-20 23:38:45 +0000 |
702 | +++ panels/info/Makefile.am 2017-02-02 17:33:35 +0000 |
703 | @@ -1,6 +1,6 @@ |
704 | cappletname = info |
705 | |
706 | -INCLUDES = \ |
707 | +AM_CPPFLAGS = \ |
708 | $(PANEL_CFLAGS) \ |
709 | $(INFO_PANEL_CFLAGS) \ |
710 | -DGNOMECC_UI_DIR="\"$(uidir)\"" \ |
711 | @@ -13,7 +13,7 @@ |
712 | noinst_PROGRAMS = test-hostname logo-generator |
713 | test_hostname_SOURCES = hostname-helper.c hostname-helper.h test-hostname.c |
714 | test_hostname_LDADD = $(PANEL_LIBS) $(INFO_PANEL_LIBS) |
715 | -test_hostname_CFLAGS = $(INCLUDES) |
716 | +test_hostname_CFLAGS = $(AM_CPPFLAGS) |
717 | |
718 | logo_generator_SOURCES = logo-generator.vala |
719 | |
720 | |
721 | === modified file 'panels/keyboard/Makefile.am' |
722 | --- panels/keyboard/Makefile.am 2013-11-29 06:28:37 +0000 |
723 | +++ panels/keyboard/Makefile.am 2017-02-02 17:33:35 +0000 |
724 | @@ -47,7 +47,7 @@ |
725 | pkgconfigdir = $(datadir)/pkgconfig |
726 | pkgconfig_DATA = unity-keybindings.pc |
727 | |
728 | -INCLUDES = \ |
729 | +AM_CPPFLAGS = \ |
730 | -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ |
731 | -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" \ |
732 | -DGNOMECC_UI_DIR="\"$(uidir)\"" \ |
733 | |
734 | === modified file 'panels/mouse/Makefile.am' |
735 | --- panels/mouse/Makefile.am 2013-11-29 06:28:37 +0000 |
736 | +++ panels/mouse/Makefile.am 2017-02-02 17:33:35 +0000 |
737 | @@ -1,7 +1,7 @@ |
738 | # This is used in PANEL_CFLAGS |
739 | cappletname = mouse |
740 | |
741 | -INCLUDES = \ |
742 | +AM_CPPFLAGS = \ |
743 | $(PANEL_CFLAGS) \ |
744 | $(MOUSE_PANEL_CFLAGS) \ |
745 | -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ |
746 | @@ -34,7 +34,7 @@ |
747 | |
748 | noinst_PROGRAMS = test-gnome-mouse-test |
749 | |
750 | -test_gnome_mouse_test_CPPFLAGS = $(INCLUDES) |
751 | +test_gnome_mouse_test_CPPFLAGS = $(AM_CPPFLAGS) |
752 | test_gnome_mouse_test_LDADD = $(PANEL_LIBS) $(MOUSE_PANEL_LIBS) |
753 | |
754 | @INTLTOOL_DESKTOP_RULE@ |
755 | |
756 | === modified file 'panels/network/Makefile.am' |
757 | --- panels/network/Makefile.am 2013-11-29 06:28:37 +0000 |
758 | +++ panels/network/Makefile.am 2017-02-02 17:33:35 +0000 |
759 | @@ -1,6 +1,6 @@ |
760 | cappletname = network |
761 | |
762 | -INCLUDES = \ |
763 | +AM_CPPFLAGS = \ |
764 | $(PANEL_CFLAGS) \ |
765 | $(NETWORK_PANEL_CFLAGS) \ |
766 | $(NETWORK_MANAGER_CFLAGS) \ |
767 | |
768 | === modified file 'panels/power/Makefile.am' |
769 | --- panels/power/Makefile.am 2013-11-29 06:28:37 +0000 |
770 | +++ panels/power/Makefile.am 2017-02-02 17:33:35 +0000 |
771 | @@ -2,7 +2,7 @@ |
772 | |
773 | SUBDIRS = icons |
774 | |
775 | -INCLUDES = \ |
776 | +AM_CPPFLAGS = \ |
777 | $(PANEL_CFLAGS) \ |
778 | $(POWER_PANEL_CFLAGS) \ |
779 | -DGNOMECC_UI_DIR="\"$(uidir)\"" \ |
780 | |
781 | === modified file 'panels/printers/Makefile.am' |
782 | --- panels/printers/Makefile.am 2013-11-29 07:58:26 +0000 |
783 | +++ panels/printers/Makefile.am 2017-02-02 17:33:35 +0000 |
784 | @@ -8,7 +8,7 @@ |
785 | jobs-dialog.ui \ |
786 | printers.ui |
787 | |
788 | -INCLUDES = \ |
789 | +AM_CPPFLAGS = \ |
790 | $(PANEL_CFLAGS) \ |
791 | $(PRINTERS_PANEL_CFLAGS) \ |
792 | -I$(top_srcdir)/shell/ \ |
793 | |
794 | === modified file 'panels/region/Makefile.am' |
795 | --- panels/region/Makefile.am 2014-09-15 20:22:00 +0000 |
796 | +++ panels/region/Makefile.am 2017-02-02 17:33:35 +0000 |
797 | @@ -1,7 +1,7 @@ |
798 | # This is used in PANEL_CFLAGS |
799 | cappletname = region |
800 | |
801 | -INCLUDES = \ |
802 | +AM_CPPFLAGS = \ |
803 | $(PANEL_CFLAGS) \ |
804 | $(REGION_PANEL_CFLAGS) \ |
805 | -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ |
806 | |
807 | === modified file 'panels/screen/Makefile.am' |
808 | --- panels/screen/Makefile.am 2013-11-29 06:28:37 +0000 |
809 | +++ panels/screen/Makefile.am 2017-02-02 17:33:35 +0000 |
810 | @@ -1,6 +1,6 @@ |
811 | cappletname = screen |
812 | |
813 | -INCLUDES = \ |
814 | +AM_CPPFLAGS = \ |
815 | $(PANEL_CFLAGS) \ |
816 | $(SCREEN_PANEL_CFLAGS) \ |
817 | -DGNOMECC_UI_DIR="\"$(uidir)\"" \ |
818 | |
819 | === modified file 'panels/universal-access/Makefile.am' |
820 | --- panels/universal-access/Makefile.am 2013-11-29 06:28:37 +0000 |
821 | +++ panels/universal-access/Makefile.am 2017-02-02 17:33:35 +0000 |
822 | @@ -1,6 +1,6 @@ |
823 | cappletname = universal-access |
824 | |
825 | -INCLUDES = \ |
826 | +AM_CPPFLAGS = \ |
827 | $(PANEL_CFLAGS) \ |
828 | $(UNIVERSAL_ACCESS_PANEL_CFLAGS) \ |
829 | -DGNOMECC_UI_DIR="\"$(uidir)\"" \ |
830 | |
831 | === modified file 'panels/wacom/Makefile.am' |
832 | --- panels/wacom/Makefile.am 2014-02-19 02:24:52 +0000 |
833 | +++ panels/wacom/Makefile.am 2017-02-02 17:33:35 +0000 |
834 | @@ -3,7 +3,7 @@ |
835 | |
836 | SUBDIRS = calibrator |
837 | |
838 | -INCLUDES = \ |
839 | +AM_CPPFLAGS = \ |
840 | $(PANEL_CFLAGS) \ |
841 | $(WACOM_PANEL_CFLAGS) \ |
842 | -I$(srcdir)/calibrator \ |
843 | @@ -59,7 +59,7 @@ |
844 | gsd-input-helper.h \ |
845 | gsd-enums.h |
846 | |
847 | -test_wacom_CPPFLAGS = $(INCLUDES) |
848 | +test_wacom_CPPFLAGS = $(AM_CPPFLAGS) |
849 | test_wacom_LDADD = $(PANEL_LIBS) $(WACOM_PANEL_LIBS) $(builddir)/calibrator/libwacom-calibrator.la |
850 | |
851 | resource_files = $(shell glib-compile-resources --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/wacom.gresource.xml) |
852 | |
853 | === modified file 'panels/wacom/calibrator/Makefile.am' |
854 | --- panels/wacom/calibrator/Makefile.am 2014-02-19 02:24:52 +0000 |
855 | +++ panels/wacom/calibrator/Makefile.am 2017-02-02 17:33:35 +0000 |
856 | @@ -1,7 +1,7 @@ |
857 | # This is used in PANEL_CFLAGS |
858 | cappletname = wacom |
859 | |
860 | -INCLUDES = \ |
861 | +AM_CPPFLAGS = \ |
862 | $(PANEL_CFLAGS) \ |
863 | $(WACOM_PANEL_CFLAGS) \ |
864 | -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ |
865 | @@ -28,7 +28,7 @@ |
866 | gui_gtk.c \ |
867 | gui_gtk.h |
868 | |
869 | -test_calibrator_CPPFLAGS = $(INCLUDES) |
870 | +test_calibrator_CPPFLAGS = $(AM_CPPFLAGS) |
871 | test_calibrator_LDADD = $(PANEL_LIBS) $(WACOM_PANEL_LIBS) |
872 | |
873 | -include $(top_srcdir)/git.mk |
874 | |
875 | === modified file 'shell/Makefile.am' |
876 | --- shell/Makefile.am 2014-02-24 17:28:38 +0000 |
877 | +++ shell/Makefile.am 2017-02-02 17:33:35 +0000 |
878 | @@ -1,4 +1,4 @@ |
879 | -INCLUDES = \ |
880 | +AM_CPPFLAGS = \ |
881 | -I$(top_srcdir) \ |
882 | $(SHELL_CFLAGS) \ |
883 | $(CHEESE_CFLAGS) |
884 | @@ -70,7 +70,7 @@ |
885 | pkgconfigdir=$(libdir)/pkgconfig |
886 | pkgconfig_DATA=libunity-control-center.pc |
887 | |
888 | -AM_CPPFLAGS = \ |
889 | +AM_CPPFLAGS += \ |
890 | -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ |
891 | -DUIDIR="\"$(uidir)\"" \ |
892 | -DMENUDIR="\"$(menudir)\"" \ |
This would work, but it won't make unity to use the lowgfx profile, but a copy of it...
So instead, I'd make at this level UCC only change the gsetting value.
Then in unity side (tools/ compiz- profile- selector. in) just use "gsettings get" to read the value of this option and choose the right profile.