diff options
author | JP Rosevear <jpr@ximian.com> | 2003-10-29 23:41:47 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2003-10-29 23:41:47 +0800 |
commit | 26f77b16e1f8a3207554e607e2ee18bb7b14c97d (patch) | |
tree | 91eaf2ffa63b732a4888afcac459faab263648da /calendar | |
parent | 6c743503b1f747c50e28c05aed4ad4c620a3912e (diff) | |
download | gsoc2013-evolution-26f77b16e1f8a3207554e607e2ee18bb7b14c97d.tar.gz gsoc2013-evolution-26f77b16e1f8a3207554e607e2ee18bb7b14c97d.tar.zst gsoc2013-evolution-26f77b16e1f8a3207554e607e2ee18bb7b14c97d.zip |
no need to update config settings everywhere explicitly
2003-10-29 JP Rosevear <jpr@ximian.com>
* gui/dialogs/cal-prefs-dialog.c (update_config): no need to
update config settings everywhere explicitly
* gui/tasks-component.c (update_uris_for_selection): cast the
widget
* gui/gnome-cal.h: remove proto
* gui/gnome-cal.c (setup_widgets): don't update config settings
explicitly
(gnome_calendar_update_config_settings): kill
* gui/e-week-view.c: remove null chars
* gui/e-tasks.h: remove proto
* gui/e-tasks.c (set_timezone): set the timezone on the client
(timezone_changed_cb): changed timezone callback
(setup_config): setup config stuff
(e_tasks_init): setup config and widgets here
(e_tasks_new): construct is dead, no need to track all widgets
(cal_opened_cb): set the timezone upon opening
(e_tasks_update_all_config_settings): kill
* gui/control-factory.c (control_factory_new_control): create the
calendar ourselves
* gui/calendar-config.c (on_timezone_set): don't update the
settings everywhere here, we have config managers now
* gui/calendar-component.c (impl_createControls): create the
calendar ourselves
* gui/calendar-commands.h: remove protos
* gui/calendar-commands.c: remove dead functions
svn path=/trunk/; revision=23117
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 39 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.c | 42 | ||||
-rw-r--r-- | calendar/gui/calendar-commands.h | 5 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 4 | ||||
-rw-r--r-- | calendar/gui/calendar-config.c | 6 | ||||
-rw-r--r-- | calendar/gui/control-factory.c | 2 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 7 | ||||
-rw-r--r-- | calendar/gui/e-tasks.c | 202 | ||||
-rw-r--r-- | calendar/gui/e-tasks.h | 5 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 1 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 23 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.h | 5 | ||||
-rw-r--r-- | calendar/gui/tasks-component.c | 4 |
13 files changed, 144 insertions, 201 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index fca2ac3644..71953bf0b7 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,42 @@ +2003-10-29 <jpr@ximian.com> + + * gui/dialogs/cal-prefs-dialog.c (update_config): no need to + update config settings everywhere explicitly + + * gui/tasks-component.c (update_uris_for_selection): cast the + widget + + * gui/gnome-cal.h: remove proto + + * gui/gnome-cal.c (setup_widgets): don't update config settings + explicitly + (gnome_calendar_update_config_settings): kill + + * gui/e-week-view.c: remove null chars + + * gui/e-tasks.h: remove proto + + * gui/e-tasks.c (set_timezone): set the timezone on the client + (timezone_changed_cb): changed timezone callback + (setup_config): setup config stuff + (e_tasks_init): setup config and widgets here + (e_tasks_new): construct is dead, no need to track all widgets + (cal_opened_cb): set the timezone upon opening + (e_tasks_update_all_config_settings): kill + + * gui/control-factory.c (control_factory_new_control): create the + calendar ourselves + + * gui/calendar-config.c (on_timezone_set): don't update the + settings everywhere here, we have config managers now + + * gui/calendar-component.c (impl_createControls): create the + calendar ourselves + + * gui/calendar-commands.h: remove protos + + * gui/calendar-commands.c: remove dead functions + 2003-10-29 JP Rosevear <jpr@ximian.com> * gui/e-day-view-config.c (set_twentyfour_hour): set the format on diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index 77305098bc..5dbce1ec54 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -63,9 +63,6 @@ #include "itip-utils.h" #include "evolution-shell-component-utils.h" -/* A list of all of the calendars started */ -static GList *all_calendars = NULL; - /* Focusing information for the calendar view. We have to keep track of this * ourselves because with Bonobo controls, we may get unpaired focus_out events. */ @@ -188,18 +185,6 @@ file_print_preview_cb (BonoboUIComponent *uic, gpointer data, const char *path) print (gcal, TRUE); } -/* This iterates over each calendar telling them to update their config - settings. */ -void -update_all_config_settings (void) -{ - GList *l; - - for (l = all_calendars; l; l = l->next) - gnome_calendar_update_config_settings (GNOME_CALENDAR (l->data), FALSE); -} - - /* Sets a clock cursor for the specified calendar window */ static void set_clock_cursor (GnomeCalendar *gcal) @@ -993,30 +978,3 @@ calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal) bonobo_ui_component_rm (uic, "/", NULL); bonobo_ui_component_unset_container (uic, NULL); } - -/* Removes a calendar from our list of all calendars when it is destroyed. */ -static void -on_calendar_destroyed (GnomeCalendar *gcal) -{ - all_calendars = g_list_remove (all_calendars, gcal); -} - -GnomeCalendar * -new_calendar (void) -{ - GtkWidget *gcal; - - gcal = gnome_calendar_new (); - if (!gcal) { - gnome_warning_dialog (_("Could not create the calendar view. Please check your " - "ORBit and OAF setup.")); - return NULL; - } - - g_signal_connect (gcal, "destroy", - G_CALLBACK (on_calendar_destroyed), NULL); - - all_calendars = g_list_prepend (all_calendars, gcal); - - return GNOME_CALENDAR (gcal); -} diff --git a/calendar/gui/calendar-commands.h b/calendar/gui/calendar-commands.h index 3e74074140..44ceb41c4e 100644 --- a/calendar/gui/calendar-commands.h +++ b/calendar/gui/calendar-commands.h @@ -30,11 +30,6 @@ #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-ui-component.h> -/* This tells all the calendars to reload the config settings. */ -void update_all_config_settings (void); - -GnomeCalendar *new_calendar (void); - void calendar_control_activate (BonoboControl *control, GnomeCalendar *gcal); void calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal); diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 24736067bb..619d15493b 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -36,6 +36,8 @@ #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-i18n.h> +#include <gtk/gtkimage.h> +#include <gtk/gtkimagemenuitem.h> #include <gal/util/e-util.h> #include <errno.h> @@ -271,7 +273,7 @@ impl_createControls (PortableServer_Servant servant, /* Create main calendar view */ /* FIXME Instead of returning, we should make a control with a * label describing the problem */ - priv->calendar = new_calendar (); + priv->calendar = GNOME_CALENDAR (gnome_calendar_new ()); if (!priv->calendar) { g_warning (G_STRLOC ": could not create the calendar widget!"); return; diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 18a0513135..4282ea7d5c 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -692,13 +692,9 @@ on_timezone_set (GnomeDialog *dialog, icaltimezone *zone; zone = e_timezone_dialog_get_timezone (etd); - if (zone) { + if (zone) calendar_config_set_timezone (icaltimezone_get_location (zone)); - update_all_config_settings (); - e_tasks_update_all_config_settings (); - } - g_object_unref (etd); } diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c index 7adc5e83df..9586d6f62d 100644 --- a/calendar/gui/control-factory.c +++ b/calendar/gui/control-factory.c @@ -196,7 +196,7 @@ control_factory_new_control (void) BonoboControl *control; GnomeCalendar *gcal; - gcal = new_calendar (); + gcal = GNOME_CALENDAR (gnome_calendar_new ()); if (!gcal) return NULL; diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 9d8c8eedb2..bfb9c06112 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -34,8 +34,6 @@ #include "../e-timezone-entry.h" #include "cal-prefs-dialog.h" #include "../calendar-config.h" -#include "../calendar-commands.h" -#include "../e-tasks.h" #include <gtk/gtksignal.h> #include <gtk/gtkoptionmenu.h> @@ -685,9 +683,4 @@ update_config (DialogData *dialog_data) calendar_config_set_default_reminder_units ( e_dialog_option_menu_get (dialog_data->default_reminder_units, default_reminder_units_map)); - - /* Done */ - - update_all_config_settings (); - e_tasks_update_all_config_settings (); } diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 1303b85f43..cf4d79ba41 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -49,10 +49,6 @@ #include "e-tasks.h" -/* A list of all of the ETasks widgets in use. We use this to update the - user preference settings. This will change when we switch to GConf. */ -static GList *all_tasks = NULL; - /* Private part of the GnomeCalendar structure */ struct _ETasksPrivate { @@ -74,6 +70,8 @@ struct _ETasksPrivate { /* View instance and the view menus handler */ GalViewInstance *view_instance; GalViewMenus *view_menus; + + GList *notifications; }; @@ -99,48 +97,6 @@ E_MAKE_TYPE (e_tasks, "ETasks", ETasks, e_tasks_class_init, e_tasks_init, GTK_TYPE_TABLE) - -/* Class initialization function for the gnome calendar */ - static void -e_tasks_class_init (ETasksClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_TABLE); - - e_tasks_signals[SELECTION_CHANGED] = - gtk_signal_new ("selection_changed", - GTK_RUN_LAST, - G_TYPE_FROM_CLASS (object_class), - GTK_SIGNAL_OFFSET (ETasksClass, selection_changed), - gtk_marshal_NONE__INT, - GTK_TYPE_NONE, 1, - GTK_TYPE_INT); - - object_class->destroy = e_tasks_destroy; - - class->selection_changed = NULL; -} - - -/* Object initialization function for the gnome calendar */ -static void -e_tasks_init (ETasks *tasks) -{ - ETasksPrivate *priv; - - priv = g_new0 (ETasksPrivate, 1); - tasks->priv = priv; - - priv->client = NULL; - priv->query = NULL; - priv->view_instance = NULL; - priv->view_menus = NULL; - priv->current_uid = NULL; -} - /* Converts a time_t to a string, relative to the specified timezone */ static char * timet_to_str_with_zone (time_t t, icaltimezone *zone) @@ -463,6 +419,50 @@ vpaned_resized_cb (GtkWidget *widget, GdkEventButton *event, ETasks *tasks) return FALSE; } +static void +set_timezone (ETasks *tasks) +{ + ETasksPrivate *priv; + char *location; + icaltimezone *zone; + + priv = tasks->priv; + + location = calendar_config_get_timezone (); + zone = icaltimezone_get_builtin_timezone (location); + g_free (location); + + if (!zone) + zone = icaltimezone_get_utc_timezone (); + + if (cal_client_get_load_state (priv->client) == CAL_CLIENT_LOAD_LOADED) + /* FIXME Error checking */ + cal_client_set_default_timezone (priv->client, zone, NULL); +} + +static void +timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) +{ + ETasks *tasks = data; + + set_timezone (tasks); +} + +static void +setup_config (ETasks *tasks) +{ + ETasksPrivate *priv; + guint not; + + priv = tasks->priv; + + /* Timezone */ + set_timezone (tasks); + + not = calendar_config_add_notification_timezone (timezone_changed_cb, tasks); + priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); +} + #define E_TASKS_TABLE_DEFAULT_STATE \ "<?xml version=\"1.0\"?>" \ "<ETableState>" \ @@ -473,7 +473,6 @@ vpaned_resized_cb (GtkWidget *widget, GdkEventButton *event, ETasks *tasks) "<grouping/>" \ "</ETableState>" - static void setup_widgets (ETasks *tasks) { @@ -536,6 +535,50 @@ setup_widgets (ETasks *tasks) gtk_widget_show_all (scroll); } +/* Class initialization function for the gnome calendar */ + static void +e_tasks_class_init (ETasksClass *class) +{ + GtkObjectClass *object_class; + + object_class = (GtkObjectClass *) class; + + parent_class = gtk_type_class (GTK_TYPE_TABLE); + + e_tasks_signals[SELECTION_CHANGED] = + gtk_signal_new ("selection_changed", + GTK_RUN_LAST, + G_TYPE_FROM_CLASS (object_class), + GTK_SIGNAL_OFFSET (ETasksClass, selection_changed), + gtk_marshal_NONE__INT, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); + + object_class->destroy = e_tasks_destroy; + + class->selection_changed = NULL; +} + + +/* Object initialization function for the gnome calendar */ +static void +e_tasks_init (ETasks *tasks) +{ + ETasksPrivate *priv; + + priv = g_new0 (ETasksPrivate, 1); + tasks->priv = priv; + + setup_config (tasks); + setup_widgets (tasks); + + priv->client = NULL; + priv->query = NULL; + priv->view_instance = NULL; + priv->view_menus = NULL; + priv->current_uid = NULL; +} + /* Callback used when the set of categories changes in the calendar client */ static void client_categories_changed_cb (CalClient *client, GPtrArray *categories, gpointer data) @@ -569,21 +612,6 @@ client_obj_updated_cb (CalClient *client, const char *uid, gpointer data) } } -GtkWidget * -e_tasks_construct (ETasks *tasks) -{ - ETasksPrivate *priv; - - g_return_val_if_fail (tasks != NULL, NULL); - g_return_val_if_fail (E_IS_TASKS (tasks), NULL); - - priv = tasks->priv; - - setup_widgets (tasks); - - return GTK_WIDGET (tasks); -} - GtkWidget * e_tasks_new (void) @@ -592,14 +620,6 @@ e_tasks_new (void) tasks = g_object_new (e_tasks_get_type (), NULL); - if (!e_tasks_construct (tasks)) { - g_message ("e_tasks_new(): Could not construct the tasks GUI"); - g_object_unref (tasks); - return NULL; - } - - all_tasks = g_list_prepend (all_tasks, tasks); - return GTK_WIDGET (tasks); } @@ -628,6 +648,8 @@ e_tasks_destroy (GtkObject *object) priv = tasks->priv; if (priv) { + GList *l; + if (priv->client) { g_object_unref (priv->client); priv->client = NULL; @@ -643,10 +665,12 @@ e_tasks_destroy (GtkObject *object) priv->tasks_view_config = NULL; } + for (l = priv->notifications; l; l = l->next) + calendar_config_remove_notification (GPOINTER_TO_UINT (l->data)); + priv->notifications = NULL; + g_free (priv); tasks->priv = NULL; - - all_tasks = g_list_remove (all_tasks, tasks); } if (GTK_OBJECT_CLASS (parent_class)->destroy) @@ -780,8 +804,6 @@ cal_opened_cb (CalClient *client, { ETasks *tasks; ETasksPrivate *priv; - char *location; - icaltimezone *zone; tasks = E_TASKS (data); priv = tasks->priv; @@ -791,13 +813,7 @@ cal_opened_cb (CalClient *client, switch (status) { case CAL_CLIENT_OPEN_SUCCESS: /* Everything is OK */ - - /* Set the client's default timezone, if we have one. */ - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - if (zone) - /* FIXME Error checking */ - cal_client_set_default_timezone (client, zone, NULL); + set_timezone (tasks); return; case CAL_CLIENT_OPEN_ERROR: @@ -1116,27 +1132,3 @@ e_tasks_get_calendar_table (ETasks *tasks) priv = tasks->priv; return E_CALENDAR_TABLE (priv->tasks_view); } - -/* This updates all the preference settings for all the ETasks widgets in use. - */ -void -e_tasks_update_all_config_settings (void) -{ - ETasks *tasks; - ETasksPrivate *priv; - GList *elem; - char *location; - icaltimezone *zone; - - location = calendar_config_get_timezone (); - zone = icaltimezone_get_builtin_timezone (location); - - for (elem = all_tasks; elem; elem = elem->next) { - tasks = E_TASKS (elem->data); - priv = tasks->priv; - - if (zone) - /* FIXME Error checking */ - cal_client_set_default_timezone (priv->client, zone, NULL); - } -} diff --git a/calendar/gui/e-tasks.h b/calendar/gui/e-tasks.h index b88e495dcc..e901a7608f 100644 --- a/calendar/gui/e-tasks.h +++ b/calendar/gui/e-tasks.h @@ -25,6 +25,7 @@ #ifndef _E_TASKS_H_ #define _E_TASKS_H_ +#include <bonobo/bonobo-ui-component.h> #include <gtk/gtktable.h> #include <cal-client/cal-client.h> #include "e-calendar-table.h" @@ -79,8 +80,4 @@ void e_tasks_discard_view_menus (ETasks *tasks); ECalendarTable *e_tasks_get_calendar_table (ETasks *tasks); -/* This updates all the preference settings for all the ETasks widgets in use. - */ -void e_tasks_update_all_config_settings (void); - #endif /* _E_TASKS_H_ */ diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index df1f01c5fc..502a5ca0f5 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -1648,7 +1648,6 @@ e_week_view_set_compress_weekend (EWeekView *week_view, gtk_widget_queue_draw (week_view->main_canvas); } - /* Whether we display event end times. */ gboolean e_week_view_get_show_event_end_times (EWeekView *week_view) diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index f1925ad365..359de9c209 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1039,9 +1039,6 @@ setup_widgets (GnomeCalendar *gcal) gtk_widget_show (GTK_WIDGET (priv->views[i])); } - - - gnome_calendar_update_config_settings (gcal, TRUE); } /* Object initialization function for the gnome calendar */ @@ -2332,26 +2329,6 @@ gnome_calendar_set_default_uri (GnomeCalendar *gcal, const char *uri) return TRUE; } -/* Tells the calendar to reload all config settings. - If initializing is TRUE it sets the pane positions as well. (We don't - want to reset the pane positions after the user clicks 'Apply' in the - preferences dialog.) */ -void -gnome_calendar_update_config_settings (GnomeCalendar *gcal, - gboolean initializing) -{ - GnomeCalendarPrivate *priv; - - g_return_if_fail (GNOME_IS_CALENDAR (gcal)); - - priv = gcal->priv; - - /* The range of days shown may have changed, so we update the date - navigator if needed. */ - gnome_calendar_update_date_navigator (gcal); - gnome_calendar_notify_dates_shown_changed (gcal); -} - void gnome_calendar_set_selected_time_range (GnomeCalendar *gcal, time_t start_time, diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index 42e4623477..748be4dc0c 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -169,11 +169,6 @@ gint gnome_calendar_get_num_events_selected (GnomeCalendar *gcal); /* Returns the number of selected tasks */ gint gnome_calendar_get_num_tasks_selected (GnomeCalendar *gcal); -/* Tells the calendar to reload all config settings. initializing should be - TRUE when we are setting the config settings for the first time. */ -void gnome_calendar_update_config_settings (GnomeCalendar *gcal, - gboolean initializing); - /* Get the current timezone. */ icaltimezone *gnome_calendar_get_timezone (GnomeCalendar *gcal); diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index bb9d0fe46f..a6b7062b9c 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -118,13 +118,13 @@ update_uris_for_selection (ESourceSelector *selector, TasksComponent *component) ESource *old_selected_source = l->data; if (!is_in_selection (selection, old_selected_source)) - remove_uri_for_source (old_selected_source, priv->tasks); + remove_uri_for_source (old_selected_source, E_TASKS (priv->tasks)); } for (l = selection; l; l = l->next) { ESource *selected_source = l->data; - add_uri_for_source (selected_source, priv->tasks); + add_uri_for_source (selected_source, E_TASKS (priv->tasks)); } e_source_selector_free_selection (priv->source_selection); |