Commit d9a38306 authored by Stepan Salenikovich's avatar Stepan Salenikovich

avatarmanipuation: fix return button infinite loop

In the case the a new photo was taken, the return (undo) button
would get stuck in an infinite loop when trying to return from
edit state to photo state and then from photo state to current state.
In this case it would keep going between the edit and photo state
instead of going back to the current state.

Change-Id: I7550b3fa0bdcdb3d5d373911fae56f46c09eaef8
Tuleap: #917
parent 5c54b353
......@@ -104,7 +104,7 @@ static void set_state(AvatarManipulation *self, AvatarManipulationState state);
static void start_camera(AvatarManipulation *self);
static void take_a_photo(AvatarManipulation *self);
static void choose_picture(AvatarManipulation *self);
static void return_to_previous_state(AvatarManipulation *self);
static void return_to_previous(AvatarManipulation *self);
static void update_preview_cb(GtkFileChooser *file_chooser, GtkWidget *preview);
static void set_avatar(AvatarManipulation *self);
static void got_snapshot(AvatarManipulation *parent);
......@@ -202,9 +202,9 @@ avatar_manipulation_init(AvatarManipulation *self)
g_signal_connect_swapped(priv->button_start_camera, "clicked", G_CALLBACK(start_camera), self);
g_signal_connect_swapped(priv->button_choose_picture, "clicked", G_CALLBACK(choose_picture), self);
g_signal_connect_swapped(priv->button_take_photo, "clicked", G_CALLBACK(take_a_photo), self);
g_signal_connect_swapped(priv->button_return_photo, "clicked", G_CALLBACK(return_to_previous_state), self);
g_signal_connect_swapped(priv->button_return_photo, "clicked", G_CALLBACK(return_to_previous), self);
g_signal_connect_swapped(priv->button_set_avatar, "clicked", G_CALLBACK(set_avatar), self);
g_signal_connect_swapped(priv->button_return_edit, "clicked", G_CALLBACK(return_to_previous_state), self);
g_signal_connect_swapped(priv->button_return_edit, "clicked", G_CALLBACK(return_to_previous), self);
......@@ -363,10 +363,17 @@ set_avatar(AvatarManipulation *self)
static void
return_to_previous_state(AvatarManipulation *self)
return_to_previous(AvatarManipulation *self)
AvatarManipulationPrivate *priv = AVATAR_MANIPULATION_GET_PRIVATE(self);
set_state(self, priv->last_state);
// from photo we alway go back to current
} else {
// otherwise, if we were in edit state, we may have come from photo or current state
set_state(self, priv->last_state);
static void
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment