[cheese: 8/13] Avoid deprecated clutter_actor_animate
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cheese: 8/13] Avoid deprecated clutter_actor_animate
- Date: Sat, 20 Apr 2013 21:48:35 +0000 (UTC)
commit 3b90a65166bc2ebdc3f318fbeb341f3fb9f1943b
Author: David King <amigadave amigadave com>
Date: Fri Apr 19 20:12:19 2013 +0100
Avoid deprecated clutter_actor_animate
Use implicit animation instead.
src/cheese-countdown.vala | 34 +++++++++++++++++-----------------
src/cheese-window.vala | 9 +++++++--
2 files changed, 24 insertions(+), 19 deletions(-)
---
diff --git a/src/cheese-countdown.vala b/src/cheese-countdown.vala
index f6f642a..a7c6ffe 100644
--- a/src/cheese-countdown.vala
+++ b/src/cheese-countdown.vala
@@ -19,25 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-using GLib;
-using Clutter;
-
internal class Cheese.Countdown : GLib.Object
{
public delegate void CountdownCallback ();
-
private Clutter.Text countdown_actor;
-
private CountdownCallback completed_callback;
-
private int current_value = 0;
-
- private ulong signal_id;
-
- private Clutter.Animation anim;
-
private GLib.Settings settings;
-
public bool running;
public Countdown (Clutter.Text countdown_actor)
@@ -53,8 +41,14 @@ internal class Cheese.Countdown : GLib.Object
*/
private void fade_out ()
{
- anim = this.countdown_actor.animate (Clutter.AnimationMode.LINEAR, 500, "opacity", 0);
- signal_id = Signal.connect_after (anim, "completed", (GLib.Callback)fade_in, this);
+ var pulse_out = new Clutter.PropertyTransition ("opacity");
+ pulse_out.set_duration (500);
+ pulse_out.set_from_value (255);
+ pulse_out.set_to_value (0);
+ pulse_out.remove_on_complete = true;
+ pulse_out.completed.connect (fade_in);
+
+ this.countdown_actor.add_transition ("pulse-out", pulse_out);
}
/**
@@ -73,8 +67,14 @@ internal class Cheese.Countdown : GLib.Object
this.countdown_actor.text = this.current_value.to_string ();
this.current_value--;
- anim = this.countdown_actor.animate (Clutter.AnimationMode.LINEAR, 500, "opacity", 255);
- signal_id = Signal.connect_after (anim, "completed", (GLib.Callback)fade_out, this);
+ var pulse_in = new Clutter.PropertyTransition ("opacity");
+ pulse_in.set_duration (500);
+ pulse_in.set_from_value (0);
+ pulse_in.set_to_value (255);
+ pulse_in.remove_on_complete = true;
+ pulse_in.completed.connect (fade_out);
+
+ this.countdown_actor.add_transition ("pulse-in", pulse_in);
}
/**
@@ -97,7 +97,7 @@ internal class Cheese.Countdown : GLib.Object
public void stop ()
{
countdown_actor.hide ();
- SignalHandler.disconnect (anim, signal_id);
+ countdown_actor.remove_all_transitions ();
running = false;
}
}
diff --git a/src/cheese-window.vala b/src/cheese-window.vala
index 67d8eed..95cbdd7 100644
--- a/src/cheese-window.vala
+++ b/src/cheese-window.vala
@@ -1097,9 +1097,14 @@ public class Cheese.MainWindow : Gtk.ApplicationWindow
viewport_layout.remove_child (current_effects_grid);
}
current_effects_grid = effects_grids.nth_data (number);
- current_effects_grid.set ("opacity", 0);
+ current_effects_grid.opacity = 0;
viewport_layout.add_child (current_effects_grid);
- current_effects_grid.animate (Clutter.AnimationMode.LINEAR, 1000, "opacity", 255);
+ current_effects_grid.save_easing_state ();
+ current_effects_grid.set_easing_mode (Clutter.AnimationMode.LINEAR);
+ current_effects_grid.set_easing_duration (500);
+ current_effects_grid.opacity = 255;
+ current_effects_grid.restore_easing_state ();
+
uint i = 0;
foreach (var effect in effects_manager.effects)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]