Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d666cf3f03 | |||
| 3ebf5c3689 | |||
| d5175e2f26 | |||
| 5ce6b4c104 | |||
| b1f87233c2 | |||
| 1f16f4e43c | |||
| f830c3bac3 | |||
| 2413f8bf13 | |||
| 37de695130 |
8 changed files with 1893 additions and 388 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -234,6 +234,17 @@ struct _GtkFileChooserDefault
|
|||
guint icon_view_scale_visible_timeout_id;
|
||||
guint icon_view_scale_after_layout_id;
|
||||
gint pending_icon_view_icon_size;
|
||||
|
||||
/* Cached index range of the rows shown in the current view. Computing
|
||||
* it is O(n) for GtkIconView, so it must not be done per cell. */
|
||||
gint visible_range_first;
|
||||
gint visible_range_last;
|
||||
guint visible_range_valid : 1;
|
||||
|
||||
/* Icon/thumbnail queries for visible rows (see icon_request_add) */
|
||||
GQueue *icon_requests; /* waiting, newest first */
|
||||
GList *icon_requests_running;
|
||||
guint icon_requests_prune_id;
|
||||
gint icon_view_scale_visible_overscan;
|
||||
ViewMode view_mode;
|
||||
|
||||
|
|
@ -259,6 +270,7 @@ struct _GtkFileChooserDefault
|
|||
GCancellable *file_exists_get_info_cancellable;
|
||||
GCancellable *update_from_entry_cancellable;
|
||||
GCancellable *shortcuts_activate_iter_cancellable;
|
||||
GCancellable *shortcuts_current_folder_cancellable;
|
||||
|
||||
LoadState load_state;
|
||||
ReloadState reload_state;
|
||||
|
|
|
|||
|
|
@ -1077,6 +1077,19 @@ _gtk_file_system_set_bookmark_label (GtkFileSystem *file_system,
|
|||
g_signal_emit_by_name (file_system, "bookmarks-changed", 0);
|
||||
}
|
||||
|
||||
GtkFileSystemVolume *
|
||||
_gtk_file_system_volume_for_mount (GFile *file,
|
||||
GMount *mount)
|
||||
{
|
||||
if (!mount && g_file_is_native (file))
|
||||
return (GtkFileSystemVolume *) root_volume_token;
|
||||
|
||||
return (GtkFileSystemVolume *) mount;
|
||||
}
|
||||
|
||||
/* Note: this blocks (it stats @file and its parents); prefer
|
||||
* g_file_find_enclosing_mount_async() plus _gtk_file_system_volume_for_mount()
|
||||
* in code that runs on the main thread. */
|
||||
GtkFileSystemVolume *
|
||||
_gtk_file_system_get_volume_for_file (GtkFileSystem *file_system,
|
||||
GFile *file)
|
||||
|
|
@ -1626,18 +1639,105 @@ file_icon_cache_key_free (FileIconCacheKey *key)
|
|||
g_slice_free (FileIconCacheKey, key);
|
||||
}
|
||||
|
||||
static void
|
||||
file_icon_cache_theme_changed_cb (GtkIconTheme *icon_theme,
|
||||
GHashTable *cache)
|
||||
/* The cache is bounded (least recently used entries go first) so zooming
|
||||
* through many icon sizes does not keep every rendered size alive. */
|
||||
#define FILE_ICON_CACHE_MAX_ENTRIES 64
|
||||
#define FILE_ICON_CACHE_MAX_BYTES (4 * 1024 * 1024)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
g_hash_table_remove_all (cache);
|
||||
GHashTable *table; /* FileIconCacheKey -> FileIconCacheEntry */
|
||||
GQueue lru; /* keys, most recently used first */
|
||||
gsize bytes;
|
||||
} FileIconCache;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GList *link; /* in FileIconCache.lru */
|
||||
gsize bytes;
|
||||
} FileIconCacheEntry;
|
||||
|
||||
static void
|
||||
file_icon_cache_entry_free (FileIconCacheEntry *entry)
|
||||
{
|
||||
g_object_unref (entry->pixbuf);
|
||||
g_slice_free (FileIconCacheEntry, entry);
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
static void
|
||||
file_icon_cache_free (FileIconCache *cache)
|
||||
{
|
||||
g_queue_clear (&cache->lru);
|
||||
g_hash_table_destroy (cache->table);
|
||||
g_slice_free (FileIconCache, cache);
|
||||
}
|
||||
|
||||
static void
|
||||
file_icon_cache_theme_changed_cb (GtkIconTheme *icon_theme,
|
||||
FileIconCache *cache)
|
||||
{
|
||||
g_queue_clear (&cache->lru);
|
||||
g_hash_table_remove_all (cache->table);
|
||||
cache->bytes = 0;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
file_icon_cache_lookup (FileIconCache *cache,
|
||||
const FileIconCacheKey *key)
|
||||
{
|
||||
FileIconCacheEntry *entry = g_hash_table_lookup (cache->table, key);
|
||||
|
||||
if (entry == NULL)
|
||||
return NULL;
|
||||
|
||||
/* Mark as most recently used. */
|
||||
g_queue_unlink (&cache->lru, entry->link);
|
||||
g_queue_push_head_link (&cache->lru, entry->link);
|
||||
|
||||
return entry->pixbuf;
|
||||
}
|
||||
|
||||
static void
|
||||
file_icon_cache_insert (FileIconCache *cache,
|
||||
FileIconCacheKey *key,
|
||||
GdkPixbuf *pixbuf)
|
||||
{
|
||||
FileIconCacheEntry *entry;
|
||||
|
||||
/* g_hash_table_insert() would free @key and keep the old one, leaving a
|
||||
* dangling pointer in the LRU queue; keep the existing entry instead. */
|
||||
if (g_hash_table_lookup (cache->table, key) != NULL)
|
||||
{
|
||||
file_icon_cache_key_free (key);
|
||||
return;
|
||||
}
|
||||
|
||||
entry = g_slice_new (FileIconCacheEntry);
|
||||
entry->pixbuf = g_object_ref (pixbuf);
|
||||
entry->bytes = (gsize) gdk_pixbuf_get_rowstride (pixbuf) * gdk_pixbuf_get_height (pixbuf);
|
||||
g_queue_push_head (&cache->lru, key);
|
||||
entry->link = cache->lru.head;
|
||||
g_hash_table_insert (cache->table, key, entry);
|
||||
cache->bytes += entry->bytes;
|
||||
|
||||
while (cache->lru.length > 1 &&
|
||||
(cache->lru.length > FILE_ICON_CACHE_MAX_ENTRIES ||
|
||||
cache->bytes > FILE_ICON_CACHE_MAX_BYTES))
|
||||
{
|
||||
FileIconCacheKey *old_key = g_queue_pop_tail (&cache->lru);
|
||||
FileIconCacheEntry *old = g_hash_table_lookup (cache->table, old_key);
|
||||
|
||||
cache->bytes -= old->bytes;
|
||||
g_hash_table_remove (cache->table, old_key);
|
||||
}
|
||||
}
|
||||
|
||||
static FileIconCache *
|
||||
file_icon_cache_get_for_icon_theme (GtkIconTheme *icon_theme)
|
||||
{
|
||||
static GQuark quark_file_icon_cache = 0;
|
||||
GHashTable *cache;
|
||||
FileIconCache *cache;
|
||||
|
||||
if (G_UNLIKELY (quark_file_icon_cache == 0))
|
||||
quark_file_icon_cache = g_quark_from_static_string ("gtk-file-icon-cache");
|
||||
|
|
@ -1645,14 +1745,16 @@ file_icon_cache_get_for_icon_theme (GtkIconTheme *icon_theme)
|
|||
cache = g_object_get_qdata (G_OBJECT (icon_theme), quark_file_icon_cache);
|
||||
if (!cache)
|
||||
{
|
||||
cache = g_hash_table_new_full (file_icon_cache_key_hash,
|
||||
file_icon_cache_key_equal,
|
||||
(GDestroyNotify) file_icon_cache_key_free,
|
||||
g_object_unref);
|
||||
cache = g_slice_new0 (FileIconCache);
|
||||
cache->table = g_hash_table_new_full (file_icon_cache_key_hash,
|
||||
file_icon_cache_key_equal,
|
||||
(GDestroyNotify) file_icon_cache_key_free,
|
||||
(GDestroyNotify) file_icon_cache_entry_free);
|
||||
g_queue_init (&cache->lru);
|
||||
g_object_set_qdata_full (G_OBJECT (icon_theme),
|
||||
quark_file_icon_cache,
|
||||
cache,
|
||||
(GDestroyNotify) g_hash_table_destroy);
|
||||
(GDestroyNotify) file_icon_cache_free);
|
||||
|
||||
g_signal_connect (icon_theme, "changed",
|
||||
G_CALLBACK (file_icon_cache_theme_changed_cb),
|
||||
|
|
@ -1671,7 +1773,7 @@ get_pixbuf_from_gicon (GIcon *icon,
|
|||
GdkScreen *screen;
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkIconInfo *icon_info;
|
||||
GHashTable *cache;
|
||||
FileIconCache *cache;
|
||||
FileIconCacheKey lookup_key;
|
||||
FileIconCacheKey *cache_key;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
|
@ -1695,7 +1797,7 @@ get_pixbuf_from_gicon (GIcon *icon,
|
|||
lookup_key.icon = icon;
|
||||
lookup_key.icon_size = icon_size;
|
||||
|
||||
pixbuf = g_hash_table_lookup (cache, &lookup_key);
|
||||
pixbuf = file_icon_cache_lookup (cache, &lookup_key);
|
||||
if (pixbuf)
|
||||
return g_object_ref (pixbuf);
|
||||
}
|
||||
|
|
@ -1721,7 +1823,7 @@ get_pixbuf_from_gicon (GIcon *icon,
|
|||
if (cache)
|
||||
{
|
||||
cache_key = file_icon_cache_key_new (screen, icon, icon_size);
|
||||
g_hash_table_insert (cache, cache_key, g_object_ref (pixbuf));
|
||||
file_icon_cache_insert (cache, cache_key, pixbuf);
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
|
|
|
|||
|
|
@ -130,6 +130,11 @@ void _gtk_file_system_set_bookmark_label (GtkFileSystem *file_system,
|
|||
GFile *file,
|
||||
const gchar *label);
|
||||
|
||||
/* Turns the result of g_file_find_enclosing_mount{,_async}() for @file into
|
||||
* the volume _gtk_file_system_get_volume_for_file() would return. Takes
|
||||
* ownership of @mount. */
|
||||
GtkFileSystemVolume * _gtk_file_system_volume_for_mount (GFile *file,
|
||||
GMount *mount);
|
||||
GtkFileSystemVolume * _gtk_file_system_get_volume_for_file (GtkFileSystem *file_system,
|
||||
GFile *file);
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -53,6 +53,8 @@ GtkFileSystemModel *_gtk_file_system_model_new_for_directory(GFile *
|
|||
guint n_columns,
|
||||
...);
|
||||
GCancellable * _gtk_file_system_model_get_cancellable (GtkFileSystemModel *model);
|
||||
void _gtk_file_system_model_set_incremental (GtkFileSystemModel *model,
|
||||
gboolean incremental);
|
||||
gboolean _gtk_file_system_model_iter_is_visible (GtkFileSystemModel *model,
|
||||
GtkTreeIter *iter);
|
||||
gboolean _gtk_file_system_model_iter_is_filtered_out (GtkFileSystemModel *model,
|
||||
|
|
|
|||
|
|
@ -74,6 +74,16 @@ struct _GtkIconViewItem
|
|||
guint selected : 1;
|
||||
guint selected_before_rubberbanding : 1;
|
||||
|
||||
/* Cached result of gtk_icon_view_calculate_item_size2(), only used when
|
||||
* the view caches cell layouts (see _gtk_icon_view_set_cache_cell_layout).
|
||||
* The inputs are the item geometry before the call and the row's
|
||||
* per-cell maximum heights; the outputs are box/before/after plus the
|
||||
* final width and height. */
|
||||
guint layout_valid : 1;
|
||||
guint layout_rtl : 1;
|
||||
gint layout_x, layout_y, layout_width;
|
||||
gint layout_out_width, layout_out_height;
|
||||
gint *layout_max_height;
|
||||
};
|
||||
|
||||
typedef struct _GtkIconViewCellInfo GtkIconViewCellInfo;
|
||||
|
|
@ -106,6 +116,15 @@ struct _GtkIconViewPrivate
|
|||
{
|
||||
gint width, height;
|
||||
|
||||
/* Reuse per-item cell layouts across relayouts (internal, opt-in). */
|
||||
guint cache_cell_layout : 1;
|
||||
|
||||
/* Last item looked up by index; makes sequential row-changed
|
||||
* notifications O(1) instead of O(n) each. Reset whenever the item
|
||||
* list changes. */
|
||||
GList *nth_cache_link;
|
||||
gint nth_cache_index;
|
||||
|
||||
GtkSelectionMode selection_mode;
|
||||
|
||||
GdkWindow *bin_window;
|
||||
|
|
@ -305,6 +324,7 @@ static void gtk_icon_view_queue_draw_path (GtkIco
|
|||
static void gtk_icon_view_queue_draw_item (GtkIconView *icon_view,
|
||||
GtkIconViewItem *item);
|
||||
static void gtk_icon_view_queue_layout (GtkIconView *icon_view);
|
||||
static void gtk_icon_view_invalidate_cell_layouts (GtkIconView *icon_view);
|
||||
static void gtk_icon_view_set_cursor_item (GtkIconView *icon_view,
|
||||
GtkIconViewItem *item,
|
||||
gint cursor_cell);
|
||||
|
|
@ -1425,6 +1445,9 @@ gtk_icon_view_style_set (GtkWidget *widget,
|
|||
gdk_window_set_background (icon_view->priv->bin_window, &widget->style->base[widget->state]);
|
||||
}
|
||||
|
||||
/* Cell sizes depend on the style; never reuse layouts measured before. */
|
||||
gtk_icon_view_invalidate_cell_layouts (icon_view);
|
||||
|
||||
gtk_widget_queue_resize (widget);
|
||||
}
|
||||
|
||||
|
|
@ -1590,6 +1613,10 @@ gtk_icon_view_expose (GtkWidget *widget,
|
|||
GtkIconViewItem *item = icons->data;
|
||||
GdkRectangle area;
|
||||
|
||||
/* Rows are laid out top to bottom; nothing after this can be exposed. */
|
||||
if (item->y > expose->area.y + expose->area.height)
|
||||
break;
|
||||
|
||||
area.x = item->x;
|
||||
area.y = item->y;
|
||||
area.width = item->width;
|
||||
|
|
@ -2687,6 +2714,115 @@ gtk_icon_view_adjustment_changed (GtkAdjustment *adjustment,
|
|||
}
|
||||
}
|
||||
|
||||
/* Same result as gtk_icon_view_calculate_item_size2(), but when cell
|
||||
* layout caching is enabled and nothing that the calculation depends on
|
||||
* has changed except the item position, the cached cell boxes are moved
|
||||
* instead of measuring all cell renderers again. Measuring text cells is
|
||||
* by far the most expensive part of a relayout, and relayouts happen for
|
||||
* every model change, so this keeps large views responsive. */
|
||||
static void
|
||||
gtk_icon_view_calculate_item_size2_cached (GtkIconView *icon_view,
|
||||
GtkIconViewItem *item,
|
||||
gint *max_height,
|
||||
gboolean rtl)
|
||||
{
|
||||
gint n_cells = icon_view->priv->n_cells;
|
||||
gint i;
|
||||
|
||||
if (!icon_view->priv->cache_cell_layout)
|
||||
{
|
||||
gtk_icon_view_calculate_item_size2 (icon_view, item, max_height);
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->layout_valid &&
|
||||
item->n_cells == n_cells &&
|
||||
item->layout_max_height != NULL &&
|
||||
item->layout_rtl == (rtl != FALSE) &&
|
||||
item->layout_width == item->width &&
|
||||
memcmp (item->layout_max_height, max_height, n_cells * sizeof (gint)) == 0)
|
||||
{
|
||||
gint dx = item->x - item->layout_x;
|
||||
gint dy = item->y - item->layout_y;
|
||||
|
||||
if (dx != 0 || dy != 0)
|
||||
{
|
||||
for (i = 0; i < n_cells; i++)
|
||||
{
|
||||
item->box[i].x += dx;
|
||||
item->box[i].y += dy;
|
||||
}
|
||||
}
|
||||
|
||||
item->layout_x = item->x;
|
||||
item->layout_y = item->y;
|
||||
item->width = item->layout_out_width;
|
||||
item->height = item->layout_out_height;
|
||||
return;
|
||||
}
|
||||
|
||||
item->layout_x = item->x;
|
||||
item->layout_y = item->y;
|
||||
item->layout_width = item->width;
|
||||
item->layout_rtl = rtl != FALSE;
|
||||
|
||||
gtk_icon_view_calculate_item_size2 (icon_view, item, max_height);
|
||||
|
||||
if (item->layout_max_height == NULL)
|
||||
item->layout_max_height = g_new (gint, n_cells);
|
||||
memcpy (item->layout_max_height, max_height, n_cells * sizeof (gint));
|
||||
item->layout_out_width = item->width;
|
||||
item->layout_out_height = item->height;
|
||||
item->layout_valid = item->n_cells == n_cells;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_invalidate_cell_layouts (GtkIconView *icon_view)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = icon_view->priv->items; l; l = l->next)
|
||||
((GtkIconViewItem *) l->data)->layout_valid = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_icon_view_set_cache_cell_layout:
|
||||
*
|
||||
* Internal. Lets an icon view reuse measured cell layouts across
|
||||
* relayouts. Only for views whose owner invalidates the layout itself
|
||||
* (with _gtk_icon_view_invalidate_cell_layout() or by changing the model
|
||||
* row) whenever cell renderer sizes change outside the icon view's
|
||||
* knowledge. Off by default, so applications see no behaviour change.
|
||||
*/
|
||||
void
|
||||
_gtk_icon_view_set_cache_cell_layout (GtkWidget *widget,
|
||||
gboolean cache)
|
||||
{
|
||||
GtkIconView *icon_view;
|
||||
|
||||
g_return_if_fail (GTK_IS_ICON_VIEW (widget));
|
||||
icon_view = GTK_ICON_VIEW (widget);
|
||||
|
||||
cache = cache != FALSE;
|
||||
if (icon_view->priv->cache_cell_layout == cache)
|
||||
return;
|
||||
|
||||
icon_view->priv->cache_cell_layout = cache;
|
||||
gtk_icon_view_invalidate_cell_layouts (icon_view);
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_icon_view_invalidate_cell_layout (GtkWidget *widget)
|
||||
{
|
||||
GtkIconView *icon_view;
|
||||
|
||||
g_return_if_fail (GTK_IS_ICON_VIEW (widget));
|
||||
icon_view = GTK_ICON_VIEW (widget);
|
||||
|
||||
gtk_icon_view_invalidate_cell_layouts (icon_view);
|
||||
gtk_icon_view_queue_layout (icon_view);
|
||||
}
|
||||
|
||||
static GList *
|
||||
gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
||||
GList *first_item,
|
||||
|
|
@ -2771,7 +2907,7 @@ gtk_icon_view_layout_single_row (GtkIconView *icon_view,
|
|||
item->col = col - 1 - item->col;
|
||||
}
|
||||
|
||||
gtk_icon_view_calculate_item_size2 (icon_view, item, max_height);
|
||||
gtk_icon_view_calculate_item_size2_cached (icon_view, item, max_height, rtl);
|
||||
|
||||
/* We may want to readjust the new y coordinate. */
|
||||
if (item->y + item->height + focus_width + icon_view->priv->row_spacing > *y)
|
||||
|
|
@ -3011,6 +3147,10 @@ gtk_icon_view_calculate_item_size (GtkIconView *icon_view,
|
|||
item->after = g_new0 (gint, icon_view->priv->n_cells);
|
||||
item->box = g_new0 (GdkRectangle, icon_view->priv->n_cells);
|
||||
|
||||
g_free (item->layout_max_height);
|
||||
item->layout_max_height = NULL;
|
||||
item->layout_valid = FALSE;
|
||||
|
||||
item->n_cells = icon_view->priv->n_cells;
|
||||
}
|
||||
|
||||
|
|
@ -3157,6 +3297,7 @@ gtk_icon_view_item_invalidate_size (GtkIconViewItem *item)
|
|||
{
|
||||
item->width = -1;
|
||||
item->height = -1;
|
||||
item->layout_valid = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -3480,6 +3621,7 @@ gtk_icon_view_item_free (GtkIconViewItem *item)
|
|||
g_free (item->before);
|
||||
g_free (item->after);
|
||||
g_free (item->box);
|
||||
g_free (item->layout_max_height);
|
||||
|
||||
g_free (item);
|
||||
}
|
||||
|
|
@ -3588,6 +3730,7 @@ gtk_icon_view_unselect_item (GtkIconView *icon_view,
|
|||
static void
|
||||
verify_items (GtkIconView *icon_view)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GList *items;
|
||||
int i = 0;
|
||||
|
||||
|
|
@ -3601,6 +3744,38 @@ verify_items (GtkIconView *icon_view)
|
|||
|
||||
i++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_view_reset_nth_cache (GtkIconView *icon_view)
|
||||
{
|
||||
icon_view->priv->nth_cache_link = NULL;
|
||||
icon_view->priv->nth_cache_index = -1;
|
||||
}
|
||||
|
||||
static GtkIconViewItem *
|
||||
gtk_icon_view_nth_item (GtkIconView *icon_view,
|
||||
gint index)
|
||||
{
|
||||
GtkIconViewPrivate *priv = icon_view->priv;
|
||||
GList *link = NULL;
|
||||
|
||||
if (priv->nth_cache_link != NULL)
|
||||
{
|
||||
if (index == priv->nth_cache_index)
|
||||
link = priv->nth_cache_link;
|
||||
else if (index == priv->nth_cache_index + 1)
|
||||
link = priv->nth_cache_link->next;
|
||||
}
|
||||
|
||||
if (link == NULL)
|
||||
link = g_list_nth (priv->items, index);
|
||||
|
||||
priv->nth_cache_link = link;
|
||||
priv->nth_cache_index = link ? index : -1;
|
||||
|
||||
return link ? link->data : NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -3618,7 +3793,7 @@ gtk_icon_view_row_changed (GtkTreeModel *model,
|
|||
gtk_icon_view_stop_editing (icon_view, TRUE);
|
||||
|
||||
index = gtk_tree_path_get_indices(path)[0];
|
||||
item = g_list_nth_data (icon_view->priv->items, index);
|
||||
item = gtk_icon_view_nth_item (icon_view, index);
|
||||
|
||||
gtk_icon_view_item_invalidate_size (item);
|
||||
gtk_icon_view_queue_layout (icon_view);
|
||||
|
|
@ -3640,6 +3815,8 @@ gtk_icon_view_row_inserted (GtkTreeModel *model,
|
|||
|
||||
icon_view = GTK_ICON_VIEW (data);
|
||||
|
||||
gtk_icon_view_reset_nth_cache (icon_view);
|
||||
|
||||
iters_persist = gtk_tree_model_get_flags (icon_view->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST;
|
||||
|
||||
index = gtk_tree_path_get_indices(path)[0];
|
||||
|
|
@ -3684,6 +3861,8 @@ gtk_icon_view_row_deleted (GtkTreeModel *model,
|
|||
|
||||
icon_view = GTK_ICON_VIEW (data);
|
||||
|
||||
gtk_icon_view_reset_nth_cache (icon_view);
|
||||
|
||||
index = gtk_tree_path_get_indices(path)[0];
|
||||
|
||||
list = g_list_nth (icon_view->priv->items, index);
|
||||
|
|
@ -3735,6 +3914,8 @@ gtk_icon_view_rows_reordered (GtkTreeModel *model,
|
|||
|
||||
icon_view = GTK_ICON_VIEW (data);
|
||||
|
||||
gtk_icon_view_reset_nth_cache (icon_view);
|
||||
|
||||
gtk_icon_view_stop_editing (icon_view, TRUE);
|
||||
|
||||
length = gtk_tree_model_iter_n_children (model, NULL);
|
||||
|
|
@ -3771,6 +3952,8 @@ gtk_icon_view_build_items (GtkIconView *icon_view)
|
|||
gboolean iters_persist;
|
||||
GList *items = NULL;
|
||||
|
||||
gtk_icon_view_reset_nth_cache (icon_view);
|
||||
|
||||
iters_persist = gtk_tree_model_get_flags (icon_view->priv->model) & GTK_TREE_MODEL_ITERS_PERSIST;
|
||||
|
||||
if (!gtk_tree_model_get_iter_first (icon_view->priv->model,
|
||||
|
|
@ -5209,6 +5392,13 @@ gtk_icon_view_get_visible_range (GtkIconView *icon_view,
|
|||
{
|
||||
GtkIconViewItem *item = icons->data;
|
||||
|
||||
/* Items are laid out row by row, so once an item starts below the
|
||||
* visible area, all following items do too. Stop here instead of
|
||||
* walking the rest of a possibly huge list. */
|
||||
if (start_index != -1 &&
|
||||
item->y > (int) (icon_view->priv->vadjustment->value + icon_view->priv->vadjustment->page_size))
|
||||
break;
|
||||
|
||||
if ((item->x + item->width >= (int)icon_view->priv->hadjustment->value) &&
|
||||
(item->y + item->height >= (int)icon_view->priv->vadjustment->value) &&
|
||||
(item->x <= (int) (icon_view->priv->hadjustment->value + icon_view->priv->hadjustment->page_size)) &&
|
||||
|
|
@ -5322,6 +5512,8 @@ gtk_icon_view_set_model (GtkIconView *icon_view,
|
|||
g_return_if_fail (GTK_IS_ICON_VIEW (icon_view));
|
||||
g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model));
|
||||
|
||||
gtk_icon_view_reset_nth_cache (icon_view);
|
||||
|
||||
if (icon_view->priv->model == model)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -141,6 +141,13 @@ const gchar *_gtk_font_style_name_translate (const gchar *name);
|
|||
#define _gtk_font_style_name_translate(name) (name)
|
||||
#endif
|
||||
|
||||
/* GtkIconView internals used by the file chooser */
|
||||
G_GNUC_INTERNAL
|
||||
void _gtk_icon_view_set_cache_cell_layout (GtkWidget *icon_view,
|
||||
gboolean cache);
|
||||
G_GNUC_INTERNAL
|
||||
void _gtk_icon_view_invalidate_cell_layout (GtkWidget *icon_view);
|
||||
|
||||
gboolean _gtk_fnmatch (const char *pattern,
|
||||
const char *string,
|
||||
gboolean no_leading_period);
|
||||
|
|
|
|||
Loading…
Reference in a new issue