[glom] Simplify tool item memory management.
- From: Murray Cumming <murrayc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glom] Simplify tool item memory management.
- Date: Wed, 27 Jan 2010 10:30:34 +0000 (UTC)
commit 669709409bf119d68780672fccd6a9d5f1779e45
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Dec 22 17:17:24 2009 +0100
Simplify tool item memory management.
.../print_layouts/print_layout_toolbar.cc | 48 +++++++-----------
.../print_layouts/print_layout_toolbar.h | 3 +
glom/utility_widgets/layouttoolbar.cc | 50 +++++++++-----------
glom/utility_widgets/layouttoolbar.h | 4 ++
4 files changed, 48 insertions(+), 57 deletions(-)
---
diff --git a/glom/mode_design/print_layouts/print_layout_toolbar.cc b/glom/mode_design/print_layouts/print_layout_toolbar.cc
index 0235aa8..cd5b578 100644
--- a/glom/mode_design/print_layouts/print_layout_toolbar.cc
+++ b/glom/mode_design/print_layouts/print_layout_toolbar.cc
@@ -19,7 +19,6 @@
*/
#include "print_layout_toolbar.h"
-#include "print_layout_toolbar_button.h"
#include <gtkmm/stock.h>
#include <glibmm/i18n.h>
#include <libglom/libglom_config.h>
@@ -33,43 +32,34 @@ namespace Glom
PrintLayoutToolbar::PrintLayoutToolbar()
: m_group_items(_("Items")),
m_group_lines(_("Lines")),
- m_group_records(_("Records"))
+ m_group_records(_("Records")),
+ m_drag_field("glom-field.png", PrintLayoutToolbarButton::ITEM_FIELD,
+ _("Database Field"), _("Drag this to the layout to add a new database field.")),
+ m_drag_text("glom-text.png", PrintLayoutToolbarButton::ITEM_TEXT,
+ _("Text"), _("Drag this to the layout to add a new static text box.")),
+ m_drag_image("glom-image.png", PrintLayoutToolbarButton::ITEM_IMAGE,
+ _("Image"), _("Drag this to the layout to add a new static image.")),
+ m_drag_line_horizontal("glom-line-horizontal.png", PrintLayoutToolbarButton::ITEM_LINE_HORIZONTAL,
+ _("Horizontal Line"), _("Drag this to the layout to add a new horizontal line.")),
+ m_drag_line_vertical("glom-line-vertical.png", PrintLayoutToolbarButton::ITEM_LINE_VERTICAL,
+ _("Vertical Line"), _("Drag this to the layout to add a new vertical line.")),
+ m_drag_related_records("glom-related-records.png", PrintLayoutToolbarButton::ITEM_PORTAL,
+ _("Related Records"), _("Drag this to the layout to add a new related records portal."))
{
// Looks ugly otherwise:
set_size_request(100, 200);
- PrintLayoutToolbarButton* drag_field =
- Gtk::manage(new PrintLayoutToolbarButton("glom-field.png", PrintLayoutToolbarButton::ITEM_FIELD,
- _("Database Field"), _("Drag this to the layout to add a new database field.")));
- PrintLayoutToolbarButton* drag_text =
- Gtk::manage(new PrintLayoutToolbarButton("glom-text.png", PrintLayoutToolbarButton::ITEM_TEXT,
- _("Text"), _("Drag this to the layout to add a new static text box.")));
- PrintLayoutToolbarButton* drag_image =
- Gtk::manage(new PrintLayoutToolbarButton("glom-image.png", PrintLayoutToolbarButton::ITEM_IMAGE,
- _("Image"), _("Drag this to the layout to add a new static image.")));
-
- PrintLayoutToolbarButton* drag_line_horizontal =
- Gtk::manage(new PrintLayoutToolbarButton("glom-line-horizontal.png", PrintLayoutToolbarButton::ITEM_LINE_HORIZONTAL,
- _("Horizontal Line"), _("Drag this to the layout to add a new horizontal line.")));
- PrintLayoutToolbarButton* drag_line_vertical =
- Gtk::manage(new PrintLayoutToolbarButton("glom-line-vertical.png", PrintLayoutToolbarButton::ITEM_LINE_VERTICAL,
- _("Vertical Line"), _("Drag this to the layout to add a new vertical line.")));
-
- PrintLayoutToolbarButton* drag_related_records =
- Gtk::manage(new PrintLayoutToolbarButton("glom-related-records.png", PrintLayoutToolbarButton::ITEM_PORTAL,
- _("Related Records"), _("Drag this to the layout to add a new related records portal.")));
-
//Note for translators: These are layout items, like widgets in GTK+.
- m_group_items.add(*drag_field);
- m_group_items.add(*drag_text);
- m_group_items.add(*drag_image);
+ m_group_items.add(m_drag_field);
+ m_group_items.add(m_drag_text);
+ m_group_items.add(m_drag_image);
//Note for translators: These are layout items, like widgets in GTK+.
- m_group_lines.add(*drag_line_horizontal);
- m_group_lines.add(*drag_line_vertical);
+ m_group_lines.add(m_drag_line_horizontal);
+ m_group_lines.add(m_drag_line_vertical);
//Note for translators: These are layout items, like widgets in GTK+.
- m_group_records.add(*drag_related_records);
+ m_group_records.add(m_drag_related_records);
add_group(m_group_items);
add_group(m_group_lines);
diff --git a/glom/mode_design/print_layouts/print_layout_toolbar.h b/glom/mode_design/print_layouts/print_layout_toolbar.h
index 54b199f..4476eee 100644
--- a/glom/mode_design/print_layouts/print_layout_toolbar.h
+++ b/glom/mode_design/print_layouts/print_layout_toolbar.h
@@ -21,6 +21,7 @@
#ifndef GLOM_UTILITY_WIDGETS_DRAGBAR_H
#define GLOM_UTILITY_WIDGETS_DRAGBAR_H
+#include <glom/mode_design/print_layouts/print_layout_toolbar_button.h>
#include <gtkmm/window.h>
#include <gtkmm/handlebox.h>
#include <gtkmm/box.h>
@@ -39,6 +40,8 @@ public:
private:
Gtk::ToolItemGroup m_group_items, m_group_lines, m_group_records;
+ PrintLayoutToolbarButton m_drag_field, m_drag_text, m_drag_image,
+ m_drag_line_horizontal, m_drag_line_vertical, m_drag_related_records;
};
} //namespace Glom
diff --git a/glom/utility_widgets/layouttoolbar.cc b/glom/utility_widgets/layouttoolbar.cc
index 9af4117..b4c0207 100644
--- a/glom/utility_widgets/layouttoolbar.cc
+++ b/glom/utility_widgets/layouttoolbar.cc
@@ -19,7 +19,6 @@
*/
#include "layouttoolbar.h"
-#include "layouttoolbarbutton.h"
#include <gtkmm/stock.h>
#include <glibmm/i18n.h>
#include <libglom/libglom_config.h>
@@ -50,30 +49,25 @@ namespace Glom
LayoutToolbar::LayoutToolbar()
: m_group_items(_("Items")),
- m_group_containers(_("Containers"))
+ m_group_containers(_("Containers")),
+ m_drag_group("glom-group.png", LayoutWidgetBase::TYPE_GROUP,
+ _("Group"), _("Drag this to the layout to add a new group.")),
+ m_drag_notebook("glom-notebook.png", LayoutWidgetBase::TYPE_NOTEBOOK,
+ _("Notebook"), _("Drag this to the layout to add a new notebook.")),
+ m_drag_item("glom-field.png", LayoutWidgetBase::TYPE_FIELD,
+ _("Database Field"), _("Drag this to the layout to add a new database field.")),
+ m_drag_portal("glom-related-records.png", LayoutWidgetBase::TYPE_PORTAL,
+ _("Related Records"), _("Drag this to the layout to add a new Related Record.")),
+ m_drag_button("glom-button.png", LayoutWidgetBase::TYPE_BUTTON,
+ _("Button"), _("Drag this to the layout to add a new button.")),
+ m_drag_text("glom-text.png", LayoutWidgetBase::TYPE_TEXT,
+ _("Group"), _("Drag this to the layout to add a new static text box.")),
+ m_drag_image("glom-image.png", LayoutWidgetBase::TYPE_IMAGE,
+ _("Image"), _("Drag this to the layout to add a new static image."))
{
// Looks ugly otherwise:
set_size_request(100, 200);
- LayoutToolbarButton* drag_group =
- Gtk::manage(new LayoutToolbarButton("glom-group.png", LayoutWidgetBase::TYPE_GROUP,
- _("Group"), _("Drag this to the layout to add a new group.")));
- LayoutToolbarButton* drag_notebook =
- Gtk::manage(new LayoutToolbarButton("glom-notebook.png", LayoutWidgetBase::TYPE_NOTEBOOK,
- _("Notebook"), _("Drag this to the layout to add a new notebook.")));
-
- LayoutToolbarButton* drag_item =
- Gtk::manage(new LayoutToolbarButton("glom-field.png", LayoutWidgetBase::TYPE_FIELD,
- _("Database Field"), _("Drag this to the layout to add a new database field.")));
- LayoutToolbarButton* drag_portal =
- Gtk::manage(new LayoutToolbarButton("glom-related-records.png", LayoutWidgetBase::TYPE_PORTAL,
- _("Related Records"), _("Drag this to the layout to add a new Related Record.")));
- LayoutToolbarButton* drag_button =
- Gtk::manage(new LayoutToolbarButton("glom-button.png", LayoutWidgetBase::TYPE_BUTTON,
- _("Button"), _("Drag this to the layout to add a new button.")));
- LayoutToolbarButton* drag_text =
- Gtk::manage(new LayoutToolbarButton("glom-text.png", LayoutWidgetBase::TYPE_TEXT,
- _("Group"), _("Drag this to the layout to add a new static text box.")));
LayoutToolbarButton* drag_image =
Gtk::manage(new LayoutToolbarButton("glom-image.png", LayoutWidgetBase::TYPE_IMAGE,
_("Image"), _("Drag this to the layout to add a new static image.")));
@@ -81,15 +75,15 @@ LayoutToolbar::LayoutToolbar()
//TODO: Add a drag item for the related records item.
//Note for translators: These are container layout items, containing child layout items, like container widgets in GTK+.
- m_group_containers.add(*drag_group);
- m_group_containers.add(*drag_notebook);
+ m_group_containers.add(m_drag_group);
+ m_group_containers.add(m_drag_notebook);
//Note for translators: These are layout items, like widgets in GTK+.
- m_group_items.add(*drag_portal);
- m_group_items.add(*drag_item);
- m_group_items.add(*drag_button);
- m_group_items.add(*drag_text);
- m_group_items.add(*drag_image);
+ m_group_items.add(m_drag_portal);
+ m_group_items.add(m_drag_item);
+ m_group_items.add(m_drag_button);
+ m_group_items.add(m_drag_text);
+ m_group_items.add(m_drag_image);
add_group(m_group_containers);
add_group(m_group_items);
diff --git a/glom/utility_widgets/layouttoolbar.h b/glom/utility_widgets/layouttoolbar.h
index 1586b43..9eb5306 100644
--- a/glom/utility_widgets/layouttoolbar.h
+++ b/glom/utility_widgets/layouttoolbar.h
@@ -21,6 +21,7 @@
#ifndef GLOM_UTILITY_WIDGETS_LAYOUTTOOLBAR_H
#define GLOM_UTILITY_WIDGETS_LAYOUTTOOLBAR_H
+#include <glom/utility_widgets/layouttoolbarbutton.h>
#include <gtkmm/window.h>
#include <gtkmm/handlebox.h>
#include <gtkmm/box.h>
@@ -38,6 +39,9 @@ public:
private:
Gtk::ToolItemGroup m_group_items, m_group_containers;
+
+ LayoutToolbarButton m_drag_group, m_drag_notebook,
+ m_drag_item, m_drag_portal, m_drag_button, m_drag_text, m_drag_image;
};
} //namespace Glom
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]