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:
@ -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
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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 ();
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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_ */
|
||||
|
||||
@ -1648,7 +1648,6 @@ e_week_view_set_compress_weekend (EWeekView *week_view,
|
||||
gtk_widget_queue_draw (week_view->main_canvas);
|
||||
}
|
||||
|
||||
| ||||