cleanup get_drag_drop_action, change constructor

This commit is contained in:
Rico Tzschichholz 2013-06-27 14:52:44 +02:00 committed by Tom Beckmann
parent 3703a701aa
commit b81a32abf7

View File

@ -25,8 +25,8 @@ namespace Gala
public class DragDropAction : Clutter.Action public class DragDropAction : Clutter.Action
{ {
public DragDropActionType drag_type { get; private set; } public DragDropActionType drag_type { get; construct; }
public string drag_id { get; set; } public string drag_id { get; construct; }
public Clutter.Actor handle { get; private set; } public Clutter.Actor handle { get; private set; }
Clutter.Actor? hovered = null; Clutter.Actor? hovered = null;
@ -66,8 +66,7 @@ namespace Gala
**/ **/
public DragDropAction (DragDropActionType type, string id) public DragDropAction (DragDropActionType type, string id)
{ {
drag_type = type; Object (drag_type : type, drag_id : id);
drag_id = id;
} }
~DragDropAction () ~DragDropAction ()
@ -179,21 +178,21 @@ namespace Gala
} }
// returns a DragDropAction instance if this actor has one or null. // returns a DragDropAction instance if this actor has one or null.
// It also checks if checks if it is a DESTINATION and if the id matches // It also checks if it is a DESTINATION and if the id matches
DragDropAction? get_drag_drop_action (Clutter.Actor actor) DragDropAction? get_drag_drop_action (Clutter.Actor actor)
{ {
DragDropAction drop_action = null; DragDropAction? drop_action = null;
foreach (var action in actor.get_actions ()) { foreach (var action in actor.get_actions ()) {
if (action is DragDropAction) { drop_action = action as DragDropAction;
drop_action = action as DragDropAction; if (drop_action == null
if (drop_action.drag_type != DragDropActionType.DESTINATION || drop_action.drag_id != drag_id) { || drop_action.drag_type != DragDropActionType.DESTINATION
drop_action = null; || drop_action.drag_id != drag_id)
continue; continue;
}
return drop_action; return drop_action;
}
} }
return null; return null;
} }