[clutter] ClutterDropAction: Added "drop-cancel" signal.



commit 397f3228608b1c7c26f16767742851fb94ca7cc7
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Wed May 2 18:08:02 2012 -0400

    ClutterDropAction: Added "drop-cancel" signal.
    
    The drop-cancel signal allows the drop action to cleanup its
    state if the can-drop signal is refused. This is especially
    useful if the drop action (or its target actor) is managing
    any drop target animations.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=675336

 clutter/clutter-drop-action.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-drop-action.c b/clutter/clutter-drop-action.c
index e91a3cd..4fec019 100644
--- a/clutter/clutter-drop-action.c
+++ b/clutter/clutter-drop-action.c
@@ -101,6 +101,7 @@ enum
   OVER_IN,
   OVER_OUT,
   DROP,
+  DROP_CANCEL,
 
   LAST_SIGNAL
 };
@@ -227,6 +228,13 @@ out:
                              clutter_actor_meta_get_actor (meta),
                              event_x, event_y);
             }
+	  else
+            {
+              g_signal_emit (data->last_action, drop_signals[DROP_CANCEL], 0,
+                             clutter_actor_meta_get_actor (meta),
+                             event_x, event_y);
+            }
+
         }
 
       data->last_action = NULL;
@@ -458,6 +466,34 @@ clutter_drop_action_class_init (ClutterDropActionClass *klass)
                   CLUTTER_TYPE_ACTOR,
                   G_TYPE_FLOAT,
                   G_TYPE_FLOAT);
+
+
+  /**
+   * ClutterDropAction::drop-cancel:
+   * @action: the #ClutterDropAction that emitted the signal
+   * @actor: the #ClutterActor attached to the @action
+   * @event_x: the X coordinate (in stage space) of the drop event
+   * @event_y: the Y coordinate (in stage space) of the drop event
+   *
+   * The ::drop-cancel signal is emitted when the drop is refused
+   * by an emission of the #ClutterDropAction::can-drop signal.
+   *
+   * After the ::drop-cancel signal is fired the active drag is
+   * terminated.
+   *
+   * Since: 1.12
+   */
+  drop_signals[DROP_CANCEL] =
+    g_signal_new (I_("drop-cancel"),
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (ClutterDropActionClass, drop),
+                  NULL, NULL,
+                  _clutter_marshal_VOID__OBJECT_FLOAT_FLOAT,
+                  G_TYPE_NONE, 3,
+                  CLUTTER_TYPE_ACTOR,
+                  G_TYPE_FLOAT,
+                  G_TYPE_FLOAT);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]