aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-03-22 17:56:31 +0800
committerChris Lahey <clahey@src.gnome.org>2001-03-22 17:56:31 +0800
commit330753151999e90f94e4159d74b50c1728be344a (patch)
tree5259567bb7f0315c74cd4161523d2b3a1e2aa546 /widgets
parent46c32e77f9b55c532c0ce1fb6befc3c31344c0ab (diff)
downloadgsoc2013-evolution-330753151999e90f94e4159d74b50c1728be344a.tar
gsoc2013-evolution-330753151999e90f94e4159d74b50c1728be344a.tar.gz
gsoc2013-evolution-330753151999e90f94e4159d74b50c1728be344a.tar.bz2
gsoc2013-evolution-330753151999e90f94e4159d74b50c1728be344a.tar.lz
gsoc2013-evolution-330753151999e90f94e4159d74b50c1728be344a.tar.xz
gsoc2013-evolution-330753151999e90f94e4159d74b50c1728be344a.tar.zst
gsoc2013-evolution-330753151999e90f94e4159d74b50c1728be344a.zip
Made this able to take -1 to denote appending to the table. Also, removed
2001-03-22 Christopher James Lahey <clahey@ximian.com> * e-table-memory.c, e-table-memory.h (e_table_memory_insert): Made this able to take -1 to denote appending to the table. Also, removed the node_ from the name of this function. (e_table_memory_remove): Removed the node_ from the name of this function. (e_table_memory_clear): New function which sets the table to empty. svn path=/trunk/; revision=8886
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-table-memory.c56
-rw-r--r--widgets/table/e-table-memory.h15
2 files changed, 48 insertions, 23 deletions
diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c
index 87e8121294..97ea2204e7 100644
--- a/widgets/table/e-table-memory.c
+++ b/widgets/table/e-table-memory.c
@@ -124,9 +124,9 @@ e_table_memory_new (void)
}
/**
- * e_table_memory_node_get_data:
+ * e_table_memory_get_data:
* @etmm:
- * @node:
+ * @row:
*
*
*
@@ -142,46 +142,49 @@ e_table_memory_get_data (ETableMemory *etmm, int row)
}
/**
- * e_table_memory_node_set_data:
+ * e_table_memory_set_data:
* @etmm:
- * @node:
- * @node_data:
+ * @row:
+ * @data:
*
*
**/
void
-e_table_memory_set_data (ETableMemory *etmm, int row, gpointer node_data)
+e_table_memory_set_data (ETableMemory *etmm, int row, gpointer data)
{
g_return_if_fail(row < 0);
g_return_if_fail(row > etmm->priv->num_rows);
- etmm->priv->data[row] = node_data;
+ etmm->priv->data[row] = data;
}
/**
- * e_table_memory_node_insert:
+ * e_table_memory_insert:
* @table_model:
* @parent_path:
* @position:
- * @node_data:
+ * @data:
*
*
*
* Return value:
**/
void
-e_table_memory_node_insert (ETableMemory *etmm,
- int row,
- gpointer node_data)
+e_table_memory_insert (ETableMemory *etmm,
+ int row,
+ gpointer data)
{
- g_return_if_fail(row < 0);
+ g_return_if_fail(row < -1);
g_return_if_fail(row > etmm->priv->num_rows);
if (!etmm->priv->frozen)
e_table_model_pre_change(E_TABLE_MODEL(etmm));
+
+ if (row == -1)
+ row = etmm->priv->num_rows;
etmm->priv->data = g_renew(gpointer, etmm->priv->data, etmm->priv->num_rows + 1);
memmove(etmm->priv->data + row + 1, etmm->priv->data + row, (etmm->priv->num_rows - row) * sizeof (gpointer));
- etmm->priv->data[row] = node_data;
+ etmm->priv->data[row] = data;
etmm->priv->num_rows ++;
if (!etmm->priv->frozen)
e_table_model_row_inserted(E_TABLE_MODEL(etmm), row);
@@ -190,7 +193,7 @@ e_table_memory_node_insert (ETableMemory *etmm,
/**
- * e_table_memory_node_remove:
+ * e_table_memory_remove:
* @etable:
* @path:
*
@@ -199,7 +202,7 @@ e_table_memory_node_insert (ETableMemory *etmm,
* Return value:
**/
gpointer
-e_table_memory_node_remove (ETableMemory *etmm, int row)
+e_table_memory_remove (ETableMemory *etmm, int row)
{
gpointer ret;
@@ -217,6 +220,27 @@ e_table_memory_node_remove (ETableMemory *etmm, int row)
}
/**
+ * e_table_memory_clear:
+ * @etable:
+ * @path:
+ *
+ *
+ *
+ * Return value:
+ **/
+void
+e_table_memory_clear (ETableMemory *etmm)
+{
+ if (!etmm->priv->frozen)
+ e_table_model_pre_change(E_TABLE_MODEL(etmm));
+ g_free(etmm->priv->data);
+ etmm->priv->data = NULL;
+ etmm->priv->num_rows = 0;
+ if (!etmm->priv->frozen)
+ e_table_model_changed(E_TABLE_MODEL(etmm));
+}
+
+/**
* e_table_memory_freeze:
* @etmm: the ETableModel to freeze.
*
diff --git a/widgets/table/e-table-memory.h b/widgets/table/e-table-memory.h
index e1c7558dc4..e1a70d506c 100644
--- a/widgets/table/e-table-memory.h
+++ b/widgets/table/e-table-memory.h
@@ -34,12 +34,13 @@ GtkType e_table_memory_get_type (void);
void e_table_memory_construct (ETableMemory *etable);
ETableMemory *e_table_memory_new (void);
-/* node operations */
-void e_table_memory_node_insert (ETableMemory *etable,
- int row,
- gpointer node_data);
-gpointer e_table_memory_node_remove (ETableMemory *etable,
- int row);
+/* row operations */
+void e_table_memory_insert (ETableMemory *etable,
+ int row,
+ gpointer data);
+gpointer e_table_memory_remove (ETableMemory *etable,
+ int row);
+void e_table_memory_clear (ETableMemory *etable);
/* Freeze and thaw */
void e_table_memory_freeze (ETableMemory *etable);
@@ -48,7 +49,7 @@ gpointer e_table_memory_get_data (ETableMemory *etm,
int row);
void e_table_memory_set_data (ETableMemory *etm,
int row,
- gpointer node_data);
+ gpointer data);
#ifdef __cplusplus
}