X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=ghelpers.c;h=7acf588ab311ef9bb02a73746b40e74594e0ec81;hp=d9380a2a0c2a4323c144a5e4c5089c4f0347254f;hb=ed06328df452330b7210db2558ae125f6e0d8fe2;hpb=f762cef937f69d6a23127baf47f22e8ffaea4c11 diff --git a/ghelpers.c b/ghelpers.c index d9380a2a..7acf588a 100644 --- a/ghelpers.c +++ b/ghelpers.c @@ -30,6 +30,31 @@ GtkWidget *new_info_entry_in_frame(GtkWidget *box, const char *label) return entry; } +static void fill_color_from_rgb(GdkColor *c, gfloat r, gfloat g, gfloat b) +{ + gint R, G, B; + gchar tmp[8]; + + memset(c, 0, sizeof(*c)); + R = r * 255; + G = g * 255; + B = b * 255; + snprintf(tmp, sizeof(tmp), "#%02x%02x%02x", R, G, B); + gdk_color_parse(tmp, c); +} + +GtkWidget *new_info_entry_in_frame_rgb(GtkWidget *box, const char *label, + gfloat r, gfloat g, gfloat b) +{ + GtkWidget *entry; + GdkColor c; + + entry = new_info_entry_in_frame(box, label); + fill_color_from_rgb(&c, r, g, b); + gtk_widget_modify_text(entry, GTK_STATE_NORMAL, &c); + return entry; +} + GtkWidget *new_info_label_in_frame(GtkWidget *box, const char *label) { GtkWidget *label_widget;