[gtkmm] Gtk::Dialog: Fix the constructors with DialogFlags



commit f4cc27adecbb70b91b77526235f1192c228a0a18
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Sat Dec 13 10:23:32 2014 +0100

    Gtk::Dialog: Fix the constructors with DialogFlags
    
    * gtk/src/dialog:ccg: Don't call gtk_dialog_new_with_buttons(). The Gtk::Dialog
    will get the wrong GType. Use _CONSTRUCT() + extra code instead. Bug #738513.

 gtk/src/dialog.ccg |   21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)
---
diff --git a/gtk/src/dialog.ccg b/gtk/src/dialog.ccg
index bf5a27e..2e957ac 100644
--- a/gtk/src/dialog.ccg
+++ b/gtk/src/dialog.ccg
@@ -37,26 +37,19 @@ Dialog::Dialog(const Glib::ustring& title, bool modal)
 
 Dialog::Dialog(const Glib::ustring& title, DialogFlags flags)
 :
-  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
-  Glib::ObjectBase(0),
-  // G_GNUC_NULL_TERMINATED in the declaration of gtk_dialog_new_with_buttons()
-  // makes it necessary to add at least one parameter corresponding to the ...,
-  // and end with a null pointer.
-  Gtk::Window((GtkWindow*)gtk_dialog_new_with_buttons(title.c_str(), 0,
-              (GtkDialogFlags)flags, 0, RESPONSE_NONE, static_cast<const char*>(0)))
+  _CONSTRUCT("title", title.c_str(), "use-header-bar", (flags & DIALOG_USE_HEADER_BAR) != 0)
 {
+  set_modal((flags & DIALOG_MODAL) != 0);
+  property_destroy_with_parent() = (flags & DIALOG_DESTROY_WITH_PARENT) != 0;
 }
 
 Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, DialogFlags flags)
 :
-  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
-  Glib::ObjectBase(0),
-  // G_GNUC_NULL_TERMINATED in the declaration of gtk_dialog_new_with_buttons()
-  // makes it necessary to add at least one parameter corresponding to the ...,
-  // and end with a null pointer.
-  Gtk::Window((GtkWindow*)gtk_dialog_new_with_buttons(title.c_str(), parent.gobj(),
-              (GtkDialogFlags)flags, 0, RESPONSE_NONE, static_cast<const char*>(0)))
+  _CONSTRUCT("title", title.c_str(), "use-header-bar", (flags & DIALOG_USE_HEADER_BAR) != 0)
 {
+  set_transient_for(parent);
+  set_modal((flags & DIALOG_MODAL) != 0);
+  property_destroy_with_parent() = (flags & DIALOG_DESTROY_WITH_PARENT) != 0;
 }
 
 _DEPRECATE_IFDEF_START


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