[gtk/gbsneto/filechooser-column-view: 101/105] filesystemmodel: Drop _gtk_file_system_model_get_value
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gbsneto/filechooser-column-view: 101/105] filesystemmodel: Drop _gtk_file_system_model_get_value
- Date: Wed, 12 Oct 2022 20:42:38 +0000 (UTC)
commit 8904195501db3bf3a8d63275cb093dcf238c59b1
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 12 00:34:18 2022 -0400
filesystemmodel: Drop _gtk_file_system_model_get_value
This function is unused, so drop it, and its callback.
gtk/gtkfilechooserwidget.c | 83 ++++------------------------------------------
gtk/gtkfilesystemmodel.c | 49 ---------------------------
gtk/gtkfilesystemmodel.h | 3 --
3 files changed, 6 insertions(+), 129 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index e7b6f39b49..f6043aa98a 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -3981,77 +3981,6 @@ end:
return g_strdup ("");
}
-static gboolean
-file_system_model_set (GtkFileSystemModel *model,
- GFile *file,
- GFileInfo *info,
- int column,
- GValue *value,
- gpointer data)
-{
- GtkFileChooserWidget *impl = data;
-
- switch (column)
- {
- case MODEL_COL_FILE:
- g_value_set_object (value, file);
- break;
- case MODEL_COL_NAME:
- if (info == NULL)
- g_value_set_string (value, DEFAULT_NEW_FOLDER_NAME);
- else
- g_value_set_string (value, g_file_info_get_display_name (info));
- break;
- case MODEL_COL_NAME_COLLATED:
- if (info == NULL)
- g_value_take_string (value, g_utf8_collate_key_for_filename (DEFAULT_NEW_FOLDER_NAME, -1));
- else
- g_value_take_string (value, g_utf8_collate_key_for_filename (g_file_info_get_display_name (info),
-1));
- break;
- case MODEL_COL_IS_FOLDER:
- g_value_set_boolean (value, info == NULL || _gtk_file_info_consider_as_directory (info));
- break;
- case MODEL_COL_IS_SENSITIVE:
- if (info)
- {
- gboolean sensitive = TRUE;
-
- if (impl->action != GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
- {
- sensitive = TRUE; /* for file modes... */
- }
- else if (!_gtk_file_info_consider_as_directory (info))
- {
- sensitive = FALSE; /* for folder modes, files are not sensitive... */
- }
- else
- {
- /* ... and for folder modes, folders are sensitive only if the filter says so */
- GtkTreeIter iter;
- if (!_gtk_file_system_model_get_iter_for_file (model, &iter, file))
- g_assert_not_reached ();
- sensitive = !_gtk_file_system_model_iter_is_filtered_out (model, &iter);
- }
-
- g_value_set_boolean (value, sensitive);
- }
- else
- g_value_set_boolean (value, TRUE);
- break;
- case MODEL_COL_SIZE:
- g_value_set_int64 (value, info ? g_file_info_get_size (info) : 0);
- break;
- case MODEL_COL_ELLIPSIZE:
- g_value_set_enum (value, info ? PANGO_ELLIPSIZE_END : PANGO_ELLIPSIZE_NONE);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- return TRUE;
-}
-
/* Gets rid of the old list model and creates a new one for the current folder */
static gboolean
set_list_model (GtkFileChooserWidget *impl,
@@ -4070,8 +3999,8 @@ set_list_model (GtkFileChooserWidget *impl,
impl->browse_files_model =
_gtk_file_system_model_new_for_directory (impl->current_folder,
MODEL_ATTRIBUTES,
- file_system_model_set,
- impl,
+ NULL,
+ NULL,
MODEL_COLUMN_TYPES);
_gtk_file_system_model_set_show_hidden (impl->browse_files_model, impl->show_hidden);
@@ -5941,8 +5870,8 @@ search_setup_model (GtkFileChooserWidget *impl)
{
g_assert (impl->search_model == NULL);
- impl->search_model = _gtk_file_system_model_new (file_system_model_set,
- impl,
+ impl->search_model = _gtk_file_system_model_new (NULL,
+ NULL,
MODEL_COLUMN_TYPES);
set_current_model (impl, G_LIST_MODEL (impl->search_model));
@@ -6107,8 +6036,8 @@ recent_start_loading (GtkFileChooserWidget *impl)
/* Setup recent model */
g_assert (impl->recent_model == NULL);
- impl->recent_model = _gtk_file_system_model_new (file_system_model_set,
- impl,
+ impl->recent_model = _gtk_file_system_model_new (NULL,
+ NULL,
MODEL_COLUMN_TYPES);
_gtk_file_system_model_set_filter (impl->recent_model, impl->current_filter);
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index d937f23f29..c85420aa40 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -797,7 +797,6 @@ _gtk_file_system_model_new (GtkFileSystemModelGetValue get_func,
GtkFileSystemModel *model;
va_list args;
- g_return_val_if_fail (get_func != NULL, NULL);
g_return_val_if_fail (n_columns > 0, NULL);
va_start (args, n_columns);
@@ -838,7 +837,6 @@ _gtk_file_system_model_new_for_directory (GFile * dir,
va_list args;
g_return_val_if_fail (G_IS_FILE (dir), NULL);
- g_return_val_if_fail (get_func != NULL, NULL);
g_return_val_if_fail (n_columns > 0, NULL);
va_start (args, n_columns);
@@ -1087,53 +1085,6 @@ _gtk_file_system_model_get_file (GtkFileSystemModel *model,
return node->file;
}
-/**
- * _gtk_file_system_model_get_value:
- * @model: a `GtkFileSystemModel`
- * @iter: a `GtkTreeIter` pointing to a row of @model
- * @column: the column to get the value for
- *
- * Gets the value associated with the given row @iter and @column.
- * If no value is available yet and the default value should be used,
- * %NULL is returned.
- * This is a performance optimization for the calls
- * gtk_tree_model_get() or gtk_tree_model_get_value(), which copy
- * the value and spend a considerable amount of time in iterator
- * lookups. Both of which are slow.
- *
- * Returns: a pointer to the actual value as stored in @model or %NULL
- * if no value available yet
- */
-const GValue *
-_gtk_file_system_model_get_value (GtkFileSystemModel *model,
- GtkTreeIter * iter,
- int column)
-{
- FileModelNode *node;
-
- g_return_val_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model), NULL);
- g_return_val_if_fail (column >= 0 && (guint) column < model->n_columns, NULL);
-
- node = get_node (model, ITER_INDEX (iter));
-
- if (!G_VALUE_TYPE (&node->values[column]))
- {
- g_value_init (&node->values[column], model->column_types[column]);
- if (!model->get_func (model,
- node->file,
- node->info,
- column,
- &node->values[column],
- model->get_data))
- {
- g_value_unset (&node->values[column]);
- return NULL;
- }
- }
-
- return &node->values[column];
-}
-
static guint
node_get_for_file (GtkFileSystemModel *model,
GFile * file)
diff --git a/gtk/gtkfilesystemmodel.h b/gtk/gtkfilesystemmodel.h
index d107a659e5..ac4de68d7f 100644
--- a/gtk/gtkfilesystemmodel.h
+++ b/gtk/gtkfilesystemmodel.h
@@ -65,9 +65,6 @@ GFileInfo * _gtk_file_system_model_get_info_for_file(GtkFileSystemModel
GFile *file);
GFile * _gtk_file_system_model_get_file (GtkFileSystemModel *model,
GtkTreeIter *iter);
-const GValue * _gtk_file_system_model_get_value (GtkFileSystemModel *model,
- GtkTreeIter * iter,
- int column);
void _gtk_file_system_model_add_and_query_file (GtkFileSystemModel *model,
GFile *file,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]