Added support for E_TABLE_MEMORY_STORE_OBJECT which represents a column

2002-03-12  Christopher James Lahey  <clahey@ximian.com>

	* e-table-memory-store.c, e-table-memory-store.h: Added support
	for E_TABLE_MEMORY_STORE_OBJECT which represents a column storing
	a GtkObject.

svn path=/trunk/; revision=16132
This commit is contained in:
Christopher James Lahey
2002-03-12 22:14:56 +00:00
committed by Chris Lahey
parent 8e2b17bcab
commit 5020c3bd9a
2 changed files with 17 additions and 2 deletions

View File

@ -43,8 +43,12 @@ duplicate_value (ETableMemoryStore *etms, int col, const void *val)
return g_strdup (val);
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
if (val)
gdk_pixbuf_ref ((GdkPixbuf *) val);
return (GdkPixbuf *) val;
gdk_pixbuf_ref ((void *) val);
return (void *) val;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
if (val)
gtk_object_ref ((void *) val);
return (void *) val;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
if (etms->priv->columns[col].custom.duplicate_value)
return etms->priv->columns[col].custom.duplicate_value (E_TABLE_MODEL (etms), col, val, NULL);
@ -111,6 +115,10 @@ etms_free_value (ETableModel *etm, int col, void *value)
if (value)
gdk_pixbuf_unref (value);
break;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
if (value)
gtk_object_unref (value);
break;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
if (etms->priv->columns[col].custom.free_value)
etms->priv->columns[col].custom.free_value (E_TABLE_MODEL (etms), col, value, NULL);
@ -131,6 +139,7 @@ etms_initialize_value (ETableModel *etm, int col)
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
return NULL;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
if (etms->priv->columns[col].custom.initialize_value)
return etms->priv->columns[col].custom.initialize_value (E_TABLE_MODEL (etms), col, NULL);
break;
@ -151,6 +160,7 @@ etms_value_is_empty (ETableModel *etm, int col, const void *value)
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
return value == NULL;
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
if (etms->priv->columns[col].custom.value_is_empty)
return etms->priv->columns[col].custom.value_is_empty (E_TABLE_MODEL (etms), col, value, NULL);
break;
@ -171,6 +181,7 @@ etms_value_to_string (ETableModel *etm, int col, const void *value)
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
return g_strdup ("");
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
if (etms->priv->columns[col].custom.value_is_empty)
return etms->priv->columns[col].custom.value_to_string (E_TABLE_MODEL (etms), col, value, NULL);
break;

View File

@ -41,6 +41,7 @@ typedef enum {
E_TABLE_MEMORY_STORE_COLUMN_TYPE_INTEGER,
E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING,
E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF,
E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT,
E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM
} ETableMemoryStoreColumnType;
@ -66,6 +67,9 @@ typedef struct {
#define E_TABLE_MEMORY_STORE_CUSTOM(editable, duplicate, free, initialize, empty, string) \
{ E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM, \
{ (duplicate), (free), (initialize), (empty), (string) }, editable }
#define E_TABLE_MEMORY_STORE_OBJECT(editable, initialize, empty, string) \
{ E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM, \
{ NULL, NULL, (initialize), (empty), (string) }, editable }
typedef struct _ETableMemoryStorePrivate ETableMemoryStorePrivate;