
On Tue, 2009-06-09 at 02:51 -0300, bulia byak wrote:
I should add that, after several days of tweaking this, starting from a patch by Felipe, I hate GTK more than ever. Its inconsistent behavior across platforms, poor configurability (can anyone please suggest how the list style can be set programmatically, not via an rc file? this style property is read-only in GTK!) and ambiguous documentation are really a shame. In the end I fixed everything except the above listed issues, using a few weird tricks but nothing really insane (standard GTK widgets only), and I think it should be good enough to release in 0.47. If and when someone comes up with a more advanced solution, it must be at least as good usability-wise as this one.
You probably want gtk_rc_parse_string and gtk_widget_set_name. Here's a code snippet from the indicator-applet. (note: the names are slightly complex as we had to lie about our type for some backwards compatibility, but you get the idea)
gtk_rc_parse_string ( "style "indicator-applet-style"\n" "{\n" " GtkMenuBar::shadow-type = none\n" " GtkMenuBar::internal-padding = 0\n" " GtkWidget::focus-line-width = 0\n" " GtkWidget::focus-padding = 0\n" "}\n" "style "indicator-applet-menubar-style"\n" "{\n" " GtkMenuBar::shadow-type = none\n" " GtkMenuBar::internal-padding = 0\n" " GtkWidget::focus-line-width = 0\n" " GtkWidget::focus-padding = 0\n" " GtkMenuItem::horizontal-padding = 0\n" "}\n" "style "indicator-applet-menuitem-style"\n" "{\n" " GtkWidget::focus-line-width = 0\n" " GtkWidget::focus-padding = 0\n" " GtkMenuItem::horizontal-padding = 0\n" "}\n" "widget "*.fast-user-switch-applet" style "indicator-applet-style"" "widget "*.fast-user-switch-menuitem" style "indicator-applet-menuitem-style"" "widget "*.fast-user-switch-menubar" style "indicator-applet-menubar-style""); gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet");
--Ted