Exemple #1
0
static char* gtk_mate_exporter_theme_name_css (GtkMateExporter* self) {
	char* _tmp1_;
	GtkMateBuffer* _tmp0_;
	char* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = NULL;
	_tmp0_ = NULL;
	_tmp2_ = NULL;
	return (_tmp2_ = string_helper_gsub (_tmp1_ = g_utf8_strdown (gtk_mate_colourer_get_theme (gtk_mate_parser_get_colourer ((_tmp0_ = gtk_mate_exporter_buffer (self))->parser))->name, -1), " ", "_"), _tmp1_ = (g_free (_tmp1_), NULL), (_tmp0_ == NULL) ? NULL : (_tmp0_ = (g_object_unref (_tmp0_), NULL)), _tmp2_);
}
Exemple #2
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);
}
Exemple #3
0
static char* gtk_mate_exporter_css (GtkMateExporter* self) {
	GtkMateColourer* _tmp0_;
	GtkMateColourer* colourer;
	GString* _result_;
	char* _tmp3_;
	char* _tmp2_;
	char* _tmp1_;
	char* _tmp13_;
	char* _tmp12_;
	char* _tmp11_;
	char* _tmp10_;
	char* _tmp9_;
	char* _tmp8_;
	char* _tmp7_;
	char* _tmp6_;
	char* _tmp5_;
	char* _tmp4_;
	char* _tmp16_;
	char* _tmp15_;
	char* _tmp14_;
	char* selection_colour;
	gboolean _tmp17_;
	const char* _tmp44_;
	char* _tmp45_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = NULL;
	colourer = (_tmp0_ = gtk_mate_parser_get_colourer (GTK_MATE_BUFFER (gtk_text_view_get_buffer ((GtkTextView*) self->view))->parser), (_tmp0_ == NULL) ? NULL : g_object_ref (_tmp0_));
	_result_ = g_string_new ("");
	_tmp3_ = NULL;
	_tmp2_ = NULL;
	_tmp1_ = NULL;
	g_string_append (_result_, _tmp3_ = g_strconcat (_tmp2_ = g_strconcat ("/* Stylesheet generated from theme: ", _tmp1_ = gtk_mate_exporter_theme_name (self), NULL), " */\n\n", NULL));
	_tmp3_ = (g_free (_tmp3_), NULL);
	_tmp2_ = (g_free (_tmp2_), NULL);
	_tmp1_ = (g_free (_tmp1_), NULL);
	g_string_append (_result_, "body {\n\tmargin: 0;\n\tpadding: 0;\n}\n\n");
	g_string_append (_result_, "pre.textmate-source {\n\tmargin: 0;\n\tpadding: 0 0 0 2px;\n\tfont-family: Monaco, monospace;\n" "\tfont-size: 11px;\n\tline-height: 1.3em;\n\tword-wrap: break-word;\n\twhite-space: pre;\n" "\twhite-space: pre-wrap;\n\twhite-space: -moz-pre-wrap;\n\twhite-space: -o-pre-wrap;\n}\n\n");
	_tmp13_ = NULL;
	_tmp12_ = NULL;
	_tmp11_ = NULL;
	_tmp10_ = NULL;
	_tmp9_ = NULL;
	_tmp8_ = NULL;
	_tmp7_ = NULL;
	_tmp6_ = NULL;
	_tmp5_ = NULL;
	_tmp4_ = NULL;
	g_string_append (_result_, _tmp13_ = g_strconcat (_tmp12_ = g_strconcat (_tmp10_ = g_strconcat (_tmp9_ = g_strconcat (_tmp7_ = g_strconcat (_tmp6_ = g_strconcat (_tmp5_ = g_strconcat ("pre.textmate-source.", _tmp4_ = gtk_mate_exporter_theme_name_css (self), NULL), " {\n", NULL), "\tcolor: ", NULL), _tmp8_ = gtk_mate_colourer_global_foreground_colour (colourer), NULL), ";\n\tbackground-color: ", NULL), _tmp11_ = gtk_mate_colourer_global_background_colour (colourer), NULL), ";\n}\n\n", NULL));
	_tmp13_ = (g_free (_tmp13_), NULL);
	_tmp12_ = (g_free (_tmp12_), NULL);
	_tmp11_ = (g_free (_tmp11_), NULL);
	_tmp10_ = (g_free (_tmp10_), NULL);
	_tmp9_ = (g_free (_tmp9_), NULL);
	_tmp8_ = (g_free (_tmp8_), NULL);
	_tmp7_ = (g_free (_tmp7_), NULL);
	_tmp6_ = (g_free (_tmp6_), NULL);
	_tmp5_ = (g_free (_tmp5_), NULL);
	_tmp4_ = (g_free (_tmp4_), NULL);
	g_string_append (_result_, "pre.textmate-source .linenum {\n");
	g_string_append (_result_, "\twidth: 75px;\n");
	g_string_append (_result_, "\tpadding: 0.1em 1em 0.2em 0;\n");
	g_string_append (_result_, "\tcolor: #888;\n");
	g_string_append (_result_, "\tbackground-color: #eee;\n");
	g_string_append (_result_, "}\n\n");
	_tmp16_ = NULL;
	_tmp15_ = NULL;
	_tmp14_ = NULL;
	g_string_append (_result_, _tmp16_ = g_strconcat (_tmp15_ = g_strconcat ("pre.textmate-source.", _tmp14_ = gtk_mate_exporter_theme_name_css (self), NULL), " span {\n", NULL));
	_tmp16_ = (g_free (_tmp16_), NULL);
	_tmp15_ = (g_free (_tmp15_), NULL);
	_tmp14_ = (g_free (_tmp14_), NULL);
	g_string_append (_result_, "\tpadding-top: 0.2em;\n");
	g_string_append (_result_, "\tpadding-bottom: 0.1em;\n");
	g_string_append (_result_, "}\n\n");
	selection_colour = (char*) gee_map_get ((GeeMap*) gtk_mate_colourer_get_theme (colourer)->global_settings, "selection");
	_tmp17_ = FALSE;
	if (selection_colour != NULL) {
		_tmp17_ = _vala_strcmp0 (selection_colour, "") != 0;
	} else {
		_tmp17_ = FALSE;
	}
	if (_tmp17_) {
		char* _tmp20_;
		char* _tmp19_;
		char* _tmp18_;
		char* _tmp21_;
		_tmp20_ = NULL;
		_tmp19_ = NULL;
		_tmp18_ = NULL;
		g_string_append (_result_, _tmp20_ = g_strconcat (_tmp19_ = g_strconcat ("pre.textmate-source.", _tmp18_ = gtk_mate_exporter_theme_name_css (self), NULL), " ::selection {\n", NULL));
		_tmp20_ = (g_free (_tmp20_), NULL);
		_tmp19_ = (g_free (_tmp19_), NULL);
		_tmp18_ = (g_free (_tmp18_), NULL);
		_tmp21_ = NULL;
		g_string_append (_result_, _tmp21_ = gtk_mate_exporter_colour (self, selection_colour));
		_tmp21_ = (g_free (_tmp21_), NULL);
		g_string_append (_result_, "}\n\n");
	}
	{
		GeeIterator* _setting_it;
		_setting_it = gee_iterable_iterator ((GeeIterable*) gtk_mate_colourer_get_theme (colourer)->settings);
		while (gee_iterator_next (_setting_it)) {
			GtkMateThemeSetting* setting;
			char* _tmp23_;
			char* _tmp22_;
			char* _tmp34_;
			char* _tmp33_;
			char* _tmp32_;
			char* _tmp31_;
			char* _tmp30_;
			char* _tmp29_;
			char* _tmp28_;
			char* _tmp27_;
			char* _tmp26_;
			char* _tmp25_;
			char* _tmp24_;
			char* _tmp35_;
			gboolean _tmp36_;
			char* font_style;
			gboolean _tmp40_;
			gboolean _tmp41_;
			gboolean _tmp42_;
			char* bg_colour;
			setting = (GtkMateThemeSetting*) gee_iterator_get (_setting_it);
			_tmp23_ = NULL;
			_tmp22_ = NULL;
			g_string_append (_result_, _tmp23_ = g_strconcat (_tmp22_ = g_strconcat ("/* ", setting->name, NULL), " */\n", NULL));
			_tmp23_ = (g_free (_tmp23_), NULL);
			_tmp22_ = (g_free (_tmp22_), NULL);
			_tmp34_ = NULL;
			_tmp33_ = NULL;
			_tmp32_ = NULL;
			_tmp31_ = NULL;
			_tmp30_ = NULL;
			_tmp29_ = NULL;
			_tmp28_ = NULL;
			_tmp27_ = NULL;
			_tmp26_ = NULL;
			_tmp25_ = NULL;
			_tmp24_ = NULL;
			g_string_append (_result_, _tmp34_ = g_strconcat (_tmp33_ = g_strconcat (_tmp26_ = g_strconcat (_tmp25_ = g_strconcat ("pre.textmate-source.", _tmp24_ = gtk_mate_exporter_theme_name_css (self), NULL), " .", NULL), _tmp32_ = string_helper_gsub (_tmp28_ = string_helper_gsub (_tmp27_ = string_helper_gsub (setting->selector, ".", "_"), " ", " ."), ", ", _tmp31_ = g_strconcat (_tmp30_ = g_strconcat (", pre.textmate-source.", _tmp29_ = gtk_mate_exporter_theme_name_css (self), NULL), " ", NULL)), NULL), " {\n", NULL));
			_tmp34_ = (g_free (_tmp34_), NULL);
			_tmp33_ = (g_free (_tmp33_), NULL);
			_tmp32_ = (g_free (_tmp32_), NULL);
			_tmp31_ = (g_free (_tmp31_), NULL);
			_tmp30_ = (g_free (_tmp30_), NULL);
			_tmp29_ = (g_free (_tmp29_), NULL);
			_tmp28_ = (g_free (_tmp28_), NULL);
			_tmp27_ = (g_free (_tmp27_), NULL);
			_tmp26_ = (g_free (_tmp26_), NULL);
			_tmp25_ = (g_free (_tmp25_), NULL);
			_tmp24_ = (g_free (_tmp24_), NULL);
			_tmp35_ = NULL;
			if ((_tmp36_ = (_tmp35_ = (char*) gee_map_get ((GeeMap*) setting->settings, "foreground")) != NULL, _tmp35_ = (g_free (_tmp35_), NULL), _tmp36_)) {
				char* _tmp39_;
				char* _tmp38_;
				char* _tmp37_;
				_tmp39_ = NULL;
				_tmp38_ = NULL;
				_tmp37_ = NULL;
				g_string_append (_result_, _tmp39_ = g_strconcat (_tmp38_ = g_strconcat ("\tcolor: ", _tmp37_ = (char*) gee_map_get ((GeeMap*) setting->settings, "foreground"), NULL), ";\n", NULL));
				_tmp39_ = (g_free (_tmp39_), NULL);
				_tmp38_ = (g_free (_tmp38_), NULL);
				_tmp37_ = (g_free (_tmp37_), NULL);
			}
			font_style = (char*) gee_map_get ((GeeMap*) setting->settings, "fontStyle");
			_tmp40_ = FALSE;
			if (font_style != NULL) {
				_tmp40_ = strstr (font_style, "italic") != NULL;
			} else {
				_tmp40_ = FALSE;
			}
			if (_tmp40_) {
				g_string_append (_result_, "\tfont-style: italic;\n");
			}
			_tmp41_ = FALSE;
			if (font_style != NULL) {
				_tmp41_ = strstr (font_style, "underline") != NULL;
			} else {
				_tmp41_ = FALSE;
			}
			if (_tmp41_) {
				g_string_append (_result_, "\ttext-decoration: underline;\n");
			}
			_tmp42_ = FALSE;
			if (font_style != NULL) {
				_tmp42_ = strstr (font_style, "bold") != NULL;
			} else {
				_tmp42_ = FALSE;
			}
			if (_tmp42_) {
				g_string_append (_result_, "\tfont-weight: bold;\n");
			}
			bg_colour = (char*) gee_map_get ((GeeMap*) setting->settings, "background");
			if (bg_colour != NULL) {
				char* _tmp43_;
				_tmp43_ = NULL;
				g_string_append (_result_, _tmp43_ = gtk_mate_exporter_colour (self, bg_colour));
				_tmp43_ = (g_free (_tmp43_), NULL);
			}
			g_string_append (_result_, "}\n\n");
			(setting == NULL) ? NULL : (setting = (g_object_unref (setting), NULL));
			font_style = (g_free (font_style), NULL);
			bg_colour = (g_free (bg_colour), NULL);
		}
		(_setting_it == NULL) ? NULL : (_setting_it = (g_object_unref (_setting_it), NULL));
	}
	_tmp44_ = NULL;
	_tmp45_ = NULL;
	return (_tmp45_ = (_tmp44_ = _result_->str, (_tmp44_ == NULL) ? NULL : g_strdup (_tmp44_)), (colourer == NULL) ? NULL : (colourer = (g_object_unref (colourer), NULL)), (_result_ == NULL) ? NULL : (_result_ = (g_string_free (_result_, TRUE), NULL)), selection_colour = (g_free (selection_colour), NULL), _tmp45_);
}