예제 #1
0
static GeeArrayList* rygel_didl_lite_writer_get_original_resources (RygelDIDLLiteWriter* self, RygelMediaItem* item, GError** error) {
	GError * _inner_error_;
	GeeArrayList* resources;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (item != NULL, NULL);
	_inner_error_ = NULL;
	resources = gee_array_list_new (GUPNP_TYPE_DIDL_LITE_RESOURCE, (GBoxedCopyFunc) _gupnp_didl_lite_resource_dup, g_free, g_direct_equal);
	{
		GeeIterator* _uri_it;
		_uri_it = gee_iterable_iterator ((GeeIterable*) item->uris);
		while (gee_iterator_next (_uri_it)) {
			char* uri;
			GUPnPDIDLLiteResource res;
			uri = (char*) gee_iterator_get (_uri_it);
			res = rygel_media_item_create_res (item, uri, &_inner_error_);
			if (_inner_error_ != NULL) {
				g_propagate_error (error, _inner_error_);
				uri = (g_free (uri), NULL);
				(_uri_it == NULL) ? NULL : (_uri_it = (g_object_unref (_uri_it), NULL));
				(resources == NULL) ? NULL : (resources = (g_object_unref (resources), NULL));
				return NULL;
			}
			gee_collection_add ((GeeCollection*) resources, &res);
			uri = (g_free (uri), NULL);
			gupnp_didl_lite_resource_destroy (&res);
		}
		(_uri_it == NULL) ? NULL : (_uri_it = (g_object_unref (_uri_it), NULL));
	}
	return resources;
}
예제 #2
0
FolksIndividual *
empathy_create_individual_from_tp_contact (TpContact *contact)
{
  GeeSet *personas;
  TpfPersona *persona;
  FolksIndividual *individual;

  persona = tpf_persona_dup_for_contact (contact);
  if (persona == NULL)
    {
      DEBUG ("Failed to get a persona for %s",
          tp_contact_get_identifier (contact));
      return NULL;
    }

  personas = GEE_SET (
      gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref, g_object_unref,
      g_direct_hash, g_direct_equal));

  gee_collection_add (GEE_COLLECTION (personas), persona);

  individual = folks_individual_new (personas);

  g_clear_object (&persona);
  g_clear_object (&personas);

  return individual;
}
예제 #3
0
static GeeList* rygel_folder_container_real_get_children_finish (RygelMediaContainer* base, GAsyncResult* res, GError** error) {
#line 158 "rygel-folder-container.c"
	RygelFolderContainer * self;
	self = (RygelFolderContainer*) base;
#line 85 "rygel-folder-container.vala"
	g_return_val_if_fail (res != NULL, NULL);
#line 88 "rygel-folder-container.vala"
	if (RYGEL_IS_FOLDER_DIRECTORY_SEARCH_RESULT (res)) {
#line 165 "rygel-folder-container.c"
		RygelFolderDirectorySearchResult* _tmp0_;
		RygelFolderDirectorySearchResult* dsr;
		GeeList* _tmp1_;
#line 89 "rygel-folder-container.vala"
		_tmp0_ = NULL;
#line 171 "rygel-folder-container.c"
		dsr = (_tmp0_ = RYGEL_FOLDER_DIRECTORY_SEARCH_RESULT (res), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
		{
			GeeIterator* _item_it;
			_item_it = gee_iterable_iterator ((GeeIterable*) ((GeeList*) ((RygelSimpleAsyncResult*) dsr)->data));
#line 91 "rygel-folder-container.vala"
			while (gee_iterator_next (_item_it)) {
#line 178 "rygel-folder-container.c"
				RygelMediaObject* item;
				item = (RygelMediaObject*) gee_iterator_get (_item_it);
#line 92 "rygel-folder-container.vala"
				gee_collection_add ((GeeCollection*) self->priv->items, item);
#line 183 "rygel-folder-container.c"
				(item == NULL) ? NULL : (item = (g_object_unref (item), NULL));
			}
			(_item_it == NULL) ? NULL : (_item_it = (g_object_unref (_item_it), NULL));
		}
#line 95 "rygel-folder-container.vala"
		((RygelMediaContainer*) self)->child_count = (guint) gee_collection_get_size ((GeeCollection*) self->priv->items);
#line 96 "rygel-folder-container.vala"
		gee_collection_remove ((GeeCollection*) self->priv->results, res);
#line 97 "rygel-folder-container.vala"
		_tmp1_ = NULL;
#line 97 "rygel-folder-container.vala"
		return (_tmp1_ = rygel_folder_directory_search_result_get_children (dsr), (dsr == NULL) ? NULL : (dsr = (g_object_unref (dsr), NULL)), _tmp1_);
#line 196 "rygel-folder-container.c"
	} else {
		RygelSimpleAsyncResult* _tmp2_;
		RygelSimpleAsyncResult* simple_res;
		GeeList* _tmp3_;
		GeeList* _tmp4_;
#line 99 "rygel-folder-container.vala"
		_tmp2_ = NULL;
#line 204 "rygel-folder-container.c"
		simple_res = (_tmp2_ = RYGEL_SIMPLE_ASYNC_RESULT (res), (_tmp2_ == NULL) ? NULL : g_object_ref (_tmp2_));
#line 101 "rygel-folder-container.vala"
		_tmp3_ = NULL;
#line 101 "rygel-folder-container.vala"
		_tmp4_ = NULL;
#line 101 "rygel-folder-container.vala"
		return (_tmp4_ = (_tmp3_ = (GeeList*) simple_res->data, (_tmp3_ == NULL) ? NULL : g_object_ref (_tmp3_)), (simple_res == NULL) ? NULL : (simple_res = (g_object_unref (simple_res), NULL)), _tmp4_);
#line 212 "rygel-folder-container.c"
	}
}
static void rygel_tracker_video_item_real_init_from_metadata (RygelTrackerItem* base, char** values, int values_length1) {
	RygelTrackerVideoItem * self;
	GError * _inner_error_;
	char* _tmp4_;
	char* _tmp6_;
	const char* _tmp5_;
	char* _tmp8_;
	const char* _tmp7_;
	char* _tmp9_;
	char* _tmp10_;
	self = (RygelTrackerVideoItem*) base;
	_inner_error_ = NULL;
	if (_vala_strcmp0 (values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_TITLE], "") != 0) {
		char* _tmp1_;
		const char* _tmp0_;
		_tmp1_ = NULL;
		_tmp0_ = NULL;
		((RygelMediaObject*) self)->title = (_tmp1_ = (_tmp0_ = values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_TITLE], (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_)), ((RygelMediaObject*) self)->title = (g_free (((RygelMediaObject*) self)->title), NULL), _tmp1_);
	} else {
		char* _tmp3_;
		const char* _tmp2_;
		_tmp3_ = NULL;
		_tmp2_ = NULL;
		((RygelMediaObject*) self)->title = (_tmp3_ = (_tmp2_ = values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_FILE_NAME], (_tmp2_ == NULL) ? NULL : g_strdup (_tmp2_)), ((RygelMediaObject*) self)->title = (g_free (((RygelMediaObject*) self)->title), NULL), _tmp3_);
	}
	if (_vala_strcmp0 (values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_SIZE], "") != 0) {
		((RygelMediaItem*) self)->size = (glong) atoi (values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_SIZE]);
	}
	if (_vala_strcmp0 (values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_DURATION], "") != 0) {
		((RygelMediaItem*) self)->duration = (glong) atoi (values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_DURATION]);
	}
	if (_vala_strcmp0 (values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_WIDTH], "") != 0) {
		((RygelMediaItem*) self)->width = atoi (values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_WIDTH]);
	}
	if (_vala_strcmp0 (values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_HEIGHT], "") != 0) {
		((RygelMediaItem*) self)->height = atoi (values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_HEIGHT]);
	}
	_tmp4_ = NULL;
	((RygelMediaItem*) self)->date = (_tmp4_ = rygel_tracker_item_seconds_to_iso8601 ((RygelTrackerItem*) self, values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_DATE]), ((RygelMediaItem*) self)->date = (g_free (((RygelMediaItem*) self)->date), NULL), _tmp4_);
	_tmp6_ = NULL;
	_tmp5_ = NULL;
	((RygelMediaItem*) self)->mime_type = (_tmp6_ = (_tmp5_ = values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_MIME], (_tmp5_ == NULL) ? NULL : g_strdup (_tmp5_)), ((RygelMediaItem*) self)->mime_type = (g_free (((RygelMediaItem*) self)->mime_type), NULL), _tmp6_);
	_tmp8_ = NULL;
	_tmp7_ = NULL;
	((RygelMediaItem*) self)->author = (_tmp8_ = (_tmp7_ = values[RYGEL_TRACKER_VIDEO_ITEM_METADATA_AUTHOR], (_tmp7_ == NULL) ? NULL : g_strdup (_tmp7_)), ((RygelMediaItem*) self)->author = (g_free (((RygelMediaItem*) self)->author), NULL), _tmp8_);
	_tmp9_ = g_filename_to_uri (((RygelTrackerItem*) self)->path, NULL, &_inner_error_);
	if (_inner_error_ != NULL) {
		g_critical ("file %s: line %d: uncaught error: %s", __FILE__, __LINE__, _inner_error_->message);
		g_clear_error (&_inner_error_);
		return;
	}
	_tmp10_ = NULL;
	gee_collection_add ((GeeCollection*) ((RygelMediaItem*) self)->uris, _tmp10_ = _tmp9_);
	_tmp10_ = (g_free (_tmp10_), NULL);
}
RygelTrackerRootContainer* rygel_tracker_root_container_construct (GType object_type, const char* title) {
	RygelTrackerRootContainer * self;
	GeeArrayList* _tmp0_;
	RygelTrackerImageCategory* _tmp1_;
	RygelTrackerMusicCategory* _tmp2_;
	RygelTrackerVideoCategory* _tmp3_;
	g_return_val_if_fail (title != NULL, NULL);
	self = (RygelTrackerRootContainer*) rygel_media_container_construct_root (object_type, title, (guint) 0);
	_tmp0_ = NULL;
	self->priv->categories = (_tmp0_ = gee_array_list_new (RYGEL_TYPE_TRACKER_CATEGORY, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (self->priv->categories == NULL) ? NULL : (self->priv->categories = (g_object_unref (self->priv->categories), NULL)), _tmp0_);
	_tmp1_ = NULL;
	gee_collection_add ((GeeCollection*) self->priv->categories, (RygelTrackerCategory*) (_tmp1_ = rygel_tracker_image_category_new ("16", (RygelMediaContainer*) self, "All Images")));
	(_tmp1_ == NULL) ? NULL : (_tmp1_ = (g_object_unref (_tmp1_), NULL));
	_tmp2_ = NULL;
	gee_collection_add ((GeeCollection*) self->priv->categories, (RygelTrackerCategory*) (_tmp2_ = rygel_tracker_music_category_new ("14", (RygelMediaContainer*) self, "All Music")));
	(_tmp2_ == NULL) ? NULL : (_tmp2_ = (g_object_unref (_tmp2_), NULL));
	_tmp3_ = NULL;
	gee_collection_add ((GeeCollection*) self->priv->categories, (RygelTrackerCategory*) (_tmp3_ = rygel_tracker_video_category_new ("15", (RygelMediaContainer*) self, "All Videos")));
	(_tmp3_ == NULL) ? NULL : (_tmp3_ = (g_object_unref (_tmp3_), NULL));
	((RygelMediaContainer*) self)->child_count = (guint) gee_collection_get_size ((GeeCollection*) self->priv->categories);
	return self;
}
예제 #6
0
파일: iset.c 프로젝트: chebizarro/LibDotNet
gboolean system_collections_generic_iset_SetEquals (SystemCollectionsGenericISet* self, SystemCollectionsGenericIEnumerable* other);
void system_collections_generic_iset_SymmetricExceptWith (SystemCollectionsGenericISet* self, SystemCollectionsGenericIEnumerable* other);
void system_collections_generic_iset_UnionWith (SystemCollectionsGenericISet* self, SystemCollectionsGenericIEnumerable* other);


static gboolean system_collections_generic_iset_real_Add (SystemCollectionsGenericISet* self, gconstpointer value) {
	gboolean result = FALSE;
	gconstpointer _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
#line 32 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/Generic/iset.vala"
	_tmp0_ = value;
#line 32 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/Generic/iset.vala"
	_tmp1_ = gee_collection_add ((GeeCollection*) self, _tmp0_);
#line 32 "/home/developer/projects/Backup/LibDotNet/src/System/Collections/Generic/iset.vala"
예제 #7
0
static void gtk_mate_pattern_add_patterns (GeeArrayList* patlist, GeeArrayList* ps) {
	g_return_if_fail (patlist != NULL);
	g_return_if_fail (ps != NULL);
	{
		GeeIterator* _p_it;
		_p_it = gee_iterable_iterator ((GeeIterable*) ps);
		while (gee_iterator_next (_p_it)) {
			GtkMatePattern* p;
			p = (GtkMatePattern*) gee_iterator_get (_p_it);
			gee_collection_add ((GeeCollection*) patlist, p);
			(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
		}
		(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
	}
}
예제 #8
0
static FolksIndividual *
create_individual_from_persona (FolksPersona *persona)
{
  GeeSet *personas;
  FolksIndividual *individual;

  personas = GEE_SET (
      gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref, g_object_unref,
      NULL, NULL, NULL, NULL, NULL, NULL));

  gee_collection_add (GEE_COLLECTION (personas), persona);

  individual = folks_individual_new (personas);

  g_clear_object (&personas);

  return individual;
}
static void rygel_folder_pref_section_real_save (RygelPreferencesSection* base) {
	RygelFolderPrefSection * self;
	GtkTextIter start = {0};
	GtkTextIter end = {0};
	const char* _tmp0_;
	char* text;
	char** _tmp2_;
	gint folders_size;
	gint folders_length1;
	char** _tmp1_;
	char** folders;
	GeeArrayList* folder_list;
	self = (RygelFolderPrefSection*) base;
	gtk_text_buffer_get_start_iter (self->priv->text_buffer, &start);
	gtk_text_buffer_get_end_iter (self->priv->text_buffer, &end);
	_tmp0_ = NULL;
	text = (_tmp0_ = gtk_text_buffer_get_text (self->priv->text_buffer, &start, &end, FALSE), (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_));
	_tmp2_ = NULL;
	_tmp1_ = NULL;
	folders = (_tmp2_ = _tmp1_ = g_strsplit (text, "\n", -1), folders_length1 = _vala_array_length (_tmp1_), folders_size = folders_length1, _tmp2_);
	folder_list = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_direct_equal);
	{
		char** folder_collection;
		int folder_collection_length1;
		int folder_it;
		folder_collection = folders;
		folder_collection_length1 = folders_length1;
		for (folder_it = 0; folder_it < folders_length1; folder_it = folder_it + 1) {
			const char* _tmp3_;
			char* folder;
			_tmp3_ = NULL;
			folder = (_tmp3_ = folder_collection[folder_it], (_tmp3_ == NULL) ? NULL : g_strdup (_tmp3_));
			{
				gee_collection_add ((GeeCollection*) folder_list, folder);
				folder = (g_free (folder), NULL);
			}
		}
	}
	rygel_configuration_set_string_list (((RygelPreferencesSection*) self)->config, ((RygelPreferencesSection*) self)->name, RYGEL_FOLDER_PREF_SECTION_FOLDERS_KEY, folder_list);
	text = (g_free (text), NULL);
	folders = (_vala_array_free (folders, folders_length1, (GDestroyNotify) g_free), NULL);
	(folder_list == NULL) ? NULL : (folder_list = (g_object_unref (folder_list), NULL));
}
void rygel_tracker_search_result_ready (RygelTrackerSearchResult* self, char*** search_result, int search_result_length1, GError* _error_) {
	RygelTrackerCategory* _tmp2_;
	RygelTrackerCategory* category;
	g_return_if_fail (self != NULL);
	if (_error_ != NULL) {
		GError* _tmp1_;
		GError* _tmp0_;
		_tmp1_ = NULL;
		_tmp0_ = NULL;
		((RygelSimpleAsyncResult*) self)->error = (_tmp1_ = (_tmp0_ = _error_, (_tmp0_ == NULL) ? ((gpointer) _tmp0_) : g_error_copy (_tmp0_)), (((RygelSimpleAsyncResult*) self)->error == NULL) ? NULL : (((RygelSimpleAsyncResult*) self)->error = (g_error_free (((RygelSimpleAsyncResult*) self)->error), NULL)), _tmp1_);
		rygel_simple_async_result_complete ((RygelSimpleAsyncResult*) self);
		return;
	}
	_tmp2_ = NULL;
	category = (_tmp2_ = RYGEL_TRACKER_CATEGORY (((RygelSimpleAsyncResult*) self)->source_object), (_tmp2_ == NULL) ? NULL : g_object_ref (_tmp2_));
	{
		guint i;
		/* Iterate through all items */
		i = (guint) 0;
		for (; i < search_result_length1; i++) {
			const char* _tmp3_;
			char* child_path;
			char** _tmp5_;
			gint metadata_size;
			gint metadata_length1;
			gint _tmp4_;
			char** metadata;
			RygelMediaItem* item;
			_tmp3_ = NULL;
			child_path = (_tmp3_ = search_result[i][0], (_tmp3_ == NULL) ? NULL : g_strdup (_tmp3_));
			_tmp5_ = NULL;
			metadata = (_tmp5_ = rygel_tracker_search_result_slice_strv_tail (self, search_result[i], -1, 2, &_tmp4_), metadata_length1 = _tmp4_, metadata_size = metadata_length1, _tmp5_);
			item = rygel_tracker_category_create_item (category, child_path, metadata, metadata_length1);
			gee_collection_add ((GeeCollection*) ((GeeList*) ((RygelSimpleAsyncResult*) self)->data), (RygelMediaObject*) item);
			child_path = (g_free (child_path), NULL);
			metadata = (_vala_array_free (metadata, metadata_length1, (GDestroyNotify) g_free), NULL);
			(item == NULL) ? NULL : (item = (g_object_unref (item), NULL));
		}
	}
	rygel_simple_async_result_complete ((RygelSimpleAsyncResult*) self);
	(category == NULL) ? NULL : (category = (g_object_unref (category), NULL));
}
예제 #11
0
static void rygel_folder_container_real_get_children (RygelMediaContainer* base, guint offset, guint max_count, GCancellable* cancellable, GAsyncReadyCallback callback, void* callback_target) {
#line 115 "rygel-folder-container.c"
	RygelFolderContainer * self;
	self = (RygelFolderContainer*) base;
	/* if the cache is empty, fill it*/
#line 56 "rygel-folder-container.vala"
	if (gee_collection_get_size ((GeeCollection*) self->priv->items) == 0) {
#line 121 "rygel-folder-container.c"
		RygelFolderDirectorySearchResult* res;
		res = rygel_folder_directory_search_result_new ((RygelMediaContainer*) self, offset, max_count, callback, callback_target);
#line 62 "rygel-folder-container.vala"
		g_file_enumerate_children_async (self->priv->root_dir, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "," G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NONE, G_PRIORITY_DEFAULT, NULL, _rygel_folder_directory_search_result_enumerate_children_ready_gasync_ready_callback, res);
#line 71 "rygel-folder-container.vala"
		gee_collection_add ((GeeCollection*) self->priv->results, (GAsyncResult*) res);
#line 128 "rygel-folder-container.c"
		(res == NULL) ? NULL : (res = (g_object_unref (res), NULL));
	} else {
		guint stop;
		GeeList* children;
		RygelSimpleAsyncResult* res;
		GeeList* _tmp1_;
		GeeList* _tmp0_;
		stop = offset + max_count;
#line 74 "rygel-folder-container.vala"
		stop = CLAMP (stop, (guint) 0, ((RygelMediaContainer*) self)->child_count);
#line 139 "rygel-folder-container.c"
		children = gee_list_slice ((GeeList*) self->priv->items, (gint) offset, (gint) stop);
		res = rygel_simple_async_result_new (GEE_TYPE_LIST, (GBoxedCopyFunc) g_object_ref, g_object_unref, (GObject*) self, callback, callback_target);
		_tmp1_ = NULL;
#line 80 "rygel-folder-container.vala"
		_tmp0_ = NULL;
#line 80 "rygel-folder-container.vala"
		res->data = (_tmp1_ = (_tmp0_ = children, (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_)), (res->data == NULL) ? NULL : (res->data = (g_object_unref (res->data), NULL)), _tmp1_);
#line 81 "rygel-folder-container.vala"
		rygel_simple_async_result_complete_in_idle (res);
#line 149 "rygel-folder-container.c"
		(children == NULL) ? NULL : (children = (g_object_unref (children), NULL));
		(res == NULL) ? NULL : (res = (g_object_unref (res), NULL));
	}
}
예제 #12
0
void rygel_plugin_add_icon (RygelPlugin* self, RygelIconInfo* icon_info) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (icon_info != NULL);
	gee_collection_add ((GeeCollection*) self->icon_infos, icon_info);
}
예제 #13
0
파일: theme.c 프로젝트: poelzi/gtkmateview
GeeArrayList* gtk_mate_theme_theme_filenames (void) {
	GError * inner_error;
	GeeArrayList* names;
	char* share_dir;
	char* name;
	GeeArrayList* _tmp8;
	inner_error = NULL;
	names = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_direct_equal);
	share_dir = gtk_mate_textmate_share_dir ();
	name = NULL;
	{
		char* _tmp0;
		GDir* _tmp1;
		GDir* d;
		char* _tmp3;
		const char* _tmp2;
		GeeArrayList* _tmp6;
		_tmp0 = NULL;
		_tmp1 = NULL;
		d = (_tmp1 = g_dir_open (_tmp0 = g_strconcat (share_dir, "/Themes", NULL), 0, &inner_error), _tmp0 = (g_free (_tmp0), NULL), _tmp1);
		if (inner_error != NULL) {
			if (inner_error->domain == G_FILE_ERROR) {
				goto __catch6_g_file_error;
			}
			goto __finally6;
		}
		_tmp3 = NULL;
		_tmp2 = NULL;
		while ((name = (_tmp3 = (_tmp2 = g_dir_read_name (d), (_tmp2 == NULL) ? NULL : g_strdup (_tmp2)), name = (g_free (name), NULL), _tmp3)) != NULL) {
			if (g_str_has_suffix (name, ".tmTheme")) {
				char* _tmp5;
				char* _tmp4;
				_tmp5 = NULL;
				_tmp4 = NULL;
				gee_collection_add ((GeeCollection*) names, _tmp5 = g_strconcat (_tmp4 = g_strconcat (share_dir, "/Themes/", NULL), name, NULL));
				_tmp5 = (g_free (_tmp5), NULL);
				_tmp4 = (g_free (_tmp4), NULL);
			}
		}
		_tmp6 = NULL;
		return (_tmp6 = names, (d == NULL) ? NULL : (d = (g_dir_close (d), NULL)), share_dir = (g_free (share_dir), NULL), name = (g_free (name), NULL), _tmp6);
	}
	goto __finally6;
	__catch6_g_file_error:
	{
		GError * e;
		e = inner_error;
		inner_error = NULL;
		{
			char* _tmp7;
			_tmp7 = NULL;
			fprintf (stdout, "couldn't open: %s\n", _tmp7 = g_strconcat (share_dir, "/Bundles", NULL));
			_tmp7 = (g_free (_tmp7), NULL);
			(e == NULL) ? NULL : (e = (g_error_free (e), NULL));
		}
	}
	__finally6:
	if (inner_error != NULL) {
		(names == NULL) ? NULL : (names = (g_object_unref (names), NULL));
		share_dir = (g_free (share_dir), NULL);
		name = (g_free (name), NULL);
		g_critical ("file %s: line %d: uncaught error: %s", __FILE__, __LINE__, inner_error->message);
		g_clear_error (&inner_error);
		return NULL;
	}
	_tmp8 = NULL;
	return (_tmp8 = NULL, (names == NULL) ? NULL : (names = (g_object_unref (names), NULL)), share_dir = (g_free (share_dir), NULL), name = (g_free (name), NULL), _tmp8);
}
예제 #14
0
파일: theme.c 프로젝트: poelzi/gtkmateview
GtkMateTheme* gtk_mate_theme_create_from_plist (PListDict* dict) {
	GtkMateTheme* theme;
	PListNode* nm;
	PListNode* _tmp2;
	GeeHashMap* _tmp5;
	GeeArrayList* _tmp6;
	PListArray* na;
	GtkMateTheme* _tmp14;
	g_return_val_if_fail (dict != NULL, NULL);
	theme = g_object_ref_sink (gtk_mate_theme_new ());
	theme->is_initialized = FALSE;
	nm = plist_dict_get (dict, "name");
	if (nm != NULL) {
		char* _tmp1;
		const char* _tmp0;
		_tmp1 = NULL;
		_tmp0 = NULL;
		theme->name = (_tmp1 = (_tmp0 = PLIST_STRING (nm)->str, (_tmp0 == NULL) ? NULL : g_strdup (_tmp0)), theme->name = (g_free (theme->name), NULL), _tmp1);
	}
	_tmp2 = NULL;
	nm = (_tmp2 = plist_dict_get (dict, "author"), (nm == NULL) ? NULL : (nm = (g_object_unref (nm), NULL)), _tmp2);
	if (nm != NULL) {
		char* _tmp4;
		const char* _tmp3;
		_tmp4 = NULL;
		_tmp3 = NULL;
		theme->author = (_tmp4 = (_tmp3 = PLIST_STRING (nm)->str, (_tmp3 == NULL) ? NULL : g_strdup (_tmp3)), theme->author = (g_free (theme->author), NULL), _tmp4);
	}
	_tmp5 = NULL;
	theme->global_settings = (_tmp5 = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, g_str_hash, g_str_equal, g_direct_equal), (theme->global_settings == NULL) ? NULL : (theme->global_settings = (g_object_unref (theme->global_settings), NULL)), _tmp5);
	_tmp6 = NULL;
	theme->settings = (_tmp6 = gee_array_list_new (GTK_MATE_TYPE_THEME_SETTING, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (theme->settings == NULL) ? NULL : (theme->settings = (g_object_unref (theme->settings), NULL)), _tmp6);
	na = PLIST_ARRAY (plist_dict_get (dict, "settings"));
	{
		GeeIterator* _nn_it;
		_nn_it = gee_iterable_iterator ((GeeIterable*) na->array);
		while (gee_iterator_next (_nn_it)) {
			PListNode* nn;
			PListDict* _tmp7;
			PListDict* nd;
			PListNode* _tmp8;
			gboolean _tmp9;
			nn = (PListNode*) gee_iterator_get (_nn_it);
			_tmp7 = NULL;
			nd = (_tmp7 = PLIST_DICT (nn), (_tmp7 == NULL) ? NULL : g_object_ref (_tmp7));
			_tmp8 = NULL;
			if ((_tmp9 = (_tmp8 = plist_dict_get (nd, "scope")) == NULL, (_tmp8 == NULL) ? NULL : (_tmp8 = (g_object_unref (_tmp8), NULL)), _tmp9)) {
				PListDict* gsd;
				gsd = PLIST_DICT (plist_dict_get (nd, "settings"));
				{
					gint _tmp10;
					char** key_collection;
					int key_collection_length1;
					int key_it;
					key_collection = plist_dict_keys (gsd, &_tmp10);
					key_collection_length1 = _tmp10;
					for (key_it = 0; key_it < _tmp10; key_it = key_it + 1) {
						const char* _tmp12;
						char* key;
						_tmp12 = NULL;
						key = (_tmp12 = key_collection[key_it], (_tmp12 == NULL) ? NULL : g_strdup (_tmp12));
						{
							PListString* _tmp11;
							_tmp11 = NULL;
							gee_map_set ((GeeMap*) theme->global_settings, key, (_tmp11 = PLIST_STRING (plist_dict_get (gsd, key)))->str);
							(_tmp11 == NULL) ? NULL : (_tmp11 = (g_object_unref (_tmp11), NULL));
							key = (g_free (key), NULL);
						}
					}
					key_collection = (_vala_array_free (key_collection, key_collection_length1, (GDestroyNotify) g_free), NULL);
				}
				(gsd == NULL) ? NULL : (gsd = (g_object_unref (gsd), NULL));
			} else {
				GtkMateThemeSetting* _tmp13;
				_tmp13 = NULL;
				gee_collection_add ((GeeCollection*) theme->settings, _tmp13 = gtk_mate_theme_setting_create_from_plist (nd));
				(_tmp13 == NULL) ? NULL : (_tmp13 = (g_object_unref (_tmp13), NULL));
			}
			(nn == NULL) ? NULL : (nn = (g_object_unref (nn), NULL));
			(nd == NULL) ? NULL : (nd = (g_object_unref (nd), NULL));
		}
		(_nn_it == NULL) ? NULL : (_nn_it = (g_object_unref (_nn_it), NULL));
	}
	_tmp14 = NULL;
	return (_tmp14 = theme, (nm == NULL) ? NULL : (nm = (g_object_unref (nm), NULL)), (na == NULL) ? NULL : (na = (g_object_unref (na), NULL)), _tmp14);
}
예제 #15
0
GeeArrayList* string_helper_occurrences (const char* s, const char* t) {
	GError * _inner_error_;
	GRegex* grx;
	GeeArrayList* poss;
	GMatchInfo* m;
	GeeArrayList* _tmp7_;
	g_return_val_if_fail (s != NULL, NULL);
	g_return_val_if_fail (t != NULL, NULL);
	_inner_error_ = NULL;
	grx = NULL;
	poss = gee_array_list_new (G_TYPE_INT, NULL, NULL, g_direct_equal);
	m = NULL;
	{
		GRegex* _tmp1_;
		char* _tmp0_;
		GMatchInfo* _tmp4_;
		gboolean _tmp3_;
		GMatchInfo* _tmp2_;
		_tmp1_ = NULL;
		_tmp0_ = NULL;
		grx = (_tmp1_ = g_regex_new (_tmp0_ = g_regex_escape_string (t, -1), 0, 0, &_inner_error_), (grx == NULL) ? NULL : (grx = (g_regex_unref (grx), NULL)), _tmp1_);
		if (_inner_error_ != NULL) {
			if (_inner_error_->domain == G_REGEX_ERROR) {
				goto __catch5_g_regex_error;
			}
			goto __finally5;
		}
		_tmp0_ = (g_free (_tmp0_), NULL);
		_tmp4_ = NULL;
		_tmp2_ = NULL;
		if ((_tmp3_ = g_regex_match (grx, s, 0, &_tmp2_), m = (_tmp4_ = _tmp2_, (m == NULL) ? NULL : (m = (g_match_info_free (m), NULL)), _tmp4_), _tmp3_)) {
			gint spos;
			gint epos;
			spos = 0;
			epos = 0;
			g_match_info_fetch_pos (m, 0, &spos, &epos);
			gee_collection_add ((GeeCollection*) poss, GINT_TO_POINTER (spos));
			while (TRUE) {
				gboolean _tmp5_;
				gint mspos;
				gint mepos;
				_tmp5_ = g_match_info_next (m, &_inner_error_);
				if (_inner_error_ != NULL) {
					if (_inner_error_->domain == G_REGEX_ERROR) {
						goto __catch5_g_regex_error;
					}
					goto __finally5;
				}
				if (!_tmp5_) {
					break;
				}
				mspos = 0;
				mepos = 0;
				g_match_info_fetch_pos (m, 0, &mspos, &mepos);
				gee_collection_add ((GeeCollection*) poss, GINT_TO_POINTER (mspos));
			}
		}
	}
	goto __finally5;
	__catch5_g_regex_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		{
			GeeArrayList* _tmp6_;
			_tmp6_ = NULL;
			return (_tmp6_ = gee_array_list_new (G_TYPE_INT, NULL, NULL, g_direct_equal), (e == NULL) ? NULL : (e = (g_error_free (e), NULL)), (grx == NULL) ? NULL : (grx = (g_regex_unref (grx), NULL)), (poss == NULL) ? NULL : (poss = (g_object_unref (poss), NULL)), (m == NULL) ? NULL : (m = (g_match_info_free (m), NULL)), _tmp6_);
		}
	}
	__finally5:
	if (_inner_error_ != NULL) {
		(grx == NULL) ? NULL : (grx = (g_regex_unref (grx), NULL));
		(poss == NULL) ? NULL : (poss = (g_object_unref (poss), NULL));
		(m == NULL) ? NULL : (m = (g_match_info_free (m), NULL));
		g_critical ("file %s: line %d: uncaught error: %s", __FILE__, __LINE__, _inner_error_->message);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	_tmp7_ = NULL;
	return (_tmp7_ = poss, (grx == NULL) ? NULL : (grx = (g_regex_unref (grx), NULL)), (m == NULL) ? NULL : (m = (g_match_info_free (m), NULL)), _tmp7_);
}
예제 #16
0
GtkMateDoublePattern* gtk_mate_double_pattern_create_from_plist (GeeArrayList* all_patterns, PListDict* pd) {
	PListString* ns;
	GtkMateDoublePattern* pattern;
	PListString* _tmp0;
	PListString* _tmp3;
	char* _tmp5;
	const char* _tmp4;
	OnigRx* _tmp6;
	PListString* _tmp7;
	char* _tmp9;
	const char* _tmp8;
	PListString* _tmp10;
	PListNode* n;
	PListNode* _tmp14;
	PListNode* _tmp16;
	GeeHashMap* _tmp17;
	GeeArrayList* _tmp18;
	PListNode* ps;
	GtkMatePattern* subpattern;
	PListNode* _tmp20;
	gboolean _tmp21;
	gboolean _tmp22;
	GtkMateDoublePattern* _tmp25;
	g_return_val_if_fail (all_patterns != NULL, NULL);
	g_return_val_if_fail (pd != NULL, NULL);
	ns = NULL;
	pattern = g_object_ref_sink (gtk_mate_double_pattern_new ());
	_tmp0 = NULL;
	ns = (_tmp0 = PLIST_STRING (plist_dict_get (pd, "name")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp0);
	if (ns != NULL) {
		char* _tmp2;
		const char* _tmp1;
		_tmp2 = NULL;
		_tmp1 = NULL;
		((GtkMatePattern*) pattern)->name = (_tmp2 = (_tmp1 = ns->str, (_tmp1 == NULL) ? NULL : g_strdup (_tmp1)), ((GtkMatePattern*) pattern)->name = (g_free (((GtkMatePattern*) pattern)->name), NULL), _tmp2);
	}
	_tmp3 = NULL;
	ns = (_tmp3 = PLIST_STRING (plist_dict_get (pd, "begin")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3);
	_tmp5 = NULL;
	_tmp4 = NULL;
	pattern->begin_string = (_tmp5 = (_tmp4 = ns->str, (_tmp4 == NULL) ? NULL : g_strdup (_tmp4)), pattern->begin_string = (g_free (pattern->begin_string), NULL), _tmp5);
	_tmp6 = NULL;
	pattern->begin = (_tmp6 = onig_rx_make1 (ns->str), (pattern->begin == NULL) ? NULL : (pattern->begin = (g_object_unref (pattern->begin), NULL)), _tmp6);
	_tmp7 = NULL;
	ns = (_tmp7 = PLIST_STRING (plist_dict_get (pd, "end")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp7);
	_tmp9 = NULL;
	_tmp8 = NULL;
	pattern->end_string = (_tmp9 = (_tmp8 = ns->str, (_tmp8 == NULL) ? NULL : g_strdup (_tmp8)), pattern->end_string = (g_free (pattern->end_string), NULL), _tmp9);
	_tmp10 = NULL;
	ns = (_tmp10 = PLIST_STRING (plist_dict_get (pd, "contentName")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp10);
	if (ns != NULL) {
		char* _tmp12;
		const char* _tmp11;
		_tmp12 = NULL;
		_tmp11 = NULL;
		pattern->content_name = (_tmp12 = (_tmp11 = ns->str, (_tmp11 == NULL) ? NULL : g_strdup (_tmp11)), pattern->content_name = (g_free (pattern->content_name), NULL), _tmp12);
	}
	n = plist_dict_get (pd, "beginCaptures");
	if (n != NULL) {
		GeeHashMap* _tmp13;
		_tmp13 = NULL;
		pattern->begin_captures = (_tmp13 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->begin_captures == NULL) ? NULL : (pattern->begin_captures = (g_object_unref (pattern->begin_captures), NULL)), _tmp13);
	}
	_tmp14 = NULL;
	n = (_tmp14 = plist_dict_get (pd, "captures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp14);
	if (n != NULL) {
		GeeHashMap* _tmp15;
		_tmp15 = NULL;
		pattern->both_captures = (_tmp15 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->both_captures == NULL) ? NULL : (pattern->both_captures = (g_object_unref (pattern->both_captures), NULL)), _tmp15);
	}
	_tmp16 = NULL;
	n = (_tmp16 = plist_dict_get (pd, "endCaptures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp16);
	_tmp17 = NULL;
	pattern->end_captures = (_tmp17 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->end_captures == NULL) ? NULL : (pattern->end_captures = (g_object_unref (pattern->end_captures), NULL)), _tmp17);
	_tmp18 = NULL;
	pattern->patterns = (_tmp18 = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (pattern->patterns == NULL) ? NULL : (pattern->patterns = (g_object_unref (pattern->patterns), NULL)), _tmp18);
	ps = plist_dict_get (pd, "patterns");
	subpattern = NULL;
	if (ps != NULL) {
		{
			GeeIterator* _p_it;
			_p_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (ps)->array);
			while (gee_iterator_next (_p_it)) {
				PListNode* p;
				GtkMatePattern* _tmp19;
				p = (PListNode*) gee_iterator_get (_p_it);
				_tmp19 = NULL;
				subpattern = (_tmp19 = gtk_mate_pattern_create_from_plist (all_patterns, PLIST_DICT (p)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp19);
				if (subpattern != NULL) {
					gee_collection_add ((GeeCollection*) pattern->patterns, subpattern);
				}
				(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
			}
			(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
		}
	}
	_tmp20 = NULL;
	n = (_tmp20 = plist_dict_get (pd, "disabled"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp20);
	_tmp21 = FALSE;
	_tmp22 = FALSE;
	if (n != NULL) {
		_tmp22 = PLIST_IS_INTEGER (n);
	} else {
		_tmp22 = FALSE;
	}
	if (_tmp22) {
		_tmp21 = PLIST_INTEGER (n)->value == 1;
	} else {
		_tmp21 = FALSE;
	}
	if (_tmp21) {
		((GtkMatePattern*) pattern)->disabled = TRUE;
	} else {
		gboolean _tmp23;
		gboolean _tmp24;
		_tmp23 = FALSE;
		_tmp24 = FALSE;
		if (n != NULL) {
			_tmp24 = PLIST_IS_STRING (n);
		} else {
			_tmp24 = FALSE;
		}
		if (_tmp24) {
			_tmp23 = _vala_strcmp0 (PLIST_STRING (n)->str, "1") == 0;
		} else {
			_tmp23 = FALSE;
		}
		if (_tmp23) {
			((GtkMatePattern*) pattern)->disabled = TRUE;
		} else {
			((GtkMatePattern*) pattern)->disabled = FALSE;
		}
	}
	gee_collection_add ((GeeCollection*) all_patterns, (GtkMatePattern*) pattern);
	_tmp25 = NULL;
	return (_tmp25 = pattern, (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), (ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp25);
}
예제 #17
0
GtkMateSinglePattern* gtk_mate_single_pattern_create_from_plist (GeeArrayList* all_patterns, PListDict* pd) {
	PListString* ns;
	GtkMateSinglePattern* pattern;
	PListString* _tmp0;
	PListString* _tmp3;
	OnigRx* _tmp4;
	PListNode* n;
	GeeHashMap* _tmp5;
	PListNode* _tmp6;
	gboolean _tmp7;
	gboolean _tmp8;
	GtkMateSinglePattern* _tmp11;
	g_return_val_if_fail (all_patterns != NULL, NULL);
	g_return_val_if_fail (pd != NULL, NULL);
	ns = NULL;
	pattern = g_object_ref_sink (gtk_mate_single_pattern_new ());
	_tmp0 = NULL;
	ns = (_tmp0 = PLIST_STRING (plist_dict_get (pd, "name")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp0);
	if (ns != NULL) {
		char* _tmp2;
		const char* _tmp1;
		_tmp2 = NULL;
		_tmp1 = NULL;
		((GtkMatePattern*) pattern)->name = (_tmp2 = (_tmp1 = ns->str, (_tmp1 == NULL) ? NULL : g_strdup (_tmp1)), ((GtkMatePattern*) pattern)->name = (g_free (((GtkMatePattern*) pattern)->name), NULL), _tmp2);
	}
	/*stdout.printf("sp: %s\n", ((PList.String) pd.get("name")).str);
	else
	stdout.printf("sp: no name\n");*/
	_tmp3 = NULL;
	ns = (_tmp3 = PLIST_STRING (plist_dict_get (pd, "match")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3);
	_tmp4 = NULL;
	pattern->match = (_tmp4 = onig_rx_make1 (ns->str), (pattern->match == NULL) ? NULL : (pattern->match = (g_object_unref (pattern->match), NULL)), _tmp4);
	n = plist_dict_get (pd, "captures");
	_tmp5 = NULL;
	pattern->captures = (_tmp5 = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->captures == NULL) ? NULL : (pattern->captures = (g_object_unref (pattern->captures), NULL)), _tmp5);
	_tmp6 = NULL;
	n = (_tmp6 = plist_dict_get (pd, "disabled"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp6);
	_tmp7 = FALSE;
	_tmp8 = FALSE;
	if (n != NULL) {
		_tmp8 = PLIST_IS_INTEGER (n);
	} else {
		_tmp8 = FALSE;
	}
	if (_tmp8) {
		_tmp7 = PLIST_INTEGER (n)->value == 1;
	} else {
		_tmp7 = FALSE;
	}
	if (_tmp7) {
		((GtkMatePattern*) pattern)->disabled = TRUE;
	} else {
		gboolean _tmp9;
		gboolean _tmp10;
		_tmp9 = FALSE;
		_tmp10 = FALSE;
		if (n != NULL) {
			_tmp10 = PLIST_IS_STRING (n);
		} else {
			_tmp10 = FALSE;
		}
		if (_tmp10) {
			_tmp9 = _vala_strcmp0 (PLIST_STRING (n)->str, "1") == 0;
		} else {
			_tmp9 = FALSE;
		}
		if (_tmp9) {
			((GtkMatePattern*) pattern)->disabled = TRUE;
		} else {
			((GtkMatePattern*) pattern)->disabled = FALSE;
		}
	}
	gee_collection_add ((GeeCollection*) all_patterns, (GtkMatePattern*) pattern);
	_tmp11 = NULL;
	return (_tmp11 = pattern, (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp11);
}
예제 #18
0
int main (int argc, char *argv[])
{
    RygelMediaServer *server;
    RygelSimpleContainer *root_container;
    char *path;
    GFile *source_dir;
    GFileEnumerator *enumerator;
    GFileInfo *info;
    int i;
    GMainLoop *loop;
    GError *error = NULL;

//     g_type_init ();

    rygel_media_engine_init (&error);

    if (error != NULL) {
        g_print ("Could not initialize media engine: %s\n",
                 error->message);
        g_error_free (error);

        return EXIT_FAILURE;
    }

    g_set_application_name ("Standalone-Server");

    root_container = rygel_simple_container_new_root ("Sample implementation");
    if (argc >= 2) {
        path = g_strdup (argv[1]);
    } else {
        path = g_get_current_dir ();
    }

    source_dir = g_file_new_for_commandline_arg (path);
    g_free (path);

    enumerator = g_file_enumerate_children (source_dir,
                                            G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME ","
                                            G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
                                            G_FILE_QUERY_INFO_NONE,
                                            NULL,
                                            NULL);
    info = g_file_enumerator_next_file (enumerator, NULL, NULL);
    i = 0;
    while (info != NULL) {
        GFile *file;
        const char *display_name, *content_type;
        char *uri, *id;
        RygelMediaItem *item = NULL;
        GError *error = NULL;

        display_name = g_file_info_get_display_name (info);
        content_type = g_file_info_get_content_type (info);
        file = g_file_get_child_for_display_name (source_dir, display_name, &error);
        if (error != NULL) {
            g_critical ("Failed to get child: %s", error->message);

            return 127;
        }
        uri = g_file_get_uri (file);
        g_object_unref (file);
        id = g_strdup_printf ("%06d", i);

        if (g_str_has_prefix (content_type, "audio/")) {
            item = (RygelMediaItem*)rygel_audio_item_new (id,
                                         (RygelMediaContainer*)root_container,
                                         display_name,
                                         RYGEL_AUDIO_ITEM_UPNP_CLASS);
        } else if (g_str_has_prefix (content_type, "video/")) {
            item = (RygelMediaItem*)rygel_video_item_new (id,
                                         (RygelMediaContainer*)root_container,
                                         display_name,
                                         RYGEL_VIDEO_ITEM_UPNP_CLASS);
        } else if (g_str_has_prefix (content_type, "image/")) {
            item = (RygelMediaItem*)rygel_image_item_new (id,
                                         (RygelMediaContainer*)root_container,
                                         display_name,
                                         RYGEL_IMAGE_ITEM_UPNP_CLASS);
        }
        g_free (id);

        if (item != NULL) {
            RygelMediaObject *object;
            GeeArrayList* uris;

            rygel_media_item_set_mime_type (RYGEL_MEDIA_ITEM (item), content_type);

            object = RYGEL_MEDIA_OBJECT (item);
            gee_collection_add (GEE_COLLECTION (object->uris), uri);

            rygel_simple_container_add_child_item (root_container, item);
        }

        i++;
        info = g_file_enumerator_next_file (enumerator, NULL, NULL);
    }

    server = rygel_media_server_new ("Single purpose server",
                                     (RygelMediaContainer*)root_container,
                                     RYGEL_PLUGIN_CAPABILITIES_NONE);
    rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (server), "eth0");
    rygel_media_device_add_interface (RYGEL_MEDIA_DEVICE (server), "wlan0");

    loop = g_main_loop_new (NULL, FALSE);
    g_main_loop_run (loop);
}
예제 #19
0
void gtk_mate_pattern_replace_base_and_self_includes (GeeArrayList* patlist, GtkMateGrammar* g) {
	GeeArrayList* include_patterns;
	GeeArrayList* patterns_to_include;
	gboolean already_self;
	GtkMateGrammar* ng;
	g_return_if_fail (patlist != NULL);
	g_return_if_fail (g != NULL);
	include_patterns = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal);
	patterns_to_include = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal);
	already_self = FALSE;
	/* some patterns have $self twice*/
	ng = NULL;
	{
		GeeIterator* _p_it;
		_p_it = gee_iterable_iterator ((GeeIterable*) patlist);
		while (gee_iterator_next (_p_it)) {
			GtkMatePattern* p;
			p = (GtkMatePattern*) gee_iterator_get (_p_it);
			if (GTK_MATE_IS_INCLUDE_PATTERN (p)) {
				if (g_str_has_prefix (p->name, "$")) {
					gboolean _tmp0;
					gboolean _tmp1;
					gee_collection_add ((GeeCollection*) include_patterns, p);
					_tmp0 = FALSE;
					_tmp1 = FALSE;
					if (_vala_strcmp0 (p->name, "$self") == 0) {
						_tmp1 = TRUE;
					} else {
						_tmp1 = _vala_strcmp0 (p->name, "$base") == 0;
					}
					if (_tmp1) {
						_tmp0 = !already_self;
					} else {
						_tmp0 = FALSE;
					}
					if (_tmp0) {
						already_self = TRUE;
						{
							GeeIterator* _pat_it;
							_pat_it = gee_iterable_iterator ((GeeIterable*) g->patterns);
							while (gee_iterator_next (_pat_it)) {
								GtkMatePattern* pat;
								pat = (GtkMatePattern*) gee_iterator_get (_pat_it);
								gee_collection_add ((GeeCollection*) patterns_to_include, pat);
								(pat == NULL) ? NULL : (pat = (g_object_unref (pat), NULL));
							}
							(_pat_it == NULL) ? NULL : (_pat_it = (g_object_unref (_pat_it), NULL));
						}
					}
				} else {
					GtkMateGrammar* _tmp2;
					_tmp2 = NULL;
					if ((ng = (_tmp2 = gtk_mate_grammar_find_by_scope_name (p->name), (ng == NULL) ? NULL : (ng = (g_object_unref (ng), NULL)), _tmp2)) != NULL) {
						gtk_mate_grammar_init_for_use (ng);
						gee_collection_add ((GeeCollection*) include_patterns, p);
						{
							GeeIterator* _pat_it;
							_pat_it = gee_iterable_iterator ((GeeIterable*) ng->patterns);
							while (gee_iterator_next (_pat_it)) {
								GtkMatePattern* pat;
								pat = (GtkMatePattern*) gee_iterator_get (_pat_it);
								gee_collection_add ((GeeCollection*) patterns_to_include, pat);
								(pat == NULL) ? NULL : (pat = (g_object_unref (pat), NULL));
							}
							(_pat_it == NULL) ? NULL : (_pat_it = (g_object_unref (_pat_it), NULL));
						}
					} else {
					}
				}
			}
			(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
		}
		(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
	}
	/*stdout.printf("unknown include pattern: %s\n", p.name);*/
	gtk_mate_pattern_remove_patterns (patlist, include_patterns);
	gtk_mate_pattern_add_patterns (patlist, patterns_to_include);
	(include_patterns == NULL) ? NULL : (include_patterns = (g_object_unref (include_patterns), NULL));
	(patterns_to_include == NULL) ? NULL : (patterns_to_include = (g_object_unref (patterns_to_include), NULL));
	(ng == NULL) ? NULL : (ng = (g_object_unref (ng), NULL));
}
예제 #20
0
void gtk_mate_pattern_replace_repository_includes (GeeArrayList* patlist, GtkMateGrammar* g) {
	GeeArrayList* include_patterns;
	GeeArrayList* patterns_to_include;
	gboolean any_included;
	g_return_if_fail (patlist != NULL);
	g_return_if_fail (g != NULL);
	include_patterns = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal);
	patterns_to_include = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal);
	any_included = TRUE;
	while (any_included) {
		/* stdout.printf("repo replacement pass\n");*/
		any_included = FALSE;
		{
			GeeIterator* _p_it;
			_p_it = gee_iterable_iterator ((GeeIterable*) patlist);
			while (gee_iterator_next (_p_it)) {
				GtkMatePattern* p;
				gboolean _tmp0;
				p = (GtkMatePattern*) gee_iterator_get (_p_it);
				_tmp0 = FALSE;
				if (GTK_MATE_IS_INCLUDE_PATTERN (p)) {
					_tmp0 = g_str_has_prefix (p->name, "#");
				} else {
					_tmp0 = FALSE;
				}
				if (_tmp0) {
					char* reponame;
					GeeArrayList* ps;
					gee_collection_add ((GeeCollection*) include_patterns, p);
					reponame = string_substring (p->name, (glong) 1, (glong) (((gint) strlen (p->name)) - 1));
					ps = (GeeArrayList*) gee_map_get ((GeeMap*) g->repository, reponame);
					/* stdout.printf("(%s) getting reponame: %s (%d)\n", this.name, reponame, ps.size);*/
					if (ps != NULL) {
						{
							GeeIterator* _p1_it;
							_p1_it = gee_iterable_iterator ((GeeIterable*) ps);
							while (gee_iterator_next (_p1_it)) {
								GtkMatePattern* p1;
								p1 = (GtkMatePattern*) gee_iterator_get (_p1_it);
								any_included = TRUE;
								gee_collection_add ((GeeCollection*) patterns_to_include, p1);
								(p1 == NULL) ? NULL : (p1 = (g_object_unref (p1), NULL));
							}
							(_p1_it == NULL) ? NULL : (_p1_it = (g_object_unref (_p1_it), NULL));
						}
					} else {
						fprintf (stdout, "warning: couldn't find repository key '%s' in grammar '%s'\n", reponame, gtk_mate_grammar_get_name (g));
					}
					reponame = (g_free (reponame), NULL);
					(ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL));
				}
				(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
			}
			(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
		}
		gtk_mate_pattern_remove_patterns (patlist, include_patterns);
		gtk_mate_pattern_add_patterns (patlist, patterns_to_include);
		gee_collection_clear ((GeeCollection*) include_patterns);
		gee_collection_clear ((GeeCollection*) patterns_to_include);
	}
	(include_patterns == NULL) ? NULL : (include_patterns = (g_object_unref (include_patterns), NULL));
	(patterns_to_include == NULL) ? NULL : (patterns_to_include = (g_object_unref (patterns_to_include), NULL));
}
예제 #21
0
GeeArrayList* gtk_mate_matcher_compile (const char* selector_string) {
	GeeArrayList* ms;
	char** _tmp1;
	gint scope_ors1_size;
	gint scope_ors1_length1;
	char** _tmp0;
	char** scope_ors1;
	GeeArrayList* _tmp11;
	g_return_val_if_fail (selector_string != NULL, NULL);
	ms = gee_array_list_new (GTK_MATE_TYPE_MATCHER, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal);
	/* FIXME should validate and throw UTF8 error if bad.*/
	_tmp1 = NULL;
	_tmp0 = NULL;
	scope_ors1 = (_tmp1 = _tmp0 = g_strsplit (selector_string, ",", 0), scope_ors1_length1 = _vala_array_length (_tmp0), scope_ors1_size = scope_ors1_length1, _tmp1);
	/*stdout.printf("match: selector: '%s', scope: '%s'\n", selector_string, scope_string);*/
	{
		char** selector_string1_collection;
		int selector_string1_collection_length1;
		int selector_string1_it;
		selector_string1_collection = scope_ors1;
		selector_string1_collection_length1 = scope_ors1_length1;
		for (selector_string1_it = 0; selector_string1_it < scope_ors1_length1; selector_string1_it = selector_string1_it + 1) {
			const char* _tmp10;
			char* selector_string1;
			_tmp10 = NULL;
			selector_string1 = (_tmp10 = selector_string1_collection[selector_string1_it], (_tmp10 == NULL) ? NULL : g_strdup (_tmp10));
			{
				GtkMateMatcher* m;
				GeeArrayList* _tmp2;
				char** _tmp4;
				gint positives_and_negatives_size;
				gint positives_and_negatives_length1;
				char** _tmp3;
				char** positives_and_negatives;
				m = g_object_ref_sink (gtk_mate_matcher_new ());
				_tmp2 = NULL;
				m->neg_rxs = (_tmp2 = gee_array_list_new (ONIG_TYPE_RX, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (m->neg_rxs == NULL) ? NULL : (m->neg_rxs = (g_object_unref (m->neg_rxs), NULL)), _tmp2);
				_tmp4 = NULL;
				_tmp3 = NULL;
				positives_and_negatives = (_tmp4 = _tmp3 = g_strsplit (selector_string1, " -", 0), positives_and_negatives_length1 = _vala_array_length (_tmp3), positives_and_negatives_size = positives_and_negatives_length1, _tmp4);
				{
					char** sub_selector_string_collection;
					int sub_selector_string_collection_length1;
					int sub_selector_string_it;
					sub_selector_string_collection = positives_and_negatives;
					sub_selector_string_collection_length1 = positives_and_negatives_length1;
					for (sub_selector_string_it = 0; sub_selector_string_it < positives_and_negatives_length1; sub_selector_string_it = sub_selector_string_it + 1) {
						const char* _tmp9;
						char* sub_selector_string;
						_tmp9 = NULL;
						sub_selector_string = (_tmp9 = sub_selector_string_collection[sub_selector_string_it], (_tmp9 == NULL) ? NULL : g_strdup (_tmp9));
						{
							if (m->pos_rx == NULL) {
								char* s1;
								char* s2;
								OnigRx* _tmp7;
								char* _tmp6;
								char* _tmp5;
								s1 = string_helper_gsub (g_strstrip (sub_selector_string), ".", "\\.");
								s2 = string_helper_gsub (s1, " ", ").* .*(");
								/*stdout.printf("positive '%s' -> '%s'\n", selector_string, "("+s2+")");*/
								_tmp7 = NULL;
								_tmp6 = NULL;
								_tmp5 = NULL;
								m->pos_rx = (_tmp7 = onig_rx_make1 (_tmp6 = g_strconcat (_tmp5 = g_strconcat ("(", s2, NULL), ")", NULL)), (m->pos_rx == NULL) ? NULL : (m->pos_rx = (g_object_unref (m->pos_rx), NULL)), _tmp7);
								_tmp6 = (g_free (_tmp6), NULL);
								_tmp5 = (g_free (_tmp5), NULL);
								s1 = (g_free (s1), NULL);
								s2 = (g_free (s2), NULL);
							} else {
								char* s1;
								char* s2;
								OnigRx* _tmp8;
								s1 = string_helper_gsub (g_strstrip (sub_selector_string), ".", "\\.");
								s2 = string_helper_gsub (s1, " ", ".* .*");
								/*stdout.printf("negative '%s' -> '%s'\n", selector_string, s2);*/
								_tmp8 = NULL;
								gee_collection_add ((GeeCollection*) m->neg_rxs, _tmp8 = onig_rx_make1 (s2));
								(_tmp8 == NULL) ? NULL : (_tmp8 = (g_object_unref (_tmp8), NULL));
								s1 = (g_free (s1), NULL);
								s2 = (g_free (s2), NULL);
							}
							sub_selector_string = (g_free (sub_selector_string), NULL);
						}
					}
				}
				gee_collection_add ((GeeCollection*) ms, m);
				selector_string1 = (g_free (selector_string1), NULL);
				(m == NULL) ? NULL : (m = (g_object_unref (m), NULL));
				positives_and_negatives = (_vala_array_free (positives_and_negatives, positives_and_negatives_length1, (GDestroyNotify) g_free), NULL);
			}
		}
	}
	_tmp11 = NULL;
	return (_tmp11 = ms, scope_ors1 = (_vala_array_free (scope_ors1, scope_ors1_length1, (GDestroyNotify) g_free), NULL), _tmp11);
}
예제 #22
0
GtkMateDoublePattern* gtk_mate_double_pattern_create_from_plist (GeeArrayList* all_patterns, PListDict* pd) {
	PListString* ns;
	GtkMateDoublePattern* pattern;
	PListString* _tmp0_;
	PListString* _tmp3_;
	char* _tmp5_;
	const char* _tmp4_;
	OnigRx* _tmp6_;
	PListString* _tmp7_;
	char* _tmp9_;
	const char* _tmp8_;
	PListString* _tmp10_;
	PListNode* n;
	PListNode* _tmp14_;
	PListNode* _tmp16_;
	GeeHashMap* _tmp17_;
	GeeArrayList* _tmp18_;
	PListNode* ps;
	GtkMatePattern* subpattern;
	PListNode* _tmp20_;
	gboolean _tmp21_;
	gboolean _tmp22_;
	GtkMateDoublePattern* _tmp25_;
	g_return_val_if_fail (all_patterns != NULL, NULL);
	g_return_val_if_fail (pd != NULL, NULL);
	ns = NULL;
	pattern = g_object_ref_sink (gtk_mate_double_pattern_new ());
	_tmp0_ = NULL;
	ns = (_tmp0_ = PLIST_STRING (plist_dict_get (pd, "name")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp0_);
	if (ns != NULL) {
		char* _tmp2_;
		const char* _tmp1_;
		_tmp2_ = NULL;
		_tmp1_ = NULL;
		((GtkMatePattern*) pattern)->name = (_tmp2_ = (_tmp1_ = ns->str, (_tmp1_ == NULL) ? NULL : g_strdup (_tmp1_)), ((GtkMatePattern*) pattern)->name = (g_free (((GtkMatePattern*) pattern)->name), NULL), _tmp2_);
	}
	_tmp3_ = NULL;
	ns = (_tmp3_ = PLIST_STRING (plist_dict_get (pd, "begin")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp3_);
	_tmp5_ = NULL;
	_tmp4_ = NULL;
	pattern->begin_string = (_tmp5_ = (_tmp4_ = ns->str, (_tmp4_ == NULL) ? NULL : g_strdup (_tmp4_)), pattern->begin_string = (g_free (pattern->begin_string), NULL), _tmp5_);
	_tmp6_ = NULL;
	pattern->begin = (_tmp6_ = onig_rx_make1 (ns->str), (pattern->begin == NULL) ? NULL : (pattern->begin = (g_object_unref (pattern->begin), NULL)), _tmp6_);
	_tmp7_ = NULL;
	ns = (_tmp7_ = PLIST_STRING (plist_dict_get (pd, "end")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp7_);
	_tmp9_ = NULL;
	_tmp8_ = NULL;
	pattern->end_string = (_tmp9_ = (_tmp8_ = ns->str, (_tmp8_ == NULL) ? NULL : g_strdup (_tmp8_)), pattern->end_string = (g_free (pattern->end_string), NULL), _tmp9_);
	_tmp10_ = NULL;
	ns = (_tmp10_ = PLIST_STRING (plist_dict_get (pd, "contentName")), (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), _tmp10_);
	if (ns != NULL) {
		char* _tmp12_;
		const char* _tmp11_;
		_tmp12_ = NULL;
		_tmp11_ = NULL;
		pattern->content_name = (_tmp12_ = (_tmp11_ = ns->str, (_tmp11_ == NULL) ? NULL : g_strdup (_tmp11_)), pattern->content_name = (g_free (pattern->content_name), NULL), _tmp12_);
	}
	n = plist_dict_get (pd, "beginCaptures");
	if (n != NULL) {
		GeeHashMap* _tmp13_;
		_tmp13_ = NULL;
		pattern->begin_captures = (_tmp13_ = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->begin_captures == NULL) ? NULL : (pattern->begin_captures = (g_object_unref (pattern->begin_captures), NULL)), _tmp13_);
	}
	_tmp14_ = NULL;
	n = (_tmp14_ = plist_dict_get (pd, "captures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp14_);
	if (n != NULL) {
		GeeHashMap* _tmp15_;
		_tmp15_ = NULL;
		pattern->both_captures = (_tmp15_ = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->both_captures == NULL) ? NULL : (pattern->both_captures = (g_object_unref (pattern->both_captures), NULL)), _tmp15_);
	}
	_tmp16_ = NULL;
	n = (_tmp16_ = plist_dict_get (pd, "endCaptures"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp16_);
	_tmp17_ = NULL;
	pattern->end_captures = (_tmp17_ = gtk_mate_pattern_make_captures_from_plist (PLIST_DICT (n)), (pattern->end_captures == NULL) ? NULL : (pattern->end_captures = (g_object_unref (pattern->end_captures), NULL)), _tmp17_);
	_tmp18_ = NULL;
	pattern->patterns = (_tmp18_ = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (pattern->patterns == NULL) ? NULL : (pattern->patterns = (g_object_unref (pattern->patterns), NULL)), _tmp18_);
	ps = plist_dict_get (pd, "patterns");
	subpattern = NULL;
	if (ps != NULL) {
		{
			GeeIterator* _p_it;
			_p_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (ps)->array);
			while (gee_iterator_next (_p_it)) {
				PListNode* p;
				GtkMatePattern* _tmp19_;
				p = (PListNode*) gee_iterator_get (_p_it);
				_tmp19_ = NULL;
				subpattern = (_tmp19_ = gtk_mate_pattern_create_from_plist (all_patterns, PLIST_DICT (p)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp19_);
				if (subpattern != NULL) {
					gee_collection_add ((GeeCollection*) pattern->patterns, subpattern);
				}
				(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
			}
			(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
		}
	}
	_tmp20_ = NULL;
	n = (_tmp20_ = plist_dict_get (pd, "disabled"), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), _tmp20_);
	_tmp21_ = FALSE;
	_tmp22_ = FALSE;
	if (n != NULL) {
		_tmp22_ = PLIST_IS_INTEGER (n);
	} else {
		_tmp22_ = FALSE;
	}
	if (_tmp22_) {
		_tmp21_ = PLIST_INTEGER (n)->value == 1;
	} else {
		_tmp21_ = FALSE;
	}
	if (_tmp21_) {
		((GtkMatePattern*) pattern)->disabled = TRUE;
	} else {
		gboolean _tmp23_;
		gboolean _tmp24_;
		_tmp23_ = FALSE;
		_tmp24_ = FALSE;
		if (n != NULL) {
			_tmp24_ = PLIST_IS_STRING (n);
		} else {
			_tmp24_ = FALSE;
		}
		if (_tmp24_) {
			_tmp23_ = _vala_strcmp0 (PLIST_STRING (n)->str, "1") == 0;
		} else {
			_tmp23_ = FALSE;
		}
		if (_tmp23_) {
			((GtkMatePattern*) pattern)->disabled = TRUE;
		} else {
			((GtkMatePattern*) pattern)->disabled = FALSE;
		}
	}
	gee_collection_add ((GeeCollection*) all_patterns, (GtkMatePattern*) pattern);
	_tmp25_ = NULL;
	return (_tmp25_ = pattern, (ns == NULL) ? NULL : (ns = (g_object_unref (ns), NULL)), (n == NULL) ? NULL : (n = (g_object_unref (n), NULL)), (ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL)), (subpattern == NULL) ? NULL : (subpattern = (g_object_unref (subpattern), NULL)), _tmp25_);
}
예제 #23
0
void rygel_plugin_add_resource (RygelPlugin* self, RygelResourceInfo* resource_info) {
	g_return_if_fail (self != NULL);
	g_return_if_fail (resource_info != NULL);
	gee_collection_add ((GeeCollection*) self->resource_infos, resource_info);
	gupnp_resource_factory_register_resource_type ((GUPnPResourceFactory*) self, resource_info->upnp_type, resource_info->type);
}
예제 #24
0
파일: map-file.c 프로젝트: pkg-ime/libskk
static void skk_map_file_load (SkkMapFile* self, const gchar* rule, const gchar* type, const gchar* name, GeeSet* included, GError** error) {
	const gchar* _tmp0_;
	SkkRuleMetadata* _tmp1_ = NULL;
	SkkRuleMetadata* metadata;
	SkkRuleMetadata* _tmp2_;
	SkkRuleMetadata* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_ = NULL;
	gchar* _tmp12_;
	gchar* filename;
	const gchar* _tmp13_;
	gboolean _tmp14_ = FALSE;
	JsonParser* _tmp17_;
	JsonParser* parser;
	JsonParser* _tmp30_;
	JsonNode* _tmp31_ = NULL;
	JsonNode* _tmp32_;
	JsonNode* root;
	JsonNode* _tmp33_;
	JsonNodeType _tmp34_ = 0;
	JsonNode* _tmp36_;
	JsonObject* _tmp37_ = NULL;
	JsonObject* _tmp38_;
	JsonObject* object;
	JsonNode* member = NULL;
	JsonObject* _tmp39_;
	gboolean _tmp40_ = FALSE;
	JsonObject* _tmp83_;
	gboolean _tmp84_ = FALSE;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (rule != NULL);
	g_return_if_fail (type != NULL);
	g_return_if_fail (name != NULL);
	g_return_if_fail (included != NULL);
	_tmp0_ = rule;
	_tmp1_ = skk_rule_find_rule (_tmp0_);
	metadata = _tmp1_;
	_tmp2_ = metadata;
	if (_tmp2_ == NULL) {
		const gchar* _tmp3_;
		GError* _tmp4_;
		_tmp3_ = rule;
		_tmp4_ = g_error_new (SKK_RULE_PARSE_ERROR, SKK_RULE_PARSE_ERROR_FAILED, "can't find rule %s", _tmp3_);
		_inner_error_ = _tmp4_;
		if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
			g_propagate_error (error, _inner_error_);
			_skk_rule_metadata_free0 (metadata);
			return;
		} else {
			_skk_rule_metadata_free0 (metadata);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp5_ = metadata;
	_tmp6_ = (*_tmp5_).base_dir;
	_tmp7_ = type;
	_tmp8_ = name;
	_tmp9_ = g_strconcat (_tmp8_, ".json", NULL);
	_tmp10_ = _tmp9_;
	_tmp11_ = g_build_filename (_tmp6_, _tmp7_, _tmp10_, NULL);
	_tmp12_ = _tmp11_;
	_g_free0 (_tmp10_);
	filename = _tmp12_;
	_tmp13_ = filename;
	_tmp14_ = g_file_test (_tmp13_, G_FILE_TEST_EXISTS);
	if (!_tmp14_) {
		const gchar* _tmp15_;
		GError* _tmp16_;
		_tmp15_ = filename;
		_tmp16_ = g_error_new (SKK_RULE_PARSE_ERROR, SKK_RULE_PARSE_ERROR_FAILED, "no such file %s", _tmp15_);
		_inner_error_ = _tmp16_;
		if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_free0 (filename);
			_skk_rule_metadata_free0 (metadata);
			return;
		} else {
			_g_free0 (filename);
			_skk_rule_metadata_free0 (metadata);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp17_ = json_parser_new ();
	parser = _tmp17_;
	{
		JsonParser* _tmp18_;
		const gchar* _tmp19_;
		gboolean _tmp20_ = FALSE;
		gboolean _tmp21_;
		_tmp18_ = parser;
		_tmp19_ = filename;
		_tmp20_ = json_parser_load_from_file (_tmp18_, _tmp19_, &_inner_error_);
		_tmp21_ = _tmp20_;
		if (_inner_error_ != NULL) {
			goto __catch28_g_error;
		}
		if (!_tmp21_) {
			GError* _tmp22_;
			_tmp22_ = g_error_new_literal (SKK_RULE_PARSE_ERROR, SKK_RULE_PARSE_ERROR_FAILED, "");
			_inner_error_ = _tmp22_;
			goto __catch28_g_error;
		}
	}
	goto __finally28;
	__catch28_g_error:
	{
		GError* e = NULL;
		const gchar* _tmp23_;
		GError* _tmp24_;
		const gchar* _tmp25_;
		gchar* _tmp26_ = NULL;
		gchar* _tmp27_;
		GError* _tmp28_;
		GError* _tmp29_;
		e = _inner_error_;
		_inner_error_ = NULL;
		_tmp23_ = filename;
		_tmp24_ = e;
		_tmp25_ = _tmp24_->message;
		_tmp26_ = g_strdup_printf ("can't load %s: %s", _tmp23_, _tmp25_);
		_tmp27_ = _tmp26_;
		_tmp28_ = g_error_new_literal (SKK_RULE_PARSE_ERROR, SKK_RULE_PARSE_ERROR_FAILED, _tmp27_);
		_tmp29_ = _tmp28_;
		_g_free0 (_tmp27_);
		_inner_error_ = _tmp29_;
		_g_error_free0 (e);
		goto __finally28;
	}
	__finally28:
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_object_unref0 (parser);
			_g_free0 (filename);
			_skk_rule_metadata_free0 (metadata);
			return;
		} else {
			_g_object_unref0 (parser);
			_g_free0 (filename);
			_skk_rule_metadata_free0 (metadata);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp30_ = parser;
	_tmp31_ = json_parser_get_root (_tmp30_);
	_tmp32_ = __vala_JsonNode_copy0 (_tmp31_);
	root = _tmp32_;
	_tmp33_ = root;
	_tmp34_ = json_node_get_node_type (_tmp33_);
	if (_tmp34_ != JSON_NODE_OBJECT) {
		GError* _tmp35_;
		_tmp35_ = g_error_new_literal (SKK_RULE_PARSE_ERROR, SKK_RULE_PARSE_ERROR_FAILED, "root element must be an object");
		_inner_error_ = _tmp35_;
		if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
			g_propagate_error (error, _inner_error_);
			__vala_JsonNode_free0 (root);
			_g_object_unref0 (parser);
			_g_free0 (filename);
			_skk_rule_metadata_free0 (metadata);
			return;
		} else {
			__vala_JsonNode_free0 (root);
			_g_object_unref0 (parser);
			_g_free0 (filename);
			_skk_rule_metadata_free0 (metadata);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp36_ = root;
	_tmp37_ = json_node_get_object (_tmp36_);
	_tmp38_ = __vala_JsonObject_copy0 (_tmp37_);
	object = _tmp38_;
	_tmp39_ = object;
	_tmp40_ = json_object_has_member (_tmp39_, "include");
	if (_tmp40_) {
		JsonObject* _tmp41_;
		JsonNode* _tmp42_ = NULL;
		JsonNode* _tmp43_;
		JsonNode* _tmp44_;
		JsonNodeType _tmp45_ = 0;
		JsonNode* _tmp47_;
		JsonArray* _tmp48_ = NULL;
		JsonArray* _tmp49_;
		JsonArray* include;
		JsonArray* _tmp50_;
		GList* _tmp51_ = NULL;
		GList* elements;
		GList* _tmp52_;
		_tmp41_ = object;
		_tmp42_ = json_object_get_member (_tmp41_, "include");
		_tmp43_ = __vala_JsonNode_copy0 (_tmp42_);
		__vala_JsonNode_free0 (member);
		member = _tmp43_;
		_tmp44_ = member;
		_tmp45_ = json_node_get_node_type (_tmp44_);
		if (_tmp45_ != JSON_NODE_ARRAY) {
			GError* _tmp46_;
			_tmp46_ = g_error_new_literal (SKK_RULE_PARSE_ERROR, SKK_RULE_PARSE_ERROR_FAILED, "\"include\" element must be an array");
			_inner_error_ = _tmp46_;
			if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
				g_propagate_error (error, _inner_error_);
				__vala_JsonNode_free0 (member);
				__vala_JsonObject_free0 (object);
				__vala_JsonNode_free0 (root);
				_g_object_unref0 (parser);
				_g_free0 (filename);
				_skk_rule_metadata_free0 (metadata);
				return;
			} else {
				__vala_JsonNode_free0 (member);
				__vala_JsonObject_free0 (object);
				__vala_JsonNode_free0 (root);
				_g_object_unref0 (parser);
				_g_free0 (filename);
				_skk_rule_metadata_free0 (metadata);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return;
			}
		}
		_tmp47_ = member;
		_tmp48_ = json_node_get_array (_tmp47_);
		_tmp49_ = __vala_JsonArray_copy0 (_tmp48_);
		include = _tmp49_;
		_tmp50_ = include;
		_tmp51_ = json_array_get_elements (_tmp50_);
		elements = _tmp51_;
		_tmp52_ = elements;
		{
			GList* element_collection = NULL;
			GList* element_it = NULL;
			element_collection = _tmp52_;
			for (element_it = element_collection; element_it != NULL; element_it = element_it->next) {
				JsonNode* element = NULL;
				element = (JsonNode*) element_it->data;
				{
					JsonNode* _tmp53_;
					const gchar* _tmp54_ = NULL;
					gchar* _tmp55_;
					gchar* parent;
					GeeSet* _tmp56_;
					const gchar* _tmp57_;
					gboolean _tmp58_ = FALSE;
					const gchar* _tmp61_;
					gint _tmp62_ = 0;
					gint index;
					gint _tmp63_;
					GeeSet* _tmp81_;
					const gchar* _tmp82_;
					_tmp53_ = element;
					_tmp54_ = json_node_get_string (_tmp53_);
					_tmp55_ = g_strdup (_tmp54_);
					parent = _tmp55_;
					_tmp56_ = included;
					_tmp57_ = parent;
					_tmp58_ = gee_collection_contains ((GeeCollection*) _tmp56_, _tmp57_);
					if (_tmp58_) {
						const gchar* _tmp59_;
						GError* _tmp60_;
						_tmp59_ = parent;
						_tmp60_ = g_error_new (SKK_RULE_PARSE_ERROR, SKK_RULE_PARSE_ERROR_FAILED, "found circular include of %s", _tmp59_);
						_inner_error_ = _tmp60_;
						if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
							g_propagate_error (error, _inner_error_);
							_g_free0 (parent);
							_g_list_free0 (elements);
							__vala_JsonArray_free0 (include);
							__vala_JsonNode_free0 (member);
							__vala_JsonObject_free0 (object);
							__vala_JsonNode_free0 (root);
							_g_object_unref0 (parser);
							_g_free0 (filename);
							_skk_rule_metadata_free0 (metadata);
							return;
						} else {
							_g_free0 (parent);
							_g_list_free0 (elements);
							__vala_JsonArray_free0 (include);
							__vala_JsonNode_free0 (member);
							__vala_JsonObject_free0 (object);
							__vala_JsonNode_free0 (root);
							_g_object_unref0 (parser);
							_g_free0 (filename);
							_skk_rule_metadata_free0 (metadata);
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
							g_clear_error (&_inner_error_);
							return;
						}
					}
					_tmp61_ = parent;
					_tmp62_ = string_index_of (_tmp61_, "/", 0);
					index = _tmp62_;
					_tmp63_ = index;
					if (_tmp63_ < 0) {
						const gchar* _tmp64_;
						const gchar* _tmp65_;
						const gchar* _tmp66_;
						GeeSet* _tmp67_;
						_tmp64_ = rule;
						_tmp65_ = type;
						_tmp66_ = parent;
						_tmp67_ = included;
						skk_map_file_load (self, _tmp64_, _tmp65_, _tmp66_, _tmp67_, &_inner_error_);
						if (_inner_error_ != NULL) {
							if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
								g_propagate_error (error, _inner_error_);
								_g_free0 (parent);
								_g_list_free0 (elements);
								__vala_JsonArray_free0 (include);
								__vala_JsonNode_free0 (member);
								__vala_JsonObject_free0 (object);
								__vala_JsonNode_free0 (root);
								_g_object_unref0 (parser);
								_g_free0 (filename);
								_skk_rule_metadata_free0 (metadata);
								return;
							} else {
								_g_free0 (parent);
								_g_list_free0 (elements);
								__vala_JsonArray_free0 (include);
								__vala_JsonNode_free0 (member);
								__vala_JsonObject_free0 (object);
								__vala_JsonNode_free0 (root);
								_g_object_unref0 (parser);
								_g_free0 (filename);
								_skk_rule_metadata_free0 (metadata);
								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
								g_clear_error (&_inner_error_);
								return;
							}
						}
					} else {
						const gchar* _tmp68_;
						gint _tmp69_;
						gchar* _tmp70_ = NULL;
						gchar* _tmp71_;
						const gchar* _tmp72_;
						const gchar* _tmp73_;
						gint _tmp74_;
						const gchar* _tmp75_;
						gint _tmp76_;
						gint _tmp77_;
						gchar* _tmp78_ = NULL;
						gchar* _tmp79_;
						GeeSet* _tmp80_;
						_tmp68_ = parent;
						_tmp69_ = index;
						_tmp70_ = string_slice (_tmp68_, (glong) 0, (glong) _tmp69_);
						_tmp71_ = _tmp70_;
						_tmp72_ = type;
						_tmp73_ = parent;
						_tmp74_ = index;
						_tmp75_ = parent;
						_tmp76_ = strlen (_tmp75_);
						_tmp77_ = _tmp76_;
						_tmp78_ = string_slice (_tmp73_, (glong) (_tmp74_ + 1), (glong) _tmp77_);
						_tmp79_ = _tmp78_;
						_tmp80_ = included;
						skk_map_file_load (self, _tmp71_, _tmp72_, _tmp79_, _tmp80_, &_inner_error_);
						_g_free0 (_tmp79_);
						_g_free0 (_tmp71_);
						if (_inner_error_ != NULL) {
							if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
								g_propagate_error (error, _inner_error_);
								_g_free0 (parent);
								_g_list_free0 (elements);
								__vala_JsonArray_free0 (include);
								__vala_JsonNode_free0 (member);
								__vala_JsonObject_free0 (object);
								__vala_JsonNode_free0 (root);
								_g_object_unref0 (parser);
								_g_free0 (filename);
								_skk_rule_metadata_free0 (metadata);
								return;
							} else {
								_g_free0 (parent);
								_g_list_free0 (elements);
								__vala_JsonArray_free0 (include);
								__vala_JsonNode_free0 (member);
								__vala_JsonObject_free0 (object);
								__vala_JsonNode_free0 (root);
								_g_object_unref0 (parser);
								_g_free0 (filename);
								_skk_rule_metadata_free0 (metadata);
								g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
								g_clear_error (&_inner_error_);
								return;
							}
						}
					}
					_tmp81_ = included;
					_tmp82_ = parent;
					gee_collection_add ((GeeCollection*) _tmp81_, _tmp82_);
					_g_free0 (parent);
				}
			}
		}
		_g_list_free0 (elements);
		__vala_JsonArray_free0 (include);
	}
	_tmp83_ = object;
	_tmp84_ = json_object_has_member (_tmp83_, "define");
	if (_tmp84_) {
		JsonObject* _tmp85_;
		JsonNode* _tmp86_ = NULL;
		JsonNode* _tmp87_;
		JsonNode* _tmp88_;
		JsonNodeType _tmp89_ = 0;
		JsonNode* _tmp91_;
		JsonObject* _tmp92_ = NULL;
		JsonObject* _tmp93_;
		JsonObject* define;
		JsonObject* _tmp94_;
		GList* _tmp95_ = NULL;
		GList* keys;
		GList* _tmp96_;
		_tmp85_ = object;
		_tmp86_ = json_object_get_member (_tmp85_, "define");
		_tmp87_ = __vala_JsonNode_copy0 (_tmp86_);
		__vala_JsonNode_free0 (member);
		member = _tmp87_;
		_tmp88_ = member;
		_tmp89_ = json_node_get_node_type (_tmp88_);
		if (_tmp89_ != JSON_NODE_OBJECT) {
			GError* _tmp90_;
			_tmp90_ = g_error_new_literal (SKK_RULE_PARSE_ERROR, SKK_RULE_PARSE_ERROR_FAILED, "\"define\" element must be an object");
			_inner_error_ = _tmp90_;
			if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
				g_propagate_error (error, _inner_error_);
				__vala_JsonNode_free0 (member);
				__vala_JsonObject_free0 (object);
				__vala_JsonNode_free0 (root);
				_g_object_unref0 (parser);
				_g_free0 (filename);
				_skk_rule_metadata_free0 (metadata);
				return;
			} else {
				__vala_JsonNode_free0 (member);
				__vala_JsonObject_free0 (object);
				__vala_JsonNode_free0 (root);
				_g_object_unref0 (parser);
				_g_free0 (filename);
				_skk_rule_metadata_free0 (metadata);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return;
			}
		}
		_tmp91_ = member;
		_tmp92_ = json_node_get_object (_tmp91_);
		_tmp93_ = __vala_JsonObject_copy0 (_tmp92_);
		define = _tmp93_;
		_tmp94_ = define;
		_tmp95_ = json_object_get_members (_tmp94_);
		keys = _tmp95_;
		_tmp96_ = keys;
		{
			GList* key_collection = NULL;
			GList* key_it = NULL;
			key_collection = _tmp96_;
			for (key_it = key_collection; key_it != NULL; key_it = key_it->next) {
				const gchar* key = NULL;
				key = (const gchar*) key_it->data;
				{
					GeeMap* _tmp97_;
					const gchar* _tmp98_;
					gboolean _tmp99_ = FALSE;
					JsonObject* _tmp104_;
					const gchar* _tmp105_;
					JsonNode* _tmp106_ = NULL;
					JsonNode* _tmp107_;
					JsonNode* _tmp108_;
					JsonNodeType _tmp109_ = 0;
					GeeMap* _tmp111_;
					const gchar* _tmp112_;
					gpointer _tmp113_ = NULL;
					GeeMap* _tmp114_;
					JsonNode* _tmp115_;
					JsonObject* _tmp116_ = NULL;
					_tmp97_ = self->priv->maps;
					_tmp98_ = key;
					_tmp99_ = gee_map_has_key (_tmp97_, _tmp98_);
					if (!_tmp99_) {
						GeeHashMap* _tmp100_;
						GeeHashMap* map;
						GeeMap* _tmp101_;
						const gchar* _tmp102_;
						GeeHashMap* _tmp103_;
						_tmp100_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, json_node_get_type (), (GBoxedCopyFunc) _vala_JsonNode_copy, _vala_JsonNode_free, NULL, NULL, NULL);
						map = _tmp100_;
						_tmp101_ = self->priv->maps;
						_tmp102_ = key;
						_tmp103_ = map;
						gee_map_set (_tmp101_, _tmp102_, (GeeMap*) _tmp103_);
						_g_object_unref0 (map);
					}
					_tmp104_ = define;
					_tmp105_ = key;
					_tmp106_ = json_object_get_member (_tmp104_, _tmp105_);
					_tmp107_ = __vala_JsonNode_copy0 (_tmp106_);
					__vala_JsonNode_free0 (member);
					member = _tmp107_;
					_tmp108_ = member;
					_tmp109_ = json_node_get_node_type (_tmp108_);
					if (_tmp109_ != JSON_NODE_OBJECT) {
						GError* _tmp110_;
						_tmp110_ = g_error_new_literal (SKK_RULE_PARSE_ERROR, SKK_RULE_PARSE_ERROR_FAILED, "map element must be an object");
						_inner_error_ = _tmp110_;
						if (_inner_error_->domain == SKK_RULE_PARSE_ERROR) {
							g_propagate_error (error, _inner_error_);
							_g_list_free0 (keys);
							__vala_JsonObject_free0 (define);
							__vala_JsonNode_free0 (member);
							__vala_JsonObject_free0 (object);
							__vala_JsonNode_free0 (root);
							_g_object_unref0 (parser);
							_g_free0 (filename);
							_skk_rule_metadata_free0 (metadata);
							return;
						} else {
							_g_list_free0 (keys);
							__vala_JsonObject_free0 (define);
							__vala_JsonNode_free0 (member);
							__vala_JsonObject_free0 (object);
							__vala_JsonNode_free0 (root);
							_g_object_unref0 (parser);
							_g_free0 (filename);
							_skk_rule_metadata_free0 (metadata);
							g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
							g_clear_error (&_inner_error_);
							return;
						}
					}
					_tmp111_ = self->priv->maps;
					_tmp112_ = key;
					_tmp113_ = gee_map_get (_tmp111_, _tmp112_);
					_tmp114_ = (GeeMap*) _tmp113_;
					_tmp115_ = member;
					_tmp116_ = json_node_get_object (_tmp115_);
					skk_map_file_load_map (self, _tmp114_, _tmp116_);
					_g_object_unref0 (_tmp114_);
				}
			}
		}
		_g_list_free0 (keys);
		__vala_JsonObject_free0 (define);
	}
	__vala_JsonNode_free0 (member);
	__vala_JsonObject_free0 (object);
	__vala_JsonNode_free0 (root);
	_g_object_unref0 (parser);
	_g_free0 (filename);
	_skk_rule_metadata_free0 (metadata);
}
예제 #25
0
/* Loads the properties of the grammar that are required
 for parsing. Loads patterns into memory, and sets
 up possible patterns.*/
void gtk_mate_grammar_init_for_use (GtkMateGrammar* self) {
	PListNode* fsm;
	PListNode* ftm;
	GeeArrayList* _tmp2;
	GeeArrayList* _tmp3;
	PListNode* ps;
	GtkMatePattern* pattern;
	GeeHashMap* _tmp5;
	PListDict* pd;
	PListDict* pd1;
	PListNode* pa1;
	g_return_if_fail (self != NULL);
	if (self->loaded) {
		return;
	}
	self->loaded = TRUE;
	/*stdout.printf("initializing grammar for use: %s\n", name);*/
	fsm = plist_dict_get (self->priv->_plist, "foldingStartMarker");
	if (fsm != NULL) {
		OnigRx* _tmp0;
		_tmp0 = NULL;
		self->folding_start_marker = (_tmp0 = onig_rx_make1 (PLIST_STRING (fsm)->str), (self->folding_start_marker == NULL) ? NULL : (self->folding_start_marker = (g_object_unref (self->folding_start_marker), NULL)), _tmp0);
	}
	ftm = plist_dict_get (self->priv->_plist, "foldingStopMarker");
	if (ftm != NULL) {
		OnigRx* _tmp1;
		_tmp1 = NULL;
		self->folding_stop_marker = (_tmp1 = onig_rx_make1 (PLIST_STRING (ftm)->str), (self->folding_stop_marker == NULL) ? NULL : (self->folding_stop_marker = (g_object_unref (self->folding_stop_marker), NULL)), _tmp1);
	}
	_tmp2 = NULL;
	self->all_patterns = (_tmp2 = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (self->all_patterns == NULL) ? NULL : (self->all_patterns = (g_object_unref (self->all_patterns), NULL)), _tmp2);
	/* stdout.printf("getting patterns\n");*/
	_tmp3 = NULL;
	self->patterns = (_tmp3 = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal), (self->patterns == NULL) ? NULL : (self->patterns = (g_object_unref (self->patterns), NULL)), _tmp3);
	ps = plist_dict_get (self->priv->_plist, "patterns");
	pattern = NULL;
	if (ps != NULL) {
		{
			GeeIterator* _p_it;
			_p_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (ps)->array);
			while (gee_iterator_next (_p_it)) {
				PListNode* p;
				GtkMatePattern* _tmp4;
				p = (PListNode*) gee_iterator_get (_p_it);
				_tmp4 = NULL;
				pattern = (_tmp4 = gtk_mate_pattern_create_from_plist (self->all_patterns, PLIST_DICT (p)), (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)), _tmp4);
				gtk_mate_pattern_set_grammar (pattern, self);
				if (pattern != NULL) {
					gee_collection_add ((GeeCollection*) self->patterns, pattern);
				}
				(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
			}
			(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
		}
	}
	/* stdout.printf("getting repository\n");*/
	_tmp5 = NULL;
	self->repository = (_tmp5 = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, GEE_TYPE_ARRAY_LIST, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_str_hash, g_str_equal, g_direct_equal), (self->repository == NULL) ? NULL : (self->repository = (g_object_unref (self->repository), NULL)), _tmp5);
	pd = PLIST_DICT (plist_dict_get (self->priv->_plist, "repository"));
	pd1 = NULL;
	pa1 = NULL;
	if (pd != NULL) {
		{
			GeeSet* _tmp6;
			GeeIterator* _tmp7;
			GeeIterator* _key_it;
			_tmp6 = NULL;
			_tmp7 = NULL;
			_key_it = (_tmp7 = gee_iterable_iterator ((GeeIterable*) (_tmp6 = gee_map_get_keys ((GeeMap*) pd->map))), (_tmp6 == NULL) ? NULL : (_tmp6 = (g_object_unref (_tmp6), NULL)), _tmp7);
			while (gee_iterator_next (_key_it)) {
				char* key;
				GeeArrayList* repo_array;
				PListDict* _tmp8;
				gboolean _tmp9;
				PListNode* _tmp10;
				gboolean _tmp11;
				key = (char*) gee_iterator_get (_key_it);
				/* stdout.printf("convert repo name: %s\n", key);*/
				repo_array = gee_array_list_new (GTK_MATE_TYPE_PATTERN, (GBoxedCopyFunc) g_object_ref, g_object_unref, g_direct_equal);
				_tmp8 = NULL;
				pd1 = (_tmp8 = PLIST_DICT (plist_dict_get (pd, key)), (pd1 == NULL) ? NULL : (pd1 = (g_object_unref (pd1), NULL)), _tmp8);
				_tmp9 = FALSE;
				_tmp10 = NULL;
				if ((_tmp11 = (_tmp10 = plist_dict_get (pd1, "begin")) != NULL, (_tmp10 == NULL) ? NULL : (_tmp10 = (g_object_unref (_tmp10), NULL)), _tmp11)) {
					_tmp9 = TRUE;
				} else {
					PListNode* _tmp12;
					_tmp12 = NULL;
					_tmp9 = (_tmp12 = plist_dict_get (pd1, "match")) != NULL;
					(_tmp12 == NULL) ? NULL : (_tmp12 = (g_object_unref (_tmp12), NULL));
				}
				/* repository name can go straight to a pattern*/
				if (_tmp9) {
					GtkMatePattern* _tmp13;
					_tmp13 = NULL;
					pattern = (_tmp13 = gtk_mate_pattern_create_from_plist (self->all_patterns, PLIST_DICT (pd1)), (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)), _tmp13);
					gtk_mate_pattern_set_grammar (pattern, self);
					if (pattern != NULL) {
						gee_collection_add ((GeeCollection*) repo_array, pattern);
					}
				} else {
					PListNode* _tmp14;
					_tmp14 = NULL;
					if ((pa1 = (_tmp14 = plist_dict_get (pd1, "patterns"), (pa1 == NULL) ? NULL : (pa1 = (g_object_unref (pa1), NULL)), _tmp14)) != NULL) {
						{
							GeeIterator* _ps1_it;
							_ps1_it = gee_iterable_iterator ((GeeIterable*) PLIST_ARRAY (pa1)->array);
							while (gee_iterator_next (_ps1_it)) {
								PListNode* ps1;
								GtkMatePattern* _tmp15;
								ps1 = (PListNode*) gee_iterator_get (_ps1_it);
								_tmp15 = NULL;
								pattern = (_tmp15 = gtk_mate_pattern_create_from_plist (self->all_patterns, PLIST_DICT (ps1)), (pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL)), _tmp15);
								gtk_mate_pattern_set_grammar (pattern, self);
								if (pattern != NULL) {
									gee_collection_add ((GeeCollection*) repo_array, pattern);
								}
								(ps1 == NULL) ? NULL : (ps1 = (g_object_unref (ps1), NULL));
							}
							(_ps1_it == NULL) ? NULL : (_ps1_it = (g_object_unref (_ps1_it), NULL));
						}
					}
				}
				gee_map_set ((GeeMap*) self->repository, key, repo_array);
				key = (g_free (key), NULL);
				(repo_array == NULL) ? NULL : (repo_array = (g_object_unref (repo_array), NULL));
			}
			(_key_it == NULL) ? NULL : (_key_it = (g_object_unref (_key_it), NULL));
		}
	}
	/* stdout.printf("all_patterns: %d\n", all_patterns.size);*/
	{
		GeeIterator* _p_it;
		/* stdout.printf("all_patterns: %d\n", all_patterns.size);*/
		_p_it = gee_iterable_iterator ((GeeIterable*) self->all_patterns);
		/* stdout.printf("all_patterns: %d\n", all_patterns.size);*/
		while (gee_iterator_next (_p_it)) {
			GtkMatePattern* p;
			/* stdout.printf("all_patterns: %d\n", all_patterns.size);*/
			p = (GtkMatePattern*) gee_iterator_get (_p_it);
			if (GTK_MATE_IS_DOUBLE_PATTERN (p)) {
				gtk_mate_pattern_replace_include_patterns (GTK_MATE_DOUBLE_PATTERN (p)->patterns, self);
			}
			(p == NULL) ? NULL : (p = (g_object_unref (p), NULL));
		}
		(_p_it == NULL) ? NULL : (_p_it = (g_object_unref (_p_it), NULL));
	}
	gtk_mate_pattern_replace_include_patterns (self->patterns, self);
	(fsm == NULL) ? NULL : (fsm = (g_object_unref (fsm), NULL));
	(ftm == NULL) ? NULL : (ftm = (g_object_unref (ftm), NULL));
	(ps == NULL) ? NULL : (ps = (g_object_unref (ps), NULL));
	(pattern == NULL) ? NULL : (pattern = (g_object_unref (pattern), NULL));
	(pd == NULL) ? NULL : (pd = (g_object_unref (pd), NULL));
	(pd1 == NULL) ? NULL : (pd1 = (g_object_unref (pd1), NULL));
	(pa1 == NULL) ? NULL : (pa1 = (g_object_unref (pa1), NULL));
}