mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 04:10:13 +00:00
filechooserwidget: Inline come functions into only callers
Similar to the previous commit(s), make it clearer what this function does.
This commit is contained in:
parent
ae75d4b565
commit
4766b475d0
@ -7480,26 +7480,6 @@ recent_clear_model (GtkFileChooserWidget *impl,
|
||||
g_set_object (&priv->recent_model, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
recent_setup_model (GtkFileChooserWidget *impl)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
|
||||
|
||||
g_assert (priv->recent_model == NULL);
|
||||
|
||||
priv->recent_model = _gtk_file_system_model_new (file_system_model_set,
|
||||
impl,
|
||||
MODEL_COLUMN_TYPES);
|
||||
|
||||
_gtk_file_system_model_set_filter (priv->recent_model, priv->current_filter);
|
||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (priv->recent_model),
|
||||
recent_sort_func,
|
||||
impl, NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->recent_model),
|
||||
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
|
||||
GTK_SORT_DESCENDING);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
recent_item_is_private (GtkRecentInfo *info)
|
||||
{
|
||||
@ -7517,19 +7497,42 @@ recent_item_is_private (GtkRecentInfo *info)
|
||||
return is_private;
|
||||
}
|
||||
|
||||
/* Populates the file system model with the GtkRecentInfo* items
|
||||
* in the provided list; frees the items
|
||||
*/
|
||||
static void
|
||||
populate_model_with_recent_items (GtkFileChooserWidget *impl,
|
||||
GList *items)
|
||||
recent_start_loading (GtkFileChooserWidget *impl)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
|
||||
gint limit;
|
||||
GList *l;
|
||||
gint n;
|
||||
GList *items;
|
||||
|
||||
limit = DEFAULT_RECENT_FILES_LIMIT;
|
||||
recent_clear_model (impl, TRUE);
|
||||
|
||||
/* Setup recent model */
|
||||
g_assert (priv->recent_model == NULL);
|
||||
|
||||
priv->recent_model = _gtk_file_system_model_new (file_system_model_set,
|
||||
impl,
|
||||
MODEL_COLUMN_TYPES);
|
||||
|
||||
_gtk_file_system_model_set_filter (priv->recent_model, priv->current_filter);
|
||||
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (priv->recent_model),
|
||||
recent_sort_func,
|
||||
impl, NULL);
|
||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->recent_model),
|
||||
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
|
||||
GTK_SORT_DESCENDING);
|
||||
|
||||
|
||||
if (!priv->recent_manager)
|
||||
return;
|
||||
|
||||
items = gtk_recent_manager_get_items (priv->recent_manager);
|
||||
if (!items)
|
||||
return;
|
||||
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)
|
||||
{
|
||||
const int limit = DEFAULT_RECENT_FILES_LIMIT;
|
||||
GList *l;
|
||||
int n;
|
||||
|
||||
n = 0;
|
||||
|
||||
@ -7553,13 +7556,9 @@ populate_model_with_recent_items (GtkFileChooserWidget *impl,
|
||||
}
|
||||
|
||||
g_set_object (&priv->model_for_search, priv->recent_model);
|
||||
}
|
||||
|
||||
static void
|
||||
populate_model_with_folders (GtkFileChooserWidget *impl,
|
||||
GList *items)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
|
||||
}
|
||||
else
|
||||
{
|
||||
GList *folders;
|
||||
GList *l;
|
||||
|
||||
@ -7571,28 +7570,7 @@ populate_model_with_folders (GtkFileChooserWidget *impl,
|
||||
MODEL_ATTRIBUTES);
|
||||
|
||||
g_list_free_full (folders, g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
recent_start_loading (GtkFileChooserWidget *impl)
|
||||
{
|
||||
GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (impl);
|
||||
GList *items;
|
||||
|
||||
recent_clear_model (impl, TRUE);
|
||||
recent_setup_model (impl);
|
||||
|
||||
if (!priv->recent_manager)
|
||||
return;
|
||||
|
||||
items = gtk_recent_manager_get_items (priv->recent_manager);
|
||||
if (!items)
|
||||
return;
|
||||
|
||||
if (priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)
|
||||
populate_model_with_recent_items (impl, items);
|
||||
else
|
||||
populate_model_with_folders (impl, items);
|
||||
}
|
||||
|
||||
g_list_free_full (items, (GDestroyNotify) gtk_recent_info_unref);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user