-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,65 @@ | ||
// | ||
// Copyright (C) 2014 Tom Beckmann | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
/* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
* SPDX-FileCopyrightText: 2024 elementary, Inc. (https://elementary.io) | ||
* 2014 Tom Beckmann | ||
*/ | ||
|
||
namespace Gala { | ||
public class Animation : Object { | ||
public string filename { get; construct; } | ||
public string[] key_frame_files { get; private set; default = {}; } | ||
public double transition_progress { get; private set; default = 0.0; } | ||
public double transition_duration { get; private set; default = 0.0; } | ||
public bool loaded { get; private set; default = false; } | ||
public class Gala.Animation : Object { | ||
public string filename { get; construct; } | ||
public string[] key_frame_files { get; private set; default = {}; } | ||
public double transition_progress { get; private set; default = 0.0; } | ||
public double transition_duration { get; private set; default = 0.0; } | ||
public bool loaded { get; private set; default = false; } | ||
|
||
private Gnome.BGSlideShow? show = null; | ||
private Gnome.BGSlideShow? show = null; | ||
|
||
public Animation (string filename) { | ||
Object (filename: filename); | ||
} | ||
public Animation (string filename) { | ||
Object (filename: filename); | ||
} | ||
|
||
public async void load () { | ||
show = new Gnome.BGSlideShow (filename); | ||
public async void load () { | ||
show = new Gnome.BGSlideShow (filename); | ||
|
||
show.load_async (null, (obj, res) => { | ||
loaded = true; | ||
show.load_async (null, (obj, res) => { | ||
loaded = true; | ||
|
||
load.callback (); | ||
}); | ||
load.callback (); | ||
}); | ||
|
||
yield; | ||
} | ||
yield; | ||
} | ||
|
||
#if HAS_MUTTER45 | ||
public void update (Mtk.Rectangle monitor) { | ||
public void update (Mtk.Rectangle monitor) { | ||
#else | ||
public void update (Meta.Rectangle monitor) { | ||
public void update (Meta.Rectangle monitor) { | ||
#endif | ||
string[] key_frame_files = {}; | ||
|
||
if (show == null) | ||
return; | ||
string[] key_frame_files = {}; | ||
|
||
if (show.get_num_slides () < 1) | ||
return; | ||
if (show == null) { | ||
return; | ||
} | ||
|
||
double progress, duration; | ||
bool is_fixed; | ||
string file1, file2; | ||
show.get_current_slide (monitor.width, monitor.height, out progress, out duration, out is_fixed, out file1, out file2); | ||
if (show.get_num_slides () < 1) { | ||
return; | ||
} | ||
|
||
transition_duration = duration; | ||
transition_progress = progress; | ||
double progress, duration; | ||
bool is_fixed; | ||
string file1, file2; | ||
show.get_current_slide (monitor.width, monitor.height, out progress, out duration, out is_fixed, out file1, out file2); | ||
|
||
if (file1 != null) | ||
key_frame_files += file1; | ||
transition_duration = duration; | ||
transition_progress = progress; | ||
|
||
if (file2 != null) | ||
key_frame_files += file2; | ||
if (file1 != null) { | ||
key_frame_files += file1; | ||
} | ||
|
||
this.key_frame_files = key_frame_files; | ||
if (file2 != null) { | ||
key_frame_files += file2; | ||
} | ||
|
||
this.key_frame_files = key_frame_files; | ||
} | ||
} |