aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/menus/gal-define-views-dialog.c3
-rw-r--r--widgets/table/e-tree-model.c35
-rw-r--r--widgets/table/e-tree-model.h4
3 files changed, 25 insertions, 17 deletions
diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c
index cf34ac8e90..229f9a406f 100644
--- a/widgets/menus/gal-define-views-dialog.c
+++ b/widgets/menus/gal-define-views-dialog.c
@@ -100,7 +100,7 @@ gal_define_views_dialog_create_etable(char *name, char *string1, char *string2,
ETableModel *model;
model = gal_define_views_model_new();
table = e_table_scrolled_new(model, NULL, SPEC, NULL);
- gtk_object_set_data(table, "GalDefineViewsDialog::model", model);
+ gtk_object_set_data(GTK_OBJECT(table), "GalDefineViewsDialog::model", model);
return table;
}
@@ -153,7 +153,6 @@ gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
GladeXML *gui;
GtkWidget *widget;
GtkWidget *etable;
- ETableModel *model;
gui = glade_xml_new (GAL_GLADEDIR "/gal-define-views.glade", NULL);
dialog->gui = gui;
diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c
index e3c4f138cd..a38e24ec62 100644
--- a/widgets/table/e-tree-model.c
+++ b/widgets/table/e-tree-model.c
@@ -41,7 +41,7 @@ struct ETreeModelPriv {
GHashTable *expanded_state; /* used for loading/saving expanded state */
GString *sort_group; /* for caching the last sort group info */
gboolean expanded_default; /* whether nodes are created expanded or collapsed by default */
- gboolean pre_change; /* has there been a pre-change event on us? */
+ gboolean frozen; /* has there been a pre-change event on us? */
};
struct ETreePath {
@@ -173,21 +173,22 @@ e_tree_model_node_traverse (ETreeModel *model, ETreePath *path, ETreePathFunc fu
}
-/* signal handlers */
-static void
-etree_pre_change(GtkObject *object, ETreeModel *etm)
+
+void
+e_tree_model_freeze(ETreeModel *etm)
{
ETreeModelPriv *priv = etm->priv;
- priv->pre_change = TRUE;
+ priv->frozen = TRUE;
}
-static void
-etree_changed(GtkObject *object, ETreeModel *etm)
+void
+e_tree_model_thaw(ETreeModel *etm)
{
ETreeModelPriv *priv = etm->priv;
- priv->pre_change = FALSE;
+ priv->frozen = FALSE;
+ e_table_model_changed(E_TABLE_MODEL(etm));
}
@@ -710,9 +711,6 @@ e_tree_model_construct (ETreeModel *etree)
priv->row_array = g_array_new (FALSE, FALSE, sizeof(ETreePath*));
priv->expanded_state = g_hash_table_new (g_str_hash, g_str_equal);
priv->sort_group = g_string_new("");
-
- gtk_signal_connect((GtkObject *)etree, "model_pre_change", etree_pre_change, etree);
- gtk_signal_connect((GtkObject *)etree, "model_changed", etree_changed, etree);
}
ETreeModel *
@@ -951,11 +949,13 @@ e_tree_model_node_insert (ETreeModel *tree_model,
parent_row = e_tree_model_row_of_node (tree_model, parent_path);
}
+ e_table_model_pre_change(E_TABLE_MODEL(tree_model));
+
priv->row_array = g_array_insert_val (priv->row_array,
parent_row + position + 1 + child_offset, new_path);
/* only do this if we know a changed signal isn't coming later on */
- if (!priv->pre_change)
+ if (!priv->frozen)
e_table_model_row_inserted (E_TABLE_MODEL(tree_model), parent_row + position + 1 + child_offset);
}
@@ -1077,6 +1077,8 @@ e_tree_model_node_remove (ETreeModel *etree, ETreePath *path)
remove the whole lot do we really care */
dochanged = (visible > 1000) || (visible > (priv->row_array->len / 4));
+ e_table_model_pre_change(E_TABLE_MODEL (etree));
+
/* and physically remove them */
if (visible == priv->row_array->len) {
g_array_set_size(priv->row_array, 0);
@@ -1088,7 +1090,7 @@ e_tree_model_node_remove (ETreeModel *etree, ETreePath *path)
}
/* tell the system we've removed (these) nodes */
- if (!priv->pre_change) {
+ if (!priv->frozen) {
if (dochanged) {
e_table_model_changed(E_TABLE_MODEL(etree));
} else {
@@ -1110,8 +1112,9 @@ add_visible_descendents_to_array (ETreeModel *etm, ETreePath *node, int *row, in
ETreeModelPriv *priv = etm->priv;
/* add a row for this node */
+ e_table_model_pre_change(E_TABLE_MODEL (etm));
priv->row_array = g_array_insert_val (priv->row_array, (*row), node);
- if (!priv->pre_change)
+ if (!priv->frozen)
e_table_model_row_inserted (E_TABLE_MODEL (etm), (*row));
(*row) ++;
(*count) ++;
@@ -1321,6 +1324,8 @@ e_tree_model_node_sort (ETreeModel *tree_model,
if (num_nodes == 0)
return;
+ e_table_model_pre_change(E_TABLE_MODEL (tree_model));
+
sort_info = g_new (ETreeSortInfo, num_nodes);
child_index = e_tree_model_row_of_node (tree_model, node) + 1;
@@ -1360,7 +1365,7 @@ e_tree_model_node_sort (ETreeModel *tree_model,
g_free (sort_info);
- if (!priv->pre_change)
+ if (!priv->frozen)
e_table_model_changed (E_TABLE_MODEL (tree_model));
}
diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h
index d3cfa6665b..e9c0a84411 100644
--- a/widgets/table/e-tree-model.h
+++ b/widgets/table/e-tree-model.h
@@ -83,6 +83,10 @@ ETreePath *e_tree_model_node_insert (ETreeModel *etree, ETreePath *parent
ETreePath *e_tree_model_node_insert_before (ETreeModel *etree, ETreePath *parent, ETreePath *sibling, gpointer node_data);
gpointer e_tree_model_node_remove (ETreeModel *etree, ETreePath *path);
+/* Freeze and thaw */
+void e_tree_model_freeze (ETreeModel *etree);
+void e_tree_model_thaw (ETreeModel *etree);
+
/* node accessors */
gboolean e_tree_model_node_is_root (ETreeModel *etree, ETreePath *path);
gboolean e_tree_model_node_is_expandable (ETreeModel *etree, ETreePath *path);