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
This commit is contained in:
JP Rosevear
2003-10-29 15:41:47 +00:00
committed by JP Rosevear
parent 6c743503b1
commit 26f77b16e1
13 changed files with 144 additions and 201 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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 ();
}

View File

@ -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);
}
}

View File

@ -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_ */

View File

@ -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)

View File

@ -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,

View File

@ -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);

View File

@ -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);