From be244e13c8bc3ede2ea4079f33358567c35f98fd Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Fri, 18 Sep 2026 07:14:01 -0400 Subject: [PATCH] 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: --- src/gui/event-editor/gcal-multi-choice.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/gui/event-editor/gcal-multi-choice.c b/src/gui/event-editor/gcal-multi-choice.c index dcc3a571..44742175 100644 --- a/src/gui/event-editor/gcal-multi-choice.c +++ b/src/gui/event-editor/gcal-multi-choice.c @@ -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);