mirror of
https://github.com/elementary/gala.git
synced 2024-11-05 01:42:08 +03:00
Animation: Fix code style (#1969)
This commit is contained in:
parent
563c8a0e22
commit
7b77cf979b
@ -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 = {};
|
||||
string[] key_frame_files = {};
|
||||
|
||||
if (show == null)
|
||||
return;
|
||||
|
||||
if (show.get_num_slides () < 1)
|
||||
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);
|
||||
|
||||
transition_duration = duration;
|
||||
transition_progress = progress;
|
||||
|
||||
if (file1 != null)
|
||||
key_frame_files += file1;
|
||||
|
||||
if (file2 != null)
|
||||
key_frame_files += file2;
|
||||
|
||||
this.key_frame_files = key_frame_files;
|
||||
if (show == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (show.get_num_slides () < 1) {
|
||||
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);
|
||||
|
||||
transition_duration = duration;
|
||||
transition_progress = progress;
|
||||
|
||||
if (file1 != null) {
|
||||
key_frame_files += file1;
|
||||
}
|
||||
|
||||
if (file2 != null) {
|
||||
key_frame_files += file2;
|
||||
}
|
||||
|
||||
this.key_frame_files = key_frame_files;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user