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:
parent
7aca4e1ab2
commit
db0b5b1195
2 changed files with 2 additions and 20 deletions
|
@ -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>
|
||||
|
|
|
@ -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*
|
||||
|
|
Loading…
Add table
Reference in a new issue