aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-table-group-container.c4
-rw-r--r--widgets/table/e-table-group-leaf.c4
-rw-r--r--widgets/table/e-table-group.c8
-rw-r--r--widgets/table/e-table-group.h6
-rw-r--r--widgets/table/e-table-header-item.c3
-rw-r--r--widgets/table/e-table-item.c11
-rw-r--r--widgets/table/e-table-scrolled.c277
-rw-r--r--widgets/table/e-table-scrolled.h69
-rw-r--r--widgets/table/e-table.c8
-rw-r--r--widgets/table/e-table.h2
10 files changed, 62 insertions, 330 deletions
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index 3281174291..66eff91b85 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -327,10 +327,10 @@ child_cursor_change (ETableGroup *etg, int row,
}
static void
-child_double_click (ETableGroup *etg, int row,
+child_double_click (ETableGroup *etg, int row, int col, GdkEvent *event,
ETableGroupContainer *etgc)
{
- e_table_group_double_click (E_TABLE_GROUP (etgc), row);
+ e_table_group_double_click (E_TABLE_GROUP (etgc), row, col, event);
}
static gint
diff --git a/widgets/table/e-table-group-leaf.c b/widgets/table/e-table-group-leaf.c
index bcc00c20a6..2a21f167d6 100644
--- a/widgets/table/e-table-group-leaf.c
+++ b/widgets/table/e-table-group-leaf.c
@@ -91,10 +91,10 @@ etgl_cursor_change (GtkObject *object, gint row, ETableGroupLeaf *etgl)
}
static void
-etgl_double_click (GtkObject *object, gint row, ETableGroupLeaf *etgl)
+etgl_double_click (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl)
{
if (row < E_TABLE_SUBSET(etgl->subset)->n_map)
- e_table_group_double_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row]);
+ e_table_group_double_click (E_TABLE_GROUP(etgl), E_TABLE_SUBSET(etgl->subset)->map_table[row], col, event);
}
static gint
diff --git a/widgets/table/e-table-group.c b/widgets/table/e-table-group.c
index c4fc0fdfda..c1eee7322c 100644
--- a/widgets/table/e-table-group.c
+++ b/widgets/table/e-table-group.c
@@ -273,14 +273,14 @@ e_table_group_cursor_change (ETableGroup *e_table_group, gint row)
}
void
-e_table_group_double_click (ETableGroup *e_table_group, gint row)
+e_table_group_double_click (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event)
{
g_return_if_fail (e_table_group != NULL);
g_return_if_fail (E_IS_TABLE_GROUP (e_table_group));
gtk_signal_emit (GTK_OBJECT (e_table_group),
etg_signals [DOUBLE_CLICK],
- row);
+ row, col, event);
}
gint
@@ -412,8 +412,8 @@ etg_class_init (GtkObjectClass *object_class)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ETableGroupClass, double_click),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
+ gtk_marshal_NONE__INT_INT_POINTER,
+ GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
etg_signals [RIGHT_CLICK] =
gtk_signal_new ("right_click",
diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h
index f9de386ff7..1791d08aee 100644
--- a/widgets/table/e-table-group.h
+++ b/widgets/table/e-table-group.h
@@ -46,7 +46,7 @@ typedef struct {
/* Signals */
void (*cursor_change) (ETableGroup *etg, int row);
- void (*double_click) (ETableGroup *etg, int row);
+ void (*double_click) (ETableGroup *etg, int row, int col, GdkEvent *event);
gint (*right_click) (ETableGroup *etg, int row, int col, GdkEvent *event);
gint (*click) (ETableGroup *etg, int row, int col, GdkEvent *event);
gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event);
@@ -117,7 +117,9 @@ void e_table_group_construct (GnomeCanvasGroup *parent,
void e_table_group_cursor_change (ETableGroup *etg,
gint row);
void e_table_group_double_click (ETableGroup *etg,
- gint row);
+ gint row,
+ gint col,
+ GdkEvent *event);
gint e_table_group_right_click (ETableGroup *etg,
gint row,
gint col,
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index 2c13ef3dcc..6d12b6da46 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -99,6 +99,9 @@ ethi_destroy (GtkObject *object){
ethi->sort_info = NULL;
}
+ if (ethi->full_header)
+ gtk_object_unref (GTK_OBJECT(ethi->full_header));
+
if (GTK_OBJECT_CLASS (ethi_parent_class)->destroy)
(*GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (object);
}
diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c
index c10d964b52..67833f0f6b 100644
--- a/widgets/table/e-table-item.c
+++ b/widgets/table/e-table-item.c
@@ -1624,6 +1624,7 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
case GDK_2BUTTON_PRESS: {
double x1, y1;
int col, row;
+ GdkEventButton button;
if (e->button.button == 5 ||
e->button.button == 4)
@@ -1634,8 +1635,12 @@ eti_event (GnomeCanvasItem *item, GdkEvent *e)
if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
return TRUE;
+ button = *(GdkEventButton *)e;
+ button.x = x1;
+ button.y = y1;
+
gtk_signal_emit (GTK_OBJECT (eti), eti_signals [DOUBLE_CLICK],
- row);
+ row, col, &button);
break;
}
case GDK_MOTION_NOTIFY: {
@@ -1891,8 +1896,8 @@ eti_class_init (GtkObjectClass *object_class)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ETableItemClass, double_click),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
+ gtk_marshal_NONE__INT_INT_POINTER,
+ GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
eti_signals [RIGHT_CLICK] =
gtk_signal_new ("right_click",
diff --git a/widgets/table/e-table-scrolled.c b/widgets/table/e-table-scrolled.c
index ab490ad7b3..aad041beb4 100644
--- a/widgets/table/e-table-scrolled.c
+++ b/widgets/table/e-table-scrolled.c
@@ -28,71 +28,10 @@
static GtkObjectClass *parent_class;
enum {
- CURSOR_CHANGE,
- DOUBLE_CLICK,
- RIGHT_CLICK,
- CLICK,
- KEY_PRESS,
- LAST_SIGNAL
-};
-
-enum {
ARG_0,
- ARG_TABLE_DRAW_GRID,
- ARG_TABLE_DRAW_FOCUS,
- ARG_CURSOR_MODE,
- ARG_LENGTH_THRESHOLD,
- ARG_CLICK_TO_ADD_MESSAGE,
+ ARG_TABLE,
};
-static gint ets_signals [LAST_SIGNAL] = { 0, };
-
-static void
-cursor_change_proxy (ETable *et, int row, ETableScrolled *ets)
-{
- gtk_signal_emit (GTK_OBJECT (ets),
- ets_signals [CURSOR_CHANGE],
- row);
-}
-
-static void
-double_click_proxy (ETable *et, int row, ETableScrolled *ets)
-{
- gtk_signal_emit (GTK_OBJECT (ets),
- ets_signals [DOUBLE_CLICK],
- row);
-}
-
-static gint
-right_click_proxy (ETable *et, int row, int col, GdkEvent *event, ETableScrolled *ets)
-{
- int return_val = 0;
- gtk_signal_emit (GTK_OBJECT (ets),
- ets_signals [RIGHT_CLICK],
- row, col, event, &return_val);
- return return_val;
-}
-
-static gint
-click_proxy (ETable *et, int row, int col, GdkEvent *event, ETableScrolled *ets)
-{
- int return_val = 0;
- gtk_signal_emit (GTK_OBJECT (ets),
- ets_signals [CLICK],
- row, col, event, &return_val);
- return return_val;
-}
-
-static gint
-key_press_proxy (ETable *et, int row, int col, GdkEvent *event, ETableScrolled *ets)
-{
- int return_val;
- gtk_signal_emit (GTK_OBJECT (ets),
- ets_signals [KEY_PRESS],
- row, col, event, &return_val);
- return return_val;
-}
-
static void
e_table_scrolled_init (GtkObject *object)
{
@@ -119,17 +58,6 @@ e_table_scrolled_real_construct (ETableScrolled *ets)
gtk_container_add(GTK_CONTAINER(ets), GTK_WIDGET(ets->table));
- gtk_signal_connect(GTK_OBJECT(ets->table), "cursor_change",
- GTK_SIGNAL_FUNC(cursor_change_proxy), ets);
- gtk_signal_connect(GTK_OBJECT(ets->table), "double_click",
- GTK_SIGNAL_FUNC(double_click_proxy), ets);
- gtk_signal_connect(GTK_OBJECT(ets->table), "right_click",
- GTK_SIGNAL_FUNC(right_click_proxy), ets);
- gtk_signal_connect(GTK_OBJECT(ets->table), "click",
- GTK_SIGNAL_FUNC(click_proxy), ets);
- gtk_signal_connect(GTK_OBJECT(ets->table), "key_press",
- GTK_SIGNAL_FUNC(key_press_proxy), ets);
-
gtk_widget_show(GTK_WIDGET(ets->table));
}
@@ -214,148 +142,23 @@ GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *e
return GTK_WIDGET (ets);
}
-gchar *e_table_scrolled_get_state (ETableScrolled *ets)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_SCROLLED(ets), NULL);
-
- return e_table_get_state(ets->table);
-}
-
-void e_table_scrolled_save_state (ETableScrolled *ets,
- const gchar *filename)
-{
- g_return_if_fail(ets != NULL);
- g_return_if_fail(E_IS_TABLE_SCROLLED(ets));
- g_return_if_fail(filename != NULL);
-
- e_table_save_state(ets->table, filename);
-}
-
-void
-e_table_scrolled_set_state(ETableScrolled *ets, const char *state)
-{
- g_return_if_fail(ets != NULL);
- g_return_if_fail(E_IS_TABLE_SCROLLED(ets));
- g_return_if_fail(state != NULL);
-
- e_table_set_state(ets->table, state);
-}
-
-void
-e_table_scrolled_load_state(ETableScrolled *ets, const gchar *filename)
-{
- g_return_if_fail(ets != NULL);
- g_return_if_fail(E_IS_TABLE_SCROLLED(ets));
- g_return_if_fail(filename != NULL);
-
- e_table_load_state(ets->table, filename);
-}
-
-void
-e_table_scrolled_set_cursor_row (ETableScrolled *ets, int row)
-{
- g_return_if_fail(ets != NULL);
- g_return_if_fail(E_IS_TABLE_SCROLLED(ets));
-
- e_table_set_cursor_row(ets->table, row);
-}
-
-int
-e_table_scrolled_get_cursor_row (ETableScrolled *ets)
+ETable *
+e_table_scrolled_get_table (ETableScrolled *ets)
{
- g_return_val_if_fail(ets != NULL, -1);
- g_return_val_if_fail(E_IS_TABLE_SCROLLED(ets), -1);
-
- return e_table_get_cursor_row(ets->table);
-}
-
-void
-e_table_scrolled_selected_row_foreach (ETableScrolled *ets,
- ETableForeachFunc callback,
- gpointer closure)
-{
- g_return_if_fail(ets != NULL);
- g_return_if_fail(E_IS_TABLE_SCROLLED(ets));
-
- e_table_selected_row_foreach(ets->table,
- callback,
- closure);
-}
-
-EPrintable *
-e_table_scrolled_get_printable (ETableScrolled *ets)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_SCROLLED(ets), NULL);
-
- return e_table_get_printable(ets->table);
+ return ets->table;
}
static void
ets_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
ETableScrolled *ets = E_TABLE_SCROLLED (o);
- gboolean bool_val;
- gchar *string_val;
switch (arg_id){
- case ARG_TABLE_DRAW_GRID:
- gtk_object_get(GTK_OBJECT(ets->table),
- "drawgrid", &bool_val,
- NULL);
- GTK_VALUE_BOOL (*arg) = bool_val;
- break;
-
- case ARG_TABLE_DRAW_FOCUS:
- gtk_object_get(GTK_OBJECT(ets->table),
- "drawfocus", &bool_val,
- NULL);
- GTK_VALUE_BOOL (*arg) = bool_val;
- break;
-
- case ARG_CLICK_TO_ADD_MESSAGE:
- gtk_object_get(GTK_OBJECT(ets->table),
- "click_to_add_message", &string_val,
- NULL);
- GTK_VALUE_STRING (*arg) = string_val;
- break;
- }
-}
-
-static void
-ets_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableScrolled *ets = E_TABLE_SCROLLED (o);
-
- switch (arg_id){
- case ARG_LENGTH_THRESHOLD:
- gtk_object_set(GTK_OBJECT(ets->table),
- "length_threshold", GTK_VALUE_INT (*arg),
- NULL);
- break;
-
- case ARG_TABLE_DRAW_GRID:
- gtk_object_set(GTK_OBJECT(ets->table),
- "drawgrid", GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_TABLE_DRAW_FOCUS:
- gtk_object_set(GTK_OBJECT(ets->table),
- "drawfocus", GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_CURSOR_MODE:
- gtk_object_set(GTK_OBJECT(ets->table),
- "cursor_mode", GTK_VALUE_INT (*arg),
- NULL);
- break;
- case ARG_CLICK_TO_ADD_MESSAGE:
- gtk_object_set(GTK_OBJECT(ets->table),
- "click_to_add_message", GTK_VALUE_STRING (*arg),
- NULL);
+ case ARG_TABLE:
+ if (ets->table)
+ GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(ets->table);
+ else
+ GTK_VALUE_OBJECT (*arg) = NULL;
break;
}
}
@@ -363,70 +166,12 @@ ets_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
static void
e_table_scrolled_class_init (GtkObjectClass *object_class)
{
- ETableScrolledClass *klass = E_TABLE_SCROLLED_CLASS(object_class);
parent_class = gtk_type_class (PARENT_TYPE);
- object_class->set_arg = ets_set_arg;
object_class->get_arg = ets_get_arg;
- klass->cursor_change = NULL;
- klass->double_click = NULL;
- klass->right_click = NULL;
- klass->click = NULL;
- klass->key_press = NULL;
-
- ets_signals [CURSOR_CHANGE] =
- gtk_signal_new ("cursor_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableScrolledClass, cursor_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- ets_signals [DOUBLE_CLICK] =
- gtk_signal_new ("double_click",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableScrolledClass, double_click),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- ets_signals [RIGHT_CLICK] =
- gtk_signal_new ("right_click",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableScrolledClass, right_click),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
-
- ets_signals [CLICK] =
- gtk_signal_new ("click",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableScrolledClass, click),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
-
- ets_signals [KEY_PRESS] =
- gtk_signal_new ("key_press",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ETableScrolledClass, key_press),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
-
- gtk_object_class_add_signals (object_class, ets_signals, LAST_SIGNAL);
-
- gtk_object_add_arg_type ("ETableScrolled::drawgrid", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_TABLE_DRAW_GRID);
- gtk_object_add_arg_type ("ETableScrolled::drawfocus", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_TABLE_DRAW_FOCUS);
- gtk_object_add_arg_type ("ETableScrolled::cursor_mode", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_CURSOR_MODE);
- gtk_object_add_arg_type ("ETableScrolled::length_threshold", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD);
- gtk_object_add_arg_type ("ETableScrolled::click_to_add_message", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_CLICK_TO_ADD_MESSAGE);
+ gtk_object_add_arg_type ("ETableScrolled::table", GTK_TYPE_OBJECT,
+ GTK_ARG_READABLE, ARG_TABLE);
}
E_MAKE_TYPE(e_table_scrolled, "ETableScrolled", ETableScrolled, e_table_scrolled_class_init, e_table_scrolled_init, PARENT_TYPE);
diff --git a/widgets/table/e-table-scrolled.h b/widgets/table/e-table-scrolled.h
index fca9c7cd98..9b2d2a510e 100644
--- a/widgets/table/e-table-scrolled.h
+++ b/widgets/table/e-table-scrolled.h
@@ -24,54 +24,31 @@ typedef struct {
typedef struct {
EScrollFrameClass parent_class;
-
- void (*cursor_change) (ETableScrolled *est, int row);
- void (*double_click) (ETableScrolled *est, int row);
- gint (*right_click) (ETableScrolled *est, int row, int col, GdkEvent *event);
- gint (*click) (ETableScrolled *est, int row, int col, GdkEvent *event);
- gint (*key_press) (ETableScrolled *est, int row, int col, GdkEvent *event);
} ETableScrolledClass;
-GtkType e_table_scrolled_get_type (void);
-
-ETableScrolled *e_table_scrolled_construct (ETableScrolled *ets,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-GtkWidget *e_table_scrolled_new (ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-
-ETableScrolled *e_table_scrolled_construct_from_spec_file (ETableScrolled *ets,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-
-gchar *e_table_scrolled_get_state (ETableScrolled *ets);
-void e_table_scrolled_save_state (ETableScrolled *ets,
- const gchar *filename);
-
-/* note that it is more efficient to provide the state at creation time */
-void e_table_scrolled_set_state (ETableScrolled *ets,
- const gchar *state);
-void e_table_scrolled_load_state (ETableScrolled *ets,
- const gchar *filename);
-
-void e_table_scrolled_set_cursor_row (ETableScrolled *ets,
- int row);
-/* -1 means we don't have the cursor. */
-int e_table_scrolled_get_cursor_row (ETableScrolled *ets);
-void e_table_scrolled_selected_row_foreach (ETableScrolled *ets,
- ETableForeachFunc callback,
- gpointer closure);
-EPrintable *e_table_scrolled_get_printable (ETableScrolled *ets);
+GtkType e_table_scrolled_get_type (void);
+
+ETableScrolled *e_table_scrolled_construct (ETableScrolled *ets,
+ ETableModel *etm,
+ ETableExtras *ete,
+ const char *spec,
+ const char *state);
+GtkWidget *e_table_scrolled_new (ETableModel *etm,
+ ETableExtras *ete,
+ const char *spec,
+ const char *state);
+
+ETableScrolled *e_table_scrolled_construct_from_spec_file (ETableScrolled *ets,
+ ETableModel *etm,
+ ETableExtras *ete,
+ const char *spec_fn,
+ const char *state_fn);
+GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *etm,
+ ETableExtras *ete,
+ const char *spec_fn,
+ const char *state_fn);
+
+ETable *e_table_scrolled_get_table (ETableScrolled *ets);
END_GNOME_DECLS
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 271884ea14..15e7f2d7f6 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -337,11 +337,11 @@ group_cursor_change (ETableGroup *etg, int row, ETable *et)
}
static void
-group_double_click (ETableGroup *etg, int row, ETable *et)
+group_double_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et)
{
gtk_signal_emit (GTK_OBJECT (et),
et_signals [DOUBLE_CLICK],
- row);
+ row, col, event);
}
static gint
@@ -1958,8 +1958,8 @@ e_table_class_init (GtkObjectClass *object_class)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (ETableClass, double_click),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
+ gtk_marshal_NONE__INT_INT_POINTER,
+ GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_POINTER);
et_signals [RIGHT_CLICK] =
gtk_signal_new ("right_click",
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index 9954c934f7..d52333ada9 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -102,7 +102,7 @@ typedef struct {
void (*cursor_change) (ETable *et, int row);
void (*selection_change) (ETable *et);
- void (*double_click) (ETable *et, int row);
+ void (*double_click) (ETable *et, int row, int col, GdkEvent *event);
gint (*right_click) (ETable *et, int row, int col, GdkEvent *event);
gint (*click) (ETable *et, int row, int col, GdkEvent *event);
gint (*key_press) (ETable *et, int row, int col, GdkEvent *event);