Accéder au contenu principal

Playing with GtkAssistant

I decided to spend some time today to play with GtkAssistant, more precisely, I tried to build a mock installation wizard mimicking Boxes' one in order to test how I could adapt its behaviour to make it GtkAssistant ready.

Overall, I enjoyed using GtkAssistant, it is a quite well thought out widget offering a lot of potential for a small API.

But despite how good GtkAssistant is, I encountered problems adapting it to my need. Here follows a list of what bogged me down.

A sequence of pages

GtkAssistant is great at implementing a sequence of pages, unfortunately, Boxes' wizard is more like a graph of pages.

Boxes' wizard's page graph
Boxes' wizard's page graph

Such a configuration is clearly out of GtkAssistant's scope and it can easily be solved by arranging the pages as a sequence and setting a custom "forward" function, so it's not that much of a problem.

Action area

GtkAssistant allows you to mark a page as custom, which will show no button in the action area when visiting this page. You can then add buttons to the action area in order to give some controls to the user. Unfortunately, I found no way to add buttons to the left side of the action area, usually containing the "back" and "cancel" buttons, which is pretty annoying.

Adding a way to add widgets to the left side or to hide only the buttons of the right side of the action area would help. In the end, I didn't found a way to make the "custom" page type useful to my case (which may just be better in the long run).

Content padding

GtkAssistant sourround its pages with some padding, which most of the time is a good idea, unfortunately one of the pages I want to use is a big and complex widget (a GtkFileChooserWidget) which need to take as much space as possible for the user's ease, but also not to look ugly.

In red, the unwanted padding
In red, the unwanted padding

Cancelling a progressing page

You can't cancel (and go back from) a page typed as "progress" if it haven't been completed. It may make sense if the work in progress must be finished properly, but it's not always the case.

For example, Boxes use a progress bar to indicate that an installation medium is being downloaded, but such a task should be cancellable by the user (he could notice that he isn't downloading the right image), so even if the "progress" page type seems to correspond to this use case, it can't be used because it doesn't allow you to cancel a possibly wrong and probably long task.

It's not that much of a problem though as a regular page can be tweaked to have the desired behaviour.

Transition animations

There is no transition animation when moving between pages. It's not a huge problem but having some animation could make the page transitions more understandable. I would love to have a left to right animation when progressing forward and vice versa when progressing backward. =)

Help wanted

If you are a Gtk+ developer or that you know how to fix some of these problems, especially the padding one, I would greatly appreciate you help! =D

Commentaires

  1. GtkAssistant -> content_box -> margin_border = 12 -> change it by 0 and that's it =)
    A good way to figure out this things is to use GtkInspector. If you don't know about it, press ctrl+alt+d and it will open, then you can see the widget hierarchy and see it's properties and css properties and change it on live. It's awesome!

    PD: I also hate by default padding and margin in widgets :(

    RépondreSupprimer
    Réponses
    1. there's also a 12px spacing set on the "main_box" GtkBox

      Supprimer
    2. Thanks a lot! Thanks to both of you I have been able to hack something working. Unfortunately I haven't found a clean way to retrieve the internal widgets though, the only I found being something like the following.

      construct { realize.connect (get_content_boxes); }

      private void get_content_boxes () {
      if (main_box == null) {
      forall ((child) => {
      if (child.name == "GtkBox")
      main_box = child as Gtk.Box;
      });

      if (main_box != null)
      main_box.set_property ("spacing", 0);
      }
      }

      Supprimer
    3. I think this is a general problem which should be addressed upstream directly, would you file a bug about it?

      Supprimer
    4. Yep, here it is: https://bugzilla.gnome.org/show_bug.cgi?id=750631

      Supprimer

Enregistrer un commentaire

Posts les plus consultés de ce blog

The Path to GNOME Games 3.26

Games received a non-negligible amount of changes that you will find in 3.26. These changes can be big as much small, and more are to come!Building the Games CollectionGames presents your games collection and if everything goes as expected, it does so without the need of any input from you. From an implementation point of view it sounds simple to do, just ask Tracker “Hey, gimme all the games” and it’s done. If only it was that simple! 😃 The system has no idea which files represent games and which doesn’t, but it can associate a MIME type to each file thanks to shared-mime-info. shared-mime-info already had a few video game related MIME types and we added a lot more such as application/x-genesis-rom.That done, we can query Tracker for files having specific MIME types that we know to often represent video game files. Unfortunately, each of these files doesn’t necessarily represent a game and a game isn’t necessarily represented by a single file: some files may be invalid and hence rep…

GNOME Games 3.24

GNOME 3.24 will be out in a few weeks and with it will come Games 3.24. This new version will offer a few new features and many refinements, some of which have been implemented by new contributors theawless and Radhika Dua, kudos to them!Find how to get the latest nightly and (soon) stable Flatpak versions of Games on its web page.A Libretro Core Descriptor SpecificationIn its version 3.22, Games stopped using a hardcoded list of well known Libretro cores and instead looked for the right one to run a game by parsing files describing their corresponding Libretro core's capabilities. These files came from the libretro-super repository and were slightly modified to better suit Games' needs.The concept was great but the format of these files proved to be not very well suited for the job: many information were not useful to Games, some information it needed were lacking, the syntax wasn't specified, complex cases like firmwares were implemented in a messy way, some useful infor…

retro-gtk: The Future, Marty!

Let's come back to retro-gtk. In the previous articles I explained how bad retro-gtk was, what I did to start improving it and more importantly what I did to prepare the terrain for further development. This article will detail the aforementioned planed improvements! Unless stated otherwise, I don't plan these changes to be part of retro-gtk 0.14 and I have no idea when they will be implemented. If I say anything you know to be wrong or if you know something which could help the library's development, please share it in the comments!Stabilization of the APIAs stated in the previous article, I want retro-gtk's API to stop breaking as much as it did in the past. Starting with 0.14, we will avoid API and ABI breaks as much as possible, and if we do any we will document them properly. The API should be stable but given that some big changes are coming I don't feel comfortable promising proper stability just yet.GitlabI requested to move retro-gtk to GNOME's GitLab. …