aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-27 09:36:20 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-27 09:36:20 +0800
commit5e3f91d87bde1ca8484b4a35fc3cdc2f1ede8a85 (patch)
treea4e8f215cad48648f602435e6d7c75226c0b9bc2 /widgets
parentd1cc23165dd9f8d853b6384f038e97afcc51e22c (diff)
downloadgsoc2013-evolution-5e3f91d87bde1ca8484b4a35fc3cdc2f1ede8a85.tar
gsoc2013-evolution-5e3f91d87bde1ca8484b4a35fc3cdc2f1ede8a85.tar.gz
gsoc2013-evolution-5e3f91d87bde1ca8484b4a35fc3cdc2f1ede8a85.tar.bz2
gsoc2013-evolution-5e3f91d87bde1ca8484b4a35fc3cdc2f1ede8a85.tar.lz
gsoc2013-evolution-5e3f91d87bde1ca8484b4a35fc3cdc2f1ede8a85.tar.xz
gsoc2013-evolution-5e3f91d87bde1ca8484b4a35fc3cdc2f1ede8a85.tar.zst
gsoc2013-evolution-5e3f91d87bde1ca8484b4a35fc3cdc2f1ede8a85.zip
Fixed a reference.
2000-07-26 Christopher James Lahey <clahey@helixcode.com> * e-table-click-to-add.c: Fixed a reference. * e-table-selection-model.c, e-table-selection-model.h: Added a clear function. * e-table.c, e-table.h: Made going from click to add to the main table and back work better. svn path=/trunk/; revision=4373
Diffstat (limited to 'widgets')
-rw-r--r--widgets/e-table/ChangeLog10
-rw-r--r--widgets/e-table/e-table-click-to-add.c2
-rw-r--r--widgets/e-table/e-table-selection-model.c16
-rw-r--r--widgets/e-table/e-table-selection-model.h1
-rw-r--r--widgets/e-table/e-table.c16
-rw-r--r--widgets/e-table/e-table.h7
-rw-r--r--widgets/table/e-table-click-to-add.c2
-rw-r--r--widgets/table/e-table-selection-model.c16
-rw-r--r--widgets/table/e-table-selection-model.h1
-rw-r--r--widgets/table/e-table.c16
-rw-r--r--widgets/table/e-table.h7
11 files changed, 82 insertions, 12 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 2576cb3cf7..7d89d00356 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,5 +1,15 @@
2000-07-26 Christopher James Lahey <clahey@helixcode.com>
+ * e-table-click-to-add.c: Fixed a reference.
+
+ * e-table-selection-model.c, e-table-selection-model.h: Added a
+ clear function.
+
+ * e-table.c, e-table.h: Made going from click to add to the main
+ table and back work better.
+
+2000-07-26 Christopher James Lahey <clahey@helixcode.com>
+
* e-table-click-to-add.c, e-table-click-to-add.h: Added an
ETableSelectionModel so this won't crash.
diff --git a/widgets/e-table/e-table-click-to-add.c b/widgets/e-table/e-table-click-to-add.c
index 9070ef2c72..ed9d2ab2d9 100644
--- a/widgets/e-table/e-table-click-to-add.c
+++ b/widgets/e-table/e-table-click-to-add.c
@@ -400,7 +400,7 @@ etcta_init (GnomeCanvasItem *item)
etcta->rect = NULL;
etcta->selection = e_table_selection_model_new();
- gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_change",
+ gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_changed",
GTK_SIGNAL_FUNC(etcta_cursor_change), etcta);
e_canvas_item_set_reflow_callback(item, etcta_reflow);
diff --git a/widgets/e-table/e-table-selection-model.c b/widgets/e-table/e-table-selection-model.c
index f896e37eaa..618adc8dae 100644
--- a/widgets/e-table/e-table-selection-model.c
+++ b/widgets/e-table/e-table-selection-model.c
@@ -44,11 +44,7 @@ enum {
static void
model_changed(ETableModel *etm, ETableSelectionModel *etsm)
{
- g_free(etsm->selection);
- etsm->selection = NULL;
- etsm->row_count = -1;
- gtk_signal_emit(GTK_OBJECT(etsm),
- e_table_selection_model_signals [SELECTION_CHANGED]);
+ e_table_selection_model_clear(etsm);
}
#if 1
@@ -386,3 +382,13 @@ void e_table_selection_model_do_something (ETableSelectionModel
}
}
}
+
+void
+e_table_selection_model_clear(ETableSelectionModel *selection)
+{
+ g_free(selection->selection);
+ selection->selection = NULL;
+ selection->row_count = -1;
+ gtk_signal_emit(GTK_OBJECT(selection),
+ e_table_selection_model_signals [SELECTION_CHANGED]);
+}
diff --git a/widgets/e-table/e-table-selection-model.h b/widgets/e-table/e-table-selection-model.h
index 251b1ceb00..a0493c6c02 100644
--- a/widgets/e-table/e-table-selection-model.h
+++ b/widgets/e-table/e-table-selection-model.h
@@ -57,6 +57,7 @@ void e_table_selection_model_do_something (ETableSelectionModel *
guint col,
gboolean shift_p,
gboolean ctrl_p);
+void e_table_selection_model_clear (ETableSelectionModel *selection);
ETableSelectionModel *e_table_selection_model_new (void);
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
index ae258a5c44..8099d3de0d 100644
--- a/widgets/e-table/e-table.c
+++ b/widgets/e-table/e-table.c
@@ -184,6 +184,7 @@ e_table_init (GtkObject *object)
e_table->drop_col = -1;
e_table->selection = e_table_selection_model_new();
+ e_table->cursor_loc = E_TABLE_CURSOR_LOC_NONE;
}
static void
@@ -271,8 +272,21 @@ table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table)
}
static void
+click_to_add_cursor_change (ETableClickToAdd *etcta, int row, int col, ETable *et)
+{
+ if (et->cursor_loc == E_TABLE_CURSOR_LOC_TABLE) {
+ e_table_selection_model_clear(et->selection);
+ }
+ et->cursor_loc = E_TABLE_CURSOR_LOC_ETCTA;
+}
+
+static void
group_cursor_change (ETableGroup *etg, int row, ETable *et)
{
+ if (et->cursor_loc == E_TABLE_CURSOR_LOC_ETCTA && et->click_to_add) {
+ e_table_click_to_add_commit(E_TABLE_CLICK_TO_ADD(et->click_to_add));
+ }
+ et->cursor_loc = E_TABLE_CURSOR_LOC_TABLE;
gtk_signal_emit (GTK_OBJECT (et),
et_signals [CURSOR_CHANGE],
row);
@@ -441,6 +455,8 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
NULL);
e_canvas_vbox_add_item(E_CANVAS_VBOX(e_table->canvas_vbox), e_table->click_to_add);
+ gtk_signal_connect(GTK_OBJECT (e_table->click_to_add), "cursor_change",
+ GTK_SIGNAL_FUNC(click_to_add_cursor_change), e_table);
}
e_table->group = e_table_group_new (
diff --git a/widgets/e-table/e-table.h b/widgets/e-table/e-table.h
index a2e608b41e..8b41407d1a 100644
--- a/widgets/e-table/e-table.h
+++ b/widgets/e-table/e-table.h
@@ -21,6 +21,12 @@ BEGIN_GNOME_DECLS
#define E_IS_TABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_TYPE))
#define E_IS_TABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE))
+typedef enum {
+ E_TABLE_CURSOR_LOC_NONE = 0,
+ E_TABLE_CURSOR_LOC_ETCTA = 1 << 0,
+ E_TABLE_CURSOR_LOC_TABLE = 1 << 1,
+} ETableCursorLoc;
+
typedef struct {
GtkTable parent;
@@ -34,6 +40,7 @@ typedef struct {
ETableSortInfo *sort_info;
ETableSelectionModel *selection;
+ ETableCursorLoc cursor_loc;
int table_model_change_id;
int table_row_change_id;
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
index 9070ef2c72..ed9d2ab2d9 100644
--- a/widgets/table/e-table-click-to-add.c
+++ b/widgets/table/e-table-click-to-add.c
@@ -400,7 +400,7 @@ etcta_init (GnomeCanvasItem *item)
etcta->rect = NULL;
etcta->selection = e_table_selection_model_new();
- gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_change",
+ gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_changed",
GTK_SIGNAL_FUNC(etcta_cursor_change), etcta);
e_canvas_item_set_reflow_callback(item, etcta_reflow);
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
index f896e37eaa..618adc8dae 100644
--- a/widgets/table/e-table-selection-model.c
+++ b/widgets/table/e-table-selection-model.c
@@ -44,11 +44,7 @@ enum {
static void
model_changed(ETableModel *etm, ETableSelectionModel *etsm)
{
- g_free(etsm->selection);
- etsm->selection = NULL;
- etsm->row_count = -1;
- gtk_signal_emit(GTK_OBJECT(etsm),
- e_table_selection_model_signals [SELECTION_CHANGED]);
+ e_table_selection_model_clear(etsm);
}
#if 1
@@ -386,3 +382,13 @@ void e_table_selection_model_do_something (ETableSelectionModel
}
}
}
+
+void
+e_table_selection_model_clear(ETableSelectionModel *selection)
+{
+ g_free(selection->selection);
+ selection->selection = NULL;
+ selection->row_count = -1;
+ gtk_signal_emit(GTK_OBJECT(selection),
+ e_table_selection_model_signals [SELECTION_CHANGED]);
+}
diff --git a/widgets/table/e-table-selection-model.h b/widgets/table/e-table-selection-model.h
index 251b1ceb00..a0493c6c02 100644
--- a/widgets/table/e-table-selection-model.h
+++ b/widgets/table/e-table-selection-model.h
@@ -57,6 +57,7 @@ void e_table_selection_model_do_something (ETableSelectionModel *
guint col,
gboolean shift_p,
gboolean ctrl_p);
+void e_table_selection_model_clear (ETableSelectionModel *selection);
ETableSelectionModel *e_table_selection_model_new (void);
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index ae258a5c44..8099d3de0d 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -184,6 +184,7 @@ e_table_init (GtkObject *object)
e_table->drop_col = -1;
e_table->selection = e_table_selection_model_new();
+ e_table->cursor_loc = E_TABLE_CURSOR_LOC_NONE;
}
static void
@@ -271,8 +272,21 @@ table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table)
}
static void
+click_to_add_cursor_change (ETableClickToAdd *etcta, int row, int col, ETable *et)
+{
+ if (et->cursor_loc == E_TABLE_CURSOR_LOC_TABLE) {
+ e_table_selection_model_clear(et->selection);
+ }
+ et->cursor_loc = E_TABLE_CURSOR_LOC_ETCTA;
+}
+
+static void
group_cursor_change (ETableGroup *etg, int row, ETable *et)
{
+ if (et->cursor_loc == E_TABLE_CURSOR_LOC_ETCTA && et->click_to_add) {
+ e_table_click_to_add_commit(E_TABLE_CLICK_TO_ADD(et->click_to_add));
+ }
+ et->cursor_loc = E_TABLE_CURSOR_LOC_TABLE;
gtk_signal_emit (GTK_OBJECT (et),
et_signals [CURSOR_CHANGE],
row);
@@ -441,6 +455,8 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
NULL);
e_canvas_vbox_add_item(E_CANVAS_VBOX(e_table->canvas_vbox), e_table->click_to_add);
+ gtk_signal_connect(GTK_OBJECT (e_table->click_to_add), "cursor_change",
+ GTK_SIGNAL_FUNC(click_to_add_cursor_change), e_table);
}
e_table->group = e_table_group_new (
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index a2e608b41e..8b41407d1a 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -21,6 +21,12 @@ BEGIN_GNOME_DECLS
#define E_IS_TABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_TYPE))
#define E_IS_TABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_TYPE))
+typedef enum {
+ E_TABLE_CURSOR_LOC_NONE = 0,
+ E_TABLE_CURSOR_LOC_ETCTA = 1 << 0,
+ E_TABLE_CURSOR_LOC_TABLE = 1 << 1,
+} ETableCursorLoc;
+
typedef struct {
GtkTable parent;
@@ -34,6 +40,7 @@ typedef struct {
ETableSortInfo *sort_info;
ETableSelectionModel *selection;
+ ETableCursorLoc cursor_loc;
int table_model_change_id;
int table_row_change_id;