[gtk+] Deprecate and hardcode gtk-recent-files-limit



commit 6218fb45be163fad06cf9dc6d80f278a6213b60b
Author: William Jon McCann <william jon mccann gmail com>
Date:   Mon Jul 8 16:42:44 2013 -0400

    Deprecate and hardcode gtk-recent-files-limit
    
    The GtkRecentChooser already has a property that can be used
    to set this on a per widget basis and the recent manager already
    has a max-age limit.

 gtk/gtkfilechooserdefault.c   |   20 +++-----------------
 gtk/gtkrecentchooser.c        |    7 ++-----
 gtk/gtkrecentchooserdefault.c |   21 +++------------------
 gtk/gtksettings.c             |    4 +++-
 4 files changed, 11 insertions(+), 41 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 33b5178..2a957c5 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -392,6 +392,8 @@ enum {
   GTK_TREE_MODEL_ROW,
 };
 
+#define DEFAULT_RECENT_FILES_LIMIT 50
+
 /* Icon size for if we can't get it from the theme */
 #define FALLBACK_ICON_SIZE 16
 
@@ -6635,22 +6637,6 @@ recent_idle_cleanup (gpointer data)
   g_free (load_data);
 }
 
-static gint
-get_recent_files_limit (GtkWidget *widget)
-{
-  GtkSettings *settings;
-  gint limit;
-
-  if (gtk_widget_has_screen (widget))
-    settings = gtk_settings_get_for_screen (gtk_widget_get_screen (widget));
-  else
-    settings = gtk_settings_get_default ();
-
-  g_object_get (G_OBJECT (settings), "gtk-recent-files-limit", &limit, NULL);
-
-  return limit;
-}
-
 /* Populates the file system model with the GtkRecentInfo* items in the provided list; frees the items */
 static void
 populate_model_with_recent_items (GtkFileChooserDefault *impl, GList *items)
@@ -6660,7 +6646,7 @@ populate_model_with_recent_items (GtkFileChooserDefault *impl, GList *items)
   GList *l;
   int n;
 
-  limit = get_recent_files_limit (GTK_WIDGET (impl));
+  limit = DEFAULT_RECENT_FILES_LIMIT;
 
   n = 0;
 
diff --git a/gtk/gtkrecentchooser.c b/gtk/gtkrecentchooser.c
index c5e151f..32f409d 100644
--- a/gtk/gtkrecentchooser.c
+++ b/gtk/gtkrecentchooser.c
@@ -220,10 +220,7 @@ gtk_recent_chooser_default_init (GtkRecentChooserInterface *iface)
    * GtkRecentChooser:limit:
    *
    * The maximum number of recently used resources to be displayed,
-   * or -1 to display all items. By default, the
-   * GtkSetting:gtk-recent-files-limit setting is respected: you can
-   * override that limit on a particular instance of #GtkRecentChooser
-   * by setting this property.
+   * or -1 to display all items.
    *
    * Since: 2.10
    */
@@ -233,7 +230,7 @@ gtk_recent_chooser_default_init (GtkRecentChooserInterface *iface)
                                                         P_("The maximum number of items to be displayed"),
                                                         -1,
                                                         G_MAXINT,
-                                                        -1,
+                                                        50,
                                                         GTK_PARAM_READWRITE));
   /**
    * GtkRecentChooser:sort-type:
diff --git a/gtk/gtkrecentchooserdefault.c b/gtk/gtkrecentchooserdefault.c
index c1d15d2..85a5bcd 100644
--- a/gtk/gtkrecentchooserdefault.c
+++ b/gtk/gtkrecentchooserdefault.c
@@ -167,6 +167,8 @@ enum {
 #define NUM_CHARS 40
 #define NUM_LINES 9
 
+#define DEFAULT_RECENT_FILES_LIMIT 50
+
 
 
 /* GObject */
@@ -218,7 +220,6 @@ static void set_current_filter        (GtkRecentChooserDefault *impl,
 static GtkIconTheme *get_icon_theme_for_widget (GtkWidget   *widget);
 static gint          get_icon_size_for_widget  (GtkWidget   *widget,
                                                GtkIconSize  icon_size);
-static gint          get_recent_files_limit    (GtkWidget   *widget);
 
 static void reload_recent_items (GtkRecentChooserDefault *impl);
 static void chooser_set_model   (GtkRecentChooserDefault *impl);
@@ -824,7 +825,7 @@ reload_recent_items (GtkRecentChooserDefault *impl)
                                              GTK_ICON_SIZE_BUTTON);
 
   if (!impl->priv->limit_set)
-    impl->priv->limit = get_recent_files_limit (widget);
+    impl->priv->limit = DEFAULT_RECENT_FILES_LIMIT;
 
   set_busy_cursor (impl, TRUE);
 
@@ -1333,22 +1334,6 @@ get_icon_size_for_widget (GtkWidget   *widget,
   return FALLBACK_ICON_SIZE;
 }
 
-static gint
-get_recent_files_limit (GtkWidget *widget)
-{
-  GtkSettings *settings;
-  gint limit;
-
-  if (gtk_widget_has_screen (widget))
-    settings = gtk_settings_get_for_screen (gtk_widget_get_screen (widget));
-  else
-    settings = gtk_settings_get_default ();
-  
-  g_object_get (G_OBJECT (settings), "gtk-recent-files-limit", &limit, NULL);
-
-  return limit;
-}
-
 static void
 recent_manager_changed_cb (GtkRecentManager *manager,
                           gpointer          user_data)
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 4627926..2c84ba3 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -1022,6 +1022,8 @@ gtk_settings_class_init (GtkSettingsClass *class)
    * -1 means every recently used file stored.
    *
    * Since: 2.12
+   *
+   * Deprecated: 3.10: This setting is ignored
    */
   result = settings_install_property_parser (class,
                                              g_param_spec_int ("gtk-recent-files-limit",
@@ -1029,7 +1031,7 @@ gtk_settings_class_init (GtkSettingsClass *class)
                                                                P_("Number of recently used files"),
                                                                -1, G_MAXINT,
                                                                50,
-                                                               GTK_PARAM_READWRITE),
+                                                               GTK_PARAM_READWRITE | G_PARAM_DEPRECATED),
                                              NULL);
   g_assert (result == PROP_RECENT_FILES_LIMIT);
 


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