Merge lp:~gordallott/unity/bghash-only-emit-on-change into lp:unity

Proposed by Gord Allott on 2012-02-22
Status: Merged
Approved by: Mirco Müller on 2012-02-22
Approved revision: 2006
Merged at revision: 2007
Proposed branch: lp:~gordallott/unity/bghash-only-emit-on-change
Merge into: lp:unity
Diff against target: 46 lines (+16/-13)
1 file modified
plugins/unityshell/src/BGHash.cpp (+16/-13)
To merge this branch: bzr merge lp:~gordallott/unity/bghash-only-emit-on-change
Reviewer Review Type Date Requested Status
Mirco Müller (community) 2012-02-22 Approve on 2012-02-22
Review via email: mp+94161@code.launchpad.net

Description of the Change

Makes bghash only change the gsettings key once per wallpaper change, instead of on every frame it transitions to the next wallpaper.

No test as gsettings is not sandboxable and this change is *only* gsettings key change related.

To post a comment you must log in.
Mirco Müller (macslow) wrote :

Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/BGHash.cpp'
2--- plugins/unityshell/src/BGHash.cpp 2012-02-14 11:03:10 +0000
3+++ plugins/unityshell/src/BGHash.cpp 2012-02-22 13:48:18 +0000
4@@ -344,6 +344,22 @@
5 _hires_time_end = 500 * 1000; // 500 milliseconds
6 _transition_handler = g_timeout_add (1000/60, (GSourceFunc)BGHash::OnTransitionCallback, this);
7
8+ // export to gsettings
9+ GSettings* settings = NULL;
10+ GdkColor color = {0,
11+ (guint16) (_new_color.red * 65535.0 * 0.7f),
12+ (guint16) (_new_color.green * 65535.0 * 0.7f),
13+ (guint16) (_new_color.blue * 65535.0 * 0.7f)};
14+
15+ settings = g_settings_new (UNITY_SCHEMA.c_str());
16+ if (settings)
17+ {
18+ unity::glib::String color_string(gdk_color_to_string(&color));
19+ LOG_DEBUG(logger) << "Setting gsettings key to: " << color_string;
20+ g_settings_set_string(settings, AVG_BG_COLOR.c_str(), color_string);
21+ g_object_unref (settings);
22+ }
23+
24 }
25
26 gboolean BGHash::OnTransitionCallback(BGHash *self)
27@@ -384,19 +400,6 @@
28 _current_color.blue * 0.7f,
29 0.5)
30 );
31- GSettings* settings = NULL;
32- GdkColor color = {0,
33- (guint16) (_current_color.red * 65535.0 * 0.7f),
34- (guint16) (_current_color.green * 65535.0 * 0.7f),
35- (guint16) (_current_color.blue * 65535.0 * 0.7f)};
36-
37- settings = g_settings_new (UNITY_SCHEMA.c_str());
38- if (settings)
39- {
40- unity::glib::String color_string(gdk_color_to_string(&color));
41- g_settings_set_string(settings, AVG_BG_COLOR.c_str(), color_string);
42- g_object_unref (settings);
43- }
44 }
45
46 GdkPixbuf *BGHash::GetPixbufFromBG ()