Support compilation with mutter 3.15.2

This commit is contained in:
Rico Tzschichholz 2014-12-11 12:07:48 +01:00 committed by Tom Beckmann
parent 91e274cf30
commit 3ab490aaf4
2 changed files with 32 additions and 0 deletions

View File

@ -121,7 +121,11 @@ namespace Gala
file_watches[filename] = cache.file_changed.connect ((changed_file) => { file_watches[filename] = cache.file_changed.connect ((changed_file) => {
if (changed_file == filename) { if (changed_file == filename) {
var image_cache = Meta.BackgroundImageCache.get_default (); var image_cache = Meta.BackgroundImageCache.get_default ();
#if HAS_MUTTER316
image_cache.purge (File.new_for_path (changed_file));
#else
image_cache.purge (changed_file); image_cache.purge (changed_file);
#endif
changed (); changed ();
} }
}); });
@ -146,11 +150,19 @@ namespace Gala
set_loaded (); set_loaded ();
if (files.length > 1) if (files.length > 1)
#if HAS_MUTTER316
background.set_blend (File.new_for_path (files[0]), File.new_for_path (files[1]), animation.transition_progress, style);
else if (files.length > 0)
background.set_file (File.new_for_path (files[0]), style);
else
background.set_file (null, style);
#else
background.set_blend (files[0], files[1], animation.transition_progress, style); background.set_blend (files[0], files[1], animation.transition_progress, style);
else if (files.length > 0) else if (files.length > 0)
background.set_filename (files[0], style); background.set_filename (files[0], style);
else else
background.set_filename (null, style); background.set_filename (null, style);
#endif
queue_update_animation (); queue_update_animation ();
}; };
@ -160,7 +172,11 @@ namespace Gala
for (var i = 0; i < files.length; i++) { for (var i = 0; i < files.length; i++) {
watch_file (files[i]); watch_file (files[i]);
#if HAS_MUTTER316
var image = cache.load (File.new_for_path (files[i]));
#else
var image = cache.load (files[i]); var image = cache.load (files[i]);
#endif
if (image.is_loaded ()) { if (image.is_loaded ()) {
num_pending_images--; num_pending_images--;
@ -217,11 +233,19 @@ namespace Gala
void load_image (string filename) void load_image (string filename)
{ {
#if HAS_MUTTER316
background.set_file (File.new_for_path (filename), style);
#else
background.set_filename (filename, style); background.set_filename (filename, style);
#endif
watch_file (filename); watch_file (filename);
var cache = Meta.BackgroundImageCache.get_default (); var cache = Meta.BackgroundImageCache.get_default ();
#if HAS_MUTTER316
var image = cache.load (File.new_for_path (filename));
#else
var image = cache.load (filename); var image = cache.load (filename);
#endif
if (image.is_loaded ()) if (image.is_loaded ())
set_loaded(); set_loaded();
else { else {

View File

@ -36,13 +36,21 @@ namespace Gala
if (system_background == null) { if (system_background == null) {
system_background = new Meta.Background (meta_screen); system_background = new Meta.Background (meta_screen);
system_background.set_color (DEFAULT_BACKGROUND_COLOR); system_background.set_color (DEFAULT_BACKGROUND_COLOR);
#if HAS_MUTTER316
system_background.set_file (File.new_for_path (DEFAULT_BACKGROUND_FILE), GDesktop.BackgroundStyle.WALLPAPER);
#else
system_background.set_filename (DEFAULT_BACKGROUND_FILE, GDesktop.BackgroundStyle.WALLPAPER); system_background.set_filename (DEFAULT_BACKGROUND_FILE, GDesktop.BackgroundStyle.WALLPAPER);
#endif
} }
background = system_background; background = system_background;
var cache = Meta.BackgroundImageCache.get_default (); var cache = Meta.BackgroundImageCache.get_default ();
#if HAS_MUTTER316
var image = cache.load (File.new_for_path (DEFAULT_BACKGROUND_FILE));
#else
var image = cache.load (DEFAULT_BACKGROUND_FILE); var image = cache.load (DEFAULT_BACKGROUND_FILE);
#endif
if (image.is_loaded ()) { if (image.is_loaded ()) {
image = null; image = null;
Idle.add(() => { Idle.add(() => {