[gtkmm] Dialog: Simplify the constructors.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Dialog: Simplify the constructors.
- Date: Tue, 14 Mar 2017 08:12:00 +0000 (UTC)
commit e4b7bf07d81b3e6598237605b5c07fdc602613b9
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Mar 14 08:56:30 2017 +0100
Dialog: Simplify the constructors.
Remove constructors that take DialogFlags, and remove the DialogFlags
enum. Add an optional bool use_header_bar parameter to the 2 other
non-default constuctors. There are now 3 constructors instead of 5.
There is now no way to specify the GTK_DIALOG_DESTROY_WITH_PARENT flag,
but hopefully this is not heavily used anyway. It seems better to use
standard C++ memory management.
icon browser demo: Use the new constructor instead of the one that
uses DialogFlags, to specify tha the dialog should be modal and should
use the header bar.
Bug #780004 (Daniel Boles)
demos/gtk-demo/example_iconbrowser.cc | 2 +-
gtk/src/dialog.ccg | 25 ++++---------------------
gtk/src/dialog.hg | 11 ++---------
3 files changed, 7 insertions(+), 31 deletions(-)
---
diff --git a/demos/gtk-demo/example_iconbrowser.cc b/demos/gtk-demo/example_iconbrowser.cc
index 5fd2165..975fd6b 100644
--- a/demos/gtk-demo/example_iconbrowser.cc
+++ b/demos/gtk-demo/example_iconbrowser.cc
@@ -891,7 +891,7 @@ const int DetailDialog::m_icon_size[n_icon_sizes] = { 16, 24, 32, 48, 64 };
// Definition of detail dialog methods.
DetailDialog::DetailDialog(Gtk::Window& parent)
-: Gtk::Dialog("", parent, Gtk::DIALOG_MODAL | Gtk::DIALOG_USE_HEADER_BAR)
+: Gtk::Dialog("", parent, true, true)
{
set_resizable(false);
Gtk::Box* content_area = get_content_area();
diff --git a/gtk/src/dialog.ccg b/gtk/src/dialog.ccg
index c21903c..e8fb1c7 100644
--- a/gtk/src/dialog.ccg
+++ b/gtk/src/dialog.ccg
@@ -20,36 +20,19 @@
namespace Gtk
{
-Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal)
+Dialog::Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal, bool use_header_bar)
:
- _CONSTRUCT("title", title.c_str())
+ _CONSTRUCT("title", title.c_str(), "use-header-bar", static_cast<int>(use_header_bar))
{
set_modal(modal);
set_transient_for(parent);
}
-Dialog::Dialog(const Glib::ustring& title, bool modal)
+Dialog::Dialog(const Glib::ustring& title, bool modal, bool use_header_bar)
:
- _CONSTRUCT("title", title.c_str())
+ _CONSTRUCT("title", title.c_str(), "use-header-bar", static_cast<int>(use_header_bar))
{
set_modal(modal);
}
-Dialog::Dialog(const Glib::ustring& title, DialogFlags flags)
-:
- _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)
-:
- _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;
-}
-
} // namespace Gtk
diff --git a/gtk/src/dialog.hg b/gtk/src/dialog.hg
index a82ff8b..d3c13d5 100644
--- a/gtk/src/dialog.hg
+++ b/gtk/src/dialog.hg
@@ -34,7 +34,6 @@ namespace Gtk
*/
_CC_INCLUDE(gtk/gtk.h)
-_WRAP_ENUM(DialogFlags, GtkDialogFlags)
_WRAP_ENUM(ResponseType, GtkResponseType)
/** Create popup windows.
@@ -73,14 +72,8 @@ class Dialog : public Window
_IGNORE(gtk_dialog_add_buttons)
public:
_CTOR_DEFAULT()
- explicit Dialog(const Glib::ustring& title, bool modal = false);
- Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal = false);
- /** @newin{3,16}
- */
- Dialog(const Glib::ustring& title, DialogFlags flags);
- /** @newin{3,16}
- */
- Dialog(const Glib::ustring& title, Gtk::Window& parent, DialogFlags flags);
+ explicit Dialog(const Glib::ustring& title, bool modal = false, bool use_header_bar = false);
+ Dialog(const Glib::ustring& title, Gtk::Window& parent, bool modal = false, bool use_header_bar = false);
_WRAP_METHOD(void add_action_widget(Widget& child, int response_id), gtk_dialog_add_action_widget)
_WRAP_METHOD(Button* add_button(const Glib::ustring& button_text, int response_id), gtk_dialog_add_button)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]