[gnome-boxes] Minor cleanup
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Minor cleanup
- Date: Thu, 21 Jun 2012 08:18:05 +0000 (UTC)
commit 48fbcfbcb468d63aec5c2eb3e3bd7d0eb0a12028
Author: Alexander Larsson <alexl redhat com>
Date: Thu Jun 21 10:05:07 2012 +0200
Minor cleanup
Define a current_image local to avoid multiple uses of App.app.current_item
https://bugzilla.gnome.org/show_bug.cgi?id=678456
src/collection-view.vala | 21 ++++++++++++---------
1 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/collection-view.vala b/src/collection-view.vala
index 60064f6..1b707a8 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -38,12 +38,13 @@ private class Boxes.CollectionView: Boxes.UI {
public override void ui_state_changed () {
uint opacity = 0;
+ var current_item = App.app.current_item;
switch (ui_state) {
case UIState.COLLECTION:
opacity = 255;
icon_view.unselect_all ();
- if (App.app.current_item != null) {
- var actor = App.app.current_item.actor;
+ if (current_item != null) {
+ var actor = current_item.actor;
App.app.overlay_bin.set_alignment (actor,
Clutter.BinAlignment.FIXED,
Clutter.BinAlignment.FIXED);
@@ -51,7 +52,10 @@ private class Boxes.CollectionView: Boxes.UI {
actor.x = 20;
actor.y = 20;
actor.min_width = actor.natural_width = Machine.SCREENSHOT_WIDTH;
- actor.transitions_completed.connect (() => {
+
+ ulong completed_id = 0;
+ completed_id = actor.transitions_completed.connect (() => {
+ actor.disconnect (completed_id);
if (App.app.ui_state == UIState.COLLECTION ||
App.app.current_item.actor != actor)
actor_remove (actor);
@@ -60,8 +64,8 @@ private class Boxes.CollectionView: Boxes.UI {
break;
case UIState.CREDS:
- var actor = App.app.current_item.actor;
- if (App.app.current_item.actor.get_parent () == null) {
+ var actor = current_item.actor;
+ if (actor.get_parent () == null) {
App.app.overlay_bin.add (actor,
Clutter.BinAlignment.FIXED,
Clutter.BinAlignment.FIXED);
@@ -77,15 +81,14 @@ private class Boxes.CollectionView: Boxes.UI {
break;
case UIState.PROPERTIES:
- var item_actor = App.app.current_item.actor;
- item_actor.hide ();
+ current_item.actor.hide ();
break;
}
fade_actor (actor, opacity);
- if (App.app.current_item != null)
- App.app.current_item.ui_state = ui_state;
+ if (current_item != null)
+ current_item.ui_state = ui_state;
}
public void update_item_visible (CollectionItem item) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]