Problem migrating AdwAboutWindow to AdwAboutDialog (with XML)

AdwAboutWindow is marked to be deprecated in libadwaita 1.6. From documentation AdwAboutDialog is supposed to be a drop-in replacement.

This is a AdwAboutWindow specification in XML format:

  <object class="AdwAboutWindow" id="about_dialog">
    <property name="visible">False</property>
    <property name="application-name" translatable="true">IBus Cangjie</property>
    <property name="developer-name" translatable="true">IBus Cangjie developers</property>
    <property name="website">https://cangjie.pages.freedesktop.org/</property>
    <property name="issue-url">https://gitlab.freedesktop.org/cangjie/ibus-cangjie/-/issues</property>
    <property name="copyright" translatable="true">© 2012 IBus Cangjie Developers</property>
  </object>

This works for my use.

But if I simply change the class:

  <object class="AdwAboutDialog" id="about_dialog">
    <property name="visible">False</property>
    <property name="application-name" translatable="true">IBus Cangjie</property>
    <property name="developer-name" translatable="true">IBus Cangjie developers</property>
    <property name="website">https://cangjie.pages.freedesktop.org/</property>
    <property name="issue-url">https://gitlab.freedesktop.org/cangjie/ibus-cangjie/-/issues</property>
    <property name="copyright" translatable="true">© 2012 IBus Cangjie Developers</property>
  </object>

This simply doesn’t show. And there is no error message. (You may test this on Workbench. The problem is exactly the same.)

What is my problem?

It works fine for me. Maybe an issue with WorkBench.

Wike uses AdwAboutDialog from .ui.

Refer https://github.com/hugolabe/Wike/blob/master/data/gtk/about.ui.

I heard the usage of Dialog is different from Window. I used to set the Window’s visible to False and then set it to True in script when needed. How do you trigger the display of this Dialog?

Found the solution.

Turns out AdwAboutDialog doesn’t work exactly like AdwAboutWindow. My old script used the visibility flag to toggle the appearance of the AdwAboutWindow:

# Show the about window
self.__builder.get_object("about_dialog").set_visible(True)

# Hide the about window
self.__builder.get_object("about_dialog").set_visible(False)

With AdwAboutDialog, I should instead use the present and close method.

# Show the about dialog on the parent window (self.__window)
self.__builder.get_object("about_dialog").present(self.__window)

# Hide the about dialog
self.__builder.get_object("about_dialog").close()

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