summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/xml-tree.cpp
diff options
context:
space:
mode:
authorJohn Smith <john.smith7545@yahoo.com>2012-03-23 10:22:33 +0000
committerJohn Smith <removethis.john.q.public@bigmail.com>2012-03-23 10:22:33 +0000
commitcb40f324c39c3b18f0349e61ace70bf650088c5c (patch)
treec6109fe09816dd09fb08a4475231263e837a7b3d /src/ui/dialog/xml-tree.cpp
parentFix for 909328 : Dockable Find & Replace dialog (diff)
downloadinkscape-cb40f324c39c3b18f0349e61ace70bf650088c5c.tar.gz
inkscape-cb40f324c39c3b18f0349e61ace70bf650088c5c.zip
Fix for 903676 : Replace GtkCList with GtkTreeView in XML Tree, selection bug fixes
(bzr r11118)
Diffstat (limited to 'src/ui/dialog/xml-tree.cpp')
-rw-r--r--src/ui/dialog/xml-tree.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp
index cdbb2257c..ae1ebf5ca 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -233,7 +233,7 @@ XmlTree::XmlTree (void) :
GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(attributes));
g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (on_attr_select_row), this);
-
+ g_signal_connect( G_OBJECT(attributes), "row-value-changed", G_CALLBACK(on_attr_row_changed), this);
xml_element_new_button.signal_clicked().connect(sigc::mem_fun(*this, &XmlTree::cmd_new_element_node));
xml_text_new_button.signal_clicked().connect(sigc::mem_fun(*this, &XmlTree::cmd_new_text_node));
@@ -738,11 +738,12 @@ void XmlTree::on_attr_select_row(GtkTreeSelection *selection, gpointer data)
GtkTreeModel *model;
if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
-/* self->selected_attr = 0;
+ // Nothing selected
+ self->selected_attr = 0;
self->attr_reset_context(self->selected_attr);
self->xml_attribute_delete_button.set_sensitive(false);
- self->on_attr_unselect_row_clear_text();*/
+ self->on_attr_unselect_row_clear_text();
return;
}
@@ -763,6 +764,22 @@ void XmlTree::on_attr_select_row(GtkTreeSelection *selection, gpointer data)
}
+void XmlTree::on_attr_row_changed(SPXMLViewAttrList *attributes, const gchar * name, gpointer data)
+{
+ // Reselect the selected row if the data changes to refresh the attribute and value edit boxes.
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(attributes));
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ const gchar *attr_name;
+ if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+ gtk_tree_model_get (model, &iter, 0, &attr_name, -1);
+ if (!strcmp(name, attr_name)) {
+ gtk_tree_selection_unselect_all(selection);
+ gtk_tree_selection_select_iter(selection, &iter);
+ }
+ }
+}
+
void XmlTree::on_attr_unselect_row_clear_text()
{
attr_name.set_text("");