Пример #1
0
/*
 * Method: set_mark_category_background(category, color)
 * category: a category (as a string).
 * color: a Gdk::Color.
 *
 * Sets given background color for mark category. If color is NULL,
 * the background color is unset.
 *
 * Returns: self.
 */
static VALUE
rg_set_mark_category_background(VALUE self, VALUE category, VALUE color)
{
    gtk_source_view_set_mark_category_background(_SELF (self),
                         RVAL2CSTR (category),
                         RVAL2GDKCOLOR((color)));
    return self;
}
static void
update_background_color (GeditView *view)
{
	GtkSourceView *source_view = GTK_SOURCE_VIEW (view);
	GtkSourceStyle *style;
	GtkSourceStyleScheme *scheme;
	GtkTextBuffer *buffer;
	
	buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
	
	scheme = gtk_source_buffer_get_style_scheme (GTK_SOURCE_BUFFER (buffer));
	style = gtk_source_style_scheme_get_style (scheme, "search-match");
	
	if (style)
	{
		gboolean bgset;
		gchar *bg;
		
		g_object_get (style, "background-set", &bgset, "background", &bg, NULL);
		
		if (bgset)
		{
			GdkColor color;
			gdk_color_parse (bg, &color);
			gtk_source_view_set_mark_category_background (source_view,
								      BOOKMARK_CATEGORY,
								      &color);
			g_free (bg);
			
			return;
		}
	}
	
	gtk_source_view_set_mark_category_background (source_view,
						      BOOKMARK_CATEGORY,
						      NULL);
}