[gtk+] Deprecate and ignore the timeout-initial and timeout-repeat settings



commit 57fc8763e930911f97b6e9fc9edebafb887db2b3
Author: William Jon McCann <william jon mccann gmail com>
Date:   Tue Jul 9 16:44:04 2013 -0400

    Deprecate and ignore the timeout-initial and timeout-repeat settings

 gdk/win32/gdkproperty-win32.c |    2 --
 gdk/x11/gdksettings.c         |    2 --
 gtk/gtkcalendar.c             |   19 +++++--------------
 gtk/gtknotebook.c             |   34 ++++++++--------------------------
 gtk/gtkpathbar.c              |   16 ++++------------
 gtk/gtkrange.c                |   16 ++++------------
 gtk/gtksettings.c             |   18 ++++++++++++++----
 gtk/gtkspinbutton.c           |   17 ++++-------------
 8 files changed, 39 insertions(+), 85 deletions(-)
---
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index 975ff33..59ab2c8 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -311,8 +311,6 @@ _gdk_win32_window_delete_property (GdkWindow *window,
   "Gtk/Modules\0"             "gtk-modules\0"
   "Gtk/CursorThemeName\0"     "gtk-cursor-theme-name\0"
   "Gtk/CursorThemeSize\0"     "gtk-cursor-theme-size\0"
-  "Gtk/TimeoutInitial\0"      "gtk-timeout-initial\0"
-  "Gtk/TimeoutRepeat\0"       "gtk-timeout-repeat\0"
   "Gtk/ColorScheme\0"         "gtk-color-scheme\0"
   "Gtk/EnableAnimations\0"    "gtk-enable-animations\0"
   "Xft/Antialias\0"           "gtk-xft-antialias\0"
diff --git a/gdk/x11/gdksettings.c b/gdk/x11/gdksettings.c
index 07f6aa0..b9e6532 100644
--- a/gdk/x11/gdksettings.c
+++ b/gdk/x11/gdksettings.c
@@ -36,8 +36,6 @@ static const struct {
   {"Gtk/Modules",             "gtk-modules"},
   {"Gtk/CursorThemeName",     "gtk-cursor-theme-name"},
   {"Gtk/CursorThemeSize",     "gtk-cursor-theme-size"},
-  {"Gtk/TimeoutInitial",      "gtk-timeout-initial"},
-  {"Gtk/TimeoutRepeat",       "gtk-timeout-repeat"},
   {"Gtk/ColorScheme",         "gtk-color-scheme"},
   {"Gtk/EnableAnimations",    "gtk-enable-animations"},
   {"Xft/Antialias",           "gtk-xft-antialias"},
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 588a905..2f0646e 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -81,6 +81,9 @@
 #include "gtktooltip.h"
 #include "gtkprivate.h"
 
+#define TIMEOUT_INITIAL  500
+#define TIMEOUT_REPEAT    50
+
 /***************************************************************************/
 /* The following date routines are taken from the lib_date package.
  * They have been minimally edited to avoid conflict with types defined
@@ -2884,15 +2887,9 @@ calendar_timer (gpointer data)
 
       if (priv->need_timer)
         {
-          GtkSettings *settings;
-          guint        timeout;
-
-          settings = gtk_widget_get_settings (GTK_WIDGET (calendar));
-          g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
-
           priv->need_timer = FALSE;
           priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
-                                            timeout * SCROLL_DELAY_FACTOR,
+                                            TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
                                             (GSourceFunc) calendar_timer,
                                             (gpointer) calendar, NULL);
         }
@@ -2913,15 +2910,9 @@ calendar_start_spinning (GtkCalendar *calendar,
 
   if (!priv->timer)
     {
-      GtkSettings *settings;
-      guint        timeout;
-
-      settings = gtk_widget_get_settings (GTK_WIDGET (calendar));
-      g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
-
       priv->need_timer = TRUE;
       priv->timer = gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE,
-                                        timeout,
+                                        TIMEOUT_INITIAL,
                                         (GSourceFunc) calendar_timer,
                                         (gpointer) calendar, NULL);
     }
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 2b4d832..b44c84a 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -104,6 +104,10 @@
 #define FRAMES_PER_SECOND     45
 #define MSECS_BETWEEN_UPDATES (1000 / FRAMES_PER_SECOND)
 
+#define TIMEOUT_INITIAL  500
+#define TIMEOUT_REPEAT    50
+#define TIMEOUT_EXPAND   500
+
 typedef struct _GtkNotebookPage GtkNotebookPage;
 
 typedef enum
@@ -3368,8 +3372,6 @@ gtk_notebook_motion_notify (GtkWidget      *widget,
   GtkNotebookPage *page;
   GtkNotebookArrow arrow;
   GtkNotebookPointerPosition pointer_position;
-  GtkSettings *settings;
-  guint timeout;
   gint x_win, y_win;
 
   page = priv->cur_page;
@@ -3433,10 +3435,7 @@ gtk_notebook_motion_notify (GtkWidget      *widget,
           if (!priv->dnd_timer)
             {
               priv->has_scrolled = TRUE;
-              settings = gtk_widget_get_settings (GTK_WIDGET (notebook));
-              g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
-
-              priv->dnd_timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
+              priv->dnd_timer = gdk_threads_add_timeout (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
                                                scroll_notebook_timer,
                                                (gpointer) notebook);
             }
@@ -3700,9 +3699,7 @@ gtk_notebook_drag_motion (GtkWidget      *widget,
   GtkNotebookPrivate *priv = notebook->priv;
   GtkAllocation allocation;
   GdkRectangle position;
-  GtkSettings *settings;
   GtkNotebookArrow arrow;
-  guint timeout;
   GdkAtom target, tab_target;
   GList *tab;
   gboolean retval = FALSE;
@@ -3775,10 +3772,7 @@ gtk_notebook_drag_motion (GtkWidget      *widget,
 
       if (!priv->switch_tab_timer)
         {
-          settings = gtk_widget_get_settings (widget);
-
-          g_object_get (settings, "gtk-timeout-expand", &timeout, NULL);
-          priv->switch_tab_timer = gdk_threads_add_timeout (timeout,
+          priv->switch_tab_timer = gdk_threads_add_timeout (TIMEOUT_EXPAND,
                                                   gtk_notebook_switch_tab_timeout,
                                                   widget);
         }
@@ -4834,14 +4828,8 @@ gtk_notebook_timer (GtkNotebook *notebook)
 
       if (priv->need_timer)
         {
-          GtkSettings *settings;
-          guint        timeout;
-
-          settings = gtk_widget_get_settings (GTK_WIDGET (notebook));
-          g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
-
           priv->need_timer = FALSE;
-          priv->timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
+          priv->timer = gdk_threads_add_timeout (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
                                            (GSourceFunc) gtk_notebook_timer,
                                            (gpointer) notebook);
         }
@@ -4856,16 +4844,10 @@ static void
 gtk_notebook_set_scroll_timer (GtkNotebook *notebook)
 {
   GtkNotebookPrivate *priv = notebook->priv;
-  GtkWidget *widget = GTK_WIDGET (notebook);
 
   if (!priv->timer)
     {
-      GtkSettings *settings = gtk_widget_get_settings (widget);
-      guint timeout;
-
-      g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
-
-      priv->timer = gdk_threads_add_timeout (timeout,
+      priv->timer = gdk_threads_add_timeout (TIMEOUT_INITIAL,
                                        (GSourceFunc) gtk_notebook_timer,
                                        (gpointer) notebook);
       priv->need_timer = TRUE;
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 10767b9..e8d15b8 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -85,6 +85,8 @@ typedef enum {
 #define BUTTON_DATA(x) ((ButtonData *)(x))
 
 #define SCROLL_DELAY_FACTOR 5
+#define TIMEOUT_INITIAL     500
+#define TIMEOUT_REPEAT      50
 
 static guint path_bar_signals [LAST_SIGNAL] = { 0 };
 
@@ -1071,14 +1073,9 @@ gtk_path_bar_scroll_timeout (GtkPathBar *path_bar)
 
       if (path_bar->priv->need_timer) 
        {
-          GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (path_bar));
-          guint        timeout;
-
-          g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
-
          path_bar->priv->need_timer = FALSE;
 
-         path_bar->priv->timer = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
+         path_bar->priv->timer = gdk_threads_add_timeout (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
                                           (GSourceFunc)gtk_path_bar_scroll_timeout,
                                           path_bar);
        }
@@ -1181,13 +1178,8 @@ gtk_path_bar_slider_button_press (GtkWidget      *widget,
 
   if (!path_bar->priv->timer)
     {
-      GtkSettings *settings = gtk_widget_get_settings (widget);
-      guint        timeout;
-
-      g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
-
       path_bar->priv->need_timer = TRUE;
-      path_bar->priv->timer = gdk_threads_add_timeout (timeout,
+      path_bar->priv->timer = gdk_threads_add_timeout (TIMEOUT_INITIAL,
                                       (GSourceFunc)gtk_path_bar_scroll_timeout,
                                       path_bar);
     }
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 9ef4ff3..7bc95ca 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -60,6 +60,8 @@
 
 #define SCROLL_DELAY_FACTOR 5    /* Scroll repeat multiplier */
 #define UPDATE_DELAY        300  /* Delay for queued update */
+#define TIMEOUT_INITIAL     500
+#define TIMEOUT_REPEAT      50
 
 typedef struct _GtkRangeStepTimer GtkRangeStepTimer;
 
@@ -4068,13 +4070,8 @@ initial_timeout (gpointer data)
 {
   GtkRange *range = GTK_RANGE (data);
   GtkRangePrivate *priv = range->priv;
-  GtkSettings *settings;
-  guint        timeout;
 
-  settings = gtk_widget_get_settings (GTK_WIDGET (data));
-  g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
-
-  priv->timer->timeout_id = gdk_threads_add_timeout (timeout * SCROLL_DELAY_FACTOR,
+  priv->timer->timeout_id = gdk_threads_add_timeout (TIMEOUT_REPEAT * SCROLL_DELAY_FACTOR,
                                                      second_timeout,
                                                      range);
   /* remove self */
@@ -4086,18 +4083,13 @@ gtk_range_add_step_timer (GtkRange      *range,
                           GtkScrollType  step)
 {
   GtkRangePrivate *priv = range->priv;
-  GtkSettings *settings;
-  guint        timeout;
 
   g_return_if_fail (priv->timer == NULL);
   g_return_if_fail (step != GTK_SCROLL_NONE);
 
-  settings = gtk_widget_get_settings (GTK_WIDGET (range));
-  g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
-
   priv->timer = g_new (GtkRangeStepTimer, 1);
 
-  priv->timer->timeout_id = gdk_threads_add_timeout (timeout,
+  priv->timer->timeout_id = gdk_threads_add_timeout (TIMEOUT_INITIAL,
                                                      initial_timeout,
                                                      range);
   priv->timer->step = step;
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 2c84ba3..e5d31c4 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -98,8 +98,8 @@
  */
 
 
-#define DEFAULT_TIMEOUT_INITIAL 200
-#define DEFAULT_TIMEOUT_REPEAT   20
+#define DEFAULT_TIMEOUT_INITIAL 500
+#define DEFAULT_TIMEOUT_REPEAT   50
 #define DEFAULT_TIMEOUT_EXPAND  500
 
 typedef struct _GtkSettingsPropertyValue GtkSettingsPropertyValue;
@@ -664,22 +664,32 @@ gtk_settings_class_init (GtkSettingsClass *class)
                                              NULL);
   g_assert (result == PROP_SHOW_UNICODE_MENU);
 
+  /**
+   * GtkSettings:gtk-timeout-initial:
+   *
+   * Deprecated: 3.10: This setting is ignored.
+   */
   result = settings_install_property_parser (class,
                                              g_param_spec_int ("gtk-timeout-initial",
                                                                P_("Start timeout"),
                                                                P_("Starting value for timeouts, when button 
is pressed"),
                                                                0, G_MAXINT, DEFAULT_TIMEOUT_INITIAL,
-                                                               GTK_PARAM_READWRITE),
+                                                               GTK_PARAM_READWRITE | G_PARAM_DEPRECATED),
                                              NULL);
 
   g_assert (result == PROP_TIMEOUT_INITIAL);
 
+  /**
+   * GtkSettings:gtk-timeout-repeat:
+   *
+   * Deprecated: 3.10: This setting is ignored.
+   */
   result = settings_install_property_parser (class,
                                              g_param_spec_int ("gtk-timeout-repeat",
                                                                P_("Repeat timeout"),
                                                                P_("Repeat value for timeouts, when button is 
pressed"),
                                                                0, G_MAXINT, DEFAULT_TIMEOUT_REPEAT,
-                                                               GTK_PARAM_READWRITE),
+                                                               GTK_PARAM_READWRITE | G_PARAM_DEPRECATED),
                                              NULL);
 
   g_assert (result == PROP_TIMEOUT_REPEAT);
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 7af3c48..13d29d4 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -58,7 +58,8 @@
 #define EPSILON               1e-10
 #define MAX_DIGITS            20
 #define MIN_ARROW_WIDTH       6
-
+#define TIMEOUT_INITIAL       500
+#define TIMEOUT_REPEAT        50
 
 /**
  * SECTION:gtkspinbutton
@@ -1459,14 +1460,9 @@ start_spinning (GtkSpinButton *spin,
 
   if (!priv->timer)
     {
-      GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (spin));
-      guint        timeout;
-
-      g_object_get (settings, "gtk-timeout-initial", &timeout, NULL);
-
       priv->timer_step = step;
       priv->need_timer = TRUE;
-      priv->timer = gdk_threads_add_timeout (timeout,
+      priv->timer = gdk_threads_add_timeout (TIMEOUT_INITIAL,
                                    (GSourceFunc) gtk_spin_button_timer,
                                    (gpointer) spin);
     }
@@ -1590,13 +1586,8 @@ gtk_spin_button_timer (GtkSpinButton *spin_button)
 
       if (priv->need_timer)
         {
-          GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (spin_button));
-          guint        timeout;
-
-          g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
-
           priv->need_timer = FALSE;
-          priv->timer = gdk_threads_add_timeout (timeout,
+          priv->timer = gdk_threads_add_timeout (TIMEOUT_REPEAT,
                                               (GSourceFunc) gtk_spin_button_timer,
                                               (gpointer) spin_button);
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]