summaryrefslogtreecommitdiffstats
path: root/src/dialogs/object-attributes.cpp
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2011-12-16 21:03:31 +0000
committerKris <Kris.De.Gussem@hotmail.com>2011-12-16 21:03:31 +0000
commit8a8d0dacce18cf93f3c808199a6125c0132bdb33 (patch)
tree22db3e6f988e7666480dc664c01ebffe51ece4f2 /src/dialogs/object-attributes.cpp
parentExtensions. convert2dashes. delete 'stroke-dasharray' attribute in style (Bug... (diff)
parent- Dropped deprecated sp_window_new (diff)
downloadinkscape-8a8d0dacce18cf93f3c808199a6125c0132bdb33.tar.gz
inkscape-8a8d0dacce18cf93f3c808199a6125c0132bdb33.zip
- SPAttributeWidget and SPAttributeTable C++ified
- fixed memory leak with item properties (old instances of item properties window were not destroyed) (bzr r10775)
Diffstat (limited to 'src/dialogs/object-attributes.cpp')
-rw-r--r--src/dialogs/object-attributes.cpp67
1 files changed, 19 insertions, 48 deletions
diff --git a/src/dialogs/object-attributes.cpp b/src/dialogs/object-attributes.cpp
index f83d3ef1f..0511ebb3a 100644
--- a/src/dialogs/object-attributes.cpp
+++ b/src/dialogs/object-attributes.cpp
@@ -5,8 +5,9 @@
/* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
+ * Kris De Gussem <Kris.DeGussem@gmail.com>
*
- * Copyright (C) 1999-2005 Authors
+ * Copyright (C) 1999-2011 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -66,41 +67,16 @@ static const SPAttrDesc image_nohref_desc[] = {
};
-static void object_released( SPObject */*object*/, GtkWidget *widget )
-{
- gtk_widget_destroy (widget);
-}
-
-
-
-static void window_destroyed( GtkObject *window, GtkObject */*object*/ )
-{
- sigc::connection *release_connection = (sigc::connection *)g_object_get_data(G_OBJECT(window), "release_connection");
- release_connection->disconnect();
- delete release_connection;
-}
-
-
-
static void sp_object_attr_show_dialog ( SPObject *object,
const SPAttrDesc *desc,
const gchar *tag )
{
- const gchar **labels, **attrs;
- gint len, i;
+ int len;
+ Gtk::Window *window;
+ SPAttributeTable* t;
Glib::ustring title;
- GtkWidget *w, *t;
-
- len = 0;
- while (desc[len].label) len += 1;
-
- labels = (const gchar **) new gchar* [len];
- attrs = (const gchar **) new gchar* [len];
-
- for (i = 0; i < len; i++) {
- labels[i] = desc[i].label;
- attrs[i] = desc[i].attribute;
- }
+ std::vector<Glib::ustring> labels;
+ std::vector<Glib::ustring> attrs;
if (!strcmp (tag, "Link")) {
title = _("Link Properties");
@@ -110,26 +86,21 @@ static void sp_object_attr_show_dialog ( SPObject *object,
title = Glib::ustring::compose(_("%1 Properties"), tag);
}
- w = sp_window_new (title.c_str(), TRUE);
-
- t = sp_attribute_table_new (object, len, labels, attrs);
- gtk_widget_show (t);
- gtk_container_add (GTK_CONTAINER (w), t);
- delete labels;
- delete attrs;
-
- g_signal_connect ( G_OBJECT (w), "destroy",
- G_CALLBACK (window_destroyed), object );
-
- sigc::connection *release_connection = new sigc::connection();
- *release_connection = object->connectRelease(sigc::bind<1>(sigc::ptr_fun(&object_released), w));
- g_object_set_data(G_OBJECT(w), "release_connection", release_connection);
-
- gtk_widget_show (w);
+ len = 0;
+ while (desc[len].label)
+ {
+ labels.push_back(desc[len].label);
+ attrs.push_back (desc[len].attribute);
+ len += 1;
+ }
+
+ window = Inkscape::UI::window_new (title.c_str(), true);
+ t = new SPAttributeTable (object, labels, attrs, (GtkWidget*)window->gobj());
+ t->show();
+ window->show();
} // end of sp_object_attr_show_dialog()
-
void sp_object_attributes_dialog (SPObject *object, const gchar *tag)
{
g_return_if_fail (object != NULL);