[gtk] calendar: Remove day-selected-double-click signal
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] calendar: Remove day-selected-double-click signal
- Date: Fri, 7 Feb 2020 18:23:20 +0000 (UTC)
commit b9b5cae6d2737394fffae50f387d05131c65e608
Author: Timm Bäder <mail baedert org>
Date: Fri Feb 7 04:32:08 2020 +0100
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.
gtk/gtkcalendar.c | 55 +++++++++++++---------------------------------------
tests/testcalendar.c | 24 -----------------------
2 files changed, 13 insertions(+), 66 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);
@@ -423,21 +421,6 @@ gtk_calendar_class_init (GtkCalendarClass *class)
NULL,
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
diff --git a/tests/testcalendar.c b/tests/testcalendar.c
index 605177ef49..91cfa9f207 100644
--- a/tests/testcalendar.c
+++ b/tests/testcalendar.c
@@ -86,27 +86,6 @@ calendar_day_selected (GtkWidget *widget,
g_free (str);
}
-static void
-calendar_day_selected_double_click (GtkWidget *widget,
- CalendarData *data)
-{
- char *str;
- guint day;
- GDateTime *date;
-
- str = calendar_date_to_string (data, "day-selected-double-click: %c");
- calendar_set_signal_strings (str, data);
- date = gtk_calendar_get_date (GTK_CALENDAR (data->calendar_widget));
- day = g_date_time_get_day_of_month (date);
-
- if (gtk_calendar_get_day_is_marked (GTK_CALENDAR (data->calendar_widget), day))
- gtk_calendar_unmark_day (GTK_CALENDAR (data->calendar_widget), day);
- else
- gtk_calendar_mark_day (GTK_CALENDAR (data->calendar_widget), day);
-
- g_date_time_unref (date);
-}
-
static void
calendar_prev_month (GtkWidget *widget,
CalendarData *data)
@@ -222,9 +201,6 @@ create_calendar(void)
g_signal_connect (calendar, "day-selected",
G_CALLBACK (calendar_day_selected),
&calendar_data);
- g_signal_connect (calendar, "day-selected-double-click",
- G_CALLBACK (calendar_day_selected_double_click),
- &calendar_data);
g_signal_connect (calendar, "prev-month",
G_CALLBACK (calendar_prev_month),
&calendar_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]