How to create the modern GtkMessageDialog boxes in Glade?

By default it would look like the upper dialog. But I would like to have something like the lower one from nautilus.

I tried a lot of settings on the GtkButtonBox to make it wider, but nothing has any effect.

Also, how can that button be red?

It seems nautilus is not made with glade, since I can’t open the .ui files there. So I wasn’t able to look it up.

Thanks

gnome-disks uses a similar dialog and glade, but there is not a single mention of that error string anywhere in the code. So I couldn’t find how it is created there

Hi, Glade is not able to do a lot of standard things, and is longer developed. I recommend just using a text editor instead. You can also try Cambalache, which is the new replacement for Glade.

thanks. Does that mean I’d have to redo the whole GUI in cambalache? Or is there some sort of compatibility between glade and cambalache?

Why are you trying to build your own message dialog, when GTK has one? Or, even better, there’s the libadwaita MessageDialog which has a better API and a better UI.

I’m already trying to use the GtkMessageDialog, as proposed in your link, but it won’t look right in glade…

Okay, the question is: why are you using Glade for building message dialogs?

Generally speaking, message dialogs are built in your code as a way to notify the user of something; there’s no real reason why you should be using Glade for them.

Thanks!

I just tried it via

message_dialog = Gtk.MessageDialog(
    self.window,
    Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
    Gtk.MessageType.QUESTION,
    Gtk.ButtonsType.YES_NO,
    "parimary " * 10,
)
message_dialog.format_secondary_text("secondary " * 10)
message_dialog.run()

and it worked well! (Note that I have no clue about the flags and stuff, I just glued stuff from the internet together with some configuration and fixes)

image

at the moment we are modifying the text of the glade-dialog before we display it each time. I’ll generate them dynamically from now on

To be honest, I’m a bit reluctant to switch to libadwaita because of the theming debate. And because I’d like to avoid rewriting everything.

well, I just realized that I asked the same question half a year ago, and actually found a solution for glade back then: How to make those modern Gtk.MessageDialogs

whoops.

You don’t have to rewrite anything, it is just a library of great widgets that will make your life easier.

There is not a “debate”, the situation with theming in libadwaita is roughly the same as a GTK3 app using the Adwaita theme, or better because of the improved support for recoloring.

We are still using GTK 3 though, libadwaita is only for GTK 4, isn’t it? We would at least have to rebuild the glade gui in cambalache as far as I can tell

For example:

I’m a GNOME user and fine with the looks (after having installed a different color scheme from GitHub - lassekongo83/adw-colors: Color themes for libadwaita and adw-gtk3), but I want the application to integrate well with KDE. I would like to avoid discussing this now though, and I don’t want to take sides. I’m just observing that this is an issue for some people.

I don’t see any debate there, I see some statements of fact: If app developers choose to make their app require a theme (i.e. Adwaita, or Breeze, or Yaru, anything else) then that’s what you will get with that app, unless of course you hack/fork it. And I would say GNOME theming was never really “alive” either in the last several years as it was not officially supported in GNOME 3.

Themes cannot really be used to provide “integration” at all, that’s an oversimplification. They are the wrong tool for the job. GNOME and KDE both have their own HIGs with conflicting guidelines, and those describe the general behavior and layout of the whole program. You cannot modify that just by changing around some colors. If you want to integrate some app with another platform, you basically have to redesign and rewrite the whole GUI for all programs you care about.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.