Commit 85ea7771 authored by Michael Natterer's avatar Michael Natterer 😴

libgimpwidgets: make GimpIntStore behave a bit nicer (don't warn)

when used in "unexpected" ways. Where "unexpected" is as simple as
removing an item from the store.
parent 610aac1d
......@@ -70,6 +70,8 @@ static void gimp_int_store_get_property (GObject *object,
static void gimp_int_store_row_inserted (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter);
static void gimp_int_store_row_deleted (GtkTreeModel *model,
GtkTreePath *path);
static void gimp_int_store_add_empty (GimpIntStore *store);
......@@ -123,6 +125,7 @@ gimp_int_store_tree_model_init (GtkTreeModelIface *iface)
parent_iface = g_type_interface_peek_parent (iface);
iface->row_inserted = gimp_int_store_row_inserted;
iface->row_deleted = gimp_int_store_row_deleted;
}
static void
......@@ -220,7 +223,22 @@ gimp_int_store_row_inserted (GtkTreeModel *model,
memcmp (iter, store->empty_iter, sizeof (GtkTreeIter)))
{
gtk_list_store_remove (GTK_LIST_STORE (store), store->empty_iter);
gtk_tree_iter_free (store->empty_iter);
}
}
static void
gimp_int_store_row_deleted (GtkTreeModel *model,
GtkTreePath *path)
{
GimpIntStore *store = GIMP_INT_STORE (model);
if (parent_iface->row_deleted)
parent_iface->row_deleted (model, path);
if (store->empty_iter)
{
/* freeing here crashes, no clue why. will be freed in finalize() */
/* gtk_tree_iter_free (store->empty_iter); */
store->empty_iter = NULL;
}
}
......
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