[gtk+/gestures: 69/92] gesture: Add gtk_gesture_set_state() helper.



commit 987bb4461e2b1dd23792bf588771aaf58cb3964a
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Apr 8 20:46:26 2014 +0200

    gesture: Add gtk_gesture_set_state() helper.
    
    This function sets the state on all sequences where it actually
    can, just a helper function to avoid iterating over sequences
    yourself.

 gtk/gtkgesture.c |   22 ++++++++++++++++++++++
 gtk/gtkgesture.h |    7 +++++--
 2 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c
index a07ac36..49a1de0 100644
--- a/gtk/gtkgesture.c
+++ b/gtk/gtkgesture.c
@@ -672,6 +672,28 @@ gtk_gesture_set_sequence_state (GtkGesture            *gesture,
   return TRUE;
 }
 
+gboolean
+gtk_gesture_set_state (GtkGesture            *gesture,
+                       GtkEventSequenceState  state)
+{
+  GdkEventSequence *sequence;
+  gboolean handled = FALSE;
+  GtkGesturePrivate *priv;
+  GHashTableIter iter;
+
+  g_return_val_if_fail (GTK_IS_GESTURE (gesture), FALSE);
+  g_return_val_if_fail (state >= GTK_EVENT_SEQUENCE_NONE &&
+                        state <= GTK_EVENT_SEQUENCE_DENIED, FALSE);
+
+  priv = gtk_gesture_get_instance_private (gesture);
+  g_hash_table_iter_init (&iter, priv->points);
+
+  while (g_hash_table_iter_next (&iter, (gpointer*) &sequence, NULL))
+    handled |= gtk_gesture_set_sequence_state (gesture, sequence, state);
+
+  return handled;
+}
+
 /**
  * gtk_gesture_get_sequences:
  * @gesture: a #GtkGesture
diff --git a/gtk/gtkgesture.h b/gtk/gtkgesture.h
index 21e7026..e5976d1 100644
--- a/gtk/gtkgesture.h
+++ b/gtk/gtkgesture.h
@@ -75,9 +75,12 @@ GDK_AVAILABLE_IN_3_14
 GdkDevice * gtk_gesture_get_device           (GtkGesture       *gesture);
 
 GDK_AVAILABLE_IN_3_14
+gboolean    gtk_gesture_set_state            (GtkGesture            *gesture,
+                                              GtkEventSequenceState  state);
+GDK_AVAILABLE_IN_3_14
 GtkEventSequenceState
-            gtk_gesture_get_sequence_state   (GtkGesture       *gesture,
-                                              GdkEventSequence *sequence);
+            gtk_gesture_get_sequence_state   (GtkGesture            *gesture,
+                                              GdkEventSequence      *sequence);
 GDK_AVAILABLE_IN_3_14
 gboolean    gtk_gesture_set_sequence_state   (GtkGesture            *gesture,
                                               GdkEventSequence      *sequence,


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