Gtk-Message: GtkDialog mapped without a transient parent

How should dialogs be opened to avoid this error?

When finding examples of the error, how may the source module be hacked to verify the problem and submit a tested patch? [Answer: contribute where the impacted dialog is called in the GUI as a note in MetaBug 8128.]

For instance, when creating a filter via the Context Menu option for an object in the Clipboard.py, a “Define Filter” dialog is created that is not correctly added to the Windows menu and returns the console warning: “Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

Most new developers seem to have to discover how to create windows in Gramps without generating the error. And to correctly add them to the “Windows” menu (not referring to the Windoze OS) instead of having no item added to that menu. Or having it appear as "Undefined Submenu -> Undefined Menu...’

Can a “Useful snippet” be added to the developer API docs?

There is a bug report for this error:
https://gramps-project.org/bugs/view.php?id=8128

1 Like

We have been trying to stomp these issues for quite a while now. What it means is that the newly opened dialog might get ‘confused’ if the windows have to be redrawn due to minimization, overlaid etc. The confusion would involve the stacking order (which window goes on top of which).

The missing parameter is in the calling module, which should be supplying a reference to itself as the parent.

After doing a bit of debugging, I was unable to recreate the trasient parent issue you mentioned. I did see the “Unknown Menu” issue.

The “Unknown Menu” issue is caused by not using the ManagedWindow class correctly. When using that class to implenet a class such as DefineFilter (in gramps/gui/editors/filtereditor.py around line 810) there should have been method defined “build_menu_names”. This is used to fill out the ‘Windows’ menu.

I tested a quick fix to this issue and the diff to the code is attached below.

diff --git a/gramps/gui/editors/filtereditor.py b/gramps/gui/editors/filtereditor.py
index 431b4b05d..56b642e22 100644
--- a/gramps/gui/editors/filtereditor.py
+++ b/gramps/gui/editors/filtereditor.py
@@ -697,6 +697,9 @@ class EditRule(ManagedWindow):
         self.get_widget('hpaned1').set_position(panepos)
         self.show()

+    def build_menu_names(self, obj):
+        return (_("Edit Rule"), _("Edit Rule"))
+
     def select_iter(self, data):
         """
         Workaround to get self.selection to move to iter row.
@@ -867,6 +870,9 @@ class EditFilter(ManagedWindow):
         self._set_size()
         self.show()

+    def build_menu_names(self, obj):
+        return (_("Define filter"), _("Define filter"))
+
     def on_help_clicked(self, obj):
         """Display the relevant portion of Gramps manual"""
         display_help(webpage=WIKI_HELP_PAGE,`Preformatted text`
2 Likes

@prculley
Could you re-check this patch? I have two places where this “Define Filters” dialog is invoked. And both now are added to the Windows menus in weird way and different ways.

  • the built-in Clipboard called from that Context menu. Instead of layering it into the Clipboard, it adds a submenu and menu item that are named the same:
    image

  • The other is an experimental add-on that calls from a button in the dialog. And still does the doubled name at submenu and menu name but pushes it down a level deeper:
    image

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