From 1ecc0f5e1da9a37a524f2da4d357560d4047e123 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 13 Sep 2012 14:29:32 +0200 Subject: [PATCH] event-controller: Rename emitted progress signals started/finished was renamed to began/ended, and "updated" signal has been added too to complete the semantics Signed-off-by: Carlos Garnacho Acked-by: Simon Schampijer --- .../event-controller/sugar-event-controller.c | 25 +++++++++++++------ .../event-controller/sugar-event-controller.h | 5 ++-- .../sugar-long-press-controller.c | 4 +-- .../sugar-rotate-controller.c | 4 +-- .../event-controller/sugar-swipe-controller.c | 4 +-- .../event-controller/sugar-zoom-controller.c | 6 ++--- 6 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/sugar3/event-controller/sugar-event-controller.c b/src/sugar3/event-controller/sugar-event-controller.c index ef9bc00f..2fae4a15 100644 --- a/src/sugar3/event-controller/sugar-event-controller.c +++ b/src/sugar3/event-controller/sugar-event-controller.c @@ -32,8 +32,9 @@ enum { }; enum { - STARTED, - FINISHED, + BEGAN, + UPDATED, + ENDED, LAST_SIGNAL }; @@ -139,19 +140,27 @@ sugar_event_controller_class_init (SugarEventControllerClass *klass) G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - signals[STARTED] = - g_signal_new ("started", + signals[BEGAN] = + g_signal_new ("began", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (SugarEventControllerClass, started), + G_STRUCT_OFFSET (SugarEventControllerClass, began), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - signals[FINISHED] = - g_signal_new ("finished", + signals[UPDATED] = + g_signal_new ("updated", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (SugarEventControllerClass, finished), + G_STRUCT_OFFSET (SugarEventControllerClass, updated), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + signals[ENDED] = + g_signal_new ("ended", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (SugarEventControllerClass, ended), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); diff --git a/src/sugar3/event-controller/sugar-event-controller.h b/src/sugar3/event-controller/sugar-event-controller.h index c96d76d2..7acf84a8 100644 --- a/src/sugar3/event-controller/sugar-event-controller.h +++ b/src/sugar3/event-controller/sugar-event-controller.h @@ -63,8 +63,9 @@ struct _SugarEventControllerClass GObjectClass parent_class; /* Signals */ - void (* started) (SugarEventController *controller); - void (* finished) (SugarEventController *controller); + void (* began) (SugarEventController *controller); + void (* updated) (SugarEventController *controller); + void (* ended) (SugarEventController *controller); /* vmethods */ gboolean (* handle_event) (SugarEventController *controller, diff --git a/src/sugar3/event-controller/sugar-long-press-controller.c b/src/sugar3/event-controller/sugar-long-press-controller.c index 6ded934e..79ba8529 100644 --- a/src/sugar3/event-controller/sugar-long-press-controller.c +++ b/src/sugar3/event-controller/sugar-long-press-controller.c @@ -319,7 +319,7 @@ _sugar_long_press_controller_timeout (gpointer user_data) priv->timeout_id = 0; priv->triggered = TRUE; - g_signal_emit_by_name (controller, "started"); + g_signal_emit_by_name (controller, "began"); return FALSE; } @@ -352,7 +352,7 @@ sugar_long_press_controller_reset (SugarEventController *controller) priv = SUGAR_LONG_PRESS_CONTROLLER (controller)->_priv; if (priv->triggered) - g_signal_emit_by_name (controller, "finished"); + g_signal_emit_by_name (controller, "ended"); _sugar_long_press_controller_cancel (SUGAR_LONG_PRESS_CONTROLLER (controller)); _sugar_long_press_controller_unset_device (SUGAR_LONG_PRESS_CONTROLLER (controller)); diff --git a/src/sugar3/event-controller/sugar-rotate-controller.c b/src/sugar3/event-controller/sugar-rotate-controller.c index c18f3754..f069918a 100644 --- a/src/sugar3/event-controller/sugar-rotate-controller.c +++ b/src/sugar3/event-controller/sugar-rotate-controller.c @@ -183,7 +183,7 @@ sugar_rotate_controller_handle_event (SugarEventController *controller, } else if (priv->touches[0].set || priv->touches[1].set) { - g_signal_emit_by_name (G_OBJECT (controller), "finished"); + g_signal_emit_by_name (G_OBJECT (controller), "ended"); g_object_notify (G_OBJECT (controller), "state"); } break; @@ -226,7 +226,7 @@ sugar_rotate_controller_reset (SugarEventController *controller) priv = SUGAR_ROTATE_CONTROLLER (controller)->_priv; if (priv->touches[0].set && priv->touches[1].set) - g_signal_emit_by_name (G_OBJECT (controller), "finished"); + g_signal_emit_by_name (G_OBJECT (controller), "ended"); priv->touches[0].sequence = NULL; priv->touches[0].set = FALSE; diff --git a/src/sugar3/event-controller/sugar-swipe-controller.c b/src/sugar3/event-controller/sugar-swipe-controller.c index d7a22ca7..9acc5661 100644 --- a/src/sugar3/event-controller/sugar-swipe-controller.c +++ b/src/sugar3/event-controller/sugar-swipe-controller.c @@ -191,10 +191,10 @@ _sugar_swipe_controller_check_emit (SugarSwipeController *controller) if (_sugar_swipe_controller_get_direction (check, last, &direction)) { priv->swiped = TRUE; - g_signal_emit_by_name (G_OBJECT (controller), "started"); + g_signal_emit_by_name (G_OBJECT (controller), "began"); g_object_notify (G_OBJECT (controller), "state"); g_signal_emit (controller, signals[SWIPE_ENDED], 0, direction); - g_signal_emit_by_name (G_OBJECT (controller), "finished"); + g_signal_emit_by_name (G_OBJECT (controller), "ended"); } } diff --git a/src/sugar3/event-controller/sugar-zoom-controller.c b/src/sugar3/event-controller/sugar-zoom-controller.c index be51c943..48c1f765 100644 --- a/src/sugar3/event-controller/sugar-zoom-controller.c +++ b/src/sugar3/event-controller/sugar-zoom-controller.c @@ -164,7 +164,7 @@ sugar_zoom_controller_handle_event (SugarEventController *controller, { _sugar_zoom_controller_get_distance (SUGAR_ZOOM_CONTROLLER (controller), &priv->initial_distance); - g_signal_emit_by_name (G_OBJECT (controller), "started"); + g_signal_emit_by_name (G_OBJECT (controller), "began"); g_object_notify (G_OBJECT (controller), "state"); } break; @@ -179,7 +179,7 @@ sugar_zoom_controller_handle_event (SugarEventController *controller, } else if (!priv->touches[0].set || priv->touches[1].set) { - g_signal_emit_by_name (G_OBJECT (controller), "finished"); + g_signal_emit_by_name (G_OBJECT (controller), "ended"); g_object_notify (G_OBJECT (controller), "state"); } break; @@ -222,7 +222,7 @@ sugar_zoom_controller_reset (SugarEventController *controller) priv = SUGAR_ZOOM_CONTROLLER (controller)->_priv; if (priv->touches[0].set && priv->touches[1].set) - g_signal_emit_by_name (G_OBJECT (controller), "finished"); + g_signal_emit_by_name (G_OBJECT (controller), "ended"); priv->touches[0].sequence = NULL; priv->touches[0].set = FALSE;