Merge lp:~didrocks/unity/unity-reset-fix into lp:unity

Proposed by Didier Roche-Tolomelli
Status: Merged
Merged at revision: 1492
Proposed branch: lp:~didrocks/unity/unity-reset-fix
Merge into: lp:unity
Diff against target: 34 lines (+12/-7)
1 file modified
tools/unity.cmake (+12/-7)
To merge this branch: bzr merge lp:~didrocks/unity/unity-reset-fix
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+74060@code.launchpad.net

Description of the change

prevent weird configuration when gconf profiles don't answer (LP: #809378)

To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

Yuck.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tools/unity.cmake'
2--- tools/unity.cmake 2011-06-06 15:26:27 +0000
3+++ tools/unity.cmake 2011-09-05 08:43:15 +0000
4@@ -76,18 +76,23 @@
5 return
6
7 # default value to not force reset if current_profile is unset
8- current_profile_gconfvalue = ""
9- if current_profile_schema:
10- current_profile_gconfvalue = current_profile_schema.get_default_value()
11+ if not current_profile_schema:
12+ print "WARNING: no current gconf profile set, assuming unity"
13+ current_profile_str = 'unity'
14+ current_profile_gconfvalue = None
15+ else:
16+ current_profile_gconfvalue = current_profile_schema.get_default_value()
17+ current_profile_str = current_profile_gconfvalue.get_string()
18
19- if current_profile_gconfvalue.get_string() == 'unity':
20+ if current_profile_str == 'unity':
21 print "WARNING: Unity currently default profile, so switching to metacity while resetting the values"
22 subprocess.Popen(["metacity", "--replace"]) #TODO: check if compiz is indeed running
23 # wait for compiz to stop
24 time.sleep(2)
25- current_profile_gconfvalue.set_string('fooo')
26- current_profile_schema.set_default_value(current_profile_gconfvalue)
27- client.set_schema("/apps/compizconfig-1/current_profile", current_profile_schema)
28+ if current_profile_gconfvalue:
29+ current_profile_gconfvalue.set_string('fooo')
30+ current_profile_schema.set_default_value(current_profile_gconfvalue)
31+ client.set_schema("/apps/compizconfig-1/current_profile", current_profile_schema)
32 # the python binding doesn't recursive-unset right
33 subprocess.Popen(["gconftool-2", "--recursive-unset", "/apps/compiz-1"]).communicate()
34 subprocess.Popen(["gconftool-2", "--recursive-unset", "/apps/compizconfig-1/profiles/unity"]).communicate()