[gimp] libgimpwidgets: make GimpIntStore behave a bit nicer (don't warn)
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: make GimpIntStore behave a bit nicer (don't warn)
- Date: Mon, 8 Oct 2012 19:34:29 +0000 (UTC)
commit 85ea7771d553d0465d70cb963fed980e507532f8
Author: Michael Natterer <mitch gimp org>
Date: Mon Oct 8 21:32:59 2012 +0200
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.
libgimpwidgets/gimpintstore.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/libgimpwidgets/gimpintstore.c b/libgimpwidgets/gimpintstore.c
index 429cd22..2f5f4b3 100644
--- a/libgimpwidgets/gimpintstore.c
+++ b/libgimpwidgets/gimpintstore.c
@@ -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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]