Exemple #1
0
static void
one_dispose (GObject *object)
{
	ETableOne *one = E_TABLE_ONE (object);


	if (one->data) {
		int i;
		int col_count;

		if (one->source) {
			col_count = e_table_model_column_count(one->source);

			for (i = 0; i < col_count; i++)
				e_table_model_free_value(one->source, i, one->data[i]);
		}

		g_free (one->data);
	}
	one->data = NULL;

	if (one->source)
		g_object_unref(one->source);
	one->source = NULL;

	G_OBJECT_CLASS (e_table_one_parent_class)->dispose (object);
}
Exemple #2
0
static void
one_free_value (ETableModel *etm, int col, void *value)
{
	ETableOne *one = E_TABLE_ONE(etm);

	if (one->source)
		e_table_model_free_value(one->source, col, value);
}
Exemple #3
0
/* The default for one_duplicate_value is to return the raw value. */
static void *
one_duplicate_value (ETableModel *etm, int col, const void *value)
{
	ETableOne *one = E_TABLE_ONE(etm);

	if (one->source)
		return e_table_model_duplicate_value(one->source, col, value);
	else
		return (void *)value;
}
Exemple #4
0
static gboolean
one_is_cell_editable (ETableModel *etm, int col, int row)
{
	ETableOne *one = E_TABLE_ONE(etm);

	if (one->source)
		return e_table_model_is_cell_editable(one->source, col, -1);
	else
		return FALSE;
}
Exemple #5
0
static void
one_set_value_at (ETableModel *etm, int col, int row, const void *val)
{
	ETableOne *one = E_TABLE_ONE(etm);

	if (one->data && one->source) {
		e_table_model_free_value(one->source, col, one->data[col]);
		one->data[col] = e_table_model_duplicate_value(one->source, col, val);
	}
}
Exemple #6
0
static void *
one_value_at (ETableModel *etm, int col, int row)
{
	ETableOne *one = E_TABLE_ONE(etm);

	if (one->data)
		return one->data[col];
	else
		return NULL;
}
Exemple #7
0
static int
one_column_count (ETableModel *etm)
{
	ETableOne *one = E_TABLE_ONE(etm);

	if (one->source)
		return e_table_model_column_count(one->source);
	else
		return 0;
}
Exemple #8
0
static char *
one_value_to_string (ETableModel *etm, int col, const void *value)
{
	ETableOne *one = E_TABLE_ONE(etm);

	if (one->source)
		return e_table_model_value_to_string (one->source, col, value);
	else
		return g_strdup("");
}
Exemple #9
0
static gboolean
one_value_is_empty (ETableModel *etm, int col, const void *value)
{
	ETableOne *one = E_TABLE_ONE(etm);

	if (one->source)
		return e_table_model_value_is_empty (one->source, col, value);
	else
		return FALSE;
}
Exemple #10
0
static void *
one_initialize_value (ETableModel *etm, int col)
{
	ETableOne *one = E_TABLE_ONE(etm);

	if (one->source)
		return e_table_model_initialize_value (one->source, col);
	else
		return NULL;
}
Exemple #11
0
static void
finish_editing (ETableClickToAdd *etcta)
{
	if (etcta->row) {
		ETableModel *one;

		e_table_item_leave_edit (E_TABLE_ITEM (etcta->row));
		e_table_one_commit (E_TABLE_ONE (etcta->one));
		etcta_drop_one (etcta);
		g_object_run_dispose (G_OBJECT (etcta->row));
		etcta->row = NULL;

		if (etcta->text) {
			g_object_run_dispose (G_OBJECT (etcta->text));
			etcta->text = NULL;
		}
		if (etcta->rect) {
			g_object_run_dispose (G_OBJECT (etcta->rect));
			etcta->rect = NULL;
		}

		one = e_table_one_new (etcta->model);
		etcta_add_one (etcta, one);
		g_object_unref (one);

		e_selection_model_clear (E_SELECTION_MODEL (etcta->selection));

		etcta->row = gnome_canvas_item_new (
			GNOME_CANVAS_GROUP (etcta),
			e_table_item_get_type (),
			"ETableHeader", etcta->eth,
			"ETableModel", etcta->one,
			"minimum_width", etcta->width,
			"horizontal_draw_grid", TRUE,
			"vertical_draw_grid", TRUE,
			"selection_model", etcta->selection,
			"cursor_mode", E_CURSOR_SPREADSHEET,
			NULL);

		g_signal_connect (
			etcta->row, "key_press",
			G_CALLBACK (item_key_press), etcta);

		e_signal_connect_notify (
			etcta->row, "notify::is-editing",
			G_CALLBACK (table_click_to_add_row_is_editing_changed_cb), etcta);

		set_initial_selection (etcta);

		g_object_notify (G_OBJECT (etcta), "is-editing");
	}
}