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 <carlos@lanedo.com> Acked-by: Simon Schampijer <simon@laptop.org>
This commit is contained in:
parent
64a759e2dc
commit
1ecc0f5e1d
@ -32,8 +32,9 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
STARTED,
|
BEGAN,
|
||||||
FINISHED,
|
UPDATED,
|
||||||
|
ENDED,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -139,19 +140,27 @@ sugar_event_controller_class_init (SugarEventControllerClass *klass)
|
|||||||
G_PARAM_STATIC_NAME |
|
G_PARAM_STATIC_NAME |
|
||||||
G_PARAM_STATIC_NICK |
|
G_PARAM_STATIC_NICK |
|
||||||
G_PARAM_STATIC_BLURB));
|
G_PARAM_STATIC_BLURB));
|
||||||
signals[STARTED] =
|
signals[BEGAN] =
|
||||||
g_signal_new ("started",
|
g_signal_new ("began",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (SugarEventControllerClass, started),
|
G_STRUCT_OFFSET (SugarEventControllerClass, began),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
signals[FINISHED] =
|
signals[UPDATED] =
|
||||||
g_signal_new ("finished",
|
g_signal_new ("updated",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST,
|
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,
|
NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__VOID,
|
g_cclosure_marshal_VOID__VOID,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
@ -63,8 +63,9 @@ struct _SugarEventControllerClass
|
|||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
/* Signals */
|
/* Signals */
|
||||||
void (* started) (SugarEventController *controller);
|
void (* began) (SugarEventController *controller);
|
||||||
void (* finished) (SugarEventController *controller);
|
void (* updated) (SugarEventController *controller);
|
||||||
|
void (* ended) (SugarEventController *controller);
|
||||||
|
|
||||||
/* vmethods */
|
/* vmethods */
|
||||||
gboolean (* handle_event) (SugarEventController *controller,
|
gboolean (* handle_event) (SugarEventController *controller,
|
||||||
|
@ -319,7 +319,7 @@ _sugar_long_press_controller_timeout (gpointer user_data)
|
|||||||
|
|
||||||
priv->timeout_id = 0;
|
priv->timeout_id = 0;
|
||||||
priv->triggered = TRUE;
|
priv->triggered = TRUE;
|
||||||
g_signal_emit_by_name (controller, "started");
|
g_signal_emit_by_name (controller, "began");
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -352,7 +352,7 @@ sugar_long_press_controller_reset (SugarEventController *controller)
|
|||||||
priv = SUGAR_LONG_PRESS_CONTROLLER (controller)->_priv;
|
priv = SUGAR_LONG_PRESS_CONTROLLER (controller)->_priv;
|
||||||
|
|
||||||
if (priv->triggered)
|
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_cancel (SUGAR_LONG_PRESS_CONTROLLER (controller));
|
||||||
_sugar_long_press_controller_unset_device (SUGAR_LONG_PRESS_CONTROLLER (controller));
|
_sugar_long_press_controller_unset_device (SUGAR_LONG_PRESS_CONTROLLER (controller));
|
||||||
|
@ -183,7 +183,7 @@ sugar_rotate_controller_handle_event (SugarEventController *controller,
|
|||||||
}
|
}
|
||||||
else if (priv->touches[0].set || priv->touches[1].set)
|
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");
|
g_object_notify (G_OBJECT (controller), "state");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -226,7 +226,7 @@ sugar_rotate_controller_reset (SugarEventController *controller)
|
|||||||
priv = SUGAR_ROTATE_CONTROLLER (controller)->_priv;
|
priv = SUGAR_ROTATE_CONTROLLER (controller)->_priv;
|
||||||
|
|
||||||
if (priv->touches[0].set && priv->touches[1].set)
|
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].sequence = NULL;
|
||||||
priv->touches[0].set = FALSE;
|
priv->touches[0].set = FALSE;
|
||||||
|
@ -191,10 +191,10 @@ _sugar_swipe_controller_check_emit (SugarSwipeController *controller)
|
|||||||
if (_sugar_swipe_controller_get_direction (check, last, &direction))
|
if (_sugar_swipe_controller_get_direction (check, last, &direction))
|
||||||
{
|
{
|
||||||
priv->swiped = TRUE;
|
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_object_notify (G_OBJECT (controller), "state");
|
||||||
g_signal_emit (controller, signals[SWIPE_ENDED], 0, direction);
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ sugar_zoom_controller_handle_event (SugarEventController *controller,
|
|||||||
{
|
{
|
||||||
_sugar_zoom_controller_get_distance (SUGAR_ZOOM_CONTROLLER (controller),
|
_sugar_zoom_controller_get_distance (SUGAR_ZOOM_CONTROLLER (controller),
|
||||||
&priv->initial_distance);
|
&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");
|
g_object_notify (G_OBJECT (controller), "state");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -179,7 +179,7 @@ sugar_zoom_controller_handle_event (SugarEventController *controller,
|
|||||||
}
|
}
|
||||||
else if (!priv->touches[0].set || priv->touches[1].set)
|
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");
|
g_object_notify (G_OBJECT (controller), "state");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -222,7 +222,7 @@ sugar_zoom_controller_reset (SugarEventController *controller)
|
|||||||
priv = SUGAR_ZOOM_CONTROLLER (controller)->_priv;
|
priv = SUGAR_ZOOM_CONTROLLER (controller)->_priv;
|
||||||
|
|
||||||
if (priv->touches[0].set && priv->touches[1].set)
|
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].sequence = NULL;
|
||||||
priv->touches[0].set = FALSE;
|
priv->touches[0].set = FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user