Re: GtkStyleContext/Symbolic-Icons without GtkWidget

A quick run-down of the problems I'm having with the other approaches:

1] The functions gtk_status_icon_set_from_icon_name() and
gtk_status_icon_set_from_gicon() do in fact use
gtk_icon_info_load_symbolic_for_context() to attempt loading symbolic
icons using the context from a private GtkImage object. However, the
colors are all wrong - shouldn't the foreground color of the adwaita
theme be set to white, as how the system-tray icons of gome-shell
themselves are white? All three snippets below result in a white
foreground color:

// An empty path
path = gtk_widget_path_new ();
gtk_style_context_set_path (style_context, path);

// Simulate the GtkImage path of GtkStatusIcon
path = gtk_widget_path_new ();
gtk_widget_path_append_type (path, GTK_TYPE_IMAGE);
gtk_style_context_set_path (style_context, path);

// A random window (off-white)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
style_context = gtk_widget_get_style_context (window);

2] Since the GtkStyleContext of GtkStatusIcon is private, it is not
possible to manually render and composite pixbufs from several
symbolic icons before calling gtk_status_icon_set_from_pixbuf ().

I've also tried using GEmblemedIcon as an alternative to manually
compositing several pixbufs, however ran into several problems with
that approach:

2] The emblem position of a GEmblemedIcon can't be controlled. The
emblem attachment points can be retrieved with
gtk_icon_info_get_attach_points (), however they can't be modified.

3] GtkIconTheme discards emblems from GIcons. Since
gtk_status_icon_set_from_gicon() uses
gtk_icon_info_load_symbolic_for_context () to create a pixbuf, the
emblems of status-tray icons will be discarded.

Since GtkStatusIcon provides no method of displaying layered symbolic
icons I've had to resort to the workaround in the previous post,
though I would love to discover the proper way of accomplishing this.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]