From fd1be1837acc71058f3f0ab4b99526639300b862 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 29 Oct 2003 14:21:34 +0000 Subject: unref config manager (init_widgets): create config manager for the 2003-10-29 JP Rosevear * gui/dialogs/recurrence-page.c (recurrence_page_finalize): unref config manager (init_widgets): create config manager for the e-calendar * gui/e-tasks.c (setup_widgets): create config manager for the table view (e_tasks_destroy): unref config manager (e_tasks_open): return FALSE not NULL (e_tasks_update_all_config_settings): don't configure the calendar table here, we have a manager * gui/calendar-config.c: remove dead config functions (handled by config managers now) svn path=/trunk/; revision=23115 --- calendar/ChangeLog | 19 ++++++- calendar/gui/calendar-config.c | 101 --------------------------------- calendar/gui/dialogs/recurrence-page.c | 11 +++- calendar/gui/e-tasks.c | 18 +++--- 4 files changed, 38 insertions(+), 111 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 458e18cd95..116ab1b8f1 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,19 @@ +2003-10-29 JP Rosevear + + * gui/dialogs/recurrence-page.c (recurrence_page_finalize): unref + config manager + (init_widgets): create config manager for the e-calendar + + * gui/e-tasks.c (setup_widgets): create config manager for the + table view + (e_tasks_destroy): unref config manager + (e_tasks_open): return FALSE not NULL + (e_tasks_update_all_config_settings): don't configure the calendar + table here, we have a manager + + * gui/calendar-config.c: remove dead config functions (handled by + config managers now) + 2003-10-29 JP Rosevear * gui/gnome-cal.c (set_timezone): set the timezone for all clients @@ -46,7 +62,8 @@ (calendar_config_add_notification_dnav_show_week_no): notify of show week number setting change - * gui/calendar-component.c (calendar_component_peek): remove bad comma + * gui/calendar-component.c (calendar_component_peek): remove bad + comma * gui/Makefile.am: build new config classes diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index d7bd087a8c..18a0513135 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -629,31 +629,6 @@ calendar_config_set_confirm_purge (gboolean confirm) gconf_client_set_bool (config, CALENDAR_CONFIG_PROMPT_PURGE, confirm, NULL); } -/* This sets all the common config settings for an ECalendar widget. - These are the week start day, and whether we show week numbers. */ -void -calendar_config_configure_e_calendar (ECalendar *cal) -{ - gboolean dnav_show_week_no; - gint week_start_day; - - g_return_if_fail (E_IS_CALENDAR (cal)); - - dnav_show_week_no = calendar_config_get_dnav_show_week_no (); - - /* Note that this is 0 (Sun) to 6 (Sat). */ - week_start_day = calendar_config_get_week_start_day (); - - /* Convert it to 0 (Mon) to 6 (Sun), which is what we use. */ - week_start_day = (week_start_day + 6) % 7; - - gnome_canvas_item_set (GNOME_CANVAS_ITEM (cal->calitem), - "show_week_numbers", dnav_show_week_no, - "week_start_day", week_start_day, - NULL); -} - - /* This sets all the common config settings for an EDateEdit widget. These are the week start day, whether we show week numbers, and whether we use 24 hour format. */ @@ -680,82 +655,6 @@ calendar_config_configure_e_date_edit (EDateEdit *dedit) e_date_edit_set_use_24_hour_format (dedit, use_24_hour); } - -/* This sets all the common config settings for an ECellDateEdit ETable item. - These are the settings for the ECalendar popup and the time list (if we use - 24 hour format, and the hours of the working day). */ -void -calendar_config_configure_e_cell_date_edit (ECellDateEdit *ecde) -{ - gboolean use_24_hour; - gint start_hour, end_hour; - ECellPopup *ecp; - ECellDateEditText *ecd; - char *location; - icaltimezone *zone; - - g_return_if_fail (E_IS_CELL_DATE_EDIT (ecde)); - - ecp = E_CELL_POPUP (ecde); - ecd = E_CELL_DATE_EDIT_TEXT (ecp->child); - - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - - calendar_config_configure_e_calendar (E_CALENDAR (ecde->calendar)); - - use_24_hour = calendar_config_get_24_hour_format (); - - start_hour = calendar_config_get_day_start_hour (); - end_hour = calendar_config_get_day_end_hour (); - - /* Round up the end hour. */ - if (calendar_config_get_day_end_minute () != 0) - end_hour++; - - e_cell_date_edit_freeze (ecde); - g_object_set (G_OBJECT (ecde), - "use_24_hour_format", use_24_hour, -#if 0 - /* We use the default 0 - 24 now. */ - "lower_hour", start_hour, - "upper_hour", end_hour, -#endif - NULL); - e_cell_date_edit_thaw (ecde); - - e_cell_date_edit_text_set_timezone (ecd, zone); - e_cell_date_edit_text_set_use_24_hour_format (ecd, use_24_hour); -} - - -/* This sets all the common config settings for an ECalendarTable widget. - These are the settings for the ECalendar popup and the time list (if we use - 24 hour format, and the hours of the working day). */ -void -calendar_config_configure_e_calendar_table (ECalendarTable *cal_table) -{ - ECalModel *model; - gboolean use_24_hour; - char *location; - icaltimezone *zone; - - g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table)); - - use_24_hour = calendar_config_get_24_hour_format (); - - model = e_calendar_table_get_model (cal_table); - e_cal_model_set_use_24_hour_format (model, use_24_hour); - - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - e_cal_model_set_timezone (model, zone); - - calendar_config_configure_e_cell_date_edit (cal_table->dates_cell); -} - - - void calendar_config_check_timezone_set () { diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 4599001c27..ece6c115bb 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -49,6 +49,7 @@ #include "../weekday-picker.h" #include "comp-editor-util.h" #include "../e-date-time-list.h" +#include "../e-mini-calendar-config.h" #include "recurrence-page.h" @@ -193,7 +194,8 @@ struct _RecurrencePagePrivate { /* For the recurrence preview, the actual widget */ GtkWidget *preview_calendar; - + EMiniCalendarConfig *preview_calendar_config; + gboolean updating; }; @@ -321,6 +323,11 @@ recurrence_page_finalize (GObject *object) priv->exception_list_store = NULL; } + if (priv->preview_calendar_config) { + g_object_unref (priv->preview_calendar_config); + priv->preview_calendar_config = NULL; + } + g_free (priv); rpage->priv = NULL; @@ -2254,10 +2261,10 @@ init_widgets (RecurrencePage *rpage) priv->preview_calendar = e_calendar_new (); ecal = E_CALENDAR (priv->preview_calendar); + priv->preview_calendar_config = e_mini_calendar_config_new (ecal); g_signal_connect((ecal->calitem), "date_range_changed", G_CALLBACK (preview_date_range_changed_cb), rpage); - calendar_config_configure_e_calendar (ecal); e_calendar_item_set_max_days_sel (ecal->calitem, 0); gtk_container_add (GTK_CONTAINER (priv->preview_bin), priv->preview_calendar); diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 768b2e587c..1303b85f43 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -44,6 +44,7 @@ #include "calendar-config.h" #include "calendar-component.h" #include "comp-util.h" +#include "e-calendar-table-config.h" #include "misc.h" #include "e-tasks.h" @@ -61,7 +62,8 @@ struct _ETasksPrivate { /* The ECalendarTable showing the tasks. */ GtkWidget *tasks_view; - + ECalendarTableConfig *tasks_view_config; + /* Calendar search bar for tasks */ GtkWidget *search_bar; @@ -502,15 +504,14 @@ setup_widgets (ETasks *tasks) /* create the task list */ priv->tasks_view = e_calendar_table_new (); - + priv->tasks_view_config = e_calendar_table_config_new (E_CALENDAR_TABLE (priv->tasks_view)); + etable = e_table_scrolled_get_table ( E_TABLE_SCROLLED (E_CALENDAR_TABLE (priv->tasks_view)->etable)); e_table_set_state (etable, E_TASKS_TABLE_DEFAULT_STATE); gtk_paned_add1 (GTK_PANED (paned), priv->tasks_view); gtk_widget_show (priv->tasks_view); - calendar_config_configure_e_calendar_table (E_CALENDAR_TABLE (priv->tasks_view)); - g_signal_connect (etable, "cursor_change", G_CALLBACK (table_cursor_change_cb), tasks); g_signal_connect (etable, "selection_change", G_CALLBACK (table_selection_change_cb), tasks); @@ -637,6 +638,11 @@ e_tasks_destroy (GtkObject *object) priv->current_uid = NULL; } + if (priv->tasks_view_config) { + g_object_unref (priv->tasks_view_config); + priv->tasks_view_config = NULL; + } + g_free (priv); tasks->priv = NULL; @@ -690,7 +696,7 @@ e_tasks_open (ETasks *tasks, /* create the CalClient */ priv->client = cal_client_new (real_uri, CALOBJ_TYPE_TODO); if (!priv->client) - return NULL; + return FALSE; g_signal_connect (priv->client, "cal_opened", G_CALLBACK (cal_opened_cb), tasks); @@ -1129,8 +1135,6 @@ e_tasks_update_all_config_settings (void) tasks = E_TASKS (elem->data); priv = tasks->priv; - calendar_config_configure_e_calendar_table (E_CALENDAR_TABLE (priv->tasks_view)); - if (zone) /* FIXME Error checking */ cal_client_set_default_timezone (priv->client, zone, NULL); -- cgit