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

Proposed by Gord Allott
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
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) Approve
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.
Revision history for this message
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
=== modified file 'plugins/unityshell/src/BGHash.cpp'
--- plugins/unityshell/src/BGHash.cpp 2012-02-14 11:03:10 +0000
+++ plugins/unityshell/src/BGHash.cpp 2012-02-22 13:48:18 +0000
@@ -344,6 +344,22 @@
344 _hires_time_end = 500 * 1000; // 500 milliseconds344 _hires_time_end = 500 * 1000; // 500 milliseconds
345 _transition_handler = g_timeout_add (1000/60, (GSourceFunc)BGHash::OnTransitionCallback, this);345 _transition_handler = g_timeout_add (1000/60, (GSourceFunc)BGHash::OnTransitionCallback, this);
346346
347 // export to gsettings
348 GSettings* settings = NULL;
349 GdkColor color = {0,
350 (guint16) (_new_color.red * 65535.0 * 0.7f),
351 (guint16) (_new_color.green * 65535.0 * 0.7f),
352 (guint16) (_new_color.blue * 65535.0 * 0.7f)};
353
354 settings = g_settings_new (UNITY_SCHEMA.c_str());
355 if (settings)
356 {
357 unity::glib::String color_string(gdk_color_to_string(&color));
358 LOG_DEBUG(logger) << "Setting gsettings key to: " << color_string;
359 g_settings_set_string(settings, AVG_BG_COLOR.c_str(), color_string);
360 g_object_unref (settings);
361 }
362
347 }363 }
348364
349 gboolean BGHash::OnTransitionCallback(BGHash *self)365 gboolean BGHash::OnTransitionCallback(BGHash *self)
@@ -384,19 +400,6 @@
384 _current_color.blue * 0.7f,400 _current_color.blue * 0.7f,
385 0.5)401 0.5)
386 );402 );
387 GSettings* settings = NULL;
388 GdkColor color = {0,
389 (guint16) (_current_color.red * 65535.0 * 0.7f),
390 (guint16) (_current_color.green * 65535.0 * 0.7f),
391 (guint16) (_current_color.blue * 65535.0 * 0.7f)};
392
393 settings = g_settings_new (UNITY_SCHEMA.c_str());
394 if (settings)
395 {
396 unity::glib::String color_string(gdk_color_to_string(&color));
397 g_settings_set_string(settings, AVG_BG_COLOR.c_str(), color_string);
398 g_object_unref (settings);
399 }
400 }403 }
401404
402 GdkPixbuf *BGHash::GetPixbufFromBG ()405 GdkPixbuf *BGHash::GetPixbufFromBG ()