Re: GtkItemFactoryEntry question

Starkweather Collin K <Collin Starkweather Colorado EDU> writes:

> I'm just getting started with Gtk, so pardon my newbie question and please
> let me know if there's a more appropriate forum for my posting. 
> I'm trying to create a menubar with menu items whose names have a '/' in
> them.  For example, see /var/log/messages below:
> static GtkItemFactoryEntry menu_array[] = 
> {
>   { "/_File" , NULL, NULL, 0, "<Branch>" },
>   { "/_File//var/log/messages", NULL, gtk_main_quit, 0,NULL },
>   { "/_Help", NULL, NULL, 0, "<LastBranch>" },
>   { "/_Help/About", NULL, NULL, 1, NULL}
> };
> The / is interpreted as a special character and I haven't been able to
> figure out how to escape it, nor have I been able to find documentation
> that indicates how to do so. None of \, \\, and % seemed to do the trick.
> I'd appreciate either of the answer or a reference to documentation that
> would provide an answer.

I don't think there is a way...

Could you file a bug on, product gtk+ about this?

A way of fake it is to pass an appropriate function to 

void   gtk_item_factory_set_translate_func (GtkItemFactory      *ifactory,
					    GtkTranslateFunc     func,
					    gpointer             data,
					    GtkDestroyNotify     notify);

The GtkTranslateFunc is called on the string before the label
is created, so you could pass in a function that did URL-style
%2f unescaping, or whatever. (The escaping would have to 
hide the the / character.)


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