Lightweight way for Glade to support custom widgets in a project?
Brian Marshall <[email protected]>
| Newsgroups | gmane.comp.gnome.glade.user |
|---|---|
| Message-ID | <CA+aUi_VFOTmUERz_354jmkaaVk0P-Mhts2+saWcrSA-pHJhETg@mail.gmail.com> |
Hi, I'm trying to get Glade to work with a custom widget that I'm using. It's a very minor extension to GtkEntry, with a couple extra properties and methods defined. It works fine already if I add it at runtime with code. It also works fine if I manually edit the Glade .ui file and change class="GtkEntry" to class="MyWidget" - GtkBuilder finds the widget class in my Python code and adds it to the window. The problem is that if I open the .ui file in Glade after this, it just deletes the custom widget. I've read that I need to add a catalog file to get Glade to recognize the widget, but that seems like overkill, and has a flaw: if someone (or me, on another computer) opens the project in Glade, and doesn't have the catalog file installed, then Glade will silently delete the widget from the window. Is there some way to provide support for a custom widget in the .ui file itself? It doesn't have to be extensive support, but it would be nice if I could get Glade to keep the widget when it loads the file. Even a simple alias from MyWidget to GtkEntry would work. Something like: <alias from="MyWidget" to="GtkEntry"/> <interface> ... </interface> (Probably not the best solution, but just to get my idea across.) That would be enough to get Glade to display it and allow manipulation, with the actual custom parts done at program runtime, since GtkBuilder handles it from there. Basically I'm looking for a way to move and place the widget in Glade, in a way that is embedded in the project, so that the failure case of silently deleting the widget on project load can never happen. My current solution is to add the custom widget completely from code - Glade never sees it. Another solution is to put GtkEntry placeholders in Glade, and replace them at runtime, but that has more overhead (in terms of amount of code that I need to write, at least), since as far as I know replacing something in GTK requires removing it and adding a new element in the same place. Also I want to clarify that if I take Glade out of the equation, and edit the .ui file manually and load it with GtkBuilder, then everything works. The only issue is that Glade doesn't recognize the widget when I'm editing the project. Thanks in advance for any responses, I appreciate your time. -- Brian _______________________________________________ Glade-users maillist - [email protected] http://lists.ximian.com/mailman/listinfo/glade-users