event-editor/multi-choice: Add signal for emitting explicit changes

We currently rely on connecting the `notify::value` signal,
which is emitted every time the value is changed explicitly or
implicitly. This can be problematic when, for example, the user
scrolls in the month view, which changes the value of each
GcalDateChooser widget, and each minor difference will re-emit
the signal until it's over. The `GcalMultiChoice::user-changed`
signal will only emit when the user presses the
previous/next buttons.

The next commit will port GcalDateChooser
to `GcalMultiChoice::user-changed`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/837>
This commit is contained in:
Hari Rana
2026-09-30 14:57:26 -04:00
parent 68ac34e8d8
commit be244e13c8
+17
View File
@@ -73,6 +73,7 @@ enum
{
WRAPPED,
ACTIVATE,
USER_CHANGED,
LAST_SIGNAL
};
@@ -132,6 +133,8 @@ action_activated (GcalMultiChoice *self,
g_signal_emit (self, signals[WRAPPED], 0);
gtk_widget_grab_focus (GTK_WIDGET (self));
g_signal_emit (self, signals[USER_CHANGED], 0);
}
static void
@@ -490,6 +493,20 @@ gcal_multi_choice_class_init (GcalMultiChoiceClass *class)
NULL,
G_TYPE_NONE, 0);
/**
* GcalMultiChoice::user-changed:
*
* Emitted when the user explicitly changes the value using up and down buttons.
*/
signals[USER_CHANGED] =
g_signal_new ("user-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
gtk_widget_class_install_action (widget_class, "multi-choice.up", NULL, (GtkWidgetActionActivateFunc) up_action_activated);
gtk_widget_class_install_action (widget_class, "multi-choice.down", NULL, (GtkWidgetActionActivateFunc) down_action_activated);