X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fstyle.c;fp=libchimara%2Fstyle.c;h=557f3dcaa5170f3b467c034d87f45e6b7cdc0502;hb=6c2209c7aa7db00d64a70263d2ffd516d43e952f;hp=48883a94a0ba4d3e6d55c707a897f5181b308b19;hpb=f945dd447b55c34d88683ff48d7ffb0b7c3c2ad8;p=projects%2Fchimara%2Fchimara.git diff --git a/libchimara/style.c b/libchimara/style.c index 48883a9..557f3dc 100644 --- a/libchimara/style.c +++ b/libchimara/style.c @@ -657,19 +657,6 @@ style_accept_style_hint(GScanner *scanner, GtkTextTag *current_tag) return TRUE; } -/* Internal function: parses a glk color to a #hex-value */ -static void -glkcolor_to_hex(glui32 val, gchar *buffer) -{ - g_return_if_fail(buffer != NULL); - - sprintf(buffer, "#%02X%02X%02X", - ((val & 0xff0000) >> 16), - ((val & 0x00ff00) >> 8), - (val & 0x0000ff) - ); -} - /* Internal function: parses a glk color to a GdkColor */ void glkcolor_to_gdkcolor(glui32 val, GdkColor *color) @@ -699,7 +686,7 @@ apply_stylehint_to_tag(GtkTextTag *tag, GtkTextTag *default_tag, glui32 wintype, gint reverse_color = GPOINTER_TO_INT( g_object_get_data(tag_object, "reverse-color") ); int i = 0; - gchar color[20]; + GdkColor color; switch(hint) { case stylehint_Indentation: g_object_set(tag_object, "left-margin", 5*val, "left-margin-set", TRUE, NULL); @@ -770,22 +757,22 @@ apply_stylehint_to_tag(GtkTextTag *tag, GtkTextTag *default_tag, glui32 wintype, break; case stylehint_TextColor: - glkcolor_to_hex(val, color); + glkcolor_to_gdkcolor(val, &color); if(!reverse_color) - g_object_set(tag_object, "foreground", color, "foreground-set", TRUE, NULL); + g_object_set(tag_object, "foreground", &color, "foreground-set", TRUE, NULL); else - g_object_set(tag_object, "background", color, "background-set", TRUE, NULL); + g_object_set(tag_object, "background", &color, "background-set", TRUE, NULL); break; case stylehint_BackColor: - glkcolor_to_hex(val, color); + glkcolor_to_gdkcolor(val, &color); if(!reverse_color) - g_object_set(tag_object, "background", color, "background-set", TRUE, NULL); + g_object_set(tag_object, "background", &color, "background-set", TRUE, NULL); else - g_object_set(tag_object, "foreground", color, "background-set", TRUE, NULL); + g_object_set(tag_object, "foreground", &color, "background-set", TRUE, NULL); break;