I just started using Glade 3.8.5 on Slackware 14.2. I have successfully created a simple window with a callback handler for the "destroy" signal. This is fine for a small and simple tutorial. However, it can be tedious to implement all callback functions manually. There is a chance that I will even forget a few if the GUI is a bit more complicated. Are there any tools that will automatically generate a skeleton for those callback functions in c? I could not find anything via websearch and I am also not sure what tags to search for.
-
If you are finding it annoying (**edit** tedious) to write the exhaustive code that C requires, you might prefer another language. – Weather Vane Jan 29 '18 at 21:15
-
@WeatherVane Did you actually understand the question? I am talking about boiler plate code that can be generated automatically. I do not shy away from exhaustive coding per se. It is very inefficient to always switch back to glade and look what name I gave to the signal handler. I can probably code something myself to do what I want but I do not want to reinvent the wheel. Your comment is neither constructive nor is it particularly witty. Anyway, I changed "annoying" to "tedious" although I did not expect anyone would get hung up on a vocabule. – Jan 29 '18 at 21:23
-
Please see the reason for my close vote. I was not trying to be witty. Your question "Are there any tools that will ..." is off topic. – Weather Vane Jan 29 '18 at 21:27
-
@WeatherVane I am familiar with the rules and they clearly state that questions about "software tools commonly used by programmers" (third bulletin point) are definetly acceplable. I would say that "Glade" falls under aforementioned category. – Jan 29 '18 at 21:30
-
Glade has 69 followers. – Weather Vane Jan 29 '18 at 21:31
-
1@WeatherVane It still has its own tag, the number of followers on **this** site is not necessarily represantative for its popularity and it is standardly included in all major Linux distributions which makes it a common tool. – Jan 29 '18 at 21:37
-
If you generate automatic callback function, how do you expect to populate the functions? Do you expect Glade to create a *.c file or ? I use Glade a lot, and I understand what you are asking, but there are missing pieces in this puzzle. – theGtknerd Jan 29 '18 at 22:16
-
I think the answer is basically, **no**. There aren't any such tools... – José Fonte Jan 29 '18 at 22:49
-
1Now that I think of it, Anjuta has a drag and drop signal to function creator. – theGtknerd Jan 29 '18 at 22:55
-
Maybe GNOME Builder has a feature similar to the Anjuta one? – liberforce Jan 30 '18 at 12:52
2 Answers
Not sure I understand what you mean by "implement all callback functions manually". The implementation is the content of your callback function, and writing it is your job, because you're the only one who knows what you are trying to achieve.
There is a chance that I will even forget a few if the GUI is a bit more complicated
Each widget has lots and lots of signals. Glade helps you design the UI, but you only have to implement those for which the default comportment doesn't suit what you are trying to achieve.
Now if by "implement all callback functions manually" you mean "write the callback skeleton manually", well at some point back in time glade had some code generation features, but that has been (rightfuly) removed. That's because modifying generated code is a mess to maintain. Coding that skeleton is just a matter of copy/pasting the signal signature from the documentation and giving your callback a name.

- 11,189
- 37
- 48
-
Yes, I did mean a skeleton, I edited the question to make it clearer. It is not just a matter of copy/paste, but also that I have to switch between Glade and my editor to look up the names that I gave to my signal. If there are many signals then I will have to check every widget to make sure I did not forget something. Anyway, thanks for the answer. – Jan 30 '18 at 14:54
-
Are you using the autoconnect feature? If not, you can just get your widgets in your code using a `GtkBuilder` object, and connect your signals manually. This way you have to add more code as you'll have to connect the signals by yourself, but at the same time you get rid of having to make the callbacks names matching between your ui file and your code. – liberforce Jan 30 '18 at 15:05
Anjuta does have Glade built in. I just recently decided to use Anjuta and GTK+ 3.2 to develop a small project. There are some quirks, for instance, inside Anjuta you have to use the "shift" key with the mouse to move around widgets (e.g. buttons, labels, etc.) in the UI development window (in Glade there is a symbol on the toolbar you click that allows you to move widgets with the mouse).
It's ironic that you ask the specific question about skeleton functions for widget signal handling. I have just discovered this same issue when building my project in Anjuta. I did notice that by default the "destroy" window callback function is always created on the window. If I discover how to get Anjuta to create the skeleton functions I will post back....if not I will just use the copy/paste and modify as required.