GNOME Bugzilla – Bug 753272
stickynotes: some settings are ignored
Last modified: 2015-11-15 04:11:08 UTC
Open the settings of Sticky Notes applet, and try to set font color, background color and font type. All of them ignored.
Most likely it will be fixed when ported to GtkStyleContext... I have no time to do it right now. stickynote_set_color and stickynote_set_font still use GtkRcStyle that is/was GTK+ 2 thing and I would not be surprised if that does not work with GTK+ 3. I have done few wrong things in this 8ff396c8ad595ac4f342521a9ddfcfbe5e2578db commit, but reverting them does not fix this bug. Wrong things: - colors[i].red = (colors[i].red * (10 - i)) / 10; - colors[i].green = (colors[i].green * (10 - i)) / 10; - colors[i].blue = (colors[i].blue * (10 - i)) / 10; + colors[i].red = (color.red * (10 - i)) / 10; + colors[i].green = (color.green * (10 - i)) / 10; + colors[i].blue = (color.blue * (10 - i)) / 10; and + font_color.red = color.red; + font_color.green = color.green; + font_color.blue = color.blue; Wrong because GdkColor values are from 0 - 65535, but GdkRGBA use 0 - 1.
I have restored color settings, but result might not be same as it used to be...
Thanks, it works well. But font type settings are still ignored, and I created a patch, which fixes the problem.
Created attachment 314600 [details] [review] stickynotes: don't ignore font type
(In reply to György Balló from comment #4) > Created attachment 314600 [details] [review] [review] > stickynotes: don't ignore font type Patch looks good to me, but can I ask you to redo patch without using deprecated function? It is not required, but it would be nice if you do it. For example you can look here: https://github.com/vain/slinp/commit/3f56e9473f62b3704d92b560715658556108ec78
I tried it, but I don't know how to restrict the specific CSS style for the actual note.
1) Add 'gchar *name;' in StickyNote struct. 2) In stickynote_new_aux generate name for example sticky-note-x, where x unique number/id. Probably add: static gint get_next_id (void) { static gint id = 0; return id++; } Use gtk_widget_set_name to set generated name. 3) Don't forget to free name in stickynote_free. Then you can use generated name to limit style for note. For example #sticky-note-1 { font: xxx; } Ideally we could store GtkCssProvider in struct, create function that generates css not only for font, but also for colors and then call this function from stickynote_set_color and stickynote_set_font.
Oh, it's so difficult to replace the gtk_widget_override_font function... I'm afraid that I can't implement this stuff. Could you implement it?
(In reply to György Balló from comment #8) > Oh, it's so difficult to replace the gtk_widget_override_font function... > I'm afraid that I can't implement this stuff. Could you implement it? Currently I have no free time to do this... :( I pushed your patch.