summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java18
1 files changed, 13 insertions, 5 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index 5f2cb67736..c7b41569dc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -646,8 +646,7 @@ void createColumn (TreeColumn column, int index) {
if (newModel == 0) error (SWT.ERROR_NO_HANDLES);
copyModel (oldModel, FIRST_COLUMN, newModel, FIRST_COLUMN, types, (int /*long*/)0, (int /*long*/)0, modelLength);
OS.gtk_tree_view_set_model (handle, newModel);
- OS.g_object_unref (oldModel);
- modelHandle = newModel;
+ setModel (newModel);
}
}
int /*long*/ columnHandle = OS.gtk_tree_view_column_new ();
@@ -994,10 +993,8 @@ void destroyItem (TreeColumn column) {
if (newModel == 0) error (SWT.ERROR_NO_HANDLES);
copyModel(oldModel, column.modelIndex, newModel, FIRST_COLUMN, types, (int /*long*/)0, (int /*long*/)0, FIRST_COLUMN + CELL_TYPES);
OS.gtk_tree_view_set_model (handle, newModel);
- OS.g_object_unref (oldModel);
- modelHandle = newModel;
+ setModel (newModel);
createColumn (null, 0);
-
} else {
for (int i=0; i<items.length; i++) {
TreeItem item = items [i];
@@ -3027,6 +3024,17 @@ public void setLinesVisible (boolean show) {
}
}
+void setModel (int /*long*/ newModel) {
+ display.removeWidget (modelHandle);
+ OS.g_object_unref (modelHandle);
+ modelHandle = newModel;
+ display.addWidget (modelHandle, this);
+ if (fixAccessibility ()) {
+ OS.g_signal_connect_closure (modelHandle, OS.row_inserted, display.closures [ROW_INSERTED], true);
+ OS.g_signal_connect_closure (modelHandle, OS.row_deleted, display.closures [ROW_DELETED], true);
+ }
+}
+
void setOrientation (boolean create) {
super.setOrientation (create);
if (items != null) {