[gtkmm-documentation] FlowBox example: Use Gtk::manage().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] FlowBox example: Use Gtk::manage().
- Date: Wed, 9 Apr 2014 07:23:09 +0000 (UTC)
commit 3d39c526fd8c27dc9758d200e9dde07b958f1663
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Apr 9 09:22:32 2014 +0200
FlowBox example: Use Gtk::manage().
* examples/book/flowbox/examplewindow.[h|cc]: This is simpler
than storing the widget pointers and deleting them later.
examples/book/flowbox/examplewindow.cc | 20 ++------------------
examples/book/flowbox/examplewindow.h | 5 -----
2 files changed, 2 insertions(+), 23 deletions(-)
---
diff --git a/examples/book/flowbox/examplewindow.cc b/examples/book/flowbox/examplewindow.cc
index 523b2f6..3269a7d 100644
--- a/examples/book/flowbox/examplewindow.cc
+++ b/examples/book/flowbox/examplewindow.cc
@@ -48,29 +48,13 @@ ExampleWindow::ExampleWindow()
ExampleWindow::~ExampleWindow()
{
- while(!m_color_swatches.empty())
- {
- Gtk::Button* color_swatch = m_color_swatches.back();
- delete color_swatch;
- m_color_swatches.pop_back();
- }
-
- while(!m_color_drawing_areas.empty())
- {
- Gtk::DrawingArea* drawing_area = m_color_drawing_areas.back();
- delete drawing_area;
- m_color_drawing_areas.pop_back();
- }
}
Gtk::Button* ExampleWindow::create_color_swatch(int swatch_i)
{
Gdk::RGBA rgba(m_color_names[swatch_i]);
- Gtk::DrawingArea* drawing_area = new Gtk::DrawingArea();
- Gtk::Button* color_swatch = new Gtk::Button();
-
- m_color_drawing_areas.push_back(drawing_area);
- m_color_swatches.push_back(color_swatch);
+ Gtk::DrawingArea* drawing_area = Gtk::manage(new Gtk::DrawingArea());
+ Gtk::Button* color_swatch = Gtk::manage(new Gtk::Button());
drawing_area->set_size_request(24, 24);
drawing_area->override_background_color(rgba);
diff --git a/examples/book/flowbox/examplewindow.h b/examples/book/flowbox/examplewindow.h
index 045443f..1d335d8 100644
--- a/examples/book/flowbox/examplewindow.h
+++ b/examples/book/flowbox/examplewindow.h
@@ -28,11 +28,6 @@ public:
virtual ~ExampleWindow();
protected:
- // Slots
-
- // Widgets
- std::vector<Gtk::Button*> m_color_swatches;
- std::vector<Gtk::DrawingArea*> m_color_drawing_areas;
// Containers
Gtk::ScrolledWindow m_scrolled_window;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]