event-editor/multi-choice: Consolidate action activation
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/754>
This commit is contained in:
@@ -155,12 +155,10 @@ set_value (GcalMultiChoice *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
up_action_activated (GcalMultiChoice *self)
|
action_activated (GcalMultiChoice *self,
|
||||||
|
int value)
|
||||||
{
|
{
|
||||||
int value, wrapped_value;
|
int wrapped_value;
|
||||||
|
|
||||||
value = self->next_cb ? self->next_cb (self->value) : self->value + 1;
|
|
||||||
g_assert_cmpint (value, >, self->value);
|
|
||||||
|
|
||||||
wrapped_value = WRAP (value, self->min_value, self->max_value);
|
wrapped_value = WRAP (value, self->min_value, self->max_value);
|
||||||
|
|
||||||
@@ -172,22 +170,26 @@ up_action_activated (GcalMultiChoice *self)
|
|||||||
gtk_widget_grab_focus (GTK_WIDGET (self));
|
gtk_widget_grab_focus (GTK_WIDGET (self));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
up_action_activated (GcalMultiChoice *self)
|
||||||
|
{
|
||||||
|
int value;
|
||||||
|
|
||||||
|
value = self->next_cb ? self->next_cb (self->value) : self->value + 1;
|
||||||
|
g_assert_cmpint (value, >, self->value);
|
||||||
|
|
||||||
|
action_activated (self, value);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
down_action_activated (GcalMultiChoice *self)
|
down_action_activated (GcalMultiChoice *self)
|
||||||
{
|
{
|
||||||
int value, wrapped_value;
|
int value;
|
||||||
|
|
||||||
value = self->prev_cb ? self->prev_cb (self->value) : self->value - 1;
|
value = self->prev_cb ? self->prev_cb (self->value) : self->value - 1;
|
||||||
g_assert_cmpint (value, <, self->value);
|
g_assert_cmpint (value, <, self->value);
|
||||||
|
|
||||||
wrapped_value = WRAP (value, self->min_value, self->max_value);
|
action_activated (self, value);
|
||||||
|
|
||||||
set_value (self, wrapped_value, GTK_STACK_TRANSITION_TYPE_NONE);
|
|
||||||
|
|
||||||
if (wrapped_value != value)
|
|
||||||
g_signal_emit (self, signals[WRAPPED], 0);
|
|
||||||
|
|
||||||
gtk_widget_grab_focus (GTK_WIDGET (self));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user