[gtk/wip/baedert/for-master] caledar: Remove spinning code



commit fec35582cda84d2149f1e7111420efffd4ff35fe
Author: Timm Bäder <mail baedert org>
Date:   Tue Feb 4 12:24:32 2020 +0100

    caledar: Remove spinning code
    
    This is dead code

 gtk/gtkcalendar.c | 109 ------------------------------------------------------
 1 file changed, 109 deletions(-)
---
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 978efdaea7..452c1a7c6e 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -268,7 +268,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 +317,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 +332,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 +382,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 +1235,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 +1289,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,
@@ -2001,38 +1966,6 @@ calendar_timer (gpointer data)
   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 +2031,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 +2052,6 @@ gtk_calendar_button_release (GtkGestureClick *gesture,
 
   if (button == GDK_BUTTON_PRIMARY)
     {
-      calendar_stop_spinning (calendar);
-
       if (priv->in_drag)
         priv->in_drag = 0;
     }
@@ -2399,15 +2312,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)
@@ -2418,25 +2325,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]