示例#1
0
static void
on_parser_parsed (GcrParser *parser, gpointer user_data)
{
	GcrSimpleCollection *collection = user_data;
	GcrSimpleCollection *testcol;
	GcrRenderer *renderer;
	gchar *group;

	renderer = gcr_renderer_create (gcr_parser_get_parsed_label (parser),
	                                gcr_parser_get_parsed_attributes (parser));
	if (renderer == NULL)
		return;

	if (GCR_IS_CERTIFICATE (renderer))
		group = gcr_certificate_get_subject_part (GCR_CERTIFICATE (renderer), "O");
	else
		group = g_strdup (G_OBJECT_TYPE_NAME (renderer));


	testcol = test_collection_instance (group);
	if (!gcr_simple_collection_contains (collection, G_OBJECT (testcol)))
		gcr_simple_collection_add (collection, G_OBJECT (testcol));

	gcr_simple_collection_add (GCR_SIMPLE_COLLECTION (testcol), G_OBJECT (renderer));
	g_object_unref (renderer);
	g_object_unref (testcol);
	g_free (group);
}
示例#2
0
static gboolean
gcr_simple_collection_real_contains (GcrCollection *collection,
                                     GObject *object)
{
	GcrSimpleCollection *self = GCR_SIMPLE_COLLECTION (collection);
	return g_hash_table_lookup (self->pv->items, object) ? TRUE : FALSE;
}
/**
* self: The SeahorseKeyserverResults object to init
*
* Inits the results object
*
**/
static void
seahorse_keyserver_results_init (SeahorseKeyserverResults *self)
{
	self->pv = G_TYPE_INSTANCE_GET_PRIVATE (self, SEAHORSE_TYPE_KEYSERVER_RESULTS, SeahorseKeyserverResultsPrivate);
	self->pv->settings = g_settings_new ("org.gnome.seahorse.manager");
	self->pv->collection = GCR_SIMPLE_COLLECTION (gcr_simple_collection_new ());
}
示例#4
0
static void
gcr_simple_collection_dispose (GObject *obj)
{
	GcrSimpleCollection *self = GCR_SIMPLE_COLLECTION (obj);

	g_hash_table_remove_all (self->pv->items);

	G_OBJECT_CLASS (gcr_simple_collection_parent_class)->dispose (obj);
}
示例#5
0
static void
gcr_simple_collection_finalize (GObject *obj)
{
	GcrSimpleCollection *self = GCR_SIMPLE_COLLECTION (obj);

	g_assert (self->pv->items);
	g_assert (g_hash_table_size (self->pv->items) == 0);
	g_hash_table_destroy (self->pv->items);
	self->pv->items = NULL;

	G_OBJECT_CLASS (gcr_simple_collection_parent_class)->finalize (obj);
}
示例#6
0
static GcrSimpleCollection *
test_collection_instance (const gchar *label)
{
	TestCollection *collection = NULL;

	g_assert (label);

	if (!all_collections) {
		all_collections = g_hash_table_new (g_str_hash, g_str_equal);
	} else {
		collection = g_hash_table_lookup (all_collections, label);
		if (collection != NULL)
			return g_object_ref (collection);
	}

	collection = g_object_new (TEST_TYPE_COLLECTION, NULL);
	collection->label = g_strdup (label);
	g_hash_table_insert (all_collections, collection->label, collection);
	return GCR_SIMPLE_COLLECTION (collection);
}
示例#7
0
static GList*
gcr_simple_collection_real_get_objects (GcrCollection *coll)
{
	GcrSimpleCollection *self = GCR_SIMPLE_COLLECTION (coll);
	return g_hash_table_get_keys (self->pv->items);
}
示例#8
0
static guint
gcr_simple_collection_real_get_length (GcrCollection *coll)
{
	GcrSimpleCollection *self = GCR_SIMPLE_COLLECTION (coll);
	return g_hash_table_size (self->pv->items);
}
static void
seahorse_keyserver_results_init (SeahorseKeyserverResults *self)
{
    self->collection = GCR_SIMPLE_COLLECTION (gcr_simple_collection_new ());
}