diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-07-28 03:42:21 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-07-28 03:42:21 +0800 |
commit | 7463b3c0eeba36906a6a94130c243a41c65d5e98 (patch) | |
tree | 099ddd2aa5815e0427abde9f6bb8aaf78cc57147 /calendar/gui/e-calendar-table.c | |
parent | 35bf394708e6564c698277ff3dff149133036580 (diff) | |
download | gsoc2013-evolution-7463b3c0eeba36906a6a94130c243a41c65d5e98.tar gsoc2013-evolution-7463b3c0eeba36906a6a94130c243a41c65d5e98.tar.gz gsoc2013-evolution-7463b3c0eeba36906a6a94130c243a41c65d5e98.tar.bz2 gsoc2013-evolution-7463b3c0eeba36906a6a94130c243a41c65d5e98.tar.lz gsoc2013-evolution-7463b3c0eeba36906a6a94130c243a41c65d5e98.tar.xz gsoc2013-evolution-7463b3c0eeba36906a6a94130c243a41c65d5e98.tar.zst gsoc2013-evolution-7463b3c0eeba36906a6a94130c243a41c65d5e98.zip |
New files with a derivative of ESearchBar that generates sexps for
2001-07-27 Federico Mena Quintero <federico@ximian.com>
* gui/cal-search-bar.[ch]: New files with a derivative of
ESearchBar that generates sexps for calendar queries directly.
* gui/gnome-cal.c (setup_widgets): Use CalSearchBar instead of
ESearchBar.
* gui/e-calendar-table.h (ECalendarTable): Removed the ->colors
array since it is handled by ETableExtras now.
* gui/e-calendar-table.[ch]: Removed the subset_model. Now we use
the live query facility to filter tasks. Removed the filter
function stuff as well.
* gui/e-tasks.c (e_tasks_construct): Use
calendar_model_set_cal_client() directly instead of
e_calendar_table_set_model().
(setup_widgets): Create a calendar search bar for the tasks
component.
(search_bar_sexp_changed_cb): Set the query sexp on the table model.
(e_tasks_on_filter_selected): Regenerate the query from the
selected category and the current sexp.
(update_query): New convenience function to recompute the real
query sexp.
* gui/gnome-cal.c (gnome_calendar_construct): Likewise.
* gui/e-calendar-table.c (e_calendar_table_set_cal_client):
Removed function; people are now supposed to get the model from
the calendar table and operate on it.
* gui/calendar-commands.c (verbs): Consistency fixes with the XML
file.
(pixmaps): Likewise.
* gui/Makefile.am (evolution_calendar_SOURCES): Added
cal-search-bar.[ch] to the list of sources.
2001-07-20 Federico Mena Quintero <federico@ximian.com>
* idl/evolution-calendar.idl (CompEditorFactory): New interface to
a centralized factory for calendar component editors. Has
editExisting() and editNew() methods to edit an existing component
from a URI/UID pair, and to create a new component in a calendar
that is in a particular URI, respectively.
* gui/comp-editor-factory.[ch]: Implementation files for the
component editor factory.
* gui/GNOME_Evolution_Calendar.oaf.in: Added the CompEditorFactory
stuff.
* gui/Makefile.am (evolution_calendar_SOURCES): Added
comp-editor-factory.[ch] to the list of sources.
svn path=/trunk/; revision=11455
Diffstat (limited to 'calendar/gui/e-calendar-table.c')
-rw-r--r-- | calendar/gui/e-calendar-table.c | 191 |
1 files changed, 3 insertions, 188 deletions
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 999b64d99f..fc86f5e4f9 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -82,18 +82,6 @@ static gint e_calendar_table_on_key_press (ETable *table, GdkEventKey *event, ECalendarTable *cal_table); -static void e_calendar_table_apply_filter (ECalendarTable *cal_table); -static void e_calendar_table_on_model_changed (ETableModel *model, - ECalendarTable *cal_table); -static void e_calendar_table_on_rows_inserted (ETableModel *model, - int row, - int count, - ECalendarTable *cal_table); -static void e_calendar_table_on_rows_deleted (ETableModel *model, - int row, - int count, - ECalendarTable *cal_table); - static void selection_clear_event (GtkWidget *invisible, GdkEventSelection *event, ECalendarTable *cal_table); @@ -252,39 +240,11 @@ e_calendar_table_init (ECalendarTable *cal_table) ETableExtras *extras; gint i; GdkPixbuf *pixbuf; - GdkColormap *colormap; - gboolean success[E_CALENDAR_TABLE_COLOR_LAST]; - gint nfailed; GList *strings; - /* Allocate the colors we need. */ - - colormap = gtk_widget_get_colormap (GTK_WIDGET (cal_table)); - - cal_table->colors[E_CALENDAR_TABLE_COLOR_OVERDUE].red = 65535; - cal_table->colors[E_CALENDAR_TABLE_COLOR_OVERDUE].green = 0; - cal_table->colors[E_CALENDAR_TABLE_COLOR_OVERDUE].blue = 0; - - nfailed = gdk_colormap_alloc_colors (colormap, cal_table->colors, - E_CALENDAR_TABLE_COLOR_LAST, - FALSE, TRUE, success); - if (nfailed) - g_warning ("Failed to allocate all colors"); - /* Create the model */ cal_table->model = calendar_model_new (); - cal_table->subset_model = e_table_subset_variable_new (E_TABLE_MODEL (cal_table->model)); - - gtk_signal_connect (GTK_OBJECT (cal_table->model), "model_changed", - GTK_SIGNAL_FUNC (e_calendar_table_on_model_changed), - cal_table); - gtk_signal_connect (GTK_OBJECT (cal_table->model), "model_rows_inserted", - GTK_SIGNAL_FUNC (e_calendar_table_on_rows_inserted), - cal_table); - gtk_signal_connect (GTK_OBJECT (cal_table->model), "model_rows_deleted", - GTK_SIGNAL_FUNC (e_calendar_table_on_rows_deleted), - cal_table); /* Create the header columns */ @@ -472,7 +432,7 @@ e_calendar_table_init (ECalendarTable *cal_table) /* Create the table */ - table = e_table_scrolled_new_from_spec_file (cal_table->subset_model, + table = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (cal_table->model), extras, EVOLUTION_ETSPECDIR "/e-calendar-table.etspec", NULL); @@ -566,9 +526,6 @@ e_calendar_table_destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (cal_table->model)); cal_table->model = NULL; - gtk_object_unref (GTK_OBJECT (cal_table->subset_model)); - cal_table->subset_model = NULL; - if (cal_table->invisible) gtk_widget_destroy (cal_table->invisible); if (cal_table->clipboard_selection) @@ -577,15 +534,6 @@ e_calendar_table_destroy (GtkObject *object) GTK_OBJECT_CLASS (parent_class)->destroy (object); } - -void -e_calendar_table_set_cal_client (ECalendarTable *cal_table, - CalClient *client) -{ - calendar_model_set_cal_client (cal_table->model, client, - CALOBJ_TYPE_TODO); -} - /** * e_calendar_table_get_table: * @cal_table: A calendar table. @@ -724,6 +672,8 @@ e_calendar_table_delete_selected (ECalendarTable *cal_table) else comp = NULL; + /* FIXME: this may be something other than a TODO component */ + if (delete_component_dialog (comp, n_selected, CAL_COMPONENT_TODO, GTK_WIDGET (cal_table))) delete_selected_components (cal_table); } @@ -1011,141 +961,6 @@ e_calendar_table_save_state (ECalendarTable *cal_table, } -void -e_calendar_table_set_filter_func (ECalendarTable *cal_table, - ECalendarTableFilterFunc filter_func, - gpointer filter_data, - GDestroyNotify filter_data_destroy) -{ - g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); - - if (cal_table->filter_func == filter_func - && cal_table->filter_data == filter_data - && cal_table->filter_data_destroy == filter_data_destroy) - return; - - if (cal_table->filter_data_destroy) - (*cal_table->filter_data_destroy) (cal_table->filter_data); - - cal_table->filter_func = filter_func; - cal_table->filter_data = filter_data; - cal_table->filter_data_destroy = filter_data_destroy; - - e_calendar_table_apply_filter (cal_table); -} - - -static void -e_calendar_table_apply_filter (ECalendarTable *cal_table) -{ - ETableSubsetVariable *etssv; - CalComponent *comp; - gint rows, row; - - etssv = E_TABLE_SUBSET_VARIABLE (cal_table->subset_model); - - /* Make sure that any edits get saved first. */ - e_table_model_pre_change (cal_table->subset_model); - - /* FIXME: A hack to remove all the existing rows quickly. */ - E_TABLE_SUBSET (cal_table->subset_model)->n_map = 0; - - if (cal_table->filter_func == NULL) { - e_table_subset_variable_add_all (etssv); - } else { - rows = e_table_model_row_count (E_TABLE_MODEL (cal_table->model)); - for (row = 0; row < rows; row++) { - comp = calendar_model_get_component (cal_table->model, - row); - - if ((*cal_table->filter_func) (cal_table, comp, - cal_table->filter_data)) - e_table_subset_variable_add (etssv, row); - } - } - - e_table_model_changed (cal_table->subset_model); -} - - -gboolean -e_calendar_table_filter_by_category (ECalendarTable *cal_table, - CalComponent *comp, - gpointer filter_data) -{ - GSList *categories_list, *elem; - gboolean retval = FALSE; - - cal_component_get_categories_list (comp, &categories_list); - - for (elem = categories_list; elem; elem = elem->next) { - if (retval == FALSE - && !strcmp ((char*) elem->data, (char*) filter_data)) - retval = TRUE; - g_free (elem->data); - } - - g_slist_free (categories_list); - - return retval; -} - - -static void -e_calendar_table_on_model_changed (ETableModel *model, - ECalendarTable *cal_table) -{ - e_calendar_table_apply_filter (cal_table); -} - - -static void -e_calendar_table_on_rows_inserted (ETableModel *model, - int row, - int count, - ECalendarTable *cal_table) -{ - int i; - - for (i = 0; i < count; i++) { - gboolean add_row; - - add_row = FALSE; - - if (cal_table->filter_func) { - CalComponent *comp; - - comp = calendar_model_get_component (cal_table->model, row + i); - g_assert (comp != NULL); - - add_row = (* cal_table->filter_func) (cal_table, comp, - cal_table->filter_data); - } else - add_row = TRUE; - - if (add_row) { - ETableSubsetVariable *etssv; - - etssv = E_TABLE_SUBSET_VARIABLE (cal_table->subset_model); - - e_table_subset_variable_increment (etssv, row, 1); - e_table_subset_variable_add (etssv, row); - } - } -} - - -static void -e_calendar_table_on_rows_deleted (ETableModel *model, - int row, - int count, - ECalendarTable *cal_table) -{ - /* We just reapply the filter since we aren't too bothered about - being efficient. It doesn't happen often. */ - e_calendar_table_apply_filter (cal_table); -} - static void invisible_destroyed (GtkWidget *invisible, ECalendarTable *cal_table) { |