diff options
author | Timm Bäder <mail@baedert.org> | 2020-02-07 04:32:08 +0100 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-02-07 13:16:32 -0500 |
commit | b9b5cae6d2737394fffae50f387d05131c65e608 (patch) | |
tree | 27efffa93436abb249d2ea7947f63504dbeee3f4 /gtk/gtkcalendar.c | |
parent | 3249756648f507aeb7cbfdf9a00383f1f2368e11 (diff) | |
download | gtk+-b9b5cae6d2737394fffae50f387d05131c65e608.tar.gz |
calendar: Remove day-selected-double-click signal
It doesn't really make sense to treat double clicks here different than
single clicks (and is bad UX), and it also breaks switching months by
quickly trying to single-click the last/first days in the calendar.
Diffstat (limited to 'gtk/gtkcalendar.c')
-rw-r--r-- | gtk/gtkcalendar.c | 55 |
1 files changed, 13 insertions, 42 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 57631f770f..78a702aa73 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -150,7 +150,6 @@ enum { enum { DAY_SELECTED_SIGNAL, - DAY_SELECTED_DOUBLE_CLICK_SIGNAL, PREV_MONTH_SIGNAL, NEXT_MONTH_SIGNAL, PREV_YEAR_SIGNAL, @@ -184,7 +183,6 @@ struct _GtkCalendarClass GtkWidgetClass parent_class; void (* day_selected) (GtkCalendar *calendar); - void (* day_selected_double_click) (GtkCalendar *calendar); void (* prev_month) (GtkCalendar *calendar); void (* next_month) (GtkCalendar *calendar); void (* prev_year) (GtkCalendar *calendar); @@ -424,21 +422,6 @@ gtk_calendar_class_init (GtkCalendarClass *class) G_TYPE_NONE, 0); /** - * GtkCalendar::day-selected-double-click: - * @calendar: the object which received the signal. - * - * Emitted when the user double-clicks a day. - */ - gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL] = - g_signal_new (I_("day-selected-double-click"), - G_OBJECT_CLASS_TYPE (gobject_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GtkCalendarClass, day_selected_double_click), - NULL, NULL, - NULL, - G_TYPE_NONE, 0); - - /** * GtkCalendar::prev-month: * @calendar: the object which received the signal. * @@ -1061,36 +1044,24 @@ gtk_calendar_button_press (GtkGestureClick *gesture, return; day_month = priv->day_month[row][col]; + day = priv->day[row][col]; - if (n_press == 1) - { - day = priv->day[row][col]; - - if (day_month == MONTH_PREV) - calendar_set_month_prev (calendar); - else if (day_month == MONTH_NEXT) - calendar_set_month_next (calendar); - - if (!gtk_widget_has_focus (widget)) - gtk_widget_grab_focus (widget); + if (day_month == MONTH_PREV) + calendar_set_month_prev (calendar); + else if (day_month == MONTH_NEXT) + calendar_set_month_next (calendar); - if (button == GDK_BUTTON_PRIMARY) - { - priv->in_drag = 1; - priv->drag_start_x = x; - priv->drag_start_y = y; - } + if (!gtk_widget_has_focus (widget)) + gtk_widget_grab_focus (widget); - calendar_select_and_focus_day (calendar, day); - } - else if (n_press == 2) + if (button == GDK_BUTTON_PRIMARY) { - priv->in_drag = 0; - if (day_month == MONTH_CURRENT) - g_signal_emit (calendar, - gtk_calendar_signals[DAY_SELECTED_DOUBLE_CLICK_SIGNAL], - 0); + priv->in_drag = 1; + priv->drag_start_x = x; + priv->drag_start_y = y; } + + calendar_select_and_focus_day (calendar, day); } static void |