app/widgets/gimpcontainercombobox.c app/widgets/gimpcontainerentry.c

2007-05-20  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcontainercombobox.c
	* app/widgets/gimpcontainerentry.c
	* app/widgets/gimpcontainertreeview.c: manage GtkTreeIters with
	gtk_tree_iter_copy/gtk_tree_iter_free instead of g_new/g_free.


svn path=/trunk/; revision=22541
This commit is contained in:
Michael Natterer 2007-05-20 11:47:27 +00:00 committed by Michael Natterer
parent 4884bc43fe
commit 5462aa56a8
4 changed files with 25 additions and 24 deletions

View File

@ -1,3 +1,10 @@
2007-05-20 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainercombobox.c
* app/widgets/gimpcontainerentry.c
* app/widgets/gimpcontainertreeview.c: manage GtkTreeIters with
gtk_tree_iter_copy/gtk_tree_iter_free instead of g_new/g_free.
2007-05-19 Michael Natterer <mitch@gimp.org>
* app/core/gimpimagefile.c (gimp_imagefile_get_desc_string): make

View File

@ -139,7 +139,7 @@ gimp_container_combo_box_view_iface_init (GimpContainerViewInterface *iface)
iface->clear_items = gimp_container_combo_box_clear_items;
iface->set_view_size = gimp_container_combo_box_set_view_size;
iface->insert_data_free = (GDestroyNotify) g_free;
iface->insert_data_free = (GDestroyNotify) gtk_tree_iter_free;
}
static void
@ -351,23 +351,21 @@ gimp_container_combo_box_insert_item (GimpContainerView *view,
gint index)
{
GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (view));
GtkTreeIter *iter;
iter = g_new0 (GtkTreeIter, 1);
GtkTreeIter iter;
if (index == -1)
gtk_list_store_append (GTK_LIST_STORE (model), iter);
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
else
gtk_list_store_insert (GTK_LIST_STORE (model), iter, index);
gtk_list_store_insert (GTK_LIST_STORE (model), &iter, index);
/* GimpContainerViews don't select items by default */
if (gtk_tree_model_iter_n_children (model, NULL) == 1)
gtk_combo_box_set_active (GTK_COMBO_BOX (view), -1);
gimp_container_combo_box_set (GIMP_CONTAINER_COMBO_BOX (view),
iter, viewable);
&iter, viewable);
return (gpointer) iter;
return gtk_tree_iter_copy (&iter);
}
static void

View File

@ -112,7 +112,7 @@ gimp_container_entry_view_iface_init (GimpContainerViewInterface *iface)
iface->clear_items = gimp_container_entry_clear_items;
iface->set_view_size = gimp_container_entry_set_view_size;
iface->insert_data_free = (GDestroyNotify) g_free;
iface->insert_data_free = (GDestroyNotify) gtk_tree_iter_free;
}
static void
@ -260,18 +260,16 @@ gimp_container_entry_insert_item (GimpContainerView *view,
gint index)
{
GtkTreeModel *model = gimp_container_entry_get_model (view);
GtkTreeIter *iter;
iter = g_new0 (GtkTreeIter, 1);
GtkTreeIter iter;
if (index == -1)
gtk_list_store_append (GTK_LIST_STORE (model), iter);
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
else
gtk_list_store_insert (GTK_LIST_STORE (model), iter, index);
gtk_list_store_insert (GTK_LIST_STORE (model), &iter, index);
gimp_container_entry_set (GIMP_CONTAINER_ENTRY (view), iter, viewable);
gimp_container_entry_set (GIMP_CONTAINER_ENTRY (view), &iter, viewable);
return (gpointer) iter;
return gtk_tree_iter_copy (&iter);
}
static void

View File

@ -148,7 +148,7 @@ gimp_container_tree_view_view_iface_init (GimpContainerViewInterface *iface)
iface->clear_items = gimp_container_tree_view_clear_items;
iface->set_view_size = gimp_container_tree_view_set_view_size;
iface->insert_data_free = (GDestroyNotify) g_free;
iface->insert_data_free = (GDestroyNotify) gtk_tree_iter_free;
}
static void
@ -513,18 +513,16 @@ gimp_container_tree_view_insert_item (GimpContainerView *view,
gint index)
{
GimpContainerTreeView *tree_view = GIMP_CONTAINER_TREE_VIEW (view);
GtkTreeIter *iter;
iter = g_new0 (GtkTreeIter, 1);
GtkTreeIter iter;
if (index == -1)
gtk_list_store_append (GTK_LIST_STORE (tree_view->model), iter);
gtk_list_store_append (GTK_LIST_STORE (tree_view->model), &iter);
else
gtk_list_store_insert (GTK_LIST_STORE (tree_view->model), iter, index);
gtk_list_store_insert (GTK_LIST_STORE (tree_view->model), &iter, index);
gimp_container_tree_view_set (tree_view, iter, viewable);
gimp_container_tree_view_set (tree_view, &iter, viewable);
return (gpointer) iter;
return gtk_tree_iter_copy (&iter);
}
static void