From e29d5a8a7adbc9363d4a054b6ab70ada182ae15d Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Sun, 25 Mar 2001 15:30:16 +0000 Subject: The model_rows_{inserted,deleted} signals changed names; deal with it. 2001-03-25 Federico Mena Quintero * gui/e-calendar-table.c (e_calendar_table_init): The model_rows_{inserted,deleted} signals changed names; deal with it. (e_calendar_table_on_rows_inserted): Updated for new ETable API. (e_calendar_table_on_rows_deleted): Likewise. * gui/gnome-cal.h (GnomeCalendarOpenMode): Removed unused enum. * gui/gnome-cal.c (gnome_calendar_open): Constify. * gui/calendar-commands.c (calendar_set_uri): Removed function, since it was just calling gnome_calendar_open(). * gui/control-factory.c (set_prop): Replace usage of calendar_set_uri() with gnome_calendar_open(). (load_calendar): Likewise. (calendar_persist_init): Made static. * gui/e-tasks.c: #include "calendar-config.h" (e_tasks_update_all_config_settings): We are configuring a table, not a calendar! Use the appropriate function. svn path=/trunk/; revision=8928 --- calendar/ChangeLog | 23 +++++++++++++++ calendar/gui/calendar-commands.c | 10 ------- calendar/gui/calendar-commands.h | 2 -- calendar/gui/control-factory.c | 19 +++++------- calendar/gui/e-calendar-table.c | 63 +++++++++++++++++++++++----------------- calendar/gui/e-tasks.c | 5 ++-- calendar/gui/gnome-cal.c | 2 +- calendar/gui/gnome-cal.h | 7 +---- 8 files changed, 73 insertions(+), 58 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index ccff1dc13f..03f2e1b3a9 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,26 @@ +2001-03-25 Federico Mena Quintero + + * gui/e-calendar-table.c (e_calendar_table_init): The + model_rows_{inserted,deleted} signals changed names; deal with it. + (e_calendar_table_on_rows_inserted): Updated for new ETable API. + (e_calendar_table_on_rows_deleted): Likewise. + + * gui/gnome-cal.h (GnomeCalendarOpenMode): Removed unused enum. + + * gui/gnome-cal.c (gnome_calendar_open): Constify. + + * gui/calendar-commands.c (calendar_set_uri): Removed function, + since it was just calling gnome_calendar_open(). + + * gui/control-factory.c (set_prop): Replace usage of + calendar_set_uri() with gnome_calendar_open(). + (load_calendar): Likewise. + (calendar_persist_init): Made static. + + * gui/e-tasks.c: #include "calendar-config.h" + (e_tasks_update_all_config_settings): We are configuring a table, + not a calendar! Use the appropriate function. + 2001-03-17 Miguel de Icaza * gui/e-day-view.c (e_day_view_on_new_event, diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index a35dfcd21e..e92b47f819 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -487,13 +487,3 @@ new_calendar (void) return GNOME_CALENDAR (gcal); } - - -void -calendar_set_uri (GnomeCalendar *gcal, char *calendar_file) -{ - g_return_if_fail (gcal); - g_return_if_fail (calendar_file); - - gnome_calendar_open (gcal, calendar_file); -} diff --git a/calendar/gui/calendar-commands.h b/calendar/gui/calendar-commands.h index 7c69850fb3..3dfad41dab 100644 --- a/calendar/gui/calendar-commands.h +++ b/calendar/gui/calendar-commands.h @@ -34,8 +34,6 @@ void update_all_config_settings (void); GnomeCalendar *new_calendar (void); -void calendar_set_uri (GnomeCalendar *gcal, char *calendar_file); - void calendar_control_activate (BonoboControl *control, GnomeCalendar *cal); void calendar_control_deactivate (BonoboControl *control); diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c index c00e10d35a..1f834e5ad6 100644 --- a/calendar/gui/control-factory.c +++ b/calendar/gui/control-factory.c @@ -96,11 +96,10 @@ set_prop (BonoboPropertyBag *bag, char *filename; switch (arg_id) { - case PROPERTY_CALENDAR_URI_IDX: filename = g_strdup_printf ("%s/calendar.ics", BONOBO_ARG_GET_STRING (arg)); - calendar_set_uri (gcal, filename); + gnome_calendar_open (gcal, filename); /* FIXME: result value -> exception? */ g_free (filename); break; @@ -163,27 +162,25 @@ load_calendar (BonoboPersistFile *pf, const CORBA_char *filename, CORBA_Environm { GnomeCalendar *gcal = closure; - calendar_set_uri (gcal, filename); - - return 0; + return gnome_calendar_open (gcal, filename); } static int -save_calendar (BonoboPersistFile *pf, const CORBA_char *filename, CORBA_Environment *ev, void *closure) +save_calendar (BonoboPersistFile *pf, const CORBA_char *filename, + CORBA_Environment *ev, + void *closure) { /* Do not know how to save stuff yet */ return -1; } -void +static void calendar_persist_init (GnomeCalendar *gcal, BonoboControl *control) { BonoboPersistFile *f; - + f = bonobo_persist_file_new (load_calendar, save_calendar, gcal); - bonobo_object_add_interface ( - BONOBO_OBJECT (control), - BONOBO_OBJECT (f)); + bonobo_object_add_interface (BONOBO_OBJECT (control), BONOBO_OBJECT (f)); } BonoboControl * diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 4806d05c21..0c709c92ae 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -84,11 +84,13 @@ static void e_calendar_table_open_task (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_row_inserted (ETableModel *model, - gint row, +static void e_calendar_table_on_rows_inserted (ETableModel *model, + int row, + int count, ECalendarTable *cal_table); -static void e_calendar_table_on_row_deleted (ETableModel *model, - gint row, +static void e_calendar_table_on_rows_deleted (ETableModel *model, + int row, + int count, ECalendarTable *cal_table); @@ -266,11 +268,11 @@ e_calendar_table_init (ECalendarTable *cal_table) 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_row_inserted", - GTK_SIGNAL_FUNC (e_calendar_table_on_row_inserted), + 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_row_deleted", - GTK_SIGNAL_FUNC (e_calendar_table_on_row_deleted), + 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 */ @@ -798,36 +800,45 @@ e_calendar_table_on_model_changed (ETableModel *model, static void -e_calendar_table_on_row_inserted (ETableModel *model, - gint row, +e_calendar_table_on_rows_inserted (ETableModel *model, + int row, + int count, ECalendarTable *cal_table) { - ETableSubsetVariable *etssv; - CalComponent *comp; - gboolean add_row = FALSE; + int i; - etssv = E_TABLE_SUBSET_VARIABLE (cal_table->subset_model); + for (i = 0; i < count; i++) { + gboolean add_row; - if (cal_table->filter_func == NULL) { - add_row = TRUE; - } else { - comp = calendar_model_get_component (cal_table->model, row); + add_row = FALSE; - if ((*cal_table->filter_func) (cal_table, comp, - cal_table->filter_data)) + 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) { - e_table_subset_variable_increment (etssv, row, 1); - e_table_subset_variable_add (etssv, row); + 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_row_deleted (ETableModel *model, - gint row, +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 diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 237f90959e..d15d332cde 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -33,6 +33,7 @@ #include "widgets/menus/gal-view-menus.h" #include "dialogs/task-editor.h" #include "e-calendar-table.h" +#include "calendar-config.h" #include "component-factory.h" #include "e-tasks.h" @@ -579,7 +580,7 @@ e_tasks_setup_menus (ETasks *tasks, /* This updates all the preference settings for all the ETasks widgets in use. */ void -e_tasks_update_all_config_settings () +e_tasks_update_all_config_settings (void) { ETasks *tasks; ETasksPrivate *priv; @@ -588,6 +589,6 @@ e_tasks_update_all_config_settings () for (elem = all_tasks; elem; elem = elem->next) { tasks = E_TASKS (elem->data); priv = tasks->priv; - calendar_config_configure_e_calendar (E_CALENDAR_TABLE (priv->tasks_view)); + calendar_config_configure_e_calendar_table (E_CALENDAR_TABLE (priv->tasks_view)); } } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index e5ae424f3e..02f8321c2c 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -887,7 +887,7 @@ gnome_calendar_get_cal_client (GnomeCalendar *gcal) } gboolean -gnome_calendar_open (GnomeCalendar *gcal, char *str_uri) +gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) { GnomeCalendarPrivate *priv; char *tasks_uri; diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index 0f06f0c13e..0d2e1d92a1 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -60,11 +60,6 @@ struct _GnomeCalendarClass { }; -typedef enum { - CALENDAR_OPEN, - CALENDAR_OPEN_OR_CREATE -} GnomeCalendarOpenMode; - GtkType gnome_calendar_get_type (void); GtkWidget *gnome_calendar_construct (GnomeCalendar *gcal); @@ -72,7 +67,7 @@ GtkWidget *gnome_calendar_new (void); CalClient *gnome_calendar_get_cal_client (GnomeCalendar *gcal); -gboolean gnome_calendar_open (GnomeCalendar *gcal, char *str_uri); +gboolean gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri); /* int gnome_calendar_create (GnomeCalendar *gcal, char *file); -- cgit