Standard Dialog Container?

Hi! I’m currently working on [Synfig Studio] Improve vectorizer dialog · Issue #2018 · synfig/synfig · GitHub and I noticed that the different dialogs use different methods for creating themselves. For example, CanvasProperties uses a Gtk::Table, CanvasOptions uses a GTK::Builder, and VectorizerSettings uses a GTK::Grid. Is there a preferred way to create a dialog with option widgets?

From what I can tell, GTK::Builder is preferred, but a bit of a hassle to implement. If that’s the case, then would it be alright if I reworked VectorizerSetting’s Grid into a Table?

Edit: Apparently Table is deprecated, so I’ve focused on learning more about Grid.

Edit2: I decided to use Grid’s features to fix the issue. However, I would still like to know about the standard way to create dialogs with gtkmm.

If implementable Gtk::Builder is preferred because this allows programmers to separate logic and UI into their own files. That way, designers who don’t code can still contribute their frontend UI/UX skills. And programmers can focus on problem-solving parts.

Gtk::Grid works too but you the programmer are solely responsible for implementing both the UI and logic code in one .cpp file.

From what I can tell, GTK::Builder is preferred, but a bit of a hassle to implement.

If you’re familiar Glade and how to load the UI file in cpp. It’s easy :slight_smile:

However, I would still like to know about the standard way to create dialogs with gtkmm.

There’s no “standard” defined among the Synfig community yet but if I’m correct there’s an ongoing work to migrate all Synfig dialog to Gtk::Builder

But it’s your choice.
If Gtk::Builder seems difficult for you, you can proceed ahead with Gtk::Grid

1 Like

@Keyikedalube Thanks for the advice. I submitted a pull request with the Grid changes, but I’ll definitely try my hand at using Builder now.

1 Like

@rodolforg Hi! I see that you worked with glade in Dialog_PreviewOptions, and I would like to know more about that. I’m working on transitioning the VectorizerSettings dialog into using Builder and Glade. I currently have the glade file for VectorizerSettings made, but I’m stuck on implementing it into the code. Are there any tips you have for me?

The git log for commit 9207c07d523e93766aef84b210dc66319087be68 (PR #900)

Preview Settings Dialog now uses GtkBuilder

 Preview Settings Dialog now uses GtkBuilder

PS:
When 'porting' a dialog to GtkBuilder:

1. Now the toplevel window (the dialog class) is instanced
via GtkBuilder, it should be explicitly freed by caller.
This one was already correctly free, but several dialogs are
not originally stored via pointers, so...

2. Don't forget to add it to synfig-studio/ui/Makefile.am and
to synfig-studio/po/POTFILES.in
(I don't know how should be done for CMake)

3. Don't forget to add the .ui file to repository... as I did
1 Like

Thanks! This is a great commit to reference!