[glom/glom-1-26] test_glade_derived_instantiation: Give dialogs transient parents.



commit cd02e9b2fdd1c0f83882ae3ca40e196f2c88fa37
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Jun 17 12:13:58 2014 +0200

    test_glade_derived_instantiation: Give dialogs transient parents.
    
    This avoid the GTK+ message about GtkDialogs that have no transient
    parent windows, though it is not important in this case.

 tests/test_glade_derived_instantiation.cc |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_glade_derived_instantiation.cc b/tests/test_glade_derived_instantiation.cc
index ef9580f..2f8a058 100644
--- a/tests/test_glade_derived_instantiation.cc
+++ b/tests/test_glade_derived_instantiation.cc
@@ -96,6 +96,17 @@ bool instantiate_widget()
   //Note that this is not testing all .glade files, or all windows (some not using glade),
   //and doesn't even reliably check all uses of .glade files,
   //but hopefully it will catch some problems:
+
+  //GTK+ complains if the a Gtk::Dialog has no transient parent.
+  Gtk::Window* parent_window = 0;
+  Gtk::Dialog* dialog = dynamic_cast<Gtk::Dialog*>(widget);
+  if(dialog)
+  {
+    parent_window = new Gtk::Window();
+    dialog->set_transient_for(*parent_window);
+    parent_window->show();
+  }
+   
   widget->show();
   const Gtk::Allocation allocation = widget->get_allocation();
  
@@ -110,6 +121,10 @@ bool instantiate_widget()
   }
   
   delete widget;
+
+  if(parent_window)
+    delete parent_window;
+
   return true;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]