[gtk/wip/baedert/for-master: 71/89] calendar: Remove spinning code
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 71/89] calendar: Remove spinning code
- Date: Thu, 6 Feb 2020 15:45:54 +0000 (UTC)
commit a7ac73b36b76ad8dd11cf191e8d3db06dc55821e
Author: Timm Bäder <mail baedert org>
Date: Tue Feb 4 12:24:32 2020 +0100
calendar: Remove spinning code
This is dead code
gtk/gtkcalendar.c | 167 ------------------------------------------------------
1 file changed, 167 deletions(-)
---
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 92c5ef0c17..20b3d6f0c1 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -95,9 +95,6 @@
#include "gtklabel.h"
#include "gtkstack.h"
-#define TIMEOUT_INITIAL 500
-#define TIMEOUT_REPEAT 50
-
static const guint month_length[2][13] =
{
{ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
@@ -268,7 +265,6 @@ struct _GtkCalendarPrivate
gint drag_start_y;
};
-static void gtk_calendar_destroy (GtkWidget *widget);
static void gtk_calendar_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -318,8 +314,6 @@ static void gtk_calendar_key_controller_focus (GtkEventControllerKey *
GdkCrossingMode mode,
GdkNotifyType detail,
GtkWidget *widget);
-static void gtk_calendar_grab_notify (GtkWidget *widget,
- gboolean was_grabbed);
static void gtk_calendar_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static gboolean gtk_calendar_drag_accept (GtkDropTarget *dest,
@@ -335,10 +329,6 @@ static gboolean gtk_calendar_drag_drop (GtkDropTarget *dest,
GtkCalendar *calendar);
-static void calendar_start_spinning (GtkCalendar *calendar,
- gint click_child);
-static void calendar_stop_spinning (GtkCalendar *calendar);
-
static void calendar_invalidate_day (GtkCalendar *widget,
gint row,
gint col);
@@ -389,12 +379,10 @@ gtk_calendar_class_init (GtkCalendarClass *class)
gobject_class->set_property = gtk_calendar_set_property;
gobject_class->get_property = gtk_calendar_get_property;
- widget_class->destroy = gtk_calendar_destroy;
widget_class->snapshot = gtk_calendar_snapshot;
widget_class->measure = gtk_calendar_measure;
widget_class->size_allocate = gtk_calendar_size_allocate;
widget_class->state_flags_changed = gtk_calendar_state_flags_changed;
- widget_class->grab_notify = gtk_calendar_grab_notify;
/**
* GtkCalendar:year:
@@ -1244,17 +1232,6 @@ calendar_row_from_y (GtkCalendar *calendar,
return row;
}
-static void
-calendar_arrow_rectangle (GtkCalendar *calendar,
- guint arrow,
- GdkRectangle *rect)
-{
- GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
-
- gtk_widget_get_allocation (priv->arrow_widgets[arrow],
- rect);
-}
-
static void
calendar_day_rectangle (GtkCalendar *calendar,
gint row,
@@ -1309,21 +1286,6 @@ calendar_set_month_prev (GtkCalendar *calendar)
calendar_queue_refresh (calendar);
}
-
-/****************************************
- * Basic object methods *
- ****************************************/
-
-static void
-gtk_calendar_destroy (GtkWidget *widget)
-{
- GtkCalendar *calendar = GTK_CALENDAR (widget);
-
- calendar_stop_spinning (calendar);
-
- GTK_WIDGET_CLASS (gtk_calendar_parent_class)->destroy (widget);
-}
-
static void
gtk_calendar_set_property (GObject *object,
guint prop_id,
@@ -1946,93 +1908,6 @@ gtk_calendar_snapshot (GtkWidget *widget,
calendar_snapshot_week_numbers (calendar, snapshot);
}
-
-/****************************************
- * Mouse handling *
- ****************************************/
-
-static void
-calendar_arrow_action (GtkCalendar *calendar,
- guint arrow)
-{
- switch (arrow)
- {
- case ARROW_YEAR_LEFT:
- calendar_set_year_prev (calendar);
- break;
- case ARROW_YEAR_RIGHT:
- calendar_set_year_next (calendar);
- break;
- case ARROW_MONTH_LEFT:
- calendar_set_month_prev (calendar);
- break;
- case ARROW_MONTH_RIGHT:
- calendar_set_month_next (calendar);
- break;
- default:;
- /* do nothing */
- }
-}
-
-static gboolean
-calendar_timer (gpointer data)
-{
- GtkCalendar *calendar = data;
- GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
- gboolean retval = FALSE;
-
- if (priv->timer)
- {
- calendar_arrow_action (calendar, priv->click_child);
-
- if (priv->need_timer)
- {
- priv->need_timer = FALSE;
- priv->timer = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
- TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
- (GSourceFunc) calendar_timer,
- calendar, NULL);
- g_source_set_name_by_id (priv->timer, "[gtk] calendar_timer");
- }
- else
- retval = TRUE;
- }
-
- return retval;
-}
-
-static void
-calendar_start_spinning (GtkCalendar *calendar,
- gint click_child)
-{
- GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
-
- priv->click_child = click_child;
-
- if (!priv->timer)
- {
- priv->need_timer = TRUE;
- priv->timer = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE,
- TIMEOUT_INITIAL,
- (GSourceFunc) calendar_timer,
- calendar, NULL);
- g_source_set_name_by_id (priv->timer, "[gtk] calendar_timer");
- }
-}
-
-static void
-calendar_stop_spinning (GtkCalendar *calendar)
-{
- GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
-
- if (priv->timer)
- {
- g_source_remove (priv->timer);
- priv->timer = 0;
- priv->need_timer = FALSE;
- }
-}
-
static void
calendar_main_button_press (GtkCalendar *calendar,
double x,
@@ -2098,30 +1973,12 @@ gtk_calendar_button_press (GtkGestureClick *gesture,
GtkWidget *widget = GTK_WIDGET (calendar);
GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
int button = gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture));
- gint arrow = -1;
if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
if (y > priv->header_h)
calendar_main_button_press (calendar, x, y, n_press, button);
-
- for (arrow = ARROW_YEAR_LEFT; arrow <= ARROW_MONTH_RIGHT; arrow++)
- {
- GdkRectangle arrow_rect;
-
- calendar_arrow_rectangle (calendar, arrow, &arrow_rect);
-
- if (gdk_rectangle_contains_point (&arrow_rect, (int)x, (int)y))
- {
- if (button == GDK_BUTTON_PRIMARY)
- calendar_start_spinning (calendar, arrow);
-
- calendar_arrow_action (calendar, arrow);
-
- return;
- }
- }
}
static void
@@ -2137,8 +1994,6 @@ gtk_calendar_button_release (GtkGestureClick *gesture,
if (button == GDK_BUTTON_PRIMARY)
{
- calendar_stop_spinning (calendar);
-
if (priv->in_drag)
priv->in_drag = 0;
}
@@ -2405,15 +2260,9 @@ gtk_calendar_key_controller_focus (GtkEventControllerKey *key,
GtkCalendarPrivate *priv = gtk_calendar_get_instance_private (calendar);
calendar_queue_refresh (calendar);
- calendar_stop_spinning (calendar);
priv->in_drag = 0;
}
-
-/****************************************
- * Misc widget methods *
- ****************************************/
-
static void
gtk_calendar_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state)
@@ -2424,25 +2273,9 @@ gtk_calendar_state_flags_changed (GtkWidget *widget,
if (!gtk_widget_is_sensitive (widget))
{
priv->in_drag = 0;
- calendar_stop_spinning (calendar);
}
}
-static void
-gtk_calendar_grab_notify (GtkWidget *widget,
- gboolean was_grabbed)
-{
- GTK_WIDGET_CLASS (gtk_calendar_parent_class)->grab_notify (widget, was_grabbed);
-
- if (!was_grabbed)
- calendar_stop_spinning (GTK_CALENDAR (widget));
-}
-
-
-/****************************************
- * Drag and Drop *
- ****************************************/
-
/* Get/set whether drag_motion requested the drag data and
* drag_data_received should thus not actually insert the data,
* since the data doesn’t result from a drop.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]