aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-08 09:43:09 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-09 09:03:18 +0800
commit3b0699fc304d0f4aecb261d19869de221f5d6abf (patch)
treeeb434f85371c9d5ae75a8425fc622c31e08baa5b
parent65695ae516532a4b6e129a0703b1056a3996de0c (diff)
downloadgsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar
gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar.gz
gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar.bz2
gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar.lz
gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar.xz
gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.tar.zst
gsoc2013-evolution-3b0699fc304d0f4aecb261d19869de221f5d6abf.zip
More refactoring of settings management.
-rw-r--r--calendar/gui/calendar-config.c64
-rw-r--r--calendar/gui/calendar-config.h8
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c52
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h1
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c2
-rw-r--r--calendar/gui/dialogs/event-editor.c41
-rw-r--r--calendar/gui/dialogs/recurrence-page.c2
-rw-r--r--calendar/gui/dialogs/schedule-page.c18
-rw-r--r--calendar/gui/dialogs/task-editor.c41
-rw-r--r--calendar/gui/e-cal-model.c13
-rw-r--r--calendar/gui/e-calendar-table.c11
-rw-r--r--calendar/gui/e-meeting-list-view.c2
-rw-r--r--calendar/gui/e-meeting-store.c252
-rw-r--r--calendar/gui/e-meeting-store.h134
-rw-r--r--calendar/gui/e-meeting-time-sel.c367
-rw-r--r--calendar/gui/e-meeting-time-sel.h72
-rw-r--r--calendar/gui/e-memo-table.c6
-rw-r--r--calendar/gui/e-memos.c381
-rw-r--r--calendar/gui/e-memos.h81
-rw-r--r--calendar/gui/e-tasks.c724
-rw-r--r--calendar/gui/e-tasks.h76
-rw-r--r--calendar/gui/e-timezone-entry.c450
-rw-r--r--calendar/gui/e-timezone-entry.h63
-rw-r--r--calendar/gui/gnome-cal.c12
-rw-r--r--calendar/gui/memos-component.c418
-rw-r--r--calendar/gui/memos-component.h57
-rw-r--r--calendar/gui/tasks-component.c801
-rw-r--r--calendar/gui/tasks-component.h55
-rw-r--r--calendar/gui/tasks-control.c333
-rw-r--r--calendar/gui/tasks-control.h35
-rw-r--r--modules/calendar/e-cal-shell-settings.c18
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c3
-rw-r--r--modules/calendar/e-memo-shell-content.c17
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c50
-rw-r--r--modules/calendar/e-memo-shell-sidebar.h2
-rw-r--r--modules/calendar/e-memo-shell-view-private.c37
-rw-r--r--modules/calendar/e-memo-shell-view-private.h2
-rw-r--r--modules/calendar/e-task-shell-content.c8
-rw-r--r--modules/calendar/e-task-shell-view-private.c5
-rw-r--r--plugins/startup-wizard/startup-wizard.c3
40 files changed, 1060 insertions, 3657 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 4099f5fd4b..5ebd7e93e0 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -151,10 +151,15 @@ calendar_config_add_notification_calendars_selected (GConfClientNotifyFunc func,
return id;
}
-/* The current timezone, e.g. "Europe/London". It may be NULL, in which case
- you should assume UTC (though Evolution will show the timezone-setting
- dialog the next time a calendar or task folder is selected). */
-gchar *
+static gchar *
+calendar_config_get_timezone_stored (void)
+{
+ calendar_config_init ();
+
+ return gconf_client_get_string (config, CALENDAR_CONFIG_TIMEZONE, NULL);
+}
+
+static gchar *
calendar_config_get_timezone (void)
{
EShell *shell;
@@ -173,14 +178,6 @@ calendar_config_get_timezone (void)
return calendar_config_get_timezone_stored ();
}
-gchar *
-calendar_config_get_timezone_stored (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_string (config, CALENDAR_CONFIG_TIMEZONE, NULL);
-}
-
icaltimezone *
calendar_config_get_icaltimezone (void)
{
@@ -198,19 +195,6 @@ calendar_config_get_icaltimezone (void)
return zone;
}
-/* Sets the timezone. If set to NULL it defaults to UTC.
- FIXME: Should check it is being set to a valid timezone. */
-void
-calendar_config_set_timezone (const gchar *timezone)
-{
- calendar_config_init ();
-
- if (timezone && timezone[0])
- gconf_client_set_string (config, CALENDAR_CONFIG_TIMEZONE, timezone, NULL);
- else
- gconf_client_set_string (config, CALENDAR_CONFIG_TIMEZONE, "UTC", NULL);
-}
-
/* Whether we use 24-hour format or 12-hour format (AM/PM). */
gboolean
calendar_config_get_24_hour_format (void)
@@ -862,36 +846,6 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed)
return sexp;
}
-gchar *
-calendar_config_get_free_busy_template (void)
-{
- calendar_config_init ();
-
- return gconf_client_get_string (config, CALENDAR_CONFIG_TEMPLATE, NULL);
-}
-
-void
-calendar_config_set_free_busy_template (const gchar *template)
-{
- calendar_config_init ();
-
- gconf_client_set_string (config, CALENDAR_CONFIG_TEMPLATE, template, NULL);
-}
-
-guint
-calendar_config_add_notification_free_busy_template (GConfClientNotifyFunc func,
- gpointer data)
-{
- guint id;
-
- calendar_config_init ();
-
- id = gconf_client_notify_add (config, CALENDAR_CONFIG_TEMPLATE, func, data,
- NULL, NULL);
-
- return id;
-}
-
void
calendar_config_set_dir_path (const gchar *path)
{
diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h
index 9a8a1dc2f8..d0b2598892 100644
--- a/calendar/gui/calendar-config.h
+++ b/calendar/gui/calendar-config.h
@@ -67,10 +67,7 @@ void calendar_config_set_calendars_selected (GSList *selected);
guint calendar_config_add_notification_calendars_selected (GConfClientNotifyFunc func, gpointer data);
/* The current timezone, e.g. "Europe/London". */
-gchar * calendar_config_get_timezone (void);
-gchar * calendar_config_get_timezone_stored (void);
icaltimezone *calendar_config_get_icaltimezone (void);
-void calendar_config_set_timezone (const gchar *timezone);
/* The working days of the week, a bit-wise combination of flags. */
CalWeekdays calendar_config_get_working_days (void);
@@ -161,11 +158,6 @@ void calendar_config_set_default_reminder_units (CalUnits units);
GSList * calendar_config_get_free_busy (void);
void calendar_config_set_free_busy (GSList * url_list);
-gchar *calendar_config_get_free_busy_template (void);
-void calendar_config_set_free_busy_template (const gchar *template);
-guint calendar_config_add_notification_free_busy_template (GConfClientNotifyFunc func,
- gpointer data);
-
/* Returns TRUE if the locale has 'am' and 'pm' strings defined, i.e. it
supports 12-hour time format. */
gboolean calendar_config_locale_supports_12_hour_format(void);
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index 5c56d69007..8f22c98569 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -95,16 +95,6 @@ eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
}
static void
-timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
-{
- icaltimezone *zone;
-
- zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (prefs->timezone));
-
- calendar_config_set_timezone (icaltimezone_get_location (zone));
-}
-
-static void
update_day_second_zone_caption (CalendarPrefsDialog *prefs)
{
gchar *location;
@@ -402,12 +392,6 @@ alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs)
}
static void
-template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs)
-{
- calendar_config_set_free_busy_template (gtk_entry_get_text (entry));
-}
-
-static void
update_system_tz_widgets (EShellSettings *shell_settings,
GParamSpec *pspec,
CalendarPrefsDialog *prefs)
@@ -427,7 +411,6 @@ update_system_tz_widgets (EShellSettings *shell_settings,
static void
setup_changes (CalendarPrefsDialog *prefs)
{
- g_signal_connect (G_OBJECT (prefs->timezone), "changed", G_CALLBACK (timezone_changed), prefs);
g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs);
g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs);
@@ -455,20 +438,6 @@ setup_changes (CalendarPrefsDialog *prefs)
g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs);
g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs);
-
- g_signal_connect (G_OBJECT (prefs->template_url), "changed", G_CALLBACK (template_url_changed), prefs);
-}
-
-/* Shows the current Free/Busy settings in the dialog */
-static void
-show_fb_config (CalendarPrefsDialog *prefs)
-{
- gchar *template_url;
-
- template_url = calendar_config_get_free_busy_template ();
- gtk_entry_set_text (GTK_ENTRY (prefs->template_url), (template_url ? template_url : ""));
-
- g_free (template_url);
}
/* Shows the current task list settings in the dialog */
@@ -538,16 +507,9 @@ show_config (CalendarPrefsDialog *prefs)
gint mask, day, time_divisions;
icaltimezone *zone;
gboolean sensitive, set = FALSE;
- gchar *location;
CalUnits units;
gint interval;
- /* Timezone. */
- location = calendar_config_get_timezone_stored ();
- zone = icaltimezone_get_builtin_timezone (location);
- e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (prefs->timezone), zone);
- g_free (location);
-
/* Day's second zone */
update_day_second_zone_caption (prefs);
@@ -573,9 +535,6 @@ show_config (CalendarPrefsDialog *prefs)
/* Alarms list*/
show_alarms_config (prefs);
- /* Free/Busy */
- show_fb_config (prefs);
-
/* Other page */
e_dialog_toggle_set (prefs->default_reminder, calendar_config_get_use_default_reminder ());
e_dialog_spin_set (prefs->default_reminder_interval, calendar_config_get_default_reminder_interval ());
@@ -662,13 +621,15 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
G_CALLBACK (update_system_tz_widgets), prefs);
widget = glade_xml_get_widget (gui, "timezone");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-timezone",
+ G_OBJECT (widget), "timezone");
e_mutual_binding_new_with_negation (
G_OBJECT (shell_settings), "cal-use-system-timezone",
G_OBJECT (widget), "sensitive");
/* General tab */
prefs->system_tz_label = glade_xml_get_widget (gui, "system-tz-label");
- prefs->timezone = glade_xml_get_widget (gui, "timezone");
prefs->day_second_zone = glade_xml_get_widget (gui, "day_second_zone");
widget = glade_xml_get_widget (gui, "sun_button");
@@ -764,7 +725,7 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
widget = glade_xml_get_widget (gui, "dnav_show_week_no");
e_mutual_binding_new (
- G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers",
+ G_OBJECT (shell_settings), "cal-show-week-numbers",
G_OBJECT (widget), "active");
widget = glade_xml_get_widget (gui, "dview_show_week_no");
@@ -799,7 +760,10 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
prefs->scrolled_window = glade_xml_get_widget (gui, "calendar-source-scrolled-window");
/* Free/Busy tab */
- prefs->template_url = glade_xml_get_widget (gui, "template_url");
+ widget = glade_xml_get_widget (gui, "template_url");
+ e_mutual_binding_new (
+ G_OBJECT (shell_settings), "cal-free-busy-template",
+ G_OBJECT (widget), "text");
target = e_cal_config_target_new_prefs (ec, prefs->gconf);
e_config_set_target ((EConfig *)ec, (EConfigTarget *) target);
toplevel = e_config_create_widget ((EConfig *)ec);
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
index 5d0a3716a6..ceaa379474 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -63,7 +63,6 @@ struct _CalendarPrefsDialog {
/* General tab */
GtkWidget *system_tz_label;
- GtkWidget *timezone;
GtkWidget *day_second_zone;
GtkWidget *working_days[7];
GtkWidget *week_start_day;
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index cfe4139708..697e8bda7f 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -239,7 +239,7 @@ comp_editor_new_date_edit (EShellSettings *shell_settings,
#endif
e_binding_new (
- G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers",
+ G_OBJECT (shell_settings), "cal-show-week-numbers",
G_OBJECT (dedit), "show-week-numbers");
e_binding_new (
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index e7d602c335..94006a961c 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -248,15 +248,6 @@ static GtkActionEntry meeting_entries[] = {
};
static void
-event_editor_client_changed_cb (EventEditor *ee)
-{
- ECal *client;
-
- client = comp_editor_get_client (COMP_EDITOR (ee));
- e_meeting_store_set_e_cal (ee->priv->model, client);
-}
-
-static void
event_editor_model_changed_cb (EventEditor *ee)
{
if (!ee->priv->updating) {
@@ -369,6 +360,31 @@ event_editor_dispose (GObject *object)
}
static void
+event_editor_constructed (GObject *object)
+{
+ EventEditorPrivate *priv;
+ EShellSettings *shell_settings;
+ EShell *shell;
+
+ priv = EVENT_EDITOR_GET_PRIVATE (object);
+
+ shell = comp_editor_get_shell (COMP_EDITOR (object));
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ e_binding_new (
+ G_OBJECT (object), "client",
+ G_OBJECT (priv->model), "client");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-free-busy-template",
+ G_OBJECT (priv->model), "free-busy-template");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-timezone",
+ G_OBJECT (priv->model), "timezone");
+}
+
+static void
event_editor_show_categories (CompEditor *editor,
gboolean visible)
{
@@ -445,6 +461,7 @@ event_editor_class_init (EventEditorClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->constructor = event_editor_constructor;
object_class->dispose = event_editor_dispose;
+ object_class->constructed = event_editor_constructed;
editor_class = COMP_EDITOR_CLASS (class);
editor_class->help_section = "usage-calendar-apts";
@@ -502,10 +519,6 @@ event_editor_init (EventEditor *ee)
action = comp_editor_get_action (editor, "send-options");
gtk_action_set_visible (action, FALSE);
- g_signal_connect (
- ee, "notify::client",
- G_CALLBACK (event_editor_client_changed_cb), NULL);
-
g_signal_connect_swapped (
ee->priv->model, "row_changed",
G_CALLBACK (event_editor_model_changed_cb), ee);
@@ -640,7 +653,7 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboo
ECal *client;
gboolean result;
- client = e_meeting_store_get_e_cal (priv->model);
+ client = e_meeting_store_get_client (priv->model);
result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
client, NULL, NULL, NULL, strip_alarms);
g_object_unref (comp);
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 66f21522b5..bd9152afc7 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -2260,7 +2260,7 @@ init_widgets (RecurrencePage *rpage)
ecal = E_CALENDAR (priv->preview_calendar);
e_binding_new (
- G_OBJECT (shell_settings), "cal-date-navigator-show-week-numbers",
+ G_OBJECT (shell_settings), "cal-show-week-numbers",
G_OBJECT (ecal->calitem), "show-week-numbers");
e_binding_new (
diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c
index 712d2708b9..979e182a8c 100644
--- a/calendar/gui/dialogs/schedule-page.c
+++ b/calendar/gui/dialogs/schedule-page.c
@@ -218,7 +218,7 @@ update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalCompone
if (start_zone != end_zone) {
icaltimezone_convert_time (&end_tt, end_zone, start_zone);
}
- e_meeting_store_set_zone (priv->model, priv->zone);
+ e_meeting_store_set_timezone (priv->model, priv->zone);
all_day = (start_tt.is_date && end_tt.is_date) ? TRUE : FALSE;
@@ -385,10 +385,14 @@ SchedulePage *
schedule_page_construct (SchedulePage *spage, EMeetingStore *ems)
{
SchedulePagePrivate *priv = spage->priv;
+ EShellSettings *shell_settings;
+ EShell *shell;
CompEditor *editor;
gchar *gladefile;
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage));
+ shell = comp_editor_get_shell (editor);
+ shell_settings = e_shell_get_shell_settings (shell);
gladefile = g_build_filename (EVOLUTION_GLADEDIR,
"schedule-page.glade",
@@ -423,6 +427,18 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems)
gtk_widget_show (GTK_WIDGET (priv->sel));
gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->sel), TRUE, TRUE, 6);
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-show-week-numbers",
+ G_OBJECT (priv->sel), "show-week-numbers");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-use-24-hour-format",
+ G_OBJECT (priv->sel), "use-24-hour-format");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-week-start-day",
+ G_OBJECT (priv->sel), "week-start-day");
+
if (!init_widgets (spage)) {
g_message ("schedule_page_construct(): "
"Could not initialize the widgets!");
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 2829def666..a309a51d91 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -126,15 +126,6 @@ static GtkActionEntry assigned_task_entries[] = {
};
static void
-task_editor_client_changed_cb (TaskEditor *te)
-{
- ECal *client;
-
- client = comp_editor_get_client (COMP_EDITOR (te));
- e_meeting_store_set_e_cal (te->priv->model, client);
-}
-
-static void
task_editor_model_changed_cb (TaskEditor *te)
{
if (!te->priv->updating) {
@@ -208,6 +199,31 @@ task_editor_dispose (GObject *object)
}
static void
+task_editor_constructed (GObject *object)
+{
+ TaskEditorPrivate *priv;
+ EShellSettings *shell_settings;
+ EShell *shell;
+
+ priv = TASK_EDITOR_GET_PRIVATE (object);
+
+ shell = comp_editor_get_shell (COMP_EDITOR (object));
+ shell_settings = e_shell_get_shell_settings (shell);
+
+ e_binding_new (
+ G_OBJECT (object), "client",
+ G_OBJECT (priv->model), "client");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-free-busy-template",
+ G_OBJECT (priv->model), "free-busy-template");
+
+ e_binding_new (
+ G_OBJECT (shell_settings), "cal-timezone",
+ G_OBJECT (priv->model), "timezone");
+}
+
+static void
task_editor_show_categories (CompEditor *editor,
gboolean visible)
{
@@ -284,6 +300,7 @@ task_editor_class_init (TaskEditorClass *class)
object_class = G_OBJECT_CLASS (class);
object_class->constructor = task_editor_constructor;
object_class->dispose = task_editor_dispose;
+ object_class->constructed = task_editor_constructed;
editor_class = COMP_EDITOR_CLASS (class);
editor_class->help_section = "usage-calendar-todo";
@@ -356,10 +373,6 @@ task_editor_init (TaskEditor *te)
g_error_free (error);
}
- g_signal_connect (
- te, "notify::client",
- G_CALLBACK (task_editor_client_changed_cb), NULL);
-
g_signal_connect_swapped (
te->priv->model, "row_changed",
G_CALLBACK (task_editor_model_changed_cb), te);
@@ -465,7 +478,7 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gbool
ECal *client;
gboolean result;
- client = e_meeting_store_get_e_cal (priv->model);
+ client = e_meeting_store_get_client (priv->model);
result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp,
client, NULL, NULL, NULL, strip_alarms);
g_object_unref (comp);
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index cbe3326760..d5a922625f 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -35,7 +35,6 @@
#include "e-cal-model.h"
#include "itip-utils.h"
#include "misc.h"
-#include "calendar-config.h"
#include "e-util/e-binding.h"
#include "e-util/e-util.h"
@@ -1600,14 +1599,16 @@ add_instance_cb (ECalComponent *comp, time_t instance_start, time_t instance_end
return TRUE;
}
-/* We do this check since the calendar items are downloaded from the server in the open_method,
- since the default timezone might not be set there */
+/* We do this check since the calendar items are downloaded from the server
+ * in the open_method, since the default timezone might not be set there. */
static void
-ensure_dates_are_in_default_zone (icalcomponent *icalcomp)
+ensure_dates_are_in_default_zone (ECalModel *model,
+ icalcomponent *icalcomp)
{
icaltimetype dt;
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ icaltimezone *zone;
+ zone = e_cal_model_get_timezone (model);
if (!zone)
return;
@@ -1670,7 +1671,7 @@ e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer user_data
e_cal_component_free_id (id);
g_object_unref (comp);
- ensure_dates_are_in_default_zone (l->data);
+ ensure_dates_are_in_default_zone (model, l->data);
if (e_cal_util_component_has_recurrences (l->data) && (priv->flags & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES)) {
RecurrenceExpansionData rdata;
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 755dfebec0..a61477d081 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -287,6 +287,7 @@ calendar_table_query_tooltip_cb (ECalendarTable *cal_table,
GString *tmp2;
gchar buff[1001];
gboolean free_text = FALSE;
+ gboolean use_24_hour_format;
ECalComponent *new_comp;
ECalComponentOrganizer organizer;
ECalComponentDateTime dtstart, dtdue;
@@ -385,6 +386,7 @@ calendar_table_query_tooltip_cb (ECalendarTable *cal_table,
e_cal_component_get_due (new_comp, &dtdue);
default_zone = e_cal_model_get_timezone (model);
+ use_24_hour_format = e_cal_model_get_use_24_hour_format (model);
if (dtstart.tzid) {
zone = icalcomponent_get_timezone (e_cal_component_get_icalcomponent (new_comp), dtstart.tzid);
@@ -405,7 +407,7 @@ calendar_table_query_tooltip_cb (ECalendarTable *cal_table,
tmp_tm = icaltimetype_to_tm_with_zone (
dtstart.value, zone, default_zone);
e_time_format_date_and_time (
- &tmp_tm, calendar_config_get_24_hour_format (),
+ &tmp_tm, use_24_hour_format,
FALSE, FALSE, buff, 1000);
if (buff [0]) {
@@ -420,7 +422,7 @@ calendar_table_query_tooltip_cb (ECalendarTable *cal_table,
tmp_tm = icaltimetype_to_tm_with_zone (
dtdue.value, zone, default_zone);
e_time_format_date_and_time (
- &tmp_tm, calendar_config_get_24_hour_format (),
+ &tmp_tm, use_24_hour_format,
FALSE, FALSE, buff, 1000);
if (buff [0]) {
@@ -1614,12 +1616,15 @@ e_calendar_table_save_state (ECalendarTable *cal_table,
static struct tm
e_calendar_table_get_current_time (ECellDateEdit *ecde, gpointer data)
{
+ ECalendarTable *cal_table = data;
+ ECalModel *model;
icaltimezone *zone;
struct tm tmp_tm = { 0 };
struct icaltimetype tt;
/* Get the current timezone. */
- zone = calendar_config_get_icaltimezone ();
+ model = e_calendar_table_get_model (cal_table);
+ zone = e_cal_model_get_timezone (model);
tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index 276c31ab01..32aa1d3a0e 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -827,7 +827,7 @@ process_section (EMeetingListView *view, GList *destinations, icalparameter_role
name = e_destination_get_name (dest);
/* Get the field as attendee from the backend */
- if (e_cal_get_ldap_attribute (e_meeting_store_get_e_cal (priv->store),
+ if (e_cal_get_ldap_attribute (e_meeting_store_get_client (priv->store),
&attr, NULL)) {
/* FIXME this should be more general */
if (!g_ascii_strcasecmp (attr, "icscalendar")) {
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index 20bc6388da..8b9f02c5a5 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -31,13 +31,17 @@
#include <libecal/e-cal-util.h>
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-data-server-util.h>
-#include "calendar-config.h"
#include "itip-utils.h"
#include "e-meeting-utils.h"
#include "e-meeting-attendee.h"
#include "e-meeting-store.h"
-#define ROW_VALID(store, row) (row >= 0 && row < store->priv->attendees->len)
+#define ROW_VALID(store, row) \
+ (row >= 0 && row < store->priv->attendees->len)
+
+#define E_MEETING_STORE_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEETING_STORE, EMeetingStorePrivate))
struct _EMeetingStorePrivate {
GPtrArray *attendees;
@@ -76,7 +80,14 @@ struct _EMeetingStoreQueueData {
GPtrArray *data;
};
-static GObjectClass *parent_class = NULL;
+enum {
+ PROP_0,
+ PROP_CLIENT,
+ PROP_FREE_BUSY_TEMPLATE,
+ PROP_TIMEZONE
+};
+
+static gpointer parent_class;
static icalparameter_cutype
text_to_type (const gchar *type)
@@ -523,13 +534,73 @@ refresh_queue_remove (EMeetingStore *store, EMeetingAttendee *attendee)
}
static void
-ems_finalize (GObject *obj)
+meeting_store_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CLIENT:
+ e_meeting_store_set_client (
+ E_MEETING_STORE (object),
+ g_value_get_object (value));
+ return;
+
+ case PROP_FREE_BUSY_TEMPLATE:
+ e_meeting_store_set_free_busy_template (
+ E_MEETING_STORE (object),
+ g_value_get_string (value));
+ return;
+
+ case PROP_TIMEZONE:
+ e_meeting_store_set_timezone (
+ E_MEETING_STORE (object),
+ g_value_get_pointer (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+meeting_store_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_CLIENT:
+ g_value_set_object (
+ value,
+ e_meeting_store_get_client (
+ E_MEETING_STORE (object)));
+ return;
+
+ case PROP_FREE_BUSY_TEMPLATE:
+ g_value_set_string (
+ value,
+ e_meeting_store_get_free_busy_template (
+ E_MEETING_STORE (object)));
+ return;
+
+ case PROP_TIMEZONE:
+ g_value_set_pointer (
+ value,
+ e_meeting_store_get_timezone (
+ E_MEETING_STORE (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+meeting_store_finalize (GObject *object)
{
- EMeetingStore *store = E_MEETING_STORE (obj);
EMeetingStorePrivate *priv;
gint i;
- priv = store->priv;
+ priv = E_MEETING_STORE_GET_PRIVATE (object);
for (i = 0; i < priv->attendees->len; i++)
g_object_unref (g_ptr_array_index (priv->attendees, i));
@@ -539,7 +610,9 @@ ems_finalize (GObject *obj)
g_object_unref (priv->client);
while (priv->refresh_queue->len > 0)
- refresh_queue_remove (store, g_ptr_array_index (priv->refresh_queue, 0));
+ refresh_queue_remove (
+ E_MEETING_STORE (object),
+ g_ptr_array_index (priv->refresh_queue, 0));
g_ptr_array_free (priv->refresh_queue, TRUE);
g_hash_table_destroy (priv->refresh_data);
@@ -550,75 +623,100 @@ ems_finalize (GObject *obj)
g_mutex_free (priv->mutex);
- g_free (priv);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (obj);
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
-ems_class_init (GObjectClass *klass)
+meeting_store_class_init (GObjectClass *class)
{
- parent_class = g_type_class_peek_parent (klass);
-
- klass->finalize = ems_finalize;
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (class);
+ g_type_class_add_private (class, sizeof (EMeetingStorePrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = meeting_store_set_property;
+ object_class->get_property = meeting_store_get_property;
+ object_class->finalize = meeting_store_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_CLIENT,
+ g_param_spec_object (
+ "client",
+ "Client",
+ NULL,
+ E_TYPE_CAL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FREE_BUSY_TEMPLATE,
+ g_param_spec_string (
+ "free-busy-template",
+ "Free/Busy Template",
+ NULL,
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TIMEZONE,
+ g_param_spec_pointer (
+ "timezone",
+ "Timezone",
+ NULL,
+ G_PARAM_READWRITE));
}
static void
-ems_init (EMeetingStore *store)
+meeting_store_init (EMeetingStore *store)
{
- EMeetingStorePrivate *priv;
-
- priv = g_new0 (EMeetingStorePrivate, 1);
-
- store->priv = priv;
-
- priv->attendees = g_ptr_array_new ();
-
- priv->zone = calendar_config_get_icaltimezone ();
+ store->priv = E_MEETING_STORE_GET_PRIVATE (store);
- priv->fb_uri = calendar_config_get_free_busy_template ();
+ store->priv->attendees = g_ptr_array_new ();
+ store->priv->refresh_queue = g_ptr_array_new ();
+ store->priv->refresh_data = g_hash_table_new (g_str_hash, g_str_equal);
- priv->refresh_queue = g_ptr_array_new ();
- priv->refresh_data = g_hash_table_new (g_str_hash, g_str_equal);
+ store->priv->mutex = g_mutex_new ();
- priv->mutex = g_mutex_new ();
-
- priv->num_queries = 0;
+ store->priv->num_queries = 0;
}
GType
e_meeting_store_get_type (void)
{
- static GType ems_type = 0;
-
- if (!ems_type) {
- static const GTypeInfo ems_info = {
- sizeof (EMeetingStoreClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) ems_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMeetingStore),
- 0,
- (GInstanceInitFunc) ems_init };
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMeetingStoreClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) meeting_store_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMeetingStore),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) meeting_store_init,
+ NULL /* value_table */
+ };
static const GInterfaceInfo tree_model_info = {
- (GInterfaceInitFunc) ems_tree_model_init,
- NULL,
- NULL };
+ (GInterfaceInitFunc) ems_tree_model_init,
+ NULL,
+ NULL
+ };
- ems_type = g_type_register_static (GTK_TYPE_LIST_STORE,
- "EMeetingStore",
- &ems_info, 0);
+ type = g_type_register_static (
+ GTK_TYPE_LIST_STORE, "EMeetingStore", &type_info, 0);
- g_type_add_interface_static (ems_type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
+ g_type_add_interface_static (
+ type, GTK_TYPE_TREE_MODEL, &tree_model_info);
}
- return ems_type;
+ return type;
}
GObject *
@@ -628,53 +726,69 @@ e_meeting_store_new (void)
}
ECal *
-e_meeting_store_get_e_cal (EMeetingStore *store)
+e_meeting_store_get_client (EMeetingStore *store)
{
+ g_return_val_if_fail (E_IS_MEETING_STORE (store), NULL);
+
return store->priv->client;
}
void
-e_meeting_store_set_e_cal (EMeetingStore *store, ECal *client)
+e_meeting_store_set_client (EMeetingStore *store,
+ ECal *client)
{
+ g_return_if_fail (E_IS_MEETING_STORE (store));
+
+ if (client != NULL) {
+ g_return_if_fail (E_IS_CAL (client));
+ g_object_ref (client);
+ }
+
if (store->priv->client != NULL)
g_object_unref (store->priv->client);
- if (client != NULL)
- g_object_ref (client);
store->priv->client = client;
+
+ g_object_notify (G_OBJECT (store), "client");
}
-icaltimezone *
-e_meeting_store_get_zone (EMeetingStore *store)
+const gchar *
+e_meeting_store_get_free_busy_template (EMeetingStore *store)
{
g_return_val_if_fail (E_IS_MEETING_STORE (store), NULL);
- return store->priv->zone;
+ return store->priv->fb_uri;
}
void
-e_meeting_store_set_zone (EMeetingStore *store, icaltimezone *zone)
+e_meeting_store_set_free_busy_template (EMeetingStore *store,
+ const gchar *free_busy_template)
{
g_return_if_fail (E_IS_MEETING_STORE (store));
- store->priv->zone = zone;
+ g_free (store->priv->fb_uri);
+ store->priv->fb_uri = g_strdup (free_busy_template);
+
+ g_object_notify (G_OBJECT (store), "free-busy-template");
}
-gchar *
-e_meeting_store_get_fb_uri (EMeetingStore *store)
+icaltimezone *
+e_meeting_store_get_timezone (EMeetingStore *store)
{
g_return_val_if_fail (E_IS_MEETING_STORE (store), NULL);
- return g_strdup (store->priv->fb_uri);
+ return store->priv->zone;
}
void
-e_meeting_store_set_fb_uri (EMeetingStore *store, const gchar *fb_uri)
+e_meeting_store_set_timezone (EMeetingStore *store,
+ icaltimezone *timezone)
{
g_return_if_fail (E_IS_MEETING_STORE (store));
- g_free (store->priv->fb_uri);
- store->priv->fb_uri = g_strdup (fb_uri);
+ store->priv->zone = timezone;
+
+ g_object_notify (G_OBJECT (store), "timezone");
}
static void
diff --git a/calendar/gui/e-meeting-store.h b/calendar/gui/e-meeting-store.h
index f67ad92ddd..62287a7b7e 100644
--- a/calendar/gui/e-meeting-store.h
+++ b/calendar/gui/e-meeting-store.h
@@ -20,24 +20,37 @@
*
*/
-#ifndef _E_MEETING_STORE_H_
-#define _E_MEETING_STORE_H_
+#ifndef E_MEETING_STORE_H
+#define E_MEETING_STORE_H
#include <gtk/gtk.h>
#include <libecal/e-cal.h>
#include "e-meeting-attendee.h"
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_MEETING_STORE \
+ (e_meeting_store_get_type ())
+#define E_MEETING_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEETING_STORE, EMeetingStore))
+#define E_MEETING_STORE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEETING_STORE, EMeetingStoreClass))
+#define E_IS_MEETING_STORE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEETING_STORE))
+#define E_IS_MEETING_STORE_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((obj), E_TYPE_MEETING_STORE))
+#define E_MEETING_STORE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEETING_STORE, EMeetingStoreClass))
-#define E_TYPE_MEETING_STORE (e_meeting_store_get_type ())
-#define E_MEETING_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MEETING_STORE, EMeetingStore))
-#define E_MEETING_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MEETING_STORE, EMeetingStoreClass))
-#define E_IS_MEETING_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MEETING_STORE))
-#define E_IS_MEETING_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MEETING_STORE))
+G_BEGIN_DECLS
-typedef struct _EMeetingStore EMeetingStore;
+typedef struct _EMeetingStore EMeetingStore;
+typedef struct _EMeetingStoreClass EMeetingStoreClass;
typedef struct _EMeetingStorePrivate EMeetingStorePrivate;
-typedef struct _EMeetingStoreClass EMeetingStoreClass;
typedef enum {
E_MEETING_STORE_ADDRESS_COL,
@@ -57,7 +70,6 @@ typedef enum {
struct _EMeetingStore {
GtkListStore parent;
-
EMeetingStorePrivate *priv;
};
@@ -65,48 +77,64 @@ struct _EMeetingStoreClass {
GtkListStoreClass parent_class;
};
-typedef gboolean (* EMeetingStoreRefreshCallback) (gpointer data);
-
-GType e_meeting_store_get_type (void);
-GObject *e_meeting_store_new (void);
-
-void e_meeting_store_set_value (EMeetingStore *im, gint row, gint col, const gchar *val);
-
-ECal *e_meeting_store_get_e_cal (EMeetingStore *im);
-void e_meeting_store_set_e_cal (EMeetingStore *im, ECal *client);
-
-icaltimezone *e_meeting_store_get_zone (EMeetingStore *im);
-void e_meeting_store_set_zone (EMeetingStore *im, icaltimezone *zone);
-
-gchar *e_meeting_store_get_fb_uri (EMeetingStore *im);
-void e_meeting_store_set_fb_uri (EMeetingStore *im, const gchar *fb_uri);
-
-void e_meeting_store_add_attendee (EMeetingStore *im, EMeetingAttendee *ia);
-EMeetingAttendee *e_meeting_store_add_attendee_with_defaults (EMeetingStore *im);
-
-void e_meeting_store_remove_attendee (EMeetingStore *im, EMeetingAttendee *ia);
-void e_meeting_store_remove_all_attendees (EMeetingStore *im);
-
-EMeetingAttendee *e_meeting_store_find_attendee (EMeetingStore *im, const gchar *address, gint *row);
-EMeetingAttendee *e_meeting_store_find_attendee_at_row (EMeetingStore *im, gint row);
-GtkTreePath *e_meeting_store_find_attendee_path (EMeetingStore *store, EMeetingAttendee *attendee);
-
-gint e_meeting_store_count_actual_attendees (EMeetingStore *im);
-const GPtrArray *e_meeting_store_get_attendees (EMeetingStore *im);
-
-void e_meeting_store_refresh_all_busy_periods (EMeetingStore *im,
- EMeetingTime *start,
- EMeetingTime *end,
- EMeetingStoreRefreshCallback call_back,
- gpointer data);
-void e_meeting_store_refresh_busy_periods (EMeetingStore *im,
- gint row,
- EMeetingTime *start,
- EMeetingTime *end,
- EMeetingStoreRefreshCallback call_back,
- gpointer data);
-
-guint e_meeting_store_get_num_queries (EMeetingStore *store);
+typedef gboolean (*EMeetingStoreRefreshCallback) (gpointer data);
+
+GType e_meeting_store_get_type (void);
+GObject * e_meeting_store_new (void);
+void e_meeting_store_set_value (EMeetingStore *meeting_store,
+ gint row,
+ gint col,
+ const gchar *val);
+ECal * e_meeting_store_get_client (EMeetingStore *meeting_store);
+void e_meeting_store_set_client (EMeetingStore *meeting_store,
+ ECal *client);
+const gchar * e_meeting_store_get_free_busy_template
+ (EMeetingStore *meeting_store);
+void e_meeting_store_set_free_busy_template
+ (EMeetingStore *meeting_store,
+ const gchar *free_busy_template);
+icaltimezone * e_meeting_store_get_timezone (EMeetingStore *meeting_store);
+void e_meeting_store_set_timezone (EMeetingStore *meeting_store,
+ icaltimezone *timezone);
+void e_meeting_store_add_attendee (EMeetingStore *meeting_store,
+ EMeetingAttendee *attendee);
+EMeetingAttendee *
+ e_meeting_store_add_attendee_with_defaults
+ (EMeetingStore *meeting_store);
+void e_meeting_store_remove_attendee (EMeetingStore *meeting_store,
+ EMeetingAttendee *attendee);
+void e_meeting_store_remove_all_attendees
+ (EMeetingStore *meeting_store);
+EMeetingAttendee *
+ e_meeting_store_find_attendee (EMeetingStore *meeting_store,
+ const gchar *address,
+ gint *row);
+EMeetingAttendee *
+ e_meeting_store_find_attendee_at_row
+ (EMeetingStore *meeting_store,
+ gint row);
+GtkTreePath * e_meeting_store_find_attendee_path
+ (EMeetingStore *meeting_store,
+ EMeetingAttendee *attendee);
+gint e_meeting_store_count_actual_attendees
+ (EMeetingStore *meeting_store);
+const GPtrArray *
+ e_meeting_store_get_attendees (EMeetingStore *meeting_store);
+void e_meeting_store_refresh_all_busy_periods
+ (EMeetingStore *meeting_store,
+ EMeetingTime *start,
+ EMeetingTime *end,
+ EMeetingStoreRefreshCallback call_back,
+ gpointer data);
+void e_meeting_store_refresh_busy_periods
+ (EMeetingStore *meeting_store,
+ gint row,
+ EMeetingTime *start,
+ EMeetingTime *end,
+ EMeetingStoreRefreshCallback call_back,
+ gpointer data);
+
+guint e_meeting_store_get_num_queries (EMeetingStore *meeting_store);
G_END_DECLS
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index 9ca98268e7..ea6fca83c9 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -39,14 +39,24 @@
#include "misc/e-canvas-utils.h"
#include "misc/e-dateedit.h"
+#include "e-util/e-binding.h"
#include "e-util/e-cursor.h"
#include "e-util/e-util.h"
-#include "calendar-config.h"
#include "e-meeting-utils.h"
#include "e-meeting-list-view.h"
#include "e-meeting-time-sel-item.h"
+#define E_MEETING_TIME_SELECTOR_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_MEETING_TIME_SELECTOR, EMeetingTimeSelectorPrivate))
+
+struct _EMeetingTimeSelectorPrivate {
+ gint week_start_day;
+ guint show_week_numbers : 1;
+ guint use_24_hour_format : 1;
+};
+
/* An array of hour strings for 24 hour time, "0:00" .. "23:00". */
const gchar *EMeetingTimeSelectorHours[24] = {
"0:00", "1:00", "2:00", "3:00", "4:00", "5:00", "6:00", "7:00",
@@ -75,15 +85,20 @@ const gchar *EMeetingTimeSelectorHours12[24] = {
/* This is the maximum scrolling speed. */
#define E_MEETING_TIME_SELECTOR_MAX_SCROLL_SPEED 4
-/* Signals */
+enum {
+ PROP_0,
+ PROP_SHOW_WEEK_NUMBERS,
+ PROP_USE_24_HOUR_FORMAT,
+ PROP_WEEK_START_DAY
+};
+
enum {
CHANGED,
LAST_SIGNAL
};
-static gint mts_signals [LAST_SIGNAL] = { 0 };
+static gint signals [LAST_SIGNAL] = { 0 };
-static void e_meeting_time_selector_destroy (GtkObject *object);
static void e_meeting_time_selector_alloc_named_color (EMeetingTimeSelector * mts,
const gchar *name, GdkColor *c);
static void e_meeting_time_selector_add_key_color (EMeetingTimeSelector * mts,
@@ -187,40 +202,179 @@ static void row_inserted_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter
static void row_changed_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data);
static void row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data);
-static void free_busy_template_changed_cb (GConfClient *client, guint cnxn_id,
- GConfEntry *entry, gpointer user_data);
+static void free_busy_template_changed_cb (EMeetingTimeSelector *mts);
G_DEFINE_TYPE (EMeetingTimeSelector, e_meeting_time_selector, GTK_TYPE_TABLE)
static void
-e_meeting_time_selector_class_init (EMeetingTimeSelectorClass * klass)
+meeting_time_selector_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHOW_WEEK_NUMBERS:
+ e_meeting_time_selector_set_show_week_numbers (
+ E_MEETING_TIME_SELECTOR (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_USE_24_HOUR_FORMAT:
+ e_meeting_time_selector_set_use_24_hour_format (
+ E_MEETING_TIME_SELECTOR (object),
+ g_value_get_boolean (value));
+ return;
+
+ case PROP_WEEK_START_DAY:
+ e_meeting_time_selector_set_week_start_day (
+ E_MEETING_TIME_SELECTOR (object),
+ g_value_get_int (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+meeting_time_selector_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_SHOW_WEEK_NUMBERS:
+ g_value_set_boolean (
+ value,
+ e_meeting_time_selector_get_show_week_numbers (
+ E_MEETING_TIME_SELECTOR (object)));
+ return;
+
+ case PROP_USE_24_HOUR_FORMAT:
+ g_value_set_boolean (
+ value,
+ e_meeting_time_selector_get_use_24_hour_format (
+ E_MEETING_TIME_SELECTOR (object)));
+ return;
+
+ case PROP_WEEK_START_DAY:
+ g_value_set_int (
+ value,
+ e_meeting_time_selector_get_week_start_day (
+ E_MEETING_TIME_SELECTOR (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+meeting_time_selector_destroy (GtkObject *object)
+{
+ EMeetingTimeSelector *mts;
+
+ mts = E_MEETING_TIME_SELECTOR (object);
+
+ e_meeting_time_selector_remove_timeout (mts);
+
+ if (mts->stipple) {
+ g_object_unref (mts->stipple);
+ mts->stipple = NULL;
+ }
+
+ if (mts->model) {
+ g_signal_handlers_disconnect_matched (
+ mts->model, G_SIGNAL_MATCH_DATA,
+ 0, 0, NULL, NULL, mts);
+ g_object_unref (mts->model);
+ mts->model = NULL;
+ }
+
+ mts->display_top = NULL;
+ mts->display_main = NULL;
+
+ if (mts->fb_refresh_not != 0) {
+ g_source_remove (mts->fb_refresh_not);
+ mts->fb_refresh_not = 0;
+ }
+
+ if (mts->style_change_idle_id != 0) {
+ g_source_remove (mts->style_change_idle_id);
+ mts->style_change_idle_id = 0;
+ }
+
+ if (GTK_OBJECT_CLASS (e_meeting_time_selector_parent_class)->destroy)
+ (*GTK_OBJECT_CLASS (e_meeting_time_selector_parent_class)->destroy)(object);
+}
+
+static void
+e_meeting_time_selector_class_init (EMeetingTimeSelectorClass * class)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
+ GtkObjectClass *gtk_object_class;
GtkWidgetClass *widget_class;
- object_class = (GtkObjectClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
+ g_type_class_add_private (class, sizeof (EMeetingTimeSelectorPrivate));
- mts_signals [CHANGED] =
- g_signal_new ("changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMeetingTimeSelectorClass, changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = meeting_time_selector_set_property;
+ object_class->get_property = meeting_time_selector_get_property;
- object_class->destroy = e_meeting_time_selector_destroy;
+ gtk_object_class = GTK_OBJECT_CLASS (class);
+ gtk_object_class->destroy = meeting_time_selector_destroy;
- widget_class->realize = e_meeting_time_selector_realize;
- widget_class->unrealize = e_meeting_time_selector_unrealize;
- widget_class->style_set = e_meeting_time_selector_style_set;
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->realize = e_meeting_time_selector_realize;
+ widget_class->unrealize = e_meeting_time_selector_unrealize;
+ widget_class->style_set = e_meeting_time_selector_style_set;
widget_class->expose_event = e_meeting_time_selector_expose_event;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_SHOW_WEEK_NUMBERS,
+ g_param_spec_boolean (
+ "show-week-numbers",
+ "Show Week Numbers",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_USE_24_HOUR_FORMAT,
+ g_param_spec_boolean (
+ "use-24-hour-format",
+ "Use 24-Hour Format",
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (
+ object_class,
+ PROP_WEEK_START_DAY,
+ g_param_spec_int (
+ "week-start-day",
+ "Week Start Day",
+ NULL,
+ 0, /* Monday */
+ 6, /* Sunday */
+ 0,
+ G_PARAM_READWRITE));
+
+ signals[CHANGED] = g_signal_new (
+ "changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (EMeetingTimeSelectorClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
e_meeting_time_selector_init (EMeetingTimeSelector * mts)
{
+ mts->priv = E_MEETING_TIME_SELECTOR_GET_PRIVATE (mts);
+
/* The shadow is drawn in the border so it must be >= 2 pixels. */
gtk_container_set_border_width (GTK_CONTAINER (mts), 2);
@@ -236,10 +390,6 @@ e_meeting_time_selector_init (EMeetingTimeSelector * mts)
mts->list_view = NULL;
- mts->fb_uri_not =
- calendar_config_add_notification_free_busy_template ((GConfClientNotifyFunc) free_busy_template_changed_cb,
- mts);
-
mts->fb_refresh_not = 0;
mts->style_change_idle_id = 0;
}
@@ -300,6 +450,10 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
if (mts->model)
g_object_ref (mts->model);
+ g_signal_connect_swapped (
+ mts->model, "notify::free-busy-template",
+ G_CALLBACK (free_busy_template_changed_cb), mts);
+
g_signal_connect (mts->model, "row_inserted", G_CALLBACK (row_inserted_cb), mts);
g_signal_connect (mts->model, "row_changed", G_CALLBACK (row_changed_cb), mts);
g_signal_connect (mts->model, "row_deleted", G_CALLBACK (row_deleted_cb), mts);
@@ -586,8 +740,18 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
a11y_label);
}
e_date_edit_set_show_time (E_DATE_EDIT (mts->start_date_edit), TRUE);
- e_date_edit_set_use_24_hour_format (E_DATE_EDIT (mts->start_date_edit),
- calendar_config_get_24_hour_format ());
+
+ e_binding_new (
+ G_OBJECT (mts), "show-week-numbers",
+ G_OBJECT (mts->start_date_edit), "show-week-numbers");
+
+ e_binding_new (
+ G_OBJECT (mts), "use-24-hour-format",
+ G_OBJECT (mts->start_date_edit), "use-24-hour-format");
+
+ e_binding_new (
+ G_OBJECT (mts), "week-start-day",
+ G_OBJECT (mts->start_date_edit), "week-start-day");
gtk_table_attach (GTK_TABLE (table), mts->start_date_edit,
1, 2, 0, 1, GTK_FILL, 0, 0, 0);
@@ -613,8 +777,18 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
a11y_label);
}
e_date_edit_set_show_time (E_DATE_EDIT (mts->end_date_edit), TRUE);
- e_date_edit_set_use_24_hour_format (E_DATE_EDIT (mts->end_date_edit),
- calendar_config_get_24_hour_format ());
+
+ e_binding_new (
+ G_OBJECT (mts), "show-week-numbers",
+ G_OBJECT (mts->end_date_edit), "show-week-numbers");
+
+ e_binding_new (
+ G_OBJECT (mts), "use-24-hour-format",
+ G_OBJECT (mts->end_date_edit), "use-24-hour-format");
+
+ e_binding_new (
+ G_OBJECT (mts), "week-start-day",
+ G_OBJECT (mts->end_date_edit), "week-start-day");
gtk_table_attach (GTK_TABLE (table), mts->end_date_edit,
1, 2, 1, 2, GTK_FILL, 0, 0, 0);
@@ -666,7 +840,7 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
e_meeting_time_selector_update_end_date_edit (mts);
e_meeting_time_selector_update_date_popup_menus (mts);
- g_signal_emit (mts, mts_signals [CHANGED], 0);
+ g_signal_emit (mts, signals [CHANGED], 0);
}
/* This adds a color to the color key beneath the main display. If color is
@@ -754,7 +928,7 @@ e_meeting_time_selector_options_menu_detacher (GtkWidget *widget,
EMeetingTimeSelector *mts;
g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (widget));
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (widget));
mts = E_MEETING_TIME_SELECTOR (widget);
g_return_if_fail (mts->options_menu == (GtkWidget*) menu);
@@ -769,7 +943,7 @@ e_meeting_time_selector_autopick_menu_detacher (GtkWidget *widget,
EMeetingTimeSelector *mts;
g_return_if_fail (widget != NULL);
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (widget));
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (widget));
mts = E_MEETING_TIME_SELECTOR (widget);
g_return_if_fail (mts->autopick_menu == (GtkWidget*) menu);
@@ -782,52 +956,68 @@ e_meeting_time_selector_new (EMeetingStore *ems)
{
GtkWidget *mts;
- mts = GTK_WIDGET (g_object_new (e_meeting_time_selector_get_type (), NULL));
+ mts = g_object_new (E_TYPE_MEETING_TIME_SELECTOR, NULL);
e_meeting_time_selector_construct (E_MEETING_TIME_SELECTOR (mts), ems);
return mts;
}
-static void
-e_meeting_time_selector_destroy (GtkObject *object)
+gboolean
+e_meeting_time_selector_get_show_week_numbers (EMeetingTimeSelector *mts)
{
- EMeetingTimeSelector *mts;
+ g_return_val_if_fail (E_IS_MEETING_TIME_SELECTOR (mts), FALSE);
- mts = E_MEETING_TIME_SELECTOR (object);
+ return mts->priv->show_week_numbers;
+}
- e_meeting_time_selector_remove_timeout (mts);
+void
+e_meeting_time_selector_set_show_week_numbers (EMeetingTimeSelector *mts,
+ gboolean show_week_numbers)
+{
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
- if (mts->stipple) {
- g_object_unref (mts->stipple);
- mts->stipple = NULL;
- }
+ mts->priv->show_week_numbers = show_week_numbers;
- if (mts->model) {
- g_object_unref (mts->model);
- mts->model = NULL;
- }
+ g_object_notify (G_OBJECT (mts), "show-week-numbers");
+}
- mts->display_top = NULL;
- mts->display_main = NULL;
+gboolean
+e_meeting_time_selector_get_use_24_hour_format (EMeetingTimeSelector *mts)
+{
+ g_return_val_if_fail (E_IS_MEETING_TIME_SELECTOR (mts), FALSE);
- if (mts->fb_uri_not) {
- calendar_config_remove_notification (mts->fb_uri_not);
- mts->fb_uri_not = 0;
- }
+ return mts->priv->use_24_hour_format;
+}
- if (mts->fb_refresh_not != 0) {
- g_source_remove (mts->fb_refresh_not);
- mts->fb_refresh_not = 0;
- }
+void
+e_meeting_time_selector_set_use_24_hour_format (EMeetingTimeSelector *mts,
+ gboolean use_24_hour_format)
+{
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
- if (mts->style_change_idle_id != 0) {
- g_source_remove (mts->style_change_idle_id);
- mts->style_change_idle_id = 0;
- }
+ mts->priv->use_24_hour_format = use_24_hour_format;
- if (GTK_OBJECT_CLASS (e_meeting_time_selector_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (e_meeting_time_selector_parent_class)->destroy)(object);
+ g_object_notify (G_OBJECT (mts), "use-24-hour-format");
+}
+
+gint
+e_meeting_time_selector_get_week_start_day (EMeetingTimeSelector *mts)
+{
+ g_return_val_if_fail (E_IS_MEETING_TIME_SELECTOR (mts), 0);
+
+ return mts->priv->week_start_day;
+}
+
+void
+e_meeting_time_selector_set_week_start_day (EMeetingTimeSelector *mts,
+ gint week_start_day)
+{
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
+
+ mts->priv->week_start_day = week_start_day;
+
+ g_object_notify (G_OBJECT (mts), "week-start-day");
}
static void
@@ -895,7 +1085,7 @@ style_change_idle_func (gpointer widget)
/* Calculate the widths of the hour strings in the style's font. */
max_hour_width = 0;
for (hour = 0; hour < 24; hour++) {
- if (calendar_config_get_24_hour_format ())
+ if (e_meeting_time_selector_get_use_24_hour_format (mts))
pango_layout_set_text (layout, EMeetingTimeSelectorHours [hour], -1);
else
pango_layout_set_text (layout, EMeetingTimeSelectorHours12 [hour], -1);
@@ -1053,7 +1243,7 @@ e_meeting_time_selector_set_meeting_time (EMeetingTimeSelector *mts,
gint end_hour,
gint end_minute)
{
- g_return_val_if_fail (IS_E_MEETING_TIME_SELECTOR (mts), FALSE);
+ g_return_val_if_fail (E_IS_MEETING_TIME_SELECTOR (mts), FALSE);
/* Check the dates are valid. */
if (!g_date_valid_dmy (start_day, start_month, start_year)
@@ -1082,7 +1272,7 @@ e_meeting_time_selector_set_meeting_time (EMeetingTimeSelector *mts,
e_meeting_time_selector_update_start_date_edit (mts);
e_meeting_time_selector_update_end_date_edit (mts);
- g_signal_emit (mts, mts_signals [CHANGED], 0);
+ g_signal_emit (mts, signals [CHANGED], 0);
return TRUE;
}
@@ -1115,7 +1305,7 @@ e_meeting_time_selector_set_working_hours_only (EMeetingTimeSelector *mts,
{
EMeetingTime saved_time;
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
if (mts->working_hours_only == working_hours_only)
return;
@@ -1140,7 +1330,7 @@ e_meeting_time_selector_set_working_hours (EMeetingTimeSelector *mts,
{
EMeetingTime saved_time;
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
if (mts->day_start_hour == day_start_hour
&& mts->day_start_minute == day_start_minute
@@ -1175,7 +1365,7 @@ e_meeting_time_selector_set_zoomed_out (EMeetingTimeSelector *mts,
{
EMeetingTime saved_time;
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
if (mts->zoomed_out == zoomed_out)
return;
@@ -1269,7 +1459,7 @@ void
e_meeting_time_selector_set_autopick_option (EMeetingTimeSelector *mts,
EMeetingTimeSelectorAutopickOption autopick_option)
{
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
switch (autopick_option) {
case E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_RESOURCES:
@@ -1294,7 +1484,7 @@ e_meeting_time_selector_attendee_set_send_meeting_to (EMeetingTimeSelector *mts,
{
EMeetingTimeSelectorAttendee *attendee;
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
g_return_if_fail (row >= 0);
g_return_if_fail (row < mts->attendees->len);
@@ -1307,7 +1497,7 @@ e_meeting_time_selector_attendee_set_send_meeting_to (EMeetingTimeSelector *mts,
void
e_meeting_time_selector_set_read_only (EMeetingTimeSelector *mts, gboolean read_only)
{
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
gtk_widget_set_sensitive (GTK_WIDGET (mts->list_view), !read_only);
gtk_widget_set_sensitive (mts->display_main, !read_only);
@@ -1334,7 +1524,7 @@ e_meeting_time_selector_dump (EMeetingTimeSelector *mts)
gint row, period_num;
gchar buffer[128];
- g_return_if_fail (IS_E_MEETING_TIME_SELECTOR (mts));
+ g_return_if_fail (E_IS_MEETING_TIME_SELECTOR (mts));
g_print ("\n\nAttendee Information:\n");
@@ -1627,7 +1817,7 @@ e_meeting_time_selector_autopick (EMeetingTimeSelector *mts,
e_meeting_time_selector_update_start_date_edit (mts);
e_meeting_time_selector_update_end_date_edit (mts);
- g_signal_emit (mts, mts_signals [CHANGED], 0);
+ g_signal_emit (mts, signals [CHANGED], 0);
return;
}
@@ -2180,7 +2370,7 @@ e_meeting_time_selector_on_start_time_changed (GtkWidget *widget,
gtk_widget_queue_draw (mts->display_top);
gtk_widget_queue_draw (mts->display_main);
- g_signal_emit (mts, mts_signals [CHANGED], 0);
+ g_signal_emit (mts, signals [CHANGED], 0);
}
/* This is called when the meeting end time GnomeDateEdit is changed,
@@ -2229,7 +2419,7 @@ e_meeting_time_selector_on_end_time_changed (GtkWidget *widget,
gtk_widget_queue_draw (mts->display_top);
gtk_widget_queue_draw (mts->display_main);
- g_signal_emit (mts, mts_signals [CHANGED], 0);
+ g_signal_emit (mts, signals [CHANGED], 0);
}
/* This updates the ranges shown in the GnomeDateEdit popup menus, according
@@ -2443,7 +2633,7 @@ e_meeting_time_selector_drag_meeting_time (EMeetingTimeSelector *mts,
if (set_both_times
|| mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_END
|| mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_START)
- g_signal_emit (mts, mts_signals [CHANGED], 0);
+ g_signal_emit (mts, signals [CHANGED], 0);
}
/* This is the timeout function which handles auto-scrolling when the user is
@@ -2582,7 +2772,7 @@ e_meeting_time_selector_timeout_handler (gpointer data)
if (set_both_times
|| mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_END
|| mts->dragging_position == E_MEETING_TIME_SELECTOR_POS_START)
- g_signal_emit (mts, mts_signals [CHANGED], 0);
+ g_signal_emit (mts, signals [CHANGED], 0);
scroll:
/* Redraw the canvases. We freeze and thaw the layouts so that they
@@ -2861,14 +3051,8 @@ row_deleted_cb (GtkTreeModel *model, GtkTreePath *path, gpointer data)
static gboolean
free_busy_timeout_refresh (gpointer data)
{
- gchar *fb_uri;
-
EMeetingTimeSelector *mts = E_MEETING_TIME_SELECTOR (data);
- fb_uri = calendar_config_get_free_busy_template ();
- e_meeting_store_set_fb_uri (mts->model, fb_uri);
- g_free (fb_uri);
-
/* Update all free/busy info, so we use the new template uri */
e_meeting_time_selector_refresh_free_busy (mts, 0, TRUE);
@@ -2878,19 +3062,12 @@ free_busy_timeout_refresh (gpointer data)
}
static void
-free_busy_template_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer data)
+free_busy_template_changed_cb (EMeetingTimeSelector *mts)
{
- EMeetingTimeSelector *mts = E_MEETING_TIME_SELECTOR (data);
-
/* Wait REFRESH_PAUSE before refreshing, using the latest uri value */
- if (mts->fb_refresh_not != 0) {
+ if (mts->fb_refresh_not != 0)
g_source_remove (mts->fb_refresh_not);
- }
- mts->fb_refresh_not = g_timeout_add_seconds (REFRESH_PAUSE,
- free_busy_timeout_refresh,
- data);
+ mts->fb_refresh_not = g_timeout_add_seconds (
+ REFRESH_PAUSE, free_busy_timeout_refresh, mts);
}
diff --git a/calendar/gui/e-meeting-time-sel.h b/calendar/gui/e-meeting-time-sel.h
index b38dd98f74..540443a255 100644
--- a/calendar/gui/e-meeting-time-sel.h
+++ b/calendar/gui/e-meeting-time-sel.h
@@ -20,8 +20,8 @@
*
*/
-#ifndef _E_MEETING_TIME_SELECTOR_H_
-#define _E_MEETING_TIME_SELECTOR_H_
+#ifndef E_MEETING_TIME_SELECTOR_H
+#define E_MEETING_TIME_SELECTOR_H
#include <gtk/gtk.h>
#include <libgnomecanvas/gnome-canvas.h>
@@ -31,14 +31,31 @@
#include "e-meeting-store.h"
#include "e-meeting-list-view.h"
-G_BEGIN_DECLS
-
/*
* EMeetingTimeSelector displays a list of attendees for a meeting and a
* graphical summary of the times which they are free and busy, allowing the
* user to select an appropriate time for a meeting.
*/
+/* Standard GObject macros */
+#define E_TYPE_MEETING_TIME_SELECTOR \
+ (e_meeting_time_selector_get_type ())
+#define E_MEETING_TIME_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MEETING_TIME_SELECTOR, EMeetingTimeSelector))
+#define E_MEETING_TIME_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MEETING_TIME_SELECTOR, EMeetingTimeSelectorClass))
+#define E_IS_MEETING_TIME_SELECTOR(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MEETING_TIME_SELECTOR))
+#define E_IS_MEETING_TIME_SELECTOR_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MEETING_TIME_SELECTOR))
+#define E_MEETING_TIME_SELECTOR_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MEETING_TIME_SELECTOR))
+
/* Define this to include the debugging functions. */
#undef E_MEETING_TIME_SELECTOR_DEBUG
@@ -48,6 +65,8 @@ G_BEGIN_DECLS
#define E_MEETING_TIME_SELECTOR_TEXT_Y_PAD 3
#define E_MEETING_TIME_SELECTOR_TEXT_X_PAD 2
+G_BEGIN_DECLS
+
/* This is used to specify the format used when displaying the dates.
The full format is like 'Sunday, September 12, 1999'. The abbreviated format
is like 'Sun 12/9/99'. The short format is like '12/9/99'. The actual
@@ -84,19 +103,17 @@ extern const gchar *EMeetingTimeSelectorHours[24];
/* An array of hour strings for 12 hour time, "12:00am" .. "11:00pm". */
extern const gchar *EMeetingTimeSelectorHours12[24];
-#define E_MEETING_TIME_SELECTOR(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, e_meeting_time_selector_get_type (), EMeetingTimeSelector)
-#define E_MEETING_TIME_SELECTOR_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, e_meeting_time_selector_get_type (), EMeetingTimeSelectorClass)
-#define IS_E_MEETING_TIME_SELECTOR(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, e_meeting_time_selector_get_type ())
+typedef struct _EMeetingTimeSelector EMeetingTimeSelector;
+typedef struct _EMeetingTimeSelectorClass EMeetingTimeSelectorClass;
+typedef struct _EMeetingTimeSelectorPrivate EMeetingTimeSelectorPrivate;
-typedef struct _EMeetingTimeSelector EMeetingTimeSelector;
-typedef struct _EMeetingTimeSelectorClass EMeetingTimeSelectorClass;
-
-struct _EMeetingTimeSelector
-{
+struct _EMeetingTimeSelector {
/* We subclass a GtkTable which makes it easy to add extra widgets
if neccesary. */
GtkTable table;
+ EMeetingTimeSelectorPrivate *priv;
+
/*
* User Interface stuff - widgets, colors etc.
*/
@@ -246,9 +263,6 @@ struct _EMeetingTimeSelector
/* This is used to determine the delay between scrolls. */
gint scroll_count;
- /* The notification function id for Free/Busy template uri changes */
- guint fb_uri_not;
-
/* The notification function id for Free/Busy refreshes */
gboolean fb_refresh_not;
@@ -257,8 +271,7 @@ struct _EMeetingTimeSelector
guint style_change_idle_id;
};
-struct _EMeetingTimeSelectorClass
-{
+struct _EMeetingTimeSelectorClass {
GtkTableClass parent_class;
void (* changed) (EMeetingTimeSelector *mts);
@@ -269,9 +282,26 @@ struct _EMeetingTimeSelectorClass
* know where the data is coming from. This is mainly just for testing for now.
*/
-GType e_meeting_time_selector_get_type (void);
-GtkWidget* e_meeting_time_selector_new (EMeetingStore *ems);
-void e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *ems);
+GType e_meeting_time_selector_get_type (void);
+GtkWidget * e_meeting_time_selector_new (EMeetingStore *ems);
+void e_meeting_time_selector_construct
+ (EMeetingTimeSelector *mts,
+ EMeetingStore *ems);
+gboolean e_meeting_time_selector_get_show_week_numbers
+ (EMeetingTimeSelector *mts);
+void e_meeting_time_selector_set_show_week_numbers
+ (EMeetingTimeSelector *mts,
+ gboolean show_week_numbers);
+gboolean e_meeting_time_selector_get_use_24_hour_format
+ (EMeetingTimeSelector *mts);
+void e_meeting_time_selector_set_use_24_hour_format
+ (EMeetingTimeSelector *mts,
+ gboolean use_24_hour_format);
+gint e_meeting_time_seletor_get_week_start_day
+ (EMeetingTimeSelector *mts);
+void e_meeting_time_selector_set_week_start_day
+ (EMeetingTimeSelector *mts,
+ gint week_start_day);
/* This returns the currently selected meeting time.
Note that months are 1-12 and days are 1-31. The start time is guaranteed to
@@ -383,4 +413,4 @@ gchar * e_meeting_time_selector_dump_date (GDate *date);
G_END_DECLS
-#endif /* _E_MEETING_TIME_SELECTOR_H_ */
+#endif /* E_MEETING_TIME_SELECTOR_H */
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index a7f2508b3f..e23f82108b 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -48,7 +48,6 @@
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-time-utils.h>
-#include "calendar-config.h"
#include "dialogs/delete-comp.h"
#include "dialogs/delete-error.h"
#include "dialogs/memo-editor.h"
@@ -1243,12 +1242,15 @@ e_memo_table_save_state (EMemoTable *memo_table,
static struct tm
e_memo_table_get_current_time (ECellDateEdit *ecde, gpointer data)
{
+ EMemoTable *memo_table = data;
+ ECalModel *model;
icaltimezone *zone;
struct tm tmp_tm = { 0 };
struct icaltimetype tt;
/* Get the current timezone. */
- zone = calendar_config_get_icaltimezone ();
+ model = e_memo_table_get_model (memo_table);
+ zone = e_cal_model_get_timezone (model);
tt = icaltime_from_timet_with_zone (time (NULL), FALSE, zone);
diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c
deleted file mode 100644
index 8a10802bff..0000000000
--- a/calendar/gui/e-memos.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <glib/gi18n.h>
-#include <libedataserver/e-time-utils.h>
-#include <table/e-table-scrolled.h>
-#include <widgets/menus/gal-view-instance.h>
-#include <widgets/menus/gal-view-factory-etable.h>
-#include <widgets/menus/gal-view-etable.h>
-
-#include "e-util/e-error.h"
-#include "e-util/e-categories-config.h"
-#include "e-util/e-util-private.h"
-#include <libecal/e-cal-time-util.h>
-#include <libedataserver/e-url.h>
-#include <libedataserver/e-categories.h>
-#include "widgets/menus/gal-view-menus.h"
-#include "dialogs/delete-error.h"
-#include "calendar-config.h"
-#include "cal-search-bar.h"
-#include "comp-util.h"
-#include "e-memo-table-config.h"
-#include "misc.h"
-#include "e-cal-component-memo-preview.h"
-#include "e-memos.h"
-#include "common/authentication.h"
-
-/* Private part of the GnomeCalendar structure */
-struct _EMemosPrivate {
- /* The memo lists for display */
- GHashTable *clients;
- GList *clients_list;
- ECal *default_client;
-
- ECalView *query;
-
- /* The EMemoTable showing the memos. */
- GtkWidget *memos_view;
- EMemoTableConfig *memos_view_config;
-
- /* Calendar search bar for memos */
- GtkWidget *search_bar;
-
- /* The preview */
- GtkWidget *preview;
-
- gchar *current_uid;
- gchar *sexp;
-
- /* View instance and the view menus handler */
- GalViewInstance *view_instance;
- GalViewMenus *view_menus;
-
- GList *notifications;
-};
-
-static void setup_widgets (EMemos *memos);
-static void e_memos_destroy (GtkObject *object);
-static void update_view (EMemos *memos);
-
-static void categories_changed_cb (gpointer object, gpointer user_data);
-
-/* Signal IDs */
-enum {
- SELECTION_CHANGED,
- SOURCE_ADDED,
- SOURCE_REMOVED,
- LAST_SIGNAL
-};
-
-static guint e_memos_signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (EMemos, e_memos, GTK_TYPE_TABLE)
-
-/* Callback used when the sexp in the search bar changes */
-static void
-search_bar_sexp_changed_cb (CalSearchBar *cal_search, const gchar *sexp, gpointer data)
-{
- EMemos *memos;
- EMemosPrivate *priv;
-
- memos = E_MEMOS (data);
- priv = memos->priv;
-
- if (priv->sexp)
- g_free (priv->sexp);
-
- priv->sexp = g_strdup (sexp);
-
- update_view (memos);
-}
-
-/* Callback used when the selected category in the search bar changes */
-static void
-search_bar_category_changed_cb (CalSearchBar *cal_search, const gchar *category, gpointer data)
-{
- EMemos *memos;
- EMemosPrivate *priv;
- ECalModel *model;
-
- memos = E_MEMOS (data);
- priv = memos->priv;
-
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
- e_cal_model_set_default_category (model, category);
-}
-
-static void
-set_timezone (EMemos *memos)
-{
- EMemosPrivate *priv;
- icaltimezone *zone;
- GList *l;
-
- priv = memos->priv;
-
- zone = calendar_config_get_icaltimezone ();
- for (l = priv->clients_list; l != NULL; l = l->next) {
- ECal *client = l->data;
-
- if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
- /* FIXME Error checking */
- e_cal_set_default_timezone (client, zone, NULL);
- }
-
- if (priv->preview)
- e_cal_component_memo_preview_set_default_timezone (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview), zone);
-}
-
-static void
-timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- EMemos *memos = data;
-
- set_timezone (memos);
-}
-
-static void
-update_view (EMemos *memos)
-{
- EMemosPrivate *priv;
- ECalModel *model;
-
- priv = memos->priv;
-
- model = e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view));
-
- e_cal_model_set_search_query (model, priv->sexp);
-
- e_cal_component_memo_preview_clear (E_CAL_COMPONENT_MEMO_PREVIEW (priv->preview));
-}
-
-static void
-setup_config (EMemos *memos)
-{
- EMemosPrivate *priv;
- guint not;
-
- priv = memos->priv;
-
- /* Timezone */
- set_timezone (memos);
-
- not = calendar_config_add_notification_timezone (timezone_changed_cb, memos);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-}
-
-static void
-setup_widgets (EMemos *memos)
-{
- EMemosPrivate *priv;
- ETable *etable;
- ECalModel *model;
-
- priv = memos->priv;
-
- priv->search_bar = cal_search_bar_new (CAL_SEARCH_MEMOS_DEFAULT);
- g_signal_connect (priv->search_bar, "sexp_changed",
- G_CALLBACK (search_bar_sexp_changed_cb), memos);
- g_signal_connect (priv->search_bar, "category_changed",
- G_CALLBACK (search_bar_category_changed_cb), memos);
-
- categories_changed_cb (NULL, memos);
-
- gtk_table_attach (GTK_TABLE (memos), priv->search_bar, 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0);
- gtk_widget_show (priv->search_bar);
-
- /* create the memo list */
- priv->memos_view = e_memo_table_new ();
- priv->memos_view_config = e_memo_table_config_new (E_MEMO_TABLE (priv->memos_view));
-
- g_signal_connect (etable, "table_drag_data_get",
- G_CALLBACK(table_drag_data_get), memos);
-}
-
-/* Class initialization function for the gnome calendar */
-static void
-e_memos_class_init (EMemosClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
-
- e_memos_signals[SELECTION_CHANGED] =
- g_signal_new ("selection_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMemosClass, selection_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
-
- e_memos_signals[SOURCE_ADDED] =
- g_signal_new ("source_added",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMemosClass, source_added),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1,
- G_TYPE_OBJECT);
-
- e_memos_signals[SOURCE_REMOVED] =
- g_signal_new ("source_removed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMemosClass, source_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1,
- G_TYPE_OBJECT);
-
- object_class->destroy = e_memos_destroy;
-
- klass->selection_changed = NULL;
- klass->source_added = NULL;
- klass->source_removed = NULL;
-}
-
-static void
-categories_changed_cb (gpointer object, gpointer user_data)
-{
- GList *cat_list;
- GPtrArray *cat_array;
- EMemosPrivate *priv;
- EMemos *memos = user_data;
-
- priv = memos->priv;
-
- cat_array = g_ptr_array_new ();
- cat_list = e_categories_get_list ();
- while (cat_list != NULL) {
- if (e_categories_is_searchable ((const gchar *) cat_list->data))
- g_ptr_array_add (cat_array, cat_list->data);
- cat_list = g_list_remove (cat_list, cat_list->data);
- }
-
- cal_search_bar_set_categories (CAL_SEARCH_BAR(priv->search_bar), cat_array);
-
- g_ptr_array_free (cat_array, TRUE);
-}
-
-/* Object initialization function for the gnome calendar */
-static void
-e_memos_init (EMemos *memos)
-{
- EMemosPrivate *priv;
-
- priv = g_new0 (EMemosPrivate, 1);
- memos->priv = priv;
-
- setup_config (memos);
- setup_widgets (memos);
-
- e_categories_register_change_listener (G_CALLBACK (categories_changed_cb), memos);
-
- priv->clients = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
- priv->query = NULL;
- priv->view_instance = NULL;
- priv->view_menus = NULL;
- priv->current_uid = NULL;
- priv->sexp = g_strdup ("#t");
- update_view (memos);
-}
-
-static void
-e_memos_destroy (GtkObject *object)
-{
- EMemos *memos;
- EMemosPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_MEMOS (object));
-
- memos = E_MEMOS (object);
- priv = memos->priv;
-
- if (priv) {
- GList *l;
-
- e_categories_unregister_change_listener (G_CALLBACK (categories_changed_cb), memos);
-
- /* disconnect from signals on all the clients */
- for (l = priv->clients_list; l != NULL; l = l->next) {
- g_signal_handlers_disconnect_matched (l->data, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, memos);
- }
-
- g_hash_table_destroy (priv->clients);
- g_list_free (priv->clients_list);
-
- if (priv->current_uid) {
- g_free (priv->current_uid);
- priv->current_uid = NULL;
- }
-
- if (priv->sexp) {
- g_free (priv->sexp);
- priv->sexp = NULL;
- }
-
- if (priv->memos_view_config) {
- g_object_unref (priv->memos_view_config);
- priv->memos_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);
- memos->priv = NULL;
- }
-
- if (GTK_OBJECT_CLASS (e_memos_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (e_memos_parent_class)->destroy) (object);
-}
-
-ECal *
-e_memos_get_default_client (EMemos *memos)
-{
- EMemosPrivate *priv;
-
- g_return_val_if_fail (memos != NULL, NULL);
- g_return_val_if_fail (E_IS_MEMOS (memos), NULL);
-
- priv = memos->priv;
-
- return e_cal_model_get_default_client (e_memo_table_get_model (E_MEMO_TABLE (priv->memos_view)));
-}
diff --git a/calendar/gui/e-memos.h b/calendar/gui/e-memos.h
deleted file mode 100644
index 4c49f56a79..0000000000
--- a/calendar/gui/e-memos.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_MEMOS_H_
-#define _E_MEMOS_H_
-
-#include <gtk/gtk.h>
-#include <libedataserver/e-source.h>
-#include <libecal/e-cal.h>
-#include "e-memo-table.h"
-
-#define E_TYPE_MEMOS (e_memos_get_type ())
-#define E_MEMOS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MEMOS, EMemos))
-#define E_MEMOS_CLASS(klass) (G_TYPE_CHECK_INSTANCE_CAST_CLASS ((klass), E_TYPE_MEMOS, \
- EMemosClass))
-#define E_IS_MEMOS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MEMOS))
-#define E_IS_MEMOS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_MEMOS))
-
-typedef struct _EMemos EMemos;
-typedef struct _EMemosClass EMemosClass;
-typedef struct _EMemosPrivate EMemosPrivate;
-
-struct _EMemos {
- GtkTable table;
-
- /* Private data */
- EMemosPrivate *priv;
-};
-
-struct _EMemosClass {
- GtkTableClass parent_class;
-
- /* Notification signals */
- void (* selection_changed) (EMemos *memos, gint n_selected);
- void (* source_added) (EMemos *memos, ESource *source);
- void (* source_removed) (EMemos *memos, ESource *source);
-};
-
-GType e_memos_get_type (void);
-GtkWidget *e_memos_construct (EMemos *memos);
-
-GtkWidget *e_memos_new (void);
-
-gboolean e_memos_add_memo_source (EMemos *memos, ESource *source);
-gboolean e_memos_remove_memo_source (EMemos *memos, ESource *source);
-gboolean e_memos_set_default_source (EMemos *memos, ESource *source);
-ECal *e_memos_get_default_client (EMemos *memos);
-
-void e_memos_open_memo (EMemos *memos);
-void e_memos_new_memo (EMemos *memos);
-void e_memos_complete_selected (EMemos *memos);
-void e_memos_delete_selected (EMemos *memos);
-
-void e_memos_setup_view_menus (EMemos *memos, BonoboUIComponent *uic);
-void e_memos_discard_view_menus (EMemos *memos);
-
-EMemoTable *e_memos_get_calendar_table (EMemos *memos);
-GtkWidget *e_memos_get_preview (EMemos *memos);
-
-#endif /* _E_MEMOS_H_ */
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
deleted file mode 100644
index 2f24ebfbc2..0000000000
--- a/calendar/gui/e-tasks.c
+++ /dev/null
@@ -1,724 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib/gi18n.h>
-#include <libedataserver/e-time-utils.h>
-#include <table/e-table-scrolled.h>
-#include <widgets/menus/gal-view-instance.h>
-#include <widgets/menus/gal-view-factory-etable.h>
-#include <widgets/menus/gal-view-etable.h>
-
-#include "e-util/e-error.h"
-#include "e-util/e-categories-config.h"
-#include "e-util/e-util-private.h"
-#include "shell/e-user-creatable-items-handler.h"
-#include <libedataserver/e-url.h>
-#include <libedataserver/e-categories.h>
-#include <libecal/e-cal-time-util.h>
-#include "widgets/menus/gal-view-menus.h"
-#include "dialogs/delete-error.h"
-#include "dialogs/task-editor.h"
-#include "cal-search-bar.h"
-#include "calendar-config.h"
-#include "calendar-component.h"
-#include "comp-util.h"
-#include "e-calendar-table-config.h"
-#include "misc.h"
-#include "tasks-component.h"
-#include "e-cal-component-preview.h"
-#include "e-tasks.h"
-#include "common/authentication.h"
-#include "e-cal-menu.h"
-#include "e-cal-model-tasks.h"
-
-/* Private part of the GnomeCalendar structure */
-struct _ETasksPrivate {
- /* The task lists for display */
- GHashTable *clients;
- GList *clients_list;
- ECal *default_client;
-
- ECalView *query;
-
- /* The ECalendarTable showing the tasks. */
- GtkWidget *tasks_view;
- ECalendarTableConfig *tasks_view_config;
-
- /* Calendar search bar for tasks */
- GtkWidget *search_bar;
-
- /* Paned widget */
- GtkWidget *paned;
-
- /* The preview */
- GtkWidget *preview;
-
- gchar *current_uid;
- gchar *sexp;
- guint update_timeout;
-
- GList *notifications;
-};
-
-static void setup_widgets (ETasks *tasks);
-static void e_tasks_destroy (GtkObject *object);
-
-static void backend_error_cb (ECal *client, const gchar *message, gpointer data);
-
-/* Signal IDs */
-enum {
- SELECTION_CHANGED,
- SOURCE_ADDED,
- SOURCE_REMOVED,
- LAST_SIGNAL
-};
-
-static guint e_tasks_signals[LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (ETasks, e_tasks, GTK_TYPE_TABLE)
-
-/* Callback used when the selected category in the search bar changes */
-static void
-search_bar_category_changed_cb (CalSearchBar *cal_search, const gchar *category, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
- ECalModel *model;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- e_cal_model_set_default_category (model, category);
-}
-
-/**
- * get_selected_components_cb
- * Helper function to fill list of selected components in ECalendarTable.
- * This function is called from e_table_selected_row_foreach.
- **/
-static void
-get_selected_components_cb (gint model_row, gpointer data)
-{
- struct AffectedComponents *ac = (struct AffectedComponents *) data;
-
- if (!ac || !ac->cal_table)
- return;
-
- ac->components = g_slist_prepend (ac->components, e_cal_model_get_component_at (E_CAL_MODEL (ac->cal_table->model), model_row));
-}
-
-/**
- * do_for_selected_components
- * Calls function func for all selected components in cal_table.
- *
- * @param cal_table Table with selected components of our interest.
- * @param func Function to be called on each selected component from cal_table.
- * The first parameter of this function is a pointer to ECalModelComponent and
- * the second parameter of this function is pointer to cal_table
- * @param user_data User data, will be passed to func.
- **/
-static void
-do_for_selected_components (ECalendarTable *cal_table, GFunc func, gpointer user_data)
-{
- ETable *etable;
- struct AffectedComponents ac;
-
- g_return_if_fail (cal_table != NULL);
-
- ac.cal_table = cal_table;
- ac.components = NULL;
-
- etable = e_table_scrolled_get_table (E_TABLE_SCROLLED (cal_table->etable));
- e_table_selected_row_foreach (etable, get_selected_components_cb, &ac);
-
- g_slist_foreach (ac.components, func, user_data);
- g_slist_free (ac.components);
-}
-
-/**
- * obtain_list_of_components
- * As a callback function to convert each ECalModelComponent to string
- * of format "source_uid\ncomponent_str" and add this newly allocated
- * string to the list of components. Strings should be freed with g_free.
- *
- * @param data ECalModelComponent object.
- * @param user_data Pointer to GSList list, where to put new strings.
- **/
-static void
-obtain_list_of_components (gpointer data, gpointer user_data)
-{
- GSList **list;
- ECalModelComponent *comp_data;
-
- list = (GSList **) user_data;
- comp_data = (ECalModelComponent *) data;
-
- if (list && comp_data) {
- gchar *comp_str;
- icalcomponent *vcal;
-
- vcal = e_cal_util_new_top_level ();
- e_cal_util_add_timezones_from_component (vcal, comp_data->icalcomp);
- icalcomponent_add_component (vcal, icalcomponent_new_clone (comp_data->icalcomp));
-
- comp_str = icalcomponent_as_ical_string_r (vcal);
- if (comp_str) {
- ESource *source = e_cal_get_source (comp_data->client);
- const gchar *source_uid = e_source_peek_uid (source);
-
- *list = g_slist_prepend (*list, g_strdup_printf ("%s\n%s", source_uid, comp_str));
-
- /* do not free this pointer, it owns libical */
- /* g_free (comp_str); */
- }
-
- icalcomponent_free (vcal);
- g_free (comp_str);
- }
-}
-
-static void
-table_drag_data_get (ETable *table,
- gint row,
- gint col,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETasks *tasks)
-{
- ETasksPrivate *priv;
-
- priv = tasks->priv;
-
- if (info == TARGET_VCALENDAR) {
- /* we will pass an icalcalendar component for both types */
- GSList *components = NULL;
-
- do_for_selected_components (E_CALENDAR_TABLE (priv->tasks_view), obtain_list_of_components, &components);
-
- if (components) {
- cal_comp_selection_set_string_list (selection_data, components);
-
- g_slist_foreach (components, (GFunc)g_free, NULL);
- g_slist_free (components);
- }
- }
-}
-
-/*
-static void
-table_drag_begin (ETable *table,
- gint row,
- gint col,
- GdkDragContext *context,
- ETasks *tasks)
-{
-
-}
-
-static void
-table_drag_end (ETable *table,
- gint row,
- gint col,
- GdkDragContext *context,
- ETasks *tasks)
-{
-
-}
-*/
-
-static void
-table_drag_data_delete (ETable *table,
- gint row,
- gint col,
- GdkDragContext *context,
- ETasks *tasks)
-{
- /* Moved components are deleted from source immediately when moved,
- because some of them can be part of destination source, and we
- don't want to delete not-moved tasks. There is no such information
- which event has been moved and which not, so skip this method.
- */
-}
-
-#define E_TASKS_TABLE_DEFAULT_STATE \
- "<?xml version=\"1.0\"?>" \
- "<ETableState>" \
- "<column source=\"13\"/>" \
- "<column source=\"14\"/>" \
- "<column source=\"9\"/>" \
- "<column source=\"5\"/>" \
- "<grouping/>" \
- "</ETableState>"
-
-static void
-pane_realized (GtkWidget *widget, ETasks *tasks)
-{
- gtk_paned_set_position ((GtkPaned *)widget, calendar_config_get_task_vpane_pos ());
-}
-
-static void
-setup_widgets (ETasks *tasks)
-{
- ETasksPrivate *priv;
- ETable *etable;
- ECalModel *model;
- gboolean state;
-
- priv = tasks->priv;
-
- priv->search_bar = cal_search_bar_new (CAL_SEARCH_TASKS_DEFAULT);
- g_signal_connect (priv->search_bar, "sexp_changed",
- G_CALLBACK (search_bar_sexp_changed_cb), tasks);
- g_signal_connect (priv->search_bar, "category_changed",
- G_CALLBACK (search_bar_category_changed_cb), tasks);
-
- gtk_table_attach (GTK_TABLE (tasks), priv->search_bar, 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0, 0);
- gtk_widget_show (priv->search_bar);
-
- /* add the paned widget for the task list and task detail areas */
- priv->paned = gtk_vpaned_new ();
- g_signal_connect (priv->paned, "realize", G_CALLBACK (pane_realized), tasks);
-
- gtk_table_attach (GTK_TABLE (tasks), priv->paned, 0, 1, 1, 2,
- GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_widget_show (priv->paned);
-
- /* create the task list */
- priv->tasks_view = e_calendar_table_new ();
- g_object_set_data (G_OBJECT (priv->tasks_view), "tasks", tasks);
- priv->tasks_view_config = e_calendar_table_config_new (E_CALENDAR_TABLE (priv->tasks_view));
-
- g_signal_connect (priv->tasks_view, "user_created", G_CALLBACK (user_created_cb), tasks);
-
- 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 (priv->paned), priv->tasks_view);
- gtk_widget_show (priv->tasks_view);
-
- e_table_drag_source_set (etable, GDK_BUTTON1_MASK,
- list_drag_types, num_list_drag_types,
- GDK_ACTION_MOVE|GDK_ACTION_COPY|GDK_ACTION_ASK);
-
- g_signal_connect (etable, "table_drag_data_get",
- G_CALLBACK(table_drag_data_get), tasks);
- g_signal_connect (etable, "table_drag_data_delete",
- G_CALLBACK(table_drag_data_delete), tasks);
-
- /*
- e_table_drag_dest_set (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)),
- 0, list_drag_types, num_list_drag_types, GDK_ACTION_LINK);
-
- g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)),
- "table_drag_motion", G_CALLBACK(table_drag_motion_cb), editor);
- g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)),
- "table_drag_drop", G_CALLBACK (table_drag_drop_cb), editor);
- g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)),
- "table_drag_data_received", G_CALLBACK(table_drag_data_received_cb), editor);
- */
-
- g_signal_connect (etable, "selection_change", G_CALLBACK (table_selection_change_cb), tasks);
-
- /* create the task detail */
- priv->preview = e_cal_component_preview_new ();
- e_cal_component_preview_set_default_timezone (E_CAL_COMPONENT_PREVIEW (priv->preview), calendar_config_get_icaltimezone ());
- gtk_paned_add2 (GTK_PANED (priv->paned), priv->preview);
- state = calendar_config_get_preview_state ();
-
- if (state)
- gtk_widget_show (priv->preview);
-}
-
-/* Class initialization function for the gnome calendar */
-static void
-e_tasks_class_init (ETasksClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) class;
-
- e_tasks_signals[SELECTION_CHANGED] =
- g_signal_new ("selection_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETasksClass, selection_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
-
- e_tasks_signals[SOURCE_ADDED] =
- g_signal_new ("source_added",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ETasksClass, source_added),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1,
- G_TYPE_OBJECT);
-
- e_tasks_signals[SOURCE_REMOVED] =
- g_signal_new ("source_removed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (ETasksClass, source_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1,
- G_TYPE_OBJECT);
-
- object_class->destroy = e_tasks_destroy;
-
- class->selection_changed = NULL;
- class->source_added = NULL;
- class->source_removed = 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_widgets (tasks);
-
- priv->clients = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
- priv->query = NULL;
- priv->current_uid = NULL;
- priv->sexp = g_strdup ("#t");
- priv->default_client = NULL;
-}
-
-GtkWidget *
-e_tasks_new (void)
-{
- ETasks *tasks;
-
- tasks = g_object_new (e_tasks_get_type (), NULL);
-
- return GTK_WIDGET (tasks);
-}
-
-static void
-e_tasks_destroy (GtkObject *object)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_TASKS (object));
-
- tasks = E_TASKS (object);
- priv = tasks->priv;
-
- if (priv) {
- GList *l;
-
- /* disconnect from signals on all the clients */
- for (l = priv->clients_list; l != NULL; l = l->next) {
- g_signal_handlers_disconnect_matched (l->data, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, tasks);
- }
-
- g_hash_table_destroy (priv->clients);
- g_list_free (priv->clients_list);
-
- if (priv->default_client)
- g_object_unref (priv->default_client);
- priv->default_client = NULL;
-
- if (priv->current_uid) {
- g_free (priv->current_uid);
- priv->current_uid = NULL;
- }
-
- if (priv->sexp) {
- g_free (priv->sexp);
- priv->sexp = NULL;
- }
-
- if (priv->tasks_view_config) {
- g_object_unref (priv->tasks_view_config);
- 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;
- }
-
- if (GTK_OBJECT_CLASS (e_tasks_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (e_tasks_parent_class)->destroy) (object);
-}
-
-static void
-set_status_message (ETasks *tasks, const gchar *message, ...)
-{
- ETasksPrivate *priv;
- va_list args;
- gchar sz[2048], *msg_string = NULL;
-
- if (message) {
- va_start (args, message);
- vsnprintf (sz, sizeof sz, message, args);
- va_end (args);
- msg_string = sz;
- }
-
- priv = tasks->priv;
-
- e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->tasks_view), msg_string, -1);
-}
-
-typedef void (*open_func) (ECal *, ECalendarStatus, ETasks *);
-
-static gboolean
-open_ecal (ETasks *tasks, ECal *cal, gboolean only_if_exists, open_func of)
-{
- ETasksPrivate *priv;
- icaltimezone *zone;
-
- priv = tasks->priv;
-
- zone = calendar_config_get_icaltimezone ();
- e_cal_set_default_timezone (cal, zone, NULL);
-
- set_status_message (tasks, _("Opening tasks at %s"), e_cal_get_uri (cal));
-
- g_signal_connect (G_OBJECT (cal), "cal_opened", G_CALLBACK (of), tasks);
- e_cal_open_async (cal, only_if_exists);
-
- return TRUE;
-}
-
-void
-e_tasks_open_task (ETasks *tasks)
-{
- ECalendarTable *cal_table;
-
- cal_table = e_tasks_get_calendar_table (tasks);
- e_calendar_table_open_selected (cal_table);
-}
-
-void
-e_tasks_new_task (ETasks *tasks)
-{
- ETasksPrivate *priv;
- CompEditor *editor;
- ECalComponent *comp;
- const gchar *category;
- ECal *ecal;
- guint32 flags = 0;
-
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- /* FIXME What to do about no default client */
- ecal = e_tasks_get_default_client (tasks);
- if (!ecal)
- return;
-
- flags |= COMP_EDITOR_NEW_ITEM | COMP_EDITOR_USER_ORG;
-
- comp = cal_comp_task_new_with_defaults (ecal);
-
- category = cal_search_bar_get_category (CAL_SEARCH_BAR (priv->search_bar));
- e_cal_component_set_categories (comp, category);
-
- editor = task_editor_new (ecal, flags);
- comp_editor_edit_comp (editor, comp);
- g_object_unref (comp);
-
- gtk_window_present (GTK_WINDOW (editor));
-}
-
-gboolean
-e_tasks_remove_todo_source (ETasks *tasks, ESource *source)
-{
- ETasksPrivate *priv;
- ECal *client;
- ECalModel *model;
- const gchar *uid;
-
- g_return_val_if_fail (tasks != NULL, FALSE);
- g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
- g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
-
- priv = tasks->priv;
-
- uid = e_source_peek_uid (source);
- client = g_hash_table_lookup (priv->clients, uid);
- if (!client)
- return TRUE;
-
- priv->clients_list = g_list_remove (priv->clients_list, client);
- g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, tasks);
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- e_cal_model_remove_client (model, client);
-
- g_hash_table_remove (priv->clients, uid);
-
- g_signal_emit (tasks, e_tasks_signals[SOURCE_REMOVED], 0, source);
-
- return TRUE;
-}
-
-gboolean
-e_tasks_set_default_source (ETasks *tasks, ESource *source)
-{
- ETasksPrivate *priv;
- ECal *ecal;
-
- g_return_val_if_fail (tasks != NULL, FALSE);
- g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
- g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
-
- priv = tasks->priv;
-
- ecal = g_hash_table_lookup (priv->clients, e_source_peek_uid (source));
-
- if (priv->default_client)
- g_object_unref (priv->default_client);
-
- if (ecal) {
- priv->default_client = g_object_ref (ecal);
- } else {
- priv->default_client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
- if (!priv->default_client)
- return FALSE;
- }
-
- open_ecal (tasks, priv->default_client, FALSE, default_client_cal_opened_cb);
-
- return TRUE;
-}
-
-/**
- * e_tasks_expunge:
- * @tasks: A tasks control widget
- *
- * Removes all tasks marked as completed
- **/
-void
-e_tasks_delete_completed (ETasks *tasks)
-{
- ETasksPrivate *priv;
- gchar *sexp;
- GList *l;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- sexp = g_strdup ("(is-completed?)");
-
- set_status_message (tasks, _("Expunging"));
-
- for (l = priv->clients_list; l != NULL; l = l->next) {
- ECal *client = l->data;
- GList *objects, *m;
- gboolean read_only = TRUE;
-
- e_cal_is_read_only (client, &read_only, NULL);
- if (read_only)
- continue;
-
- if (!e_cal_get_object_list (client, sexp, &objects, NULL)) {
- g_warning (G_STRLOC ": Could not get the objects");
-
- continue;
- }
-
- for (m = objects; m; m = m->next) {
- /* FIXME Better error handling */
- e_cal_remove_object (client, icalcomponent_get_uid (m->data), NULL);
- }
-
- g_list_foreach (objects, (GFunc) icalcomponent_free, NULL);
- g_list_free (objects);
- }
-
- set_status_message (tasks, NULL);
-
- g_free (sexp);
-}
-
-void
-e_tasks_open_task_id (ETasks *tasks,
- const gchar *src_uid,
- const gchar *comp_uid,
- const gchar *comp_rid)
-{
- ECal *client = NULL;
- GList *l;
- icalcomponent* icalcomp = NULL;
- icalproperty *attendee_prop = NULL;
-
- if (!src_uid || !comp_uid)
- return;
-
- for (l = tasks->priv->clients_list; l != NULL; l = l->next) {
- ESource *client_src;
-
- client = l->data;
- client_src = e_cal_get_source (client);
-
- if (!strcmp (src_uid, e_source_peek_uid (client_src)))
- break;
- }
-
- if (!client)
- return;
-
- e_cal_get_object (client, comp_uid, comp_rid, &icalcomp, NULL);
-
- if (!icalcomp)
- return;
-
- attendee_prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY);
- e_calendar_table_open_task (E_CALENDAR_TABLE (tasks->priv->tasks_view), client, icalcomp, attendee_prop != NULL);
- icalcomponent_free (icalcomp);
-
- return;
-}
diff --git a/calendar/gui/e-tasks.h b/calendar/gui/e-tasks.h
deleted file mode 100644
index a37db26117..0000000000
--- a/calendar/gui/e-tasks.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _E_TASKS_H_
-#define _E_TASKS_H_
-
-#include <bonobo/bonobo-ui-component.h>
-#include <gtk/gtk.h>
-#include <libedataserver/e-source.h>
-#include <libecal/e-cal.h>
-#include "e-calendar-table.h"
-
-#define E_TYPE_TASKS (e_tasks_get_type ())
-#define E_TASKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TASKS, ETasks))
-#define E_TASKS_CLASS(klass) (G_TYPE_CHECK_INSTANCE_CAST_CLASS ((klass), E_TYPE_TASKS, \
- ETasksClass))
-#define E_IS_TASKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TASKS))
-#define E_IS_TASKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TASKS))
-
-typedef struct _ETasks ETasks;
-typedef struct _ETasksClass ETasksClass;
-typedef struct _ETasksPrivate ETasksPrivate;
-
-struct _ETasks {
- GtkTable table;
-
- /* Private data */
- ETasksPrivate *priv;
-};
-
-struct _ETasksClass {
- GtkTableClass parent_class;
-
- /* Notification signals */
- void (* selection_changed) (ETasks *tasks, gint n_selected);
- void (* source_added) (ETasks *tasks, ESource *source);
- void (* source_removed) (ETasks *tasks, ESource *source);
-};
-
-GType e_tasks_get_type (void);
-GtkWidget *e_tasks_construct (ETasks *tasks);
-
-GtkWidget *e_tasks_new (void);
-
-gboolean e_tasks_add_todo_source (ETasks *tasks, ESource *source);
-gboolean e_tasks_remove_todo_source (ETasks *tasks, ESource *source);
-gboolean e_tasks_set_default_source (ETasks *tasks, ESource *source);
-void e_tasks_open_task (ETasks *tasks);
-void e_tasks_open_task_id (ETasks *tasks,
- const gchar *src_uid,
- const gchar *comp_uid,
- const gchar *comp_rid);
-void e_tasks_new_task (ETasks *tasks);
-void e_tasks_delete_completed (ETasks *tasks);
-
-#endif /* _E_TASKS_H_ */
diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c
index f3e239aa63..53a8a4498b 100644
--- a/calendar/gui/e-timezone-entry.c
+++ b/calendar/gui/e-timezone-entry.c
@@ -33,12 +33,16 @@
#include <glib/gi18n.h>
#include "e-timezone-entry.h"
+#define E_TIMEZONE_ENTRY_GET_PRIVATE(obj) \
+ (G_TYPE_INSTANCE_GET_PRIVATE \
+ ((obj), E_TYPE_TIMEZONE_ENTRY, ETimezoneEntryPrivate))
+
struct _ETimezoneEntryPrivate {
/* The current timezone, set in e_timezone_entry_set_timezone()
or from the timezone dialog. Note that we don't copy it or
use a ref count - we assume it is never destroyed for the
lifetime of this widget. */
- icaltimezone *zone;
+ icaltimezone *timezone;
/* This can be set to the default timezone. If the current timezone
setting in the ETimezoneEntry matches this, then the entry field
@@ -50,314 +54,320 @@ struct _ETimezoneEntryPrivate {
};
enum {
- CHANGED,
- LAST_SIGNAL
+ PROP_0,
+ PROP_TIMEZONE
};
-static void e_timezone_entry_destroy (GtkObject *object);
-
-static gboolean e_timezone_entry_mnemonic_activate (GtkWidget *widget,
- gboolean group_cycling);
-static gboolean e_timezone_entry_focus (GtkWidget *widget,
- GtkDirectionType direction);
-static void on_entry_changed (GtkEntry *entry,
- ETimezoneEntry *tentry);
-static void on_button_clicked (GtkWidget *widget,
- ETimezoneEntry *tentry);
-static void add_relation (ETimezoneEntry *tentry,
- GtkWidget *widget);
-
-static void e_timezone_entry_set_entry (ETimezoneEntry *tentry);
+enum {
+ CHANGED,
+ LAST_SIGNAL
+};
-static guint timezone_entry_signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE (ETimezoneEntry, e_timezone_entry, GTK_TYPE_HBOX)
static void
-e_timezone_entry_class_init (ETimezoneEntryClass *class)
+timezone_entry_emit_changed (ETimezoneEntry *timezone_entry)
{
- GtkObjectClass *object_class = (GtkObjectClass *) class;
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
-
- object_class = (GtkObjectClass*) class;
-
- widget_class->mnemonic_activate = e_timezone_entry_mnemonic_activate;
- widget_class->focus = e_timezone_entry_focus;
- timezone_entry_signals[CHANGED] =
- g_signal_new ("changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETimezoneEntryClass, changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- object_class->destroy = e_timezone_entry_destroy;
-
- class->changed = NULL;
+ g_signal_emit (timezone_entry, signals[CHANGED], 0);
}
static void
-e_timezone_entry_init (ETimezoneEntry *tentry)
+timezone_entry_update_entry (ETimezoneEntry *timezone_entry)
{
- ETimezoneEntryPrivate *priv;
- AtkObject *a11y;
-
- tentry->priv = priv = g_new0 (ETimezoneEntryPrivate, 1);
+ const gchar *display_name;
+ gchar *name_buffer;
+ icaltimezone *timezone;
- priv->zone = NULL;
- priv->default_zone = NULL;
+ timezone = e_timezone_entry_get_timezone (timezone_entry);
- priv->entry = gtk_entry_new ();
- gtk_editable_set_editable (GTK_EDITABLE (priv->entry), FALSE);
- /*gtk_widget_set_usize (priv->date_entry, 90, 0);*/
- gtk_box_pack_start (GTK_BOX (tentry), priv->entry, TRUE, TRUE, 0);
- gtk_widget_show (priv->entry);
- g_signal_connect (priv->entry, "changed", G_CALLBACK (on_entry_changed), tentry);
+ if (timezone != NULL) {
+ display_name = icaltimezone_get_display_name (timezone);
- priv->button = gtk_button_new_with_label (_("Select..."));
- g_signal_connect (priv->button, "clicked", G_CALLBACK (on_button_clicked), tentry);
- gtk_box_pack_start (GTK_BOX (tentry), priv->button, FALSE, FALSE, 6);
- gtk_widget_show (priv->button);
- a11y = gtk_widget_get_accessible (priv->button);
- if (a11y != NULL) {
- atk_object_set_name (a11y, _("Select Timezone"));
- }
-}
+ /* We check if it is one of our builtin timezone
+ names, in which case we call gettext to translate
+ it. If it isn't a builtin timezone name, we don't. */
+ if (icaltimezone_get_builtin_timezone (display_name))
+ display_name = _(display_name);
+ } else
+ display_name = "";
-/**
- * e_timezone_entry_new:
- *
- * Description: Creates a new #ETimezoneEntry widget which can be used
- * to provide an easy to use way for entering dates and times.
- *
- * Returns: a new #ETimezoneEntry widget.
- */
-GtkWidget *
-e_timezone_entry_new (void)
-{
- ETimezoneEntry *tentry;
+ name_buffer = g_strdup (display_name);
- tentry = g_object_new (e_timezone_entry_get_type (), NULL);
+ gtk_entry_set_text (GTK_ENTRY (timezone_entry->priv->entry), name_buffer);
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET(tentry), GTK_CAN_FOCUS);
+ /* XXX Do we need to hide the timezone entry at all? I know
+ * this overrules the previous case of hiding the timezone
+ * entry field when we select the default timezone. */
+ gtk_widget_show (timezone_entry->priv->entry);
- return GTK_WIDGET (tentry);
+ g_free (name_buffer);
}
-
static void
-e_timezone_entry_destroy (GtkObject *object)
+timezone_entry_add_relation (ETimezoneEntry *timezone_entry)
{
- ETimezoneEntry *tentry;
+ AtkObject *a11y_timezone_entry;
+ AtkObject *a11y_widget;
+ AtkRelationSet *set;
+ AtkRelation *relation;
+ GtkWidget *widget;
+ GPtrArray *target;
+ gpointer target_object;
- g_return_if_fail (E_IS_TIMEZONE_ENTRY (object));
+ /* add a labelled_by relation for widget for accessibility */
- tentry = E_TIMEZONE_ENTRY (object);
+ widget = GTK_WIDGET (timezone_entry);
+ a11y_timezone_entry = gtk_widget_get_accessible (widget);
- g_free (tentry->priv);
- tentry->priv = NULL;
+ widget = timezone_entry->priv->entry;
+ a11y_widget = gtk_widget_get_accessible (widget);
- if (GTK_OBJECT_CLASS (e_timezone_entry_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (e_timezone_entry_parent_class)->destroy) (object);
+ set = atk_object_ref_relation_set (a11y_widget);
+ if (set != NULL) {
+ relation = atk_relation_set_get_relation_by_type (
+ set, ATK_RELATION_LABELLED_BY);
+ /* check whether has a labelled_by relation already */
+ if (relation != NULL)
+ return;
+ }
+
+ set = atk_object_ref_relation_set (a11y_timezone_entry);
+ if (!set)
+ return;
+
+ relation = atk_relation_set_get_relation_by_type (
+ set, ATK_RELATION_LABELLED_BY);
+ if (relation != NULL) {
+ target = atk_relation_get_target (relation);
+ target_object = g_ptr_array_index (target, 0);
+ if (ATK_IS_OBJECT (target_object)) {
+ atk_object_add_relationship (
+ a11y_widget,
+ ATK_RELATION_LABELLED_BY,
+ ATK_OBJECT (target_object));
+ }
+ }
}
/* The arrow button beside the date field has been clicked, so we show the
popup with the ECalendar in. */
static void
-on_button_clicked (GtkWidget *widget,
- ETimezoneEntry *tentry)
+timezone_entry_button_clicked_cb (ETimezoneEntry *timezone_entry)
{
- ETimezoneEntryPrivate *priv;
ETimezoneDialog *timezone_dialog;
GtkWidget *dialog;
-
- priv = tentry->priv;
+ icaltimezone *timezone;
timezone_dialog = e_timezone_dialog_new ();
- e_timezone_dialog_set_timezone (timezone_dialog, priv->zone);
+ timezone = e_timezone_entry_get_timezone (timezone_entry);
+ e_timezone_dialog_set_timezone (timezone_dialog, timezone);
dialog = e_timezone_dialog_get_toplevel (timezone_dialog);
- if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
- priv->zone = e_timezone_dialog_get_timezone (timezone_dialog);
- e_timezone_entry_set_entry (tentry);
- }
+ if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT)
+ goto exit;
+ timezone = e_timezone_dialog_get_timezone (timezone_dialog);
+ e_timezone_entry_set_timezone (timezone_entry, timezone);
+ timezone_entry_update_entry (timezone_entry);
+
+exit:
g_object_unref (timezone_dialog);
}
static void
-on_entry_changed (GtkEntry *entry,
- ETimezoneEntry *tentry)
+timezone_entry_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- g_signal_emit (GTK_OBJECT (tentry), timezone_entry_signals[CHANGED], 0);
-}
-
-icaltimezone*
-e_timezone_entry_get_timezone (ETimezoneEntry *tentry)
-{
- ETimezoneEntryPrivate *priv;
-
- g_return_val_if_fail (E_IS_TIMEZONE_ENTRY (tentry), NULL);
-
- priv = tentry->priv;
+ switch (property_id) {
+ case PROP_TIMEZONE:
+ e_timezone_entry_set_timezone (
+ E_TIMEZONE_ENTRY (object),
+ g_value_get_pointer (value));
+ return;
+ }
- return priv->zone;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
static void
-add_relation (ETimezoneEntry *tentry,
- GtkWidget *widget)
+timezone_entry_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- AtkObject *a11ytentry, *a11yWidget;
- AtkRelationSet *set;
- AtkRelation *relation;
- GPtrArray *target;
- gpointer target_object;
-
- /* add a labelled_by relation for widget for accessibility */
-
- a11ytentry = gtk_widget_get_accessible (GTK_WIDGET (tentry));
- a11yWidget = gtk_widget_get_accessible (widget);
-
- set = atk_object_ref_relation_set (a11yWidget);
- if (set != NULL) {
- relation = atk_relation_set_get_relation_by_type (set,
- ATK_RELATION_LABELLED_BY);
- /* check whether has a labelled_by relation already */
- if (relation != NULL)
+ switch (property_id) {
+ case PROP_TIMEZONE:
+ g_value_set_pointer (
+ value, e_timezone_entry_get_timezone (
+ E_TIMEZONE_ENTRY (object)));
return;
}
- set = atk_object_ref_relation_set (a11ytentry);
- if (!set)
- return;
-
- relation = atk_relation_set_get_relation_by_type (set,
- ATK_RELATION_LABELLED_BY);
- if (relation != NULL) {
- target = atk_relation_get_target (relation);
- target_object = g_ptr_array_index (target, 0);
- if (ATK_IS_OBJECT (target_object)) {
- atk_object_add_relationship (a11yWidget,
- ATK_RELATION_LABELLED_BY,
- ATK_OBJECT (target_object));
- }
- }
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-void
-e_timezone_entry_set_timezone (ETimezoneEntry *tentry,
- icaltimezone *zone)
+static gboolean
+timezone_entry_mnemonic_activate (GtkWidget *widget,
+ gboolean group_cycling)
{
ETimezoneEntryPrivate *priv;
- g_return_if_fail (E_IS_TIMEZONE_ENTRY (tentry));
+ priv = E_TIMEZONE_ENTRY_GET_PRIVATE (widget);
- priv = tentry->priv;
-
- priv->zone = zone;
-
- e_timezone_entry_set_entry (tentry);
+ if (GTK_WIDGET_CAN_FOCUS (widget)) {
+ if (priv->button != NULL)
+ gtk_widget_grab_focus (priv->button);
+ }
- add_relation (tentry, priv->entry);
+ return TRUE;
}
-/* Sets the default timezone. If the current timezone matches this, then the
- entry field is hidden. This is useful since most people do not use timezones
- so it makes the user interface simpler. */
-void
-e_timezone_entry_set_default_timezone (ETimezoneEntry *tentry,
- icaltimezone *zone)
+static gboolean
+timezone_entry_focus (GtkWidget *widget,
+ GtkDirectionType direction)
{
ETimezoneEntryPrivate *priv;
- g_return_if_fail (E_IS_TIMEZONE_ENTRY (tentry));
+ priv = E_TIMEZONE_ENTRY_GET_PRIVATE (widget);
- priv = tentry->priv;
+ if (direction == GTK_DIR_TAB_FORWARD) {
+ if (GTK_WIDGET_HAS_FOCUS (priv->entry))
+ gtk_widget_grab_focus (priv->button);
+ else if (GTK_WIDGET_HAS_FOCUS (priv->button))
+ return FALSE;
+ else if (GTK_WIDGET_VISIBLE (priv->entry))
+ gtk_widget_grab_focus (priv->entry);
+ else
+ gtk_widget_grab_focus (priv->button);
- priv->default_zone = zone;
+ } else if (direction == GTK_DIR_TAB_BACKWARD) {
+ if (GTK_WIDGET_HAS_FOCUS (priv->entry))
+ return FALSE;
+ else if (GTK_WIDGET_HAS_FOCUS (priv->button)) {
+ if (GTK_WIDGET_VISIBLE (priv->entry))
+ gtk_widget_grab_focus (priv->entry);
+ else
+ return FALSE;
+ } else
+ gtk_widget_grab_focus (priv->button);
+ } else
+ return FALSE;
- e_timezone_entry_set_entry (tentry);
+ return TRUE;
}
static void
-e_timezone_entry_set_entry (ETimezoneEntry *tentry)
+e_timezone_entry_class_init (ETimezoneEntryClass *class)
{
- ETimezoneEntryPrivate *priv;
- const gchar *display_name;
- gchar *name_buffer;
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+
+ g_type_class_add_private (class, sizeof (ETimezoneEntryPrivate));
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = timezone_entry_set_property;
+ object_class->get_property = timezone_entry_get_property;
+
+ widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->mnemonic_activate = timezone_entry_mnemonic_activate;
+ widget_class->focus = timezone_entry_focus;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_TIMEZONE,
+ g_param_spec_pointer (
+ "timezone",
+ "Timezone",
+ NULL,
+ G_PARAM_READWRITE));
+
+ signals[CHANGED] = g_signal_new (
+ "changed",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETimezoneEntryClass, changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+}
- priv = tentry->priv;
+static void
+e_timezone_entry_init (ETimezoneEntry *timezone_entry)
+{
+ AtkObject *a11y;
+ GtkWidget *widget;
- if (priv->zone) {
- display_name = icaltimezone_get_display_name (priv->zone);
+ timezone_entry->priv = E_TIMEZONE_ENTRY_GET_PRIVATE (timezone_entry);
- /* We check if it is one of our builtin timezone
- names, in which case we call gettext to translate
- it. If it isn't a builtin timezone name, we
- don't. */
- if (icaltimezone_get_builtin_timezone (display_name))
- display_name = _(display_name);
- } else
- display_name = "";
+ GTK_WIDGET_SET_FLAGS (GTK_WIDGET (timezone_entry), GTK_CAN_FOCUS);
- name_buffer = g_strdup (display_name);
+ widget = gtk_entry_new ();
+ gtk_editable_set_editable (GTK_EDITABLE (widget), FALSE);
+ gtk_box_pack_start (GTK_BOX (timezone_entry), widget, TRUE, TRUE, 0);
+ timezone_entry->priv->entry = widget;
+ gtk_widget_show (widget);
- gtk_entry_set_text (GTK_ENTRY (priv->entry), name_buffer);
+ g_signal_connect_swapped (
+ widget, "changed",
+ G_CALLBACK (timezone_entry_emit_changed), timezone_entry);
- /* do we need to hide the timezone entry at all? i know this overrules the previous case of hiding the timezone
- * entry field when we select the default timezone
- */
- gtk_widget_show (priv->entry);
+ widget = gtk_button_new_with_label (_("Select..."));
+ gtk_box_pack_start (GTK_BOX (timezone_entry), widget, FALSE, FALSE, 6);
+ timezone_entry->priv->button = widget;
+ gtk_widget_show (widget);
- g_free (name_buffer);
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (timezone_entry_button_clicked_cb), timezone_entry);
+
+ a11y = gtk_widget_get_accessible (timezone_entry->priv->button);
+ if (a11y != NULL)
+ atk_object_set_name (a11y, _("Select Timezone"));
}
-static gboolean
-e_timezone_entry_mnemonic_activate (GtkWidget *widget,
- gboolean group_cycling)
+GtkWidget *
+e_timezone_entry_new (void)
{
- GtkButton *button = NULL;
+ return g_object_new (E_TYPE_TIMEZONE_ENTRY, NULL);
+}
- if (GTK_WIDGET_CAN_FOCUS (widget)) {
- button = GTK_BUTTON (((ETimezoneEntryPrivate *) ((ETimezoneEntry *) widget)->priv)->button);
- if (button != NULL)
- gtk_widget_grab_focus (GTK_WIDGET (button));
- }
+icaltimezone *
+e_timezone_entry_get_timezone (ETimezoneEntry *timezone_entry)
+{
+ g_return_val_if_fail (E_IS_TIMEZONE_ENTRY (timezone_entry), NULL);
- return TRUE;
+ return timezone_entry->priv->timezone;
}
-static gboolean
-e_timezone_entry_focus (GtkWidget *widget, GtkDirectionType direction)
+void
+e_timezone_entry_set_timezone (ETimezoneEntry *timezone_entry,
+ icaltimezone *timezone)
{
- ETimezoneEntry *tentry;
+ g_return_if_fail (E_IS_TIMEZONE_ENTRY (timezone_entry));
- tentry = E_TIMEZONE_ENTRY (widget);
+ timezone_entry->priv->timezone = timezone;
- if (direction == GTK_DIR_TAB_FORWARD) {
- if (GTK_WIDGET_HAS_FOCUS (tentry->priv->entry))
- gtk_widget_grab_focus (tentry->priv->button);
- else if (GTK_WIDGET_HAS_FOCUS (tentry->priv->button))
- return FALSE;
- else if (GTK_WIDGET_VISIBLE (tentry->priv->entry))
- gtk_widget_grab_focus (tentry->priv->entry);
- else
- gtk_widget_grab_focus (tentry->priv->button);
- } else if (direction == GTK_DIR_TAB_BACKWARD) {
- if (GTK_WIDGET_HAS_FOCUS (tentry->priv->entry))
- return FALSE;
- else if (GTK_WIDGET_HAS_FOCUS (tentry->priv->button)) {
- if (GTK_WIDGET_VISIBLE (tentry->priv->entry))
- gtk_widget_grab_focus (tentry->priv->entry);
- else
- return FALSE;
- } else
- gtk_widget_grab_focus (tentry->priv->button);
- } else
- return FALSE;
- return TRUE;
+ timezone_entry_update_entry (timezone_entry);
+ timezone_entry_add_relation (timezone_entry);
+
+ g_object_notify (G_OBJECT (timezone_entry), "timezone");
}
+/* Sets the default timezone. If the current timezone matches this,
+ * then the entry field is hidden. This is useful since most people
+ * do not use timezones so it makes the user interface simpler. */
+void
+e_timezone_entry_set_default_timezone (ETimezoneEntry *timezone_entry,
+ icaltimezone *timezone)
+{
+ g_return_if_fail (E_IS_TIMEZONE_ENTRY (timezone_entry));
+
+ timezone_entry->priv->default_zone = timezone;
+
+ timezone_entry_update_entry (timezone_entry);
+}
diff --git a/calendar/gui/e-timezone-entry.h b/calendar/gui/e-timezone-entry.h
index c1bf482aef..6c0cd1dc6b 100644
--- a/calendar/gui/e-timezone-entry.h
+++ b/calendar/gui/e-timezone-entry.h
@@ -29,50 +29,61 @@
* timezone.
*/
-#ifndef __E_TIMEZONE_ENTRY_H_
-#define __E_TIMEZONE_ENTRY_H_
+#ifndef E_TIMEZONE_ENTRY_H
+#define E_TIMEZONE_ENTRY_H
#include <gtk/gtk.h>
#include <libecal/e-cal.h>
-G_BEGIN_DECLS
+/* Standard GObject macros */
+#define E_TYPE_TIMEZONE_ENTRY \
+ (e_timezone_entry_get_type ())
+#define E_TIMEZONE_ENTRY(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_TIMEZONE_ENTRY, ETimezoneEntry))
+#define E_TIMEZONE_ENTRY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_TIMEZONE_ENTRY, ETimezoneEntryClass))
+#define E_IS_TIMEZONE_ENTRY(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_TIMEZONE_ENTRY))
+#define E_IS_TIMEZONE_ENTRY_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_TIMEZONE_ENTRY))
+#define E_IS_TIMEZONE_ENTRY_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_TIMEZONE_ENTRY, ETimezoneEntryClass))
-#define E_TYPE_TIMEZONE_ENTRY (e_timezone_entry_get_type ())
-#define E_TIMEZONE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TIMEZONE_ENTRY, ETimezoneEntry))
-#define E_TIMEZONE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TIMEZONE_ENTRY, ETimezoneEntryClass))
-#define E_IS_TIMEZONE_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TIMEZONE_ENTRY))
-#define E_IS_TIMEZONE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TIMEZONE_ENTRY))
+G_BEGIN_DECLS
-typedef struct _ETimezoneEntry ETimezoneEntry;
+typedef struct _ETimezoneEntry ETimezoneEntry;
+typedef struct _ETimezoneEntryClass ETimezoneEntryClass;
typedef struct _ETimezoneEntryPrivate ETimezoneEntryPrivate;
-typedef struct _ETimezoneEntryClass ETimezoneEntryClass;
struct _ETimezoneEntry {
- GtkHBox hbox;
-
- /*< private >*/
+ GtkHBox parent;
ETimezoneEntryPrivate *priv;
};
struct _ETimezoneEntryClass {
GtkHBoxClass parent_class;
- void (* changed) (ETimezoneEntry *tentry);
+ void (*changed) (ETimezoneEntry *timezone_entry);
};
-GType e_timezone_entry_get_type (void);
-GtkWidget* e_timezone_entry_new (void);
-
-icaltimezone* e_timezone_entry_get_timezone (ETimezoneEntry *tentry);
-void e_timezone_entry_set_timezone (ETimezoneEntry *tentry,
- icaltimezone *zone);
+GType e_timezone_entry_get_type (void);
+GtkWidget * e_timezone_entry_new (void);
+icaltimezone * e_timezone_entry_get_timezone (ETimezoneEntry *timezone_entry);
+void e_timezone_entry_set_timezone (ETimezoneEntry *timezone_entry,
+ icaltimezone *timezone);
-/* Sets the default timezone. If the current timezone matches this, then the
- entry field is hidden. This is useful since most people do not use timezones
- so it makes the user interface simpler. */
-void e_timezone_entry_set_default_timezone(ETimezoneEntry *tentry,
- icaltimezone *zone);
+/* Sets the default timezone. If the current timezone matches this,
+ * then the entry field is hidden. This is useful since most people
+ * do not use timezones so it makes the user interface simpler. */
+void e_timezone_entry_set_default_timezone
+ (ETimezoneEntry *timezone_entry,
+ icaltimezone *timezone);
G_END_DECLS
-#endif /* __E_TIMEZONE_ENTRY_H_ */
+#endif /* E_TIMEZONE_ENTRY_H */
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 6283e6b8dd..4944630727 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -723,14 +723,16 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
}
-/* We do this check since the calendar items are downloaded from the server in the open_method,
- since the default timezone might not be set there */
+/* We do this check since the calendar items are downloaded from the server
+ * in the open_method, since the default timezone might not be set there. */
static void
-ensure_dates_are_in_default_zone (icalcomponent *icalcomp)
+ensure_dates_are_in_default_zone (GnomeCalendar *gcal,
+ icalcomponent *icalcomp)
{
icaltimetype dt;
- icaltimezone *zone = calendar_config_get_icaltimezone ();
+ icaltimezone *zone;
+ zone = gnome_calendar_get_timezone (gcal);
if (!zone)
return;
@@ -761,7 +763,7 @@ dn_e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer data)
for (l = objects; l; l = l->next) {
ECalComponent *comp = NULL;
- ensure_dates_are_in_default_zone (l->data);
+ ensure_dates_are_in_default_zone (gcal, l->data);
comp = e_cal_component_new ();
if (!e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data))) {
g_object_unref (comp);
diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c
deleted file mode 100644
index 2e45ad4ec9..0000000000
--- a/calendar/gui/memos-component.c
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Rodrigo Moya <rodrigo@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <glib/gi18n-lib.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-exception.h>
-#include <gconf/gconf-client.h>
-#include <libecal/e-cal.h>
-#include <libedataserver/e-data-server-util.h>
-#include <libedataserverui/e-source-selector.h>
-#include <shell/e-user-creatable-items-handler.h>
-#include <shell/e-component-view.h>
-#include "e-cal-model.h"
-#include "e-memos.h"
-#include "memos-component.h"
-#include "memos-control.h"
-#include "e-comp-editor-registry.h"
-#include "migration.h"
-#include "comp-util.h"
-#include "calendar-config.h"
-#include "e-cal-popup.h"
-#include "common/authentication.h"
-#include "dialogs/calendar-setup.h"
-#include "dialogs/comp-editor.h"
-#include "dialogs/copy-source-dialog.h"
-#include "dialogs/memo-editor.h"
-#include "widgets/misc/e-info-label.h"
-#include "e-util/e-error.h"
-#include "calendar-component.h"
-
-#define CREATE_MEMO_ID "memo"
-#define CREATE_SHARED_MEMO_ID "shared-memo"
-#define CREATE_MEMO_LIST_ID "memo-list"
-
-#define WEB_BASE_URI "webcal://"
-#define PERSONAL_RELATIVE_URI "system"
-
-#define PARENT_TYPE bonobo_object_get_type ()
-
-static BonoboObjectClass *parent_class = NULL;
-
-typedef struct _MemosComponentView
-{
- ESourceList *source_list;
-
- GSList *source_selection;
-
- EMemos *memos;
- ETable *table;
- ETableModel *model;
-
- GtkWidget *source_selector;
-
- GList *notifications;
-
-} MemosComponentView;
-
-struct _MemosComponentPrivate {
-
- ESourceList *source_list;
- GSList *source_selection;
-
- ECal *create_ecal;
-
- GList *notifications;
-};
-
-#define d(x)
-
-/* Utility functions. */
-/* FIXME Some of these are duplicated from calendar-component.c */
-static gboolean
-is_in_selection (GSList *selection, ESource *source)
-{
- GSList *l;
-
- for (l = selection; l; l = l->next) {
- ESource *selected_source = l->data;
-
- if (!strcmp (e_source_peek_uid (selected_source), e_source_peek_uid (source)))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-is_in_uids (GSList *uids, ESource *source)
-{
- GSList *l;
-
- for (l = uids; l; l = l->next) {
- const gchar *uid = l->data;
-
- if (!strcmp (uid, e_source_peek_uid (source)))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-source_selection_changed_cb (ESourceSelector *selector, MemosComponentView *component_view)
-{
- GSList *selection, *l, *uids_selected = NULL;
-
- selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (component_view->source_selector));
-
- for (l = component_view->source_selection; l; l = l->next) {
- ESource *old_selected_source = l->data;
-
- if (!is_in_selection (selection, old_selected_source))
- e_memos_remove_memo_source (component_view->memos, old_selected_source);
- }
-
- for (l = selection; l; l = l->next) {
- ESource *selected_source = l->data;
-
- e_memos_add_memo_source (component_view->memos, selected_source);
- uids_selected = g_slist_append (uids_selected, (gchar *)e_source_peek_uid (selected_source));
- }
-
- e_source_selector_free_selection (component_view->source_selection);
- component_view->source_selection = selection;
-
- /* Save the selection for next time we start up */
- calendar_config_set_memos_selected (uids_selected);
- g_slist_free (uids_selected);
-}
-
-/* Evolution::Component CORBA methods */
-
-static gboolean
-selector_tree_data_dropped (ESourceSelector *selector,
- GtkSelectionData *data,
- ESource *destination,
- GdkDragAction action,
- guint info,
- MemosComponent *component)
-{
- gboolean success = FALSE;
- icalcomponent *icalcomp = NULL;
- ECal *client = NULL;
- GSList *components, *p;
-
- client = auth_new_cal_from_source (
- destination, E_CAL_SOURCE_TYPE_JOURNAL);
-
- if (!client || !e_cal_open (client, TRUE, NULL))
- goto finish;
-
- components = cal_comp_selection_get_string_list (data);
- success = components != NULL;
- for (p = components; p && success; p = p->next) {
- gchar *comp_str; /* do not free this! */
-
- /* p->data is "source_uid\ncomponent_string" */
- comp_str = strchr (p->data, '\n');
- if (!comp_str)
- continue;
-
- comp_str [0] = 0;
- comp_str++;
- icalcomp = icalparser_parse_string (comp_str);
-
- if (!icalcomp)
- continue;
-
- success = cal_comp_process_source_list_drop (client, icalcomp, action, p->data, component->priv->source_list);
- icalcomponent_free (icalcomp);
- }
-
- g_slist_foreach (components, (GFunc)g_free, NULL);
- g_slist_free (components);
-
- finish:
- if (client)
- g_object_unref (client);
-
- return success;
-}
-
-static void
-config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- MemosComponent *component = data;
- MemosComponentPrivate *priv;
-
- priv = component->priv;
-
- g_object_unref (priv->create_ecal);
- priv->create_ecal = NULL;
-
- priv->notifications = g_list_remove (priv->notifications, GUINT_TO_POINTER (id));
-}
-
-static ECal *
-setup_create_ecal (MemosComponent *component, MemosComponentView *component_view)
-{
- MemosComponentPrivate *priv;
- ESource *source = NULL;
- gchar *uid;
- guint not;
-
- priv = component->priv;
-
- if (component_view) {
- ECal *default_ecal;
-
- default_ecal = e_memos_get_default_client (component_view->memos);
- if (default_ecal)
- return default_ecal;
- }
-
- if (priv->create_ecal)
- return priv->create_ecal;
-
- /* Get the current primary calendar, or try to set one if it doesn't already exist */
- uid = calendar_config_get_primary_memos ();
- if (uid) {
- source = e_source_list_peek_source_by_uid (priv->source_list, uid);
- g_free (uid);
-
- priv->create_ecal = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
- }
-
- if (!priv->create_ecal) {
- /* Try to create a default if there isn't one */
- source = e_source_list_peek_source_any (priv->source_list);
- if (source)
- priv->create_ecal = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL);
- }
-
- if (priv->create_ecal) {
-
- if (!e_cal_open (priv->create_ecal, FALSE, NULL)) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
- _("Unable to open the memo list '%s' for creating events and meetings"),
- e_source_peek_name (source));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- return NULL;
- }
-
- } else {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
- "%s", _("There is no calendar available for creating memos"));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- return NULL;
- }
-
- /* Handle the fact it may change on us */
- not = calendar_config_add_notification_primary_memos (config_create_ecal_changed_cb,
- component);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* Save the primary source for use elsewhere */
- calendar_config_set_primary_memos (e_source_peek_uid (source));
-
- return priv->create_ecal;
-}
-
-/* Ensures the calendar is selected */
-static void
-object_created_cb (CompEditor *ce, EMemoTable *memo_table)
-{
- g_return_if_fail (memo_table != NULL);
-
- memo_table->user_created_cal = comp_editor_get_client (ce);
- g_signal_emit_by_name (memo_table, "user_created");
- memo_table->user_created_cal = NULL;
-}
-
-static gboolean
-create_new_memo (MemosComponent *memo_component, gboolean is_assigned, MemosComponentView *component_view)
-{
- ECal *ecal;
- ECalComponent *comp;
- CompEditor *editor;
- CompEditorFlags flags = 0;
-
- ecal = setup_create_ecal (memo_component, component_view);
- if (!ecal)
- return FALSE;
-
- flags |= COMP_EDITOR_NEW_ITEM;
- if (is_assigned) {
- flags |= COMP_EDITOR_IS_SHARED;
- flags |= COMP_EDITOR_USER_ORG;
- }
-
- editor = memo_editor_new (ecal, flags);
- comp = cal_comp_memo_new_with_defaults (ecal);
-
- if (component_view)
- g_signal_connect (editor, "object_created", G_CALLBACK (object_created_cb), e_memos_get_calendar_table (component_view->memos));
-
- comp_editor_edit_comp (editor, comp);
- gtk_window_present (GTK_WINDOW (editor));
-
- e_comp_editor_registry_add (comp_editor_registry, editor, TRUE);
-
- return TRUE;
-}
-
-static MemosComponentView *
-create_component_view (MemosComponent *memos_component)
-{
- MemosComponentPrivate *priv;
- MemosComponentView *component_view;
- GtkWidget *statusbar_widget;
-
- priv = memos_component->priv;
-
- /* Create the calendar component view */
- component_view = g_new0 (MemosComponentView, 1);
-
- /* Create sidebar selector */
- g_signal_connect (component_view->source_selector, "drag-data-received",
- G_CALLBACK (selector_tree_drag_data_received), memos_component);
-
- component_view->memos = (EMemos *) bonobo_control_get_widget (component_view->view_control);
- component_view->table = e_memo_table_get_table (e_memos_get_calendar_table (component_view->memos));
- component_view->model = E_TABLE_MODEL (e_memo_table_get_model (e_memos_get_calendar_table (component_view->memos)));
-
- /* connect after setting the initial selections, or we'll get unwanted calls
- to calendar_control_sensitize_calendar_commands */
- g_signal_connect (component_view->source_selector, "selection_changed",
- G_CALLBACK (source_selection_changed_cb), component_view);
- g_signal_connect (component_view->source_selector, "primary_selection_changed",
- G_CALLBACK (primary_source_selection_changed_cb), component_view);
-
- return component_view;
-}
-
-static void
-destroy_component_view (MemosComponentView *component_view)
-{
- GList *l;
-
- if (component_view->source_list)
- g_object_unref (component_view->source_list);
-
- if (component_view->source_selection)
- e_source_selector_free_selection (component_view->source_selection);
-
- for (l = component_view->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
- g_list_free (component_view->notifications);
-
- g_free (component_view);
-}
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- MemosComponent *memos_component = MEMOS_COMPONENT (object);
- MemosComponentPrivate *priv = memos_component->priv;
- GList *l;
-
- if (priv->source_list != NULL) {
- g_object_unref (priv->source_list);
- priv->source_list = NULL;
- }
- if (priv->source_selection != NULL) {
- e_source_selector_free_selection (priv->source_selection);
- priv->source_selection = NULL;
- }
-
- if (priv->create_ecal) {
- g_object_unref (priv->create_ecal);
- priv->create_ecal = NULL;
- }
-
- for (l = priv->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
- g_list_free (priv->notifications);
- priv->notifications = NULL;
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
diff --git a/calendar/gui/memos-component.h b/calendar/gui/memos-component.h
deleted file mode 100644
index b46095c629..0000000000
--- a/calendar/gui/memos-component.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Rodrigo Moya <rodrigo@ximian.com>
- * Nathan Owens <pianocomp81@yahoo.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _MEMOS_COMPONENT_H_
-#define _MEMOS_COMPONENT_H_
-
-#include <bonobo/bonobo-object.h>
-#include <libedataserver/e-source-list.h>
-#include <widgets/misc/e-activity-handler.h>
-#include "Evolution.h"
-
-#define MEMOS_TYPE_COMPONENT (memos_component_get_type ())
-#define MEMOS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MEMOS_TYPE_COMPONENT, MemosComponent))
-#define MEMOS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MEMOS_TYPE_COMPONENT, MemosComponentClass))
-#define MEMOS_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MEMOS_TYPE_COMPONENT))
-#define MEMOS_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MEMOS_TYPE_COMPONENT))
-
-typedef struct _MemosComponent MemosComponent;
-typedef struct _MemosComponentPrivate MemosComponentPrivate;
-typedef struct _MemosComponentClass MemosComponentClass;
-
-struct _MemosComponent {
- BonoboObject parent;
-
- MemosComponentPrivate *priv;
-};
-
-struct _MemosComponentClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Component__epv epv;
-};
-
-GType memos_component_get_type (void);
-MemosComponent *memos_component_peek (void);
-
-#endif /* _MEMOS_COMPONENT_H_ */
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
deleted file mode 100644
index 02783496f6..0000000000
--- a/calendar/gui/tasks-component.c
+++ /dev/null
@@ -1,801 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-#include <glib/gi18n-lib.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-exception.h>
-#include <gconf/gconf-client.h>
-#include <libecal/e-cal.h>
-#include <libedataserver/e-data-server-util.h>
-#include <libedataserver/e-url.h>
-#include <libedataserverui/e-source-selector.h>
-#include <shell/e-user-creatable-items-handler.h>
-#include <shell/e-component-view.h>
-#include "e-cal-model.h"
-#include "e-tasks.h"
-#include "tasks-component.h"
-#include "tasks-control.h"
-#include "e-comp-editor-registry.h"
-#include "migration.h"
-#include "comp-util.h"
-#include "calendar-config.h"
-#include "e-cal-popup.h"
-#include "common/authentication.h"
-#include "dialogs/calendar-setup.h"
-#include "dialogs/comp-editor.h"
-#include "dialogs/copy-source-dialog.h"
-#include "dialogs/task-editor.h"
-#include "misc/e-info-label.h"
-#include "e-util/e-error.h"
-
-#define CREATE_TASK_ID "task"
-#define CREATE_TASK_ASSIGNED_ID "task-assigned"
-#define CREATE_TASK_LIST_ID "task-list"
-
-#define WEB_BASE_URI "webcal://"
-#define PERSONAL_RELATIVE_URI "system"
-
-#define PARENT_TYPE bonobo_object_get_type ()
-
-static BonoboObjectClass *parent_class = NULL;
-
-typedef struct
-{
- ESourceList *source_list;
-
- GSList *source_selection;
-
- ETasks *tasks;
- ETable *table;
- ETableModel *model;
-
- GtkWidget *source_selector;
-
- BonoboControl *view_control;
-
- GList *notifications;
-
-} TasksComponentView;
-
-struct _TasksComponentPrivate {
-
- ESourceList *source_list;
- GSList *source_selection;
-
- GList *views;
-
- ECal *create_ecal;
-
- GList *notifications;
-};
-
-/* Utility functions. */
-/* FIXME Some of these are duplicated from calendar-component.c */
-static gboolean
-is_in_selection (GSList *selection, ESource *source)
-{
- GSList *l;
-
- for (l = selection; l; l = l->next) {
- ESource *selected_source = l->data;
-
- if (!strcmp (e_source_peek_uid (selected_source), e_source_peek_uid (source)))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-is_in_uids (GSList *uids, ESource *source)
-{
- GSList *l;
-
- for (l = uids; l; l = l->next) {
- const gchar *uid = l->data;
-
- if (!strcmp (uid, e_source_peek_uid (source)))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-update_uris_for_selection (TasksComponentView *component_view)
-{
- GSList *selection, *l, *uids_selected = NULL;
-
- selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (component_view->source_selector));
-
- for (l = component_view->source_selection; l; l = l->next) {
- ESource *old_selected_source = l->data;
-
- if (!is_in_selection (selection, old_selected_source))
- e_tasks_remove_todo_source (component_view->tasks, old_selected_source);
- }
-
- for (l = selection; l; l = l->next) {
- ESource *selected_source = l->data;
-
- e_tasks_add_todo_source (component_view->tasks, selected_source);
- uids_selected = g_slist_append (uids_selected, (gchar *)e_source_peek_uid (selected_source));
- }
-
- e_source_selector_free_selection (component_view->source_selection);
- component_view->source_selection = selection;
-
- /* Save the selection for next time we start up */
- calendar_config_set_tasks_selected (uids_selected);
- g_slist_free (uids_selected);
-}
-
-static void
-update_uri_for_primary_selection (TasksComponentView *component_view)
-{
- ESource *source;
- ECalendarTable *cal_table;
- ETable *etable;
-
- source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!source)
- return;
-
- /* Set the default */
- e_tasks_set_default_source (component_view->tasks, source);
-
- cal_table = e_tasks_get_calendar_table (component_view->tasks);
- etable = e_calendar_table_get_table (cal_table);
-
- tasks_control_sensitize_commands (component_view->view_control, component_view->tasks, e_table_selected_count (etable));
-
- /* Save the selection for next time we start up */
- calendar_config_set_primary_tasks (e_source_peek_uid (source));
-}
-
-/* Callbacks. */
-static void
-copy_task_list_cb (EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- TasksComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- copy_source_dialog (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source, E_CAL_SOURCE_TYPE_TODO);
-}
-
-static void
-delete_task_list_cb (EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- TasksComponentView *component_view = data;
- ESource *selected_source;
- ECal *cal;
- gchar *uri;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- if (e_error_run((GtkWindow *)gtk_widget_get_toplevel(ep->target->widget),
- "calendar:prompt-delete-task-list", e_source_peek_name(selected_source), NULL) != GTK_RESPONSE_YES)
- return;
-
- /* first, ask the backend to remove the task list */
- uri = e_source_get_uri (selected_source);
- cal = e_cal_model_get_client_for_uri (
- e_calendar_table_get_model (E_CALENDAR_TABLE (e_tasks_get_calendar_table (component_view->tasks))),
- uri);
- if (!cal)
- cal = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_TODO);
- g_free (uri);
- if (cal) {
- if (e_cal_remove (cal, NULL)) {
- if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (component_view->source_selector),
- selected_source)) {
- e_tasks_remove_todo_source (component_view->tasks, selected_source);
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector),
- selected_source);
- }
-
- e_source_group_remove_source (e_source_peek_group (selected_source), selected_source);
- e_source_list_sync (component_view->source_list, NULL);
- }
- }
-}
-
-static void
-new_task_list_cb (EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- calendar_setup_new_task_list (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)));
-}
-
-static void
-rename_task_list_cb (EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- TasksComponentView *component_view = data;
- ESourceSelector *selector;
-
- selector = E_SOURCE_SELECTOR (component_view->source_selector);
- e_source_selector_edit_primary_selection (selector);
-}
-
-static void
-edit_task_list_cb (EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- TasksComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- calendar_setup_edit_task_list (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source);
-}
-
-static void
-set_offline_availability (EPopup *ep, EPopupItem *pitem, gpointer data, const gchar *value)
-{
- TasksComponentView *component_view = data;
- ESource *selected_source;
-
- selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector));
- if (!selected_source)
- return;
-
- e_source_set_property (selected_source, "offline_sync", value);
-}
-
-static void
-mark_no_offline_cb (EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- set_offline_availability (ep, pitem, data, "0");
-}
-
-static void
-mark_offline_cb (EPopup *ep, EPopupItem *pitem, gpointer data)
-{
- set_offline_availability (ep, pitem, data, "1");
-}
-
-static EPopupItem etc_source_popups[] = {
- { E_POPUP_ITEM, (gchar *) "10.new", (gchar *) N_("_New Task List"), new_task_list_cb, NULL, (gchar *) "stock_todo", 0, 0 },
- { E_POPUP_ITEM, (gchar *) "15.copy", (gchar *) N_("_Copy..."), copy_task_list_cb, NULL, (gchar *) "edit-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, (gchar *) "18.rename", (gchar *) N_("_Rename..."), rename_task_list_cb, NULL, NULL, 0, E_CAL_POPUP_SOURCE_PRIMARY },
-
- { E_POPUP_BAR, (gchar *) "20.bar" },
- { E_POPUP_ITEM, (gchar *) "20.delete", (gchar *) N_("_Delete"), delete_task_list_cb, NULL, (gchar *) "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY },
- { E_POPUP_ITEM, (gchar *) "30.mark_tasks_offline", (gchar *) N_("_Make available for offline use"), mark_offline_cb, NULL, (gchar *) "stock_disconnect", E_CAL_POPUP_SOURCE_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_OFFLINE },
- { E_POPUP_ITEM, (gchar *) "40.mark_tasks_no_offline", (gchar *) N_("_Do not make available for offline use"), mark_no_offline_cb, NULL, (gchar *) "stock_connect", E_CAL_POPUP_SOURCE_NO_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_NO_OFFLINE },
-
- { E_POPUP_BAR, (gchar *) "99.bar" },
- { E_POPUP_ITEM, (gchar *) "99.properties", (gchar *) N_("_Properties"), edit_task_list_cb, NULL, (gchar *) "document-properties", 0, E_CAL_POPUP_SOURCE_PRIMARY },
-};
-
-static void
-etc_source_popup_free(EPopup *ep, GSList *list, gpointer data)
-{
- g_slist_free(list);
-}
-
-static gboolean
-popup_event_cb(ESourceSelector *selector, ESource *insource, GdkEventButton *event, TasksComponentView *component_view)
-{
- ECalPopup *ep;
- ECalPopupTargetSource *t;
- GSList *menus = NULL;
- gint i;
- GtkMenu *menu;
-
- /** @HookPoint-ECalPopup: Tasks Source Selector Context Menu
- * @Id: org.gnome.evolution.tasks.source.popup
- * @Class: org.gnome.evolution.calendar.popup:1.0
- * @Target: ECalPopupTargetSource
- *
- * The context menu on the source selector in the tasks window.
- */
- ep = e_cal_popup_new("org.gnome.evolution.tasks.source.popup");
- t = e_cal_popup_target_new_source(ep, selector);
- t->target.widget = (GtkWidget *)component_view->tasks;
-
- for (i=0;i<sizeof(etc_source_popups)/sizeof(etc_source_popups[0]);i++)
- menus = g_slist_prepend(menus, &etc_source_popups[i]);
-
- e_popup_add_items((EPopup *)ep, menus, NULL,etc_source_popup_free, component_view);
-
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button:0, event?event->time:gtk_get_current_event_time());
-
- return TRUE;
-}
-
-static void
-source_selection_changed_cb (ESourceSelector *selector, TasksComponentView *component_view)
-{
- update_uris_for_selection (component_view);
-}
-
-static void
-primary_source_selection_changed_cb (ESourceSelector *selector, TasksComponentView *component_view)
-{
- update_uri_for_primary_selection (component_view);
-}
-
-static void
-source_removed_cb (ETasks *tasks, ESource *source, TasksComponentView *component_view)
-{
- e_source_selector_unselect_source (E_SOURCE_SELECTOR (component_view->source_selector), source);
-}
-
-static gboolean
-selector_tree_data_dropped (ESourceSelector *selector,
- GtkSelectionData *data,
- ESource *destination,
- GdkDragAction action,
- guint info,
- TasksComponent *component)
-{
- gboolean success = FALSE;
- icalcomponent *icalcomp = NULL;
- ECal *client = NULL;
- GSList *components, *p;
-
- client = auth_new_cal_from_source (
- destination, E_CAL_SOURCE_TYPE_TODO);
-
- if (!client || !e_cal_open (client, TRUE, NULL))
- goto finish;
-
- components = cal_comp_selection_get_string_list (data);
- success = components != NULL;
- for (p = components; p && success; p = p->next) {
- gchar *comp_str; /* do not free this! */
-
- /* p->data is "source_uid\ncomponent_string" */
- comp_str = strchr (p->data, '\n');
- if (!comp_str)
- continue;
-
- comp_str [0] = 0;
- comp_str++;
- icalcomp = icalparser_parse_string (comp_str);
-
- if (!icalcomp)
- continue;
-
- success = cal_comp_process_source_list_drop (client, icalcomp, action, p->data, component->priv->source_list);
- icalcomponent_free (icalcomp);
- }
- g_slist_foreach (components, (GFunc)g_free, NULL);
- g_slist_free (components);
-
- finish:
- if (client)
- g_object_unref (client);
-
- return success;
-}
-
-static void
-config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- TasksComponent *component = data;
- TasksComponentPrivate *priv;
-
- priv = component->priv;
-
- g_object_unref (priv->create_ecal);
- priv->create_ecal = NULL;
-
- priv->notifications = g_list_remove (priv->notifications, GUINT_TO_POINTER (id));
-}
-
-static ECal *
-setup_create_ecal (TasksComponent *component, TasksComponentView *component_view)
-{
- TasksComponentPrivate *priv;
- ESource *source = NULL;
- gchar *uid;
- guint not;
-
- priv = component->priv;
-
- if (component_view) {
- ECal *default_ecal;
-
- default_ecal = e_tasks_get_default_client (component_view->tasks);
- if (default_ecal)
- return default_ecal;
- }
-
- if (priv->create_ecal)
- return priv->create_ecal;
-
- /* Get the current primary calendar, or try to set one if it doesn't already exist */
- uid = calendar_config_get_primary_tasks ();
- if (uid) {
- source = e_source_list_peek_source_by_uid (priv->source_list, uid);
- g_free (uid);
-
- priv->create_ecal = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
- }
-
- if (!priv->create_ecal) {
- /* Try to create a default if there isn't one */
- source = e_source_list_peek_source_any (priv->source_list);
- if (source)
- priv->create_ecal = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
- }
-
- if (priv->create_ecal) {
- icaltimezone *zone;
-
- zone = calendar_config_get_icaltimezone ();
- e_cal_set_default_timezone (priv->create_ecal, zone, NULL);
-
- if (!e_cal_open (priv->create_ecal, FALSE, NULL)) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
- _("Unable to open the task list '%s' for creating events and meetings"),
- e_source_peek_name (source));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- return NULL;
- }
-
- } else {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
- "%s", _("There is no calendar available for creating tasks"));
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- return NULL;
- }
-
- /* Handle the fact it may change on us */
- not = calendar_config_add_notification_primary_tasks (config_create_ecal_changed_cb,
- component);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* Save the primary source for use elsewhere */
- calendar_config_set_primary_tasks (e_source_peek_uid (source));
-
- return priv->create_ecal;
-}
-
-/* Ensures the calendar is selected */
-static void
-object_created_cb (CompEditor *ce, ECalendarTable *cal_table)
-{
- g_return_if_fail (cal_table != NULL);
-
- cal_table->user_created_cal = comp_editor_get_client (ce);
- g_signal_emit_by_name (cal_table, "user_created");
- cal_table->user_created_cal = NULL;
-}
-
-static gboolean
-create_new_todo (TasksComponent *task_component, gboolean is_assigned, TasksComponentView *component_view)
-{
- ECal *ecal;
- ECalComponent *comp;
- CompEditor *editor;
- guint32 flags = 0;
-
- ecal = setup_create_ecal (task_component, component_view);
- if (!ecal)
- return FALSE;
-
- if (is_assigned)
- flags |= COMP_EDITOR_IS_ASSIGNED;
-
- flags |= COMP_EDITOR_NEW_ITEM | COMP_EDITOR_USER_ORG;
-
- editor = task_editor_new (ecal, flags);
- comp = cal_comp_task_new_with_defaults (ecal);
-
- if (component_view)
- g_signal_connect (editor, "object_created", G_CALLBACK (object_created_cb), e_tasks_get_calendar_table (component_view->tasks));
-
- comp_editor_edit_comp (editor, comp);
- if (is_assigned)
- task_editor_show_assignment (TASK_EDITOR (editor));
- gtk_window_present (GTK_WINDOW (editor));
-
- e_comp_editor_registry_add (comp_editor_registry, editor, TRUE);
-
- return TRUE;
-}
-
-static TasksComponentView *
-create_component_view (TasksComponent *tasks_component)
-{
- TasksComponentPrivate *priv;
- TasksComponentView *component_view;
-
- priv = tasks_component->priv;
-
- /* Create the calendar component view */
- component_view = g_new0 (TasksComponentView, 1);
-
- /* Add the source lists */
- component_view->source_list = g_object_ref (priv->source_list);
-
- /* Create sidebar selector */
- component_view->source_selector = e_source_selector_new (tasks_component->priv->source_list);
-
- g_signal_connect (component_view->source_selector, "drag-data-received",
- G_CALLBACK (selector_tree_drag_data_received), tasks_component);
-
- component_view->tasks = (ETasks *) bonobo_control_get_widget (component_view->view_control);
- component_view->table = e_calendar_table_get_table (e_tasks_get_calendar_table (component_view->tasks));
- component_view->model = E_TABLE_MODEL (e_calendar_table_get_model (e_tasks_get_calendar_table (component_view->tasks)));
-
- /* This signal is thrown if backends die - we update the selector */
- g_signal_connect (component_view->tasks, "source_removed",
- G_CALLBACK (source_removed_cb), component_view);
-
- /* connect after setting the initial selections, or we'll get unwanted calls
- to calendar_control_sensitize_calendar_commands */
- g_signal_connect (component_view->source_selector, "selection_changed",
- G_CALLBACK (source_selection_changed_cb), component_view);
- g_signal_connect (component_view->source_selector, "primary_selection_changed",
- G_CALLBACK (primary_source_selection_changed_cb), component_view);
- g_signal_connect (component_view->source_selector, "popup_event",
- G_CALLBACK (popup_event_cb), component_view);
-
- return component_view;
-}
-
-static void
-destroy_component_view (TasksComponentView *component_view)
-{
- GList *l;
-
- g_signal_handlers_disconnect_matched (component_view->model, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, component_view);
-
- if (component_view->source_list)
- g_object_unref (component_view->source_list);
-
- if (component_view->source_selection)
- e_source_selector_free_selection (component_view->source_selection);
-
- for (l = component_view->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
- g_list_free (component_view->notifications);
-
- g_free (component_view);
-}
-
-static void
-view_destroyed_cb (gpointer data, GObject *where_the_object_was)
-{
- TasksComponent *tasks_component = data;
- TasksComponentPrivate *priv;
- GList *l;
-
- priv = tasks_component->priv;
-
- for (l = priv->views; l; l = l->next) {
- TasksComponentView *component_view = l->data;
-
- if (G_OBJECT (component_view->view_control) == where_the_object_was) {
- priv->views = g_list_remove (priv->views, component_view);
- destroy_component_view (component_view);
-
- break;
- }
- }
-}
-
-static void
-impl_handleURI (PortableServer_Servant servant, const gchar *uri, CORBA_Environment *ev)
-{
- TasksComponent *tasks_component = TASKS_COMPONENT (bonobo_object_from_servant (servant));
- TasksComponentPrivate *priv;
- GList *l;
- TasksComponentView *view = NULL;
-
- gchar *src_uid = NULL;
- gchar *uid = NULL;
- gchar *rid = NULL;
-
- priv = tasks_component->priv;
-
- l = g_list_last (priv->views);
- if (!l)
- return;
-
- view = l->data;
-
- if (!strncmp (uri, "task:", 5)) {
- EUri *euri = e_uri_new (uri);
- const gchar *p;
- gchar *header, *content;
- gsize len, clen;
-
- p = euri->query;
- if (p) {
- while (*p) {
- len = strcspn (p, "=&");
-
- /* If it's malformed, give up. */
- if (p[len] != '=')
- break;
-
- header = (gchar *) p;
- header[len] = '\0';
- p += len + 1;
-
- clen = strcspn (p, "&");
-
- content = g_strndup (p, clen);
- if (!g_ascii_strcasecmp (header, "source-uid")) {
- src_uid = g_strdup (content);
- } else if (!g_ascii_strcasecmp (header, "comp-uid")) {
- uid = g_strdup (content);
- } else if (!g_ascii_strcasecmp (header, "comp-rid")) {
- rid = g_strdup (content);
- }
- g_free (content);
-
- p += clen;
- if (*p == '&') {
- p++;
- if (!strcmp (p, "amp;"))
- p += 4;
- }
- }
-
- if (uid && src_uid) {
- e_tasks_open_task_id (view->tasks, src_uid, uid, rid);
- }
-
- g_free (src_uid);
- g_free (uid);
- g_free (rid);
- }
- e_uri_free (euri);
- }
-
- return;
-}
-
-static void
-impl_requestCreateItem (PortableServer_Servant servant,
- const CORBA_char *item_type_name,
- CORBA_Environment *ev)
-{
- TasksComponent *tasks_component = TASKS_COMPONENT (bonobo_object_from_servant (servant));
-
- if (strcmp (item_type_name, CREATE_TASK_ID) == 0) {
- if (!create_new_todo (tasks_component, FALSE, NULL))
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
- } else if (strcmp (item_type_name, CREATE_TASK_ASSIGNED_ID) == 0) {
- if (!create_new_todo (tasks_component, TRUE, NULL))
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_Failed);
- } else if (strcmp (item_type_name, CREATE_TASK_LIST_ID) == 0) {
- /* FIXME Should we use the last opened window? */
- calendar_setup_new_task_list (NULL);
- } else {
- bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType);
- }
-}
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- TasksComponent *tasks_component = TASKS_COMPONENT (object);
- TasksComponentPrivate *priv = tasks_component->priv;
- GList *l;
-
- if (priv->source_list != NULL) {
- g_object_unref (priv->source_list);
- priv->source_list = NULL;
- }
- if (priv->source_selection != NULL) {
- e_source_selector_free_selection (priv->source_selection);
- priv->source_selection = NULL;
- }
-
- if (priv->create_ecal) {
- g_object_unref (priv->create_ecal);
- priv->create_ecal = NULL;
- }
-
- for (l = priv->views; l; l = l->next) {
- TasksComponentView *component_view = l->data;
-
- g_object_weak_unref (G_OBJECT (component_view->view_control), view_destroyed_cb, tasks_component);
- }
- g_list_free (priv->views);
- priv->views = NULL;
-
- for (l = priv->notifications; l; l = l->next)
- calendar_config_remove_notification (GPOINTER_TO_UINT (l->data));
- g_list_free (priv->notifications);
- priv->notifications = NULL;
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- TasksComponentPrivate *priv = TASKS_COMPONENT (object)->priv;
- GList *l;
-
- for (l = priv->views; l; l = l->next) {
- TasksComponentView *component_view = l->data;
-
- destroy_component_view (component_view);
- }
- g_list_free (priv->views);
-
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-tasks_component_class_init (TasksComponentClass *klass)
-{
- POA_GNOME_Evolution_Component__epv *epv = &klass->epv;
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
- parent_class = g_type_class_peek_parent (klass);
-
- epv->requestCreateItem = impl_requestCreateItem;
- epv->handleURI = impl_handleURI;
-
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
-}
-
-static void
-tasks_component_init (TasksComponent *component, TasksComponentClass *klass)
-{
- TasksComponentPrivate *priv;
-
- priv = g_new0 (TasksComponentPrivate, 1);
-
- component->priv = priv;
-}
diff --git a/calendar/gui/tasks-component.h b/calendar/gui/tasks-component.h
deleted file mode 100644
index 851d3d0381..0000000000
--- a/calendar/gui/tasks-component.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _TASKS_COMPONENT_H_
-#define _TASKS_COMPONENT_H_
-
-#include <bonobo/bonobo-object.h>
-#include <libedataserver/e-source-list.h>
-#include <misc/e-activity-handler.h>
-#include "Evolution.h"
-
-#define TASKS_TYPE_COMPONENT (tasks_component_get_type ())
-#define TASKS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TASKS_TYPE_COMPONENT, TasksComponent))
-#define TASKS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TASKS_TYPE_COMPONENT, TasksComponentClass))
-#define TASKS_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TASKS_TYPE_COMPONENT))
-#define TASKS_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TASKS_TYPE_COMPONENT))
-
-typedef struct _TasksComponent TasksComponent;
-typedef struct _TasksComponentPrivate TasksComponentPrivate;
-typedef struct _TasksComponentClass TasksComponentClass;
-
-struct _TasksComponent {
- BonoboObject parent;
-
- TasksComponentPrivate *priv;
-};
-
-struct _TasksComponentClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Component__epv epv;
-};
-
-GType tasks_component_get_type (void);
-
-#endif /* _TASKS_COMPONENT_H_ */
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
deleted file mode 100644
index 61f7eb4848..0000000000
--- a/calendar/gui/tasks-control.c
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Damon Chaplin <damon@ximian.com>
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <e-util/e-dialog-utils.h>
-#include <e-util/e-icon-factory.h>
-#include <e-util/e-print.h>
-#include <e-util/e-util-private.h>
-#include "dialogs/cal-prefs-dialog.h"
-#include "calendar-config.h"
-#include "calendar-commands.h"
-#include "e-tasks.h"
-#include "e-calendar-table.h"
-#include "print.h"
-#include "tasks-control.h"
-#include "evolution-shell-component-utils.h"
-#include "e-util/e-menu.h"
-#include "e-cal-menu.h"
-#include "e-cal-component-preview.h"
-#include "e-util/e-menu.h"
-#include "itip-utils.h"
-
-#define FIXED_MARGIN .05
-
-static void tasks_control_activate_cb (BonoboControl *control,
- gboolean activate,
- gpointer user_data);
-static void tasks_control_new_task_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void tasks_control_complete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void tasks_control_purge_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-static void tasks_control_assign_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-
-static void tasks_control_forward_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path);
-
-struct _tasks_sensitize_item {
- const gchar *command;
- guint32 enable;
-};
-
-static void
-sensitize_items(BonoboUIComponent *uic, struct _tasks_sensitize_item *items, guint32 mask)
-{
- while (items->command) {
- gchar command[32];
-
- if (strlen(items->command)>=21) {
- g_warning ("Size more than 21: %s\n", items->command);
- continue;
- }
-
- sprintf(command, "/commands/%s", items->command);
-
- bonobo_ui_component_set_prop (uic, command, "sensitive",
- (items->enable & mask) == 0 ? "1" : "0",
- NULL);
- items++;
- }
-}
-
-#define E_CAL_TASKS_PREVIEW_ACTIVE (1<<31)
-
-static struct _tasks_sensitize_item tasks_sensitize_table[] = {
- { "TasksOpenTask", E_CAL_MENU_SELECT_ONE },
- { "TasksCut", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE | E_CAL_TASKS_PREVIEW_ACTIVE },
- { "TasksCopy", E_CAL_MENU_SELECT_ANY },
- { "TasksPaste", E_CAL_MENU_SELECT_EDITABLE | E_CAL_TASKS_PREVIEW_ACTIVE },
- { "TasksDelete", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE },
- { "TasksMarkComplete", E_CAL_MENU_SELECT_ANY | E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_NOTCOMPLETE},
- { "TasksPurge", E_CAL_MENU_SELECT_EDITABLE },
- { "TasksAssign", E_CAL_MENU_SELECT_ONE | E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_ASSIGNABLE },
- { "TasksForward", E_CAL_MENU_SELECT_ONE },
- { NULL }
-};
-
-/* Sensitizes the UI Component menu/toolbar commands based on the number of
- * selected tasks.
- */
-void
-tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, gint n_selected)
-{
- BonoboUIComponent *uic;
- gboolean read_only = TRUE;
- ECal *ecal;
- ECalModel *model;
- ECalMenu *menu;
- ECalMenuTargetSelect *t;
- GPtrArray *events;
- GSList *selected = NULL, *l = NULL;
- ECalendarTable *cal_table;
- GtkWidget *preview;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- if (bonobo_ui_component_get_container (uic) == CORBA_OBJECT_NIL)
- return;
-
- menu = e_tasks_get_tasks_menu (tasks);
- cal_table = e_tasks_get_calendar_table (tasks);
- model = e_calendar_table_get_model (cal_table);
- events = g_ptr_array_new ();
- selected = e_calendar_table_get_selected (cal_table);
-
- for (l = selected;l;l = g_slist_next (l)) {
- g_ptr_array_add (events, e_cal_model_copy_component_data ((ECalModelComponent *)l->data));
- }
-
- g_slist_free (selected);
-
- t = e_cal_menu_target_new_select (menu, model, events);
-
- ecal = e_cal_model_get_default_client (model);
-
- if (ecal)
- e_cal_is_read_only (ecal, &read_only, NULL);
-
- preview = e_cal_component_preview_get_html (E_CAL_COMPONENT_PREVIEW (e_tasks_get_preview (tasks)));
- if (preview && GTK_WIDGET_VISIBLE (preview) && GTK_WIDGET_HAS_FOCUS (preview))
- t->target.mask = t->target.mask | E_CAL_TASKS_PREVIEW_ACTIVE;
- else
- t->target.mask = t->target.mask & (~E_CAL_TASKS_PREVIEW_ACTIVE);
-
- sensitize_items (uic, tasks_sensitize_table, t->target.mask);
- e_menu_update_target ((EMenu *)menu, (EMenuTarget *)t);
-}
-
-/* Callback used when the selection in the table changes */
-static void
-selection_changed_cb (ETasks *tasks, gint n_selected, gpointer data)
-{
- BonoboControl *control;
-
- control = BONOBO_CONTROL (data);
-
- tasks_control_sensitize_commands (control, tasks, n_selected);
-}
-
-static gboolean
-tasks_control_focus_changed (GtkWidget *widget, GdkEventFocus *event, struct focus_changed_data *fc_data)
-{
- g_return_val_if_fail (fc_data != NULL, FALSE);
-
- tasks_control_sensitize_commands (fc_data->control, fc_data->tasks, -1);
-
- return FALSE;
-}
-
-static BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("TasksNewTask", tasks_control_new_task_cmd),
- BONOBO_UI_VERB ("TasksMarkComplete", tasks_control_complete_cmd),
- BONOBO_UI_VERB ("TasksPurge", tasks_control_purge_cmd),
- BONOBO_UI_VERB ("TasksAssign", tasks_control_assign_cmd),
- BONOBO_UI_VERB ("TasksForward", tasks_control_forward_cmd),
- BONOBO_UI_VERB_END
-};
-
-void
-tasks_control_activate (BonoboControl *control, ETasks *tasks)
-{
- Bonobo_UIContainer remote_uih;
- BonoboUIComponent *uic;
- gint n_selected;
- ECalendarTable *cal_table;
- ETable *etable;
- gboolean state;
- gchar *xmlfile;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- remote_uih = bonobo_control_get_remote_ui_container (control, NULL);
- bonobo_ui_component_set_container (uic, remote_uih, NULL);
- bonobo_object_release_unref (remote_uih, NULL);
-
- e_tasks_set_ui_component (tasks, uic);
-
- bonobo_ui_component_add_verb_list_with_data (uic, verbs, tasks);
-
- bonobo_ui_component_freeze (uic, NULL);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR,
- "evolution-tasks.xml",
- NULL);
- bonobo_ui_util_set_ui (uic, PREFIX,
- xmlfile,
- "evolution-tasks",
- NULL);
- g_free (xmlfile);
-
- e_tasks_setup_view_menus (tasks, uic);
-
- /* Signals from the tasks widget; also sensitize the menu items as appropriate */
-
- g_signal_connect (tasks, "selection_changed", G_CALLBACK (selection_changed_cb), control);
-
- e_menu_activate ((EMenu *)e_tasks_get_tasks_menu (tasks), uic, 1);
- cal_table = e_tasks_get_calendar_table (tasks);
- etable = e_calendar_table_get_table (cal_table);
- n_selected = e_table_selected_count (etable);
-
- tasks_control_sensitize_commands (control, tasks, n_selected);
-
- state = calendar_config_get_preview_state();
-
- bonobo_ui_component_thaw (uic, NULL);
-
- bonobo_ui_component_add_listener(uic, "ViewPreview", tasks_control_view_preview, tasks);
- bonobo_ui_component_set_prop(uic, "/commands/ViewPreview", "state", state?"1":"0", NULL);
-}
-
-void
-tasks_control_deactivate (BonoboControl *control, ETasks *tasks)
-{
- BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
-
- g_return_if_fail (uic != NULL);
-
- e_menu_activate ((EMenu *)e_tasks_get_tasks_menu (tasks), uic, 0);
- e_tasks_set_ui_component (tasks, NULL);
-
- e_tasks_discard_view_menus (tasks);
-
- /* Stop monitoring the "selection_changed" signal */
- g_signal_handlers_disconnect_matched (tasks, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, control);
-
- bonobo_ui_component_rm (uic, "/", NULL);
- bonobo_ui_component_unset_container (uic, NULL);
-}
-
-static void
-tasks_control_new_task_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
- e_tasks_new_task (tasks);
-}
-
-static void
-tasks_control_complete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path)
-{
- ETasks *tasks;
-
- bonobo_ui_component_set_prop (uic, "/commands/TasksMarkComplete", "sensitive",
- "0",
- NULL);
- tasks = E_TASKS (data);
- e_tasks_complete_selected (tasks);
-}
-
-static gboolean
-confirm_purge (ETasks *tasks)
-{
- GtkWidget *dialog, *checkbox, *parent;
- gint button;
-
- if (!calendar_config_get_confirm_purge ())
- return TRUE;
-
- parent = gtk_widget_get_toplevel (GTK_WIDGET (tasks));
- dialog = gtk_message_dialog_new (
- (GtkWindow *)parent,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_YES_NO,
- "%s",
- _("This operation will permanently erase all tasks marked as completed. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"));
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO);
-
- checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
- gtk_widget_show (checkbox);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 6);
-
- button = gtk_dialog_run (GTK_DIALOG (dialog));
- if (button == GTK_RESPONSE_YES && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
- calendar_config_set_confirm_purge (FALSE);
- gtk_widget_destroy (dialog);
-
- return button == GTK_RESPONSE_YES ? TRUE : FALSE;
-}
-
-static void
-tasks_control_purge_cmd (BonoboUIComponent *uic,
- gpointer data,
- const gchar *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
- if (confirm_purge (tasks))
- e_tasks_delete_completed (tasks);
-}
diff --git a/calendar/gui/tasks-control.h b/calendar/gui/tasks-control.h
deleted file mode 100644
index de98914e40..0000000000
--- a/calendar/gui/tasks-control.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) version 3.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with the program; if not, see <http://www.gnu.org/licenses/>
- *
- *
- * Authors:
- * Federico Mena Quintero <federico@ximian.com>
- * Damon Chaplin <damon@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _TASKS_CONTROL_H_
-#define _TASKS_CONTROL_H_
-
-#include "e-tasks.h"
-
-BonoboControl *tasks_control_new (void);
-void tasks_control_activate (BonoboControl *control, ETasks *tasks);
-void tasks_control_deactivate (BonoboControl *control, ETasks *tasks);
-void tasks_control_sensitize_commands (BonoboControl *control, ETasks *tasks, gint n_selected);
-
-#endif /* _TASKS_CONTROL_H_ */
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c
index dbb11ff0f9..4d75bae4e9 100644
--- a/modules/calendar/e-cal-shell-settings.c
+++ b/modules/calendar/e-cal-shell-settings.c
@@ -489,14 +489,14 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/prompts/confirm_purge");
e_shell_settings_install_property_for_key (
- "cal-date-navigator-show-week-numbers",
- "/apps/evolution/calendar/date_navigator/show_week_numbers");
-
- e_shell_settings_install_property_for_key (
"cal-day-view-show-week-numbers",
"/apps/evolution/calendar/display/day_view_show_week_number");
e_shell_settings_install_property_for_key (
+ "cal-free-busy-template",
+ "/apps/evolution/calendar/publish/template");
+
+ e_shell_settings_install_property_for_key (
"cal-hide-completed-tasks",
"/apps/evolution/calendar/tasks/hide_completed");
@@ -529,6 +529,10 @@ e_cal_shell_backend_init_settings (EShell *shell)
"/apps/evolution/calendar/display/show_event_end");
e_shell_settings_install_property_for_key (
+ "cal-show-week-numbers",
+ "/apps/evolution/calendar/date_navigator/show_week_numbers");
+
+ e_shell_settings_install_property_for_key (
"cal-tasks-color-due-today",
"/apps/evolution/calendar/tasks/colors/due_today");
@@ -597,7 +601,8 @@ e_cal_shell_backend_init_settings (EShell *shell)
G_OBJECT (shell_settings), "cal-timezone",
transform_string_to_icaltimezone,
transform_icaltimezone_to_string,
- (GDestroyNotify) NULL, shell_settings);
+ (GDestroyNotify) g_object_unref,
+ g_object_ref (shell_settings));
e_shell_settings_install_property (
g_param_spec_int (
@@ -722,5 +727,6 @@ e_cal_shell_backend_init_settings (EShell *shell)
G_OBJECT (shell_settings), "cal-working-days-saturday",
transform_working_days_bitset_to_saturday,
transform_working_days_saturday_to_bitset,
- (GDestroyNotify) NULL, shell_settings);
+ (GDestroyNotify) g_object_unref,
+ g_object_ref (shell_settings));
}
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 6fb35e1588..28f96e553d 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -440,8 +440,7 @@ cal_shell_sidebar_constructed (GObject *object)
gtk_widget_show (widget);
e_binding_new (
- G_OBJECT (shell_settings),
- "cal-date-navigator-show-week-numbers",
+ G_OBJECT (shell_settings), "cal-show-week-numbers",
G_OBJECT (calitem), "show-week-numbers");
e_binding_new (
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index ece6eb694a..3a7ee78718 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -25,7 +25,6 @@
#include "e-util/gconf-bridge.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-model-memos.h"
#include "calendar/gui/e-memo-table.h"
@@ -353,11 +352,12 @@ memo_shell_content_constructed (GObject *object)
{
EMemoShellContentPrivate *priv;
EShell *shell;
+ EShellView *shell_view;
EShellSettings *shell_settings;
+ EShellBackend *shell_backend;
EShellContent *shell_content;
- EShellWindow *shell_window;
- EShellView *shell_view;
GalViewInstance *view_instance;
+ icaltimezone *timezone;
ETable *table;
GConfBridge *bridge;
GtkWidget *container;
@@ -371,12 +371,16 @@ memo_shell_content_constructed (GObject *object)
shell_content = E_SHELL_CONTENT (object);
shell_view = e_shell_content_get_shell_view (shell_content);
- shell_window = e_shell_view_get_shell_window (shell_view);
- shell = e_shell_window_get_shell (shell_window);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+
+ shell = e_shell_backend_get_shell (shell_backend);
shell_settings = e_shell_get_shell_settings (shell);
priv->memo_model = e_cal_model_memos_new (shell_settings);
+ timezone = e_shell_settings_get_pointer (
+ shell_settings, "cal-timezone");
+
/* Build content widgets. */
container = GTK_WIDGET (object);
@@ -406,8 +410,7 @@ memo_shell_content_constructed (GObject *object)
widget = e_cal_component_preview_new ();
e_cal_component_preview_set_default_timezone (
- E_CAL_COMPONENT_PREVIEW (widget),
- calendar_config_get_icaltimezone ());
+ E_CAL_COMPONENT_PREVIEW (widget), timezone);
gtk_container_add (GTK_CONTAINER (container), widget);
priv->memo_preview = g_object_ref (widget);
gtk_widget_show (widget);
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index ca5d05c40b..0962a8a20d 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -25,6 +25,7 @@
#include <glib/gi18n.h>
#include <libecal/e-cal.h>
+#include "e-util/e-binding.h"
#include "e-util/e-error.h"
#include "e-util/e-util.h"
#include "calendar/common/authentication.h"
@@ -41,6 +42,7 @@
struct _EMemoShellSidebarPrivate {
GtkWidget *selector;
+ icaltimezone *timezone;
/* UID -> Client */
GHashTable *client_table;
@@ -90,33 +92,6 @@ memo_shell_sidebar_emit_status_message (EMemoShellSidebar *memo_shell_sidebar,
}
static void
-memo_shell_sidebar_update_timezone (EMemoShellSidebar *memo_shell_sidebar)
-{
- GHashTable *client_table;
- icaltimezone *zone;
- GList *values;
-
- zone = calendar_config_get_icaltimezone ();
- client_table = memo_shell_sidebar->priv->client_table;
- values = g_hash_table_get_values (client_table);
-
- while (values != NULL) {
- ECal *client = values->data;
-
- if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
- e_cal_set_default_timezone (client, zone, NULL);
-
- values = g_list_delete_link (values, values);
- }
-
- /* XXX Need to call e_cal_component_preview_set_default_timezone()
- * here but the sidebar is not really supposed to access content
- * stuff. I guess we could emit an "update-timezone" signal
- * here, but that feels wrong. Maybe this whole thing should
- * be in EMemoShellView instead. */
-}
-
-static void
memo_shell_sidebar_backend_died_cb (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
@@ -483,13 +458,6 @@ memo_shell_sidebar_check_state (EShellSidebar *shell_sidebar)
}
static void
-memo_shell_sidebar_client_added (EMemoShellSidebar *memo_shell_sidebar,
- ECal *client)
-{
- memo_shell_sidebar_update_timezone (memo_shell_sidebar);
-}
-
-static void
memo_shell_sidebar_client_removed (EMemoShellSidebar *memo_shell_sidebar,
ECal *client)
{
@@ -532,7 +500,6 @@ memo_shell_sidebar_class_init (EMemoShellSidebarClass *class)
shell_sidebar_class = E_SHELL_SIDEBAR_CLASS (class);
shell_sidebar_class->check_state = memo_shell_sidebar_check_state;
- class->client_added = memo_shell_sidebar_client_added;
class->client_removed = memo_shell_sidebar_client_removed;
g_object_class_install_property (
@@ -632,6 +599,19 @@ e_memo_shell_sidebar_new (EShellView *shell_view)
"shell-view", shell_view, NULL);
}
+GList *
+e_memo_shell_sidebar_get_clients (EMemoShellSidebar *memo_shell_sidebar)
+{
+ GHashTable *client_table;
+
+ g_return_val_if_fail (
+ E_IS_MEMO_SHELL_SIDEBAR (memo_shell_sidebar), NULL);
+
+ client_table = memo_shell_sidebar->priv->client_table;
+
+ return g_hash_table_get_values (client_table);
+}
+
ESourceSelector *
e_memo_shell_sidebar_get_selector (EMemoShellSidebar *memo_shell_sidebar)
{
diff --git a/modules/calendar/e-memo-shell-sidebar.h b/modules/calendar/e-memo-shell-sidebar.h
index 665c8f218a..068d7436bc 100644
--- a/modules/calendar/e-memo-shell-sidebar.h
+++ b/modules/calendar/e-memo-shell-sidebar.h
@@ -80,6 +80,8 @@ GType e_memo_shell_sidebar_get_type (void);
void e_memo_shell_sidebar_register_type
(GTypeModule *type_module);
GtkWidget * e_memo_shell_sidebar_new(EShellView *shell_view);
+GList * e_memo_shell_sidebar_get_clients
+ (EMemoShellSidebar *memo_shell_sidebar);
ESourceSelector *
e_memo_shell_sidebar_get_selector
(EMemoShellSidebar *memo_shell_sidebar);
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index 4953a388d3..da321d5c19 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -67,6 +67,7 @@ memo_shell_view_selector_client_added_cb (EMemoShellView *memo_shell_view,
model = e_memo_table_get_model (memo_table);
e_cal_model_add_client (model, client);
+ e_memo_shell_view_update_timezone (memo_shell_view);
}
static void
@@ -198,6 +199,11 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
g_signal_connect_swapped (
+ model, "notify::timezone",
+ G_CALLBACK (e_memo_shell_view_update_timezone),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
memo_table, "open-component",
G_CALLBACK (e_memo_shell_view_open_memo),
memo_shell_view);
@@ -269,6 +275,7 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
e_memo_shell_view_actions_init (memo_shell_view);
e_memo_shell_view_update_sidebar (memo_shell_view);
e_memo_shell_view_update_search_filter (memo_shell_view);
+ e_memo_shell_view_update_timezone (memo_shell_view);
e_memo_shell_view_execute_search (memo_shell_view);
}
@@ -522,3 +529,33 @@ e_memo_shell_view_update_sidebar (EMemoShellView *memo_shell_view)
g_string_free (string, TRUE);
}
+
+void
+e_memo_shell_view_update_timezone (EMemoShellView *memo_shell_view)
+{
+ EMemoShellContent *memo_shell_content;
+ EMemoShellSidebar *memo_shell_sidebar;
+ ECalComponentPreview *memo_preview;
+ icaltimezone *timezone;
+ ECalModel *model;
+ GList *clients, *iter;
+
+ memo_shell_content = memo_shell_view->priv->memo_shell_content;
+ memo_preview = e_memo_shell_content_get_memo_preview (memo_shell_content);
+ model = e_memo_shell_content_get_memo_model (memo_shell_content);
+ timezone = e_cal_model_get_timezone (model);
+
+ memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+ clients = e_memo_shell_sidebar_get_clients (memo_shell_sidebar);
+
+ for (iter = clients; iter != NULL; iter = iter->next) {
+ ECal *client = iter->data;
+
+ if (e_cal_get_load_state (client) == E_CAL_LOAD_LOADED)
+ e_cal_set_default_timezone (client, timezone, NULL);
+ }
+
+ e_cal_component_preview_set_default_timezone (memo_preview, timezone);
+
+ g_list_free (clients);
+}
diff --git a/modules/calendar/e-memo-shell-view-private.h b/modules/calendar/e-memo-shell-view-private.h
index c41eaed7c0..c7ece91f68 100644
--- a/modules/calendar/e-memo-shell-view-private.h
+++ b/modules/calendar/e-memo-shell-view-private.h
@@ -120,6 +120,8 @@ void e_memo_shell_view_update_sidebar
(EMemoShellView *memo_shell_view);
void e_memo_shell_view_update_search_filter
(EMemoShellView *memo_shell_view);
+void e_memo_shell_view_update_timezone
+ (EMemoShellView *memo_shell_view);
G_END_DECLS
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index 8a4e0f1442..88e5e4d856 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -26,7 +26,6 @@
#include "e-util/e-binding.h"
#include "e-util/gconf-bridge.h"
-#include "calendar/gui/calendar-config.h"
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-model-tasks.h"
#include "calendar/gui/e-calendar-table.h"
@@ -358,6 +357,7 @@ task_shell_content_constructed (GObject *object)
EShellWindow *shell_window;
EShellView *shell_view;
GalViewInstance *view_instance;
+ icaltimezone *timezone;
ETable *table;
GConfBridge *bridge;
GtkWidget *container;
@@ -377,6 +377,9 @@ task_shell_content_constructed (GObject *object)
priv->task_model = e_cal_model_tasks_new (shell_settings);
+ timezone = e_shell_settings_get_pointer (
+ shell_settings, "cal-timezone");
+
/* Build content widgets. */
container = GTK_WIDGET (object);
@@ -406,8 +409,7 @@ task_shell_content_constructed (GObject *object)
widget = e_cal_component_preview_new ();
e_cal_component_preview_set_default_timezone (
- E_CAL_COMPONENT_PREVIEW (widget),
- calendar_config_get_icaltimezone ());
+ E_CAL_COMPONENT_PREVIEW (widget), timezone);
gtk_container_add (GTK_CONTAINER (container), widget);
priv->task_preview = g_object_ref (widget);
gtk_widget_show (widget);
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 1cbadcb53c..38c5ab6033 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -704,16 +704,17 @@ e_task_shell_view_update_timezone (ETaskShellView *task_shell_view)
ETaskShellSidebar *task_shell_sidebar;
ECalComponentPreview *task_preview;
icaltimezone *timezone;
+ ECalModel *model;
GList *clients, *iter;
task_shell_content = task_shell_view->priv->task_shell_content;
task_preview = e_task_shell_content_get_task_preview (task_shell_content);
+ model = e_task_shell_content_get_task_model (task_shell_content);
+ timezone = e_cal_model_get_timezone (model);
task_shell_sidebar = task_shell_view->priv->task_shell_sidebar;
clients = e_task_shell_sidebar_get_clients (task_shell_sidebar);
- timezone = calendar_config_get_icaltimezone ();
-
for (iter = clients; iter != NULL; iter = iter->next) {
ECal *client = iter->data;
diff --git a/plugins/startup-wizard/startup-wizard.c b/plugins/startup-wizard/startup-wizard.c
index 41a647a1b6..9c7ffe699b 100644
--- a/plugins/startup-wizard/startup-wizard.c
+++ b/plugins/startup-wizard/startup-wizard.c
@@ -209,7 +209,8 @@ startup_wizard_commit (EPlugin *ep, EMConfigTargetAccount *target)
e_shell_settings_set_boolean (
shell_settings, "cal-use-system-timezone", TRUE);
location = e_cal_util_get_system_timezone_location ();
- calendar_config_set_timezone (location);
+ e_shell_settings_set_string (
+ shell_settings, "cal-timezone-string", location);
g_free (location);
if (import_importers) {