mirror of
https://github.com/elementary/gala.git
synced 2024-11-04 13:16:15 +03:00
cleanup get_drag_drop_action, change constructor
This commit is contained in:
parent
3703a701aa
commit
b81a32abf7
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user