aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-03-04 04:05:57 +0800
committerChris Lahey <clahey@src.gnome.org>2000-03-04 04:05:57 +0800
commit626f63df0b18cc891b7995a0b7202303efede45d (patch)
tree9a963dfa708abf113b067bf1a11c7592f13cb565
parentbc0d854e93fa0dd9ca596d1663f389f31f458439 (diff)
downloadgsoc2013-evolution-626f63df0b18cc891b7995a0b7202303efede45d.tar
gsoc2013-evolution-626f63df0b18cc891b7995a0b7202303efede45d.tar.gz
gsoc2013-evolution-626f63df0b18cc891b7995a0b7202303efede45d.tar.bz2
gsoc2013-evolution-626f63df0b18cc891b7995a0b7202303efede45d.tar.lz
gsoc2013-evolution-626f63df0b18cc891b7995a0b7202303efede45d.tar.xz
gsoc2013-evolution-626f63df0b18cc891b7995a0b7202303efede45d.tar.zst
gsoc2013-evolution-626f63df0b18cc891b7995a0b7202303efede45d.zip
Added a bunch of stuff to the TODO list. Put +s before a few of the items
2000-03-04 Christopher James Lahey <clahey@helixcode.com> * TODO: Added a bunch of stuff to the TODO list. Put +s before a few of the items that are finished. * test-table.c: Add a button to save the spec file. * e-table.c, e-table.h: Add loading configurations from files as well as the ability to get the current configuration out of the widget. svn path=/trunk/; revision=2025
-rw-r--r--widgets/e-table/ChangeLog11
-rw-r--r--widgets/e-table/TODO50
-rw-r--r--widgets/e-table/e-table.c118
-rw-r--r--widgets/e-table/e-table.h6
-rw-r--r--widgets/e-table/test-table.c21
-rw-r--r--widgets/table/e-table.c118
-rw-r--r--widgets/table/e-table.h6
-rw-r--r--widgets/table/test-table.c21
8 files changed, 323 insertions, 28 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 62c8268043..e2e25b6f41 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,14 @@
+2000-03-04 Christopher James Lahey <clahey@helixcode.com>
+
+ * TODO: Added a bunch of stuff to the TODO list. Put +s before a
+ few of the items that are finished.
+
+ * test-table.c: Add a button to save the spec file.
+
+ * e-table.c, e-table.h: Add loading configurations from files as
+ well as the ability to get the current configuration out of the
+ widget.
+
2000-03-03 Christopher James Lahey <clahey@helixcode.com>
* e-table.c: Removed some unused code.
diff --git a/widgets/e-table/TODO b/widgets/e-table/TODO
index 29dbd454e5..461b21b4d3 100644
--- a/widgets/e-table/TODO
+++ b/widgets/e-table/TODO
@@ -19,6 +19,52 @@ mouse grabbing for scrolling
* Run Insure on the thing.
-* Propagation
++ * Propagation
- * Row changes should be reflected in the subsets.
++ * Row changes should be reflected in the subsets.
+
+
+
++ * Add an ETable::get_specification method to get the current layout informatino.
+
+* Add GUI sort
+
+ * Add a method to the ETableGroup class to change the sorting information.
+ * Add a way to get sorting information out of the ETableHeader.
+ * Add display of proper arrows to the ETableHeaderItem.
+ * Add switching of sorting on clicks.
+ * Add depressed button state to ETableHeaderItem?
+
+* Add GUI grouping
+
+ * Create ETableGroupItem class.
+ * Make it work. (A large step)
+
+* Add a context menu
+
+ * Define the menu
+ * Create the menu object.
+ * Hook up all the menu items.
+
+* Add a possible columns GUI
+
+ * Create ETableColumnList class.
+ * Hook it up to ETableHeader.
+ * Figure out the correct semantics for requireing the connection between the ETableHeader and the ETableColumnList.
+ * Implement widget display.
+ * Implement drag&drop.
+
+* Add closing and openning of groups
+
+ * Add + button to group display.
+ * Build in semantics for clicking on the button.
+ * Make sub items hide & show.
+ * Resize group.
+ * Figure out how to save this data.
+
+* Data entry ("Click here to add...")
+
+ * Implement ETableDataEntry (a subclass of ETableModel).
+ * Build GUI for the data entry model. This should be fairly simple.
+
+* Fix known bug about navigating out of the bottom of the table.
diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c
index 074ed3c2ae..7d1d9afd14 100644
--- a/widgets/e-table/e-table.c
+++ b/widgets/e-table/e-table.c
@@ -58,6 +58,8 @@ et_destroy (GtkObject *object)
g_source_remove(et->rebuild_idle_id);
et->rebuild_idle_id = 0;
}
+
+ xmlFreeDoc (et->specification);
(*e_table_parent_class->destroy)(object);
}
@@ -623,7 +625,7 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
gtk_signal_connect (
GTK_OBJECT (e_table->table_canvas), "size_allocate",
GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table);
-
+
gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
gtk_table_attach (
GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas),
@@ -665,18 +667,14 @@ e_table_fill_table (ETable *e_table, ETableModel *model)
NULL);
}
-void
-e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
- const char *spec)
+static void
+et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
+ xmlDoc *xmlSpec)
{
- xmlDoc *xmlSpec;
xmlNode *xmlRoot;
xmlNode *xmlColumns;
xmlNode *xmlGrouping;
- char *copy;
- copy = g_strdup(spec);
-
GTK_TABLE (e_table)->homogeneous = FALSE;
gtk_table_resize (GTK_TABLE (e_table), 1, 2);
@@ -686,9 +684,6 @@ e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
e_table->model = etm;
gtk_object_ref (GTK_OBJECT (etm));
-
- xmlSpec = xmlParseMemory(copy, strlen(copy) + 1);
- e_table->specification = xmlSpec;
xmlRoot = xmlDocGetRootElement(xmlSpec);
xmlColumns = e_xml_get_child_by_name(xmlRoot, "columns-shown");
@@ -701,6 +696,29 @@ e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
e_table_fill_table (e_table, etm);
}
+void
+e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
+ const char *spec)
+{
+ xmlDoc *xmlSpec;
+ char *copy;
+ copy = g_strdup(spec);
+
+ xmlSpec = xmlParseMemory(copy, strlen(copy));
+ et_real_construct(e_table, full_header, etm, xmlSpec);
+ g_free(copy);
+}
+
+void
+e_table_construct_from_spec_file (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
+ const char *filename)
+{
+ xmlDoc *xmlSpec;
+
+ xmlSpec = xmlParseFile(filename);
+ et_real_construct(e_table, full_header, etm, xmlSpec);
+}
+
GtkWidget *
e_table_new (ETableHeader *full_header, ETableModel *etm, const char *spec)
{
@@ -713,6 +731,84 @@ e_table_new (ETableHeader *full_header, ETableModel *etm, const char *spec)
return (GtkWidget *) e_table;
}
+GtkWidget *
+e_table_new_from_spec_file (ETableHeader *full_header, ETableModel *etm, const char *filename)
+{
+ ETable *e_table;
+
+ e_table = gtk_type_new (e_table_get_type ());
+
+ e_table_construct (e_table, full_header, etm, filename);
+
+ return (GtkWidget *) e_table;
+}
+
+static xmlNode *
+et_build_column_spec(ETable *e_table)
+{
+ xmlNode *columns_shown;
+ gint i;
+ gint col_count;
+
+ columns_shown = xmlNewNode(NULL, "columns-shown");
+
+ col_count = e_table_header_count(e_table->header);
+ for ( i = 0; i < col_count; i++ ) {
+ gchar *text = g_strdup_printf("%d", e_table_header_index(e_table->header, i));
+ xmlNewChild(columns_shown, NULL, "column", text);
+ g_free(text);
+ }
+ return columns_shown;
+}
+
+static xmlNode *
+et_build_grouping_spec(ETable *e_table)
+{
+ xmlNode *grouping;
+ xmlNode *root;
+
+ root = xmlDocGetRootElement(e_table->specification);
+ grouping = xmlCopyNode(e_xml_get_child_by_name(root, "grouping"), TRUE);
+ return grouping;
+}
+
+static xmlDoc *
+et_build_tree (ETable *e_table)
+{
+ xmlDoc *doc;
+ xmlNode *root;
+ doc = xmlNewDoc( "1.0" );
+ if ( doc == NULL )
+ return NULL;
+ root = xmlNewDocNode(doc, NULL, "ETableSpecification", NULL);
+ xmlDocSetRootElement(doc, root);
+ xmlAddChild(root, et_build_column_spec(e_table));
+ xmlAddChild(root, et_build_grouping_spec(e_table));
+ return doc;
+}
+
+gchar *
+e_table_get_specification (ETable *e_table)
+{
+ xmlDoc *doc = et_build_tree (e_table);
+ xmlChar *buffer;
+ gint size;
+ xmlDocDumpMemory(doc,
+ &buffer,
+ &size);
+ xmlFreeDoc(doc);
+ return buffer;
+}
+
+void
+e_table_save_specification (ETable *e_table, gchar *filename)
+{
+ xmlDoc *doc = et_build_tree (e_table);
+ xmlSaveFile(filename, doc);
+ xmlFreeDoc(doc);
+}
+
+
static void
e_table_class_init (GtkObjectClass *object_class)
{
diff --git a/widgets/e-table/e-table.h b/widgets/e-table/e-table.h
index 841013c09a..5c29c1fa0c 100644
--- a/widgets/e-table/e-table.h
+++ b/widgets/e-table/e-table.h
@@ -56,6 +56,12 @@ void e_table_construct (ETable *e_table, ETableHeader *full_header, ETable
const char *spec);
GtkWidget *e_table_new (ETableHeader *full_header, ETableModel *etm,
const char *spec);
+void e_table_construct_from_spec_file (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
+ const char *filename);
+GtkWidget *e_table_new_from_spec_file (ETableHeader *full_header, ETableModel *etm,
+ const char *filename);
+gchar *e_table_get_specification (ETable *e_table);
+void e_table_save_specification (ETable *e_table, gchar *filename);
END_GNOME_DECLS
diff --git a/widgets/e-table/test-table.c b/widgets/e-table/test-table.c
index 401cacb285..7bb54b668a 100644
--- a/widgets/e-table/test-table.c
+++ b/widgets/e-table/test-table.c
@@ -273,9 +273,15 @@ table_browser_test (void)
}
static void
+save_spec (GtkWidget *button, ETable *e_table)
+{
+ e_table_save_specification(e_table, "e-table-test.xml");
+}
+
+static void
do_e_table_demo (const char *spec)
{
- GtkWidget *e_table, *window, *frame;
+ GtkWidget *e_table, *window, *frame, *vbox, *button;
ECell *cell_left_just;
ETableHeader *full_header;
int i;
@@ -308,11 +314,22 @@ do_e_table_demo (const char *spec)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
frame = gtk_frame_new (NULL);
e_table = e_table_new (full_header, e_table_model, spec);
- gtk_container_add (GTK_CONTAINER (frame), e_table);
+
+ button = gtk_button_new_with_label("Save spec");
+ gtk_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (save_spec), e_table);
+
+ vbox = gtk_vbox_new(FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (vbox), e_table, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_add (GTK_CONTAINER (window), frame);
gtk_widget_set_usize (window, 200, 200);
gtk_widget_show (e_table);
+ gtk_widget_show (button);
+ gtk_widget_show (vbox);
gtk_widget_show (frame);
gtk_widget_show (window);
}
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
index 074ed3c2ae..7d1d9afd14 100644
--- a/widgets/table/e-table.c
+++ b/widgets/table/e-table.c
@@ -58,6 +58,8 @@ et_destroy (GtkObject *object)
g_source_remove(et->rebuild_idle_id);
et->rebuild_idle_id = 0;
}
+
+ xmlFreeDoc (et->specification);
(*e_table_parent_class->destroy)(object);
}
@@ -623,7 +625,7 @@ e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *h
gtk_signal_connect (
GTK_OBJECT (e_table->table_canvas), "size_allocate",
GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table);
-
+
gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
gtk_table_attach (
GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas),
@@ -665,18 +667,14 @@ e_table_fill_table (ETable *e_table, ETableModel *model)
NULL);
}
-void
-e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
- const char *spec)
+static void
+et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
+ xmlDoc *xmlSpec)
{
- xmlDoc *xmlSpec;
xmlNode *xmlRoot;
xmlNode *xmlColumns;
xmlNode *xmlGrouping;
- char *copy;
- copy = g_strdup(spec);
-
GTK_TABLE (e_table)->homogeneous = FALSE;
gtk_table_resize (GTK_TABLE (e_table), 1, 2);
@@ -686,9 +684,6 @@ e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
e_table->model = etm;
gtk_object_ref (GTK_OBJECT (etm));
-
- xmlSpec = xmlParseMemory(copy, strlen(copy) + 1);
- e_table->specification = xmlSpec;
xmlRoot = xmlDocGetRootElement(xmlSpec);
xmlColumns = e_xml_get_child_by_name(xmlRoot, "columns-shown");
@@ -701,6 +696,29 @@ e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
e_table_fill_table (e_table, etm);
}
+void
+e_table_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
+ const char *spec)
+{
+ xmlDoc *xmlSpec;
+ char *copy;
+ copy = g_strdup(spec);
+
+ xmlSpec = xmlParseMemory(copy, strlen(copy));
+ et_real_construct(e_table, full_header, etm, xmlSpec);
+ g_free(copy);
+}
+
+void
+e_table_construct_from_spec_file (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
+ const char *filename)
+{
+ xmlDoc *xmlSpec;
+
+ xmlSpec = xmlParseFile(filename);
+ et_real_construct(e_table, full_header, etm, xmlSpec);
+}
+
GtkWidget *
e_table_new (ETableHeader *full_header, ETableModel *etm, const char *spec)
{
@@ -713,6 +731,84 @@ e_table_new (ETableHeader *full_header, ETableModel *etm, const char *spec)
return (GtkWidget *) e_table;
}
+GtkWidget *
+e_table_new_from_spec_file (ETableHeader *full_header, ETableModel *etm, const char *filename)
+{
+ ETable *e_table;
+
+ e_table = gtk_type_new (e_table_get_type ());
+
+ e_table_construct (e_table, full_header, etm, filename);
+
+ return (GtkWidget *) e_table;
+}
+
+static xmlNode *
+et_build_column_spec(ETable *e_table)
+{
+ xmlNode *columns_shown;
+ gint i;
+ gint col_count;
+
+ columns_shown = xmlNewNode(NULL, "columns-shown");
+
+ col_count = e_table_header_count(e_table->header);
+ for ( i = 0; i < col_count; i++ ) {
+ gchar *text = g_strdup_printf("%d", e_table_header_index(e_table->header, i));
+ xmlNewChild(columns_shown, NULL, "column", text);
+ g_free(text);
+ }
+ return columns_shown;
+}
+
+static xmlNode *
+et_build_grouping_spec(ETable *e_table)
+{
+ xmlNode *grouping;
+ xmlNode *root;
+
+ root = xmlDocGetRootElement(e_table->specification);
+ grouping = xmlCopyNode(e_xml_get_child_by_name(root, "grouping"), TRUE);
+ return grouping;
+}
+
+static xmlDoc *
+et_build_tree (ETable *e_table)
+{
+ xmlDoc *doc;
+ xmlNode *root;
+ doc = xmlNewDoc( "1.0" );
+ if ( doc == NULL )
+ return NULL;
+ root = xmlNewDocNode(doc, NULL, "ETableSpecification", NULL);
+ xmlDocSetRootElement(doc, root);
+ xmlAddChild(root, et_build_column_spec(e_table));
+ xmlAddChild(root, et_build_grouping_spec(e_table));
+ return doc;
+}
+
+gchar *
+e_table_get_specification (ETable *e_table)
+{
+ xmlDoc *doc = et_build_tree (e_table);
+ xmlChar *buffer;
+ gint size;
+ xmlDocDumpMemory(doc,
+ &buffer,
+ &size);
+ xmlFreeDoc(doc);
+ return buffer;
+}
+
+void
+e_table_save_specification (ETable *e_table, gchar *filename)
+{
+ xmlDoc *doc = et_build_tree (e_table);
+ xmlSaveFile(filename, doc);
+ xmlFreeDoc(doc);
+}
+
+
static void
e_table_class_init (GtkObjectClass *object_class)
{
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
index 841013c09a..5c29c1fa0c 100644
--- a/widgets/table/e-table.h
+++ b/widgets/table/e-table.h
@@ -56,6 +56,12 @@ void e_table_construct (ETable *e_table, ETableHeader *full_header, ETable
const char *spec);
GtkWidget *e_table_new (ETableHeader *full_header, ETableModel *etm,
const char *spec);
+void e_table_construct_from_spec_file (ETable *e_table, ETableHeader *full_header, ETableModel *etm,
+ const char *filename);
+GtkWidget *e_table_new_from_spec_file (ETableHeader *full_header, ETableModel *etm,
+ const char *filename);
+gchar *e_table_get_specification (ETable *e_table);
+void e_table_save_specification (ETable *e_table, gchar *filename);
END_GNOME_DECLS
diff --git a/widgets/table/test-table.c b/widgets/table/test-table.c
index 401cacb285..7bb54b668a 100644
--- a/widgets/table/test-table.c
+++ b/widgets/table/test-table.c
@@ -273,9 +273,15 @@ table_browser_test (void)
}
static void
+save_spec (GtkWidget *button, ETable *e_table)
+{
+ e_table_save_specification(e_table, "e-table-test.xml");
+}
+
+static void
do_e_table_demo (const char *spec)
{
- GtkWidget *e_table, *window, *frame;
+ GtkWidget *e_table, *window, *frame, *vbox, *button;
ECell *cell_left_just;
ETableHeader *full_header;
int i;
@@ -308,11 +314,22 @@ do_e_table_demo (const char *spec)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
frame = gtk_frame_new (NULL);
e_table = e_table_new (full_header, e_table_model, spec);
- gtk_container_add (GTK_CONTAINER (frame), e_table);
+
+ button = gtk_button_new_with_label("Save spec");
+ gtk_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (save_spec), e_table);
+
+ vbox = gtk_vbox_new(FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (vbox), e_table, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (frame), vbox);
gtk_container_add (GTK_CONTAINER (window), frame);
gtk_widget_set_usize (window, 200, 200);
gtk_widget_show (e_table);
+ gtk_widget_show (button);
+ gtk_widget_show (vbox);
gtk_widget_show (frame);
gtk_widget_show (window);
}