summaryrefslogtreecommitdiffstats
path: root/src/ui/toolbar
diff options
context:
space:
mode:
authorAlexander Valavanis <valavanisalex@gmail.com>2019-01-22 01:07:04 +0000
committerAlexander Valavanis <valavanisalex@gmail.com>2019-01-22 01:07:04 +0000
commit2bbb773127857150ec03faafcd6c77cd14efbb45 (patch)
treed5879d3ef62c1bc7ecc57cf7f9ee3d31ca9ee8da /src/ui/toolbar
parentNodeToolbar: Fix initialisation (diff)
downloadinkscape-2bbb773127857150ec03faafcd6c77cd14efbb45.tar.gz
inkscape-2bbb773127857150ec03faafcd6c77cd14efbb45.zip
Tidy more memory mgmt in toolbars
Diffstat (limited to 'src/ui/toolbar')
-rw-r--r--src/ui/toolbar/calligraphy-toolbar.cpp32
-rw-r--r--src/ui/toolbar/calligraphy-toolbar.h8
-rw-r--r--src/ui/toolbar/lpe-toolbar.cpp5
-rw-r--r--src/ui/toolbar/lpe-toolbar.h3
-rw-r--r--src/ui/toolbar/spiral-toolbar.cpp5
-rw-r--r--src/ui/toolbar/spiral-toolbar.h2
6 files changed, 10 insertions, 45 deletions
diff --git a/src/ui/toolbar/calligraphy-toolbar.cpp b/src/ui/toolbar/calligraphy-toolbar.cpp
index f6900e361..faad6edd0 100644
--- a/src/ui/toolbar/calligraphy-toolbar.cpp
+++ b/src/ui/toolbar/calligraphy-toolbar.cpp
@@ -58,36 +58,10 @@ std::vector<Glib::ustring> get_presets_list() {
return presets;
}
-
-#if 0
-static gchar const *const widget_names[] = {
- "width",
- "mass",
- "wiggle",
- "angle",
- "thinning",
- "tremor",
- "flatness",
- "cap_rounding",
- "usepressure",
- "tracebackground",
- "usetilt"
-};
-#endif
-
-
-
namespace Inkscape {
namespace UI {
namespace Toolbar {
-CalligraphyToolbar::~CalligraphyToolbar()
-{
- if(_tracebackground_pusher) delete _tracebackground_pusher;
- if(_usepressure_pusher) delete _usepressure_pusher;
- if(_usetilt_pusher) delete _usetilt_pusher;
-}
-
GtkWidget *
CalligraphyToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions)
{
@@ -272,7 +246,7 @@ CalligraphyToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions)
GTK_ICON_SIZE_MENU );
toolbar->_widget_map["tracebackground"] = G_OBJECT(toolbar->_tracebackground);
gtk_action_group_add_action( mainActions, GTK_ACTION( toolbar->_tracebackground ) );
- toolbar->_tracebackground_pusher = new PrefPusher(GTK_TOGGLE_ACTION(toolbar->_tracebackground), "/tools/calligraphic/tracebackground", update_presets_list, gpointer(toolbar));
+ toolbar->_tracebackground_pusher.reset(new PrefPusher(GTK_TOGGLE_ACTION(toolbar->_tracebackground), "/tools/calligraphic/tracebackground", update_presets_list, gpointer(toolbar)));
}
/* Use Pressure button */
@@ -284,7 +258,7 @@ CalligraphyToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions)
GTK_ICON_SIZE_MENU );
toolbar->_widget_map["usepressure"] = G_OBJECT(toolbar->_usepressure);
gtk_action_group_add_action( mainActions, GTK_ACTION( toolbar->_usepressure ) );
- toolbar->_usepressure_pusher = new PrefPusher(GTK_TOGGLE_ACTION(toolbar->_usepressure), "/tools/calligraphic/usepressure", update_presets_list, gpointer(toolbar));
+ toolbar->_usepressure_pusher.reset(new PrefPusher(GTK_TOGGLE_ACTION(toolbar->_usepressure), "/tools/calligraphic/usepressure", update_presets_list, gpointer(toolbar)));
}
/* Use Tilt button */
@@ -296,7 +270,7 @@ CalligraphyToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions)
GTK_ICON_SIZE_MENU );
toolbar->_widget_map["usetilt"] = G_OBJECT(toolbar->_usetilt);
gtk_action_group_add_action( mainActions, GTK_ACTION( toolbar->_usetilt ) );
- toolbar->_usetilt_pusher = new PrefPusher(GTK_TOGGLE_ACTION(toolbar->_usetilt), "/tools/calligraphic/usetilt", update_presets_list, gpointer(toolbar));
+ toolbar->_usetilt_pusher.reset(new PrefPusher(GTK_TOGGLE_ACTION(toolbar->_usetilt), "/tools/calligraphic/usetilt", update_presets_list, gpointer(toolbar)));
g_signal_connect_after( G_OBJECT(toolbar->_usetilt), "toggled", G_CALLBACK(tilt_state_changed), toolbar );
gtk_action_set_sensitive( GTK_ACTION(toolbar->_angle_action), !prefs->getBool("/tools/calligraphic/usetilt", true) );
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(toolbar->_usetilt), prefs->getBool("/tools/calligraphic/usetilt", true) );
diff --git a/src/ui/toolbar/calligraphy-toolbar.h b/src/ui/toolbar/calligraphy-toolbar.h
index 617d25aef..f37d84808 100644
--- a/src/ui/toolbar/calligraphy-toolbar.h
+++ b/src/ui/toolbar/calligraphy-toolbar.h
@@ -65,9 +65,9 @@ private:
InkToggleAction *_tracebackground;
InkToggleAction *_usetilt;
- PrefPusher *_tracebackground_pusher;
- PrefPusher *_usepressure_pusher;
- PrefPusher *_usetilt_pusher;
+ std::unique_ptr<PrefPusher> _tracebackground_pusher;
+ std::unique_ptr<PrefPusher> _usepressure_pusher;
+ std::unique_ptr<PrefPusher> _usetilt_pusher;
void width_value_changed();
void velthin_value_changed();
@@ -90,8 +90,6 @@ protected:
: Toolbar(desktop)
{}
- ~CalligraphyToolbar() override;
-
public:
static GtkWidget * prep(SPDesktop *desktop, GtkActionGroup* mainActions);
};
diff --git a/src/ui/toolbar/lpe-toolbar.cpp b/src/ui/toolbar/lpe-toolbar.cpp
index 361144881..347e9247c 100644
--- a/src/ui/toolbar/lpe-toolbar.cpp
+++ b/src/ui/toolbar/lpe-toolbar.cpp
@@ -58,11 +58,6 @@ LPEToolbar::LPEToolbar(SPDesktop *desktop)
_tracker->setActiveUnit(_desktop->getNamedView()->display_units);
}
-LPEToolbar::~LPEToolbar()
-{
- delete _tracker;
-}
-
GtkWidget *
LPEToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions)
{
diff --git a/src/ui/toolbar/lpe-toolbar.h b/src/ui/toolbar/lpe-toolbar.h
index bc4eb3288..ed20db8ae 100644
--- a/src/ui/toolbar/lpe-toolbar.h
+++ b/src/ui/toolbar/lpe-toolbar.h
@@ -53,7 +53,7 @@ class UnitTracker;
namespace Toolbar {
class LPEToolbar : public Toolbar {
private:
- UI::Widget::UnitTracker *_tracker;
+ std::unique_ptr<UI::Widget::UnitTracker> _tracker;
InkSelectOneAction *_mode_action;
InkSelectOneAction *_line_segment_action;
InkSelectOneAction *_units_action;
@@ -84,7 +84,6 @@ private:
protected:
LPEToolbar(SPDesktop *desktop);
- ~LPEToolbar() override;
public:
static GtkWidget * prep(SPDesktop *desktop, GtkActionGroup* mainActions);
diff --git a/src/ui/toolbar/spiral-toolbar.cpp b/src/ui/toolbar/spiral-toolbar.cpp
index a13b4b2c1..4792d6f6b 100644
--- a/src/ui/toolbar/spiral-toolbar.cpp
+++ b/src/ui/toolbar/spiral-toolbar.cpp
@@ -74,7 +74,6 @@ SpiralToolbar::~SpiralToolbar()
if(_connection) {
_connection->disconnect();
- delete _connection;
}
}
@@ -158,8 +157,8 @@ SpiralToolbar::prep(SPDesktop *desktop, GtkActionGroup* mainActions)
}
- toolbar->_connection = new sigc::connection(
- desktop->getSelection()->connectChanged(sigc::mem_fun(*toolbar, &SpiralToolbar::selection_changed)));
+ toolbar->_connection.reset(new sigc::connection(
+ desktop->getSelection()->connectChanged(sigc::mem_fun(*toolbar, &SpiralToolbar::selection_changed))));
return GTK_WIDGET(toolbar->gobj());
}
diff --git a/src/ui/toolbar/spiral-toolbar.h b/src/ui/toolbar/spiral-toolbar.h
index 34150bde2..20b5bb4b7 100644
--- a/src/ui/toolbar/spiral-toolbar.h
+++ b/src/ui/toolbar/spiral-toolbar.h
@@ -64,7 +64,7 @@ private:
GObject *obj);
void selection_changed(Inkscape::Selection *selection);
- sigc::connection *_connection;
+ std::unique_ptr<sigc::connection> _connection;
protected:
SpiralToolbar(SPDesktop *desktop) :