background: Use objects for CcBackgroundItem storage

So that we don't need to unref the items in the list store by hand.
This commit is contained in:
Bastien Nocera 2011-02-14 18:11:04 +00:00
parent 7aca4e1ab2
commit db0b5b1195
2 changed files with 2 additions and 20 deletions

View file

@ -7,7 +7,7 @@
<!-- column-name gicon -->
<column type="GIcon"/>
<!-- column-name data -->
<column type="gpointer"/>
<column type="GObject"/>
<!-- column-name source-id -->
<column type="guint"/>
</columns>

View file

@ -70,22 +70,6 @@ bg_source_set_property (GObject *object,
}
}
static gboolean
free_tree_model_items (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gpointer data)
{
CcBackgroundItem *item = NULL;
gtk_tree_model_get (model, iter, 1, &item, -1);
if (item)
g_object_unref (item);
return FALSE;
}
static void
bg_source_dispose (GObject *object)
{
@ -93,8 +77,6 @@ bg_source_dispose (GObject *object)
if (priv->store)
{
gtk_tree_model_foreach (GTK_TREE_MODEL (priv->store),
free_tree_model_items, NULL);
g_object_unref (priv->store);
priv->store = NULL;
}
@ -136,7 +118,7 @@ bg_source_init (BgSource *self)
priv = self->priv = SOURCE_PRIVATE (self);
priv->store = gtk_list_store_new (2, G_TYPE_ICON, G_TYPE_POINTER);
priv->store = gtk_list_store_new (2, G_TYPE_ICON, G_TYPE_OBJECT);
}
GtkListStore*