diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-03-06 07:15:14 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-03-06 07:15:14 +0800 |
commit | 3de981ec78d529eb1bd9b2f98f154eae91dffc6d (patch) | |
tree | e8758124523b6c534890aa80f5b918981be6ce00 /widgets/table/e-table.c | |
parent | 645f69dcf6d0b6162c5c7843371c559486234175 (diff) | |
download | gsoc2013-evolution-3de981ec78d529eb1bd9b2f98f154eae91dffc6d.tar gsoc2013-evolution-3de981ec78d529eb1bd9b2f98f154eae91dffc6d.tar.gz gsoc2013-evolution-3de981ec78d529eb1bd9b2f98f154eae91dffc6d.tar.bz2 gsoc2013-evolution-3de981ec78d529eb1bd9b2f98f154eae91dffc6d.tar.lz gsoc2013-evolution-3de981ec78d529eb1bd9b2f98f154eae91dffc6d.tar.xz gsoc2013-evolution-3de981ec78d529eb1bd9b2f98f154eae91dffc6d.tar.zst gsoc2013-evolution-3de981ec78d529eb1bd9b2f98f154eae91dffc6d.zip |
Added support for the sorting info. The Etable creates a sort_info object,
2000-03-05 Christopher James Lahey <clahey@helixcode.com>
* e-table.c, e-table.h: Added support for the sorting info. The
Etable creates a sort_info object, and then connects to the
signals to rearrange the rows when the sort_info changes. It also
passes the info object to the ETableHeaderItem.
* e-table-model.c: Fixed a typo where ETableModel was written as
ETableModle.
* e-table-header.c, e-table-header.h: Added some code for sorting
here, but it's not used. I don't think we want this code, but I
wanted to check it in at least once so that it's not lost.
* e-table-header-item.c, e-table-header-item.h: Added a
"sort_info" argument to ETableHeaderItem. Added display of
current sort settings. Added support for clicking to change the
sort settings.
* e-table-col.h: E_TABLE_COL_ARROW_NONE is marked as being = 0
since this is required in other places. (I think C defines this
as being the case, but it's good to have the = 0 there so that
it's obvious that it has to be first.)
* TODO: Mark sorting as done.
* e-table-sort-info.c, e-table-sort-info.h: New files for
containing the xml grouping/sorting information and for sending
signals on that information.
* Makefile.am: Added e-table-sort-info.c and e-table-sort-info.h.
svn path=/trunk/; revision=2060
Diffstat (limited to 'widgets/table/e-table.c')
-rw-r--r-- | widgets/table/e-table.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index 4bd4417cd0..b1c14b958a 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -35,6 +35,7 @@ static GtkObjectClass *e_table_parent_class; static void e_table_fill_table (ETable *e_table, ETableModel *model); +static gboolean changed_idle (gpointer data); static void et_destroy (GtkObject *object) @@ -44,6 +45,7 @@ et_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (et->model)); gtk_object_unref (GTK_OBJECT (et->full_header)); gtk_object_unref (GTK_OBJECT (et->header)); + gtk_object_unref (GTK_OBJECT (et->sort_info)); gtk_widget_destroy (GTK_WIDGET (et->header_canvas)); gtk_widget_destroy (GTK_WIDGET (et->table_canvas)); @@ -53,6 +55,9 @@ et_destroy (GtkObject *object) et->table_row_change_id); gtk_signal_disconnect (GTK_OBJECT (et->model), et->table_cell_change_id); + if (et->sort_info_change_id) + gtk_signal_disconnect (GTK_OBJECT (et->model), + et->sort_info_change_id); if (et->rebuild_idle_id) { g_source_remove(et->rebuild_idle_id); @@ -68,6 +73,9 @@ static void e_table_init (GtkObject *object) { ETable *e_table = E_TABLE (object); + + e_table->sort_info = NULL; + e_table->sort_info_change_id = 0; e_table->draw_grid = 1; e_table->draw_focus = 1; @@ -110,18 +118,46 @@ header_canvas_size_alocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_t } static void +sort_info_changed (ETableSortInfo *info, ETable *et) +{ + et->need_rebuild = TRUE; + if ( !et->rebuild_idle_id ) { + et->rebuild_idle_id = g_idle_add(changed_idle, et); + } +} + +static void e_table_setup_header (ETable *e_table) { + xmlNode *root; + xmlNode *grouping; e_table->header_canvas = GNOME_CANVAS (gnome_canvas_new ()); - + gtk_widget_show (GTK_WIDGET (e_table->header_canvas)); + root = xmlDocGetRootElement(e_table->specification); + grouping = e_xml_get_child_by_name(root, "grouping"); + + e_table->sort_info = e_table_sort_info_new(); + + gtk_object_ref(GTK_OBJECT(e_table->sort_info)); + gtk_object_sink(GTK_OBJECT(e_table->sort_info)); + + gtk_object_set(GTK_OBJECT(e_table->sort_info), + "grouping", grouping, + NULL); + + e_table->sort_info_change_id = + gtk_signal_connect (GTK_OBJECT(e_table->sort_info), "sort_info_changed", + GTK_SIGNAL_FUNC (sort_info_changed), e_table); + e_table->header_item = gnome_canvas_item_new ( gnome_canvas_root (e_table->header_canvas), e_table_header_item_get_type (), "ETableHeader", e_table->header, "x", 0, "y", 0, + "sort_info", e_table->sort_info, NULL); gtk_signal_connect ( @@ -705,7 +741,7 @@ et_real_construct (ETable *e_table, ETableHeader *full_header, ETableModel *etm, gtk_widget_show (vscrollbar); gtk_table_attach ( GTK_TABLE (e_table), vscrollbar, - 1, 2, 1, 2, 0, GTK_FILL | GTK_EXPAND, 0, 0); + 1, 2, 0, 2, 0, GTK_FILL | GTK_EXPAND, 0, 0); gtk_widget_pop_colormap (); gtk_widget_pop_visual (); |