Message-ID: <43A1E8A3.108 at rftp.com> Date: Thu, 15 Dec 2005 14:05:23 -0800 From: Robert Roessler Organization: Robert's High-performance Software MIME-Version: 1.0 To: LablGTK List Subject: Re: Question about class ui_manager? References: <43A165E2.1020806 at rftp.com> <20051215.225622.95506504.garrigue at math.nagoya-u.ac.jp> In-Reply-To: <20051215.225622.95506504.garrigue at math.nagoya-u.ac.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jacques Garrigue wrote: > From: Robert Roessler > >> I am trying to use the method "add_ui" in the ui_manager class to add >> a separator element. >> >> It looks to me like the "name" parameter should be handled like the >> action parameter - they both should be of type "string option", >> allowing the name to not be present as is already allowed by the action. > > In the documentation, action can be NULL, but nothing is said about > name. > If you look the source code, you will see that the function starts > with: > g_return_if_fail (name != NULL); > > So clearly you have to pass a meaningful name... All right... after looking at gtkuimanager.c, I actually wonder if it is possible to add separators using this method - at least in "stream mode", where you just keep adding elements after the same parent, e.g., a menu. Interestingly, when the UIManager is parsing an XML representation, it appears to special-case the names for separators: the name pointer gets set to NULL, and its length to -1. But add_ui only treats separators specially to the extent that, as you say, the "no action" case is permitted - you are forced to use a name, which in turn is passed to get_child_node() without being "fixed" as it is in the parsing case. Sigh - yes, it works fine to do it the ugly and verbose way - construct the full XML and pass it to add_ui_from_string for EVERY separator... I consider this a bug in the underlying GTK implementation (noting,of course, that I am not an expert on the subject). ;) If it is determined by the GTK people that it needs fixing, and is fixed by allowing NO name, THEN LablGTK would need to switch to a string option typing for name... if it is fixed by recognizing a "magic" name of "separator" (not as good, I think), then nothing would need to happen with the binding. Robert Roessler robertr@rftp.com http://www.rftp.com