diff options
Diffstat (limited to 'calendar')
43 files changed, 545 insertions, 374 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index feda5578cf..a98600a82b 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,102 @@ +2008-08-14 Matthew Barnes <mbarnes@redhat.com> + + * gui/dialogs/comp-editor.c: + Use e_display_help() for displaying help. + +2008-08-17 Chenthill Palanisamy <pchenthill@novell.com> + + * gui/dialogs/event-page.c: (source_changed_cb): + * gui/dialogs/memo-page.c: (source_changed_cb): + * gui/e-cal-model.c: (e_cal_model_set_timezone), + (e_cal_view_done_cb): + * gui/e-day-view-config.c: Fixed some warnings. + +2008-08-15 Chenthill Palanisamy <pchenthill@novell.com> + + Fixes #347287 + * gui/e-cal-list-view-config.c: (e_cal_list_view_config_set_view): + * gui/e-cal-list-view.c: (e_cal_list_view_new): + * gui/e-cal-list-view.h: + * gui/e-cal-model.c: (e_cal_model_set_timezone), (add_instance_cb), + (e_cal_view_objects_added_cb), (e_cal_view_done_cb), + (update_e_cal_view_for_client), (cal_opened_cb), (add_new_client), + (e_cal_model_component_class_init), + (e_cal_model_component_finalize), (e_cal_model_component_init), + (e_cal_model_component_get_type), + (e_cal_model_copy_component_data), + (e_cal_model_free_component_data): + * gui/e-cal-model.h: + * gui/e-calendar-view.c: (e_calendar_view_init), + (e_calendar_view_set_model): + * gui/e-calendar-view.h: + * gui/e-day-view-config.c: (e_day_view_config_set_view): + * gui/e-day-view.c: (time_range_changed_cb), + (model_row_changed_cb), (model_cell_changed_cb), + (model_rows_inserted_cb), (model_rows_deleted_cb), + (timezone_changed_cb), (e_day_view_init), (init_model), + (e_day_view_new), (e_day_view_set_mins_per_row), + (e_day_view_add_event), (e_day_view_check_layout): + * gui/e-day-view.h: + * gui/e-week-view-config.c: (e_week_view_config_set_view): + * gui/e-week-view.c: (time_range_changed_cb), + (model_row_changed_cb), (model_cell_changed_cb), + (model_rows_inserted_cb), (model_rows_deleted_cb), + (timezone_changed_cb), (e_week_view_init), (init_model), + (e_week_view_new), (e_week_view_add_event), + (e_week_view_check_layout): + * gui/e-week-view.h: + * gui/gnome-cal.c: (message_proxy), (create_thread_pool), + (message_push), (update_query_async), (update_query), + (set_search_query), (set_timezone), (setup_widgets), + (update_view_times), (display_view), (display_view_cb), + (add_mclient_async), (add_mclient), (client_cal_opened_cb), + (default_client_cal_opened_cb), + (gnome_calendar_remove_source_by_uid), + (gnome_calendar_on_date_navigator_selection_changed): Use a + single model for all the views. + +2008-08-12 Matthew Barnes <mbarnes@redhat.com> + + * gui/migration.c: + Fix TeX-style quotes. (#547372) + +2008-08-12 Dmitrijs Ledkovs <dmitrij.ledkov@gmail.com> + + ** Fixes bug #498095 + + * gui/dialogs/event-page.glade: "D_escription" -> "_Description" + * gui/dialogs/task-page.glade: As above and "_Due Date" -> "D_ue Date" + Change mnemonics to resolve clash with "_Edit". + * gui/dialogs/memo-page.glade: + Set proper mnemonic widget for description label. + +2008-08-11 Matthew Barnes <mbarnes@redhat.com> + + ** Fixes part of bug #546892 + + * gui/alarm-notify/alarm-notify-dialog.c: + * gui/dialogs/alarm-dialog.c: + * gui/dialogs/alarm-list-dialog.c: + * gui/dialogs/cal-attachment-select-file.c: + * gui/dialogs/changed-comp.c: + * gui/dialogs/delete-error.c: + * gui/dialogs/select-source-dialog.c: + Prefer gtk_window_set_icon_name() over gtk_window_set_icon_list(). + + * gui/dialogs/event-page.c: + * gui/e-timezone-entry.c: + Prefer gtk_image_new_from_icon_name() over e_icon_factory_get_image(). + + * gui/alarm-notify/alarm-queue.c: + Prefer gtk_status_icon_set_from_icon_name() over + gtk_status_icon_set_from_pixbuf(). + + * gui/e-calendar-table.c: + * gui/e-calendar-view.c: + * gui/e-memo-table.c: + e_activity_handler_operation_started() no longer takes a GdkPixbuf. + It was ignoring the pixbuf anyway ever since we added a spinner icon. + 2008-08-08 Milan Crha <mcrha@redhat.com> ** Fix for bug #544117 diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c index 3f7ad5fa4a..bfc0375c8f 100644 --- a/calendar/gui/alarm-notify/alarm-notify-dialog.c +++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c @@ -32,7 +32,6 @@ #include "alarm-notify-dialog.h" #include "config-data.h" #include "util.h" -#include "e-util/e-icon-factory.h" #include "e-util/e-util-private.h" @@ -212,8 +211,6 @@ notified_alarms_dialog_new (void) GtkWidget *edit_btn; GtkWidget *snooze_btn; GtkWidget *image; - char *icon_path; - GList *icon_list; GtkCellRenderer *renderer = gtk_cell_renderer_text_new (); AlarmNotificationsDialog *na = NULL; AlarmNotify *an = g_new0 (AlarmNotify, 1); @@ -286,10 +283,9 @@ notified_alarms_dialog_new (void) gtk_widget_realize (an->dialog); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (an->dialog)->vbox), 0); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (an->dialog)->action_area), 12); - image = glade_xml_get_widget (an->xml, "alarm-image"); - icon_path = e_icon_factory_get_icon_filename ("stock_alarm", E_ICON_SIZE_DIALOG); - gtk_image_set_from_file (GTK_IMAGE (image), icon_path); - g_free (icon_path); + image = glade_xml_get_widget (an->xml, "alarm-image"); + gtk_image_set_from_icon_name ( + GTK_IMAGE (image), "stock_alarm", GTK_ICON_SIZE_DIALOG); g_signal_connect (edit_btn, "clicked", G_CALLBACK (edit_pressed_cb), an); g_signal_connect (snooze_btn, "clicked", G_CALLBACK (snooze_pressed_cb), an); @@ -298,12 +294,8 @@ notified_alarms_dialog_new (void) if (!GTK_WIDGET_REALIZED (an->dialog)) gtk_widget_realize (an->dialog); - icon_list = e_icon_factory_get_icon_list ("stock_alarm"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (an->dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + + gtk_window_set_icon_name (GTK_WINDOW (an->dialog), "stock_alarm"); /* Set callback for updating the snooze "minutes" label */ g_signal_connect (G_OBJECT (an->snooze_time_min), "value_changed", diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index 219dfdc82d..720a757eed 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -35,7 +35,6 @@ #include <libgnomeui/gnome-dialog-util.h> #include <libgnomeui/gnome-uidefs.h> -#include <e-util/e-icon-factory.h> #include <libecal/e-cal-time-util.h> #include <libecal/e-cal-component.h> @@ -1384,19 +1383,18 @@ static gboolean tray_icon_blink_cb (gpointer data) { static gboolean tray_blink_state = FALSE; - GdkPixbuf *pixbuf; + const gchar *icon_name; tray_blink_countdown--; tray_blink_state = !tray_blink_state; - pixbuf = e_icon_factory_get_icon ((tray_blink_state || tray_blink_countdown <= 0)? - "stock_appointment-reminder-excl" : - "stock_appointment-reminder", - E_ICON_SIZE_LARGE_TOOLBAR); + if (tray_blink_state || tray_blink_countdown <= 0) + icon_name = "stock_appointment-reminder-excl"; + else + icon_name = "stock_appointment-reminder"; if (tray_icon) - gtk_status_icon_set_from_pixbuf (tray_icon, pixbuf); - g_object_unref (pixbuf); + gtk_status_icon_set_from_icon_name (tray_icon, icon_name); if (tray_blink_countdown <= 0) tray_blink_id = -1; @@ -1480,7 +1478,8 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa, /* create the tray icon */ if (tray_icon == NULL) { tray_icon = gtk_status_icon_new (); - gtk_status_icon_set_from_pixbuf (tray_icon, e_icon_factory_get_icon ("stock_appointment-reminder", E_ICON_SIZE_LARGE_TOOLBAR)); + gtk_status_icon_set_from_icon_name ( + tray_icon, "stock_appointment-reminder"); g_signal_connect (G_OBJECT (tray_icon), "activate", G_CALLBACK (icon_activated), NULL); g_signal_connect (G_OBJECT (tray_icon), "popup-menu", diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c index 450854b7b7..8c7a783fe8 100644 --- a/calendar/gui/cal-search-bar.c +++ b/calendar/gui/cal-search-bar.c @@ -28,7 +28,6 @@ #include <glib/gi18n.h> #include <libedataserver/e-categories.h> #include <libecal/e-cal-time-util.h> -#include <e-util/e-icon-factory.h> #include <libedataserver/e-categories.h> #include <filter/rule-editor.h> @@ -546,8 +545,16 @@ generate_viewoption_menu (CALSearchBarItem *subitems) char *str = NULL; str = e_str_without_underscores (subitems[i].search.text); menu_item = gtk_image_menu_item_new_with_label (str); -/* if (subitems[i].image) - gtk_image_menu_item_set_image (menu_item, e_icon_factory_get_image (subitems[i].image, E_ICON_SIZE_MENU));*/ + if (subitems[i].image) { + GtkWidget *image; + + image = gtk_image_new_from_icon_name ( + subitems[i].image, + GTK_ICON_SIZE_MENU); + gtk_image_menu_item_set_image ( + GTK_IMAGE_MENU_ITEM (menu_item), + image); + } g_free (str); } else { menu_item = gtk_menu_item_new (); diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index b30729c554..4dff00825c 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -54,7 +54,6 @@ #include "dialogs/event-editor.h" #include "misc/e-info-label.h" #include "e-util/e-error.h" -#include "e-util/e-icon-factory.h" #include "e-cal-menu.h" #include "e-cal-popup.h" diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c index 48402bbab3..11642e3e47 100644 --- a/calendar/gui/dialogs/alarm-dialog.c +++ b/calendar/gui/dialogs/alarm-dialog.c @@ -37,7 +37,6 @@ #include <libecal/e-cal-util.h> #include <libecal/e-cal-time-util.h> #include "e-util/e-dialog-widgets.h" -#include "e-util/e-icon-factory.h" #include "e-util/e-util-private.h" #include <libebook/e-destination.h> #include <libedataserverui/e-name-selector.h> @@ -1142,7 +1141,6 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) { Dialog dialog; int response_id; - GList *icon_list; char *gladefile; g_return_val_if_fail (alarm != NULL, FALSE); @@ -1178,12 +1176,8 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm) gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->vbox), 0); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->action_area), 12); - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog.toplevel), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + gtk_window_set_icon_name ( + GTK_WINDOW (dialog.toplevel), "x-office-calendar"); gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel), GTK_WINDOW (parent)); diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c index 8bce8f0eaa..8066061993 100644 --- a/calendar/gui/dialogs/alarm-list-dialog.c +++ b/calendar/gui/dialogs/alarm-list-dialog.c @@ -37,7 +37,6 @@ #include <libecal/e-cal-util.h> #include <libecal/e-cal-time-util.h> #include "e-util/e-dialog-widgets.h" -#include "e-util/e-icon-factory.h" #include "e-util/e-util-private.h" #include "alarm-dialog.h" #include "alarm-list-dialog.h" @@ -263,7 +262,6 @@ alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) { Dialog dialog; int response_id; - GList *icon_list; char *gladefile; dialog.ecal = ecal; @@ -293,12 +291,8 @@ alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store) gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->vbox), 0); gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog.toplevel)->action_area), 12); - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog.toplevel), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + gtk_window_set_icon_name ( + GTK_WINDOW (dialog.toplevel), "x-office-calendar"); gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel), GTK_WINDOW (parent)); diff --git a/calendar/gui/dialogs/cal-attachment-select-file.c b/calendar/gui/dialogs/cal-attachment-select-file.c index 2f08acbf07..2d2acb359e 100644 --- a/calendar/gui/dialogs/cal-attachment-select-file.c +++ b/calendar/gui/dialogs/cal-attachment-select-file.c @@ -36,7 +36,6 @@ #include <glib/gi18n.h> #include "cal-attachment-select-file.h" -#include <e-util/e-icon-factory.h> enum { SELECTOR_MODE_MULTI = (1 << 0), @@ -49,7 +48,6 @@ run_selector(CompEditor *editor, const char *title, guint32 flags, gboolean *sho GtkWidget *selection; GtkWidget *showinline = NULL; char *path; - GList *icon_list; path = g_object_get_data ((GObject *) editor, "attach_path"); @@ -90,12 +88,7 @@ run_selector(CompEditor *editor, const char *title, guint32 flags, gboolean *sho gtk_window_set_wmclass ((GtkWindow *) selection, "fileselection", "Evolution:editor"); gtk_window_set_modal ((GtkWindow *) selection, TRUE); - icon_list = e_icon_factory_get_icon_list ("mail-message-new"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (selection), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + gtk_window_set_icon_name (GTK_WINDOW (selection), "mail-message-new"); if (gtk_dialog_run ((GtkDialog *) selection) == GTK_RESPONSE_OK) { if (showinline_p) diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index c0cd28f6c0..4e81e79f44 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -25,7 +25,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <libgnomeui/gnome-uidefs.h> -#include <e-util/e-icon-factory.h> #include "e-util/e-error.h" #include "cancel-comp.h" diff --git a/calendar/gui/dialogs/changed-comp.c b/calendar/gui/dialogs/changed-comp.c index c994fb6303..5f62e54624 100644 --- a/calendar/gui/dialogs/changed-comp.c +++ b/calendar/gui/dialogs/changed-comp.c @@ -24,7 +24,6 @@ #include <glib/gi18n.h> #include <libgnomeui/gnome-uidefs.h> -#include <e-util/e-icon-factory.h> #include "changed-comp.h" @@ -48,7 +47,6 @@ changed_component_dialog (GtkWindow *parent, ECalComponent *comp, gboolean delet ECalComponentVType vtype; char *str; gint response; - GList *icon_list; vtype = e_cal_component_get_vtype (comp); @@ -105,12 +103,7 @@ changed_component_dialog (GtkWindow *parent, ECalComponent *comp, gboolean delet GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", str); - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + gtk_window_set_icon_name (GTK_WINDOW (dialog), "x-office-calendar"); response = gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 9a08009b6c..3ae846ac79 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -31,6 +31,7 @@ #include <glib/gstdio.h> #include <gdk/gdkkeysyms.h> #include <libgnome/libgnome.h> +#include <e-util/e-util.h> #include <e-util/e-dialog-utils.h> #include <e-util/e-util-private.h> #include <e-util/gconf-bridge.h> @@ -2255,16 +2256,11 @@ static void comp_editor_show_help (CompEditor *editor) { CompEditorClass *class; - GError *error = NULL; class = COMP_EDITOR_GET_CLASS (editor); g_return_if_fail (class->help_section != NULL); - gnome_help_display ("evolution.xml", class->help_section, &error); - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } + e_display_help (GTK_WINDOW (editor), class->help_section); } diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c index b87a01a58e..228e84f464 100644 --- a/calendar/gui/dialogs/delete-comp.c +++ b/calendar/gui/dialogs/delete-comp.c @@ -23,7 +23,6 @@ #endif #include <glib/gi18n.h> -#include <e-util/e-icon-factory.h> #include "e-util/e-error.h" #include "../calendar-config.h" #include "delete-comp.h" diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c index d1280da16a..7c264d0638 100644 --- a/calendar/gui/dialogs/delete-error.c +++ b/calendar/gui/dialogs/delete-error.c @@ -25,7 +25,6 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <libgnomeui/gnome-uidefs.h> -#include <e-util/e-icon-factory.h> #include "delete-error.h" @@ -39,9 +38,9 @@ void delete_error_dialog (GError *error, ECalComponentVType vtype) { - GList *icon_list = NULL; GtkWidget *dialog; const char *str; + const gchar *icon_name = NULL; if (!error) return; @@ -106,15 +105,12 @@ delete_error_dialog (GError *error, ECalComponentVType vtype) GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", str); if (vtype == E_CAL_COMPONENT_EVENT) - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); + icon_name = "x-office-calendar"; else if (vtype == E_CAL_COMPONENT_TODO) - icon_list = e_icon_factory_get_icon_list ("stock_todo"); + icon_name = "stock_todo"; - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + if (icon_name) + gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 1547a67f0e..ca1b581ee6 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -32,7 +32,6 @@ #include <glib/gi18n.h> #include <misc/e-dateedit.h> -#include <e-util/e-icon-factory.h> #include <e-util/e-plugin-ui.h> #include <e-util/e-util-private.h> #include <evolution-shell-component-utils.h> diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index ef103ac0c0..9737d08fca 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -42,7 +42,6 @@ #include "../e-timezone-entry.h" #include <e-util/e-dialog-utils.h> #include <e-util/e-dialog-widgets.h> -#include <e-util/e-icon-factory.h> #include <e-util/e-util-private.h> #include "../e-meeting-attendee.h" @@ -688,7 +687,7 @@ create_image_event_box (const char *image_text, const char *tip_text) GtkWidget *image, *box; box = gtk_event_box_new (); - image = e_icon_factory_get_image (image_text, E_ICON_SIZE_MENU); + image = gtk_image_new_from_icon_name (image_text, GTK_ICON_SIZE_MENU); gtk_container_add ((GtkContainer *) box, image); gtk_widget_show_all (box); @@ -2544,8 +2543,8 @@ source_changed_cb (ESourceComboBox *source_combo_box, EventPage *epage) return; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); - client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT); source = e_source_combo_box_get_active (source_combo_box); + client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_EVENT); if (client) { icaltimezone *zone; diff --git a/calendar/gui/dialogs/event-page.glade b/calendar/gui/dialogs/event-page.glade index f593357a65..f0f1d2e090 100644 --- a/calendar/gui/dialogs/event-page.glade +++ b/calendar/gui/dialogs/event-page.glade @@ -159,7 +159,7 @@ <child> <widget class="GtkLabel" id="description-label"> <property name="visible">True</property> - <property name="label" translatable="yes">D_escription:</property> + <property name="label" translatable="yes">_Description:</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_CENTER</property> diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 9f3e5d85d4..b8822cee15 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -826,8 +826,8 @@ source_changed_cb (ESourceComboBox *source_combo_box, editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage)); flags = comp_editor_get_flags (editor); - client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL); source = e_source_combo_box_get_active (source_combo_box); + client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_JOURNAL); if (!client || !e_cal_open (client, FALSE, NULL)) { GtkWidget *dialog; diff --git a/calendar/gui/dialogs/memo-page.glade b/calendar/gui/dialogs/memo-page.glade index 93bc1a9b5c..6b65a053d5 100644 --- a/calendar/gui/dialogs/memo-page.glade +++ b/calendar/gui/dialogs/memo-page.glade @@ -159,6 +159,7 @@ <widget class="GtkLabel" id="label18"> <property name="visible">True</property> <property name="label" translatable="yes">_Description:</property> + <property name="mnemonic_widget">memo_content</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_CENTER</property> diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c index a669dfcafc..9cc6c57fe3 100644 --- a/calendar/gui/dialogs/select-source-dialog.c +++ b/calendar/gui/dialogs/select-source-dialog.c @@ -23,7 +23,6 @@ #endif #include <glib/gi18n.h> -#include <e-util/e-icon-factory.h> #include <libedataserverui/e-source-selector-dialog.h> #include "select-source-dialog.h" @@ -40,7 +39,7 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) ESource *selected_source = NULL; const char *gconf_key; GConfClient *conf_client; - GList *icon_list = NULL; + const gchar *icon_name = NULL; if (obj_type == E_CAL_SOURCE_TYPE_EVENT) gconf_key = "/apps/evolution/calendar/sources"; @@ -58,17 +57,14 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) dialog = e_source_selector_dialog_new (parent, source_list); if (obj_type == E_CAL_SOURCE_TYPE_EVENT) - icon_list = e_icon_factory_get_icon_list ("x-office-calendar"); + icon_name = "x-office-calendar"; else if (obj_type == E_CAL_SOURCE_TYPE_TODO) - icon_list = e_icon_factory_get_icon_list ("stock_todo"); + icon_name = "stock_todo"; else if (obj_type == E_CAL_SOURCE_TYPE_JOURNAL) - icon_list = e_icon_factory_get_icon_list ("stock_journal"); + icon_name = "stock_journal"; - if (icon_list) { - gtk_window_set_icon_list (GTK_WINDOW (dialog), icon_list); - g_list_foreach (icon_list, (GFunc) g_object_unref, NULL); - g_list_free (icon_list); - } + if (icon_name) + gtk_window_set_icon_name (GTK_WINDOW (dialog), icon_name); if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { selected_source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog)); diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 7e2994499a..1d947ead13 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -31,7 +31,6 @@ #include <glade/glade.h> #include <glib/gi18n.h> -#include <e-util/e-icon-factory.h> #include <e-util/e-plugin-ui.h> #include <e-util/e-util-private.h> #include <evolution-shell-component-utils.h> diff --git a/calendar/gui/dialogs/task-page.glade b/calendar/gui/dialogs/task-page.glade index a5eb1e271e..d106381f8f 100644 --- a/calendar/gui/dialogs/task-page.glade +++ b/calendar/gui/dialogs/task-page.glade @@ -169,7 +169,7 @@ <child> <widget class="GtkLabel" id="due-date-label"> <property name="visible">True</property> - <property name="label" translatable="yes">_Due date:</property> + <property name="label" translatable="yes">D_ue date:</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_CENTER</property> @@ -274,7 +274,7 @@ <child> <widget class="GtkLabel" id="label18"> <property name="visible">True</property> - <property name="label" translatable="yes">De_scription:</property> + <property name="label" translatable="yes">_Description:</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_CENTER</property> diff --git a/calendar/gui/e-cal-list-view-config.c b/calendar/gui/e-cal-list-view-config.c index 923d4ce09d..e686aa531c 100644 --- a/calendar/gui/e-cal-list-view-config.c +++ b/calendar/gui/e-cal-list-view-config.c @@ -145,26 +145,6 @@ e_cal_list_view_config_get_view (ECalListViewConfig *view_config) } static void -set_timezone (ECalListView *list_view) -{ - icaltimezone *zone; - - zone = calendar_config_get_icaltimezone (); - e_calendar_view_set_timezone (E_CALENDAR_VIEW (list_view), zone); -} - -static void -timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - ECalListViewConfig *view_config = data; - ECalListViewConfigPrivate *priv; - - priv = view_config->priv; - - set_timezone (priv->view); -} - -static void set_twentyfour_hour (ECalListView *list_view) { gboolean use_24_hour; @@ -214,12 +194,6 @@ e_cal_list_view_config_set_view (ECalListViewConfig *view_config, ECalListView * priv->view = g_object_ref (list_view); - /* Time zone */ - set_timezone (list_view); - - not = calendar_config_add_notification_timezone (timezone_changed_cb, view_config); - priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); - /* 24 Hour format */ set_twentyfour_hour (list_view); diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c index 8fb38cbc95..a11778f285 100644 --- a/calendar/gui/e-cal-list-view.c +++ b/calendar/gui/e-cal-list-view.c @@ -314,13 +314,9 @@ e_cal_list_view_construct (ECalListView *cal_list_view) * Creates a new #ECalListView. **/ GtkWidget * -e_cal_list_view_new (void) +e_cal_list_view_new (ECalModel *model) { ECalListView *cal_list_view; - ECalModel *model; - - model = E_CAL_MODEL (e_cal_model_calendar_new ()); - e_cal_model_set_flags (model, E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES); cal_list_view = g_object_new (e_cal_list_view_get_type (), "model", model, NULL); if (!e_cal_list_view_construct (cal_list_view)) { diff --git a/calendar/gui/e-cal-list-view.h b/calendar/gui/e-cal-list-view.h index c2b630ccde..898249d01c 100644 --- a/calendar/gui/e-cal-list-view.h +++ b/calendar/gui/e-cal-list-view.h @@ -75,7 +75,7 @@ struct _ECalListViewClass GType e_cal_list_view_get_type (void); GtkWidget *e_cal_list_view_construct (ECalListView *cal_list_view); -GtkWidget *e_cal_list_view_new (void); +GtkWidget *e_cal_list_view_new (ECalModel *cal_model); void e_cal_list_view_load_state (ECalListView *cal_list_view, gchar *filename); void e_cal_list_view_save_state (ECalListView *cal_list_view, gchar *filename); diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c index 23f6ea89f8..818015cade 100644 --- a/calendar/gui/e-cal-model.c +++ b/calendar/gui/e-cal-model.c @@ -75,6 +75,10 @@ struct _ECalModelPrivate { gboolean use_24_hour_format; }; +#define E_CAL_MODEL_COMPONENT_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), E_TYPE_CAL_MODEL_COMPONENT, ECalModelComponentPrivate)) + static void e_cal_model_dispose (GObject *object); static void e_cal_model_finalize (GObject *object); @@ -1111,7 +1115,6 @@ void e_cal_model_set_timezone (ECalModel *model, icaltimezone *zone) { ECalModelPrivate *priv; - GList *l; g_return_if_fail (E_IS_CAL_MODEL (model)); @@ -1120,9 +1123,6 @@ e_cal_model_set_timezone (ECalModel *model, icaltimezone *zone) e_table_model_pre_change (E_TABLE_MODEL (model)); priv->zone = zone; - for (l = priv->clients; l; l = l->next) - e_cal_set_default_timezone (((ECalModelClient *)l->data)->client, priv->zone, NULL); - /* the timezone affects the times shown for date fields, so we need to redisplay everything */ e_table_model_changed (E_TABLE_MODEL (model)); @@ -1364,13 +1364,11 @@ add_instance_cb (ECalComponent *comp, time_t instance_start, time_t instance_end e_cal_component_set_dtend (comp, &to_set); e_cal_component_free_datetime (&datetime); - comp_data = g_new0 (ECalModelComponent, 1); + comp_data = g_object_new (E_TYPE_CAL_MODEL_COMPONENT, NULL); comp_data->client = g_object_ref (rdata->client); comp_data->icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (comp)); comp_data->instance_start = instance_start; comp_data->instance_end = instance_end; - comp_data->dtstart = comp_data->dtend = comp_data->due = comp_data->completed = NULL; - comp_data->color = NULL; g_ptr_array_add (priv->objects, comp_data); e_table_model_row_inserted (E_TABLE_MODEL (rdata->model), priv->objects->len - 1); @@ -1456,12 +1454,10 @@ e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer user_data } else { e_table_model_pre_change (E_TABLE_MODEL (model)); - comp_data = g_new0 (ECalModelComponent, 1); + comp_data = g_object_new (E_TYPE_CAL_MODEL_COMPONENT, NULL); comp_data->client = g_object_ref (e_cal_view_get_client (query)); comp_data->icalcomp = icalcomponent_new_clone (l->data); e_cal_model_set_instance_times (comp_data, priv->zone); - comp_data->dtstart = comp_data->dtend = comp_data->due = comp_data->completed = NULL; - comp_data->color = NULL; g_ptr_array_add (priv->objects, comp_data); e_table_model_row_inserted (E_TABLE_MODEL (model), priv->objects->len - 1); @@ -1537,6 +1533,8 @@ static void update_e_cal_view_for_client (ECalModel *model, ECalModelClient *client_data) { ECalModelPrivate *priv; + GError *error = NULL; + gint tries = 0; priv = model->priv; @@ -1559,7 +1557,16 @@ update_e_cal_view_for_client (ECalModel *model, ECalModelClient *client_data) if (!client_data->do_query) return; - if (!e_cal_get_query (client_data->client, priv->full_sexp, &client_data->query, NULL)) { +try_again: + if (!e_cal_get_query (client_data->client, priv->full_sexp, &client_data->query, &error)) { + if (error->code == E_CALENDAR_STATUS_BUSY && tries != 3) { + tries++; + /*TODO chose an optimal value */ + g_usleep (50); + g_clear_error (&error); + goto try_again; + } + g_warning (G_STRLOC ": Unable to get query"); return; @@ -1597,7 +1604,6 @@ cal_opened_cb (ECal *client, ECalendarStatus status, gpointer user_data) if (status != E_CALENDAR_STATUS_OK) { e_cal_model_remove_client (model, client); - return; } @@ -1619,6 +1625,11 @@ add_new_client (ECalModel *model, ECal *client, gboolean do_query) priv = model->priv; + /* DEBUG the load state should always be loaded here + if (e_cal_get_load_state (client) != E_CAL_LOAD_LOADED) { + g_assert_not_reached (); + } */ + /* Look to see if we already have this client */ client_data = find_client_data (model, client); if (client_data) { @@ -2075,6 +2086,7 @@ e_cal_model_date_value_to_string (ECalModel *model, const void *value) return g_strdup (buffer); } +/* FIXME is it still needed ? static ECellDateEditValue * copy_ecdv (ECellDateEditValue *ecdv) { @@ -2085,47 +2097,34 @@ copy_ecdv (ECellDateEditValue *ecdv) new_ecdv->zone = ecdv ? ecdv->zone : NULL; return new_ecdv; -} +} */ -/** - * e_cal_model_copy_component_data - */ -ECalModelComponent * -e_cal_model_copy_component_data (ECalModelComponent *comp_data) -{ - ECalModelComponent *new_data; - g_return_val_if_fail (comp_data != NULL, NULL); +struct _ECalModelComponentPrivate { +}; + +static void e_cal_model_component_finalize (GObject *object); - new_data = g_new0 (ECalModelComponent, 1); +static GObjectClass *parent_class; - new_data->instance_start = comp_data->instance_start; - new_data->instance_end = comp_data->instance_end; - if (comp_data->icalcomp) - new_data->icalcomp = icalcomponent_new_clone (comp_data->icalcomp); - if (comp_data->client) - new_data->client = g_object_ref (comp_data->client); - if (comp_data->dtstart) - new_data->dtstart = copy_ecdv (comp_data->dtstart); - if (comp_data->dtend) - new_data->dtend = copy_ecdv (comp_data->dtend); - if (comp_data->due) - new_data->due = copy_ecdv (comp_data->due); - if (comp_data->completed) - new_data->completed = copy_ecdv (comp_data->completed); - if (comp_data->color) - new_data->color = g_strdup (comp_data->color); +/* Class initialization function for the calendar component object */ +static void +e_cal_model_component_class_init (ECalModelComponentClass *klass) +{ + GObjectClass *object_class; - return new_data; + object_class = (GObjectClass *) klass; + + parent_class = g_type_class_peek_parent (klass); + + object_class->finalize = e_cal_model_component_finalize; } -/** - * e_cal_model_free_component_data - */ -void -e_cal_model_free_component_data (ECalModelComponent *comp_data) + +static void +e_cal_model_component_finalize (GObject *object) { - g_return_if_fail (comp_data != NULL); + ECalModelComponent *comp_data = E_CAL_MODEL_COMPONENT(object); if (comp_data->client) { g_object_unref (comp_data->client); @@ -2155,8 +2154,64 @@ e_cal_model_free_component_data (ECalModelComponent *comp_data) g_free (comp_data->color); comp_data->color = NULL; } + + if (G_OBJECT_CLASS (parent_class)->finalize) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); +} + +/* Object initialization function for the calendar component object */ +static void +e_cal_model_component_init (ECalModelComponent *comp) +{ + comp->dtstart = NULL; + comp->dtend = NULL; + comp->due = NULL; + comp->completed = NULL; + comp->color = NULL; +} + +GType +e_cal_model_component_get_type (void) +{ + static GType e_cal_model_component_type = 0; + + if (!e_cal_model_component_type) { + static GTypeInfo info = { + sizeof (ECalModelComponentClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) e_cal_model_component_class_init, + NULL, NULL, + sizeof (ECalModelComponent), + 0, + (GInstanceInitFunc) e_cal_model_component_init + }; + e_cal_model_component_type = g_type_register_static (G_TYPE_OBJECT, "ECalModelComponent", &info, 0); + } + + return e_cal_model_component_type; +} + +/** + * e_cal_model_copy_component_data + */ +ECalModelComponent * +e_cal_model_copy_component_data (ECalModelComponent *comp_data) +{ + g_return_val_if_fail (comp_data != NULL, NULL); + + return g_object_ref (comp_data); +} - g_free (comp_data); +/** + * e_cal_model_free_component_data + */ +void +e_cal_model_free_component_data (ECalModelComponent *comp_data) +{ + g_return_if_fail (comp_data != NULL); + + g_object_unref (comp_data); } /** diff --git a/calendar/gui/e-cal-model.h b/calendar/gui/e-cal-model.h index ca259c2678..405efb4400 100644 --- a/calendar/gui/e-cal-model.h +++ b/calendar/gui/e-cal-model.h @@ -57,19 +57,39 @@ typedef enum { E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES = 0x01 } ECalModelFlags; -typedef struct { +#define E_TYPE_CAL_MODEL_COMPONENT (e_cal_model_component_get_type ()) +#define E_CAL_MODEL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CAL_MODEL_COMPONENT, ECalModelComponent)) +#define E_CAL_MODEL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CAL_MODEL_COMPONENT, \ + ECalComponentClass)) +#define E_IS_CAL_MODEL_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CAL_MODEL_COMPONENT)) +#define E_IS_CAL_MODEL_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_CAL_MODEL_COMPONENT)) + +typedef struct _ECalModelComponent ECalModelComponent; +typedef struct _ECalModelComponentClass ECalModelComponentClass; +typedef struct _ECalModelComponentPrivate ECalModelComponentPrivate; + +struct _ECalModelComponent { + GObject object; + ECal *client; icalcomponent *icalcomp; time_t instance_start; time_t instance_end; - - /* private data */ + + /* Private data used by ECalModelCalendar and ECalModelTasks */ + /* keep these public to avoid many accessor functions */ ECellDateEditValue *dtstart; ECellDateEditValue *dtend; ECellDateEditValue *due; ECellDateEditValue *completed; gchar *color; -} ECalModelComponent; + + ECalModelComponentPrivate *priv; +}; + +struct _ECalModelComponentClass { + GObjectClass parent_class; +}; typedef struct { ECalModelComponent *comp_data; @@ -97,6 +117,7 @@ typedef struct { } ECalModelClass; GType e_cal_model_get_type (void); +GType e_cal_model_component_get_type (void); icalcomponent_kind e_cal_model_get_component_kind (ECalModel *model); void e_cal_model_set_component_kind (ECalModel *model, icalcomponent_kind kind); diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 4038c73c04..71c8cfae1f 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -1836,10 +1836,6 @@ static char *test[] = { #endif -/* Displays messages on the status bar */ -#define EVOLUTION_TASKS_PROGRESS_IMAGE "stock_todo" -static GdkPixbuf *progress_icon = NULL; - void e_calendar_table_set_activity_handler (ECalendarTable *cal_table, EActivityHandler *activity_handler) { @@ -1864,11 +1860,8 @@ e_calendar_table_set_status_message (ECalendarTable *cal_table, const gchar *mes } else if (cal_table->activity_id == 0) { char *client_id = g_strdup_printf ("%p", cal_table); - if (progress_icon == NULL) - progress_icon = e_icon_factory_get_icon (EVOLUTION_TASKS_PROGRESS_IMAGE, E_ICON_SIZE_STATUS); - - cal_table->activity_id = e_activity_handler_operation_started (cal_table->activity_handler, client_id, - progress_icon, message, TRUE); + cal_table->activity_id = e_activity_handler_operation_started ( + cal_table->activity_handler, client_id, message, TRUE); g_free (client_id); } else { diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 8fa9c61830..c8be57c49d 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -61,10 +61,6 @@ #include "e-cal-popup.h" #include "misc.h" -/* Used for the status bar messages */ -#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "x-office-calendar" -static GdkPixbuf *progress_icon = NULL; - struct _ECalendarViewPrivate { /* The GnomeCalendar we are associated to */ GnomeCalendar *calendar; @@ -397,8 +393,6 @@ static void e_calendar_view_init (ECalendarView *cal_view) { cal_view->priv = g_new0 (ECalendarViewPrivate, 1); - - cal_view->priv->model = (ECalModel *) e_cal_model_calendar_new (); } static void @@ -467,7 +461,6 @@ e_calendar_view_set_model (ECalendarView *cal_view, ECalModel *model) } cal_view->priv->model = g_object_ref (model); - e_calendar_view_update_query (cal_view); } icaltimezone * @@ -582,10 +575,8 @@ e_calendar_view_set_status_message (ECalendarView *cal_view, const gchar *messag } else if (priv->activity_id == 0) { char *client_id = g_strdup_printf ("%p", cal_view); - if (progress_icon == NULL) - progress_icon = e_icon_factory_get_icon (EVOLUTION_CALENDAR_PROGRESS_IMAGE, E_ICON_SIZE_STATUS); - - priv->activity_id = e_activity_handler_operation_started (priv->activity_handler, client_id, progress_icon, message, TRUE); + priv->activity_id = e_activity_handler_operation_started ( + priv->activity_handler, client_id, message, TRUE); g_free (client_id); } else { diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h index 2c8fd8b4d3..b8b8fbb588 100644 --- a/calendar/gui/e-calendar-view.h +++ b/calendar/gui/e-calendar-view.h @@ -81,6 +81,8 @@ typedef struct _ECalendarViewPrivate ECalendarViewPrivate; struct _ECalendarView { GtkTable table; + + gboolean in_focus; ECalendarViewPrivate *priv; }; diff --git a/calendar/gui/e-day-view-config.c b/calendar/gui/e-day-view-config.c index 292dfc7c53..f11212f896 100644 --- a/calendar/gui/e-day-view-config.c +++ b/calendar/gui/e-day-view-config.c @@ -145,26 +145,6 @@ e_day_view_config_get_view (EDayViewConfig *view_config) } static void -set_timezone (EDayView *day_view) -{ - icaltimezone *zone; - - zone = calendar_config_get_icaltimezone (); - e_calendar_view_set_timezone (E_CALENDAR_VIEW (day_view), zone); -} - -static void -timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - EDayViewConfig *view_config = data; - EDayViewConfigPrivate *priv; - - priv = view_config->priv; - - set_timezone (priv->view); -} - -static void set_week_start (EDayView *day_view) { int week_start_day; @@ -420,12 +400,6 @@ e_day_view_config_set_view (EDayViewConfig *view_config, EDayView *day_view) priv->view = g_object_ref (day_view); - /* Time zone */ - set_timezone (day_view); - - not = calendar_config_add_notification_timezone (timezone_changed_cb, view_config); - priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); - /* Week start */ set_week_start (day_view); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index fc1912969d..ebf17eff78 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -486,6 +486,11 @@ time_range_changed_cb (ECalModel *model, time_t start_time, time_t end_time, gpo g_return_if_fail (E_IS_DAY_VIEW (day_view)); + if (!E_CALENDAR_VIEW (day_view)->in_focus) { + e_day_view_free_events (day_view); + return; + } + /* Calculate the first day that should be shown, based on start_time and the days_shown setting. If we are showing 1 day it is just the start of the day given by start_time, otherwise it is the previous @@ -568,6 +573,10 @@ model_row_changed_cb (ETableModel *etm, int row, gpointer user_data) { EDayView *day_view = E_DAY_VIEW (user_data); + if (!E_CALENDAR_VIEW (day_view)->in_focus) { + return; + } + update_row (day_view, row); } @@ -576,6 +585,10 @@ model_cell_changed_cb (ETableModel *etm, int col, int row, gpointer user_data) { EDayView *day_view = E_DAY_VIEW (user_data); + if (!E_CALENDAR_VIEW (day_view)->in_focus) { + return; + } + update_row (day_view, row); } @@ -586,6 +599,10 @@ model_rows_inserted_cb (ETableModel *etm, int row, int count, gpointer user_data ECalModel *model; int i; + if (!E_CALENDAR_VIEW (day_view)->in_focus) { + return; + } + e_day_view_stop_editing_event (day_view); model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); @@ -612,6 +629,10 @@ model_rows_deleted_cb (ETableModel *etm, int row, int count, gpointer user_data) EDayView *day_view = E_DAY_VIEW (user_data); int i; + if (!E_CALENDAR_VIEW (day_view)->in_focus) { + return; + } + e_day_view_stop_editing_event (day_view); for (i = row + count; i > row; i--) { @@ -653,6 +674,10 @@ timezone_changed_cb (ECalendarView *cal_view, icaltimezone *old_zone, g_return_if_fail (E_IS_DAY_VIEW (day_view)); + + if (!cal_view->in_focus) + return; + /* If our time hasn't been set yet, just return. */ if (day_view->lower == 0 && day_view->upper == 0) return; @@ -673,7 +698,6 @@ e_day_view_init (EDayView *day_view) { gint day; GnomeCanvasGroup *canvas_group; - ECalModel *model; GtkWidget *w; GTK_WIDGET_SET_FLAGS (day_view, GTK_CAN_FOCUS); @@ -981,9 +1005,16 @@ e_day_view_init (EDayView *day_view) target_table, n_targets, GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_ASK); - /* Get the model */ - model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); + /* connect to ECalendarView's signals */ + g_signal_connect (G_OBJECT (day_view), "timezone_changed", + G_CALLBACK (timezone_changed_cb), NULL); +} + + +static void +init_model (EDayView *day_view, ECalModel *model) +{ /* connect to ECalModel's signals */ g_signal_connect (G_OBJECT (model), "time_range_changed", G_CALLBACK (time_range_changed_cb), day_view); @@ -995,10 +1026,6 @@ e_day_view_init (EDayView *day_view) G_CALLBACK (model_rows_inserted_cb), day_view); g_signal_connect (G_OBJECT (model), "model_rows_deleted", G_CALLBACK (model_rows_deleted_cb), day_view); - - /* connect to ECalendarView's signals */ - g_signal_connect (G_OBJECT (day_view), "timezone_changed", - G_CALLBACK (timezone_changed_cb), NULL); } /* Turn off the background of the canvas windows. This reduces flicker @@ -1019,12 +1046,13 @@ e_day_view_on_canvas_realized (GtkWidget *widget, * Creates a new #EDayView. **/ GtkWidget * -e_day_view_new (void) +e_day_view_new (ECalModel *model) { GObject *day_view; day_view = g_object_new (e_day_view_get_type (), NULL); - e_cal_model_set_flags (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES); + e_calendar_view_set_model ((ECalendarView *)day_view, model); + init_model ((EDayView *) day_view, model); return GTK_WIDGET (day_view); } @@ -2346,7 +2374,7 @@ e_day_view_set_mins_per_row (EDayView *day_view, e_day_view_recalc_num_rows (day_view); /* If we aren't visible, we'll sort it out later. */ - if (!GTK_WIDGET_VISIBLE (day_view)) + if (!E_CALENDAR_VIEW (day_view)->in_focus) return; for (day = 0; day < E_DAY_VIEW_MAX_DAYS; day++) @@ -4147,12 +4175,11 @@ e_day_view_add_event (ECalComponent *comp, add_event_data = data; -#if 0 + /* g_print ("Day view lower: %s", ctime (&add_event_data->day_view->lower)); g_print ("Day view upper: %s", ctime (&add_event_data->day_view->upper)); g_print ("Event start: %s", ctime (&start)); - g_print ("Event end : %s\n", ctime (&end)); -#endif + g_print ("Event end : %s\n", ctime (&end)); */ /* Check that the event times are valid. */ g_return_val_if_fail (start <= end, TRUE); @@ -4167,7 +4194,7 @@ e_day_view_add_event (ECalComponent *comp, if (add_event_data->comp_data) { event.comp_data = e_cal_model_copy_component_data (add_event_data->comp_data); } else { - event.comp_data = g_new0 (ECalModelComponent, 1); + event.comp_data = g_object_new (E_TYPE_CAL_MODEL_COMPONENT, NULL); event.comp_data->client = g_object_ref (e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (add_event_data->day_view)))); e_cal_component_abort_sequence (comp); @@ -4241,7 +4268,7 @@ e_day_view_check_layout (EDayView *day_view) gint day, rows_in_top_display; /* Don't bother if we aren't visible. */ - if (!GTK_WIDGET_VISIBLE (day_view)) + if (!E_CALENDAR_VIEW (day_view)->in_focus) return; /* Make sure the events are sorted (by start and size). */ diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h index a107ad92b6..2a187c6f42 100644 --- a/calendar/gui/e-day-view.h +++ b/calendar/gui/e-day-view.h @@ -474,7 +474,7 @@ struct _EDayViewClass GType e_day_view_get_type (void); -GtkWidget* e_day_view_new (void); +GtkWidget* e_day_view_new (ECalModel *model); /* Whether we are displaying a work-week, in which case the display always starts on the first day of the working week. */ diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c index 9ce7993101..98f17a7121 100644 --- a/calendar/gui/e-memo-table.c +++ b/calendar/gui/e-memo-table.c @@ -1095,10 +1095,6 @@ static char *test[] = { #endif -/* Displays messages on the status bar */ -#define EVOLUTION_MEMOS_PROGRESS_IMAGE "stock_notes" -static GdkPixbuf *progress_icon = NULL; - void e_memo_table_set_activity_handler (EMemoTable *memo_table, EActivityHandler *activity_handler) { @@ -1123,11 +1119,8 @@ e_memo_table_set_status_message (EMemoTable *memo_table, const gchar *message) } else if (memo_table->activity_id == 0) { char *client_id = g_strdup_printf ("%p", memo_table); - if (progress_icon == NULL) - progress_icon = e_icon_factory_get_icon (EVOLUTION_MEMOS_PROGRESS_IMAGE, E_ICON_SIZE_STATUS); - - memo_table->activity_id = e_activity_handler_operation_started (memo_table->activity_handler, client_id, - progress_icon, message, TRUE); + memo_table->activity_id = e_activity_handler_operation_started ( + memo_table->activity_handler, client_id, message, TRUE); g_free (client_id); } else { diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c index d361e622b2..d0c57dc0d3 100644 --- a/calendar/gui/e-timezone-entry.c +++ b/calendar/gui/e-timezone-entry.c @@ -33,7 +33,6 @@ #include <widgets/e-timezone-dialog/e-timezone-dialog.h> #include <glib/gi18n.h> #include "e-timezone-entry.h" -#include <e-util/e-icon-factory.h> struct _ETimezoneEntryPrivate { /* The current timezone, set in e_timezone_entry_set_timezone() @@ -106,7 +105,7 @@ static void e_timezone_entry_init (ETimezoneEntry *tentry) { ETimezoneEntryPrivate *priv; - GtkWidget *gtk_image; + GtkWidget *image; AtkObject *a11y; tentry->priv = priv = g_new0 (ETimezoneEntryPrivate, 1); @@ -130,9 +129,10 @@ e_timezone_entry_init (ETimezoneEntry *tentry) atk_object_set_name (a11y, _("Select Timezone")); } - gtk_image = e_icon_factory_get_image ("stock_timezone", E_ICON_SIZE_BUTTON); - gtk_container_add (GTK_CONTAINER (priv->button), gtk_image); - gtk_widget_show (gtk_image); + image = gtk_image_new_from_icon_name ( + "stock_timezone", GTK_ICON_SIZE_BUTTON); + gtk_container_add (GTK_CONTAINER (priv->button), image); + gtk_widget_show (image); } diff --git a/calendar/gui/e-week-view-config.c b/calendar/gui/e-week-view-config.c index 2b1d3c6d99..5f3f967b55 100644 --- a/calendar/gui/e-week-view-config.c +++ b/calendar/gui/e-week-view-config.c @@ -145,26 +145,6 @@ e_week_view_config_get_view (EWeekViewConfig *view_config) } static void -set_timezone (EWeekView *week_view) -{ - icaltimezone *zone; - - zone = calendar_config_get_icaltimezone (); - e_calendar_view_set_timezone (E_CALENDAR_VIEW (week_view), zone); -} - -static void -timezone_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data) -{ - EWeekViewConfig *view_config = data; - EWeekViewConfigPrivate *priv; - - priv = view_config->priv; - - set_timezone (priv->view); -} - -static void set_week_start (EWeekView *week_view) { int week_start_week; @@ -280,12 +260,6 @@ e_week_view_config_set_view (EWeekViewConfig *view_config, EWeekView *week_view) priv->view = g_object_ref (week_view); - /* Time zone */ - set_timezone (week_view); - - not = calendar_config_add_notification_timezone (timezone_changed_cb, view_config); - priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); - /* Week start */ set_week_start (week_view); diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index bbc9404498..aa459f817d 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -242,6 +242,11 @@ time_range_changed_cb (ECalModel *model, time_t start_time, time_t end_time, gpo g_return_if_fail (E_IS_WEEK_VIEW (week_view)); + if (!E_CALENDAR_VIEW (week_view)->in_focus) { + e_week_view_free_events (week_view); + return; + } + time_to_gdate_with_zone (&date, start_time, e_calendar_view_get_timezone (E_CALENDAR_VIEW (week_view))); /* Calculate the weekday of the given date, 0 = Mon. */ @@ -346,6 +351,11 @@ static void model_row_changed_cb (ETableModel *etm, int row, gpointer user_data) { EWeekView *week_view = E_WEEK_VIEW (user_data); + + if (!E_CALENDAR_VIEW (week_view)->in_focus) { + return; + } + update_row (week_view, row); } @@ -355,6 +365,10 @@ model_cell_changed_cb (ETableModel *etm, int col, int row, gpointer user_data) { EWeekView *week_view = E_WEEK_VIEW (user_data); + if (!E_CALENDAR_VIEW (week_view)->in_focus) { + return; + } + update_row (week_view, row); } @@ -365,6 +379,10 @@ model_rows_inserted_cb (ETableModel *etm, int row, int count, gpointer user_data ECalModel *model; int i; + if (!E_CALENDAR_VIEW (week_view)->in_focus) { + return; + } + model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)); for (i = 0; i < count; i++) { @@ -389,6 +407,9 @@ model_rows_deleted_cb (ETableModel *etm, int row, int count, gpointer user_data) int i; /* FIXME Stop editing? */ + if (!E_CALENDAR_VIEW (week_view)->in_focus) { + return; + } for (i = row + count; i > row; i--) { gint event_num; @@ -428,6 +449,9 @@ timezone_changed_cb (ECalendarView *cal_view, icaltimezone *old_zone, g_return_if_fail (E_IS_WEEK_VIEW (week_view)); + if (!cal_view->in_focus) + return; + /* If we don't have a valid date set yet, just return. */ if (!g_date_valid (&week_view->first_day_shown)) return; @@ -450,7 +474,6 @@ e_week_view_init (EWeekView *week_view) GnomeCanvasGroup *canvas_group; GtkObject *adjustment; GdkPixbuf *pixbuf; - ECalModel *model; gint i; GTK_WIDGET_SET_FLAGS (week_view, GTK_CAN_FOCUS); @@ -586,9 +609,14 @@ e_week_view_init (EWeekView *week_view) week_view->resize_width_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); week_view->last_cursor_set = NULL; - /* Get the model */ - model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)); + /* connect to ECalendarView's signals */ + g_signal_connect (G_OBJECT (week_view), "timezone_changed", + G_CALLBACK (timezone_changed_cb), NULL); +} +static void +init_model (EWeekView *week_view, ECalModel *model) +{ /* connect to ECalModel's signals */ g_signal_connect (G_OBJECT (model), "time_range_changed", G_CALLBACK (time_range_changed_cb), week_view); @@ -601,12 +629,8 @@ e_week_view_init (EWeekView *week_view) g_signal_connect (G_OBJECT (model), "model_rows_deleted", G_CALLBACK (model_rows_deleted_cb), week_view); - /* connect to ECalendarView's signals */ - g_signal_connect (G_OBJECT (week_view), "timezone_changed", - G_CALLBACK (timezone_changed_cb), NULL); } - /** * e_week_view_new: * @Returns: a new #EWeekView. @@ -614,12 +638,13 @@ e_week_view_init (EWeekView *week_view) * Creates a new #EWeekView. **/ GtkWidget * -e_week_view_new (void) +e_week_view_new (ECalModel *model) { GtkWidget *week_view; week_view = GTK_WIDGET (g_object_new (e_week_view_get_type (), NULL)); - e_cal_model_set_flags (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES); + e_calendar_view_set_model ((ECalendarView *) week_view, model); + init_model ((EWeekView *) week_view, model); return week_view; } @@ -2403,7 +2428,7 @@ e_week_view_add_event (ECalComponent *comp, if (add_event_data->comp_data) { event.comp_data = e_cal_model_copy_component_data (add_event_data->comp_data); } else { - event.comp_data = g_new0 (ECalModelComponent, 1); + event.comp_data = g_object_new (E_TYPE_CAL_MODEL_COMPONENT, NULL); event.comp_data->client = g_object_ref (e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (add_event_data->week_view)))); e_cal_component_abort_sequence (comp); @@ -2447,7 +2472,7 @@ static void e_week_view_check_layout (EWeekView *week_view) { /* Don't bother if we aren't visible. */ - if (!GTK_WIDGET_VISIBLE (week_view)) + if (!E_CALENDAR_VIEW (week_view)->in_focus) return; /* Make sure the events are sorted (by start and size). */ diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h index e4d8a214ce..1b7d680357 100644 --- a/calendar/gui/e-week-view.h +++ b/calendar/gui/e-week-view.h @@ -348,7 +348,7 @@ struct _EWeekViewClass GType e_week_view_get_type (void); -GtkWidget* e_week_view_new (void); +GtkWidget* e_week_view_new (ECalModel *model); /* The first day shown. Note that it will be rounded down to the start of a week when set. The returned value will be invalid if no date has been set diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 85ae1349cd..d2fd8f551b 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -91,7 +91,7 @@ #define G_MAXINT32 ((gint32) 0x7fffffff) #endif - +#define d(x) x /* Private part of the GnomeCalendar structure */ struct _GnomeCalendarPrivate { @@ -249,6 +249,41 @@ static void update_query (GnomeCalendar *gcal); static void update_todo_view (GnomeCalendar *gcal); static void update_memo_view (GnomeCalendar *gcal); +static void default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal); +static void client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal); + +/* Simple asynchronous message dispatcher */ +typedef struct _Message Message; +typedef void (*MessageFunc) (Message *msg); + +struct _Message { + MessageFunc func; +}; + +static void +message_proxy (Message *msg) +{ + g_return_if_fail (msg->func != NULL); + + msg->func (msg); +} + +static gpointer +create_thread_pool (void) +{ + /* once created, run forever */ + return g_thread_pool_new ((GFunc) message_proxy, NULL, 1, FALSE, NULL); +} + +static void +message_push (Message *msg) +{ + static GOnce once = G_ONCE_INIT; + + g_once (&once, (GThreadFunc) create_thread_pool, NULL); + + g_thread_pool_push ((GThreadPool *) once.retval, msg, NULL); +} G_DEFINE_TYPE (GnomeCalendar, gnome_calendar, GTK_TYPE_VBOX) @@ -813,24 +848,22 @@ adjust_e_cal_view_sexp (GnomeCalendar *gcal, const char *sexp) return new_sexp; } -/* Restarts a query for the date navigator in the calendar */ -static void -update_query (GnomeCalendar *gcal) +struct _date_query_msg { + Message header; + GnomeCalendar *gcal; +}; + +static void +update_query_async (struct _date_query_msg *msg) { + GnomeCalendar *gcal = msg->gcal; GnomeCalendarPrivate *priv; ECalView *old_query; char *real_sexp; GList *l; priv = gcal->priv; - - if (priv->updating == TRUE) { - return; - } - e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), _("Updating query"), -1); - e_calendar_item_clear_marks (priv->date_navigator->calitem); - - priv->updating = TRUE; + /* free the previous queries */ for (l = priv->dn_queries; l != NULL; l = l->next) { old_query = l->data; @@ -849,20 +882,33 @@ update_query (GnomeCalendar *gcal) real_sexp = adjust_e_cal_view_sexp (gcal, priv->sexp); if (!real_sexp) { - e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1); - priv->updating = FALSE; return; /* No time range is set, so don't start a query */ } - + /* create queries for each loaded client */ for (l = priv->clients_list[E_CAL_SOURCE_TYPE_EVENT]; l != NULL; l = l->next) { + GError *error = NULL; + gint tries = 0; + /* don't create queries for clients not loaded yet */ if (e_cal_get_load_state ((ECal *) l->data) != E_CAL_LOAD_LOADED) continue; +try_again: old_query = NULL; - if (!e_cal_get_query ((ECal *) l->data, real_sexp, &old_query, NULL)) { - g_warning (G_STRLOC ": Could not create the query"); + if (!e_cal_get_query ((ECal *) l->data, real_sexp, &old_query, &error)) { + /* If calendar is busy try again for 3 times. */ + if (error->code == E_CALENDAR_STATUS_BUSY && tries != 3) { + tries++; + /*TODO chose an optimal value */ + g_usleep (50); + + g_clear_error (&error); + goto try_again; + } + + g_warning (G_STRLOC ": Could not create the query: %s ", error->message); + g_clear_error (&error); continue; } @@ -882,10 +928,26 @@ update_query (GnomeCalendar *gcal) } /* free memory */ - priv->updating = FALSE; g_free (real_sexp); - e_calendar_view_set_status_message (E_CALENDAR_VIEW (priv->week_view), NULL, -1); update_todo_view (gcal); + + g_object_unref (msg->gcal); + g_slice_free (struct _date_query_msg, msg); +} + +/* Restarts a query for the date navigator in the calendar */ +static void +update_query (GnomeCalendar *gcal) +{ + struct _date_query_msg *msg; + + e_calendar_item_clear_marks (gcal->priv->date_navigator->calitem); + + msg = g_slice_new0 (struct _date_query_msg); + msg->header.func = (MessageFunc) update_query_async; + msg->gcal = g_object_ref (gcal); + + message_push ((Message *) msg); } static void @@ -908,26 +970,28 @@ set_search_query (GnomeCalendar *gcal, const char *sexp) priv->sexp = g_strdup (sexp); + d(g_print ("Changing the queries %s \n", sexp)); + update_query (gcal); + i = priv->current_view_type; + /* Set the query on the views */ - for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) { - if (i == GNOME_CAL_LIST_VIEW) { - if (!priv->lview_select_daten_range) { - cal_search_bar_get_time_range ((CalSearchBar *)priv->search_bar, &start, &end); - e_cal_model_set_search_query_with_time_range (e_calendar_view_get_model (priv->views [i]), sexp, start, end); - } else { - start = priv->base_view_time; - get_times_for_views (gcal, GNOME_CAL_LIST_VIEW, &start, &end); - - e_cal_model_set_search_query_with_time_range (e_calendar_view_get_model (priv->views [i]), sexp, start, end); - - if (priv->current_view_type == GNOME_CAL_LIST_VIEW) - gnome_calendar_update_date_navigator (gcal); - } - } else - e_cal_model_set_search_query (e_calendar_view_get_model (priv->views[i]), sexp); - } + if (i == GNOME_CAL_LIST_VIEW) { + if (!priv->lview_select_daten_range) { + cal_search_bar_get_time_range ((CalSearchBar *)priv->search_bar, &start, &end); + e_cal_model_set_search_query_with_time_range (e_calendar_view_get_model (priv->views [i]), sexp, start, end); + } else { + start = priv->base_view_time; + get_times_for_views (gcal, GNOME_CAL_LIST_VIEW, &start, &end); + + e_cal_model_set_search_query_with_time_range (e_calendar_view_get_model (priv->views [i]), sexp, start, end); + + if (priv->current_view_type == GNOME_CAL_LIST_VIEW) + gnome_calendar_update_date_navigator (gcal); + } + } else + e_cal_model_set_search_query (e_calendar_view_get_model (priv->views[i]), sexp); /* Set the query on the task pad */ update_todo_view (gcal); @@ -1224,6 +1288,9 @@ set_timezone (GnomeCalendar *calendar) /* FIXME Error checking */ e_cal_set_default_timezone (priv->default_client[i], priv->zone, NULL); } + + if (priv->views [priv->current_view_type]) + e_calendar_view_set_timezone (priv->views [priv->current_view_type], priv->zone); } static void @@ -1506,6 +1573,7 @@ setup_widgets (GnomeCalendar *gcal) ECalModel *w_model; GtkWidget *vbox; GtkWidget *label; + ECalModel *cal_model; int i; char *tmp; @@ -1610,8 +1678,12 @@ setup_widgets (GnomeCalendar *gcal) /* Timeout check to hide completed items */ priv->update_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_todo_view_cb, gcal, NULL); + /* Create the model for the views */ + cal_model = (ECalModel *) e_cal_model_calendar_new (); + e_cal_model_set_flags (cal_model, E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES); + /* The Day View. */ - priv->day_view = e_day_view_new (); + priv->day_view = e_day_view_new (cal_model); e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->day_view), gcal); e_calendar_view_set_timezone (E_CALENDAR_VIEW (priv->day_view), priv->zone); g_signal_connect (priv->day_view, "selection_changed", @@ -1619,7 +1691,7 @@ setup_widgets (GnomeCalendar *gcal) connect_day_view_focus (gcal, E_DAY_VIEW (priv->day_view)); /* The Work Week View. */ - priv->work_week_view = e_day_view_new (); + priv->work_week_view = e_day_view_new (cal_model); e_day_view_set_work_week_view (E_DAY_VIEW (priv->work_week_view), TRUE); e_day_view_set_days_shown (E_DAY_VIEW (priv->work_week_view), 5); @@ -1631,7 +1703,7 @@ setup_widgets (GnomeCalendar *gcal) priv->update_marcus_bains_line_timeout = g_timeout_add_full (G_PRIORITY_LOW, 60000, (GSourceFunc) update_marcus_bains_line_cb, gcal, NULL); /* The Week View. */ - priv->week_view = e_week_view_new (); + priv->week_view = e_week_view_new (cal_model); e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->week_view), gcal); e_calendar_view_set_timezone (E_CALENDAR_VIEW (priv->week_view), priv->zone); g_signal_connect (priv->week_view, "selection_changed", @@ -1650,7 +1722,7 @@ setup_widgets (GnomeCalendar *gcal) G_CALLBACK (view_done_cb), gcal); /* The Month View. */ - priv->month_view = e_week_view_new (); + priv->month_view = e_week_view_new (cal_model); e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->month_view), gcal); e_calendar_view_set_timezone (E_CALENDAR_VIEW (priv->month_view), priv->zone); e_week_view_set_multi_week_view (E_WEEK_VIEW (priv->month_view), TRUE); @@ -1666,7 +1738,7 @@ setup_widgets (GnomeCalendar *gcal) gcal); /* The List View. */ - priv->list_view = e_cal_list_view_new (); + priv->list_view = e_cal_list_view_new (cal_model); e_calendar_view_set_calendar (E_CALENDAR_VIEW (priv->list_view), gcal); e_calendar_view_set_timezone (E_CALENDAR_VIEW (priv->list_view), priv->zone); @@ -1733,10 +1805,6 @@ setup_widgets (GnomeCalendar *gcal) g_signal_connect (e_memo_table_get_model ((EMemoTable *)priv->memo), "cal_view_done", G_CALLBACK (view_done_cb), gcal); - - /* make sure we set the initial time ranges for the views */ - update_view_times (gcal, time (NULL)); - gnome_calendar_update_date_navigator (gcal); } /* Object initialization function for the gnome calendar */ @@ -2041,25 +2109,21 @@ static void update_view_times (GnomeCalendar *gcal, time_t start_time) { GnomeCalendarPrivate *priv; - int i; + ECalModel *model; + time_t real_start_time = start_time; + time_t end_time; priv = gcal->priv; priv->base_view_time = start_time; - for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) { - ECalModel *model; - time_t real_start_time = start_time; - time_t end_time; - - model = e_calendar_view_get_model (priv->views[i]); - get_times_for_views (gcal, i, &real_start_time, &end_time); + model = e_calendar_view_get_model (priv->views [priv->current_view_type]); + get_times_for_views (gcal, priv->current_view_type, &real_start_time, &end_time); - if (i == GNOME_CAL_LIST_VIEW && !priv->lview_select_daten_range) - continue; + if (priv->current_view_type == GNOME_CAL_LIST_VIEW && !priv->lview_select_daten_range) + return; - e_cal_model_set_time_range (model, real_start_time, end_time); - } + e_cal_model_set_time_range (model, real_start_time, end_time); } static void @@ -2233,6 +2297,7 @@ display_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, gboolean gra { GnomeCalendarPrivate *priv; gboolean preserve_day; + int i; priv = gcal->priv; @@ -2276,10 +2341,17 @@ display_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type, gboolean gra } priv->current_view_type = view_type; + E_CALENDAR_VIEW (priv->views [view_type])->in_focus = TRUE; gtk_notebook_set_current_page ( GTK_NOTEBOOK (priv->notebook), (int) view_type); + for (i = 0; i < GNOME_CAL_LAST_VIEW ; i++) { + if (i == view_type) + continue; + E_CALENDAR_VIEW (priv->views [i])->in_focus = FALSE; + } + if (grab_focus) focus_current_view (gcal); @@ -2331,12 +2403,15 @@ display_view_cb (GalViewInstance *view_instance, GalView *view, gpointer data) display_view (gcal, view_type, TRUE); + + if (!priv->base_view_time) + update_view_times (gcal, time (NULL)); + else + update_view_times (gcal, priv->base_view_time); + gnome_calendar_update_date_navigator (gcal); gnome_calendar_notify_dates_shown_changed (gcal); - if (!priv->lview_select_daten_range && priv->current_view_type != GNOME_CAL_LIST_VIEW) - update_query (gcal); - } /** @@ -2607,15 +2682,44 @@ gnome_calendar_set_pane_positions (GnomeCalendar *gcal) } } +struct _mclient_msg { + Message header; + ECalModel *model; + ECal *client; +}; + +static void +add_mclient_async (struct _mclient_msg *msg) +{ + e_cal_model_add_client (msg->model, msg->client); + + g_object_unref (msg->client); + g_object_unref (msg->model); + g_slice_free (struct _mclient_msg, msg); +} + +static void +add_mclient (ECalModel *model, ECal *client) +{ + struct _mclient_msg *msg; + + msg = g_slice_new0 (struct _mclient_msg); + msg->header.func = (MessageFunc) add_mclient_async; + msg->model = g_object_ref (model); + msg->client = g_object_ref (client); + + message_push ((Message *) msg); +} + static void client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) { GnomeCalendarPrivate *priv; ECalSourceType source_type; ESource *source; + ECalModel *model; ECalLoadState state; char *msg; - int i; priv = gcal->priv; @@ -2682,7 +2786,6 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, client_cal_opened_cb, NULL); - switch (source_type) { case E_CAL_SOURCE_TYPE_EVENT : msg = g_strdup_printf (_("Loading appointments at %s"), e_cal_get_uri (ecal)); @@ -2690,12 +2793,8 @@ client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar *gcal) g_free (msg); /* add client to the views */ - for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) { - ECalModel *model; - - model = e_calendar_view_get_model (priv->views[i]); - e_cal_model_add_client (model, ecal); - } + model = e_calendar_view_get_model (priv->views[priv->current_view_type]); + add_mclient (model, ecal); /* update date navigator query */ update_query (gcal); @@ -2731,7 +2830,6 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar ECalSourceType source_type; ESource *source; ECalLoadState state; - int i; priv = gcal->priv; @@ -2788,11 +2886,9 @@ default_client_cal_opened_cb (ECal *ecal, ECalendarStatus status, GnomeCalendar switch (source_type) { case E_CAL_SOURCE_TYPE_EVENT: - for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) { e_cal_model_set_default_client ( - e_calendar_view_get_model (E_CALENDAR_VIEW (priv->views[i])), + e_calendar_view_get_model (E_CALENDAR_VIEW (priv->views[priv->current_view_type])), ecal); - } break; case E_CAL_SOURCE_TYPE_TODO: @@ -3111,7 +3207,6 @@ gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, ECalSourceType source_ GnomeCalendarPrivate *priv; ECal *client; ECalModel *model; - int i; GList *l; g_return_val_if_fail (gcal != NULL, FALSE); @@ -3143,10 +3238,8 @@ gnome_calendar_remove_source_by_uid (GnomeCalendar *gcal, ECalSourceType source_ } } - for (i = 0; i < GNOME_CAL_LAST_VIEW; i++) { - model = e_calendar_view_get_model (priv->views[i]); - e_cal_model_remove_client (model, client); - } + model = e_calendar_view_get_model (priv->views[priv->current_view_type]); + e_cal_model_remove_client (model, client); /* update date navigator query */ update_query (gcal); @@ -3413,8 +3506,9 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, Gnom /* If the selection hasn't changed just return. */ if (!g_date_compare (&start_date, &new_start_date) - && !g_date_compare (&end_date, &new_end_date)) + && !g_date_compare (&end_date, &new_end_date)) { return; + } new_days_shown = g_date_get_julian (&new_end_date) - g_date_get_julian (&new_start_date) + 1; @@ -3458,8 +3552,8 @@ gnome_calendar_on_date_navigator_selection_changed (ECalendarItem *calitem, Gnom /* Make the views display things properly */ update_view_times (gcal, new_time); - set_view (gcal, view_type, TRUE); + gnome_calendar_notify_dates_shown_changed (gcal); } diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c index d0d17b0945..31280d52cb 100644 --- a/calendar/gui/memos-component.c +++ b/calendar/gui/memos-component.c @@ -51,7 +51,6 @@ #include "dialogs/copy-source-dialog.h" #include "dialogs/memo-editor.h" #include "widgets/misc/e-info-label.h" -#include "e-util/e-icon-factory.h" #include "e-util/e-error.h" #include "calendar-component.h" diff --git a/calendar/gui/memos-control.c b/calendar/gui/memos-control.c index 51125a31cb..e7f9132665 100644 --- a/calendar/gui/memos-control.c +++ b/calendar/gui/memos-control.c @@ -35,8 +35,8 @@ #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-ui-util.h> #include <e-util/e-dialog-utils.h> -#include <e-util/e-print.h> #include <e-util/e-icon-factory.h> +#include <e-util/e-print.h> #include <e-util/e-util-private.h> #include "calendar-config.h" diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c index 4c3cb53210..462a62b1b6 100644 --- a/calendar/gui/migration.c +++ b/calendar/gui/migration.c @@ -192,7 +192,7 @@ dialog_set_folder_name (const char *folder_name) { char *text; - text = g_strdup_printf (_("Migrating `%s':"), folder_name); + text = g_strdup_printf (_("Migrating '%s':"), folder_name); gtk_label_set_text (label, text); g_free (text); diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index b7f6cc6ea2..d976202a8c 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -52,7 +52,6 @@ #include "dialogs/task-editor.h" #include "misc/e-info-label.h" #include "e-util/e-error.h" -#include "e-util/e-icon-factory.h" #define CREATE_TASK_ID "task" #define CREATE_TASK_ASSIGNED_ID "task-assigned" diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index 7a61cf1eae..26927cb412 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -34,8 +34,8 @@ #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-ui-util.h> #include <e-util/e-dialog-utils.h> -#include <e-util/e-print.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" |