[gtk/gbsneto/filechooser-column-view: 19/47] filesystemmodel: Don't expose cache




commit 61d605b3295b62ef115b84bcb850f618c7988ab0
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Oct 8 10:12:41 2022 -0300

    filesystemmodel: Don't expose cache
    
    With this commit we start slowly cleaning up the sattelite code
    surrounding GtkFileChooserWidget, so that we eventually drop it
    all.

 gtk/gtkfilechooserwidget.c | 17 ---------------
 gtk/gtkfilesystemmodel.c   | 53 ----------------------------------------------
 gtk/gtkfilesystemmodel.h   |  2 --
 3 files changed, 72 deletions(-)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 8aea423d33..c1695ece1e 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -515,8 +515,6 @@ static void     recent_start_loading         (GtkFileChooserWidget *impl);
 static void     recent_clear_model           (GtkFileChooserWidget *impl,
                                               gboolean               remove_from_treeview);
 static gboolean recent_should_respond        (GtkFileChooserWidget *impl);
-static void     clear_model_cache            (GtkFileChooserWidget *impl,
-                                              int                   column);
 static void     set_model_filter             (GtkFileChooserWidget *impl,
                                               GtkFileFilter        *filter);
 static void     switch_to_home_dir           (GtkFileChooserWidget *impl);
@@ -1523,20 +1521,6 @@ change_sort_directories_first_state (GSimpleAction *action,
                                         impl->sort_order);
 }
 
-static void
-clear_model_cache (GtkFileChooserWidget *impl,
-                   int                   column)
-{
-  if (impl->browse_files_model)
-    _gtk_file_system_model_clear_cache (impl->browse_files_model, column);
-
-  if (impl->search_model)
-    _gtk_file_system_model_clear_cache (impl->search_model, column);
-
-  if (impl->recent_model)
-    _gtk_file_system_model_clear_cache (impl->recent_model, column);
-}
-
 static void
 set_model_filter (GtkFileChooserWidget *impl,
                   GtkFileFilter        *filter)
@@ -6737,7 +6721,6 @@ set_current_filter (GtkFileChooserWidget *impl,
 
       gtk_drop_down_set_selected (GTK_DROP_DOWN (impl->filter_combo), filter_index);
 
-      clear_model_cache (impl, MODEL_COL_IS_SENSITIVE);
       set_model_filter (impl, impl->current_filter);
       g_object_notify (G_OBJECT (impl), "filter");
     }
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index 35325cb83f..1c9b76f27b 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -2156,59 +2156,6 @@ thaw_updates (GtkFileSystemModel *model)
     }
 }
 
-/**
- * _gtk_file_system_model_clear_cache:
- * @model: a `GtkFileSystemModel`
- * @column: the column to clear or -1 for all columns
- *
- * Clears the cached values in the model for the given @column. Use 
- * this function whenever your get_value function would return different
- * values for a column.
- * The file chooser uses this for example when the icon theme changes to 
- * invalidate the cached pixbufs.
- **/
-void
-_gtk_file_system_model_clear_cache (GtkFileSystemModel *model,
-                                    int                 column)
-{
-  guint i;
-  int start, end;
-  gboolean changed;
-
-  g_return_if_fail (GTK_IS_FILE_SYSTEM_MODEL (model));
-  g_return_if_fail (column >= -1 && (guint) column < model->n_columns);
-
-  if (column > -1)
-    {
-      start = column;
-      end = column + 1;
-    }
-  else
-    {
-      start = 0;
-      end = model->n_columns;
-    }
-
-  for (i = 0; i < model->files->len; i++)
-    {
-      FileModelNode *node = get_node (model, i);
-      changed = FALSE;
-      for (column = start; column < end; column++)
-        {
-          if (!G_VALUE_TYPE (&node->values[column]))
-            continue;
-          
-          g_value_unset (&node->values[column]);
-          changed = TRUE;
-        }
-
-      if (changed && node->visible)
-       emit_row_changed_for_node (model, i);
-    }
-
-  /* FIXME: resort? */
-}
-
 /**
  * _gtk_file_system_model_add_and_query_file:
  * @model: a `GtkFileSystemModel`
diff --git a/gtk/gtkfilesystemmodel.h b/gtk/gtkfilesystemmodel.h
index 475c8bb6ec..a69992c24a 100644
--- a/gtk/gtkfilesystemmodel.h
+++ b/gtk/gtkfilesystemmodel.h
@@ -96,8 +96,6 @@ void                _gtk_file_system_model_set_show_files   (GtkFileSystemModel
                                                             gboolean            show_files);
 void                _gtk_file_system_model_set_filter_folders (GtkFileSystemModel *model,
                                                             gboolean            show_folders);
-void                _gtk_file_system_model_clear_cache      (GtkFileSystemModel *model,
-                                                             int                 column);
 
 void                _gtk_file_system_model_set_filter       (GtkFileSystemModel *model,
                                                              GtkFileFilter      *filter);


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