/* Called to filter each row */ static gboolean on_filter_visible (GObject *obj, gpointer user_data) { SeahorseKeyManagerStore* self = SEAHORSE_KEY_MANAGER_STORE (user_data); GList *children, *l; gboolean ret = FALSE; /* Check the row requested */ switch (self->priv->filter_mode) { case KEY_STORE_MODE_FILTERED: ret = object_contains_filtered_text (obj, self->priv->filter_text); break; case KEY_STORE_MODE_ALL: ret = TRUE; break; default: g_assert_not_reached (); break; }; /* If current is not being shown, double check with children */ if (!ret && GCR_IS_COLLECTION (obj)) { children = gcr_collection_get_objects (GCR_COLLECTION (obj)); for (l = children; !ret && l != NULL; l = g_list_next (l)) ret = on_filter_visible (l->data, user_data); } return ret; }
/** * gcr_union_collection_have: * @self: the union collection * @collection: the collection to check * * Check whether the collection is present in the union. * * Returns: whether present or not */ gboolean gcr_union_collection_have (GcrUnionCollection *self, GcrCollection *collection) { g_return_val_if_fail (GCR_IS_UNION_COLLECTION (self), FALSE); g_return_val_if_fail (GCR_IS_COLLECTION (collection), FALSE); return g_hash_table_lookup (self->pv->collections, collection) != NULL; }
/** * gcr_union_collection_add: * @self: The union collection * @collection: The collection whose objects to add * * Add objects from this collection to the union */ void gcr_union_collection_add (GcrUnionCollection *self, GcrCollection *collection) { g_return_if_fail (GCR_IS_UNION_COLLECTION (self)); g_return_if_fail (GCR_IS_COLLECTION (collection)); gcr_union_collection_take (self, g_object_ref (collection)); }
/** * gcr_union_collection_remove: * @self: The collection * @collection: The collection whose objects to remove * * Remove an object from the collection. */ void gcr_union_collection_remove (GcrUnionCollection *self, GcrCollection *collection) { GList *objects, *l; g_return_if_fail (GCR_IS_UNION_COLLECTION (self)); g_return_if_fail (GCR_IS_COLLECTION (collection)); g_return_if_fail (g_hash_table_lookup (self->pv->collections, collection)); g_object_ref (collection); g_hash_table_remove (self->pv->collections, collection); disconnect_from_collection (self, collection); objects = gcr_collection_get_objects (collection); for (l = objects; l != NULL; l = g_list_next (l)) on_collection_removed (collection, l->data, self); g_list_free (objects); g_object_unref (collection); }