mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
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.
This commit is contained in:
parent
d0a2e06c7d
commit
6218fb45be
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user