Accéder au contenu principal

libhandy 0.0.10

libhandy 0.0.10 just got released, and it comes with a few new adaptive widgets for your GTK app.

You can get this new version here.

The View Switcher

GNOME applications typically use a GtkStackSwitcher to switch between their views. This design works fine on a desktop, but not so well on really narrow devices like mobile phones, so Tobias Bernard designed a more modern and adaptive replacement — now available in libhandy as the HdyViewSwitcher.

In many ways, the HdyViewSwitcher functions very similarly to a GtkStackSwitcher: you assign it a GtkStack containing your application's pages, and it will display a row of side-by-side, homogeneously-sized buttons, each representing a page. It differs in that it can display both the title and the icon of your pages, and that the layout of the buttons automatically adapts to a narrower version, depending on the available width.

We have also added a view switcher bar, designed to be used at he bottom of the window: HdyViewSwitcherBar.

Thanks a lot to Zander Brown for their prototypes!

The view switchers in action in a modified GNOME Clocks.

The Squeezer

To complete the view switcher design, we needed a way to automatically switch between having a view switcher in the header bar and a view switcher bar at the bottom of the window.

For that we added HdySqueezer: give it widgets, and it will show the first one that fits the available space. A common way to use it would be:

<object class="GtkHeaderBar">
  <property name="title">Application</property>
  <child type="title">
    <object class="HdySqueezer">
      <property name="transition-type">crossfade</property>
      <signal name="notify::visible-child" handler="on_child_changed"/>
      <child>
        <object class="HdyViewSwitcher" id="view_switcher">
          <property name="stack">pages</property>
        </object>
      </child>
      <child>
        <object class="GtkLabel" id="title_label">
          <property name="label">Application</property>
          <style>
            <class name="title"/>
          </style>
        </object>
      </child>
    </object>
  </child>
</object>

In the example above, if there is enough space the view switcher will be visible in the header bar; if not, a widget mimicking the window's title will be displayed. Additionally, you can reveal or conceal a HdyViewSwitcherBar at the bottom of your window, depending on which widget is presented by the squeezer to only show a single view switcher at a time.

Another Header Bar?

To make the view switcher work as intended, we need to make sure it is always strictly centered; we also need to make sure the view switcher fills all the height of the header bar. Both of these are unfortunately not possible with GtkHeaderBar in GTK 3, so I forked it as HdyHeaderBar to, first, make it not force its title widget to be vertically centered, and hence to allow it to fill all the available height, and second, to allow for choosing between strictly centering its title widget or loosely centering it (similar to GtkHeaderBar).

The Preferences Window

To simplify writing modern, adaptive and featureful applications, I wrote a generic preferences window you can use to implement your application's preferences window: HdyPreferencesWindow.

It is organized this way:

  • the window contains pages implemented via HdyPreferencesPage;
  • pages have a title, and contain preferences groups implemented via HdyPreferencesGroup;
  • groups can have a title, description, and preferences implemented via rows (HdyPreferencesRow) or any other widget;
  • preferences implemented via HdyPreferencesRow have a name, and can be searched via their page title, group title or name;
  • HdyActionRow is a derivative of HdyPreferencesRow, so you can use it (and its derivatives) to easily implement your preferences.

GNOME Web's preferences window re-implemented as a HdyPreferencesWindow.

\ˈfjuːtʃə\

The next expected version of libhandy is libhandy 1.0. It will come with quite a few API fixes, which is why a major version number bump is required. libhandy's API has been stable since many version, and we will guarantee that stability starting from version 1.0.

Commentaires

  1. Thank you so much for sharing your brilliant thoughts with us. Visit Ogen Infosystem for professional Web Designing and SEO Services in Delhi, India.
    Website Designing Company in Delhi

    RépondreSupprimer
  2. Webocity is best website designing company in delhi , Best Website development company in Delhi, We Offer Best Digital Marketing services in Delhi.

    RépondreSupprimer
  3. Thanks mate. I am really impressed with your writing talents and also with the layout on your weblog. Appreciate, Is this a paid subject matter or did you customize it yourself? Either way keep up the nice quality writing, it is rare to peer a nice weblog like this one nowadays. Thank you, check also event marketing and event gift bag ideas

    RépondreSupprimer
  4. Thanks for sharing this information.
    Yes Done is the best online site for on demand home services, professional service providers in Jaipur, Rajasthan. We are providing top services like carpenter, cleaning, TV, best pest control services in Jaipur, ro repair service in Jaipur, ac repair service in Jaipur online by Yes Done is there for services at your doorstep in Jaipur, Rajasthan. For more service visit our website. For more services visit our website.

    RépondreSupprimer
  5. ভালো ওয়েবসাইট : Sinopsis Film
    ভালো ওয়েবসাইট : One Piece
    ভালো ওয়েবসাইট : Resep
    ভালো ওয়েবসাইট : One Piece
    ভালো ওয়েবসাইট : Sinopsis Film
    ভালো ওয়েবসাইট : lambang
    ভালো ওয়েবসাইট : One Piece
    ভালো ওয়েবসাইট : Logo

    RépondreSupprimer

Enregistrer un commentaire

Posts les plus consultés de ce blog

Moving the Blog

I am moving this blog to greener lands: https://fediverse.blog/~/AdrienPlazas . The existing articles will remain here on Blogger, and new articles will land on the fediverse.blog Plume instance.

Games 3.30: Features Overload

With a new version of GNOME always comes a new version of Games, and this new version comes packed with new features, bug fixes and developer experience improvements. Install Games 3.30 Platforms View and Developers View As part of his GSoC project, Saurabh implemented two new views of your games collection: one filtering games by their developers and another one filtering them by their platforms. To know more, read Saurabh's Segregating views and Description view articles on his blog. To implement this he needed to work a lot on the Grilo front, check his explanations in his Adding self registering keys to lua-factory article. He also started to work on a new page displaying many details about a game like the number of players and a description, it was unfortunately not ready on time for this release but will hopefully land in 3.32. Gamepad Navigation You can now navigate the UI with your gamepads! Select your collection view with the shoulder buttons, browse

Have You Played Atari Today? 🎵

This is a guest article by Laurent « Hell Pé » Pointecouteau, the Alfred Pennyworth of GNOME Games who relentlessly works in the shadows to help make Games what it is, when he’s not busy writing in French about video games or slacking on Twitter. I used to be really excited at New Stable Release Blog Posts™ like this one, back in the day when you had to wait six months for getting new GNOME stable releases (and matching Ubuntu PPAs) in order to discover what was new in your favourite apps. But nowadays, these blog posts, while still a delight to read, are just a little less surprising than before, and we’ve got Flatpak to thank for that! So, here’s a quick reminder: Games can be obtained by two ways. The old-school way, with the version provided by your distro; and soon, hopefully, your distro will upgrade to the brand-new 3.26 stable version that we’ve just released. And the Flatpak way, the one we actually recommend if your system is ready for it: it’ll give you the choice betwe