static void settings_manager_on_blacklist_event (SettingsManager* self) {
	GSettings* _tmp0_;
	gchar** _tmp1_;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_;
	gint _tmp3__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->settings;
	_tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players");
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _vala_array_length (_tmp1_);
	g_signal_emit_by_name (self, "blacklist-updates", _tmp3_, _vala_array_length (_tmp1_));
	_tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL);
}
Example #2
0
gchar* daemon_helpers_typehelper_IndentString (const gchar* text, gint count) {
	gchar* result = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_ = NULL;
	gchar** parts;
	gint parts_length1;
	gint _parts_size_;
	gchar* _tmp2_ = NULL;
	gchar* prefix;
	gchar* _tmp6_ = NULL;
	g_return_val_if_fail (text != NULL, NULL);
	_tmp1_ = _tmp0_ = g_strsplit (text, "\n", 0);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = _vala_array_length (_tmp0_);
	_tmp2_ = g_strnfill ((gsize) count, '\t');
	prefix = _tmp2_;
	{
		gint i;
		i = 0;
		{
			gboolean _tmp3_;
			_tmp3_ = TRUE;
			while (TRUE) {
				gchar* _tmp4_;
				gchar* _tmp5_;
				if (!_tmp3_) {
					i++;
				}
				_tmp3_ = FALSE;
				if (!(i < parts_length1)) {
					break;
				}
				_tmp4_ = g_strconcat (prefix, parts[i], NULL);
				_tmp5_ = _tmp4_;
				_g_free0 (parts[i]);
				parts[i] = _tmp5_;
			}
		}
	}
	_tmp6_ = g_strjoinv ("\n", parts);
	result = _tmp6_;
	_g_free0 (prefix);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return result;
}
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));
}
static void _lambda0_ (DockManagerHelperTileObject* self) {
	gchar* _tmp0_ = NULL;
	gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_ = NULL;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* id;
	gchar* _tmp7_ = NULL;
	gchar* address;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_;
	GError * _inner_error_ = NULL;
	_tmp0_ = g_path_get_basename (self->priv->_helper_path);
	_tmp1_ = _tmp0_;
	_tmp3_ = _tmp2_ = g_strsplit (_tmp1_, ".", 0);
	_tmp4_ = _tmp3_;
	_tmp4__length1 = _vala_array_length (_tmp2_);
	_tmp5_ = g_strdup (_tmp4_[0]);
	_tmp6_ = _tmp5_;
	_tmp4_ = (_vala_array_free (_tmp4_, _tmp4__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_tmp1_);
	id = _tmp6_;
	_tmp7_ = g_strdup_printf ("http://wiki.go-docky.com/index.php?title=%s_Helper", id);
	address = _tmp7_;
	_tmp8_ = g_strdup_printf ("xdg-open %s", address);
	_tmp9_ = _tmp8_;
	g_spawn_command_line_async (_tmp9_, &_inner_error_);
	_g_free0 (_tmp9_);
	if (_inner_error_ != NULL) {
		_g_free0 (address);
		_g_free0 (id);
		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;
	}
	_g_free0 (address);
	_g_free0 (id);
}
Example #5
0
gchar* plank_drawing_drawing_service_get_icon_from_gicon (GIcon* icon) {
	gchar* result = NULL;
	GIcon* _tmp0_ = NULL;
	GIcon* _tmp7_ = NULL;
	_tmp0_ = icon;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, g_themed_icon_get_type ())) {
		gchar* icons = NULL;
		GIcon* _tmp1_ = NULL;
		gchar** _tmp2_ = NULL;
		gchar** _tmp3_ = NULL;
		gchar* _tmp4_ = NULL;
		const gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		_tmp1_ = icon;
		_tmp3_ = _tmp2_ = g_themed_icon_get_names (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, g_themed_icon_get_type (), GThemedIcon));
		_tmp4_ = _vala_g_strjoinv (";;", _tmp3_, _vala_array_length (_tmp2_));
		icons = _tmp4_;
		_tmp5_ = icons;
		_tmp6_ = string_replace (_tmp5_, "(null);;", "");
		result = _tmp6_;
		_g_free0 (icons);
		return result;
	}
	_tmp7_ = icon;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp7_, g_file_icon_get_type ())) {
		GIcon* _tmp8_ = NULL;
		GFile* _tmp9_ = NULL;
		gchar* _tmp10_ = NULL;
		_tmp8_ = icon;
		_tmp9_ = g_file_icon_get_file (G_TYPE_CHECK_INSTANCE_CAST (_tmp8_, g_file_icon_get_type (), GFileIcon));
		_tmp10_ = g_file_get_path (_tmp9_);
		result = _tmp10_;
		return result;
	}
	result = NULL;
	return result;
}
void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name) {
	static const char key[] = "interested-media-players";
	GVariantType* _tmp0_;
	GVariantType* _tmp1_;
	GVariantBuilder* _tmp2_;
	GVariantBuilder* _tmp3_;
	GVariantBuilder* players;
	GSettings* _tmp4_;
	gchar** _tmp5_;
	gchar** _tmp6_ = NULL;
	GVariantBuilder* _tmp12_;
	const gchar* _tmp13_;
	GSettings* _tmp14_;
	GVariantBuilder* _tmp15_;
	GVariant* _tmp16_ = NULL;
	GVariant* _tmp17_;
	GSettings* _tmp18_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (app_desktop_name != NULL);
	_tmp0_ = g_variant_type_new ("as");
	_tmp1_ = _tmp0_;
	_tmp2_ = g_variant_builder_new (_tmp1_);
	_tmp3_ = _tmp2_;
	_g_variant_type_free0 (_tmp1_);
	players = _tmp3_;
	_tmp4_ = self->priv->settings;
	_tmp6_ = _tmp5_ = g_settings_get_strv (_tmp4_, key);
	{
		gchar** player_collection = NULL;
		gint player_collection_length1 = 0;
		gint _player_collection_size_ = 0;
		gint player_it = 0;
		player_collection = _tmp6_;
		player_collection_length1 = _vala_array_length (_tmp5_);
		for (player_it = 0; player_it < _vala_array_length (_tmp5_); player_it = player_it + 1) {
			gchar* _tmp7_;
			gchar* player = NULL;
			_tmp7_ = g_strdup (player_collection[player_it]);
			player = _tmp7_;
			{
				const gchar* _tmp8_;
				const gchar* _tmp9_;
				GVariantBuilder* _tmp10_;
				const gchar* _tmp11_;
				_tmp8_ = player;
				_tmp9_ = app_desktop_name;
				if (g_strcmp0 (_tmp8_, _tmp9_) == 0) {
					_g_free0 (player);
					player_collection = (_vala_array_free (player_collection, player_collection_length1, (GDestroyNotify) g_free), NULL);
					_g_variant_builder_unref0 (players);
					return;
				}
				_tmp10_ = players;
				_tmp11_ = player;
				g_variant_builder_add (_tmp10_, "s", _tmp11_, NULL);
				_g_free0 (player);
			}
		}
		player_collection = (_vala_array_free (player_collection, player_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp12_ = players;
	_tmp13_ = app_desktop_name;
	g_variant_builder_add (_tmp12_, "s", _tmp13_, NULL);
	_tmp14_ = self->priv->settings;
	_tmp15_ = players;
	_tmp16_ = g_variant_builder_end (_tmp15_);
	_tmp17_ = g_variant_ref_sink (_tmp16_);
	g_settings_set_value (_tmp14_, key, _tmp17_);
	_g_variant_unref0 (_tmp17_);
	_tmp18_ = self->priv->settings;
	g_settings_apply (_tmp18_);
	_g_variant_builder_unref0 (players);
}
GeeArrayList* settings_manager_fetch_interested (SettingsManager* self) {
	GeeArrayList* result = NULL;
	gint _tmp0_ = 0;
	gchar** _tmp1_ = NULL;
	gchar** blacklisted;
	gint blacklisted_length1;
	gint _blacklisted_size_;
	GSettings* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_ = NULL;
	gchar** interested;
	gint interested_length1;
	gint _interested_size_;
	GeeArrayList* _tmp5_;
	GeeArrayList* list;
	gchar** _tmp6_;
	gint _tmp6__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = settings_manager_fetch_blacklist (self, &_tmp0_);
	blacklisted = _tmp1_;
	blacklisted_length1 = _tmp0_;
	_blacklisted_size_ = blacklisted_length1;
	_tmp2_ = self->priv->settings;
	_tmp4_ = _tmp3_ = g_settings_get_strv (_tmp2_, "interested-media-players");
	interested = _tmp4_;
	interested_length1 = _vala_array_length (_tmp3_);
	_interested_size_ = interested_length1;
	_tmp5_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
	list = _tmp5_;
	_tmp6_ = interested;
	_tmp6__length1 = interested_length1;
	{
		gchar** s_collection = NULL;
		gint s_collection_length1 = 0;
		gint _s_collection_size_ = 0;
		gint s_it = 0;
		s_collection = _tmp6_;
		s_collection_length1 = _tmp6__length1;
		for (s_it = 0; s_it < _tmp6__length1; s_it = s_it + 1) {
			gchar* _tmp7_;
			gchar* s = NULL;
			_tmp7_ = g_strdup (s_collection[s_it]);
			s = _tmp7_;
			{
				const gchar* _tmp8_;
				GeeArrayList* _tmp10_;
				const gchar* _tmp11_;
				gboolean _tmp12_ = FALSE;
				const gchar* _tmp13_;
				gchar** _tmp14_;
				gint _tmp14__length1;
				GeeArrayList* _tmp15_;
				const gchar* _tmp16_;
				_tmp8_ = s;
				if (g_strcmp0 (_tmp8_, "banshee-1") == 0) {
					gchar* _tmp9_;
					_tmp9_ = g_strdup ("banshee");
					_g_free0 (s);
					s = _tmp9_;
				}
				_tmp10_ = list;
				_tmp11_ = s;
				_tmp12_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp10_, _tmp11_);
				if (_tmp12_) {
					_g_free0 (s);
					continue;
				}
				_tmp13_ = s;
				_tmp14_ = blacklisted;
				_tmp14__length1 = blacklisted_length1;
				if (_vala_string_array_contains (_tmp14_, _tmp14__length1, _tmp13_)) {
					_g_free0 (s);
					continue;
				}
				_tmp15_ = list;
				_tmp16_ = s;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
				_g_free0 (s);
			}
		}
	}
	result = list;
	interested = (_vala_array_free (interested, interested_length1, (GDestroyNotify) g_free), NULL);
	blacklisted = (_vala_array_free (blacklisted, blacklisted_length1, (GDestroyNotify) g_free), NULL);
	return result;
}
GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self) {
	GeeArrayList* result = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* list;
	GSettings* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_ = NULL;
	gchar** preferred;
	gint preferred_length1;
	gint _preferred_size_;
	GeeArrayList* _tmp4_ = NULL;
	GeeArrayList* interested;
	gchar** _tmp5_;
	gint _tmp5__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
	list = _tmp0_;
	_tmp1_ = self->priv->settings;
	_tmp3_ = _tmp2_ = g_settings_get_strv (_tmp1_, "preferred-media-players");
	preferred = _tmp3_;
	preferred_length1 = _vala_array_length (_tmp2_);
	_preferred_size_ = preferred_length1;
	_tmp4_ = settings_manager_fetch_interested (self);
	interested = _tmp4_;
	_tmp5_ = preferred;
	_tmp5__length1 = preferred_length1;
	{
		gchar** s_collection = NULL;
		gint s_collection_length1 = 0;
		gint _s_collection_size_ = 0;
		gint s_it = 0;
		s_collection = _tmp5_;
		s_collection_length1 = _tmp5__length1;
		for (s_it = 0; s_it < _tmp5__length1; s_it = s_it + 1) {
			gchar* _tmp6_;
			gchar* s = NULL;
			_tmp6_ = g_strdup (s_collection[s_it]);
			s = _tmp6_;
			{
				gboolean _tmp7_ = FALSE;
				GeeArrayList* _tmp8_;
				const gchar* _tmp9_;
				gboolean _tmp10_ = FALSE;
				gboolean _tmp14_;
				_tmp8_ = list;
				_tmp9_ = s;
				_tmp10_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp8_, _tmp9_);
				if (!_tmp10_) {
					GeeArrayList* _tmp11_;
					const gchar* _tmp12_;
					gboolean _tmp13_ = FALSE;
					_tmp11_ = interested;
					_tmp12_ = s;
					_tmp13_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp11_, _tmp12_);
					_tmp7_ = _tmp13_;
				} else {
					_tmp7_ = FALSE;
				}
				_tmp14_ = _tmp7_;
				if (_tmp14_) {
					GeeArrayList* _tmp15_;
					const gchar* _tmp16_;
					_tmp15_ = list;
					_tmp16_ = s;
					gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_);
				}
				_g_free0 (s);
			}
		}
	}
	result = list;
	_g_object_unref0 (interested);
	preferred = (_vala_array_free (preferred, preferred_length1, (GDestroyNotify) g_free), NULL);
	return result;
}
DaemonSmtpConfiguration* daemon_smtp_configuration_Parse (const gchar* input, GError** error) {
	DaemonSmtpConfiguration* result = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_ = NULL;
	gchar** parts;
	gint parts_length1;
	gint _parts_size_;
	gchar* _tmp3_ = NULL;
	gchar* sender;
	gint _tmp4_;
	gchar* host = NULL;
	guint16* port = NULL;
	gchar* _tmp6_ = NULL;
	guint16* _tmp7_ = NULL;
	guint16* _tmp9_;
	guint16* _tmp10_;
	guint16* _tmp13_;
	DaemonSmtpConfiguration* _tmp14_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (input != NULL, NULL);
	_tmp1_ = _tmp0_ = g_strsplit (input, "/", 0);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = _vala_array_length (_tmp0_);
	if (parts_length1 != 2) {
		GError* _tmp2_ = NULL;
		_tmp2_ = g_error_new_literal (DAEMON_SMTP_ERROR, DAEMON_SMTP_ERROR_InvalidConfiguration, "Invalid configuration string");
		_inner_error_ = _tmp2_;
		if (_inner_error_->domain == DAEMON_SMTP_ERROR) {
			g_propagate_error (error, _inner_error_);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			return NULL;
		} else {
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			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 NULL;
		}
	}
	_tmp3_ = string_strip (parts[0]);
	sender = _tmp3_;
	_tmp4_ = strlen (sender);
	if (_tmp4_ == 0) {
		GError* _tmp5_ = NULL;
		_tmp5_ = g_error_new_literal (DAEMON_SMTP_ERROR, DAEMON_SMTP_ERROR_InvalidConfiguration, "Invalid configuration string");
		_inner_error_ = _tmp5_;
		if (_inner_error_->domain == DAEMON_SMTP_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_free0 (sender);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			return NULL;
		} else {
			_g_free0 (sender);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			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 NULL;
		}
	}
	daemon_helpers_typehelper_ParseHostAndPort (parts[1], &_tmp6_, &_tmp7_, &_inner_error_);
	_g_free0 (host);
	host = _tmp6_;
	_g_free0 (port);
	port = _tmp7_;
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == DAEMON_HELPERS_DAEMON_ERROR) {
			goto __catch8_daemon_helpers_daemon_error;
		}
		_g_free0 (port);
		_g_free0 (host);
		_g_free0 (sender);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		g_critical ("file %s: line %d: unexpected 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 NULL;
	}
	goto __finally8;
	__catch8_daemon_helpers_daemon_error:
	{
		GError * _error_;
		GError* _tmp8_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_tmp8_ = g_error_new_literal (DAEMON_SMTP_ERROR, DAEMON_SMTP_ERROR_InvalidConfiguration, _error_->message);
		_inner_error_ = _tmp8_;
		_g_error_free0 (_error_);
		goto __finally8;
	}
	__finally8:
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == DAEMON_SMTP_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_free0 (port);
			_g_free0 (host);
			_g_free0 (sender);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			return NULL;
		} else {
			_g_free0 (port);
			_g_free0 (host);
			_g_free0 (sender);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			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 NULL;
		}
	}
	_tmp9_ = __uint16_dup0 (port);
	_tmp10_ = _tmp9_;
	if (_tmp10_ == NULL) {
		gint _tmp11_;
		guint16* _tmp12_;
		_tmp11_ = 25;
		_tmp12_ = __uint16_dup0 (&_tmp11_);
		_g_free0 (_tmp10_);
		_tmp10_ = _tmp12_;
	}
	_tmp13_ = __uint16_dup0 (_tmp10_);
	_g_free0 (port);
	port = _tmp13_;
	_tmp14_ = daemon_smtp_configuration_new (sender, host, *port);
	result = _tmp14_;
	_g_free0 (_tmp10_);
	_g_free0 (port);
	_g_free0 (host);
	_g_free0 (sender);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return result;
}
Example #10
0
void grava_renderer_draw_node (cairo_t* ctx, GravaNode* node) {
#line 185 "renderer.vala"
	g_return_if_fail (ctx != NULL);
#line 185 "renderer.vala"
	g_return_if_fail (node != NULL);
#line 187 "renderer.vala"
	cairo_save (ctx);
#line 189 "renderer.vala"
	cairo_set_tolerance (ctx, 0.1);
#line 190 "renderer.vala"
	cairo_set_line_join (ctx, CAIRO_LINE_JOIN_ROUND);
#line 191 "renderer.vala"
	cairo_set_line_width (ctx, (double) 1);
#line 192 "renderer.vala"
	cairo_translate (ctx, node->x, node->y);
#line 462 "renderer.c"
	/*ctx.set_source_rgb (1, 1, 1);*/
#line 195 "renderer.vala"
	cairo_set_source_rgb (ctx, 0.8, 0.8, 0.8);
#line 466 "renderer.c"
	/*#if 0
	if (node.calls.length() >0) 
	set_color(ctx, "red");
	else
	set_color(ctx, "blue");
	#endif
	*/
#line 203 "renderer.vala"
	grava_renderer_set_color (ctx, node->data);
#line 204 "renderer.vala"
	grava_renderer_set_color_str (ctx, (const char*) g_hash_table_lookup (node->data, "bgcolor"));
#line 206 "renderer.vala"
	if (node->has_body) {
#line 207 "renderer.vala"
		switch (node->shape) {
#line 482 "renderer.c"
			case GRAVA_SHAPE_CIRCLE:
			{
#line 209 "renderer.vala"
				grava_renderer_circle (ctx, node->w, node->h);
#line 210 "renderer.vala"
				cairo_fill (ctx);
#line 211 "renderer.vala"
				break;
#line 491 "renderer.c"
			}
			default:
			{
#line 214 "renderer.vala"
				grava_renderer_square (ctx, node->w, node->h);
#line 215 "renderer.vala"
				cairo_fill (ctx);
#line 216 "renderer.vala"
				break;
#line 501 "renderer.c"
			}
		}
	}
	/* title rectangle */
#line 221 "renderer.vala"
	if (((const char*) g_hash_table_lookup (node->data, "color")) != NULL) {
#line 222 "renderer.vala"
		grava_renderer_set_color_str (ctx, (const char*) g_hash_table_lookup (node->data, "color"));
#line 510 "renderer.c"
	} else {
#line 224 "renderer.vala"
		if (g_slist_length (node->calls) == 1) {
#line 225 "renderer.vala"
			cairo_set_source_rgba (ctx, 0.2, 0.2, 0.4, 0.7);
#line 516 "renderer.c"
		} else {
#line 227 "renderer.vala"
			if (g_slist_length (node->calls) > 0) {
#line 228 "renderer.vala"
				cairo_set_source_rgba (ctx, 0.3, 0.3, (double) 1, 0.7);
#line 522 "renderer.c"
			} else {
#line 230 "renderer.vala"
				cairo_set_source_rgba (ctx, 0.8, 0.8, 0.8, 0.8);
#line 526 "renderer.c"
			}
		}
	}
#line 231 "renderer.vala"
	grava_renderer_square (ctx, node->w, (double) 15);
#line 232 "renderer.vala"
	cairo_fill (ctx);
#line 233 "renderer.vala"
	grava_renderer_line (ctx, (double) 0, (double) 15, node->w, (double) 0);
#line 536 "renderer.c"
	/* draw minimize button */
#line 236 "renderer.vala"
	cairo_save (ctx);
#line 540 "renderer.c"
	/*ctx.set_source_rgba (0.7, 0.0, 0.0, 1);*/
#line 238 "renderer.vala"
	cairo_set_source_rgba (ctx, 0.6, 0.6, 0.6, 0.8);
#line 239 "renderer.vala"
	cairo_translate (ctx, node->w - 13, (double) 3);
#line 240 "renderer.vala"
	grava_renderer_square (ctx, (double) 10, (double) 10);
#line 241 "renderer.vala"
	cairo_fill (ctx);
#line 242 "renderer.vala"
	cairo_restore (ctx);
#line 244 "renderer.vala"
	cairo_select_font_face (ctx, "Sans Serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
#line 554 "renderer.c"
	/*Courier", */
#line 247 "renderer.vala"
	cairo_set_font_size (ctx, (double) 10);
#line 558 "renderer.c"
	/* set label */
#line 250 "renderer.vala"
	cairo_set_source_rgb (ctx, 0.1, 0.1, 0.1);
#line 251 "renderer.vala"
	cairo_move_to (ctx, (double) 5, (double) 10);
#line 252 "renderer.vala"
	cairo_show_text (ctx, (const char*) g_hash_table_lookup (node->data, "label"));
#line 566 "renderer.c"
	/* set body */
#line 255 "renderer.vala"
	if (node->has_body) {
#line 570 "renderer.c"
		gint y;
		const char* _tmp0_;
		char* body;
		y = 25;
#line 257 "renderer.vala"
		_tmp0_ = NULL;
#line 577 "renderer.c"
		body = (_tmp0_ = (const char*) g_hash_table_lookup (node->data, "body"), (_tmp0_ == NULL) ? NULL : g_strdup (_tmp0_));
#line 258 "renderer.vala"
		if (body != NULL) {
#line 581 "renderer.c"
			{
				char** _tmp1_;
				char** str_collection;
				int str_collection_length1;
				int str_it;
				_tmp1_ = NULL;
#line 259 "renderer.vala"
				str_collection = _tmp1_ = g_strsplit (body, "\n", 0);
#line 590 "renderer.c"
				str_collection_length1 = _vala_array_length (_tmp1_);
				for (str_it = 0; str_it < _vala_array_length (_tmp1_); str_it = str_it + 1) {
					const char* _tmp3_;
					char* str;
#line 822 "glib-2.0.vapi"
					_tmp3_ = NULL;
#line 597 "renderer.c"
					str = (_tmp3_ = str_collection[str_it], (_tmp3_ == NULL) ? NULL : g_strdup (_tmp3_));
					{
						gboolean _tmp2_ = {0};
#line 260 "renderer.vala"
						y = y + 10;
#line 261 "renderer.vala"
						cairo_move_to (ctx, (double) 5, (double) y);
#line 262 "renderer.vala"
						if (strstr (str, "call ") != NULL) {
#line 262 "renderer.vala"
							_tmp2_ = TRUE;
#line 609 "renderer.c"
						} else {
#line 263 "renderer.vala"
							_tmp2_ = strstr (str, "bl ") != NULL;
#line 613 "renderer.c"
						}
#line 262 "renderer.vala"
						if (_tmp2_) {
#line 264 "renderer.vala"
							grava_renderer_set_color_str (ctx, "blue");
#line 619 "renderer.c"
						} else {
#line 266 "renderer.vala"
							if (strstr (str, "goto") != NULL) {
#line 267 "renderer.vala"
								grava_renderer_set_color_str (ctx, "green");
#line 625 "renderer.c"
							} else {
#line 269 "renderer.vala"
								if (strstr (str, " j") != NULL) {
#line 270 "renderer.vala"
									grava_renderer_set_color_str (ctx, "green");
#line 631 "renderer.c"
								} else {
#line 272 "renderer.vala"
									if (g_str_has_suffix (str, ":")) {
#line 273 "renderer.vala"
										grava_renderer_set_color_str (ctx, "red");
#line 637 "renderer.c"
									} else {
#line 275 "renderer.vala"
										grava_renderer_set_color_str (ctx, "black");
#line 641 "renderer.c"
									}
								}
							}
						}
#line 276 "renderer.vala"
						cairo_show_text (ctx, str);
#line 648 "renderer.c"
						str = (g_free (str), NULL);
					}
				}
#line 259 "renderer.vala"
				str_collection = (_vala_array_free (str_collection, str_collection_length1, (GDestroyNotify) g_free), NULL);
#line 654 "renderer.c"
			}
		}
		/*set_color(ctx, node.data);
		 box square */
#line 281 "renderer.vala"
		if (grava_graph_selected == node) {
#line 661 "renderer.c"
			/*ctx.set_source_rgba (1, 0.8, 0.0, 0.9);*/
#line 283 "renderer.vala"
			cairo_set_source_rgba (ctx, (double) 0, 0.0, 0.0, 1.0);
#line 284 "renderer.vala"
			cairo_set_line_width (ctx, (double) 2);
#line 667 "renderer.c"
		} else {
#line 286 "renderer.vala"
			cairo_set_source_rgba (ctx, 0.2, 0.2, 0.2, 0.4);
#line 287 "renderer.vala"
			cairo_set_line_width (ctx, (double) 1);
#line 673 "renderer.c"
		}
#line 290 "renderer.vala"
		if (node->shape == GRAVA_SHAPE_CIRCLE) {
#line 291 "renderer.vala"
			grava_renderer_circle (ctx, node->w, node->h);
#line 679 "renderer.c"
		} else {
#line 292 "renderer.vala"
			grava_renderer_square (ctx, node->w, node->h);
#line 683 "renderer.c"
		}
		body = (g_free (body), NULL);
	}
#line 295 "renderer.vala"
	cairo_stroke (ctx);
#line 297 "renderer.vala"
	cairo_restore (ctx);
#line 691 "renderer.c"
}
DaemonConfigurationServerConfiguration* daemon_configuration_server_configuration_Parse (const gchar* input, GError** error) {
	DaemonConfigurationServerConfiguration* result = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_ = NULL;
	gchar** parts;
	gint parts_length1;
	gint _parts_size_;
	gboolean _tmp3_ = FALSE;
	gint _tmp4_;
	gchar** _tmp7_;
	gchar** _tmp8_ = NULL;
	gchar** channels;
	gint channels_length1;
	gint _channels_size_;
	gchar* host = NULL;
	guint16* port = NULL;
	gchar* _tmp9_ = NULL;
	guint16* _tmp10_ = NULL;
	guint16* _tmp12_;
	guint16* _tmp13_;
	guint16* _tmp16_;
	DaemonConfigurationServerConfiguration* _tmp17_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (input != NULL, NULL);
	_tmp1_ = _tmp0_ = g_strsplit (input, "/", 0);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = _vala_array_length (_tmp0_);
	if (parts_length1 != 2) {
		GError* _tmp2_ = NULL;
		_tmp2_ = g_error_new_literal (DAEMON_CONFIGURATION_CONFIGURATION_ERROR, DAEMON_CONFIGURATION_CONFIGURATION_ERROR_Invalid, "Invalid format");
		_inner_error_ = _tmp2_;
		if (_inner_error_->domain == DAEMON_CONFIGURATION_CONFIGURATION_ERROR) {
			g_propagate_error (error, _inner_error_);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			return NULL;
		} else {
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			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 NULL;
		}
	}
	_tmp4_ = strlen (parts[0]);
	if (_tmp4_ == 0) {
		_tmp3_ = TRUE;
	} else {
		gint _tmp5_;
		_tmp5_ = strlen (parts[1]);
		_tmp3_ = _tmp5_ == 0;
	}
	if (_tmp3_) {
		GError* _tmp6_ = NULL;
		_tmp6_ = g_error_new_literal (DAEMON_CONFIGURATION_CONFIGURATION_ERROR, DAEMON_CONFIGURATION_CONFIGURATION_ERROR_Invalid, "Must specify both Server and Channel(s)");
		_inner_error_ = _tmp6_;
		if (_inner_error_->domain == DAEMON_CONFIGURATION_CONFIGURATION_ERROR) {
			g_propagate_error (error, _inner_error_);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			return NULL;
		} else {
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			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 NULL;
		}
	}
	_tmp8_ = _tmp7_ = g_strsplit (parts[1], ",", 0);
	channels = _tmp8_;
	channels_length1 = _vala_array_length (_tmp7_);
	_channels_size_ = _vala_array_length (_tmp7_);
	daemon_helpers_typehelper_ParseHostAndPort (parts[0], &_tmp9_, &_tmp10_, &_inner_error_);
	_g_free0 (host);
	host = _tmp9_;
	_g_free0 (port);
	port = _tmp10_;
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == DAEMON_HELPERS_DAEMON_ERROR) {
			goto __catch27_daemon_helpers_daemon_error;
		}
		_g_free0 (port);
		_g_free0 (host);
		channels = (_vala_array_free (channels, channels_length1, (GDestroyNotify) g_free), NULL);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		g_critical ("file %s: line %d: unexpected 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 NULL;
	}
	goto __finally27;
	__catch27_daemon_helpers_daemon_error:
	{
		GError * _error_;
		GError* _tmp11_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		_tmp11_ = g_error_new_literal (DAEMON_CONFIGURATION_CONFIGURATION_ERROR, DAEMON_CONFIGURATION_CONFIGURATION_ERROR_Invalid, _error_->message);
		_inner_error_ = _tmp11_;
		_g_error_free0 (_error_);
		goto __finally27;
	}
	__finally27:
	if (_inner_error_ != NULL) {
		if (_inner_error_->domain == DAEMON_CONFIGURATION_CONFIGURATION_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_free0 (port);
			_g_free0 (host);
			channels = (_vala_array_free (channels, channels_length1, (GDestroyNotify) g_free), NULL);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			return NULL;
		} else {
			_g_free0 (port);
			_g_free0 (host);
			channels = (_vala_array_free (channels, channels_length1, (GDestroyNotify) g_free), NULL);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			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 NULL;
		}
	}
	_tmp12_ = __uint16_dup0 (port);
	_tmp13_ = _tmp12_;
	if (_tmp13_ == NULL) {
		gint _tmp14_;
		guint16* _tmp15_;
		_tmp14_ = 6667;
		_tmp15_ = __uint16_dup0 (&_tmp14_);
		_g_free0 (_tmp13_);
		_tmp13_ = _tmp15_;
	}
	_tmp16_ = __uint16_dup0 (_tmp13_);
	_g_free0 (port);
	port = _tmp16_;
	_tmp17_ = daemon_configuration_server_configuration_new (host, *port, channels, channels_length1);
	result = _tmp17_;
	_g_free0 (_tmp13_);
	_g_free0 (port);
	_g_free0 (host);
	channels = (_vala_array_free (channels, channels_length1, (GDestroyNotify) g_free), NULL);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return result;
}
Example #12
0
static gboolean gmpc_meta_data_widgets_similar_songs_update_sim_song (GmpcMetaDataWidgetsSimilarSongs* self) {
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	if (self->priv->current == NULL) {
		GList* _tmp0_ = NULL;
		GtkProgressBar* _tmp1_ = NULL;
		_tmp0_ = meta_data_get_text_list (self->priv->copy);
		self->priv->current = _tmp0_;
		_tmp1_ = (GtkProgressBar*) gtk_progress_bar_new ();
		_g_object_unref0 (self->priv->pchild);
		self->priv->pchild = (GtkWidget*) g_object_ref_sink (_tmp1_);
		gtk_container_add ((GtkContainer*) self, self->priv->pchild);
		gtk_widget_show_all ((GtkWidget*) self);
	}
	gtk_progress_bar_pulse (GTK_PROGRESS_BAR (self->priv->pchild));
	if (self->priv->current != NULL) {
		gchar* _tmp2_;
		gchar* entry;
		_tmp2_ = g_strdup ((const gchar*) self->priv->current->data);
		entry = _tmp2_;
		if (entry != NULL) {
			gchar** _tmp3_;
			gchar** _tmp4_ = NULL;
			gchar** split;
			gint split_length1;
			gint _split_size_;
			_tmp4_ = _tmp3_ = g_strsplit (entry, "::", 2);
			split = _tmp4_;
			split_length1 = _vala_array_length (_tmp3_);
			_split_size_ = _vala_array_length (_tmp3_);
			if (split_length1 == 2) {
				gchar** _tmp5_;
				gchar** _tmp6_ = NULL;
				gchar** art_split;
				gint art_split_length1;
				gint _art_split_size_;
				MpdData* _tmp8_ = NULL;
				MpdData* data;
				mpd_database_search_start (connection, FALSE);
				_tmp6_ = _tmp5_ = g_strsplit (split[0], " ", 0);
				art_split = _tmp6_;
				art_split_length1 = _vala_array_length (_tmp5_);
				_art_split_size_ = _vala_array_length (_tmp5_);
				{
					gchar** artist_collection;
					int artist_collection_length1;
					int artist_it;
					artist_collection = art_split;
					artist_collection_length1 = art_split_length1;
					for (artist_it = 0; artist_it < art_split_length1; artist_it = artist_it + 1) {
						gchar* _tmp7_;
						gchar* artist;
						_tmp7_ = g_strdup (artist_collection[artist_it]);
						artist = _tmp7_;
						{
							mpd_database_search_add_constraint (connection, MPD_TAG_ITEM_ARTIST, artist);
							_g_free0 (artist);
						}
					}
				}
				mpd_database_search_add_constraint (connection, MPD_TAG_ITEM_TITLE, split[1]);
				_tmp8_ = mpd_database_search_commit (connection);
				data = _tmp8_;
				if (data != NULL) {
					MpdData* _tmp9_;
					_tmp9_ = data;
					data = NULL;
					self->priv->item = mpd_data_concatenate (self->priv->item, _tmp9_);
				}
				_mpd_data_free0 (data);
				art_split = (_vala_array_free (art_split, art_split_length1, (GDestroyNotify) g_free), NULL);
			}
			split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL);
		}
		self->priv->current = self->priv->current->next;
		if (self->priv->current != NULL) {
			result = TRUE;
			_g_free0 (entry);
			return result;
		}
		_g_free0 (entry);
	}
	gtk_object_destroy ((GtkObject*) self->priv->pchild);
	if (self->priv->item != NULL) {
		GmpcMpdDataModel* _tmp10_ = NULL;
		GmpcMpdDataModel* model;
		MpdData* _tmp11_;
		GmpcMpdDataTreeview* _tmp12_ = NULL;
		GmpcMpdDataTreeview* tree;
		GtkWidget* _tmp13_;
		_tmp10_ = gmpc_mpddata_model_new ();
		model = _tmp10_;
		self->priv->item = misc_mpddata_remove_duplicate_songs (self->priv->item);
		_tmp11_ = self->priv->item;
		self->priv->item = NULL;
		gmpc_mpddata_model_set_mpd_data (model, _tmp11_);
		_tmp12_ = gmpc_mpddata_treeview_new ("similar-song", TRUE, (GtkTreeModel*) model);
		tree = g_object_ref_sink (_tmp12_);
		gmpc_mpddata_treeview_enable_click_fix (tree);
		g_signal_connect_object ((GtkWidget*) tree, "button-release-event", (GCallback) _gmpc_meta_data_widgets_similar_songs_tree_right_menu_gtk_widget_button_release_event, self, 0);
		g_signal_connect_object ((GtkTreeView*) tree, "row-activated", (GCallback) _gmpc_meta_data_widgets_similar_songs_tree_row_activated_gtk_tree_view_row_activated, self, 0);
		gtk_container_add ((GtkContainer*) self, (GtkWidget*) tree);
		_tmp13_ = _g_object_ref0 ((GtkWidget*) tree);
		_g_object_unref0 (self->priv->pchild);
		self->priv->pchild = _tmp13_;
		_g_object_unref0 (tree);
		_g_object_unref0 (model);
	} else {
		const gchar* _tmp14_ = NULL;
		GtkLabel* _tmp15_ = NULL;
		GtkLabel* label;
		GtkWidget* _tmp16_;
		_tmp14_ = _ ("Unavailable");
		_tmp15_ = (GtkLabel*) gtk_label_new (_tmp14_);
		label = g_object_ref_sink (_tmp15_);
		gtk_misc_set_alignment ((GtkMisc*) label, 0.0f, 0.0f);
		gtk_container_add ((GtkContainer*) self, (GtkWidget*) label);
		_tmp16_ = _g_object_ref0 ((GtkWidget*) label);
		_g_object_unref0 (self->priv->pchild);
		self->priv->pchild = _tmp16_;
		_g_object_unref0 (label);
	}
	_meta_data_free0 (self->priv->copy);
	self->priv->copy = NULL;
	self->priv->idle_add = (guint) 0;
	gtk_widget_show_all ((GtkWidget*) self);
	result = FALSE;
	return result;
}
Example #13
0
/**
 * Create new color converted from string formatted like
 * "%d;;%d;;%d;;%d" with numeric entries ranged in 0..255
 *
 * @return new {@link Color} based on the given string
 */
void plank_drawing_color_from_string (const gchar* s, PlankDrawingColor* result) {
	gchar** parts = NULL;
	const gchar* _tmp0_ = NULL;
	gchar** _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gint parts_length1 = 0;
	gint _parts_size_ = 0;
	gchar** _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	guint8 _tmp6_ = 0U;
	gchar** _tmp7_ = NULL;
	gint _tmp7__length1 = 0;
	const gchar* _tmp8_ = NULL;
	gint _tmp9_ = 0;
	gdouble _tmp10_ = 0.0;
	gdouble _tmp11_ = 0.0;
	guint8 _tmp12_ = 0U;
	guint8 _tmp13_ = 0U;
	gchar** _tmp14_ = NULL;
	gint _tmp14__length1 = 0;
	const gchar* _tmp15_ = NULL;
	gint _tmp16_ = 0;
	gdouble _tmp17_ = 0.0;
	gdouble _tmp18_ = 0.0;
	guint8 _tmp19_ = 0U;
	guint8 _tmp20_ = 0U;
	gchar** _tmp21_ = NULL;
	gint _tmp21__length1 = 0;
	const gchar* _tmp22_ = NULL;
	gint _tmp23_ = 0;
	gdouble _tmp24_ = 0.0;
	gdouble _tmp25_ = 0.0;
	guint8 _tmp26_ = 0U;
	guint8 _tmp27_ = 0U;
	gchar** _tmp28_ = NULL;
	gint _tmp28__length1 = 0;
	const gchar* _tmp29_ = NULL;
	gint _tmp30_ = 0;
	gdouble _tmp31_ = 0.0;
	gdouble _tmp32_ = 0.0;
	guint8 _tmp33_ = 0U;
	PlankDrawingColor _tmp34_ = {0};
	g_return_if_fail (s != NULL);
	_tmp0_ = s;
	_tmp2_ = _tmp1_ = g_strsplit (_tmp0_, ";;", 0);
	parts = _tmp2_;
	parts_length1 = _vala_array_length (_tmp1_);
	_parts_size_ = parts_length1;
	_tmp3_ = parts;
	_tmp3__length1 = parts_length1;
	if (_tmp3__length1 != 4) {
		const gchar* _tmp4_ = NULL;
		PlankDrawingColor _tmp5_ = {0};
		_tmp4_ = s;
		g_critical ("Color.vala:458: Malformed color string '%s'", _tmp4_);
		_tmp5_.R = (gdouble) 0;
		*result = _tmp5_;
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		return;
	}
	_tmp6_ = G_MAXUINT8;
	_tmp7_ = parts;
	_tmp7__length1 = parts_length1;
	_tmp8_ = _tmp7_[0];
	_tmp9_ = atoi (_tmp8_);
	_tmp10_ = MAX ((gdouble) 0, (gdouble) _tmp9_);
	_tmp11_ = MIN ((gdouble) _tmp6_, _tmp10_);
	_tmp12_ = G_MAXUINT8;
	_tmp13_ = G_MAXUINT8;
	_tmp14_ = parts;
	_tmp14__length1 = parts_length1;
	_tmp15_ = _tmp14_[1];
	_tmp16_ = atoi (_tmp15_);
	_tmp17_ = MAX ((gdouble) 0, (gdouble) _tmp16_);
	_tmp18_ = MIN ((gdouble) _tmp13_, _tmp17_);
	_tmp19_ = G_MAXUINT8;
	_tmp20_ = G_MAXUINT8;
	_tmp21_ = parts;
	_tmp21__length1 = parts_length1;
	_tmp22_ = _tmp21_[2];
	_tmp23_ = atoi (_tmp22_);
	_tmp24_ = MAX ((gdouble) 0, (gdouble) _tmp23_);
	_tmp25_ = MIN ((gdouble) _tmp20_, _tmp24_);
	_tmp26_ = G_MAXUINT8;
	_tmp27_ = G_MAXUINT8;
	_tmp28_ = parts;
	_tmp28__length1 = parts_length1;
	_tmp29_ = _tmp28_[3];
	_tmp30_ = atoi (_tmp29_);
	_tmp31_ = MAX ((gdouble) 0, (gdouble) _tmp30_);
	_tmp32_ = MIN ((gdouble) _tmp27_, _tmp31_);
	_tmp33_ = G_MAXUINT8;
	_tmp34_.R = _tmp11_ / _tmp12_;
	_tmp34_.G = _tmp18_ / _tmp19_;
	_tmp34_.B = _tmp25_ / _tmp26_;
	_tmp34_.A = _tmp32_ / _tmp33_;
	*result = _tmp34_;
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return;
}
Example #14
0
char* atlantis_document_uri_to_filename (AtlantisDocument* self, const char* uri) {
#line 146 "document.c"
	char* result;
	char* f;
#line 47 "document.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 47 "document.vala"
	g_return_val_if_fail (uri != NULL, NULL);
#line 49 "document.vala"
	f = g_strdup (uri);
#line 52 "document.vala"
	if (g_str_has_prefix (uri, "file:")) {
#line 157 "document.c"
		char* _tmp2_;
		gint _tmp1__length1;
		char** _tmp1_;
		char** _tmp0_;
#line 53 "document.vala"
		f = (_tmp2_ = g_strdup ((_tmp1_ = _tmp0_ = g_strsplit (uri, "://", 0), _tmp1__length1 = _vala_array_length (_tmp0_), _tmp1_)[1]), _g_free0 (f), _tmp2_);
#line 164 "document.c"
		_tmp1_ = (_vala_array_free (_tmp1_, _tmp1__length1, (GDestroyNotify) g_free), NULL);
	} else {
#line 54 "document.vala"
		if (!g_path_is_absolute (uri)) {
#line 169 "document.c"
			char* _tmp4_;
			char* _tmp3_;
#line 55 "document.vala"
			f = (_tmp4_ = g_build_filename (_tmp3_ = g_get_current_dir (), uri, NULL), _g_free0 (f), _tmp4_);
#line 174 "document.c"
			_g_free0 (_tmp3_);
		}
	}
	result = f;
#line 57 "document.vala"
	return result;
#line 181 "document.c"
}
Example #15
0
void daemon_helpers_typehelper_ParseHostAndPort (const gchar* input, gchar** host, guint16** port, GError** error) {
	gchar* _host = NULL;
	guint16* _port = NULL;
	gchar** _tmp0_;
	gchar** _tmp1_ = NULL;
	gchar** parts;
	gint parts_length1;
	gint _parts_size_;
	gchar* _tmp3_ = NULL;
	gint _tmp4_;
	GError * _inner_error_ = NULL;
	g_return_if_fail (input != NULL);
	_tmp1_ = _tmp0_ = g_strsplit (input, ":", 0);
	parts = _tmp1_;
	parts_length1 = _vala_array_length (_tmp0_);
	_parts_size_ = _vala_array_length (_tmp0_);
	if (parts_length1 > 2) {
		GError* _tmp2_ = NULL;
		_tmp2_ = g_error_new_literal (DAEMON_HELPERS_DAEMON_ERROR, DAEMON_HELPERS_DAEMON_ERROR_ParseFailed, "Invalid host");
		_inner_error_ = _tmp2_;
		if (_inner_error_->domain == DAEMON_HELPERS_DAEMON_ERROR) {
			g_propagate_error (error, _inner_error_);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			return;
		} else {
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			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;
		}
	}
	_tmp3_ = string_strip (parts[0]);
	_g_free0 (_host);
	_host = _tmp3_;
	_tmp4_ = strlen (_host);
	if (_tmp4_ == 0) {
		GError* _tmp5_ = NULL;
		_tmp5_ = g_error_new_literal (DAEMON_HELPERS_DAEMON_ERROR, DAEMON_HELPERS_DAEMON_ERROR_ParseFailed, "Invalid host");
		_inner_error_ = _tmp5_;
		if (_inner_error_->domain == DAEMON_HELPERS_DAEMON_ERROR) {
			g_propagate_error (error, _inner_error_);
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			return;
		} else {
			parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			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;
		}
	}
	if (parts_length1 == 2) {
		guint16* _tmp6_ = NULL;
		_tmp6_ = daemon_helpers_typehelper_ParsePort (parts[1]);
		_g_free0 (_port);
		_port = _tmp6_;
		if (_port == NULL) {
			GError* _tmp7_ = NULL;
			_tmp7_ = g_error_new_literal (DAEMON_HELPERS_DAEMON_ERROR, DAEMON_HELPERS_DAEMON_ERROR_ParseFailed, "Could not parse port");
			_inner_error_ = _tmp7_;
			if (_inner_error_->domain == DAEMON_HELPERS_DAEMON_ERROR) {
				g_propagate_error (error, _inner_error_);
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				return;
			} else {
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				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;
			}
		}
	}
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	if (host) {
		*host = _host;
	} else {
		_g_free0 (_host);
	}
	if (port) {
		*port = _port;
	} else {
		_g_free0 (_port);
	}
}
Example #16
0
static gchar* plank_services_logger_format_message (const gchar* msg) {
	gchar* result = NULL;
	gboolean _tmp0_ = FALSE;
	GRegex* _tmp1_ = NULL;
	const gchar* _tmp16_ = NULL;
	gchar* _tmp17_ = NULL;
	g_return_val_if_fail (msg != NULL, NULL);
	_tmp1_ = plank_services_logger_re;
	if (_tmp1_ != NULL) {
		GRegex* _tmp2_ = NULL;
		const gchar* _tmp3_ = NULL;
		gboolean _tmp4_ = FALSE;
		_tmp2_ = plank_services_logger_re;
		_tmp3_ = msg;
		_tmp4_ = g_regex_match (_tmp2_, _tmp3_, 0, NULL);
		_tmp0_ = _tmp4_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gchar** parts = NULL;
		GRegex* _tmp5_ = NULL;
		const gchar* _tmp6_ = NULL;
		gchar** _tmp7_ = NULL;
		gchar** _tmp8_ = NULL;
		gint parts_length1 = 0;
		gint _parts_size_ = 0;
		gchar** _tmp9_ = NULL;
		gint _tmp9__length1 = 0;
		const gchar* _tmp10_ = NULL;
		gchar** _tmp11_ = NULL;
		gint _tmp11__length1 = 0;
		const gchar* _tmp12_ = NULL;
		gchar** _tmp13_ = NULL;
		gint _tmp13__length1 = 0;
		const gchar* _tmp14_ = NULL;
		gchar* _tmp15_ = NULL;
		_tmp5_ = plank_services_logger_re;
		_tmp6_ = msg;
		_tmp8_ = _tmp7_ = g_regex_split (_tmp5_, _tmp6_, 0);
		parts = _tmp8_;
		parts_length1 = _vala_array_length (_tmp7_);
		_parts_size_ = parts_length1;
		_tmp9_ = parts;
		_tmp9__length1 = parts_length1;
		_tmp10_ = _tmp9_[1];
		_tmp11_ = parts;
		_tmp11__length1 = parts_length1;
		_tmp12_ = _tmp11_[3];
		_tmp13_ = parts;
		_tmp13__length1 = parts_length1;
		_tmp14_ = _tmp13_[4];
		_tmp15_ = g_strdup_printf ("[%s%s] %s", _tmp10_, _tmp12_, _tmp14_);
		result = _tmp15_;
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		return result;
	}
	_tmp16_ = msg;
	_tmp17_ = g_strdup (_tmp16_);
	result = _tmp17_;
	return result;
}
Example #17
0
RygelHTTPItemURI* rygel_http_item_uri_construct_from_string (GType object_type, const char* uri, RygelHTTPServer* http_server, GError** error) {
#line 233 "rygel-http-item-uri.c"
	GError * _inner_error_;
	RygelHTTPItemURI * self;
	char* _tmp0_;
	RygelHTTPServer* _tmp1_;
	char* request_uri;
	char** _tmp3_;
	gint _parts_size_;
	gint parts_length1;
	char** _tmp2_;
	char** parts;
	gboolean _tmp4_ = FALSE;
#line 45 "rygel-http-item-uri.vala"
	g_return_val_if_fail (uri != NULL, NULL);
#line 45 "rygel-http-item-uri.vala"
	g_return_val_if_fail (http_server != NULL, NULL);
#line 249 "rygel-http-item-uri.c"
	_inner_error_ = NULL;
#line 45 "rygel-http-item-uri.vala"
	self = (RygelHTTPItemURI*) g_object_new (object_type, NULL);
#line 49 "rygel-http-item-uri.vala"
	self->thumbnail_index = -1;
#line 50 "rygel-http-item-uri.vala"
	self->subtitle_index = -1;
#line 51 "rygel-http-item-uri.vala"
	self->transcode_target = (_tmp0_ = NULL, _g_free0 (self->transcode_target), _tmp0_);
#line 52 "rygel-http-item-uri.vala"
	self->http_server = (_tmp1_ = _g_object_ref0 (http_server), _g_object_unref0 (self->http_server), _tmp1_);
#line 54 "rygel-http-item-uri.vala"
	request_uri = string_replace (uri, rygel_http_server_get_path_root (http_server), "");
#line 263 "rygel-http-item-uri.c"
	parts = (_tmp3_ = _tmp2_ = g_strsplit (request_uri, "/", 0), parts_length1 = _vala_array_length (_tmp2_), _parts_size_ = parts_length1, _tmp3_);
#line 57 "rygel-http-item-uri.vala"
	if (parts_length1 < 2) {
#line 57 "rygel-http-item-uri.vala"
		_tmp4_ = TRUE;
#line 269 "rygel-http-item-uri.c"
	} else {
#line 57 "rygel-http-item-uri.vala"
		_tmp4_ = (parts_length1 % 2) == 0;
#line 273 "rygel-http-item-uri.c"
	}
#line 57 "rygel-http-item-uri.vala"
	if (_tmp4_) {
#line 277 "rygel-http-item-uri.c"
		_inner_error_ = g_error_new (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_BAD_REQUEST, _ ("Invalid URI '%s'"), request_uri);
		{
			if (_inner_error_->domain == RYGEL_HTTP_REQUEST_ERROR) {
				g_propagate_error (error, _inner_error_);
				_g_free0 (request_uri);
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				g_object_unref (self);
				return NULL;
			} else {
				_g_free0 (request_uri);
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				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 NULL;
			}
		}
	}
	{
		gint i;
#line 62 "rygel-http-item-uri.vala"
		i = 1;
#line 299 "rygel-http-item-uri.c"
		{
			gboolean _tmp5_;
#line 62 "rygel-http-item-uri.vala"
			_tmp5_ = TRUE;
#line 62 "rygel-http-item-uri.vala"
			while (TRUE) {
#line 306 "rygel-http-item-uri.c"
				GQuark _tmp13_;
				const char* _tmp12_;
				static GQuark _tmp13__label0 = 0;
				static GQuark _tmp13__label1 = 0;
				static GQuark _tmp13__label2 = 0;
				static GQuark _tmp13__label3 = 0;
#line 62 "rygel-http-item-uri.vala"
				if (!_tmp5_) {
#line 62 "rygel-http-item-uri.vala"
					i = i + 2;
#line 317 "rygel-http-item-uri.c"
				}
#line 62 "rygel-http-item-uri.vala"
				_tmp5_ = FALSE;
#line 62 "rygel-http-item-uri.vala"
				if (!(i < (parts_length1 - 1))) {
#line 62 "rygel-http-item-uri.vala"
					break;
#line 325 "rygel-http-item-uri.c"
				}
				_tmp12_ = parts[i];
				_tmp13_ = (NULL == _tmp12_) ? 0 : g_quark_from_string (_tmp12_);
				if (_tmp13_ == ((0 != _tmp13__label0) ? _tmp13__label0 : (_tmp13__label0 = g_quark_from_static_string ("item"))))
				switch (0) {
					default:
					{
						guchar* _tmp9_;
						gint _data_size_;
						gint data_length1;
						size_t _tmp7_;
						char* _tmp6_;
						guchar* _tmp8_;
						guchar* data;
						GString* builder;
						char* _tmp10_;
						data = (_tmp9_ = (_tmp8_ = g_base64_decode (_tmp6_ = soup_uri_decode (parts[i + 1]), &_tmp7_), _g_free0 (_tmp6_), _tmp8_), data_length1 = _tmp7_, _data_size_ = data_length1, _tmp9_);
#line 66 "rygel-http-item-uri.vala"
						builder = g_string_new ("");
#line 67 "rygel-http-item-uri.vala"
						g_string_append (builder, (const char*) data);
#line 68 "rygel-http-item-uri.vala"
						self->item_id = (_tmp10_ = g_strdup (builder->str), _g_free0 (self->item_id), _tmp10_);
#line 349 "rygel-http-item-uri.c"
						data = (g_free (data), NULL);
						_g_string_free0 (builder);
#line 70 "rygel-http-item-uri.vala"
						break;
#line 354 "rygel-http-item-uri.c"
					}
				} else if (_tmp13_ == ((0 != _tmp13__label1) ? _tmp13__label1 : (_tmp13__label1 = g_quark_from_static_string ("transcoded"))))
				switch (0) {
					default:
					{
						char* _tmp11_;
#line 72 "rygel-http-item-uri.vala"
						self->transcode_target = (_tmp11_ = soup_uri_decode (parts[i + 1]), _g_free0 (self->transcode_target), _tmp11_);
#line 74 "rygel-http-item-uri.vala"
						break;
#line 365 "rygel-http-item-uri.c"
					}
				} else if (_tmp13_ == ((0 != _tmp13__label2) ? _tmp13__label2 : (_tmp13__label2 = g_quark_from_static_string ("thumbnail"))))
				switch (0) {
					default:
					{
#line 76 "rygel-http-item-uri.vala"
						self->thumbnail_index = atoi (parts[i + 1]);
#line 78 "rygel-http-item-uri.vala"
						break;
#line 375 "rygel-http-item-uri.c"
					}
				} else if (_tmp13_ == ((0 != _tmp13__label3) ? _tmp13__label3 : (_tmp13__label3 = g_quark_from_static_string ("subtitle"))))
				switch (0) {
					default:
					{
#line 80 "rygel-http-item-uri.vala"
						self->subtitle_index = atoi (parts[i + 1]);
#line 82 "rygel-http-item-uri.vala"
						break;
#line 385 "rygel-http-item-uri.c"
					}
				} else
				switch (0) {
					default:
					{
#line 84 "rygel-http-item-uri.vala"
						break;
#line 393 "rygel-http-item-uri.c"
					}
				}
			}
		}
	}
#line 88 "rygel-http-item-uri.vala"
	if (self->item_id == NULL) {
#line 401 "rygel-http-item-uri.c"
		_inner_error_ = g_error_new_literal (RYGEL_HTTP_REQUEST_ERROR, RYGEL_HTTP_REQUEST_ERROR_NOT_FOUND, _ ("Not Found"));
		{
			if (_inner_error_->domain == RYGEL_HTTP_REQUEST_ERROR) {
				g_propagate_error (error, _inner_error_);
				_g_free0 (request_uri);
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				g_object_unref (self);
				return NULL;
			} else {
				_g_free0 (request_uri);
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
				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 NULL;
			}
		}
	}
	_g_free0 (request_uri);
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return self;
}
Example #18
0
gboolean ug_settings_safe_get_boolean (const gchar* key, gboolean _default_) {
	gboolean result = FALSE;
	GSettings* _tmp0_;
	GSettings* gsettings;
	GSettings* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_ = NULL;
	gchar** keys;
	gint keys_length1;
	gint _keys_size_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gboolean _tmp11_;
	g_return_val_if_fail (key != NULL, FALSE);
	_tmp0_ = g_settings_new (UG_SETTINGS_SCHEMA);
	gsettings = _tmp0_;
	_tmp1_ = gsettings;
	_tmp3_ = _tmp2_ = g_settings_list_keys (_tmp1_);
	keys = _tmp3_;
	keys_length1 = _vala_array_length (_tmp2_);
	_keys_size_ = keys_length1;
	_tmp4_ = keys;
	_tmp4__length1 = keys_length1;
	{
		gchar** k_collection = NULL;
		gint k_collection_length1 = 0;
		gint _k_collection_size_ = 0;
		gint k_it = 0;
		k_collection = _tmp4_;
		k_collection_length1 = _tmp4__length1;
		for (k_it = 0; k_it < _tmp4__length1; k_it = k_it + 1) {
			gchar* _tmp5_;
			gchar* k = NULL;
			_tmp5_ = g_strdup (k_collection[k_it]);
			k = _tmp5_;
			{
				const gchar* _tmp6_;
				const gchar* _tmp7_;
				_tmp6_ = k;
				_tmp7_ = key;
				if (g_strcmp0 (_tmp6_, _tmp7_) == 0) {
					GSettings* _tmp8_;
					const gchar* _tmp9_;
					gboolean _tmp10_ = FALSE;
					_tmp8_ = gsettings;
					_tmp9_ = key;
					_tmp10_ = g_settings_get_boolean (_tmp8_, _tmp9_);
					result = _tmp10_;
					_g_free0 (k);
					keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
					_g_object_unref0 (gsettings);
					return result;
				}
				_g_free0 (k);
			}
		}
	}
	_tmp11_ = _default_;
	result = _tmp11_;
	keys = (_vala_array_free (keys, keys_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (gsettings);
	return result;
}
Example #19
0
static GdkPixbuf* plank_drawing_drawing_service_load_pixbuf (const gchar* icon, gint size) {
	GdkPixbuf* result = NULL;
	GdkPixbuf* pbuf = NULL;
	GtkIconTheme* icon_theme = NULL;
	GtkIconTheme* _tmp0_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (icon != NULL, NULL);
	pbuf = NULL;
	_tmp0_ = gtk_icon_theme_get_default ();
	icon_theme = _tmp0_;
	{
		GtkIconTheme* _tmp1_ = NULL;
		const gchar* _tmp2_ = NULL;
		gboolean _tmp3_ = FALSE;
		_tmp1_ = icon_theme;
		_tmp2_ = icon;
		_tmp3_ = gtk_icon_theme_has_icon (_tmp1_, _tmp2_);
		if (_tmp3_) {
			GdkPixbuf* _tmp4_ = NULL;
			GtkIconTheme* _tmp5_ = NULL;
			const gchar* _tmp6_ = NULL;
			gint _tmp7_ = 0;
			GdkPixbuf* _tmp8_ = NULL;
			GdkPixbuf* _tmp9_ = NULL;
			_tmp5_ = icon_theme;
			_tmp6_ = icon;
			_tmp7_ = size;
			_tmp8_ = gtk_icon_theme_load_icon (_tmp5_, _tmp6_, _tmp7_, 0, &_inner_error_);
			_tmp4_ = _tmp8_;
			if (_inner_error_ != NULL) {
				goto __catch4_g_error;
			}
			_tmp9_ = _tmp4_;
			_tmp4_ = NULL;
			_g_object_unref0 (pbuf);
			pbuf = _tmp9_;
			_g_object_unref0 (_tmp4_);
		} else {
			const gchar* _tmp10_ = NULL;
			gboolean _tmp11_ = FALSE;
			_tmp10_ = icon;
			_tmp11_ = string_contains (_tmp10_, ".");
			if (_tmp11_) {
				gchar** parts = NULL;
				const gchar* _tmp12_ = NULL;
				gchar** _tmp13_ = NULL;
				gchar** _tmp14_ = NULL;
				gint parts_length1 = 0;
				gint _parts_size_ = 0;
				GtkIconTheme* _tmp15_ = NULL;
				gchar** _tmp16_ = NULL;
				gint _tmp16__length1 = 0;
				const gchar* _tmp17_ = NULL;
				gboolean _tmp18_ = FALSE;
				_tmp12_ = icon;
				_tmp14_ = _tmp13_ = g_strsplit (_tmp12_, ".", 0);
				parts = _tmp14_;
				parts_length1 = _vala_array_length (_tmp13_);
				_parts_size_ = parts_length1;
				_tmp15_ = icon_theme;
				_tmp16_ = parts;
				_tmp16__length1 = parts_length1;
				_tmp17_ = _tmp16_[0];
				_tmp18_ = gtk_icon_theme_has_icon (_tmp15_, _tmp17_);
				if (_tmp18_) {
					GdkPixbuf* _tmp19_ = NULL;
					GtkIconTheme* _tmp20_ = NULL;
					gchar** _tmp21_ = NULL;
					gint _tmp21__length1 = 0;
					const gchar* _tmp22_ = NULL;
					gint _tmp23_ = 0;
					GdkPixbuf* _tmp24_ = NULL;
					GdkPixbuf* _tmp25_ = NULL;
					_tmp20_ = icon_theme;
					_tmp21_ = parts;
					_tmp21__length1 = parts_length1;
					_tmp22_ = _tmp21_[0];
					_tmp23_ = size;
					_tmp24_ = gtk_icon_theme_load_icon (_tmp20_, _tmp22_, _tmp23_, 0, &_inner_error_);
					_tmp19_ = _tmp24_;
					if (_inner_error_ != NULL) {
						parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
						goto __catch4_g_error;
					}
					_tmp25_ = _tmp19_;
					_tmp19_ = NULL;
					_g_object_unref0 (pbuf);
					pbuf = _tmp25_;
					_g_object_unref0 (_tmp19_);
				}
				parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
			}
		}
	}
	goto __finally4;
	__catch4_g_error:
	{
		g_clear_error (&_inner_error_);
		_inner_error_ = NULL;
	}
	__finally4:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (pbuf);
		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 NULL;
	}
	result = pbuf;
	return result;
}
Example #20
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);
}
Example #21
0
GdkPixbuf* plank_drawing_drawing_service_load_icon (const gchar* names, gint width, gint height) {
	GdkPixbuf* result = NULL;
	GeeArrayList* all_names = NULL;
	GeeArrayList* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar** _tmp2_ = NULL;
	gchar** _tmp3_ = NULL;
	gchar** _tmp7_ = NULL;
	gchar** _tmp8_ = NULL;
	GdkPixbuf* pbuf = NULL;
	GdkPixbuf* _tmp42_ = NULL;
	gint _tmp60_ = 0;
	gint _tmp61_ = 0;
	gint _tmp62_ = 0;
	gint _tmp63_ = 0;
	GdkPixbuf* _tmp64_ = NULL;
	g_return_val_if_fail (names != NULL, NULL);
	_tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
	all_names = _tmp0_;
	_tmp1_ = names;
	_tmp3_ = _tmp2_ = g_strsplit (_tmp1_, ";;", 0);
	{
		gchar** s_collection = NULL;
		gint s_collection_length1 = 0;
		gint _s_collection_size_ = 0;
		gint s_it = 0;
		s_collection = _tmp3_;
		s_collection_length1 = _vala_array_length (_tmp2_);
		for (s_it = 0; s_it < _vala_array_length (_tmp2_); s_it = s_it + 1) {
			gchar* _tmp4_ = NULL;
			gchar* s = NULL;
			_tmp4_ = g_strdup (s_collection[s_it]);
			s = _tmp4_;
			{
				GeeArrayList* _tmp5_ = NULL;
				const gchar* _tmp6_ = NULL;
				_tmp5_ = all_names;
				_tmp6_ = s;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp5_, _tmp6_);
				_g_free0 (s);
			}
		}
		s_collection = (_vala_array_free (s_collection, s_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp8_ = _tmp7_ = g_strsplit (PLANK_DRAWING_DRAWING_SERVICE_MISSING_ICONS, ";;", 0);
	{
		gchar** s_collection = NULL;
		gint s_collection_length1 = 0;
		gint _s_collection_size_ = 0;
		gint s_it = 0;
		s_collection = _tmp8_;
		s_collection_length1 = _vala_array_length (_tmp7_);
		for (s_it = 0; s_it < _vala_array_length (_tmp7_); s_it = s_it + 1) {
			gchar* _tmp9_ = NULL;
			gchar* s = NULL;
			_tmp9_ = g_strdup (s_collection[s_it]);
			s = _tmp9_;
			{
				GeeArrayList* _tmp10_ = NULL;
				const gchar* _tmp11_ = NULL;
				_tmp10_ = all_names;
				_tmp11_ = s;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, _tmp11_);
				_g_free0 (s);
			}
		}
		s_collection = (_vala_array_free (s_collection, s_collection_length1, (GDestroyNotify) g_free), NULL);
	}
	pbuf = NULL;
	{
		GeeArrayList* _name_list = NULL;
		GeeArrayList* _tmp12_ = NULL;
		GeeArrayList* _tmp13_ = NULL;
		gint _name_size = 0;
		GeeArrayList* _tmp14_ = NULL;
		gint _tmp15_ = 0;
		gint _tmp16_ = 0;
		gint _name_index = 0;
		_tmp12_ = all_names;
		_tmp13_ = _g_object_ref0 (_tmp12_);
		_name_list = _tmp13_;
		_tmp14_ = _name_list;
		_tmp15_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp14_);
		_tmp16_ = _tmp15_;
		_name_size = _tmp16_;
		_name_index = -1;
		while (TRUE) {
			gint _tmp17_ = 0;
			gint _tmp18_ = 0;
			gint _tmp19_ = 0;
			gchar* name = NULL;
			GeeArrayList* _tmp20_ = NULL;
			gint _tmp21_ = 0;
			gpointer _tmp22_ = NULL;
			const gchar* _tmp23_ = NULL;
			gboolean _tmp24_ = FALSE;
			const gchar* _tmp30_ = NULL;
			gint _tmp31_ = 0;
			gint _tmp32_ = 0;
			gint _tmp33_ = 0;
			GdkPixbuf* _tmp34_ = NULL;
			GdkPixbuf* _tmp35_ = NULL;
			const gchar* _tmp36_ = NULL;
			GeeArrayList* _tmp37_ = NULL;
			gpointer _tmp38_ = NULL;
			gchar* _tmp39_ = NULL;
			gboolean _tmp40_ = FALSE;
			_tmp17_ = _name_index;
			_name_index = _tmp17_ + 1;
			_tmp18_ = _name_index;
			_tmp19_ = _name_size;
			if (!(_tmp18_ < _tmp19_)) {
				break;
			}
			_tmp20_ = _name_list;
			_tmp21_ = _name_index;
			_tmp22_ = gee_abstract_list_get ((GeeAbstractList*) _tmp20_, _tmp21_);
			name = (gchar*) _tmp22_;
			_tmp23_ = name;
			_tmp24_ = plank_drawing_drawing_service_icon_is_file (_tmp23_);
			if (_tmp24_) {
				const gchar* _tmp25_ = NULL;
				gint _tmp26_ = 0;
				gint _tmp27_ = 0;
				GdkPixbuf* _tmp28_ = NULL;
				GdkPixbuf* _tmp29_ = NULL;
				_tmp25_ = name;
				_tmp26_ = width;
				_tmp27_ = height;
				_tmp28_ = plank_drawing_drawing_service_load_pixbuf_from_file (_tmp25_, _tmp26_, _tmp27_);
				_g_object_unref0 (pbuf);
				pbuf = _tmp28_;
				_tmp29_ = pbuf;
				if (_tmp29_ != NULL) {
					_g_free0 (name);
					break;
				}
			}
			_tmp30_ = name;
			_tmp31_ = width;
			_tmp32_ = height;
			_tmp33_ = MAX (_tmp31_, _tmp32_);
			_tmp34_ = plank_drawing_drawing_service_load_pixbuf (_tmp30_, _tmp33_);
			_g_object_unref0 (pbuf);
			pbuf = _tmp34_;
			_tmp35_ = pbuf;
			if (_tmp35_ != NULL) {
				_g_free0 (name);
				break;
			}
			_tmp36_ = name;
			_tmp37_ = all_names;
			_tmp38_ = gee_abstract_list_last ((GeeAbstractList*) _tmp37_);
			_tmp39_ = (gchar*) _tmp38_;
			_tmp40_ = g_strcmp0 (_tmp36_, _tmp39_) != 0;
			_g_free0 (_tmp39_);
			if (_tmp40_) {
				const gchar* _tmp41_ = NULL;
				_tmp41_ = name;
				g_message ("DrawingService.vala:137: Could not find icon '%s'", _tmp41_);
			}
			_g_free0 (name);
		}
		_g_object_unref0 (_name_list);
	}
	_tmp42_ = pbuf;
	if (_tmp42_ != NULL) {
		gboolean _tmp43_ = FALSE;
		gboolean _tmp44_ = FALSE;
		gint _tmp45_ = 0;
		_tmp45_ = width;
		if (_tmp45_ != (-1)) {
			gint _tmp46_ = 0;
			_tmp46_ = height;
			_tmp44_ = _tmp46_ != (-1);
		} else {
			_tmp44_ = FALSE;
		}
		if (_tmp44_) {
			gboolean _tmp47_ = FALSE;
			gint _tmp48_ = 0;
			GdkPixbuf* _tmp49_ = NULL;
			gint _tmp50_ = 0;
			gint _tmp51_ = 0;
			_tmp48_ = width;
			_tmp49_ = pbuf;
			_tmp50_ = gdk_pixbuf_get_width (_tmp49_);
			_tmp51_ = _tmp50_;
			if (_tmp48_ != _tmp51_) {
				_tmp47_ = TRUE;
			} else {
				gint _tmp52_ = 0;
				GdkPixbuf* _tmp53_ = NULL;
				gint _tmp54_ = 0;
				gint _tmp55_ = 0;
				_tmp52_ = height;
				_tmp53_ = pbuf;
				_tmp54_ = gdk_pixbuf_get_height (_tmp53_);
				_tmp55_ = _tmp54_;
				_tmp47_ = _tmp52_ != _tmp55_;
			}
			_tmp43_ = _tmp47_;
		} else {
			_tmp43_ = FALSE;
		}
		if (_tmp43_) {
			GdkPixbuf* _tmp56_ = NULL;
			gint _tmp57_ = 0;
			gint _tmp58_ = 0;
			GdkPixbuf* _tmp59_ = NULL;
			_tmp56_ = pbuf;
			_tmp57_ = width;
			_tmp58_ = height;
			_tmp59_ = plank_drawing_drawing_service_ar_scale (_tmp56_, _tmp57_, _tmp58_);
			result = _tmp59_;
			_g_object_unref0 (pbuf);
			_g_object_unref0 (all_names);
			return result;
		}
		result = pbuf;
		_g_object_unref0 (all_names);
		return result;
	}
	g_warning ("DrawingService.vala:146: No icon found, return empty pixbuf");
	_tmp60_ = width;
	_tmp61_ = MAX (1, _tmp60_);
	_tmp62_ = height;
	_tmp63_ = MAX (1, _tmp62_);
	_tmp64_ = plank_drawing_drawing_service_get_empty_pixbuf (_tmp61_, _tmp63_);
	result = _tmp64_;
	_g_object_unref0 (pbuf);
	_g_object_unref0 (all_names);
	return result;
}
Example #22
0
static char* gtk_mate_exporter_css_names (GtkMateExporter* self, GtkMateScope* scope, gboolean inner) {
	char* this_name;
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (scope != NULL, NULL);
	this_name = NULL;
	_tmp0_ = FALSE;
	_tmp1_ = FALSE;
	if (GTK_MATE_IS_DOUBLE_PATTERN (scope->pattern)) {
		_tmp1_ = GTK_MATE_DOUBLE_PATTERN (scope->pattern)->content_name != NULL;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		_tmp0_ = inner;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		char* _tmp3_;
		const char* _tmp2_;
		_tmp3_ = NULL;
		_tmp2_ = NULL;
		this_name = (_tmp3_ = (_tmp2_ = GTK_MATE_DOUBLE_PATTERN (scope->pattern)->content_name, (_tmp2_ == NULL) ? NULL : g_strdup (_tmp2_)), this_name = (g_free (this_name), NULL), _tmp3_);
	} else {
		char* _tmp5_;
		const char* _tmp4_;
		_tmp5_ = NULL;
		_tmp4_ = NULL;
		this_name = (_tmp5_ = (_tmp4_ = gtk_mate_scope_get_name (scope), (_tmp4_ == NULL) ? NULL : g_strdup (_tmp4_)), this_name = (g_free (this_name), NULL), _tmp5_);
	}
	if (this_name != NULL) {
		char** _tmp7_;
		gint bits_size;
		gint bits_length1;
		char** _tmp6_;
		char** bits;
		const char* _tmp8_;
		char* current;
		GString* _result_;
		char* _tmp12_;
		const char* _tmp11_;
		_tmp7_ = NULL;
		_tmp6_ = NULL;
		bits = (_tmp7_ = _tmp6_ = g_strsplit (this_name, ".", 0), bits_length1 = _vala_array_length (_tmp6_), bits_size = bits_length1, _tmp7_);
		/* bits == ["meta", "class", "ruby"]*/
		_tmp8_ = NULL;
		current = (_tmp8_ = bits[0], (_tmp8_ == NULL) ? NULL : g_strdup (_tmp8_));
		_result_ = g_string_new ("");
		{
			gint i;
			i = 1;
			for (; i < bits_length1; i++) {
				char* _tmp10_;
				char* _tmp9_;
				g_string_append (_result_, current);
				_tmp10_ = NULL;
				_tmp9_ = NULL;
				current = (_tmp10_ = g_strconcat (_tmp9_ = g_strconcat (current, "_", NULL), bits[i], NULL), current = (g_free (current), NULL), _tmp10_);
				_tmp9_ = (g_free (_tmp9_), NULL);
				g_string_append (_result_, " ");
			}
		}
		g_string_append (_result_, current);
		_tmp12_ = NULL;
		_tmp11_ = NULL;
		this_name = (_tmp12_ = (_tmp11_ = _result_->str, (_tmp11_ == NULL) ? NULL : g_strdup (_tmp11_)), this_name = (g_free (this_name), NULL), _tmp12_);
		bits = (_vala_array_free (bits, bits_length1, (GDestroyNotify) g_free), NULL);
		current = (g_free (current), NULL);
		(_result_ == NULL) ? NULL : (_result_ = (g_string_free (_result_, TRUE), NULL));
	}
	return this_name;
}