GNOME Bugzilla – Bug 101987
Widget/class paths unknown for menus and dialogs
Last modified: 2004-12-22 21:47:04 UTC
Problem: One can not customize parts of GTK, since the widget and class paths are unknown. Please look at the attached code. It creates a main window, a menubar and one menu. Also, it creates a GtkFileSelection when "Open..." is selected from the menu. The names set for widgets are: GtkWindow(menutest).GtkVBox(vbox).GtkMenuBar(menubar) Also, GtkMenu(filemenu).GtkMenuItem(menuitem_1 and menuitem_2). GtkFileSelection(file_dialog). To change style for the menu, I assumed this would work: widget "menutest.vbox.menubar*" style "my_style" Alas, it does not change style of the menu items, only the menu bar itself. Even this does not work: widget "menutest*menuitem*" style "my_style" But this does: widget "*menuitem*" style "my_style" but now I have lost the information that only menu items under "menutest" shall be customized. I could rename my menu items "menutest_menuitem_n", so then ""menutest*menuitem*" would work. But this is not a general solution. I can not say "Apply this style to everything created by menutest" in principle like this (fixing the names), because some names are unknown. Take the file selection dialog. I would like to customize that. I name it "file_dialog", so I can say widget "*file_dialog*" style "my_style" But again, we loose the information that we really only mean file dialogs created by "menutest". Also, this does not customize the option menu or the dialogs created by file selection itself, for example, when pressing the "New Folder" there is a dialog popped up, this is not affected by widget "*file_dialog*" In fact, there is no documented way at all to customize a file dialog or menus created by one application, since the file dialog names used aren't documented. This does not customize menus or dialogs used by a file dialog either: widget_class "*GtkFileSelection*" style "my_style" Contrast this to Xt, where I can say (for a Motif compiled emacs) emacs*background: red and all widgets, menus, dialogs use red as background. I'd like to see something similar in GTK, so that menus and dialogs pick up the path names from their parents. They don't seem to do so now.
Created attachment 13223 [details] names.c
The use of gtkrc for customizing complicated widget paths is really not encouraged, so we aren't going to extend it at all. How it works (with the exception of bugs) is how it is going to work. Note that GtkMenu widgets are inside a (automatically created) GtkWindow widget ... so you need paths like GtkWindow.GtkMenu (or *.GtkMenu) not GtkMenu There might be some bug in the: > widget "menutest.vbox.menubar*" style "my_style" > > Alas, it does not change style of the menu items, only the menu bar > itself. I saw something like this a few weeks ago but didn't have time to investigate further. (If you play around a little bit you'll be able to find variants that work.)
Cannot reproduce any problems with paths of the form: widget_class "*GtkMenuBar*" style "menubaritem" Which is what I thought I was seeing problems with before. They seem to work fine