summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2014-03-28 21:16:35 +0000
committerMartin Owens <doctormo@gmail.com>2014-03-28 21:16:35 +0000
commitb8a04c5946f23e3cc09e398d1b6603bbba6ceed9 (patch)
treead79dc7432dda707322d605722790975ad23b4b2 /src/ui
parentRemove _onApply and strdup the char from the label before it gets corrupted. ... (diff)
downloadinkscape-b8a04c5946f23e3cc09e398d1b6603bbba6ceed9.tar.gz
inkscape-b8a04c5946f23e3cc09e398d1b6603bbba6ceed9.zip
Guides: Clean up memory a bit better and move color changed to OK so we don't set the colour before OK
(bzr r13228)
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/dialog/guides.cpp33
-rw-r--r--src/ui/dialog/guides.h1
2 files changed, 14 insertions, 20 deletions
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index 0e754106d..80740113c 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -68,20 +68,6 @@ void GuidelinePropertiesDialog::showDialog(SPGuide *guide, SPDesktop *desktop) {
dialog.run();
}
-void GuidelinePropertiesDialog::_colorChanged()
-{
-#if WITH_GTKMM_3_0
- const Gdk::RGBA c = _color.get_rgba();
- unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257;
-#else
- const Gdk::Color c = _color.get_color();
- unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257;
-#endif
- //TODO: why 257? verify this!
-
- sp_guide_set_color(*_guide, r, g, b, true);
-}
-
void GuidelinePropertiesDialog::_modeChanged()
{
_mode = !_relative_toggle.get_active();
@@ -124,9 +110,21 @@ void GuidelinePropertiesDialog::_onOK()
sp_guide_moveto(*_guide, newpos, true);
- const gchar* name = _label_entry.getEntry()->get_text().c_str();
+ const gchar* name = g_strdup( _label_entry.getEntry()->get_text().c_str() );
- sp_guide_set_label(*_guide, g_strdup(name), true);
+ sp_guide_set_label(*_guide, name, true);
+ g_free((gpointer) name);
+
+#if WITH_GTKMM_3_0
+ const Gdk::RGBA c = _color.get_rgba();
+ unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257;
+#else
+ const Gdk::Color c = _color.get_color();
+ unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257;
+#endif
+ //TODO: why 257? verify this!
+
+ sp_guide_set_color(*_guide, r, g, b, true);
DocumentUndo::done(_guide->document, SP_VERB_NONE,
_("Set guide properties"));
@@ -214,9 +212,6 @@ void GuidelinePropertiesDialog::_setup() {
1, 3, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
#endif
- _color.signal_color_set().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_colorChanged));
-
-
// unitmenus
/* fixme: We should allow percents here too, as percents of the canvas size */
_unit_menu.setUnitType(UNIT_TYPE_LINEAR);
diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h
index 76b830e70..22bf5097a 100644
--- a/src/ui/dialog/guides.h
+++ b/src/ui/dialog/guides.h
@@ -67,7 +67,6 @@ protected:
void _response(gint response);
void _modeChanged();
- void _colorChanged();
private:
GuidelinePropertiesDialog(GuidelinePropertiesDialog const &); // no copy