GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit a39a229b authored by Christian Hergert's avatar Christian Hergert

listbox: allow tweaking the recycle max

This allows you to set how many rows to cache by default.
parent a0f74d4f
......@@ -35,6 +35,8 @@
#include "dzl-list-box.h"
#include "dzl-list-box-row.h"
#define RECYCLE_MAX_DEFAULT 25
typedef struct
{
GListModel *model;
......@@ -294,7 +296,7 @@ dzl_list_box_init (DzlListBox *self)
DzlListBoxPrivate *priv = dzl_list_box_get_instance_private (self);
priv->row_type = G_TYPE_INVALID;
priv->recycle_max = 25;
priv->recycle_max = RECYCLE_MAX_DEFAULT;
g_queue_init (&priv->trashed_rows);
}
......@@ -369,3 +371,27 @@ dzl_list_box_set_model (DzlListBox *self,
self,
NULL);
}
/**
* dzl_list_box_set_recycle_max:
* @self: a #DzlListBox
* @recycle_max: max number of rows to cache
*
* Sets the max number of rows to cache for reuse. Set to 0 to return
* to the default.
*
* Since: 3.28
*/
void
dzl_list_box_set_recycle_max (DzlListBox *self,
guint recycle_max)
{
DzlListBoxPrivate *priv = dzl_list_box_get_instance_private (self);
g_return_if_fail (DZL_IS_LIST_BOX (self));
if (recycle_max == 0)
priv->recycle_max = RECYCLE_MAX_DEFAULT;
else
priv->recycle_max = recycle_max;
}
......@@ -51,6 +51,9 @@ GListModel *dzl_list_box_get_model (DzlListBox *self);
DZL_AVAILABLE_IN_ALL
void dzl_list_box_set_model (DzlListBox *self,
GListModel *model);
DZL_AVAILABLE_IN_3_28
void dzl_list_box_set_recycle_max (DzlListBox *self,
guint recycle_max);
G_END_DECLS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment