aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/Makefile.am3
-rw-r--r--calendar/gui/alarm-notify/alarm-notify-dialog.c14
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c18
-rw-r--r--calendar/gui/alarm-notify/notify-main.c2
-rw-r--r--calendar/gui/calendar-commands.c.dead380
-rw-r--r--calendar/gui/calendar-commands.h.dead44
-rw-r--r--calendar/gui/calendar-component.c.dead710
-rw-r--r--calendar/gui/calendar-component.h.dead55
-rw-r--r--calendar/gui/comp-util.c17
-rw-r--r--calendar/gui/dialogs/Makefile.am3
-rw-r--r--calendar/gui/dialogs/alarm-dialog.c9
-rw-r--r--calendar/gui/dialogs/alarm-dialog.ui2
-rw-r--r--calendar/gui/dialogs/alarm-list-dialog.c14
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c4
-rw-r--r--calendar/gui/dialogs/calendar-setup.c16
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c96
-rw-r--r--calendar/gui/dialogs/comp-editor.c27
-rw-r--r--calendar/gui/dialogs/delete-comp.c10
-rw-r--r--calendar/gui/dialogs/event-editor.c13
-rw-r--r--calendar/gui/dialogs/event-page.c8
-rw-r--r--calendar/gui/dialogs/event-page.ui4
-rw-r--r--calendar/gui/dialogs/memo-editor.c4
-rw-r--r--calendar/gui/dialogs/memo-page.c8
-rw-r--r--calendar/gui/dialogs/recur-comp.c7
-rw-r--r--calendar/gui/dialogs/recurrence-page.c43
-rw-r--r--calendar/gui/dialogs/schedule-page.c4
-rw-r--r--calendar/gui/dialogs/send-comp.c10
-rw-r--r--calendar/gui/dialogs/task-details-page.c19
-rw-r--r--calendar/gui/dialogs/task-editor.c9
-rw-r--r--calendar/gui/dialogs/task-page.c4
-rw-r--r--calendar/gui/e-cal-component-preview.c8
-rw-r--r--calendar/gui/e-cal-list-view.c4
-rw-r--r--calendar/gui/e-cal-list-view.etspec1
-rw-r--r--calendar/gui/e-cal-model.c2
-rw-r--r--calendar/gui/e-calendar-selector.c6
-rw-r--r--calendar/gui/e-calendar-view.c137
-rw-r--r--calendar/gui/e-calendar-view.h8
-rw-r--r--calendar/gui/e-day-view-main-item.c20
-rw-r--r--calendar/gui/e-day-view-time-item.c9
-rw-r--r--calendar/gui/e-day-view-top-item.c30
-rw-r--r--calendar/gui/e-day-view.c706
-rw-r--r--calendar/gui/e-itip-control.c79
-rw-r--r--calendar/gui/e-meeting-list-view.c4
-rw-r--r--calendar/gui/e-meeting-time-sel-item.c17
-rw-r--r--calendar/gui/e-meeting-time-sel.c288
-rw-r--r--calendar/gui/e-memo-table.c10
-rw-r--r--calendar/gui/e-select-names-renderer.c15
-rw-r--r--calendar/gui/e-task-table.c34
-rw-r--r--calendar/gui/e-timezone-entry.c26
-rw-r--r--calendar/gui/e-week-view-event-item.c97
-rw-r--r--calendar/gui/e-week-view-main-item.c4
-rw-r--r--calendar/gui/e-week-view-titles-item.c26
-rw-r--r--calendar/gui/e-week-view.c416
-rw-r--r--calendar/gui/ea-cal-view-event.c19
-rw-r--r--calendar/gui/ea-cal-view.c8
-rw-r--r--calendar/gui/ea-day-view.c4
-rw-r--r--calendar/gui/ea-week-view.c4
-rw-r--r--calendar/gui/gnome-cal.c10
-rw-r--r--calendar/gui/goto-dialog.ui2
-rw-r--r--calendar/gui/itip-utils.c5
-rw-r--r--calendar/gui/print.c34
-rw-r--r--calendar/gui/tag-calendar.c8
-rw-r--r--calendar/gui/weekday-picker.c25
63 files changed, 1612 insertions, 2011 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 4c4137651b..a168582db0 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -71,7 +71,8 @@ libevolution_calendar_la_CPPFLAGS = \
-DPREFIX=\""$(prefix)"\" \
$(GNOME_PLATFORM_CFLAGS) \
$(LIBSOUP_CFLAGS) \
- $(EVOLUTION_CALENDAR_CFLAGS)
+ $(EVOLUTION_CALENDAR_CFLAGS) \
+ $(CAMEL_CFLAGS)
ui_DATA = \
e-itip-control.ui \
diff --git a/calendar/gui/alarm-notify/alarm-notify-dialog.c b/calendar/gui/alarm-notify/alarm-notify-dialog.c
index a6259d69ab..aa42987caa 100644
--- a/calendar/gui/alarm-notify/alarm-notify-dialog.c
+++ b/calendar/gui/alarm-notify/alarm-notify-dialog.c
@@ -232,6 +232,7 @@ dialog_destroyed_cb (GtkWidget *dialog, gpointer user_data)
AlarmNotificationsDialog *
notified_alarms_dialog_new (void)
{
+ GtkWidget *container;
GtkWidget *edit_btn;
GtkWidget *snooze_btn;
GtkWidget *image;
@@ -298,8 +299,13 @@ notified_alarms_dialog_new (void)
G_CALLBACK (tree_selection_changed_cb), an);
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);
+
+ container = gtk_dialog_get_action_area (GTK_DIALOG (an->dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 12);
+
+ container = gtk_dialog_get_content_area (GTK_DIALOG (an->dialog));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 0);
+
image = e_builder_get_widget (an->builder, "alarm-image");
gtk_image_set_from_icon_name (
GTK_IMAGE (image), "stock_alarm", GTK_ICON_SIZE_DIALOG);
@@ -310,11 +316,7 @@ notified_alarms_dialog_new (void)
g_signal_connect (G_OBJECT (an->dialog), "response", G_CALLBACK (dialog_response_cb), an);
g_signal_connect (G_OBJECT (an->dialog), "destroy", G_CALLBACK (dialog_destroyed_cb), an);
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_realized (an->dialog))
-#else
- if (!GTK_WIDGET_REALIZED (an->dialog))
-#endif
gtk_widget_realize (an->dialog);
gtk_window_set_icon_name (GTK_WINDOW (an->dialog), "stock_alarm");
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index ffa3d4b1f2..f7ef6fdcf4 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -1674,6 +1674,7 @@ audio_notification (time_t trigger, CompQueuedAlarms *cqa,
static void
mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id)
{
+ GtkWidget *container;
GtkWidget *dialog;
GtkWidget *label;
@@ -1694,7 +1695,9 @@ mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id)
"configured to send an email. Evolution will display\n"
"a normal reminder dialog box instead."));
gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4);
+
+ container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (container), label, TRUE, TRUE, 4);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
@@ -1704,7 +1707,10 @@ mail_notification (time_t trigger, CompQueuedAlarms *cqa, gpointer alarm_id)
static gboolean
procedure_notification_dialog (const gchar *cmd, const gchar *url)
{
- GtkWidget *dialog, *label, *checkbox;
+ GtkWidget *container;
+ GtkWidget *dialog;
+ GtkWidget *label;
+ GtkWidget *checkbox;
gchar *str;
gint btn;
@@ -1728,15 +1734,15 @@ procedure_notification_dialog (const gchar *cmd, const gchar *url)
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- label, TRUE, TRUE, 4);
+
+ container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (container), label, TRUE, TRUE, 4);
g_free (str);
checkbox = gtk_check_button_new_with_label
(_("Do not ask me about this program again."));
gtk_widget_show (checkbox);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
- checkbox, TRUE, TRUE, 4);
+ gtk_box_pack_start (GTK_BOX (container), checkbox, TRUE, TRUE, 4);
/* Run the dialog */
btn = gtk_dialog_run (GTK_DIALOG (dialog));
diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c
index 483704f1e4..b20e7c5e16 100644
--- a/calendar/gui/alarm-notify/notify-main.c
+++ b/calendar/gui/alarm-notify/notify-main.c
@@ -30,9 +30,9 @@
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <camel/camel.h>
#include <unique/unique.h>
#include <dbus/dbus-glib.h>
-#include <camel/camel-object.h>
#include <libedataserver/e-source.h>
#include <libedataserverui/e-passwords.h>
diff --git a/calendar/gui/calendar-commands.c.dead b/calendar/gui/calendar-commands.c.dead
deleted file mode 100644
index 6368857ead..0000000000
--- a/calendar/gui/calendar-commands.c.dead
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Evolution calendar - Commands for the calendar GUI control
- *
- * 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:
- * Miguel de Icaza <miguel@ximian.com>
- * Federico Mena-Quintero <federico@ximian.com>
- * Seth Alves <alves@hungry.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-exception.h>
-#include <libecal/e-cal-time-util.h>
-#include "shell/Evolution.h"
-#include "calendar-commands.h"
-#include "calendar-component.h"
-#include "calendar-config.h"
-#include "e-day-view.h"
-#include "e-week-view.h"
-#include "gnome-cal.h"
-#include "goto.h"
-#include "print.h"
-#include "dialogs/cal-prefs-dialog.h"
-#include "itip-utils.h"
-#include "e-cal-list-view.h"
-#include "evolution-shell-component-utils.h"
-#include "e-util/e-icon-factory.h"
-#include "e-util/e-util-private.h"
-#include "e-cal-menu.h"
-
-/* Focusing information for the calendar view. We have to keep track of this
- * ourselves because with Bonobo controls, we may get unpaired focus_out events.
- */
-typedef struct {
- guint calendar_focused : 1;
- guint taskpad_focused : 1;
-} FocusData;
-
-/* Sets a clock cursor for the specified calendar window */
-static void
-set_clock_cursor (GnomeCalendar *gcal)
-{
- GdkCursor *cursor;
-
- cursor = gdk_cursor_new (GDK_WATCH);
- gdk_window_set_cursor (GTK_WIDGET (gcal)->window, cursor);
- gdk_cursor_unref (cursor);
- gdk_flush ();
-}
-
-/* Resets the normal cursor for the specified calendar window */
-static void
-set_normal_cursor (GnomeCalendar *gcal)
-{
- gdk_window_set_cursor (GTK_WIDGET (gcal)->window, NULL);
- gdk_flush ();
-}
-
-static void
-show_day_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- gnome_calendar_set_view (gcal, GNOME_CAL_DAY_VIEW);
-}
-
-static void
-show_work_week_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- gnome_calendar_set_view (gcal, GNOME_CAL_WORK_WEEK_VIEW);
-}
-
-static void
-show_week_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- gnome_calendar_set_view (gcal, GNOME_CAL_WEEK_VIEW);
-}
-
-static void
-show_month_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- gnome_calendar_set_view (gcal, GNOME_CAL_MONTH_VIEW);
-}
-
-static void
-show_list_view_clicked (BonoboUIComponent *uic, gpointer data, const gchar *path)
-{
- GnomeCalendar *gcal;
-
- gcal = GNOME_CALENDAR (data);
-
- gnome_calendar_set_view (gcal, GNOME_CAL_LIST_VIEW);
-}
-
-struct _sensitize_item {
- const gchar *command;
- guint32 enable;
-};
-
-static void
-sensitize_items(BonoboUIComponent *uic, struct _sensitize_item *items, guint32 mask)
-{
- while (items->command) {
- gchar command[32];
-
- if (strlen(items->command)>=21) {
- g_warning ("items->command >= 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++;
- }
-}
-
-static struct _sensitize_item taskpad_sensitize_table[] = {
- { "Cut", E_CAL_MENU_SELECT_EDITABLE | E_CAL_MENU_SELECT_ANY },
- { "Copy", E_CAL_MENU_SELECT_ANY },
- { "Paste", E_CAL_MENU_SELECT_EDITABLE },
- { "Delete", E_CAL_MENU_SELECT_EDITABLE },
- { NULL }
-};
-
-/* Sensitizes the UI Component menu/toolbar tasks commands based on the number
- * of selected tasks. If enable is FALSE, all will be disabled. Otherwise, the
- * currently-selected number of tasks will be used.
- */
-static void
-sensitize_taskpad_commands (GnomeCalendar *gcal, BonoboControl *control, gboolean enable)
-{
- BonoboUIComponent *uic;
- ECalendarTable *task_pad;
- ECalModel *model;
- GSList *selected, *l;
- ECalMenu *menu;
- GPtrArray *events;
- ECalMenuTargetSelect *t;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- menu = gnome_calendar_get_calendar_menu (gcal);
- task_pad = gnome_calendar_get_task_pad(gcal);
- model = e_calendar_table_get_model (task_pad);
- selected = e_calendar_table_get_selected(task_pad);
- events = g_ptr_array_new();
- 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);
- if (!enable)
- t->target.mask = ~((~t->target.mask) & E_CAL_MENU_SELECT_EDITABLE);
-
- sensitize_items(uic, taskpad_sensitize_table, t->target.mask);
-}
-
-/* Callback used when the selection in the calendar views changes */
-static void
-gcal_calendar_selection_changed_cb (GnomeCalendar *gcal, gpointer data)
-{
- BonoboControl *control;
-
- control = BONOBO_CONTROL (data);
-
- calendar_control_sensitize_calendar_commands (control, gcal, TRUE);
-}
-
-/* Callback used when the selection in the taskpad changes */
-static void
-gcal_taskpad_selection_changed_cb (GnomeCalendar *gcal, gpointer data)
-{
- BonoboControl *control;
-
- control = BONOBO_CONTROL (data);
-
- sensitize_taskpad_commands (gcal, control, TRUE);
-}
-
-/* Callback used when the focus changes for a calendar view */
-static void
-gcal_calendar_focus_change_cb (GnomeCalendar *gcal, gboolean in, gpointer data)
-{
- BonoboControl *control;
- FocusData *focus;
-
- control = BONOBO_CONTROL (data);
-
- focus = g_object_get_data (G_OBJECT (control), "focus_data");
- g_return_if_fail (focus != NULL);
-
- if (in) {
- g_signal_connect (gcal, "calendar_selection_changed",
- G_CALLBACK (gcal_calendar_selection_changed_cb), control);
- calendar_control_sensitize_calendar_commands (control, gcal, TRUE);
- focus->calendar_focused = TRUE;
- } else if (focus->calendar_focused) {
- g_signal_handlers_disconnect_by_func (
- gcal, G_CALLBACK (gcal_calendar_selection_changed_cb), control);
- calendar_control_sensitize_calendar_commands (control, gcal, FALSE);
- focus->calendar_focused = FALSE;
- }
-}
-
-/* Callback used when the taskpad focus changes */
-static void
-gcal_taskpad_focus_change_cb (GnomeCalendar *gcal, gboolean in, gpointer data)
-{
- BonoboControl *control;
- FocusData *focus;
-
- control = BONOBO_CONTROL (data);
-
- focus = g_object_get_data (G_OBJECT (control), "focus_data");
- g_return_if_fail (focus != NULL);
-
- if (in) {
- g_signal_connect (gcal, "taskpad_selection_changed",
- G_CALLBACK (gcal_taskpad_selection_changed_cb), control);
- sensitize_taskpad_commands (gcal, control, TRUE);
- focus->taskpad_focused = TRUE;
- } else if (focus->taskpad_focused) {
- /* With Bonobo controls, we may get unpaired focus_out events.
- * That is why we have to keep track of this ourselves instead
- * of blindly assumming that we are getting this event because
- * the taskpad was in fact focused.
- */
- g_signal_handlers_disconnect_by_func (
- gcal, G_CALLBACK (gcal_taskpad_selection_changed_cb), control);
- sensitize_taskpad_commands (gcal, control, FALSE);
- focus->taskpad_focused = FALSE;
- }
-
-}
-
-static void
-help_debug (BonoboUIComponent *uid, gpointer data, const gchar *path)
-{
- calendar_component_show_logger ((GtkWidget *) data);
-}
-
-static BonoboUIVerb verbs [] = {
-
- BONOBO_UI_VERB ("ShowDayView", show_day_view_clicked),
- BONOBO_UI_VERB ("ShowWorkWeekView", show_work_week_view_clicked),
- BONOBO_UI_VERB ("ShowWeekView", show_week_view_clicked),
- BONOBO_UI_VERB ("ShowMonthView", show_month_view_clicked),
- BONOBO_UI_VERB ("ShowListView", show_list_view_clicked),
-
- BONOBO_UI_VERB ("HelpDebug", help_debug),
- BONOBO_UI_VERB_END
-};
-
-void
-calendar_control_activate (BonoboControl *control,
- GnomeCalendar *gcal)
-{
- Bonobo_UIContainer remote_uih;
- BonoboUIComponent *uic;
- FocusData *focus;
- 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);
-
- gnome_calendar_set_ui_component (gcal, uic);
-
- bonobo_ui_component_add_verb_list_with_data (uic, verbs, gcal);
-
- bonobo_ui_component_freeze (uic, NULL);
-
- xmlfile = g_build_filename (EVOLUTION_UIDIR,
- "evolution-calendar.xml",
- NULL);
- bonobo_ui_util_set_ui (uic, PREFIX,
- xmlfile,
- "evolution-calendar",
- NULL);
- g_free (xmlfile);
-
- gnome_calendar_setup_view_menus (gcal, uic);
-
- g_signal_connect (gcal, "calendar_focus_change",
- G_CALLBACK (gcal_calendar_focus_change_cb), control);
- g_signal_connect (gcal, "taskpad_focus_change",
- G_CALLBACK (gcal_taskpad_focus_change_cb), control);
-
- e_menu_activate((EMenu *)gnome_calendar_get_calendar_menu (gcal), uic, 1);
- e_menu_activate((EMenu *)gnome_calendar_get_taskpad_menu (gcal), uic, 1);
-
- calendar_control_sensitize_calendar_commands (control, gcal, TRUE);
- sensitize_taskpad_commands (gcal, control, TRUE);
-
- bonobo_ui_component_thaw (uic, NULL);
-
- focus = g_new (FocusData, 1);
- focus->calendar_focused = FALSE;
- focus->taskpad_focused = FALSE;
-
- g_object_set_data (G_OBJECT (control), "focus_data", focus);
-}
-
-void
-calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal)
-{
- FocusData *focus;
- BonoboUIComponent *uic;
-
- uic = bonobo_control_get_ui_component (control);
- g_return_if_fail (uic != NULL);
-
- e_menu_activate((EMenu *)gnome_calendar_get_calendar_menu (gcal), uic, 0);
- e_menu_activate((EMenu *)gnome_calendar_get_taskpad_menu (gcal), uic, 0);
-
- gnome_calendar_set_ui_component (gcal, NULL);
-
- focus = g_object_get_data (G_OBJECT (control), "focus_data");
- g_return_if_fail (focus != NULL);
-
- g_object_set_data (G_OBJECT (control), "focus_data", NULL);
- g_free (focus);
-
- gnome_calendar_discard_view_menus (gcal);
-
- g_signal_handlers_disconnect_matched (gcal, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, control);
-
- bonobo_ui_component_rm (uic, "/", NULL);
- bonobo_ui_component_unset_container (uic, NULL);
-}
diff --git a/calendar/gui/calendar-commands.h.dead b/calendar/gui/calendar-commands.h.dead
deleted file mode 100644
index 605230302e..0000000000
--- a/calendar/gui/calendar-commands.h.dead
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Evolution calendar - Commands for the calendar GUI control
- *
- * 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:
- * Miguel de Icaza <miguel@ximian.com>
- * Federico Mena-Quintero <federico@ximian.com>
- * Seth Alves <alves@hungry.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef CALENDAR_COMMANDS_H
-#define CALENDAR_COMMANDS_H
-
-#include "gnome-cal.h"
-
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-ui-component.h>
-
-void calendar_control_activate (BonoboControl *control, GnomeCalendar *gcal);
-void calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal);
-
-void calendar_control_sensitize_calendar_commands (BonoboControl *control, GnomeCalendar *gcal, gboolean enable);
-
-void calendar_goto_today (GnomeCalendar *gcal);
-
-void calendar_command_print (GnomeCalendar *gcal, GtkPrintOperationAction action);
-
-#endif /* CALENDAR_COMMANDS_H */
diff --git a/calendar/gui/calendar-component.c.dead b/calendar/gui/calendar-component.c.dead
deleted file mode 100644
index 9cd0e8eb21..0000000000
--- a/calendar/gui/calendar-component.c.dead
+++ /dev/null
@@ -1,710 +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:
- * Ettore Perazzoli <ettore@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 <string.h>
-#include <errno.h>
-#include <glib/gi18n-lib.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-exception.h>
-#include <libical/icalvcal.h>
-#include <libedataserver/e-data-server-util.h>
-#include <libedataserver/e-url.h>
-#include <libecal/e-cal-time-util.h>
-#include <libedataserverui/e-source-selector.h>
-#include <shell/e-user-creatable-items-handler.h>
-#include <shell/e-component-view.h>
-#include "e-calendar-view.h"
-#include "calendar-config-keys.h"
-#include "calendar-config.h"
-#include "calendar-component.h"
-#include "calendar-commands.h"
-#include "control-factory.h"
-#include "gnome-cal.h"
-#include "migration.h"
-#include "comp-util.h"
-#include "common/authentication.h"
-#include "dialogs/calendar-setup.h"
-#include "dialogs/comp-editor.h"
-#include "dialogs/copy-source-dialog.h"
-#include "dialogs/event-editor.h"
-#include "misc/e-info-label.h"
-#include "e-util/e-non-intrusive-error-dialog.h"
-#include "e-util/gconf-bridge.h"
-#include "e-util/e-error.h"
-#include "e-cal-menu.h"
-#include "e-cal-popup.h"
-#include "e-attachment-handler-calendar.h"
-
-/* IDs for user creatable items */
-#define CREATE_EVENT_ID "event"
-#define CREATE_MEETING_ID "meeting"
-#define CREATE_ALLDAY_EVENT_ID "allday-event"
-#define CREATE_CALENDAR_ID "calendar"
-#define CALENDAR_ERROR_LEVEL_KEY "/apps/evolution/calendar/display/error_level"
-#define CALENDAR_ERROR_TIME_OUT_KEY "/apps/evolution/calendar/display/error_timeout"
-
-static BonoboObjectClass *parent_class = NULL;
-
-typedef struct
-{
- ESourceList *source_list;
- ESourceList *task_source_list;
- ESourceList *memo_source_list;
-
- GSList *source_selection;
- GSList *task_source_selection;
- GSList *memo_source_selection;
-
- GnomeCalendar *calendar;
-
- GtkWidget *source_selector;
-
- BonoboControl *view_control;
-
- GList *notifications;
-
- gfloat vpane_pos;
-} CalendarComponentView;
-
-struct _CalendarComponentPrivate {
-
- gint gconf_notify_id;
-
- ESourceList *source_list;
- ESourceList *task_source_list;
- ESourceList *memo_source_list;
-
- EActivityHandler *activity_handler;
- ELogger *logger;
-
- GList *views;
-
- ECal *create_ecal;
-
- GList *notifications;
-};
-
-static void
-calcomp_vpane_realized (GtkWidget *vpane, CalendarComponentView *view)
-{
- gtk_paned_set_position (GTK_PANED (vpane), (gint)(view->vpane_pos*vpane->allocation.height));
-
-}
-
-static gboolean
-calcomp_vpane_resized (GtkWidget *vpane, GdkEventButton *e, CalendarComponentView *view)
-{
-
- view->vpane_pos = gtk_paned_get_position (GTK_PANED (vpane));
- calendar_config_set_tag_vpane_pos (view->vpane_pos/(gfloat)vpane->allocation.height);
-
- return FALSE;
-}
-
-/* Utility functions. */
-
-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_task_memo_selection (CalendarComponentView *component_view, ECalSourceType type)
-{
- GSList *uids_selected, *l, *source_selection;
- ESourceList *source_list = NULL;
-
- if (type == E_CAL_SOURCE_TYPE_TODO) {
- /* Get the selection in gconf */
- uids_selected = calendar_config_get_tasks_selected ();
- source_list = component_view->task_source_list;
- source_selection = component_view->task_source_selection;
- } else {
- uids_selected = calendar_config_get_memos_selected ();
- source_list = component_view->memo_source_list;
- source_selection = component_view->memo_source_selection;
- }
-
- /* Remove any that aren't there any more */
- for (l = source_selection; l; l = l->next) {
- gchar *uid = l->data;
- ESource *source;
-
- source = e_source_list_peek_source_by_uid (component_view->source_list, uid);
- if (!source)
- gnome_calendar_remove_source_by_uid (component_view->calendar, type, uid);
- else if (!is_in_uids (uids_selected, source))
- gnome_calendar_remove_source (component_view->calendar, type, source);
-
- g_free (uid);
- }
- g_slist_free (source_selection);
-
- /* Make sure the whole selection is there */
- for (l = uids_selected; l; l = l->next) {
- gchar *uid = l->data;
- ESource *source;
-
- source = e_source_list_peek_source_by_uid (source_list, uid);
- if (source && !gnome_calendar_add_source (component_view->calendar, type, source)) {
- /* FIXME do something */;
- }
- }
-
- if (type == E_CAL_SOURCE_TYPE_TODO)
- component_view->task_source_selection = uids_selected;
- else
- component_view->memo_source_selection = uids_selected;
-}
-
-static void
-update_primary_task_memo_selection (CalendarComponentView *component_view, ECalSourceType type)
-{
- ESource *source = NULL;
- gchar *uid;
- ESourceList *source_list = NULL;
-
- if (type == E_CAL_SOURCE_TYPE_TODO) {
- uid = calendar_config_get_primary_tasks ();
- source_list = component_view->task_source_list;
- } else {
- uid = calendar_config_get_primary_memos ();
- source_list = component_view->memo_source_list;
- }
-
- if (uid) {
- source = e_source_list_peek_source_by_uid (source_list, uid);
-
- g_free (uid);
- }
-
- if (source)
- gnome_calendar_set_default_source (component_view->calendar, type, source);
-}
-
-static void
-config_primary_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- CalendarComponent *calendar_component = data;
- CalendarComponentPrivate *priv = calendar_component->priv;
-
- if (priv->create_ecal) {
- g_object_unref (priv->create_ecal);
- priv->create_ecal = NULL;
- }
-}
-
-static void
-config_tasks_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- update_task_memo_selection (data, E_CAL_SOURCE_TYPE_TODO);
-}
-
-static void
-config_primary_tasks_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- update_primary_task_memo_selection (data, E_CAL_SOURCE_TYPE_TODO);
-}
-
-static void
-config_memos_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- update_task_memo_selection (data, E_CAL_SOURCE_TYPE_JOURNAL);
-}
-
-static void
-config_primary_memos_selection_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- update_primary_task_memo_selection (data, E_CAL_SOURCE_TYPE_JOURNAL);
-}
-
-/* Evolution::Component CORBA methods. */
-static void
-impl_handleURI (PortableServer_Servant servant, const gchar *uri, CORBA_Environment *ev)
-{
- CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
- CalendarComponentPrivate *priv;
- GList *l;
- CalendarComponentView *view = NULL;
- gchar *src_uid = NULL;
- gchar *uid = NULL;
- gchar *rid = NULL;
-
- priv = calendar_component->priv;
-
- l = g_list_last (priv->views);
- if (!l)
- return;
-
- view = l->data;
-
- if (!strncmp (uri, "calendar:", 9)) {
- EUri *euri = e_uri_new (uri);
- const gchar *p;
- gchar *header, *content;
- gsize len, clen;
- time_t start = -1, end = -1;
-
- 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, "startdate")) {
- start = time_from_isodate (content);
- } else if (!g_ascii_strcasecmp (header, "enddate")) {
- end = time_from_isodate (content);
- } else 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 (start != -1) {
-
- if (end == -1)
- gnome_calendar_set_selected_time_range (view->calendar, start);
- }
- if (src_uid && uid)
- gnome_calendar_edit_appointment (view->calendar, src_uid, uid, rid);
-
- g_free (src_uid);
- g_free (uid);
- g_free (rid);
- }
- e_uri_free (euri);
- }
-}
-
-static void
-config_create_ecal_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- CalendarComponent *calendar_component = data;
- CalendarComponentPrivate *priv;
-
- priv = calendar_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 (CalendarComponent *calendar_component, CalendarComponentView *component_view)
-{
- CalendarComponentPrivate *priv;
- ESource *source = NULL;
- gchar *uid;
- guint not;
-
- priv = calendar_component->priv;
-
- /* Try to use the client from the calendar first to avoid re-opening things */
- if (component_view) {
- ECal *default_ecal;
-
- default_ecal = gnome_calendar_get_default_client (component_view->calendar);
- if (default_ecal)
- return default_ecal;
- }
-
- /* If there is an existing fall back, use that */
- 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_calendar ();
- 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_EVENT);
- }
-
- 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_EVENT);
- }
-
- 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 calendar '%s' for creating events and meetings"),
- e_source_peek_name (source));
-
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- g_object_unref (priv->create_ecal);
- priv->create_ecal = NULL;
-
- return NULL;
- }
-
- } else {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_OK,
- _("There is no calendar available for creating events and meetings"));
- 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_calendar (config_create_ecal_changed_cb,
- calendar_component);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- /* Save the primary source for use elsewhere */
- calendar_config_set_primary_calendar (e_source_peek_uid (source));
-
- return priv->create_ecal;
-}
-
-static CalendarComponentView *
-create_component_view (CalendarComponent *calendar_component)
-{
- CalendarComponentPrivate *priv;
- CalendarComponentView *component_view;
- GtkWidget **vpane;
- guint not;
-
- priv = calendar_component->priv;
-
- /* Create the calendar component view */
- component_view = g_new0 (CalendarComponentView, 1);
-
- vpane = gtk_vpaned_new ();
- g_signal_connect_after (vpane, "realize",
- G_CALLBACK(calcomp_vpane_realized), component_view);
- g_signal_connect (vpane, "button_release_event",
- G_CALLBACK (calcomp_vpane_resized), component_view);
- gtk_widget_show (vpane);
- /* Add the source lists */
- component_view->source_list = g_object_ref (priv->source_list);
- component_view->task_source_list = g_object_ref (priv->task_source_list);
- component_view->memo_source_list = g_object_ref (priv->memo_source_list);
- /* Create sidebar selector */
- component_view->source_selector = e_source_selector_new (calendar_component->priv->source_list);
- g_signal_connect (
- component_view->source_selector, "data-dropped",
- G_CALLBACK (selector_tree_data_dropped), calendar_component);
-
- gtk_drag_dest_set(component_view->source_selector, GTK_DEST_DEFAULT_ALL, drag_types,
- num_drag_types, GDK_ACTION_COPY | GDK_ACTION_MOVE);
-
- gtk_widget_show (component_view->source_selector);
-
- selector_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_container_add (GTK_CONTAINER (selector_scrolled_window), component_view->source_selector);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (selector_scrolled_window),
- GTK_SHADOW_IN);
- gtk_widget_show (selector_scrolled_window);
-
- component_view->info_label = (EInfoLabel *)e_info_label_new("x-office-calendar");
- e_info_label_set_info (component_view->info_label, _("Calendars"), "");
- gtk_widget_show (GTK_WIDGET (component_view->info_label));
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX (vbox), GTK_WIDGET (component_view->info_label), FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX (vbox), selector_scrolled_window, TRUE, TRUE, 0);
- gtk_widget_show (vbox);
-
- gtk_paned_pack1 (GTK_PANED (vpane), vbox, FALSE, FALSE);
-
- component_view->sidebar_control = bonobo_control_new (vpane);
-
- /* Create main view */
- component_view->view_control = control_factory_new_control ();
- if (!component_view->view_control) {
- /* FIXME free memory */
-
- return NULL;
- }
-
- component_view->calendar = (GnomeCalendar *) bonobo_control_get_widget (component_view->view_control);
-
- gtk_paned_pack2 (GTK_PANED (vpane), gnome_calendar_get_tag (component_view->calendar), FALSE, FALSE);
-
- /* This signal is thrown if backends die - we update the selector */
- g_signal_connect (component_view->calendar, "source_added",
- G_CALLBACK (source_added_cb), component_view);
- g_signal_connect (component_view->calendar, "source_removed",
- G_CALLBACK (source_removed_cb), component_view);
-
- /* Create status bar */
- statusbar_widget = e_task_bar_new ();
- component_view->activity_handler = e_activity_handler_new ();
- e_activity_handler_attach_task_bar (component_view->activity_handler, E_TASK_BAR (statusbar_widget));
- e_activity_handler_attach_task_bar (priv->activity_handler, E_TASK_BAR (statusbar_widget));
-
- gtk_widget_show (statusbar_widget);
-
- component_view->statusbar_control = bonobo_control_new (statusbar_widget);
-
- gnome_calendar_set_activity_handler (component_view->calendar, component_view->activity_handler);
-
- /* 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);
-
->>>>>>> 23df769955ea54f756a579c19964df87ae6fd5c8:calendar/gui/calendar-component.c
- /* Set up the "new" item handler */
- g_signal_connect (component_view->view_control, "activate", G_CALLBACK (control_activate_cb), component_view);
-
- /* Load the selection from the last run */
- update_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_TODO);
- update_primary_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_TODO);
- update_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_JOURNAL);
- update_primary_task_memo_selection (component_view, E_CAL_SOURCE_TYPE_JOURNAL);
-
- /* If the tasks/memos selection changes elsewhere, update it for the mini
- mini tasks view sidebar */
- not = calendar_config_add_notification_tasks_selected (config_tasks_selection_changed_cb,
- component_view);
- component_view->notifications = g_list_prepend (component_view->notifications, GUINT_TO_POINTER (not));
-
- not = calendar_config_add_notification_memos_selected (config_memos_selection_changed_cb,
- component_view);
- component_view->notifications = g_list_prepend (component_view->notifications, GUINT_TO_POINTER (not));
-
- not = calendar_config_add_notification_primary_tasks (config_primary_tasks_selection_changed_cb,
- component_view);
- component_view->notifications = g_list_prepend (component_view->notifications, GUINT_TO_POINTER (not));
-
- not = calendar_config_add_notification_primary_memos (config_primary_memos_selection_changed_cb,
- component_view);
- component_view->notifications = g_list_prepend (component_view->notifications, GUINT_TO_POINTER (not));
-
- return component_view;
-}
-
-static void
-destroy_component_view (CalendarComponentView *component_view)
-{
- GList *l;
-
- if (component_view->source_list)
- g_object_unref (component_view->source_list);
-
- if (component_view->task_source_list)
- g_object_unref (component_view->task_source_list);
-
- if (component_view->memo_source_list)
- g_object_unref (component_view->memo_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);
-
- if (component_view->task_source_selection) {
- g_slist_foreach (component_view->task_source_selection, (GFunc) g_free, NULL);
- g_slist_free (component_view->task_source_selection);
- }
-
- if (component_view->memo_source_selection) {
- g_slist_foreach (component_view->memo_source_selection, (GFunc) g_free, NULL);
- g_slist_free (component_view->memo_source_selection);
- }
-
- g_free (component_view);
-}
-
-static void
-view_destroyed_cb (gpointer data, GObject *where_the_object_was)
-{
- CalendarComponent *calendar_component = data;
- CalendarComponentPrivate *priv;
- GList *l;
-
- priv = calendar_component->priv;
-
- for (l = priv->views; l; l = l->next) {
- CalendarComponentView *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;
- }
- }
-}
-
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- CalendarComponent *calendar_component = CALENDAR_COMPONENT (object);
- CalendarComponentPrivate *priv = calendar_component->priv;
- GList *l;
-
- if (priv->source_list != NULL) {
- g_object_unref (priv->source_list);
- priv->source_list = NULL;
- }
-
- if (priv->activity_handler != NULL) {
- g_object_unref (priv->activity_handler);
- priv->activity_handler = NULL;
- }
-
- if (priv->activity_handler != NULL) {
- g_object_unref (priv->activity_handler);
- priv->activity_handler = NULL;
- }
-
- if (priv->create_ecal) {
- g_object_unref (priv->create_ecal);
- priv->create_ecal = NULL;
- }
-
- for (l = priv->views; l; l = l->next) {
- CalendarComponentView *component_view = l->data;
-
- g_object_weak_unref (G_OBJECT (component_view->view_control), view_destroyed_cb, calendar_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
-calendar_component_class_init (CalendarComponentClass *class)
-{
- POA_GNOME_Evolution_Component__epv *epv = &class->epv;
- GObjectClass *object_class = G_OBJECT_CLASS (class);
-
- bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
- parent_class = g_type_class_peek_parent (class);
-
- epv->handleURI = impl_handleURI;
-
- object_class->dispose = impl_dispose;
-}
-
-static void
-calendar_component_init (CalendarComponent *component)
-{
- CalendarComponentPrivate *priv;
- guint not;
-
- not = calendar_config_add_notification_primary_calendar (config_primary_selection_changed_cb,
- component);
- priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not));
-
- priv->logger = e_logger_create ("calendar");
- priv->activity_handler = e_activity_handler_new ();
- e_activity_handler_set_logger (priv->activity_handler, priv->logger);
- e_activity_handler_set_error_flush_time (priv->activity_handler,eni_config_get_error_timeout (CALENDAR_ERROR_TIME_OUT_KEY)*1000);
-
- component->priv = priv;
-
- e_cal_get_sources (&priv->task_source_list, E_CAL_SOURCE_TYPE_TODO, NULL);
- e_cal_get_sources (&priv->memo_source_list, E_CAL_SOURCE_TYPE_JOURNAL, NULL);
-}
diff --git a/calendar/gui/calendar-component.h.dead b/calendar/gui/calendar-component.h.dead
deleted file mode 100644
index fbdd8efd23..0000000000
--- a/calendar/gui/calendar-component.h.dead
+++ /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:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
- *
- */
-
-#ifndef _CALENDAR_COMPONENT_H_
-#define _CALENDAR_COMPONENT_H_
-
-#include <bonobo/bonobo-object.h>
-#include <libedataserver/e-source-list.h>
-#include <widgets/misc/e-activity-handler.h>
-#include "Evolution.h"
-
-#define CALENDAR_TYPE_COMPONENT (calendar_component_get_type ())
-#define CALENDAR_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALENDAR_TYPE_COMPONENT, CalendarComponent))
-#define CALENDAR_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALENDAR_TYPE_COMPONENT, CalendarComponentClass))
-#define CALENDAR_IS_COMPONENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALENDAR_TYPE_COMPONENT))
-#define CALENDAR_IS_COMPONENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), CALENDAR_TYPE_COMPONENT))
-
-typedef struct _CalendarComponent CalendarComponent;
-typedef struct _CalendarComponentPrivate CalendarComponentPrivate;
-typedef struct _CalendarComponentClass CalendarComponentClass;
-
-struct _CalendarComponent {
- BonoboObject parent;
-
- CalendarComponentPrivate *priv;
-};
-
-struct _CalendarComponentClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Component__epv epv;
-};
-
-GType calendar_component_get_type (void);
-
-#endif /* _CALENDAR_COMPONENT_H_ */
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index a8fa9aef72..e8cbc72436 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -483,6 +483,7 @@ cal_comp_selection_set_string_list (GtkSelectionData *data, GSList *str_list)
/* format is "str1\0str2\0...strN\0" */
GSList *p;
GByteArray *array;
+ GdkAtom target;
g_return_if_fail (data != NULL);
@@ -497,7 +498,8 @@ cal_comp_selection_set_string_list (GtkSelectionData *data, GSList *str_list)
g_byte_array_append (array, c, strlen ((const gchar *) c) + 1);
}
- gtk_selection_data_set (data, data->target, 8, array->data, array->len);
+ target = gtk_selection_data_get_target (data);
+ gtk_selection_data_set (data, target, 8, array->data, array->len);
g_byte_array_free (array, TRUE);
}
@@ -512,17 +514,22 @@ cal_comp_selection_set_string_list (GtkSelectionData *data, GSList *str_list)
* @return Newly allocated GSList of strings.
**/
GSList *
-cal_comp_selection_get_string_list (GtkSelectionData *data)
+cal_comp_selection_get_string_list (GtkSelectionData *selection_data)
{
/* format is "str1\0str2\0...strN\0" */
gchar *inptr, *inend;
GSList *list;
+ const guchar *data;
+ gint length;
- g_return_val_if_fail (data != NULL, NULL);
+ g_return_val_if_fail (selection_data != NULL, NULL);
+
+ data = gtk_selection_data_get_data (selection_data);
+ length = gtk_selection_data_get_length (selection_data);
list = NULL;
- inptr = (gchar *)data->data;
- inend = (gchar *)(data->data + data->length);
+ inptr = (gchar *) data;
+ inend = (gchar *) (data + length);
while (inptr < inend) {
gchar *start = inptr;
diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am
index 6e9cb26c05..0bd89de799 100644
--- a/calendar/gui/dialogs/Makefile.am
+++ b/calendar/gui/dialogs/Makefile.am
@@ -15,7 +15,8 @@ libcal_dialogs_la_CPPFLAGS = \
-DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
-DPREFIX=\""$(prefix)"\" \
$(GNOME_PLATFORM_CFLAGS) \
- $(EVOLUTION_CALENDAR_CFLAGS)
+ $(EVOLUTION_CALENDAR_CFLAGS) \
+ $(CAMEL_CFLAGS)
ecalendarincludedir = $(privincludedir)/calendar/gui/dialogs
diff --git a/calendar/gui/dialogs/alarm-dialog.c b/calendar/gui/dialogs/alarm-dialog.c
index f7d5443da0..9fe23fe525 100644
--- a/calendar/gui/dialogs/alarm-dialog.c
+++ b/calendar/gui/dialogs/alarm-dialog.c
@@ -1209,6 +1209,7 @@ gboolean
alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm)
{
Dialog dialog;
+ GtkWidget *container;
gint response_id;
g_return_val_if_fail (alarm != NULL, FALSE);
@@ -1234,8 +1235,12 @@ alarm_dialog_run (GtkWidget *parent, ECal *ecal, ECalComponentAlarm *alarm)
alarm_to_dialog (&dialog);
gtk_widget_ensure_style (dialog.toplevel);
- 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);
+
+ container = gtk_dialog_get_action_area (GTK_DIALOG (dialog.toplevel));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 12);
+
+ container = gtk_dialog_get_content_area (GTK_DIALOG (dialog.toplevel));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 0);
gtk_window_set_icon_name (
GTK_WINDOW (dialog.toplevel), "x-office-calendar");
diff --git a/calendar/gui/dialogs/alarm-dialog.ui b/calendar/gui/dialogs/alarm-dialog.ui
index 94ae8009c4..bf6e570e4a 100644
--- a/calendar/gui/dialogs/alarm-dialog.ui
+++ b/calendar/gui/dialogs/alarm-dialog.ui
@@ -411,7 +411,7 @@
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="label" translatable="yes">extra times every</property>
+ <property name="label" translatable="yes" comments="This is part of the sentence: 'Repeat the alarm %d extra times every %d minutes'. Where %d are numbers.">extra times every</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
diff --git a/calendar/gui/dialogs/alarm-list-dialog.c b/calendar/gui/dialogs/alarm-list-dialog.c
index c350b4774d..b8588d666d 100644
--- a/calendar/gui/dialogs/alarm-list-dialog.c
+++ b/calendar/gui/dialogs/alarm-list-dialog.c
@@ -261,6 +261,7 @@ gboolean
alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store)
{
Dialog dialog;
+ GtkWidget *container;
gint response_id;
dialog.ecal = ecal;
@@ -279,14 +280,19 @@ alarm_list_dialog_run (GtkWidget *parent, ECal *ecal, EAlarmList *list_store)
sensitize_buttons (&dialog);
gtk_widget_ensure_style (dialog.toplevel);
- 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);
+
+ container = gtk_dialog_get_action_area (GTK_DIALOG (dialog.toplevel));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 12);
+
+ container = gtk_dialog_get_content_area (GTK_DIALOG (dialog.toplevel));
+ gtk_container_set_border_width (GTK_CONTAINER (container), 0);
gtk_window_set_icon_name (
GTK_WINDOW (dialog.toplevel), "x-office-calendar");
- gtk_window_set_transient_for (GTK_WINDOW (dialog.toplevel),
- GTK_WINDOW (parent));
+ gtk_window_set_transient_for (
+ GTK_WINDOW (dialog.toplevel),
+ GTK_WINDOW (parent));
response_id = gtk_dialog_run (GTK_DIALOG (dialog.toplevel));
gtk_widget_hide (dialog.toplevel);
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index f6ba176d00..914c26c3ec 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -779,8 +779,8 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
/* date/time format */
table = e_builder_get_widget (prefs->builder, "datetime_format_table");
- e_datetime_format_add_setup_widget (table, 0, "calendar", "table", DTFormatKindDateTime, _("Time and date:"));
- e_datetime_format_add_setup_widget (table, 1, "calendar", "table", DTFormatKindDate, _("Date only:"));
+ e_datetime_format_add_setup_widget (table, 0, "calendar", "table", DTFormatKindDateTime, _("Ti_me and date:"));
+ e_datetime_format_add_setup_widget (table, 1, "calendar", "table", DTFormatKindDate, _("_Date only:"));
/* Hide senseless preferences when running in Express mode */
e_shell_hide_widgets_for_express_mode (shell, prefs->builder,
diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c
index 9b396ce2cf..b21c027fe1 100644
--- a/calendar/gui/dialogs/calendar-setup.c
+++ b/calendar/gui/dialogs/calendar-setup.c
@@ -137,7 +137,7 @@ static GtkWidget *
eccp_get_source_type (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
{
static GtkWidget *label, *type;
- gint row;
+ guint row;
CalendarSourceDialog *sdialog = data;
ECalConfigTargetSource *t = (ECalConfigTargetSource *) ec->target;
ESource *source = t->source;
@@ -147,7 +147,7 @@ eccp_get_source_type (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg
if (old)
gtk_widget_destroy (label);
- row = ((GtkTable *)parent)->nrows;
+ g_object_get (parent, "n-rows", &row, NULL);
if (sdialog->original_source) {
label = gtk_label_new (_("Type:"));
@@ -214,14 +214,14 @@ static GtkWidget *
eccp_get_source_name (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data)
{
static GtkWidget *label, *entry;
- gint row;
+ guint row;
ECalConfigTargetSource *t = (ECalConfigTargetSource *) ec->target;
ESource *source = t->source;
if (old)
gtk_widget_destroy (label);
- row = ((GtkTable*)parent)->nrows;
+ g_object_get (parent, "n-rows", &row, NULL);
label = gtk_label_new_with_mnemonic (_("_Name:"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
@@ -257,14 +257,14 @@ eccp_general_offline (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidg
CalendarSourceDialog *sdialog = data;
GtkWidget *offline_setting = NULL;
const gchar *offline_sync;
- gint row;
+ guint row;
const gchar *base_uri = e_source_group_peek_base_uri (sdialog->source_group);
gboolean is_local = base_uri && (g_str_has_prefix (base_uri, "file://") || g_str_has_prefix (base_uri, "contacts://"));
offline_sync = e_source_get_property (sdialog->source, "offline_sync");
if (old)
return old;
else {
- row = ((GtkTable*)parent)->nrows;
+ g_object_get (parent, "n-rows", &row, NULL);
if (sdialog->source_type == E_CAL_SOURCE_TYPE_EVENT)
offline_setting = gtk_check_button_new_with_mnemonic (_("Cop_y calendar contents locally for offline operation"));
@@ -322,10 +322,12 @@ eccp_get_source_color (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWid
{
CalendarSourceDialog *sdialog = data;
static GtkWidget *label, *color_button;
- guint row = GTK_TABLE (parent)->nrows;
+ guint row;
const gchar *color_spec = NULL;
GdkColor color;
+ g_object_get (parent, "n-rows", &row, NULL);
+
if (old)
gtk_widget_destroy (label);
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 9f96011eda..9856bd7c96 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -111,102 +111,6 @@ comp_editor_free_dates (CompEditorPageDates *dates)
e_cal_component_free_icaltimetype (dates->complete);
}
-/* dtstart is only passed in if tt is the dtend. */
-static void
-write_label_piece (struct icaltimetype *tt,
- gchar *buffer,
- gint size,
- gchar *stext,
- const gchar *etext,
- struct icaltimetype *dtstart)
-{
- struct tm tmp_tm = { 0 };
- struct icaltimetype tt_copy = *tt;
- gint len;
-
- /* FIXME: May want to convert the time to an appropriate zone. */
-
- if (stext != NULL)
- strcat (buffer, stext);
-
- /* If we are writing the DTEND (i.e. DTSTART is set), and
- DTEND > DTSTART, subtract 1 day. The DTEND date is not inclusive. */
- if (tt_copy.is_date && dtstart
- && icaltime_compare_date_only (tt_copy, *dtstart) > 0) {
- icaltime_adjust (&tt_copy, -1, 0, 0, 0);
- }
-
- tmp_tm.tm_year = tt_copy.year - 1900;
- tmp_tm.tm_mon = tt_copy.month - 1;
- tmp_tm.tm_mday = tt_copy.day;
- tmp_tm.tm_hour = tt_copy.hour;
- tmp_tm.tm_min = tt_copy.minute;
- tmp_tm.tm_sec = tt_copy.second;
- tmp_tm.tm_isdst = -1;
-
- tmp_tm.tm_wday = time_day_of_week (tt_copy.day, tt_copy.month - 1,
- tt_copy.year);
-
- len = strlen (buffer);
- e_time_format_date_and_time (&tmp_tm,
- calendar_config_get_24_hour_format (),
- !tt_copy.is_date, FALSE,
- &buffer[len], size - len);
- if (etext != NULL)
- strcat (buffer, etext);
-}
-
-/**
- * comp_editor_date_label:
- * @dates: The dates to use in constructing a label
- * @label: The label whose text is to be set
- *
- * Set the text of a label based on the dates available and the user's
- * formatting preferences
- **/
-void
-comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label)
-{
- gchar buffer[1024];
- gboolean start_set = FALSE, end_set = FALSE;
- gboolean complete_set = FALSE, due_set = FALSE;
-
- buffer[0] = '\0';
-
- if (dates->start && !icaltime_is_null_time (*dates->start->value))
- start_set = TRUE;
- if (dates->end && !icaltime_is_null_time (*dates->end->value))
- end_set = TRUE;
- if (dates->complete && !icaltime_is_null_time (*dates->complete))
- complete_set = TRUE;
- if (dates->due && !icaltime_is_null_time (*dates->due->value))
- due_set = TRUE;
-
- if (start_set)
- write_label_piece (dates->start->value, buffer, 1024,
- NULL, NULL, NULL);
-
- if (start_set && end_set)
- write_label_piece (dates->end->value, buffer, 1024,
- _(" to "), NULL, dates->start->value);
-
- if (complete_set) {
- if (start_set)
- write_label_piece (dates->complete, buffer, 1024, _(" (Completed "), ")", NULL);
- else
- write_label_piece (dates->complete, buffer, 1024, _("Completed "), NULL, NULL);
- }
-
- if (due_set && dates->complete == NULL) {
- if (start_set)
- write_label_piece (dates->due->value, buffer, 1024, _(" (Due "), ")", NULL);
- else
- write_label_piece (dates->due->value, buffer, 1024, _("Due "), NULL, NULL);
- }
-
- gtk_label_set_text (GTK_LABEL (label), buffer);
-}
-
/**
* comp_editor_new_date_edit:
* @show_date: Whether to show a date picker in the widget.
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 062e483562..010dd1cbf6 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -42,16 +42,6 @@
#include <e-util/gconf-bridge.h>
#include <shell/e-shell.h>
-#include <camel/camel-url.h>
-#include <camel/camel-exception.h>
-#include <camel/camel-folder.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-mime-message.h>
-#include <camel/camel-file-utils.h>
-#include <camel/camel-stream-fs.h>
-
-#include "mail/mail-tools.h"
-
#include "../print.h"
#include "../comp-util.h"
#include "save-comp.h"
@@ -2974,7 +2964,8 @@ comp_editor_get_mime_attach_list (CompEditor *editor)
EAttachment *attachment;
CamelDataWrapper *wrapper;
CamelMimePart *mime_part;
- CamelStreamMem *mstream;
+ CamelStream *stream;
+ GByteArray *byte_array;
guchar *buffer = NULL;
const gchar *desc, *disp;
gint column_id;
@@ -2990,16 +2981,18 @@ comp_editor_get_mime_attach_list (CompEditor *editor)
continue;
cal_mime_attach = g_malloc0 (sizeof (struct CalMimeAttach));
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
- mstream = (CamelStreamMem *) camel_stream_mem_new ();
+ wrapper = camel_medium_get_content (CAMEL_MEDIUM (mime_part));
+
+ byte_array = g_byte_array_new ();
+ stream = camel_stream_mem_new_with_byte_array (byte_array);
- camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) mstream);
- buffer = g_memdup (mstream->buffer->data, mstream->buffer->len);
+ camel_data_wrapper_decode_to_stream (wrapper, stream);
+ buffer = g_memdup (byte_array->data, byte_array->len);
camel_mime_part_set_content_id (mime_part, NULL);
cal_mime_attach->encoded_data = (gchar *)buffer;
- cal_mime_attach->length = mstream->buffer->len;
+ cal_mime_attach->length = byte_array->len;
cal_mime_attach->filename = g_strdup (camel_mime_part_get_filename (mime_part));
desc = camel_mime_part_get_description (mime_part);
if (!desc || *desc == '\0')
@@ -3014,7 +3007,7 @@ comp_editor_get_mime_attach_list (CompEditor *editor)
attach_list = g_slist_append (attach_list, cal_mime_attach);
- camel_object_unref (mstream);
+ g_object_unref (stream);
}
diff --git a/calendar/gui/dialogs/delete-comp.c b/calendar/gui/dialogs/delete-comp.c
index e0a431ffb7..ecdaf58762 100644
--- a/calendar/gui/dialogs/delete-comp.c
+++ b/calendar/gui/dialogs/delete-comp.c
@@ -166,12 +166,12 @@ delete_component_dialog (ECalComponent *comp,
}
static void
-cb_toggled_cb (GtkWidget *toggle, gpointer data)
+cb_toggled_cb (GtkToggleButton *toggle, gpointer data)
{
gboolean active = FALSE;
GtkWidget *entry = (GtkWidget *) data;
- active = GTK_TOGGLE_BUTTON (toggle)->active;
+ active = gtk_toggle_button_get_active (toggle);
gtk_widget_set_sensitive (entry, active);
}
@@ -208,13 +208,13 @@ prompt_retract_dialog (ECalComponent *comp, gchar **retract_text, GtkWidget *par
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
- gtk_box_set_spacing ((GtkBox *) (GTK_DIALOG (dialog)->vbox), 12);
- vbox = GTK_WIDGET (GTK_DIALOG (dialog)->vbox);
+ vbox = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_set_spacing (GTK_BOX (vbox), 12);
cb = gtk_check_button_new_with_mnemonic (_("_Delete this item from all other recipient's mailboxes?"));
gtk_container_add (GTK_CONTAINER (vbox), cb);
- label = gtk_label_new_with_mnemonic ("_Retract comment");
+ label = gtk_label_new_with_mnemonic (_("_Retract comment"));
frame = gtk_frame_new (NULL);
gtk_frame_set_label_widget ((GtkFrame *) frame, label);
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 7184a63d9e..262751fa86 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -117,6 +117,7 @@ create_schedule_page (CompEditor *editor)
EventEditorPrivate *priv;
ENameSelector *name_selector;
CompEditorPage *page;
+ GtkWidget *content_area;
priv = EVENT_EDITOR_GET_PRIVATE (editor);
@@ -124,6 +125,9 @@ create_schedule_page (CompEditor *editor)
_("Free/Busy"), GTK_WINDOW (editor), GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+ content_area =
+ gtk_dialog_get_content_area (GTK_DIALOG (priv->sched_window));
+
g_signal_connect (
priv->sched_window, "response",
G_CALLBACK (gtk_widget_hide), NULL);
@@ -134,7 +138,7 @@ create_schedule_page (CompEditor *editor)
priv->sched_page = schedule_page_new (priv->model, editor);
page = COMP_EDITOR_PAGE (priv->sched_page);
gtk_container_add (
- GTK_CONTAINER (GTK_DIALOG (priv->sched_window)->vbox),
+ GTK_CONTAINER (content_area),
comp_editor_page_get_widget (page));
name_selector = event_page_get_name_selector (priv->event_page);
@@ -282,6 +286,7 @@ event_editor_constructor (GType type,
CompEditorPage *page;
EventEditorPrivate *priv;
GtkActionGroup *action_group;
+ GtkWidget *content_area;
ECal *client;
gboolean is_meeting;
GtkWidget *alarm_page;
@@ -317,6 +322,9 @@ event_editor_constructor (GType type,
priv->recur_window, "delete-event",
G_CALLBACK(gtk_widget_hide_on_delete), NULL);
+ content_area =
+ gtk_dialog_get_content_area (GTK_DIALOG (priv->recur_window));
+
priv->recur_page = recurrence_page_new (editor);
page = COMP_EDITOR_PAGE (priv->recur_page);
if (!e_shell_get_express_mode(e_shell_get_default())) {
@@ -556,6 +564,9 @@ event_editor_init (EventEditor *ee)
g_error_free (error);
}
+ action = comp_editor_get_action (editor, "print");
+ gtk_action_set_tooltip (action, _("Print this event"));
+
/* Hide send options. */
action = comp_editor_get_action (editor, "send-options");
gtk_action_set_visible (action, FALSE);
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index f37861827d..1dfabb7597 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -2137,6 +2137,7 @@ get_widgets (EventPage *epage)
EventPagePrivate *priv;
GSList *accel_groups;
GtkAction *action;
+ GtkWidget *parent;
GtkWidget *toplevel;
GtkWidget *sw;
@@ -2178,7 +2179,8 @@ get_widgets (EventPage *epage)
priv->attendees_label = GW ("attendees-label");
g_object_ref (priv->main);
- gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main);
+ parent = gtk_widget_get_parent (priv->main);
+ gtk_container_remove (GTK_CONTAINER (parent), priv->main);
priv->categories = GW ("categories");
priv->categories_btn = GW ("categories-button");
@@ -2457,11 +2459,7 @@ safe_to_process_date_changed_signal (GtkWidget *dedit_widget)
entry = e_date_edit_get_entry (dedit);
-#if GTK_CHECK_VERSION(2,19,7)
return !entry || !gtk_widget_has_focus (entry);
-#else
- return !entry || !GTK_WIDGET_HAS_FOCUS (entry);
-#endif
}
/* Callback used when the start date widget change. We check that the
diff --git a/calendar/gui/dialogs/event-page.ui b/calendar/gui/dialogs/event-page.ui
index 328b6eac42..061c0b1e43 100644
--- a/calendar/gui/dialogs/event-page.ui
+++ b/calendar/gui/dialogs/event-page.ui
@@ -323,7 +323,7 @@
<child>
<object class="GtkLabel" id="summary-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Su_mmary:</property>
+ <property name="label" translatable="yes">_Summary:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
@@ -858,7 +858,7 @@
<child>
<object class="GtkLabel" id="attendees-label">
<property name="visible">True</property>
- <property name="label" translatable="yes">Attendee_s...</property>
+ <property name="label" translatable="yes">Atte_ndees...</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c
index 8e988c00a5..9486ef6770 100644
--- a/calendar/gui/dialogs/memo-editor.c
+++ b/calendar/gui/dialogs/memo-editor.c
@@ -133,6 +133,7 @@ memo_editor_init (MemoEditor *me)
{
CompEditor *editor = COMP_EDITOR (me);
GtkUIManager *ui_manager;
+ GtkAction *action;
const gchar *id;
GError *error = NULL;
@@ -150,6 +151,9 @@ memo_editor_init (MemoEditor *me)
g_critical ("%s: %s", G_STRFUNC, error->message);
g_error_free (error);
}
+
+ action = comp_editor_get_action (editor, "print");
+ gtk_action_set_tooltip (action, _("Print this memo"));
}
/**
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index adb10dc9fa..8ffe45d2c5 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -438,12 +438,14 @@ fill_comp_with_recipients (ENameSelector *name_selector, ECalComponent *comp)
if (contact && e_contact_get (contact , E_CONTACT_IS_LIST)) {
EBook *book = NULL;
ENameSelectorDialog *dialog;
+ ENameSelectorModel *model;
EContactStore *c_store;
GList *books, *l;
gchar *uri = e_contact_get (contact, E_CONTACT_BOOK_URI);
dialog = e_name_selector_peek_dialog (name_selector);
- c_store = e_name_selector_dialog_peek_model (dialog)->contact_store;
+ model = e_name_selector_dialog_peek_model (dialog);
+ c_store = e_name_selector_model_peek_contact_store (model);
books = e_contact_store_get_books (c_store);
for (l = books; l; l = l->next) {
@@ -768,6 +770,7 @@ get_widgets (MemoPage *mpage)
MemoPagePrivate *priv;
GSList *accel_groups;
GtkWidget *toplevel;
+ GtkWidget *parent;
priv = mpage->priv;
@@ -787,7 +790,8 @@ get_widgets (MemoPage *mpage)
page->accel_group = g_object_ref (accel_groups->data);
g_object_ref (priv->main);
- gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main);
+ parent = gtk_widget_get_parent (priv->main);
+ gtk_container_remove (GTK_CONTAINER (parent), priv->main);
priv->info_hbox = GW ("generic-info");
priv->info_icon = GW ("generic-info-image");
diff --git a/calendar/gui/dialogs/recur-comp.c b/calendar/gui/dialogs/recur-comp.c
index 0d9197546b..7793647723 100644
--- a/calendar/gui/dialogs/recur-comp.c
+++ b/calendar/gui/dialogs/recur-comp.c
@@ -40,6 +40,7 @@ recur_component_dialog (ECal *client,
gchar *str;
GtkWidget *dialog, *rb_this, *rb_prior, *rb_future, *rb_all, *hbox;
GtkWidget *placeholder, *vbox;
+ GtkWidget *content_area;
ECalComponentVType vtype;
gboolean ret;
@@ -72,8 +73,10 @@ recur_component_dialog (ECal *client,
g_free (str);
gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+
hbox = gtk_hbox_new (FALSE, 12);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
+ gtk_container_add (GTK_CONTAINER (content_area), hbox);
placeholder = gtk_label_new ("");
gtk_widget_set_size_request (placeholder, 48, 48);
@@ -105,7 +108,7 @@ recur_component_dialog (ECal *client,
gtk_widget_show_all (hbox);
placeholder = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), placeholder, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), placeholder, FALSE, FALSE, 0);
gtk_widget_show (placeholder);
ret = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK;
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 578f98929c..ae79698efd 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -532,6 +532,7 @@ sensitize_recur_widgets (RecurrencePage *rpage)
CompEditor *editor;
CompEditorFlags flags;
gboolean recurs, sens = TRUE;
+ GtkWidget *child;
GtkWidget *label;
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
@@ -548,8 +549,9 @@ sensitize_recur_widgets (RecurrencePage *rpage)
else
gtk_widget_set_sensitive (priv->preview_calendar, TRUE && sens);
- if (GTK_BIN (priv->custom_warning_bin)->child)
- gtk_widget_destroy (GTK_BIN (priv->custom_warning_bin)->child);
+ child = gtk_bin_get_child (GTK_BIN (priv->custom_warning_bin));
+ if (child != NULL)
+ gtk_widget_destroy (child);
if (recurs && priv->custom) {
gtk_widget_set_sensitive (priv->params, FALSE);
@@ -681,7 +683,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp)
guint8 day_mask;
gint i;
- g_return_if_fail (GTK_BIN (priv->special)->child != NULL);
+ g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->special)) != NULL);
g_return_if_fail (priv->weekday_picker != NULL);
g_return_if_fail (IS_WEEKDAY_PICKER (priv->weekday_picker));
@@ -717,7 +719,7 @@ simple_recur_to_comp (RecurrencePage *rpage, ECalComponent *comp)
enum month_num_options month_num;
enum month_day_options month_day;
- g_return_if_fail (GTK_BIN (priv->special)->child != NULL);
+ g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->special)) != NULL);
g_return_if_fail (priv->month_day_combo != NULL);
g_return_if_fail (GTK_IS_COMBO_BOX (priv->month_day_combo));
g_return_if_fail (priv->month_num_combo != NULL);
@@ -901,11 +903,7 @@ fill_component (RecurrencePage *rpage, ECalComponent *comp)
e_cal_component_set_exdate_list (comp, list);
e_cal_component_free_exdate_list (list);
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (priv->ending_combo) && gtk_widget_get_sensitive (priv->ending_combo) &&
-#else
- if (GTK_WIDGET_VISIBLE (priv->ending_combo) && GTK_WIDGET_IS_SENSITIVE (priv->ending_combo) &&
-#endif
e_dialog_combo_box_get (priv->ending_combo, ending_types_map) == ENDING_UNTIL) {
/* check whether the "until" date is in the future */
struct icaltimetype tt;
@@ -950,7 +948,7 @@ make_weekly_special (RecurrencePage *rpage)
priv = rpage->priv;
- g_return_if_fail (GTK_BIN (priv->special)->child == NULL);
+ g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->special)) == NULL);
g_return_if_fail (priv->weekday_picker == NULL);
/* Create the widgets */
@@ -1228,7 +1226,7 @@ make_monthly_special (RecurrencePage *rpage)
priv = rpage->priv;
- g_return_if_fail (GTK_BIN (priv->special)->child == NULL);
+ g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->special)) == NULL);
g_return_if_fail (priv->month_day_combo == NULL);
/* Create the widgets */
@@ -1282,6 +1280,7 @@ make_recurrence_special (RecurrencePage *rpage)
{
RecurrencePagePrivate *priv;
icalrecurrencetype_frequency frequency;
+ GtkWidget *child;
priv = rpage->priv;
@@ -1289,8 +1288,10 @@ make_recurrence_special (RecurrencePage *rpage)
gtk_widget_destroy (priv->month_num_combo);
priv->month_num_combo = NULL;
}
- if (GTK_BIN (priv->special)->child != NULL) {
- gtk_widget_destroy (GTK_BIN (priv->special)->child);
+
+ child = gtk_bin_get_child (GTK_BIN (priv->special));
+ if (child != NULL) {
+ gtk_widget_destroy (child);
priv->weekday_picker = NULL;
priv->month_day_combo = NULL;
@@ -1345,7 +1346,7 @@ make_ending_until_special (RecurrencePage *rpage)
EDateEdit *de;
ECalComponentDateTime dt_start;
- g_return_if_fail (GTK_BIN (priv->ending_special)->child == NULL);
+ g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->ending_special)) == NULL);
g_return_if_fail (priv->ending_date_edit == NULL);
editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage));
@@ -1394,7 +1395,7 @@ make_ending_count_special (RecurrencePage *rpage)
priv = rpage->priv;
- g_return_if_fail (GTK_BIN (priv->ending_special)->child == NULL);
+ g_return_if_fail (gtk_bin_get_child (GTK_BIN (priv->ending_special)) == NULL);
g_return_if_fail (priv->ending_count_spin == NULL);
/* Create the widgets */
@@ -1435,11 +1436,13 @@ make_ending_special (RecurrencePage *rpage)
{
RecurrencePagePrivate *priv;
enum ending_type ending_type;
+ GtkWidget *child;
priv = rpage->priv;
- if (GTK_BIN (priv->ending_special)->child != NULL) {
- gtk_widget_destroy (GTK_BIN (priv->ending_special)->child);
+ child = gtk_bin_get_child (GTK_BIN (priv->ending_special));
+ if (child != NULL) {
+ gtk_widget_destroy (child);
priv->ending_date_edit = NULL;
priv->ending_count_spin = NULL;
@@ -1985,6 +1988,7 @@ get_widgets (RecurrencePage *rpage)
RecurrencePagePrivate *priv;
GSList *accel_groups;
GtkWidget *toplevel;
+ GtkWidget *parent;
priv = rpage->priv;
@@ -2002,7 +2006,8 @@ get_widgets (RecurrencePage *rpage)
page->accel_group = g_object_ref (accel_groups->data);
g_object_ref (priv->main);
- gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main);
+ parent = gtk_widget_get_parent (priv->main);
+ gtk_container_remove (GTK_CONTAINER (parent), priv->main);
priv->recurs = GW ("recurs");
priv->params = GW ("params");
@@ -2082,6 +2087,7 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget **
RecurrencePagePrivate *priv;
GtkWidget *dialog, *toplevel;
CompEditor *editor;
+ GtkWidget *container;
priv = rpage->priv;
@@ -2096,7 +2102,8 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget **
*date_edit = comp_editor_new_date_edit (TRUE, FALSE, TRUE);
gtk_widget_show (*date_edit);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), *date_edit, FALSE, TRUE, 6);
+ container = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_box_pack_start (GTK_BOX (container), *date_edit, FALSE, TRUE, 6);
return dialog;
}
diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c
index 2e13cba1b9..7cd177e410 100644
--- a/calendar/gui/dialogs/schedule-page.c
+++ b/calendar/gui/dialogs/schedule-page.c
@@ -307,6 +307,7 @@ get_widgets (SchedulePage *spage)
SchedulePagePrivate *priv;
GSList *accel_groups;
GtkWidget *toplevel;
+ GtkWidget *parent;
priv = spage->priv;
@@ -324,7 +325,8 @@ get_widgets (SchedulePage *spage)
page->accel_group = g_object_ref (accel_groups->data);
g_object_ref (priv->main);
- gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main);
+ parent = gtk_widget_get_parent (priv->main);
+ gtk_container_remove (GTK_CONTAINER (parent), priv->main);
#undef GW
diff --git a/calendar/gui/dialogs/send-comp.c b/calendar/gui/dialogs/send-comp.c
index a42501c9d6..4a9f80ef21 100644
--- a/calendar/gui/dialogs/send-comp.c
+++ b/calendar/gui/dialogs/send-comp.c
@@ -108,6 +108,7 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo
ECalComponentVType vtype;
const gchar *id;
GtkWidget *dialog, *sa_checkbox = NULL, *ona_checkbox = NULL;
+ GtkWidget *content_area;
gboolean res;
if (strip_alarms)
@@ -155,11 +156,12 @@ send_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gbo
}
dialog = e_alert_dialog_new_for_args (parent, id, NULL);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
if (strip_alarms)
- sa_checkbox = add_checkbox (GTK_BOX (GTK_DIALOG (dialog)->vbox), _("Send my alarms with this event"));
+ sa_checkbox = add_checkbox (GTK_BOX (content_area), _("Send my alarms with this event"));
if (only_new_attendees)
- ona_checkbox = add_checkbox (GTK_BOX (GTK_DIALOG (dialog)->vbox), _("Notify new attendees _only"));
+ ona_checkbox = add_checkbox (GTK_BOX (content_area), _("Notify new attendees _only"));
res = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES;
@@ -183,11 +185,11 @@ send_component_prompt_subject (GtkWindow *parent, ECal *client, ECalComponent *c
switch (vtype) {
case E_CAL_COMPONENT_EVENT:
- id = "calendar:prompt-send-no-subject-calendar";
+ id = "calendar:prompt-save-no-subject-calendar";
break;
case E_CAL_COMPONENT_TODO:
- id = "calendar:prompt-send-no-subject-task";
+ id = "calendar:prompt-save-no-subject-task";
break;
case E_CAL_COMPONENT_JOURNAL:
id = "calendar:prompt-send-no-subject-memo";
diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c
index c549633eb5..f84b07ecd3 100644
--- a/calendar/gui/dialogs/task-details-page.c
+++ b/calendar/gui/dialogs/task-details-page.c
@@ -448,6 +448,7 @@ get_widgets (TaskDetailsPage *tdpage)
TaskDetailsPagePrivate *priv;
GSList *accel_groups;
GtkWidget *toplevel;
+ GtkWidget *parent;
priv = tdpage->priv;
@@ -465,7 +466,8 @@ get_widgets (TaskDetailsPage *tdpage)
page->accel_group = g_object_ref (accel_groups->data);
g_object_ref (priv->main);
- gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main);
+ parent = gtk_widget_get_parent (priv->main);
+ gtk_container_remove (GTK_CONTAINER (parent), priv->main);
priv->status_combo = GW ("status-combobox");
priv->priority_combo = GW ("priority-combobox");
@@ -661,6 +663,7 @@ static void
init_widgets (TaskDetailsPage *tdpage)
{
TaskDetailsPagePrivate *priv;
+ GtkAdjustment *adjustment;
priv = tdpage->priv;
@@ -677,13 +680,15 @@ init_widgets (TaskDetailsPage *tdpage)
/* Connect signals. The Status, Percent Complete & Date Completed
properties are closely related so whenever one changes we may need
to update the other 2. */
- g_signal_connect (GTK_COMBO_BOX (priv->status_combo),
- "changed",
- G_CALLBACK (status_changed), tdpage);
+ g_signal_connect (
+ GTK_COMBO_BOX (priv->status_combo), "changed",
+ G_CALLBACK (status_changed), tdpage);
- g_signal_connect((GTK_SPIN_BUTTON (priv->percent_complete)->adjustment),
- "value_changed",
- G_CALLBACK (percent_complete_changed), tdpage);
+ adjustment = gtk_spin_button_get_adjustment (
+ GTK_SPIN_BUTTON (priv->percent_complete));
+ g_signal_connect (
+ adjustment, "value_changed",
+ G_CALLBACK (percent_complete_changed), tdpage);
/* Priority */
g_signal_connect_swapped (
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 7e35cbe070..46a2f95d0e 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -309,6 +309,8 @@ task_editor_init (TaskEditor *te)
CompEditor *editor = COMP_EDITOR (te);
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
+ GtkWidget *content_area;
+ GtkAction *action;
const gchar *id;
GError *error = NULL;
@@ -333,8 +335,10 @@ task_editor_init (TaskEditor *te)
G_CALLBACK(gtk_widget_hide), NULL);
te->priv->task_details_page = task_details_page_new (editor);
+ content_area = gtk_dialog_get_content_area (
+ GTK_DIALOG (te->priv->task_details_window));
gtk_container_add (
- GTK_CONTAINER (GTK_DIALOG (te->priv->task_details_window)->vbox),
+ GTK_CONTAINER (content_area),
comp_editor_page_get_widget ((CompEditorPage *) te->priv->task_details_page));
gtk_widget_show_all (gtk_bin_get_child (GTK_BIN (te->priv->task_details_window)));
comp_editor_append_page (
@@ -362,6 +366,9 @@ task_editor_init (TaskEditor *te)
g_error_free (error);
}
+ action = comp_editor_get_action (editor, "print");
+ gtk_action_set_tooltip (action, _("Print this task"));
+
g_signal_connect_swapped (
te->priv->model, "row_changed",
G_CALLBACK (task_editor_model_changed_cb), te);
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index fb6338005f..9747501eea 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -1335,6 +1335,7 @@ get_widgets (TaskPage *tpage)
TaskPagePrivate *priv;
GSList *accel_groups;
GtkWidget *toplevel;
+ GtkWidget *parent;
GtkWidget *sw;
GtkTreeSelection *selection;
@@ -1352,7 +1353,8 @@ get_widgets (TaskPage *tpage)
page->accel_group = g_object_ref (accel_groups->data);
g_object_ref (priv->main);
- gtk_container_remove (GTK_CONTAINER (priv->main->parent), priv->main);
+ parent = gtk_widget_get_parent (priv->main);
+ gtk_container_remove (GTK_CONTAINER (parent), priv->main);
priv->info_hbox = e_builder_get_widget (priv->builder, "generic-info");
priv->info_icon = e_builder_get_widget (priv->builder, "generic-info-image");
diff --git a/calendar/gui/e-cal-component-preview.c b/calendar/gui/e-cal-component-preview.c
index 77fa25c995..da7e853863 100644
--- a/calendar/gui/e-cal-component-preview.c
+++ b/calendar/gui/e-cal-component-preview.c
@@ -27,13 +27,13 @@
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
+#include <camel/camel.h>
#include <libecal/e-cal-time-util.h>
#include <libedataserver/e-categories.h>
#include <libedataserver/e-time-utils.h>
#include <e-util/e-util.h>
#include <e-util/e-categories-config.h>
#include "calendar-config.h"
-#include <camel/camel-mime-filter-tohtml.h>
#define E_CAL_COMPONENT_PREVIEW_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -401,14 +401,8 @@ cal_component_preview_class_init (ECalComponentPreviewClass *class)
static void
cal_component_preview_init (ECalComponentPreview *preview)
{
- GtkHTML *html;
-
preview->priv = E_CAL_COMPONENT_PREVIEW_GET_PRIVATE (preview);
- html = GTK_HTML (preview);
- gtk_html_set_default_content_type (html, "charset=utf-8");
- gtk_html_load_empty (html);
-
preview->priv->zone = icaltimezone_get_utc_timezone ();
}
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index 0a3c3de0be..aabf98ce55 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -235,6 +235,7 @@ setup_e_table (ECalListView *cal_list_view)
strings = g_list_append (strings, (gchar *) _("Confidential"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
+ g_list_free (strings);
e_table_extras_add_cell (extras, "classification", popup_cell);
@@ -420,6 +421,9 @@ e_cal_list_view_get_selected_time_range (ECalendarView *cal_view, time_t *start_
ECalComponentDateTime dtstart, dtend;
ECalComponent *comp;
+ if (!is_comp_data_valid (event))
+ return FALSE;
+
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
if (start_time) {
diff --git a/calendar/gui/e-cal-list-view.etspec b/calendar/gui/e-cal-list-view.etspec
index f8f2d72853..ba0130fac4 100644
--- a/calendar/gui/e-cal-list-view.etspec
+++ b/calendar/gui/e-cal-list-view.etspec
@@ -2,6 +2,7 @@
<ETableColumn model_col="5" _title="Start Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare" priority="-2"/>
<ETableColumn model_col="12" _title="End Date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare" priority="-2"/>
<ETableColumn model_col="8" _title="Summary" expansion="3.0" minimum_width="10" resizable="true" cell="calstring" compare="collate" priority="10"/>
+ <ETableColumn model_col="4" _title="Description" expansion="3.0" minimum_width="10" resizable="true" cell="calstring" compare="collate" priority="10"/>
<ETableColumn model_col="13" _title="Location" expansion="3.0" minimum_width="10" resizable="true" cell="calstring" compare="collate" priority="10"/>
<ETableColumn model_col="0" _title="Categories" cell="calstring" compare="collate" expansion="1.0" minimum_width="10" resizable="true" priority="-2"/>
<ETableColumn model_col="10" _title="Created" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare" priority="-2"/>
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index e48b95999d..e745d33810 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -323,7 +323,7 @@ e_cal_model_class_init (ECalModelClass *class)
PROP_DEFAULT_CLIENT,
g_param_spec_object (
"default-client",
- _("Default Client"),
+ "Default Client",
NULL,
E_TYPE_CAL,
G_PARAM_READWRITE));
diff --git a/calendar/gui/e-calendar-selector.c b/calendar/gui/e-calendar-selector.c
index 0747b55b59..915c970871 100644
--- a/calendar/gui/e-calendar-selector.c
+++ b/calendar/gui/e-calendar-selector.c
@@ -105,12 +105,12 @@ calendar_selector_data_dropped (ESourceSelector *selector,
GtkTreePath *path = NULL;
ECal *client;
icalcomponent *icalcomp;
- const gchar *string;
+ const guchar *data;
gboolean success = FALSE;
gpointer object = NULL;
- string = (const gchar *) selection_data->data;
- icalcomp = icalparser_parse_string (string);
+ data = gtk_selection_data_get_data (selection_data);
+ icalcomp = icalparser_parse_string ((const gchar *) data);
if (icalcomp == NULL)
goto exit;
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index d41ef007a4..63088350c2 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -170,6 +170,9 @@ calendar_view_delete_event (ECalendarView *cal_view,
gboolean delete = FALSE;
GError *error = NULL;
+ if (!is_comp_data_valid (event))
+ return;
+
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
vtype = e_cal_component_get_vtype (comp);
@@ -341,6 +344,15 @@ calendar_view_finalize (GObject *object)
}
static void
+calendar_view_constructed (GObject *object)
+{
+ /* Do this after calendar_view_init() so extensions can query
+ * the GType accurately. See GInstanceInitFunc documentation
+ * for details of the problem. */
+ e_extensible_load_extensions (E_EXTENSIBLE (object));
+}
+
+static void
calendar_view_update_actions (ESelectable *selectable,
EFocusTracker *focus_tracker,
GdkAtom *clipboard_targets,
@@ -442,6 +454,9 @@ calendar_view_cut_clipboard (ESelectable *selectable)
if (!event)
continue;
+ if (!is_comp_data_valid (event))
+ continue;
+
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
@@ -551,7 +566,7 @@ calendar_view_copy_clipboard (ESelectable *selectable)
for (l = selected; l != NULL; l = l->next) {
event = (ECalendarViewEvent *) l->data;
- if (event) {
+ if (event && is_comp_data_valid (event)) {
e_cal_util_add_timezones_from_component (vcal_comp, event->comp_data->icalcomp);
add_related_timezones (vcal_comp, event->comp_data->icalcomp, event->comp_data->client);
@@ -561,6 +576,9 @@ calendar_view_copy_clipboard (ESelectable *selectable)
for (l = selected; l != NULL; l = l->next) {
event = (ECalendarViewEvent *) l->data;
+ if (!is_comp_data_valid (event))
+ continue;
+
new_icalcomp = icalcomponent_new_clone (event->comp_data->icalcomp);
/* remove RECURRENCE-IDs from copied objects */
@@ -736,6 +754,7 @@ e_calendar_view_class_init (ECalendarViewClass *class)
object_class->get_property = calendar_view_get_property;
object_class->dispose = calendar_view_dispose;
object_class->finalize = calendar_view_finalize;
+ object_class->constructed = calendar_view_constructed;
class->selection_changed = NULL;
class->selected_time_changed = NULL;
@@ -1197,6 +1216,9 @@ e_calendar_view_delete_selected_occurrence (ECalendarView *cal_view)
if (!selected)
return;
event = (ECalendarViewEvent *) selected->data;
+ if (!is_comp_data_valid (event))
+ return;
+
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
vtype = e_cal_component_get_vtype (comp);
@@ -1307,7 +1329,7 @@ e_calendar_view_open_event (ECalendarView *cal_view)
selected = e_calendar_view_get_selected_events (cal_view);
if (selected) {
ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
- if (event)
+ if (event && is_comp_data_valid (event))
e_calendar_view_edit_appointment (cal_view, event->comp_data->client,
event->comp_data->icalcomp, icalcomponent_get_first_property(event->comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY) != NULL);
@@ -1644,39 +1666,42 @@ get_label (struct icaltimetype *tt, icaltimezone *f_zone, icaltimezone *t_zone)
void
e_calendar_view_move_tip (GtkWidget *widget, gint x, gint y)
{
- GtkRequisition requisition;
- gint w, h;
- GdkScreen *screen;
- GdkScreen *pointer_screen;
- gint monitor_num, px, py;
- GdkRectangle monitor;
-
- screen = gtk_widget_get_screen (widget);
-
- gtk_widget_size_request (widget, &requisition);
- w = requisition.width;
- h = requisition.height;
-
- gdk_display_get_pointer (gdk_screen_get_display (screen),
- &pointer_screen, &px, &py, NULL);
- if (pointer_screen != screen)
- {
- px = x;
- py = y;
- }
- monitor_num = gdk_screen_get_monitor_at_point (screen, px, py);
- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
-
- if ((x + w) > monitor.x + monitor.width)
- x -= (x + w) - (monitor.x + monitor.width);
- else if (x < monitor.x)
- x = monitor.x;
-
- if ((y + h + widget->allocation.height + 4) > monitor.y + monitor.height)
- y = y - h - 36;
-
- gtk_window_move (GTK_WINDOW (widget), x, y);
- gtk_widget_show (widget);
+ GtkAllocation allocation;
+ GtkRequisition requisition;
+ gint w, h;
+ GdkScreen *screen;
+ GdkScreen *pointer_screen;
+ gint monitor_num, px, py;
+ GdkRectangle monitor;
+
+ screen = gtk_widget_get_screen (widget);
+
+ gtk_widget_size_request (widget, &requisition);
+ w = requisition.width;
+ h = requisition.height;
+
+ gdk_display_get_pointer (
+ gdk_screen_get_display (screen),
+ &pointer_screen, &px, &py, NULL);
+ if (pointer_screen != screen) {
+ px = x;
+ py = y;
+ }
+ monitor_num = gdk_screen_get_monitor_at_point (screen, px, py);
+ gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+
+ if ((x + w) > monitor.x + monitor.width)
+ x -= (x + w) - (monitor.x + monitor.width);
+ else if (x < monitor.x)
+ x = monitor.x;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ if ((y + h + allocation.height + 4) > monitor.y + monitor.height)
+ y = y - h - 36;
+
+ gtk_window_move (GTK_WINDOW (widget), x, y);
+ gtk_widget_show (widget);
}
/**
@@ -1779,6 +1804,7 @@ e_calendar_view_get_tooltips (ECalendarViewEventData *data)
ECalendarViewEvent *pevent;
GtkStyle *style = gtk_widget_get_default_style ();
GtkWidget *widget = (GtkWidget *) g_object_get_data (G_OBJECT (data->cal_view), "tooltip-window");
+ GdkWindow *window;
ECalComponent *newcomp = e_cal_component_new ();
icaltimezone *zone, *default_zone;
ECal *client = NULL;
@@ -1791,6 +1817,9 @@ e_calendar_view_get_tooltips (ECalendarViewEventData *data)
default_zone = e_calendar_view_get_timezone (data->cal_view);
pevent = data->get_view_event (data->cal_view, data->day, data->event_num);
+ if (!is_comp_data_valid (pevent))
+ return FALSE;
+
client = pevent->comp_data->client;
clone_comp = icalcomponent_new_clone (pevent->comp_data->icalcomp);
@@ -1938,7 +1967,8 @@ e_calendar_view_get_tooltips (ECalendarViewEventData *data)
e_calendar_view_move_tip (pevent->tooltip, pevent->x +16, pevent->y+16);
- gdk_keyboard_grab (pevent->tooltip->window, FALSE, GDK_CURRENT_TIME);
+ window = gtk_widget_get_window (pevent->tooltip);
+ gdk_keyboard_grab (window, FALSE, GDK_CURRENT_TIME);
g_signal_connect (pevent->tooltip, "key-press-event", G_CALLBACK (tooltip_grab), data->cal_view);
pevent->timeout = -1;
@@ -2091,3 +2121,38 @@ get_today_background (const GdkColor base_background)
return res;
}
+gboolean
+is_comp_data_valid_func (ECalendarViewEvent *event, const gchar *location)
+{
+ g_return_val_if_fail (location != NULL, FALSE);
+
+ if (!event) {
+ g_warning ("%s: event is NULL", location);
+ return FALSE;
+ }
+
+ if (!event->comp_data) {
+ g_warning ("%s: event's (%p) comp_data is NULL", location, event);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+gboolean
+is_array_index_in_bounds_func (GArray *array, gint index, const gchar *location)
+{
+ g_return_val_if_fail (location != NULL, FALSE);
+
+ if (!array) {
+ g_warning ("%s: array is NULL", location);
+ return FALSE;
+ }
+
+ if (index < 0 || index >= array->len) {
+ g_warning ("%s: index %d is out of bounds [0,%d) at array %p", location, index, array->len, array);
+ return FALSE;
+ }
+
+ return TRUE;
+}
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index 62fcabcc37..6f68e6376b 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -87,6 +87,14 @@ typedef struct {
E_CALENDAR_VIEW_EVENT_FIELDS
} ECalendarViewEvent;
+/* checks if event->comp_data is not NULL, returns FALSE when it is and prints a warning on a console */
+gboolean is_comp_data_valid_func (ECalendarViewEvent *event, const gchar *location);
+#define is_comp_data_valid(_event) is_comp_data_valid_func ((ECalendarViewEvent *) (_event), G_STRFUNC)
+
+/* checks if index is within bounds for the array; returns FALSE when not, and prints a warning on a console */
+gboolean is_array_index_in_bounds_func (GArray *array, gint index, const gchar *location);
+#define is_array_index_in_bounds(_array, _index) is_array_index_in_bounds_func (_array, _index, G_STRFUNC)
+
typedef struct _ECalendarView ECalendarView;
typedef struct _ECalendarViewClass ECalendarViewClass;
typedef struct _ECalendarViewPrivate ECalendarViewPrivate;
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 11baebf67b..5de9b76546 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -107,6 +107,9 @@ day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *main_item,
gboolean first = TRUE;
event = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
+ if (!is_comp_data_valid (event))
+ continue;
+
/* If the event is TRANSPARENT, skip it. */
if (icalcomp_is_transparent (event->comp_data->icalcomp)) {
continue;
@@ -248,9 +251,15 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
font_options = get_font_options ();
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
/* Fill in the event background. Note that for events in the first
column of the day, we might not want to paint over the vertical bar,
since that is used for multiple events. But then you can't see
@@ -279,11 +288,7 @@ day_view_main_item_draw_day_event (EDayViewMainItem *main_item,
g_object_get (G_OBJECT (event->canvas_item), "x_offset", &text_x_offset, NULL);
/* Draw shadow around the event when selected */
-#if GTK_CHECK_VERSION(2,19,7)
if (is_editing && (gtk_widget_has_focus (day_view->main_canvas))) {
-#else
- if (is_editing && (GTK_WIDGET_HAS_FOCUS (day_view->main_canvas))) {
-#endif
/* For embossing Item selection */
item_x -= 1;
item_y -= 2;
@@ -870,6 +875,9 @@ day_view_main_item_draw_events_in_vbars (EDayViewMainItem *main_item,
for (event_num = 0; event_num < day_view->events[day]->len; event_num++) {
event = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
+ if (!is_comp_data_valid (event))
+ continue;
+
/* We can skip the events in the first column since they will
draw over this anyway. */
if (event->num_columns > 0 && event->start_row_or_col == 0) {
@@ -1103,11 +1111,7 @@ day_view_main_item_draw (GnomeCanvasItem *canvas_item,
if (can_draw_in_region (draw_region, rect_x, rect_y, rect_width, rect_height)) {
cairo_save (cr);
-#if GTK_CHECK_VERSION(2,19,7)
gdk_cairo_set_source_color (cr, &day_view->colors[gtk_widget_has_focus (GTK_WIDGET (day_view)) ? E_DAY_VIEW_COLOR_BG_SELECTED : E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED]);
-#else
- gdk_cairo_set_source_color (cr, &day_view->colors[GTK_WIDGET_HAS_FOCUS(day_view) ? E_DAY_VIEW_COLOR_BG_SELECTED : E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED]);
-#endif
cairo_rectangle (cr, rect_x, rect_y, rect_width, rect_height);
cairo_fill (cr);
cairo_restore (cr);
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c
index 6f7b8313c0..edc446ac25 100644
--- a/calendar/gui/e-day-view-time-item.c
+++ b/calendar/gui/e-day-view-time-item.c
@@ -853,6 +853,7 @@ static void
e_day_view_time_item_on_button_press (EDayViewTimeItem *time_item,
GdkEvent *event)
{
+ GdkWindow *window;
EDayView *day_view;
GnomeCanvas *canvas;
gint row;
@@ -868,14 +869,12 @@ e_day_view_time_item_on_button_press (EDayViewTimeItem *time_item,
if (row == -1)
return;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (day_view))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (day_view));
- if (gdk_pointer_grab (GTK_LAYOUT (canvas)->bin_window, FALSE,
+ window = gtk_layout_get_bin_window (GTK_LAYOUT (canvas));
+
+ if (gdk_pointer_grab (window, FALSE,
GDK_POINTER_MOTION_MASK
| GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->button.time) == 0) {
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index 4012ba6289..f622b8252b 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -93,8 +93,15 @@ day_view_top_item_draw_triangle (EDayViewTopItem *top_item,
if (h % 2 == 0)
c1--;
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
+
cairo_save (cr);
/* Fill it in. */
if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
@@ -187,9 +194,15 @@ day_view_top_item_draw_long_event (EDayViewTopItem *top_item,
&item_w, &item_h))
return;
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
style = gtk_widget_get_style (GTK_WIDGET (day_view));
gc = day_view->main_gc;
fg_gc = style->fg_gc[GTK_STATE_NORMAL];
@@ -581,6 +594,7 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item,
GtkStyle *style;
GdkGC *fg_gc;
gchar buffer[128];
+ GtkAllocation allocation;
GdkRectangle clip_rect;
gint canvas_width, canvas_height, left_edge, day, date_width, date_x;
gint item_height, event_num;
@@ -598,7 +612,9 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item,
style = gtk_widget_get_style (GTK_WIDGET (day_view));
fg_gc = style->fg_gc[GTK_STATE_NORMAL];
- canvas_width = GTK_WIDGET (canvas_item->canvas)->allocation.width;
+ gtk_widget_get_allocation (
+ GTK_WIDGET (canvas_item->canvas), &allocation);
+ canvas_width = allocation.width;
canvas_height = (show_dates ? 1 : (MAX (1, day_view->rows_in_top_display) + 1)) * day_view->top_row_height;
left_edge = 0;
item_height = day_view->top_row_height - E_DAY_VIEW_TOP_CANVAS_Y_GAP;
@@ -648,11 +664,7 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item,
cairo_restore (cr);
/* Draw the selection background. */
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (GTK_WIDGET (day_view))
-#else
- if (GTK_WIDGET_HAS_FOCUS (day_view)
-#endif
&& day_view->selection_start_day != -1) {
gint start_col, end_col, rect_x, rect_y, rect_w, rect_h;
@@ -684,9 +696,11 @@ day_view_top_item_draw (GnomeCanvasItem *canvas_item,
e_day_view_top_item_get_day_label (day_view, day, buffer, sizeof (buffer));
clip_rect.x = day_view->day_offsets[day] - x;
clip_rect.y = 2 - y;
- if (day_view->days_shown == 1)
- clip_rect.width = day_view->top_canvas->allocation.width - day_view->day_offsets[day];
- else
+ if (day_view->days_shown == 1) {
+ gtk_widget_get_allocation (
+ day_view->top_canvas, &allocation);
+ clip_rect.width = allocation.width - day_view->day_offsets[day];
+ } else
clip_rect.width = day_view->day_widths[day];
clip_rect.height = item_height - 2;
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index cc8581fb00..010f5bdb32 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -591,6 +591,9 @@ day_view_constructed (GObject *object)
{
ECalModel *model;
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_day_view_parent_class)->constructed (object);
+
model = e_calendar_view_get_model (E_CALENDAR_VIEW (object));
g_signal_connect_swapped (
@@ -981,9 +984,11 @@ e_day_view_init (EDayView *day_view)
{
gint day;
GnomeCanvasGroup *canvas_group;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
GtkWidget *w;
- GTK_WIDGET_SET_FLAGS (day_view, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (GTK_WIDGET (day_view), TRUE);
day_view->long_events = g_array_new (FALSE, FALSE,
sizeof (EDayViewEvent));
@@ -1239,8 +1244,10 @@ e_day_view_init (EDayView *day_view)
* Times Canvas
*/
day_view->time_canvas = e_canvas_new ();
- gtk_layout_set_vadjustment (GTK_LAYOUT (day_view->time_canvas),
- GTK_LAYOUT (day_view->main_canvas)->vadjustment);
+ layout = GTK_LAYOUT (day_view->main_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+ layout = GTK_LAYOUT (day_view->time_canvas);
+ gtk_layout_set_vadjustment (layout, adjustment);
gtk_table_attach (GTK_TABLE (day_view), day_view->time_canvas,
0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
@@ -1259,16 +1266,22 @@ e_day_view_init (EDayView *day_view)
/*
* Scrollbar.
*/
- day_view->mc_hscrollbar = gtk_hscrollbar_new (GTK_LAYOUT (day_view->main_canvas)->hadjustment);
+ layout = GTK_LAYOUT (day_view->main_canvas);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ day_view->mc_hscrollbar = gtk_hscrollbar_new (adjustment);
gtk_table_attach (GTK_TABLE (day_view), day_view->mc_hscrollbar, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
gtk_widget_show (day_view->mc_hscrollbar);
- day_view->tc_vscrollbar = gtk_vscrollbar_new (GTK_LAYOUT (day_view->top_canvas)->vadjustment);
+ layout = GTK_LAYOUT (day_view->top_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+ day_view->tc_vscrollbar = gtk_vscrollbar_new (adjustment);
gtk_table_attach (GTK_TABLE (day_view), day_view->tc_vscrollbar,
2, 3, 0, 1, 0, GTK_FILL, 0, 0);
/* gtk_widget_show (day_view->tc_vscrollbar); */
- day_view->vscrollbar = gtk_vscrollbar_new (GTK_LAYOUT (day_view->main_canvas)->vadjustment);
+ layout = GTK_LAYOUT (day_view->main_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+ day_view->vscrollbar = gtk_vscrollbar_new (adjustment);
gtk_table_attach (GTK_TABLE (day_view), day_view->vscrollbar,
2, 3, 1, 2, 0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (day_view->vscrollbar);
@@ -1321,8 +1334,10 @@ static void
e_day_view_on_canvas_realized (GtkWidget *widget,
EDayView *day_view)
{
- gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window,
- NULL, FALSE);
+ GdkWindow *window;
+
+ window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
+ gdk_window_set_back_pixmap (window, NULL, FALSE);
}
/**
@@ -1404,12 +1419,14 @@ e_day_view_realize (GtkWidget *widget)
{
EDayView *day_view;
GdkColormap *colormap;
+ GdkWindow *window;
if (GTK_WIDGET_CLASS (e_day_view_parent_class)->realize)
(*GTK_WIDGET_CLASS (e_day_view_parent_class)->realize)(widget);
day_view = E_DAY_VIEW (widget);
- day_view->main_gc = gdk_gc_new (widget->window);
+ window = gtk_widget_get_window (widget);
+ day_view->main_gc = gdk_gc_new (window);
colormap = gtk_widget_get_colormap (widget);
@@ -1446,21 +1463,25 @@ e_day_view_realize (GtkWidget *widget)
static void
e_day_view_set_colors(EDayView *day_view, GtkWidget *widget)
{
- day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING] = widget->style->base[GTK_STATE_NORMAL];
- day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING] = widget->style->bg[GTK_STATE_ACTIVE];
- day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED] = widget->style->base[GTK_STATE_SELECTED];
- day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED] = widget->style->bg[GTK_STATE_SELECTED];
- day_view->colors[E_DAY_VIEW_COLOR_BG_GRID] = widget->style->dark[GTK_STATE_NORMAL];
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (widget);
+
+ day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING] = style->base[GTK_STATE_NORMAL];
+ day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING] = style->bg[GTK_STATE_ACTIVE];
+ day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED] = style->base[GTK_STATE_SELECTED];
+ day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED] = style->bg[GTK_STATE_SELECTED];
+ day_view->colors[E_DAY_VIEW_COLOR_BG_GRID] = style->dark[GTK_STATE_NORMAL];
day_view->colors[E_DAY_VIEW_COLOR_BG_MULTIDAY_TODAY] = get_today_background (day_view->colors[E_DAY_VIEW_COLOR_BG_WORKING]);
- day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS] = widget->style->dark[GTK_STATE_NORMAL];
- day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED] = widget->style->bg[GTK_STATE_SELECTED];
- day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID] = widget->style->light[GTK_STATE_NORMAL];
- day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR] = widget->style->base[GTK_STATE_SELECTED];
- day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND] = widget->style->base[GTK_STATE_NORMAL];
- day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER] = widget->style->dark[GTK_STATE_NORMAL];
- day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND] = widget->style->bg[GTK_STATE_ACTIVE];
- day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER] = widget->style->dark[GTK_STATE_NORMAL];
- day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE] = widget->style->dark[GTK_STATE_PRELIGHT];
+ day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS] = style->dark[GTK_STATE_NORMAL];
+ day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED] = style->bg[GTK_STATE_SELECTED];
+ day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID] = style->light[GTK_STATE_NORMAL];
+ day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR] = style->base[GTK_STATE_SELECTED];
+ day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND] = style->base[GTK_STATE_NORMAL];
+ day_view->colors[E_DAY_VIEW_COLOR_EVENT_BORDER] = style->dark[GTK_STATE_NORMAL];
+ day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND] = style->bg[GTK_STATE_ACTIVE];
+ day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER] = style->dark[GTK_STATE_NORMAL];
+ day_view->colors[E_DAY_VIEW_COLOR_MARCUS_BAINS_LINE] = style->dark[GTK_STATE_PRELIGHT];
}
static void
@@ -1495,6 +1516,7 @@ e_day_view_unrealize (GtkWidget *widget)
static GdkColor
e_day_view_get_text_color (EDayView *day_view, EDayViewEvent *event, GtkWidget *widget)
{
+ GtkStyle *style;
GdkColor bg_color;
guint16 red, green, blue;
gdouble cc = 65535.0;
@@ -1503,7 +1525,7 @@ e_day_view_get_text_color (EDayView *day_view, EDayViewEvent *event, GtkWidget *
green = day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND].green;
blue = day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND].blue;
- if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data),
+ if (is_comp_data_valid (event) && gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)), event->comp_data),
&bg_color)) {
GdkColormap *colormap;
colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
@@ -1514,15 +1536,18 @@ e_day_view_get_text_color (EDayView *day_view, EDayViewEvent *event, GtkWidget *
}
}
+ style = gtk_widget_get_style (widget);
+
if ((red/cc > 0.7) || (green/cc > 0.7) || (blue/cc > 0.7 ))
- return widget->style->black;
+ return style->black;
else
- return widget->style->white;
+ return style->white;
}
static void
e_day_view_update_top_scroll (EDayView *day_view, gboolean scroll_to_top)
{
+ GtkAllocation allocation;
gint top_rows, top_canvas_height;
gdouble old_x2, old_y2, new_x2, new_y2;
@@ -1541,7 +1566,8 @@ e_day_view_update_top_scroll (EDayView *day_view, gboolean scroll_to_top)
/* Set the scroll region of the top canvas */
gnome_canvas_get_scroll_region (GNOME_CANVAS (day_view->top_canvas),
NULL, NULL, &old_x2, &old_y2);
- new_x2 = day_view->top_canvas->allocation.width - 1;
+ gtk_widget_get_allocation (day_view->top_canvas, &allocation);
+ new_x2 = allocation.width - 1;
new_y2 = (MAX (1, day_view->rows_in_top_display) + 1) * day_view->top_row_height - 1;
if (old_x2 != new_x2 || old_y2 != new_y2) {
gnome_canvas_set_scroll_region (GNOME_CANVAS (day_view->top_canvas),
@@ -1577,6 +1603,7 @@ e_day_view_style_set (GtkWidget *widget,
PangoFontMetrics *font_metrics;
PangoLayout *layout;
gint week_day, event_num;
+ GtkAdjustment *adjustment;
EDayViewEvent *event;
GdkColor color;
@@ -1635,16 +1662,25 @@ e_day_view_style_set (GtkWidget *widget,
PANGO_PIXELS (pango_font_metrics_get_ascent (font_metrics)) +
PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)) +
E_DAY_VIEW_EVENT_BORDER_HEIGHT + E_DAY_VIEW_EVENT_Y_PAD * 2 + 2 /* FIXME */;
- day_view->row_height = MAX (day_view->row_height, E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD + 2);
- GTK_LAYOUT (day_view->main_canvas)->vadjustment->step_increment = day_view->row_height;
+ day_view->row_height =
+ MAX (day_view->row_height,
+ E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD + 2);
+
+ adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (day_view->main_canvas));
+ gtk_adjustment_set_step_increment (adjustment, day_view->row_height);
day_view->top_row_height =
PANGO_PIXELS (pango_font_metrics_get_ascent (font_metrics)) +
PANGO_PIXELS (pango_font_metrics_get_descent (font_metrics)) +
E_DAY_VIEW_LONG_EVENT_BORDER_HEIGHT * 2 + E_DAY_VIEW_LONG_EVENT_Y_PAD * 2 +
E_DAY_VIEW_TOP_CANVAS_Y_GAP;
- day_view->top_row_height = MAX (day_view->top_row_height, E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD + 2 + E_DAY_VIEW_TOP_CANVAS_Y_GAP);
- GTK_LAYOUT (day_view->top_canvas)->vadjustment->step_increment = day_view->top_row_height;
+ day_view->top_row_height =
+ MAX (day_view->top_row_height,
+ E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD + 2 +
+ E_DAY_VIEW_TOP_CANVAS_Y_GAP);
+
+ adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (day_view->top_canvas));
+ gtk_adjustment_set_step_increment (adjustment, day_view->top_row_height);
gtk_widget_set_size_request (day_view->top_dates_canvas, -1, day_view->top_row_height - 2);
e_day_view_update_top_scroll (day_view, TRUE);
@@ -1791,11 +1827,14 @@ e_day_view_recalc_cell_sizes (EDayView *day_view)
gint day, max_width;
struct tm date_tm;
gchar buffer[128];
+ GtkAllocation allocation;
PangoContext *pango_context;
PangoLayout *layout;
gint pango_width;
- g_return_if_fail (((GtkWidget*)day_view)->style != NULL);
+ g_return_if_fail (gtk_widget_get_style (GTK_WIDGET (day_view)) != NULL);
+
+ gtk_widget_get_allocation (day_view->main_canvas, &allocation);
/* Set up Pango prerequisites */
pango_context = gtk_widget_get_pango_context (GTK_WIDGET (day_view));
@@ -1804,7 +1843,7 @@ e_day_view_recalc_cell_sizes (EDayView *day_view)
/* Calculate the column sizes, using floating point so that pixels
get divided evenly. Note that we use one more element than the
number of columns, to make it easy to get the column widths. */
- width = day_view->main_canvas->allocation.width;
+ width = allocation.width;
if (day_view->days_shown == 1)
width = MAX (width, day_view->max_cols * (E_DAY_VIEW_MIN_DAY_COL_WIDTH + E_DAY_VIEW_GAP_WIDTH) - E_DAY_VIEW_MIN_DAY_COL_WIDTH - 1);
width /= day_view->days_shown;
@@ -1969,6 +2008,9 @@ e_day_view_foreach_event_with_uid (EDayView *day_view,
event = &g_array_index (day_view->events[day],
EDayViewEvent, event_num);
+ if (!is_comp_data_valid (event))
+ continue;
+
u = icalcomponent_get_uid (event->comp_data->icalcomp);
if (uid && !strcmp (uid, u)) {
if (!(*callback) (day_view, day, event_num, data))
@@ -1983,6 +2025,9 @@ e_day_view_foreach_event_with_uid (EDayView *day_view,
event = &g_array_index (day_view->long_events,
EDayViewEvent, event_num);
+ if (!is_comp_data_valid (event))
+ continue;
+
u = icalcomponent_get_uid (event->comp_data->icalcomp);
if (u && !strcmp (uid, u)) {
if (!(*callback) (day_view, E_DAY_VIEW_LONG_EVENT, event_num, data))
@@ -2004,12 +2049,19 @@ e_day_view_remove_event_cb (EDayView *day_view,
day, event_num);
#endif
- if (day == E_DAY_VIEW_LONG_EVENT)
+ if (day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return TRUE;
+
event = &g_array_index (day_view->long_events,
EDayViewEvent, event_num);
- else
+ } else {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return TRUE;
+
event = &g_array_index (day_view->events[day],
EDayViewEvent, event_num);
+ }
if (!event)
return TRUE;
@@ -2029,7 +2081,8 @@ e_day_view_remove_event_cb (EDayView *day_view,
if (event->canvas_item)
gtk_object_destroy (GTK_OBJECT (event->canvas_item));
- g_object_unref (event->comp_data);
+ if (is_comp_data_valid (event))
+ g_object_unref (event->comp_data);
event->comp_data = NULL;
if (day == E_DAY_VIEW_LONG_EVENT) {
@@ -2053,6 +2106,9 @@ set_text_as_bold (EDayViewEvent *event)
gchar *address;
ECalComponentAttendee *at = NULL;
+ if (!is_comp_data_valid (event))
+ return;
+
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
address = itip_get_comp_attendee (comp, event->comp_data->client);
@@ -2091,10 +2147,13 @@ e_day_view_update_event_label (EDayView *day_view,
gchar *text;
gint interval;
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
/* If the event isn't visible just return. */
- if (!event->canvas_item)
+ if (!event->canvas_item || !is_comp_data_valid (event))
return;
summary = icalcomponent_get_summary (event->comp_data->icalcomp);
@@ -2142,11 +2201,14 @@ e_day_view_update_long_event_label (EDayView *day_view,
const gchar *summary;
gboolean free_text = FALSE;
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
/* If the event isn't visible just return. */
- if (!event->canvas_item)
+ if (!event->canvas_item || !is_comp_data_valid (event))
return;
summary = e_calendar_view_get_icalcomponent_summary (event->comp_data->client, event->comp_data->icalcomp, &free_text);
@@ -2231,6 +2293,9 @@ e_day_view_find_event_from_uid (EDayView *day_view,
event = &g_array_index (day_view->events[day],
EDayViewEvent, event_num);
+ if (!is_comp_data_valid (event))
+ continue;
+
if (event->comp_data->client != client)
continue;
@@ -2259,6 +2324,9 @@ e_day_view_find_event_from_uid (EDayView *day_view,
event = &g_array_index (day_view->long_events,
EDayViewEvent, event_num);
+ if (!is_comp_data_valid (event))
+ continue;
+
if (event->comp_data->client != client)
continue;
@@ -2976,25 +3044,34 @@ e_day_view_recalc_work_week (EDayView *day_view)
static gboolean
e_day_view_update_scroll_regions (EDayView *day_view)
{
+ GtkAllocation main_canvas_allocation;
+ GtkAllocation time_canvas_allocation;
gdouble old_x2, old_y2, new_x2, new_y2;
gboolean need_reshape = FALSE;
+ gtk_widget_get_allocation (
+ day_view->main_canvas, &main_canvas_allocation);
+ gtk_widget_get_allocation (
+ day_view->time_canvas, &time_canvas_allocation);
+
/* Set the scroll region of the time canvas to its allocated width,
but with the height the same as the main canvas. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (day_view->time_canvas),
- NULL, NULL, &old_x2, &old_y2);
- new_x2 = day_view->time_canvas->allocation.width - 1;
+ gnome_canvas_get_scroll_region (
+ GNOME_CANVAS (day_view->time_canvas),
+ NULL, NULL, &old_x2, &old_y2);
+ new_x2 = time_canvas_allocation.width - 1;
new_y2 = MAX (day_view->rows * day_view->row_height,
- day_view->main_canvas->allocation.height) - 1;
+ main_canvas_allocation.height) - 1;
if (old_x2 != new_x2 || old_y2 != new_y2)
gnome_canvas_set_scroll_region (GNOME_CANVAS (day_view->time_canvas),
0, 0, new_x2, new_y2);
/* Set the scroll region of the main canvas to its allocated width,
but with the height depending on the number of rows needed. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (day_view->main_canvas),
- NULL, NULL, &old_x2, &old_y2);
- new_x2 = day_view->main_canvas->allocation.width - 1;
+ gnome_canvas_get_scroll_region (
+ GNOME_CANVAS (day_view->main_canvas),
+ NULL, NULL, &old_x2, &old_y2);
+ new_x2 = main_canvas_allocation.width - 1;
if (day_view->days_shown == 1)
new_x2 = MAX (new_x2, day_view->max_cols * (E_DAY_VIEW_MIN_DAY_COL_WIDTH + E_DAY_VIEW_GAP_WIDTH) - E_DAY_VIEW_MIN_DAY_COL_WIDTH - 1);
@@ -3005,7 +3082,7 @@ e_day_view_update_scroll_regions (EDayView *day_view)
0, 0, new_x2, new_y2);
}
- if (new_x2 <= day_view->main_canvas->allocation.width - 1)
+ if (new_x2 <= main_canvas_allocation.width - 1)
gtk_widget_hide (day_view->mc_hscrollbar);
else
gtk_widget_show (day_view->mc_hscrollbar);
@@ -3070,6 +3147,11 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
{
gint event_x, event_y, day, event_num;
ECalendarViewPosition pos;
+ GtkLayout *layout;
+ GdkWindow *window;
+
+ layout = GTK_LAYOUT (widget);
+ window = gtk_layout_get_bin_window (layout);
if (day_view->resize_event_num != -1)
day_view->resize_event_num = -1;
@@ -3079,9 +3161,8 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
/* Convert the coords to the main canvas window, or return if the
window is not found. */
- if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event,
- GTK_LAYOUT (widget)->bin_window,
- &event_x, &event_y))
+ if (!e_day_view_convert_event_coords (
+ day_view, (GdkEvent*) event, window, &event_x, &event_y))
return FALSE;
pos = e_day_view_convert_position_in_top_canvas (day_view,
@@ -3116,14 +3197,10 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
return TRUE;
}
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (day_view))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (day_view));
- if (gdk_pointer_grab (GTK_LAYOUT (widget)->bin_window, FALSE,
+ if (gdk_pointer_grab (window, FALSE,
GDK_POINTER_MOTION_MASK
| GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time) == 0) {
@@ -3133,11 +3210,7 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
e_day_view_start_selection (day_view, day, -1);
}
} else if (event->button == 3) {
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (day_view))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (day_view));
if (day < day_view->selection_start_day || day > day_view->selection_end_day) {
@@ -3211,11 +3284,16 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
{
gint event_x, event_y, row, day, event_num;
ECalendarViewPosition pos;
+ GtkLayout *layout;
+ GdkWindow *window;
#if 0
g_print ("In e_day_view_on_main_canvas_button_press\n");
#endif
+ layout = GTK_LAYOUT (widget);
+ window = gtk_layout_get_bin_window (layout);
+
if (day_view->resize_event_num != -1)
day_view->resize_event_num = -1;
@@ -3224,9 +3302,8 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
/* Convert the coords to the main canvas window, or return if the
window is not found. */
- if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event,
- GTK_LAYOUT (widget)->bin_window,
- &event_x, &event_y))
+ if (!e_day_view_convert_event_coords (
+ day_view, (GdkEvent*) event, window, &event_x, &event_y))
return FALSE;
/* Find out where the mouse is. */
@@ -3262,14 +3339,10 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
return TRUE;
}
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)) && !gtk_widget_has_focus (GTK_WIDGET (day_view->main_canvas)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (day_view) && !GTK_WIDGET_HAS_FOCUS (day_view->main_canvas))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (day_view));
- if (gdk_pointer_grab (GTK_LAYOUT (widget)->bin_window, FALSE,
+ if (gdk_pointer_grab (window, FALSE,
GDK_POINTER_MOTION_MASK
| GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time) == 0) {
@@ -3280,11 +3353,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
g_signal_emit_by_name (day_view, "selected_time_changed");
}
} else if (event->button == 3) {
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (day_view))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (day_view));
if ((day < day_view->selection_start_day || day > day_view->selection_end_day)
@@ -3383,6 +3452,9 @@ e_day_view_on_long_event_button_press (EDayView *day_view,
} else if (event->button == 3) {
EDayViewEvent *e;
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return TRUE;
+
e = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
e_day_view_set_selected_time_range_in_top_visible (day_view, e->start, e->end);
@@ -3421,6 +3493,9 @@ e_day_view_on_event_button_press (EDayView *day_view,
} else if (event->button == 3) {
EDayViewEvent *e;
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return TRUE;
+
e = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
e_day_view_set_selected_time_range_visible (day_view, e->start, e->end);
@@ -3442,12 +3517,20 @@ e_day_view_on_long_event_click (EDayView *day_view,
gint event_y)
{
EDayViewEvent *event;
+ GtkLayout *layout;
+ GdkWindow *window;
gint start_day, end_day, day;
gint item_x, item_y, item_w, item_h;
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
/* Ignore clicks on the EText while editing. */
if (pos == E_CALENDAR_VIEW_POS_EVENT
&& E_TEXT (event->canvas_item)->editing) {
@@ -3467,14 +3550,13 @@ e_day_view_on_long_event_click (EDayView *day_view,
/* Grab the keyboard focus, so the event being edited is saved
and we can use the Escape key to abort the resize. */
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (day_view))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (day_view));
- if (gdk_pointer_grab (GTK_LAYOUT (day_view->top_canvas)->bin_window, FALSE,
+ layout = GTK_LAYOUT (day_view->top_canvas);
+ window = gtk_layout_get_bin_window (layout);
+
+ if (gdk_pointer_grab (window, FALSE,
GDK_POINTER_MOTION_MASK
| GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time) == 0) {
@@ -3517,11 +3599,19 @@ e_day_view_on_event_click (EDayView *day_view,
gint event_y)
{
EDayViewEvent *event;
+ GtkLayout *layout;
+ GdkWindow *window;
gint tmp_day, row, start_row;
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
/* Ignore clicks on the EText while editing. */
if (pos == E_CALENDAR_VIEW_POS_EVENT
&& E_TEXT (event->canvas_item)->editing) {
@@ -3541,14 +3631,13 @@ e_day_view_on_event_click (EDayView *day_view,
/* Grab the keyboard focus, so the event being edited is saved
and we can use the Escape key to abort the resize. */
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (day_view)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (day_view))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (day_view));
- if (gdk_pointer_grab (GTK_LAYOUT (day_view->main_canvas)->bin_window, FALSE,
+ layout = GTK_LAYOUT (day_view->main_canvas);
+ window = gtk_layout_get_bin_window (layout);
+
+ if (gdk_pointer_grab (window, FALSE,
GDK_POINTER_MOTION_MASK
| GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time) == 0) {
@@ -3596,12 +3685,22 @@ e_day_view_on_event_double_click (EDayView *day_view,
EDayViewEvent *event;
icalproperty *attendee_prop = NULL;
- if (day == -1)
+ if (day == -1) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
- else
+ } else {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
+ }
+
+ if (!is_comp_data_valid (event))
+ return;
attendee_prop = icalcomponent_get_first_property (event->comp_data->icalcomp, ICAL_ATTENDEE_PROPERTY);
@@ -3643,23 +3742,37 @@ e_day_view_get_selected_events (ECalendarView *cal_view)
g_return_val_if_fail (E_IS_DAY_VIEW (day_view), NULL);
if (day_view->editing_event_num != -1) {
- if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT)
+ if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, day_view->editing_event_num))
+ return NULL;
+
event = &g_array_index (day_view->long_events,
EDayViewEvent,
day_view->editing_event_num);
- else
+ } else {
+ if (!is_array_index_in_bounds (day_view->events[day_view->editing_event_day], day_view->editing_event_num))
+ return NULL;
+
event = &g_array_index (day_view->events[day_view->editing_event_day],
EDayViewEvent,
day_view->editing_event_num);
+ }
} else if (day_view->popup_event_num != -1) {
- if (day_view->popup_event_day == E_DAY_VIEW_LONG_EVENT)
+ if (day_view->popup_event_day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, day_view->popup_event_num))
+ return NULL;
+
event = &g_array_index (day_view->long_events,
EDayViewEvent,
day_view->popup_event_num);
- else
+ } else {
+ if (!is_array_index_in_bounds (day_view->events[day_view->popup_event_day], day_view->popup_event_num))
+ return NULL;
+
event = &g_array_index (day_view->events[day_view->popup_event_day],
EDayViewEvent,
day_view->popup_event_num);
+ }
}
if (event)
@@ -3787,16 +3900,18 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
gint event_x, event_y, canvas_x, canvas_y;
gint day, event_num;
GdkCursor *cursor;
+ GdkWindow *window;
#if 0
g_print ("In e_day_view_on_top_canvas_motion\n");
#endif
+ window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
+
/* Convert the coords to the main canvas window, or return if the
window is not found. */
- if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) mevent,
- GTK_LAYOUT (widget)->bin_window,
- &event_x, &event_y))
+ if (!e_day_view_convert_event_coords (
+ day_view, (GdkEvent*) mevent, window, &event_x, &event_y))
return FALSE;
canvas_x = event_x;
@@ -3805,9 +3920,13 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
pos = e_day_view_convert_position_in_top_canvas (day_view,
canvas_x, canvas_y,
&day, &event_num);
- if (event_num != -1)
+ if (event_num != -1) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return FALSE;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
+ }
if (day_view->selection_is_being_dragged) {
e_day_view_update_selection (day_view, day, -1);
@@ -3820,9 +3939,15 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
} else if (day_view->pressed_event_day == E_DAY_VIEW_LONG_EVENT) {
GtkTargetList *target_list;
+ if (!is_array_index_in_bounds (day_view->long_events, day_view->pressed_event_num))
+ return FALSE;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
day_view->pressed_event_num);
+ if (!is_comp_data_valid (event))
+ return FALSE;
+
if (!e_cal_util_component_has_recurrences (event->comp_data->icalcomp)
&& (abs (canvas_x - day_view->drag_event_x)
> E_DAY_VIEW_DRAG_START_OFFSET
@@ -3850,7 +3975,7 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
cursor = day_view->normal_cursor;
/* Recurring events can't be resized. */
- if (event && !e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) {
+ if (event && is_comp_data_valid (event) && !e_cal_util_component_has_recurrences (event->comp_data->icalcomp)) {
switch (pos) {
case E_CALENDAR_VIEW_POS_LEFT_EDGE:
case E_CALENDAR_VIEW_POS_RIGHT_EDGE:
@@ -3863,8 +3988,12 @@ e_day_view_on_top_canvas_motion (GtkWidget *widget,
/* Only set the cursor if it is different to last one set. */
if (day_view->last_cursor_set_in_top_canvas != cursor) {
+ GdkWindow *window;
+
day_view->last_cursor_set_in_top_canvas = cursor;
- gdk_window_set_cursor (widget->window, cursor);
+
+ window = gtk_widget_get_window (widget);
+ gdk_window_set_cursor (window, cursor);
}
if (event && E_IS_TEXT (event->canvas_item) && E_TEXT (event->canvas_item)->editing) {
@@ -3884,17 +4013,19 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget,
ECalendarViewPosition pos;
gint event_x, event_y, canvas_x, canvas_y;
gint row, day, event_num;
+ GdkWindow *window;
GdkCursor *cursor;
#if 0
g_print ("In e_day_view_on_main_canvas_motion\n");
#endif
+ window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
+
/* Convert the coords to the main canvas window, or return if the
window is not found. */
- if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) mevent,
- GTK_LAYOUT (widget)->bin_window,
- &event_x, &event_y))
+ if (!e_day_view_convert_event_coords (
+ day_view, (GdkEvent*) mevent, window, &event_x, &event_y))
return FALSE;
canvas_x = event_x;
@@ -3904,9 +4035,13 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget,
canvas_x, canvas_y,
&day, &row,
&event_num);
- if (event_num != -1)
+ if (event_num != -1) {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return FALSE;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
+ }
if (day_view->selection_is_being_dragged) {
if (pos != E_CALENDAR_VIEW_POS_OUTSIDE) {
@@ -3953,7 +4088,7 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget,
cursor = day_view->normal_cursor;
/* Check if the event is editable and client is not readonly while changing the cursor */
- if (event && event->is_editable && e_cal_is_read_only (event->comp_data->client, &read_only, NULL) && !read_only) {
+ if (event && event->is_editable && is_comp_data_valid (event) && e_cal_is_read_only (event->comp_data->client, &read_only, NULL) && !read_only) {
switch (pos) {
case E_CALENDAR_VIEW_POS_LEFT_EDGE:
@@ -3970,8 +4105,12 @@ e_day_view_on_main_canvas_motion (GtkWidget *widget,
/* Only set the cursor if it is different to last one set. */
if (day_view->last_cursor_set_in_main_canvas != cursor) {
+ GdkWindow *window;
+
day_view->last_cursor_set_in_main_canvas = cursor;
- gdk_window_set_cursor (widget->window, cursor);
+
+ window = gtk_widget_get_window (widget);
+ gdk_window_set_cursor (window, cursor);
}
if (event && E_IS_TEXT (event->canvas_item) && E_TEXT (event->canvas_item)->editing) {
@@ -4139,10 +4278,14 @@ e_day_view_update_resize (EDayView *day_view,
day = day_view->resize_event_day;
event_num = day_view->resize_event_num;
+
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
- if (event && (!event->is_editable || (e_cal_is_read_only (event->comp_data->client, &read_only, NULL) && read_only))) {
+ if (event && (!event->is_editable || !is_comp_data_valid (event) || (e_cal_is_read_only (event->comp_data->client, &read_only, NULL) && read_only))) {
return;
}
@@ -4186,9 +4329,16 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
gint is_date;
event_num = day_view->resize_event_num;
+
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
client = event->comp_data->client;
/* We use a temporary copy of the comp since we don't want to
@@ -4297,9 +4447,16 @@ e_day_view_finish_resize (EDayView *day_view)
day = day_view->resize_event_day;
event_num = day_view->resize_event_num;
+
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
client = event->comp_data->client;
/* We use a temporary shallow copy of the ico since we don't want to
@@ -4386,6 +4543,7 @@ e_day_view_finish_resize (EDayView *day_view)
static void
e_day_view_abort_resize (EDayView *day_view)
{
+ GdkWindow *window;
gint day, event_num;
if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE)
@@ -4401,16 +4559,16 @@ e_day_view_abort_resize (EDayView *day_view)
gtk_widget_queue_draw (day_view->top_canvas);
day_view->last_cursor_set_in_top_canvas = day_view->normal_cursor;
- gdk_window_set_cursor (day_view->top_canvas->window,
- day_view->normal_cursor);
+ window = gtk_widget_get_window (day_view->top_canvas);
+ gdk_window_set_cursor (window, day_view->normal_cursor);
} else {
e_day_view_reshape_day_event (day_view, day, event_num);
e_day_view_reshape_main_canvas_resize_bars (day_view);
gtk_widget_queue_draw (day_view->main_canvas);
day_view->last_cursor_set_in_main_canvas = day_view->normal_cursor;
- gdk_window_set_cursor (day_view->main_canvas->window,
- day_view->normal_cursor);
+ window = gtk_widget_get_window (day_view->main_canvas);
+ gdk_window_set_cursor (window, day_view->normal_cursor);
}
}
@@ -4447,7 +4605,8 @@ e_day_view_free_event_array (EDayView *day_view,
if (event->canvas_item)
gtk_object_destroy (GTK_OBJECT (event->canvas_item));
- g_object_unref (event->comp_data);
+ if (is_comp_data_valid (event))
+ g_object_unref (event->comp_data);
}
g_array_set_size (array, 0);
@@ -4660,6 +4819,9 @@ e_day_view_reshape_long_event (EDayView *day_view,
PangoContext *pango_context;
PangoLayout *layout;
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
@@ -4674,6 +4836,9 @@ e_day_view_reshape_long_event (EDayView *day_view,
return;
}
+ if (!is_comp_data_valid (event))
+ return;
+
/* Take off the border and padding. */
item_x += E_DAY_VIEW_LONG_EVENT_BORDER_WIDTH + E_DAY_VIEW_LONG_EVENT_X_PAD;
item_w -= (E_DAY_VIEW_LONG_EVENT_BORDER_WIDTH + E_DAY_VIEW_LONG_EVENT_X_PAD) * 2;
@@ -4819,6 +4984,10 @@ e_day_view_reshape_day_events (EDayView *day_view,
e_day_view_reshape_day_event (day_view, day, event_num);
event = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
+
+ if (!is_comp_data_valid (event))
+ continue;
+
current_comp_string = icalcomponent_as_ical_string_r (event->comp_data->icalcomp);
if (day_view->last_edited_comp_string == NULL) {
g_free (current_comp_string);
@@ -4843,6 +5012,9 @@ e_day_view_reshape_day_event (EDayView *day_view,
gint item_x, item_y, item_w, item_h;
gint num_icons, icons_offset;
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
@@ -4864,9 +5036,9 @@ e_day_view_reshape_day_event (EDayView *day_view,
draw them on top of the resize rect. */
icons_offset = 0;
num_icons = 0;
- if (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE
+ if (is_comp_data_valid (event) && (day_view->resize_drag_pos == E_CALENDAR_VIEW_POS_NONE
|| day_view->resize_event_day != day
- || day_view->resize_event_num != event_num) {
+ || day_view->resize_event_num != event_num)) {
ECalComponent *comp;
comp = e_cal_component_new ();
@@ -5839,24 +6011,50 @@ static void
e_day_view_scroll (EDayView *day_view,
gfloat pages_to_scroll)
{
- GtkAdjustment *adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment;
- gfloat new_value;
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble new_value;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
+ gdouble value;
+
+ layout = GTK_LAYOUT (day_view->main_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
- new_value = adj->value - adj->page_size * pages_to_scroll;
- new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
- gtk_adjustment_set_value (adj, new_value);
+ new_value = value - page_size * pages_to_scroll;
+ new_value = CLAMP (new_value, lower, upper - page_size);
+ gtk_adjustment_set_value (adjustment, new_value);
}
static void
e_day_view_top_scroll (EDayView *day_view,
gfloat pages_to_scroll)
{
- GtkAdjustment *adj = GTK_LAYOUT (day_view->top_canvas)->vadjustment;
- gfloat new_value;
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble new_value;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
+ gdouble value;
- new_value = adj->value - adj->page_size * pages_to_scroll;
- new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
- gtk_adjustment_set_value (adj, new_value);
+ layout = GTK_LAYOUT (day_view->top_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
+
+ new_value = value - page_size * pages_to_scroll;
+ new_value = CLAMP (new_value, lower, upper - page_size);
+ gtk_adjustment_set_value (adjustment, new_value);
}
void
@@ -5864,14 +6062,20 @@ e_day_view_ensure_rows_visible (EDayView *day_view,
gint start_row,
gint end_row)
{
- GtkAdjustment *adj;
- gfloat value, min_value, max_value;
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+ gdouble max_value;
+ gdouble min_value;
+ gdouble page_size;
+ gdouble value;
- adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment;
+ layout = GTK_LAYOUT (day_view->main_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
- value = adj->value;
+ value = gtk_adjustment_get_value (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
- min_value = (end_row + 1) * day_view->row_height - adj->page_size;
+ min_value = (end_row + 1) * day_view->row_height - page_size;
if (value < min_value)
value = min_value;
@@ -5879,10 +6083,7 @@ e_day_view_ensure_rows_visible (EDayView *day_view,
if (value > max_value)
value = max_value;
- if (value != adj->value) {
- adj->value = value;
- gtk_adjustment_value_changed (adj);
- }
+ gtk_adjustment_set_value (adjustment, value);
}
static void
@@ -5906,13 +6107,22 @@ e_day_view_start_editing_event (EDayView *day_view,
return;
if (day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
} else {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
}
+ if (!is_comp_data_valid (event))
+ return;
+
if (!e_cal_is_read_only (event->comp_data->client, &read_only, NULL) || read_only)
return;
@@ -5984,10 +6194,20 @@ cancel_editing (EDayView *day_view)
g_return_if_fail (day != -1);
- if (day == E_DAY_VIEW_LONG_EVENT)
+ if (day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
- else
+ } else {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
+ }
+
+ if (!is_comp_data_valid (event))
+ return;
/* Reset the text to what was in the component */
@@ -6006,9 +6226,15 @@ tooltip_get_view_event (EDayView *day_view, gint day, gint event_num)
EDayViewEvent *pevent;
if (day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return NULL;
+
pevent = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
} else {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return NULL;
+
pevent = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
}
@@ -6111,6 +6337,8 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
gint event_x, event_y, row, day, event_num;
ECalendarViewPosition pos;
gboolean main_canvas = TRUE;
+ GdkWindow *window;
+ GtkLayout *layout;
if (day_view->editing_event_num != -1)
break;
@@ -6123,13 +6351,19 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
/* Convert the coords to the main canvas window, or return if the
window is not found. */
- if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event,
- GTK_LAYOUT (day_view->main_canvas)->bin_window,
- &event_x, &event_y)) {
+ layout = GTK_LAYOUT (day_view->main_canvas);
+ window = gtk_layout_get_bin_window (layout);
+ if (!e_day_view_convert_event_coords (
+ day_view, (GdkEvent*) event,
+ window, &event_x, &event_y)) {
+
main_canvas = FALSE;
- if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event,
- GTK_LAYOUT (day_view->top_canvas)->bin_window,
- &event_x, &event_y)) {
+
+ layout = GTK_LAYOUT (day_view->top_canvas);
+ window = gtk_layout_get_bin_window (layout);
+ if (!e_day_view_convert_event_coords (
+ day_view, (GdkEvent*) event,
+ window, &event_x, &event_y)) {
return FALSE;
}
}
@@ -6217,6 +6451,9 @@ e_day_view_event_move (ECalendarView *cal_view, ECalViewMoveDirection direction)
if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
return FALSE;
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return FALSE;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
day_view->resize_event_day = day;
@@ -6293,8 +6530,16 @@ e_day_view_change_event_time (EDayView *day_view, time_t start_dt, time_t end_dt
day = day_view->editing_event_day;
event_num = day_view->editing_event_num;
+
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
+
client = event->comp_data->client;
/* We use a temporary shallow copy of the ico since we don't want to
@@ -6368,6 +6613,10 @@ e_day_view_change_event_end_time_up (EDayView *day_view)
event_num = day_view->editing_event_num;
if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
return;
+
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
day_view->resize_event_day = day;
@@ -6398,6 +6647,10 @@ e_day_view_change_event_end_time_down (EDayView *day_view)
event_num = day_view->editing_event_num;
if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
return;
+
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
day_view->resize_event_day = day;
@@ -6422,6 +6675,7 @@ static void
e_day_view_on_editing_started (EDayView *day_view,
GnomeCanvasItem *item)
{
+ GtkAllocation allocation;
gint day, event_num;
if (!e_day_view_find_event_from_item (day_view, item,
@@ -6444,6 +6698,8 @@ e_day_view_on_editing_started (EDayView *day_view,
day_view->editing_event_day = day;
day_view->editing_event_num = event_num;
+ gtk_widget_get_allocation (day_view->top_canvas, &allocation);
+
if (day == E_DAY_VIEW_LONG_EVENT) {
gint item_x, item_y, item_w, item_h, scroll_y;
gint start_day, end_day;
@@ -6454,11 +6710,16 @@ e_day_view_on_editing_started (EDayView *day_view,
&start_day, &end_day,
&item_x, &item_y,
&item_w, &item_h)) {
+ GtkLayout *layout;
+ GtkAdjustment *adjustment;
+
+ layout = GTK_LAYOUT (day_view->top_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+
/* and ensure it's visible too */
/*item_y = (event_num * (day_view->top_row_height + 1)) - 1;*/
- scroll_y = gtk_adjustment_get_value (GTK_LAYOUT (day_view->top_canvas)->vadjustment);
- if (item_y + day_view->top_row_height > day_view->top_canvas->allocation.height + scroll_y ||
- item_y < scroll_y)
+ scroll_y = gtk_adjustment_get_value (adjustment);
+ if (item_y + day_view->top_row_height > allocation.height + scroll_y || item_y < scroll_y)
gnome_canvas_scroll_to (GNOME_CANVAS (day_view->top_canvas), 0, item_y);
}
} else {
@@ -6499,14 +6760,23 @@ e_day_view_on_editing_stopped (EDayView *day_view,
return;
if (day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
} else {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
}
+ if (!is_comp_data_valid (event))
+ return;
+
/* Reset the edit fields. */
day_view->editing_event_day = -1;
day_view->editing_event_num = -1;
@@ -6719,6 +6989,7 @@ e_day_view_check_auto_scroll (EDayView *day_view,
gint event_x,
gint event_y)
{
+ GtkAllocation allocation;
gint scroll_x, scroll_y;
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (day_view->main_canvas),
@@ -6730,10 +7001,11 @@ e_day_view_check_auto_scroll (EDayView *day_view,
day_view->last_mouse_x = event_x;
day_view->last_mouse_y = event_y;
+ gtk_widget_get_allocation (day_view->main_canvas, &allocation);
+
if (event_y < E_DAY_VIEW_AUTO_SCROLL_OFFSET)
e_day_view_start_auto_scroll (day_view, TRUE);
- else if (event_y >= day_view->main_canvas->allocation.height
- - E_DAY_VIEW_AUTO_SCROLL_OFFSET)
+ else if (event_y >= allocation.height - E_DAY_VIEW_AUTO_SCROLL_OFFSET)
e_day_view_start_auto_scroll (day_view, FALSE);
else
e_day_view_stop_auto_scroll (day_view);
@@ -6765,7 +7037,11 @@ e_day_view_auto_scroll_handler (gpointer data)
EDayView *day_view;
ECalendarViewPosition pos;
gint scroll_x, scroll_y, new_scroll_y, canvas_x, canvas_y, row, day;
- GtkAdjustment *adj;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
+ gdouble step_increment;
+ gdouble page_size;
+ gdouble upper;
g_return_val_if_fail (E_IS_DAY_VIEW (data), FALSE);
@@ -6782,13 +7058,18 @@ e_day_view_auto_scroll_handler (gpointer data)
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (day_view->main_canvas),
&scroll_x, &scroll_y);
- adj = GTK_LAYOUT (day_view->main_canvas)->vadjustment;
+ layout = GTK_LAYOUT (day_view->main_canvas);
+ adjustment = gtk_layout_get_vadjustment (layout);
+
+ step_increment = gtk_adjustment_get_step_increment (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
if (day_view->auto_scroll_up)
- new_scroll_y = MAX (scroll_y - adj->step_increment, 0);
+ new_scroll_y = MAX (scroll_y - step_increment, 0);
else
- new_scroll_y = MIN (scroll_y + adj->step_increment,
- adj->upper - adj->page_size);
+ new_scroll_y = MIN (scroll_y + step_increment,
+ upper - page_size);
if (new_scroll_y != scroll_y) {
/* NOTE: This reduces flicker, but only works if we don't use
@@ -6844,6 +7125,9 @@ e_day_view_get_event_rows (EDayView *day_view,
g_return_val_if_fail (day < E_DAY_VIEW_LONG_EVENT, FALSE);
g_return_val_if_fail (event_num >= 0, FALSE);
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return FALSE;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
start_row = event->start_minute / day_view->mins_per_row;
@@ -6868,6 +7152,9 @@ e_day_view_get_event_position (EDayView *day_view,
EDayViewEvent *event;
gint start_row, end_row, cols_in_row, start_col, num_columns;
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return FALSE;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
@@ -6922,6 +7209,9 @@ e_day_view_get_long_event_position (EDayView *day_view,
{
EDayViewEvent *event;
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return FALSE;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
@@ -6946,9 +7236,12 @@ e_day_view_get_long_event_position (EDayView *day_view,
}
*item_x = day_view->day_offsets[*start_day] + E_DAY_VIEW_BAR_WIDTH;
- if (day_view->days_shown == 1)
- *item_w = day_view->top_canvas->allocation.width;
- else
+ if (day_view->days_shown == 1) {
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (day_view->top_canvas, &allocation);
+ *item_w = allocation.width;
+ } else
*item_w = day_view->day_offsets[*end_day + 1];
*item_w = MAX (*item_w - *item_x - E_DAY_VIEW_GAP_WIDTH, 0);
*item_y = (event->start_row_or_col) * day_view->top_row_height;
@@ -7189,6 +7482,9 @@ e_day_view_update_top_canvas_drag (EDayView *day_view,
num_days = 1;
if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, day_view->drag_event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
day_view->drag_event_num);
row = event->start_row_or_col + 1;
@@ -7205,6 +7501,9 @@ e_day_view_update_top_canvas_drag (EDayView *day_view,
day = MIN (day, day_view->days_shown - num_days);
} else if (day_view->drag_event_day != -1) {
+ if (!is_array_index_in_bounds (day_view->events[day_view->drag_event_day], day_view->drag_event_num))
+ return;
+
event = &g_array_index (day_view->events[day_view->drag_event_day],
EDayViewEvent,
day_view->drag_event_num);
@@ -7252,7 +7551,7 @@ e_day_view_update_top_canvas_drag (EDayView *day_view,
& GNOME_CANVAS_ITEM_VISIBLE)) {
const gchar *summary;
- if (event) {
+ if (event && is_comp_data_valid (event)) {
summary = icalcomponent_get_summary (event->comp_data->icalcomp);
text = g_strdup (summary);
} else {
@@ -7345,9 +7644,15 @@ e_day_view_update_main_canvas_drag (EDayView *day_view,
num_rows = 1;
if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, day_view->drag_event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
day_view->drag_event_num);
} else if (day_view->drag_event_day != -1) {
+ if (!is_array_index_in_bounds (day_view->events[day_view->drag_event_day], day_view->drag_event_num))
+ return;
+
event = &g_array_index (day_view->events[day_view->drag_event_day],
EDayViewEvent,
day_view->drag_event_num);
@@ -7411,7 +7716,7 @@ e_day_view_update_main_canvas_drag (EDayView *day_view,
if (!(day_view->drag_item->object.flags & GNOME_CANVAS_ITEM_VISIBLE)) {
const gchar *summary;
- if (event) {
+ if (event && is_comp_data_valid (event)) {
summary = icalcomponent_get_summary (event->comp_data->icalcomp);
text = g_strdup (summary);
} else {
@@ -7475,12 +7780,19 @@ e_day_view_on_drag_begin (GtkWidget *widget,
g_return_if_fail (day != -1);
g_return_if_fail (event_num != -1);
- if (day == E_DAY_VIEW_LONG_EVENT)
+ if (day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
- else
+ } else {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
+ }
/* Hide the text item, since it will be shown in the special drag
items. */
@@ -7504,10 +7816,16 @@ e_day_view_on_drag_end (GtkWidget *widget,
return;
if (day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
gtk_widget_queue_draw (day_view->top_canvas);
} else {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day], EDayViewEvent,
event_num);
gtk_widget_queue_draw (day_view->main_canvas);
@@ -7540,12 +7858,22 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
g_return_if_fail (day != -1);
g_return_if_fail (event_num != -1);
- if (day == E_DAY_VIEW_LONG_EVENT)
+ if (day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, event_num))
+ return;
+
event = &g_array_index (day_view->long_events,
EDayViewEvent, event_num);
- else
+ } else {
+ if (!is_array_index_in_bounds (day_view->events[day], event_num))
+ return;
+
event = &g_array_index (day_view->events[day],
EDayViewEvent, event_num);
+ }
+
+ if (!is_comp_data_valid (event))
+ return;
vcal = e_cal_util_new_top_level ();
e_cal_util_add_timezones_from_component (
@@ -7557,15 +7885,17 @@ e_day_view_on_drag_data_get (GtkWidget *widget,
if (comp_str) {
ESource *source = e_cal_get_source (event->comp_data->client);
const gchar *source_uid = e_source_peek_uid (source);
+ GdkAtom target;
gchar *tmp;
if (!source_uid)
source_uid = "";
tmp = g_strconcat (source_uid, "\n", comp_str, NULL);
+ target = gtk_selection_data_get_target (selection_data);
gtk_selection_data_set (
- selection_data, selection_data->target,
- 8, (guchar *) tmp, strlen (tmp));
+ selection_data, target, 8,
+ (guchar *) tmp, strlen (tmp));
g_free (tmp);
}
@@ -7579,7 +7909,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
- GtkSelectionData *data,
+ GtkSelectionData *selection_data,
guint info,
guint time,
EDayView *day_view)
@@ -7595,6 +7925,12 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
gboolean all_day_event;
ECal *client;
gboolean drag_from_same_window;
+ const guchar *data;
+ gint format, length;
+
+ data = gtk_selection_data_get_data (selection_data);
+ format = gtk_selection_data_get_format (selection_data);
+ length = gtk_selection_data_get_length (selection_data);
if (day_view->drag_event_day != -1)
drag_from_same_window = TRUE;
@@ -7604,8 +7940,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
client = e_cal_model_get_default_client (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)));
/* Note that we only support DnD within the EDayView at present. */
- if ((data->length >= 0) && (data->format == 8)
- && (day_view->drag_event_day != -1)) {
+ if (length >= 0 && format == 8 && day_view->drag_event_day != -1) {
/* We are dragging in the same window */
pos = e_day_view_convert_position_in_top_canvas (day_view,
@@ -7620,8 +7955,15 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
end_offset = 0;
if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, day_view->drag_event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
day_view->drag_event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
+
day -= day_view->drag_event_offset;
day = MAX (day, 0);
@@ -7637,9 +7979,15 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
start_offset = event->start_minute;
end_offset = event->end_minute;
} else {
+ if (!is_array_index_in_bounds (day_view->events[day_view->drag_event_day], day_view->drag_event_num))
+ return;
+
event = &g_array_index (day_view->events[day_view->drag_event_day],
EDayViewEvent,
day_view->drag_event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
}
client = event->comp_data->client;
@@ -7731,11 +8079,9 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
}
}
- if ((data->length >= 0) && (data->format == 8)
- && !drag_from_same_window) {
+ if (length >= 0 && format == 8 && !drag_from_same_window) {
/* We are dragging between different window */
- gchar *comp_str;
icalcomponent *icalcomp;
icalcomponent_kind kind;
time_t dtstart;
@@ -7747,8 +8093,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
goto error;
- comp_str = (gchar *) data->data;
- icalcomp = icalparser_parse_string ((const gchar *) comp_str);
+ icalcomp = icalparser_parse_string ((const gchar *) data);
if (!icalcomp)
goto error;
@@ -7804,7 +8149,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
GdkDragContext *context,
gint x,
gint y,
- GtkSelectionData *data,
+ GtkSelectionData *selection_data,
guint info,
guint time,
EDayView *day_view)
@@ -7819,6 +8164,12 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
time_t dt;
ECal *client;
gboolean drag_from_same_window;
+ const guchar *data;
+ gint format, length;
+
+ data = gtk_selection_data_get_data (selection_data);
+ format = gtk_selection_data_get_format (selection_data);
+ length = gtk_selection_data_get_length (selection_data);
if (day_view->drag_event_day != -1)
drag_from_same_window = TRUE;
@@ -7833,8 +8184,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
y += scroll_y;
/* Note that we only support DnD within the EDayView at present. */
- if ((data->length >= 0) && (data->format == 8)
- && (day_view->drag_event_day != -1)) {
+ if (length >= 0 && format == 8 && (day_view->drag_event_day != -1)) {
/* We are dragging in the same window */
pos = e_day_view_convert_position_in_main_canvas (day_view,
@@ -7849,12 +8199,25 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
end_offset = 0;
if (day_view->drag_event_day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, day_view->drag_event_num))
+ return;
+
event = &g_array_index (day_view->long_events, EDayViewEvent,
day_view->drag_event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
} else {
+ if (!is_array_index_in_bounds (day_view->events[day_view->drag_event_day], day_view->drag_event_num))
+ return;
+
event = &g_array_index (day_view->events[day_view->drag_event_day],
EDayViewEvent,
day_view->drag_event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
+
row -= day_view->drag_event_offset;
/* Calculate time offset from start row. */
@@ -7936,11 +8299,9 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
}
}
- if ((data->length >= 0) && (data->format == 8)
- && !drag_from_same_window) {
+ if (length >= 0 && format == 8 && !drag_from_same_window) {
/* We are dragging between different window */
- gchar *comp_str;
icalcomponent *icalcomp;
icalcomponent_kind kind;
time_t dtstart;
@@ -7952,8 +8313,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
if (pos == E_CALENDAR_VIEW_POS_OUTSIDE)
goto error;
- comp_str = (gchar *) data->data;
- icalcomp = icalparser_parse_string ((const gchar *) comp_str);
+ icalcomp = icalparser_parse_string ((const gchar *) data);
if (!icalcomp)
goto error;
@@ -8112,10 +8472,16 @@ e_day_view_paste_text (ECalendarView *cal_view)
return;
if (day_view->editing_event_day == E_DAY_VIEW_LONG_EVENT) {
+ if (!is_array_index_in_bounds (day_view->long_events, day_view->editing_event_num))
+ return;
+
event = &g_array_index (day_view->long_events,
EDayViewEvent,
day_view->editing_event_num);
} else {
+ if (!is_array_index_in_bounds (day_view->events[day_view->editing_event_day], day_view->editing_event_num))
+ return;
+
event = &g_array_index (day_view->events[day_view->editing_event_day],
EDayViewEvent,
day_view->editing_event_num);
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index c941310a2e..fed200d34c 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -758,7 +758,7 @@ write_recurrence_piece (EItipControl *itip, ECalComponent *comp,
struct icalrecurrencetype *r;
gint i;
- g_string_append_len (buffer, "<b>Recurring:</b> ", 18);
+ g_string_append_printf (buffer, "<b>%s</b> ", _("Recurring:"));
if (!e_cal_component_has_simple_recurrence (comp)) {
g_string_append_printf (
@@ -1021,6 +1021,18 @@ write_error_html (EItipControl *itip, const gchar *itip_err)
g_string_free (buffer, TRUE);
}
+static gchar *
+dupe_first_bold (const gchar *format, const gchar *organizer, const gchar *delegator)
+{
+ gchar *tmp, *res;
+
+ tmp = g_strconcat ("<b>", organizer ? organizer : "", "</b>", NULL);
+ res = g_strdup_printf (format, tmp, delegator ? delegator : "");
+ g_free (tmp);
+
+ return res;
+}
+
static void
write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, const gchar *options)
{
@@ -1072,12 +1084,12 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
e_cal_component_get_attendee_list (priv->comp, &attendees);
if (attendees != NULL) {
attendee = attendees->data;
- html = g_strdup_printf (itip_desc,
+ html = dupe_first_bold (itip_desc,
attendee->cn ?
attendee->cn :
- itip_strip_mailto (attendee->value));
+ itip_strip_mailto (attendee->value), NULL);
} else {
- html = g_strdup_printf (itip_desc, _("An unknown person"));
+ html = dupe_first_bold (itip_desc, _("An unknown person"), NULL);
}
break;
case ICAL_METHOD_REQUEST:
@@ -1085,7 +1097,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
e_cal_component_get_organizer (priv->comp, &organizer);
if (priv->delegator_address != NULL) {
if (organizer.value != NULL)
- html = g_strdup_printf (itip_desc,
+ html = dupe_first_bold (itip_desc,
organizer.cn ?
organizer.cn :
itip_strip_mailto (organizer.value),
@@ -1093,18 +1105,18 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
priv->delegator_name :
priv->delegator_address);
else
- html = g_strdup_printf (itip_desc, _("An unknown person"),
+ html = dupe_first_bold (itip_desc, _("An unknown person"),
priv->delegator_name ?
priv->delegator_name :
priv->delegator_address);
} else {
if (organizer.value != NULL)
- html = g_strdup_printf (itip_desc,
+ html = dupe_first_bold (itip_desc,
organizer.cn ?
organizer.cn :
- itip_strip_mailto (organizer.value));
+ itip_strip_mailto (organizer.value), NULL);
else
- html = g_strdup_printf (itip_desc, _("An unknown person"));
+ html = dupe_first_bold (itip_desc, _("An unknown person"), NULL);
}
break;
@@ -1116,20 +1128,21 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
/* The organizer sent this */
e_cal_component_get_organizer (priv->comp, &organizer);
if (organizer.value != NULL)
- html = g_strdup_printf (itip_desc,
+ html = dupe_first_bold (itip_desc,
organizer.cn ?
organizer.cn :
- itip_strip_mailto (organizer.value));
+ itip_strip_mailto (organizer.value), NULL);
else
- html = g_strdup_printf (itip_desc, _("An unknown person"));
+ html = dupe_first_bold (itip_desc, _("An unknown person"), NULL);
break;
}
g_string_append_printf (buffer, "%s", html);
g_free (html);
+ g_string_append (buffer, "<br> ");
/* Describe what the user can do */
g_string_append (
- buffer, _("<br> Please review the following information, "
+ buffer, _("Please review the following information, "
"and then select an action from the menu below."));
/* Separator */
@@ -1353,28 +1366,28 @@ show_current_event (EItipControl *itip)
switch (priv->method) {
case ICAL_METHOD_PUBLISH:
- itip_desc = _("<b>%s</b> has published meeting information.");
+ itip_desc = _("%s has published meeting information.");
itip_title = _("Meeting Information");
options = get_publish_options ();
show_selector = TRUE;
break;
case ICAL_METHOD_REQUEST:
if (priv->delegator_address != NULL)
- itip_desc = _("<b>%s</b> requests the presence of %s at a meeting.");
+ itip_desc = _("%s requests the presence of %s at a meeting.");
else
- itip_desc = _("<b>%s</b> requests your presence at a meeting.");
+ itip_desc = _("%s requests your presence at a meeting.");
itip_title = _("Meeting Proposal");
options = get_request_options ();
show_selector = TRUE;
break;
case ICAL_METHOD_ADD:
/* FIXME Whats going on here? */
- itip_desc = _("<b>%s</b> wishes to be added to an existing meeting.");
+ itip_desc = _("%s wishes to be added to an existing meeting.");
itip_title = _("Meeting Update");
options = get_publish_options ();
break;
case ICAL_METHOD_REFRESH:
- itip_desc = _("<b>%s</b> wishes to receive the latest meeting information.");
+ itip_desc = _("%s wishes to receive the latest meeting information.");
itip_title = _("Meeting Update Request");
options = get_refresh_options ();
@@ -1382,7 +1395,7 @@ show_current_event (EItipControl *itip)
adjust_item (itip, priv->comp);
break;
case ICAL_METHOD_REPLY:
- itip_desc = _("<b>%s</b> has replied to a meeting request.");
+ itip_desc = _("%s has replied to a meeting request.");
itip_title = _("Meeting Reply");
options = get_reply_options ();
@@ -1390,7 +1403,7 @@ show_current_event (EItipControl *itip)
adjust_item (itip, priv->comp);
break;
case ICAL_METHOD_CANCEL:
- itip_desc = _("<b>%s</b> has canceled a meeting.");
+ itip_desc = _("%s has canceled a meeting.");
itip_title = _("Meeting Cancelation");
/* FIXME priv->current_ecal will always be NULL so the
* user won't see an error message, the OK button will
@@ -1401,7 +1414,7 @@ show_current_event (EItipControl *itip)
adjust_item (itip, priv->comp);
break;
default:
- itip_desc = _("<b>%s</b> has sent an unintelligible message.");
+ itip_desc = _("%s has sent an unintelligible message.");
itip_title = _("Bad Meeting Message");
options = NULL;
}
@@ -1429,7 +1442,7 @@ show_current_todo (EItipControl *itip)
switch (priv->method) {
case ICAL_METHOD_PUBLISH:
- itip_desc = _("<b>%s</b> has published task information.");
+ itip_desc = _("%s has published task information.");
itip_title = _("Task Information");
options = get_publish_options ();
show_selector = TRUE;
@@ -1437,21 +1450,21 @@ show_current_todo (EItipControl *itip)
case ICAL_METHOD_REQUEST:
/* FIXME Does this need to handle like events above? */
if (priv->delegator_address != NULL)
- itip_desc = _("<b>%s</b> requests %s to perform a task.");
+ itip_desc = _("%s requests %s to perform a task.");
else
- itip_desc = _("<b>%s</b> requests you perform a task.");
+ itip_desc = _("%s requests you perform a task.");
itip_title = _("Task Proposal");
options = get_request_options ();
show_selector = TRUE;
break;
case ICAL_METHOD_ADD:
/* FIXME Whats going on here? */
- itip_desc = _("<b>%s</b> wishes to be added to an existing task.");
+ itip_desc = _("%s wishes to be added to an existing task.");
itip_title = _("Task Update");
options = get_publish_options ();
break;
case ICAL_METHOD_REFRESH:
- itip_desc = _("<b>%s</b> wishes to receive the latest task information.");
+ itip_desc = _("%s wishes to receive the latest task information.");
itip_title = _("Task Update Request");
options = get_refresh_options ();
@@ -1459,7 +1472,7 @@ show_current_todo (EItipControl *itip)
adjust_item (itip, priv->comp);
break;
case ICAL_METHOD_REPLY:
- itip_desc = _("<b>%s</b> has replied to a task assignment.");
+ itip_desc = _("%s has replied to a task assignment.");
itip_title = _("Task Reply");
options = get_reply_options ();
@@ -1467,7 +1480,7 @@ show_current_todo (EItipControl *itip)
adjust_item (itip, priv->comp);
break;
case ICAL_METHOD_CANCEL:
- itip_desc = _("<b>%s</b> has canceled a task.");
+ itip_desc = _("%s has canceled a task.");
itip_title = _("Task Cancelation");
/* FIXME priv->current_ecal will always be NULL so the
* user won't see an error message, the OK button will
@@ -1478,7 +1491,7 @@ show_current_todo (EItipControl *itip)
adjust_item (itip, priv->comp);
break;
default:
- itip_desc = _("<b>%s</b> has sent an unintelligible message.");
+ itip_desc = _("%s has sent an unintelligible message.");
itip_title = _("Bad Task Message");
options = NULL;
}
@@ -1503,22 +1516,22 @@ show_current_freebusy (EItipControl *itip)
switch (priv->method) {
case ICAL_METHOD_PUBLISH:
- itip_desc = _("<b>%s</b> has published free/busy information.");
+ itip_desc = _("%s has published free/busy information.");
itip_title = _("Free/Busy Information");
options = NULL;
break;
case ICAL_METHOD_REQUEST:
- itip_desc = _("<b>%s</b> requests your free/busy information.");
+ itip_desc = _("%s requests your free/busy information.");
itip_title = _("Free/Busy Request");
options = get_request_fb_options ();
break;
case ICAL_METHOD_REPLY:
- itip_desc = _("<b>%s</b> has replied to a free/busy request.");
+ itip_desc = _("%s has replied to a free/busy request.");
itip_title = _("Free/Busy Reply");
options = NULL;
break;
default:
- itip_desc = _("<b>%s</b> has sent an unintelligible message.");
+ itip_desc = _("%s has sent an unintelligible message.");
itip_title = _("Bad Free/Busy Message");
options = NULL;
}
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index 0e48f7cb32..9920de85e1 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -771,12 +771,14 @@ process_section (EMeetingListView *view, GList *destinations, icalparameter_role
if (contact && e_contact_get (contact , E_CONTACT_IS_LIST)) {
EBook *book = NULL;
ENameSelectorDialog *dialog;
+ ENameSelectorModel *model;
EContactStore *c_store;
GList *books, *l;
gchar *uri = e_contact_get (contact, E_CONTACT_BOOK_URI);
dialog = e_name_selector_peek_dialog (view->priv->name_selector);
- c_store = e_name_selector_dialog_peek_model (dialog)->contact_store;
+ model = e_name_selector_dialog_peek_model (dialog);
+ c_store = e_name_selector_model_peek_contact_store (model);
books = e_contact_store_get_books (c_store);
for (l = books; l; l = l->next) {
diff --git a/calendar/gui/e-meeting-time-sel-item.c b/calendar/gui/e-meeting-time-sel-item.c
index 6c4c2ad8dc..c7c81e12ce 100644
--- a/calendar/gui/e-meeting-time-sel-item.c
+++ b/calendar/gui/e-meeting-time-sel-item.c
@@ -203,7 +203,7 @@ e_meeting_time_selector_item_realize (GnomeCanvasItem *item)
mts_item = E_MEETING_TIME_SELECTOR_ITEM (item);
canvas = item->canvas;
- window = GTK_WIDGET (canvas)->window;
+ window = gtk_widget_get_window (GTK_WIDGET (canvas));
mts_item->main_gc = gdk_gc_new (window);
mts_item->stipple_gc = gdk_gc_new (window);
@@ -976,8 +976,14 @@ e_meeting_time_selector_item_motion_notify (EMeetingTimeSelectorItem *mts_item,
/* Only set the cursor if it is different to the last one we set. */
if (mts_item->last_cursor_set != cursor) {
+ GdkWindow *window;
+ GnomeCanvas *canvas;
+
mts_item->last_cursor_set = cursor;
- gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (mts_item)->canvas)->window, cursor);
+
+ canvas = GNOME_CANVAS_ITEM (mts_item)->canvas;
+ window = gtk_widget_get_window (GTK_WIDGET (canvas));
+ gdk_window_set_cursor (window, cursor);
}
return FALSE;
@@ -1043,7 +1049,12 @@ e_meeting_time_selector_item_calculate_busy_range (EMeetingTimeSelector *mts,
void
e_meeting_time_selector_item_set_normal_cursor (EMeetingTimeSelectorItem *mts_item)
{
+ GnomeCanvas *canvas;
+ GdkWindow *window;
+
g_return_if_fail (IS_E_MEETING_TIME_SELECTOR_ITEM (mts_item));
- gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (mts_item)->canvas)->window, mts_item->normal_cursor);
+ canvas = GNOME_CANVAS_ITEM (mts_item)->canvas;
+ window = gtk_widget_get_window (GTK_WIDGET (canvas));
+ gdk_window_set_cursor (window, mts_item->normal_cursor);
}
diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c
index dd3f49df75..4c19b5a3aa 100644
--- a/calendar/gui/e-meeting-time-sel.c
+++ b/calendar/gui/e-meeting-time-sel.c
@@ -133,9 +133,9 @@ static void e_meeting_time_selector_options_menu_position_callback (GtkMenu *men
gint *y,
gboolean *push_in,
gpointer user_data);
-static void e_meeting_time_selector_on_zoomed_out_toggled (GtkWidget *button,
+static void e_meeting_time_selector_on_zoomed_out_toggled (GtkCheckMenuItem *button,
EMeetingTimeSelector *mts);
-static void e_meeting_time_selector_on_working_hours_toggled (GtkWidget *button,
+static void e_meeting_time_selector_on_working_hours_toggled (GtkCheckMenuItem *menuitem,
EMeetingTimeSelector *mts);
static void e_meeting_time_selector_on_invite_others_button_clicked (GtkWidget *button,
EMeetingTimeSelector *mts);
@@ -403,6 +403,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
{
GtkWidget *hbox, *vbox, *separator, *label, *table, *sw;
GtkWidget *alignment, *child_hbox, *arrow, *menuitem;
+ GtkWidget *child;
+ GtkAdjustment *adjustment;
+ GtkLayout *layout;
GSList *group;
guint accel_key;
time_t meeting_start_time;
@@ -473,7 +476,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
- gtk_widget_set_child_visible (GTK_SCROLLED_WINDOW (sw)->vscrollbar, FALSE);
+ gtk_widget_set_child_visible (
+ gtk_scrolled_window_get_vscrollbar (
+ GTK_SCROLLED_WINDOW (sw)), FALSE);
gtk_widget_show (sw);
gtk_container_add (GTK_CONTAINER (sw), GTK_WIDGET (mts->list_view));
@@ -512,18 +517,26 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
g_signal_connect (mts->display_main, "scroll-event",
G_CALLBACK (e_meeting_time_selector_on_canvas_scroll_event), mts);
- gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (sw), GTK_LAYOUT (mts->display_main)->vadjustment);
+ layout = GTK_LAYOUT (mts->display_main);
- mts->hscrollbar = gtk_hscrollbar_new (GTK_LAYOUT (mts->display_main)->hadjustment);
- GTK_LAYOUT (mts->display_main)->hadjustment->step_increment = mts->day_width;
- gtk_table_attach (GTK_TABLE (mts), mts->hscrollbar,
- 1, 4, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ adjustment = gtk_layout_get_vadjustment (layout);
+ gtk_scrolled_window_set_vadjustment (
+ GTK_SCROLLED_WINDOW (sw), adjustment);
+
+ adjustment = gtk_layout_get_hadjustment (layout);
+ mts->hscrollbar = gtk_hscrollbar_new (adjustment);
+ gtk_adjustment_set_step_increment (adjustment, mts->day_width);
+ gtk_table_attach (
+ GTK_TABLE (mts), mts->hscrollbar,
+ 1, 4, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0);
gtk_widget_show (mts->hscrollbar);
- mts->vscrollbar = gtk_vscrollbar_new (GTK_LAYOUT (mts->display_main)->vadjustment);
- GTK_LAYOUT (mts->display_main)->vadjustment->step_increment = mts->row_height;
- gtk_table_attach (GTK_TABLE (mts), mts->vscrollbar,
- 4, 5, 1, 2, 0, GTK_EXPAND | GTK_FILL, 0, 0);
+ adjustment = gtk_layout_get_vadjustment (layout);
+ mts->vscrollbar = gtk_vscrollbar_new (adjustment);
+ gtk_adjustment_set_step_increment (adjustment, mts->row_height);
+ gtk_table_attach (
+ GTK_TABLE (mts), mts->vscrollbar,
+ 4, 5, 1, 2, 0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (mts->vscrollbar);
/* Create the item in the top canvas. */
@@ -562,7 +575,7 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
gtk_widget_show (hbox);
mts->add_attendees_button =
- gtk_button_new_with_mnemonic (_("A_ttendees..."));
+ gtk_button_new_with_mnemonic (_("Atte_ndees..."));
gtk_button_set_image (
GTK_BUTTON (mts->add_attendees_button),
gtk_image_new_from_stock (
@@ -600,7 +613,8 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
e_meeting_time_selector_options_menu_detacher);
menuitem = gtk_check_menu_item_new_with_label ("");
- gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("Show _only working hours"));
+ child = gtk_bin_get_child (GTK_BIN (menuitem));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("Show _only working hours"));
gtk_menu_shell_append (GTK_MENU_SHELL (mts->options_menu), menuitem);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
mts->working_hours_only);
@@ -610,7 +624,8 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
gtk_widget_show (menuitem);
menuitem = gtk_check_menu_item_new_with_label ("");
- gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("Show _zoomed out"));
+ child = gtk_bin_get_child (GTK_BIN (menuitem));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("Show _zoomed out"));
gtk_menu_shell_append (GTK_MENU_SHELL (mts->options_menu), menuitem);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
mts->zoomed_out);
@@ -625,7 +640,8 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("");
- gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("_Update free/busy"));
+ child = gtk_bin_get_child (GTK_BIN (menuitem));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_Update free/busy"));
gtk_menu_shell_append (GTK_MENU_SHELL (mts->options_menu), menuitem);
g_signal_connect (menuitem, "activate",
@@ -639,9 +655,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
gtk_widget_show (hbox);
mts->autopick_down_button = gtk_button_new_with_label ("");
- gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (mts->autopick_down_button)->child),
- _("_<<"));
- accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (mts->autopick_down_button)->child));
+ child = gtk_bin_get_child (GTK_BIN (mts->autopick_down_button));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_<<"));
+ accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (child));
gtk_widget_add_accelerator (mts->autopick_down_button, "clicked", mts->accel_group,
accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0);
gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_down_button, TRUE, TRUE, 6);
@@ -672,9 +688,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
gtk_widget_show (arrow);
mts->autopick_up_button = gtk_button_new_with_label ("");
- gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (mts->autopick_up_button)->child),
- _(">_>"));
- accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (GTK_BIN (mts->autopick_up_button)->child));
+ child = gtk_bin_get_child (GTK_BIN (mts->autopick_up_button));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _(">_>"));
+ accel_key = gtk_label_get_mnemonic_keyval (GTK_LABEL (child));
gtk_widget_add_accelerator (mts->autopick_up_button, "clicked", mts->accel_group,
accel_key, GDK_MOD1_MASK | GDK_SHIFT_MASK, 0);
gtk_box_pack_start (GTK_BOX (hbox), mts->autopick_up_button, TRUE, TRUE, 6);
@@ -689,8 +705,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
menuitem = gtk_radio_menu_item_new_with_label (NULL, "");
mts->autopick_all_item = menuitem;
+ child = gtk_bin_get_child (GTK_BIN (menuitem));
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("_All people and resources"));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_All people and resources"));
gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem);
g_signal_connect (menuitem, "toggled",
G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts);
@@ -698,8 +715,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
menuitem = gtk_radio_menu_item_new_with_label (group, "");
mts->autopick_all_people_one_resource_item = menuitem;
+ child = gtk_bin_get_child (GTK_BIN (menuitem));
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("All _people and one resource"));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("All _people and one resource"));
gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem);
g_signal_connect (menuitem, "toggled",
G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts);
@@ -707,8 +725,9 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
menuitem = gtk_radio_menu_item_new_with_label (group, "");
mts->autopick_required_people_item = menuitem;
+ child = gtk_bin_get_child (GTK_BIN (menuitem));
group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
- gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("_Required people"));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("_Required people"));
gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem);
g_signal_connect (menuitem, "activate",
G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts);
@@ -716,7 +735,8 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
menuitem = gtk_radio_menu_item_new_with_label (group, "");
mts->autopick_required_people_one_resource_item = menuitem;
- gtk_label_set_text_with_mnemonic (GTK_LABEL (GTK_BIN (menuitem)->child), _("Required people and _one resource"));
+ child = gtk_bin_get_child (GTK_BIN (menuitem));
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (child), _("Required people and _one resource"));
gtk_menu_shell_append (GTK_MENU_SHELL (mts->autopick_menu), menuitem);
g_signal_connect (menuitem, "activate",
G_CALLBACK (e_meeting_time_selector_on_autopick_option_toggled), mts);
@@ -830,12 +850,18 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingStore *em
8, 8);
/* Connect handlers to the adjustments scroll the other items. */
- g_signal_connect (GTK_LAYOUT (mts->display_main)->hadjustment, "value_changed",
- G_CALLBACK (e_meeting_time_selector_hadjustment_changed), mts);
- g_signal_connect (GTK_LAYOUT (mts->display_main)->vadjustment, "value_changed",
- G_CALLBACK (e_meeting_time_selector_vadjustment_changed), mts);
- g_signal_connect (GTK_LAYOUT (mts->display_main)->vadjustment, "changed",
- G_CALLBACK (e_meeting_time_selector_vadjustment_changed), mts);
+ layout = GTK_LAYOUT (mts->display_main);
+ adjustment = gtk_layout_get_hadjustment (layout);
+ g_signal_connect (
+ adjustment, "value_changed",
+ G_CALLBACK (e_meeting_time_selector_hadjustment_changed), mts);
+ adjustment = gtk_layout_get_vadjustment (layout);
+ g_signal_connect (
+ adjustment, "value_changed",
+ G_CALLBACK (e_meeting_time_selector_vadjustment_changed), mts);
+ g_signal_connect (
+ adjustment, "changed",
+ G_CALLBACK (e_meeting_time_selector_vadjustment_changed), mts);
e_meeting_time_selector_recalc_grid (mts);
e_meeting_time_selector_ensure_meeting_time_shown (mts);
@@ -881,28 +907,36 @@ e_meeting_time_selector_expose_key_color (GtkWidget *darea,
GdkColor *color)
{
EMeetingTimeSelector * mts;
+ GtkAllocation allocation;
+ GdkWindow *window;
+ GtkStyle *style;
GdkGC *gc;
- gint width, height;
+
+ style = gtk_widget_get_style (darea);
+ window = gtk_widget_get_window (darea);
+ gtk_widget_get_allocation (darea, &allocation);
mts = g_object_get_data (G_OBJECT (darea), "data");
gc = mts->color_key_gc;
- width = darea->allocation.width;
- height = darea->allocation.height;
- gtk_paint_shadow (darea->style, darea->window, GTK_STATE_NORMAL,
- GTK_SHADOW_IN, NULL, NULL, NULL, 0, 0, width, height);
+ gtk_paint_shadow (
+ style, window, GTK_STATE_NORMAL,
+ GTK_SHADOW_IN, NULL, NULL, NULL, 0, 0,
+ allocation.width, allocation.height);
if (color) {
gdk_gc_set_foreground (gc, color);
- gdk_draw_rectangle (darea->window, gc, TRUE, 1, 1,
- width - 2, height - 2);
+ gdk_draw_rectangle (
+ window, gc, TRUE, 1, 1,
+ allocation.width - 2, allocation.height - 2);
} else {
gdk_gc_set_foreground (gc, &mts->grid_color);
gdk_gc_set_background (gc, &mts->stipple_bg_color);
gdk_gc_set_stipple (gc, mts->stipple);
gdk_gc_set_fill (gc, GDK_OPAQUE_STIPPLED);
- gdk_draw_rectangle (darea->window, gc, TRUE, 1, 1,
- width - 2, height - 2);
+ gdk_draw_rectangle (
+ window, gc, TRUE, 1, 1,
+ allocation.width - 2, allocation.height - 2);
gdk_gc_set_fill (gc, GDK_SOLID);
}
@@ -1027,13 +1061,15 @@ static void
e_meeting_time_selector_realize (GtkWidget *widget)
{
EMeetingTimeSelector *mts;
+ GdkWindow *window;
if (GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->realize)
(*GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->realize)(widget);
mts = E_MEETING_TIME_SELECTOR (widget);
- mts->color_key_gc = gdk_gc_new (widget->window);
+ window = gtk_widget_get_window (widget);
+ mts->color_key_gc = gdk_gc_new (window);
}
static void
@@ -1065,10 +1101,11 @@ get_cell_height (GtkTreeView *tree)
}
static gboolean
-style_change_idle_func (gpointer widget)
+style_change_idle_func (EMeetingTimeSelector *mts)
{
- EMeetingTimeSelector *mts;
EMeetingTime saved_time;
+ GtkAdjustment *adjustment;
+ GtkWidget *widget;
gint hour, max_hour_width;
/*int maxheight; */
PangoFontDescription *font_desc;
@@ -1076,9 +1113,8 @@ style_change_idle_func (gpointer widget)
PangoFontMetrics *font_metrics;
PangoLayout *layout;
- mts = E_MEETING_TIME_SELECTOR (widget);
-
/* Set up Pango prerequisites */
+ widget = GTK_WIDGET (mts);
font_desc = gtk_widget_get_style (widget)->font_desc;
pango_context = gtk_widget_get_pango_context (widget);
font_metrics = pango_context_get_metrics (pango_context, font_desc,
@@ -1121,8 +1157,13 @@ style_change_idle_func (gpointer widget)
gtk_widget_set_size_request (mts->attendees_vbox_spacer, 1, mts->row_height * 2 - 6);
- GTK_LAYOUT (mts->display_main)->hadjustment->step_increment = mts->day_width;
- GTK_LAYOUT (mts->display_main)->vadjustment->step_increment = mts->row_height;
+ widget = mts->display_main;
+
+ adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (widget));
+ gtk_adjustment_set_step_increment (adjustment, mts->day_width);
+
+ adjustment = gtk_layout_get_vadjustment (GTK_LAYOUT (widget));
+ gtk_adjustment_set_step_increment (adjustment, mts->row_height);
g_object_unref (layout);
pango_font_metrics_unref (font_metrics);
@@ -1142,7 +1183,8 @@ e_meeting_time_selector_style_set (GtkWidget *widget,
(*GTK_WIDGET_CLASS (e_meeting_time_selector_parent_class)->style_set)(widget, previous_style);
if (!mts->style_change_idle_id)
- mts->style_change_idle_id = g_idle_add (style_change_idle_func, widget);
+ mts->style_change_idle_id = g_idle_add (
+ (GSourceFunc) style_change_idle_func, widget);
}
/* This draws a shadow around the top display and main display. */
@@ -1165,19 +1207,24 @@ e_meeting_time_selector_expose_event (GtkWidget *widget,
static void
e_meeting_time_selector_draw_shadow (EMeetingTimeSelector *mts)
{
- GtkWidget *widget;
+ GtkAllocation allocation;
+ GdkWindow *window;
+ GtkStyle *style;
gint x, y, w, h;
- widget = GTK_WIDGET (mts);
-
/* Draw the shadow around the graphical displays. */
- x = mts->display_top->allocation.x - 2;
- y = mts->display_top->allocation.y - 2;
- w = mts->display_top->allocation.width + 4;
- h = mts->display_top->allocation.height + mts->display_main->allocation.height + 4;
+ gtk_widget_get_allocation (mts->display_top, &allocation);
+ x = allocation.x - 2;
+ y = allocation.y - 2;
+ w = allocation.width + 4;
+ h = allocation.height + allocation.height + 4;
- gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
- GTK_SHADOW_IN, NULL, NULL, NULL, x, y, w, h);
+ style = gtk_widget_get_style (GTK_WIDGET (mts));
+ window = gtk_widget_get_window (GTK_WIDGET (mts));
+
+ gtk_paint_shadow (
+ style, window, GTK_STATE_NORMAL,
+ GTK_SHADOW_IN, NULL, NULL, NULL, x, y, w, h);
}
/* When the main canvas scrolls, we scroll the other canvases. */
@@ -1185,26 +1232,30 @@ static void
e_meeting_time_selector_hadjustment_changed (GtkAdjustment *adjustment,
EMeetingTimeSelector *mts)
{
- GtkAdjustment *adj;
+ GtkAdjustment *hadjustment;
+ GtkLayout *layout;
+ gdouble value;
- adj = GTK_LAYOUT (mts->display_top)->hadjustment;
- if (adj->value != adjustment->value) {
- adj->value = adjustment->value;
- gtk_adjustment_value_changed (adj);
- }
+ layout = GTK_LAYOUT (mts->display_top);
+ hadjustment = gtk_layout_get_hadjustment (layout);
+
+ value = gtk_adjustment_get_value (adjustment);
+ gtk_adjustment_set_value (hadjustment, value);
}
static void
e_meeting_time_selector_vadjustment_changed (GtkAdjustment *adjustment,
EMeetingTimeSelector *mts)
{
- GtkAdjustment *adj;
+ GtkAdjustment *vadjustment;
+ GtkTreeView *tree_view;
+ gdouble value;
- adj = gtk_tree_view_get_vadjustment (GTK_TREE_VIEW (mts->list_view));
- if (adj->value != adjustment->value) {
- adj->value = adjustment->value;
- gtk_adjustment_value_changed (adj);
- }
+ tree_view = GTK_TREE_VIEW (mts->list_view);
+ vadjustment = gtk_tree_view_get_vadjustment (tree_view);
+
+ value = gtk_adjustment_get_value (adjustment);
+ gtk_adjustment_set_value (vadjustment, value);
}
void
@@ -1467,12 +1518,20 @@ e_meeting_time_selector_refresh_free_busy (EMeetingTimeSelector *mts, gint row,
EMeetingTimeSelectorAutopickOption
e_meeting_time_selector_get_autopick_option (EMeetingTimeSelector *mts)
{
- if (GTK_CHECK_MENU_ITEM (mts->autopick_all_item)->active)
+ GtkWidget *widget;
+
+ widget = mts->autopick_all_item;
+ if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
return E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_RESOURCES;
- if (GTK_CHECK_MENU_ITEM (mts->autopick_all_people_one_resource_item)->active)
+
+ widget = mts->autopick_all_people_one_resource_item;
+ if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
return E_MEETING_TIME_SELECTOR_ALL_PEOPLE_AND_ONE_RESOURCE;
- if (GTK_CHECK_MENU_ITEM (mts->autopick_required_people_item)->active)
+
+ widget = mts->autopick_required_people_item;
+ if (gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget)))
return E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE;
+
return E_MEETING_TIME_SELECTOR_REQUIRED_PEOPLE_AND_ONE_RESOURCE;
}
@@ -1639,14 +1698,20 @@ e_meeting_time_selector_options_menu_position_callback (GtkMenu *menu,
{
EMeetingTimeSelector *mts;
GtkRequisition menu_requisition;
+ GtkAllocation allocation;
+ GtkWidget *widget;
+ GdkWindow *window;
gint max_x, max_y;
mts = E_MEETING_TIME_SELECTOR (user_data);
/* Calculate our preferred position. */
- gdk_window_get_origin (mts->options_button->window, x, y);
- *x += mts->options_button->allocation.x;
- *y += mts->options_button->allocation.y + mts->options_button->allocation.height - 2;
+ widget = mts->options_button;
+ window = gtk_widget_get_window (widget);
+ gdk_window_get_origin (window, x, y);
+ gtk_widget_get_allocation (widget, &allocation);
+ *x += allocation.x;
+ *y += allocation.y + allocation.height - 2;
/* Now make sure we are on the screen. */
gtk_widget_size_request (mts->options_menu, &menu_requisition);
@@ -1662,11 +1727,7 @@ e_meeting_time_selector_on_update_free_busy (GtkWidget *button,
{
/* Make sure the menu pops down, which doesn't happen by default if
keyboard accelerators are used. */
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (mts->options_menu))
-#else
- if (GTK_WIDGET_VISIBLE (mts->options_menu))
-#endif
gtk_menu_popdown (GTK_MENU (mts->options_menu));
e_meeting_time_selector_refresh_free_busy (mts, 0, TRUE);
@@ -1690,14 +1751,20 @@ e_meeting_time_selector_autopick_menu_position_callback (GtkMenu *menu,
{
EMeetingTimeSelector *mts;
GtkRequisition menu_requisition;
+ GtkAllocation allocation;
+ GtkWidget *widget;
+ GdkWindow *window;
gint max_x, max_y;
mts = E_MEETING_TIME_SELECTOR (user_data);
/* Calculate our preferred position. */
- gdk_window_get_origin (mts->autopick_button->window, x, y);
- *x += mts->autopick_button->allocation.x;
- *y += mts->autopick_button->allocation.y + mts->autopick_button->allocation.height - 2;
+ widget = mts->autopick_button;
+ window = gtk_widget_get_window (widget);
+ gdk_window_get_origin (window, x, y);
+ gtk_widget_get_allocation (widget, &allocation);
+ *x += allocation.x;
+ *y += allocation.y + allocation.height - 2;
/* Now make sure we are on the screen. */
gtk_widget_size_request (mts->autopick_menu, &menu_requisition);
@@ -1713,11 +1780,7 @@ e_meeting_time_selector_on_autopick_option_toggled (GtkWidget *button,
{
/* Make sure the menu pops down, which doesn't happen by default if
keyboard accelerators are used. */
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (mts->autopick_menu))
-#else
- if (GTK_WIDGET_VISIBLE (mts->autopick_menu))
-#endif
gtk_menu_popdown (GTK_MENU (mts->autopick_menu));
}
@@ -2112,36 +2175,34 @@ e_meeting_time_selector_find_time_clash (EMeetingTimeSelector *mts,
}
static void
-e_meeting_time_selector_on_zoomed_out_toggled (GtkWidget *menuitem,
+e_meeting_time_selector_on_zoomed_out_toggled (GtkCheckMenuItem *menuitem,
EMeetingTimeSelector *mts)
{
+ gboolean active;
+
/* Make sure the menu pops down, which doesn't happen by default if
keyboard accelerators are used. */
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (mts->options_menu))
-#else
- if (GTK_WIDGET_VISIBLE (mts->options_menu))
-#endif
gtk_menu_popdown (GTK_MENU (mts->options_menu));
- e_meeting_time_selector_set_zoomed_out (mts, GTK_CHECK_MENU_ITEM (menuitem)->active);
+ active = gtk_check_menu_item_get_active (menuitem);
+ e_meeting_time_selector_set_zoomed_out (mts, active);
e_meeting_time_selector_ensure_meeting_time_shown (mts);
}
static void
-e_meeting_time_selector_on_working_hours_toggled (GtkWidget *menuitem,
+e_meeting_time_selector_on_working_hours_toggled (GtkCheckMenuItem *menuitem,
EMeetingTimeSelector *mts)
{
+ gboolean active;
+
/* Make sure the menu pops down, which doesn't happen by default if
keyboard accelerators are used. */
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (mts->options_menu))
-#else
- if (GTK_WIDGET_VISIBLE (mts->options_menu))
-#endif
gtk_menu_popdown (GTK_MENU (mts->options_menu));
- e_meeting_time_selector_set_working_hours_only (mts, GTK_CHECK_MENU_ITEM (menuitem)->active);
+ active = gtk_check_menu_item_get_active (menuitem);
+ e_meeting_time_selector_set_working_hours_only (mts, active);
e_meeting_time_selector_ensure_meeting_time_shown (mts);
}
@@ -2360,8 +2421,10 @@ static void
e_meeting_time_selector_on_canvas_realized (GtkWidget *widget,
EMeetingTimeSelector *mts)
{
- gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window,
- NULL, FALSE);
+ GdkWindow *window;
+
+ window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
+ gdk_window_set_back_pixmap (window, NULL, FALSE);
}
/* This is called when the meeting start time GnomeDateEdit is changed,
@@ -2509,12 +2572,12 @@ e_meeting_time_selector_on_canvas_scroll_event (GtkWidget *widget, GdkEventScrol
static void
e_meeting_time_selector_update_main_canvas_scroll_region (EMeetingTimeSelector *mts)
{
- gint height, canvas_height;
+ GtkAllocation allocation;
+ gint height;
+ gtk_widget_get_allocation (mts->display_main, &allocation);
height = mts->row_height * (e_meeting_store_count_actual_attendees (mts->model) + 2);
- canvas_height = GTK_WIDGET (mts->display_main)->allocation.height;
-
- height = MAX (height, canvas_height);
+ height = MAX (height, allocation.height);
gnome_canvas_set_scroll_region (GNOME_CANVAS (mts->display_main),
0, 0,
@@ -2534,11 +2597,13 @@ e_meeting_time_selector_drag_meeting_time (EMeetingTimeSelector *mts,
EMeetingTime first_time, last_time, drag_time, *time_to_set;
gint scroll_x, scroll_y, canvas_width;
gboolean set_both_times = FALSE;
+ GtkAllocation allocation;
/* Get the x coords of visible part of the canvas. */
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main),
&scroll_x, &scroll_y);
- canvas_width = mts->display_main->allocation.width;
+ gtk_widget_get_allocation (mts->display_main, &allocation);
+ canvas_width = allocation.width;
/* Save the x coordinate for the timeout handler. */
mts->last_drag_x = (x < scroll_x) ? x - scroll_x
@@ -2684,6 +2749,7 @@ e_meeting_time_selector_timeout_handler (gpointer data)
gint scroll_x, max_scroll_x, scroll_y, canvas_width;
gint scroll_speed, scroll_offset;
gboolean set_both_times = FALSE;
+ GtkAllocation allocation;
mts = E_MEETING_TIME_SELECTOR (data);
@@ -2698,7 +2764,8 @@ e_meeting_time_selector_timeout_handler (gpointer data)
/* Get the x coords of visible part of the canvas. */
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main),
&scroll_x, &scroll_y);
- canvas_width = mts->display_main->allocation.width;
+ gtk_widget_get_allocation (mts->display_main, &allocation);
+ canvas_width = allocation.width;
/* Calculate the scroll delay, between 0 and MAX_SCROLL_SPEED. */
scroll_speed = abs (mts->last_drag_x / E_MEETING_TIME_SELECTOR_SCROLL_INCREMENT_WIDTH);
@@ -2870,8 +2937,9 @@ e_meeting_time_selector_update_end_date_edit (EMeetingTimeSelector *mts)
static void
e_meeting_time_selector_ensure_meeting_time_shown (EMeetingTimeSelector *mts)
{
- gint start_x, end_x, scroll_x, scroll_y, canvas_width;
+ gint start_x, end_x, scroll_x, scroll_y;
gint new_scroll_x;
+ GtkAllocation allocation;
EMeetingTime time;
/* Check if we need to change the range of dates shown. */
@@ -2895,8 +2963,8 @@ e_meeting_time_selector_ensure_meeting_time_shown (EMeetingTimeSelector *mts)
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (mts->display_main),
&scroll_x, &scroll_y);
- canvas_width = mts->display_main->allocation.width;
- if (start_x > scroll_x && end_x <= scroll_x + canvas_width)
+ gtk_widget_get_allocation (mts->display_main, &allocation);
+ if (start_x > scroll_x && end_x <= scroll_x + allocation.width)
return;
new_scroll_x = start_x;
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index d5e5093a93..a078fd140f 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -570,6 +570,7 @@ memo_table_query_tooltip (GtkWidget *widget,
FALSE, FALSE, buff, 1000);
if (buff [0]) {
+ /* Translators: This is followed by an event's start date/time */
g_string_append (tmp2, _("Start: "));
g_string_append (tmp2, buff);
}
@@ -588,6 +589,7 @@ memo_table_query_tooltip (GtkWidget *widget,
if (tmp2->len)
g_string_append (tmp2, "; ");
+ /* Translators: This is followed by an event's due date/time */
g_string_append (tmp2, _("Due: "));
g_string_append (tmp2, buff);
}
@@ -912,11 +914,7 @@ memo_table_paste_clipboard (ESelectable *selectable)
/* Paste text into a cell being edited. */
if (gtk_clipboard_wait_is_text_available (clipboard) &&
-#if GTK_CHECK_VERSION(2,19,7)
gtk_widget_has_focus (GTK_WIDGET (table_canvas)) &&
-#else
- GTK_WIDGET_HAS_FOCUS (table_canvas) &&
-#endif
E_IS_TABLE_ITEM (item) &&
E_TABLE_ITEM (item)->editing_col >= 0 &&
E_TABLE_ITEM (item)->editing_row >= 0) {
@@ -1050,7 +1048,7 @@ memo_table_class_init (EMemoTableClass *class)
PROP_MODEL,
g_param_spec_object (
"model",
- _("Model"),
+ "Model",
NULL,
E_TYPE_CAL_MODEL,
G_PARAM_READWRITE |
@@ -1067,7 +1065,7 @@ memo_table_class_init (EMemoTableClass *class)
PROP_SHELL_VIEW,
g_param_spec_object (
"shell-view",
- _("Shell View"),
+ "Shell View",
NULL,
E_TYPE_SHELL_VIEW,
G_PARAM_READWRITE |
diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c
index bb0698fa29..ddb8e72efe 100644
--- a/calendar/gui/e-select-names-renderer.c
+++ b/calendar/gui/e-select-names-renderer.c
@@ -54,11 +54,13 @@ static void
e_select_names_renderer_editing_done (GtkCellEditable *editable, ESelectNamesRenderer *cell)
{
GList *addresses = NULL, *names = NULL, *a, *n;
+ gboolean editing_canceled;
/* We don't need to listen for the focus out event any more */
g_signal_handlers_disconnect_matched (editable, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, cell);
- if (GTK_ENTRY (editable)->editing_canceled) {
+ g_object_get (editable, "editing-canceled", &editing_canceled, NULL);
+ if (editing_canceled) {
gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (cell), TRUE);
goto cleanup;
}
@@ -103,13 +105,20 @@ e_select_names_renderer_start_editing (GtkCellRenderer *cell, GdkEvent *event, G
ESelectNamesRenderer *sn_cell = E_SELECT_NAMES_RENDERER (cell);
GtkCellRendererText *text_cell = GTK_CELL_RENDERER_TEXT (cell);
ESelectNamesEditable *editable;
+ gboolean is_editable;
+ gfloat xalign;
- if (!text_cell->editable)
+ g_object_get (
+ text_cell,
+ "editable", &is_editable,
+ "xalign", &xalign, NULL);
+
+ if (!is_editable)
return NULL;
editable = E_SELECT_NAMES_EDITABLE (e_select_names_editable_new ());
gtk_entry_set_has_frame (GTK_ENTRY (editable), FALSE);
- gtk_entry_set_alignment (GTK_ENTRY (editable), cell->xalign);
+ gtk_entry_set_alignment (GTK_ENTRY (editable), xalign);
if (sn_cell->priv->email && *sn_cell->priv->email)
e_select_names_editable_set_address (editable, sn_cell->priv->name, sn_cell->priv->email);
gtk_widget_show (GTK_WIDGET (editable));
diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c
index c71eeeeb04..98d422aa16 100644
--- a/calendar/gui/e-task-table.c
+++ b/calendar/gui/e-task-table.c
@@ -412,6 +412,7 @@ task_table_constructed (GObject *object)
GList *strings;
AtkObject *a11y;
gchar *etspecfile;
+ gint percent;
task_table = E_TASK_TABLE (object);
model = e_task_table_get_model (task_table);
@@ -488,6 +489,7 @@ task_table_constructed (GObject *object)
strings = g_list_append (strings, (gchar *) _("Confidential"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
+ g_list_free (strings);
e_table_extras_add_cell (extras, "classification", popup_cell);
@@ -511,6 +513,7 @@ task_table_constructed (GObject *object)
strings = g_list_append (strings, (gchar *) _("Undefined"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
+ g_list_free (strings);
e_table_extras_add_cell (extras, "priority", popup_cell);
@@ -527,20 +530,19 @@ task_table_constructed (GObject *object)
g_object_unref (cell);
strings = NULL;
- strings = g_list_append (strings, (gchar *) _("0%"));
- strings = g_list_append (strings, (gchar *) _("10%"));
- strings = g_list_append (strings, (gchar *) _("20%"));
- strings = g_list_append (strings, (gchar *) _("30%"));
- strings = g_list_append (strings, (gchar *) _("40%"));
- strings = g_list_append (strings, (gchar *) _("50%"));
- strings = g_list_append (strings, (gchar *) _("60%"));
- strings = g_list_append (strings, (gchar *) _("70%"));
- strings = g_list_append (strings, (gchar *) _("80%"));
- strings = g_list_append (strings, (gchar *) _("90%"));
- strings = g_list_append (strings, (gchar *) _("100%"));
+ for (percent = 0; percent <= 100; percent += 10) {
+ /* Translators: "%d%%" is the percentage of a task done.
+ %d is the actual value, %% is replaced with a percent sign.
+ Result values will be 0%, 10%, 20%, ... 100%
+ */
+ strings = g_list_append (strings, g_strdup_printf (_("%d%%"), percent));
+ }
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
+ g_list_foreach (strings, (GFunc) g_free, NULL);
+ g_list_free (strings);
+
e_table_extras_add_cell (extras, "percent", popup_cell);
/* Transparency field. */
@@ -561,6 +563,7 @@ task_table_constructed (GObject *object)
strings = g_list_append (strings, (gchar *) _("Busy"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
+ g_list_free (strings);
e_table_extras_add_cell (extras, "transparency", popup_cell);
@@ -584,6 +587,7 @@ task_table_constructed (GObject *object)
strings = g_list_append (strings, (gchar *) _("Canceled"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
+ g_list_free (strings);
e_table_extras_add_cell (extras, "calstatus", popup_cell);
@@ -1133,11 +1137,7 @@ task_table_paste_clipboard (ESelectable *selectable)
/* Paste text into a cell being edited. */
if (gtk_clipboard_wait_is_text_available (clipboard) &&
-#if GTK_CHECK_VERSION(2,19,7)
gtk_widget_has_focus (GTK_WIDGET (table_canvas)) &&
-#else
- GTK_WIDGET_HAS_FOCUS (table_canvas) &&
-#endif
E_IS_TABLE_ITEM (item) &&
E_TABLE_ITEM (item)->editing_col >= 0 &&
E_TABLE_ITEM (item)->editing_row >= 0) {
@@ -1349,7 +1349,7 @@ task_table_class_init (ETaskTableClass *class)
PROP_MODEL,
g_param_spec_object (
"model",
- _("Model"),
+ "Model",
NULL,
E_TYPE_CAL_MODEL,
G_PARAM_READWRITE |
@@ -1366,7 +1366,7 @@ task_table_class_init (ETaskTableClass *class)
PROP_SHELL_VIEW,
g_param_spec_object (
"shell-view",
- _("Shell View"),
+ "Shell View",
NULL,
E_TYPE_SHELL_VIEW,
G_PARAM_READWRITE |
diff --git a/calendar/gui/e-timezone-entry.c b/calendar/gui/e-timezone-entry.c
index 309661a2db..c281a4aedf 100644
--- a/calendar/gui/e-timezone-entry.c
+++ b/calendar/gui/e-timezone-entry.c
@@ -236,44 +236,20 @@ timezone_entry_focus (GtkWidget *widget,
priv = E_TIMEZONE_ENTRY_GET_PRIVATE (widget);
if (direction == GTK_DIR_TAB_FORWARD) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (priv->entry))
-#else
- if (GTK_WIDGET_HAS_FOCUS (priv->entry))
-#endif
gtk_widget_grab_focus (priv->button);
-#if GTK_CHECK_VERSION(2,19,7)
else if (gtk_widget_has_focus (priv->button))
-#else
- else if (GTK_WIDGET_HAS_FOCUS (priv->button))
-#endif
return FALSE;
-#if GTK_CHECK_VERSION(2,19,7)
else if (gtk_widget_get_visible (priv->entry))
-#else
- else if (GTK_WIDGET_VISIBLE (priv->entry))
-#endif
gtk_widget_grab_focus (priv->entry);
else
gtk_widget_grab_focus (priv->button);
} else if (direction == GTK_DIR_TAB_BACKWARD) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (priv->entry))
-#else
- if (GTK_WIDGET_HAS_FOCUS (priv->entry))
-#endif
return FALSE;
-#if GTK_CHECK_VERSION(2,19,7)
else if (gtk_widget_has_focus (priv->button)) {
-#else
- else if (GTK_WIDGET_HAS_FOCUS (priv->button)) {
-#endif
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_get_visible (priv->entry))
-#else
- if (GTK_WIDGET_VISIBLE (priv->entry))
-#endif
gtk_widget_grab_focus (priv->entry);
else
return FALSE;
@@ -328,7 +304,7 @@ e_timezone_entry_init (ETimezoneEntry *timezone_entry)
timezone_entry->priv = E_TIMEZONE_ENTRY_GET_PRIVATE (timezone_entry);
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (timezone_entry), GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (GTK_WIDGET (timezone_entry), TRUE);
widget = gtk_entry_new ();
gtk_editable_set_editable (GTK_EDITABLE (widget), FALSE);
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 90d8831747..ba44b7a24a 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -87,11 +87,14 @@ week_view_event_item_get_position (EWeekViewEventItem *event_item,
{
EWeekView *week_view;
GnomeCanvasItem *item;
+ GtkWidget *parent;
item = GNOME_CANVAS_ITEM (event_item);
- week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent);
- g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), E_CALENDAR_VIEW_POS_NONE);
+ parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas));
+ g_return_val_if_fail (E_IS_WEEK_VIEW (parent), E_CALENDAR_VIEW_POS_NONE);
+
+ week_view = E_WEEK_VIEW (parent);
if (x < item->x1 + E_WEEK_VIEW_EVENT_L_PAD
|| x >= item->x2 - E_WEEK_VIEW_EVENT_R_PAD)
@@ -120,19 +123,31 @@ week_view_event_item_double_click (EWeekViewEventItem *event_item,
EWeekView *week_view;
EWeekViewEvent *event;
GnomeCanvasItem *item;
+ GtkWidget *parent;
item = GNOME_CANVAS_ITEM (event_item);
- week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent);
- g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE);
+ parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas));
+ g_return_val_if_fail (E_IS_WEEK_VIEW (parent), FALSE);
+
+ week_view = E_WEEK_VIEW (parent);
+
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return TRUE;
event = &g_array_index (
week_view->events, EWeekViewEvent,
event_item->priv->event_num);
+ if (!is_comp_data_valid (event))
+ return TRUE;
+
if (week_view->editing_event_num >= 0) {
EWeekViewEvent *editing;
+ if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+ return TRUE;
+
editing = &g_array_index (
week_view->events, EWeekViewEvent,
week_view->editing_event_num);
@@ -141,6 +156,7 @@ week_view_event_item_double_click (EWeekViewEventItem *event_item,
* on the component, which is not on the server. */
if (editing && event &&
editing->comp_data == event->comp_data &&
+ is_comp_data_valid (editing) &&
(!event->comp_data ||
!is_icalcomp_on_the_server (
event->comp_data->icalcomp,
@@ -167,14 +183,24 @@ week_view_event_item_button_press (EWeekViewEventItem *event_item,
EWeekViewEvent *event;
EWeekViewEventSpan *span;
GnomeCanvasItem *item;
+ GtkWidget *parent;
item = GNOME_CANVAS_ITEM (event_item);
- week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent);
- g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE);
+ parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas));
+ g_return_val_if_fail (E_IS_WEEK_VIEW (parent), FALSE);
+
+ week_view = E_WEEK_VIEW (parent);
+
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return FALSE;
event = &g_array_index (week_view->events, EWeekViewEvent,
event_item->priv->event_num);
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + event_item->priv->span_num))
+ return FALSE;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + event_item->priv->span_num);
@@ -201,11 +227,7 @@ week_view_event_item_button_press (EWeekViewEventItem *event_item,
return TRUE;
} else if (bevent->button.button == 3) {
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (week_view))) {
-#else
- if (!GTK_WIDGET_HAS_FOCUS (week_view)) {
-#endif
gtk_widget_grab_focus (GTK_WIDGET (week_view));
if (week_view->event_destroyed) {
week_view->event_destroyed = FALSE;
@@ -235,11 +257,14 @@ week_view_event_item_button_release (EWeekViewEventItem *event_item,
{
EWeekView *week_view;
GnomeCanvasItem *item;
+ GtkWidget *parent;
item = GNOME_CANVAS_ITEM (event_item);
- week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent);
- g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE);
+ parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas));
+ g_return_val_if_fail (E_IS_WEEK_VIEW (parent), FALSE);
+
+ week_view = E_WEEK_VIEW (parent);
if (week_view->pressed_event_num != -1
&& week_view->pressed_event_num == event_item->priv->event_num
@@ -368,6 +393,8 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
EWeekView *week_view;
EWeekViewEvent *event;
ECalComponent *comp;
+ GnomeCanvas *canvas;
+ GtkWidget *parent;
GdkGC *gc;
gint num_icons = 0, icon_x_inc;
gboolean draw_reminder_icon = FALSE, draw_recurrence_icon = FALSE;
@@ -376,10 +403,19 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
GSList *categories_pixbufs = NULL, *pixbufs;
cairo_t *cr;
- week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (event_item)->canvas)->parent);
+ canvas = GNOME_CANVAS_ITEM (event_item)->canvas;
+ parent = gtk_widget_get_parent (GTK_WIDGET (canvas));
+ week_view = E_WEEK_VIEW (parent);
+
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return;
event = &g_array_index (week_view->events, EWeekViewEvent,
event_item->priv->event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
+
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (
comp, icalcomponent_new_clone (event->comp_data->icalcomp));
@@ -484,6 +520,8 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item,
ECalModel *model;
EWeekView *week_view;
EWeekViewEvent *event;
+ GnomeCanvas *canvas;
+ GtkWidget *parent;
GdkPoint points[3];
const gchar *color_spec;
gint c1, c2;
@@ -492,11 +530,19 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item,
if (!can_draw_in_region (draw_region, x, y, w, h))
return;
- week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (event_item)->canvas)->parent);
+ canvas = GNOME_CANVAS_ITEM (event_item)->canvas;
+ parent = gtk_widget_get_parent (GTK_WIDGET (canvas));
+ week_view = E_WEEK_VIEW (parent);
+
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return;
event = &g_array_index (week_view->events, EWeekViewEvent,
event_item->priv->event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
cr = gdk_cairo_create (drawable);
points[0].x = x;
@@ -621,12 +667,15 @@ week_view_event_item_update (GnomeCanvasItem *item,
GnomeCanvasItemClass *canvas_item_class;
EWeekViewEventItem *event_item;
EWeekView *week_view;
+ GtkWidget *parent;
gint event_num, span_num;
gint span_x, span_y, span_w;
event_item = E_WEEK_VIEW_EVENT_ITEM (item);
- week_view = E_WEEK_VIEW (GTK_WIDGET (item->canvas)->parent);
- g_return_if_fail (E_IS_WEEK_VIEW (week_view));
+ parent = gtk_widget_get_parent (GTK_WIDGET (item->canvas));
+ g_return_if_fail (E_IS_WEEK_VIEW (parent));
+
+ week_view = E_WEEK_VIEW (parent);
/* Chain up to parent's update() method. */
canvas_item_class = GNOME_CANVAS_ITEM_CLASS (parent_class);
@@ -666,6 +715,7 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
EWeekViewEventSpan *span;
ECalModel *model;
GdkGC *gc;
+ GtkWidget *parent;
gint x1, y1, x2, y2, time_x, time_y;
gint icon_x, icon_y, time_width, min_end_time_x, max_icon_x;
gint rect_x, rect_w, rect_x2 = 0;
@@ -686,21 +736,32 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item,
const gchar *color_spec;
event_item = E_WEEK_VIEW_EVENT_ITEM (canvas_item);
- week_view = E_WEEK_VIEW (GTK_WIDGET (canvas_item->canvas)->parent);
- g_return_if_fail (E_IS_WEEK_VIEW (week_view));
+ parent = gtk_widget_get_parent (GTK_WIDGET (canvas_item->canvas));
+ g_return_if_fail (E_IS_WEEK_VIEW (parent));
+
+ week_view = E_WEEK_VIEW (parent);
if (event_item->priv->event_num == -1 || event_item->priv->span_num == -1)
return;
g_return_if_fail (event_item->priv->event_num < week_view->events->len);
+ if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
+ return;
+
event = &g_array_index (week_view->events, EWeekViewEvent,
event_item->priv->event_num);
+ if (!is_comp_data_valid (event))
+ return;
+
g_return_if_fail (
event->spans_index + event_item->priv->span_num <
week_view->spans->len);
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + event_item->priv->span_num))
+ return;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + event_item->priv->span_num);
diff --git a/calendar/gui/e-week-view-main-item.c b/calendar/gui/e-week-view-main-item.c
index eb8de3af9a..3522790401 100644
--- a/calendar/gui/e-week-view-main-item.c
+++ b/calendar/gui/e-week-view-main-item.c
@@ -169,11 +169,7 @@ week_view_main_item_draw_day (EWeekViewMainItem *main_item,
|| week_view->selection_end_day < day)
selected = FALSE;
if (selected) {
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (GTK_WIDGET (week_view))) {
-#else
- if (GTK_WIDGET_HAS_FOCUS (week_view)) {
-#endif
gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_SELECTED]);
} else {
gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_SELECTED]);
diff --git a/calendar/gui/e-week-view-titles-item.c b/calendar/gui/e-week-view-titles-item.c
index f2d90e7150..ab7a9db652 100644
--- a/calendar/gui/e-week-view-titles-item.c
+++ b/calendar/gui/e-week-view-titles-item.c
@@ -126,9 +126,10 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item,
EWeekView *week_view;
GtkStyle *style;
GdkGC *fg_gc, *light_gc, *dark_gc;
- gint canvas_width, canvas_height, col_width, col, date_width, date_x;
+ gint col_width, col, date_width, date_x;
gchar buffer[128];
GdkRectangle clip_rect;
+ GtkAllocation allocation;
gboolean abbreviated;
gint weekday;
PangoLayout *layout;
@@ -137,28 +138,29 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item,
week_view = e_week_view_titles_item_get_week_view (titles_item);
g_return_if_fail (week_view != NULL);
+ gtk_widget_get_allocation (
+ GTK_WIDGET (canvas_item->canvas), &allocation);
+
style = gtk_widget_get_style (GTK_WIDGET (week_view));
fg_gc = style->fg_gc[GTK_STATE_NORMAL];
light_gc = style->light_gc[GTK_STATE_NORMAL];
dark_gc = style->dark_gc[GTK_STATE_NORMAL];
- canvas_width = GTK_WIDGET (canvas_item->canvas)->allocation.width;
- canvas_height = GTK_WIDGET (canvas_item->canvas)->allocation.height;
layout = gtk_widget_create_pango_layout (GTK_WIDGET (week_view), NULL);
/* Draw the shadow around the dates. */
gdk_draw_line (drawable, light_gc,
1 - x, 1 - y,
- canvas_width - 2 - x, 1 - y);
+ allocation.width - 2 - x, 1 - y);
gdk_draw_line (drawable, light_gc,
1 - x, 2 - y,
- 1 - x, canvas_height - 1 - y);
+ 1 - x, allocation.height - 1 - y);
gdk_draw_rectangle (drawable, dark_gc, FALSE,
0 - x, 0 - y,
- canvas_width - 1, canvas_height);
+ allocation.width - 1, allocation.height);
/* Determine the format to use. */
- col_width = canvas_width / week_view->columns;
+ col_width = allocation.width / week_view->columns;
abbreviated = (week_view->max_day_width + 2 >= col_width);
/* Shift right one pixel to account for the shadow around the main
@@ -182,7 +184,7 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item,
clip_rect.x = week_view->col_offsets[col] - x;
clip_rect.y = 2 - y;
clip_rect.width = week_view->col_widths[col];
- clip_rect.height = canvas_height - 2;
+ clip_rect.height = allocation.height - 2;
gdk_gc_set_clip_rectangle (fg_gc, &clip_rect);
if (weekday == 5 && week_view->compress_weekend)
@@ -212,22 +214,22 @@ week_view_titles_item_draw (GnomeCanvasItem *canvas_item,
week_view->col_offsets[col] - x,
4 - y,
week_view->col_offsets[col] - x,
- canvas_height - 4 - y);
+ allocation.height - 4 - y);
gdk_draw_line (drawable, dark_gc,
week_view->col_offsets[col] - 1 - x,
4 - y,
week_view->col_offsets[col] - 1 - x,
- canvas_height - 4 - y);
+ allocation.height - 4 - y);
}
/* Draw the lines between each column. */
if (col != 0) {
gdk_draw_line (drawable, style->black_gc,
week_view->col_offsets[col] - x,
- canvas_height - y,
+ allocation.height - y,
week_view->col_offsets[col] - x,
- canvas_height - y);
+ allocation.height - y);
}
if (weekday == 5 && week_view->compress_weekend)
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 696113987b..accafd9ac2 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -405,8 +405,14 @@ week_view_time_range_changed_cb (EWeekView *week_view,
/* Reset the adjustment value to 0 if the base address has changed.
Note that we do this after updating first_day_shown so that our
signal handler will not try to reload the events. */
- if (update_adjustment_value)
- gtk_adjustment_set_value (GTK_RANGE (week_view->vscrollbar)->adjustment, 0);
+ if (update_adjustment_value) {
+ GtkRange *range;
+ GtkAdjustment *adjustment;
+
+ range = GTK_RANGE (week_view->vscrollbar);
+ adjustment = gtk_range_get_adjustment (range);
+ gtk_adjustment_set_value (adjustment, 0);
+ }
if (!E_CALENDAR_VIEW (week_view)->in_focus) {
e_week_view_free_events (week_view);
@@ -524,6 +530,9 @@ week_view_constructed (GObject *object)
ECalModel *model;
ECalendarView *calendar_view;
+ /* Chain up to parent's constructed() method. */
+ G_OBJECT_CLASS (e_week_view_parent_class)->constructed (object);
+
calendar_view = E_CALENDAR_VIEW (object);
model = e_calendar_view_get_model (calendar_view);
@@ -687,7 +696,7 @@ e_week_view_init (EWeekView *week_view)
GdkPixbuf *pixbuf;
gint i;
- GTK_WIDGET_SET_FLAGS (week_view, GTK_CAN_FOCUS);
+ gtk_widget_set_can_focus (GTK_WIDGET (week_view), TRUE);
week_view->query = NULL;
week_view->event_destroyed = FALSE;
@@ -894,12 +903,14 @@ e_week_view_realize (GtkWidget *widget)
{
EWeekView *week_view;
GdkColormap *colormap;
+ GdkWindow *window;
if (GTK_WIDGET_CLASS (e_week_view_parent_class)->realize)
(*GTK_WIDGET_CLASS (e_week_view_parent_class)->realize)(widget);
week_view = E_WEEK_VIEW (widget);
- week_view->main_gc = gdk_gc_new (widget->window);
+ window = gtk_widget_get_window (widget);
+ week_view->main_gc = gdk_gc_new (window);
colormap = gtk_widget_get_colormap (widget);
@@ -940,17 +951,21 @@ color_inc (GdkColor c, gint amount)
static void
e_week_view_set_colors(EWeekView *week_view, GtkWidget *widget)
{
- week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS] = widget->style->base[GTK_STATE_INSENSITIVE];
- week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS] = widget->style->base[GTK_STATE_NORMAL];
- week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND] = widget->style->base[GTK_STATE_NORMAL];
- week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER] = widget->style->dark[GTK_STATE_NORMAL];
- week_view->colors[E_WEEK_VIEW_COLOR_EVENT_TEXT] = widget->style->text[GTK_STATE_NORMAL];
- week_view->colors[E_WEEK_VIEW_COLOR_GRID] = widget->style->dark[GTK_STATE_NORMAL];
- week_view->colors[E_WEEK_VIEW_COLOR_SELECTED] = widget->style->base[GTK_STATE_SELECTED];
- week_view->colors[E_WEEK_VIEW_COLOR_SELECTED_UNFOCUSSED] = widget->style->bg[GTK_STATE_SELECTED];
- week_view->colors[E_WEEK_VIEW_COLOR_DATES] = widget->style->text[GTK_STATE_NORMAL];
- week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED] = widget->style->text[GTK_STATE_SELECTED];
- week_view->colors[E_WEEK_VIEW_COLOR_TODAY] = widget->style->base[GTK_STATE_SELECTED];
+ GtkStyle *style;
+
+ style = gtk_widget_get_style (widget);
+
+ week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS] = style->base[GTK_STATE_INSENSITIVE];
+ week_view->colors[E_WEEK_VIEW_COLOR_ODD_MONTHS] = style->base[GTK_STATE_NORMAL];
+ week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND] = style->base[GTK_STATE_NORMAL];
+ week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER] = style->dark[GTK_STATE_NORMAL];
+ week_view->colors[E_WEEK_VIEW_COLOR_EVENT_TEXT] = style->text[GTK_STATE_NORMAL];
+ week_view->colors[E_WEEK_VIEW_COLOR_GRID] = style->dark[GTK_STATE_NORMAL];
+ week_view->colors[E_WEEK_VIEW_COLOR_SELECTED] = style->base[GTK_STATE_SELECTED];
+ week_view->colors[E_WEEK_VIEW_COLOR_SELECTED_UNFOCUSSED] = style->bg[GTK_STATE_SELECTED];
+ week_view->colors[E_WEEK_VIEW_COLOR_DATES] = style->text[GTK_STATE_NORMAL];
+ week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED] = style->text[GTK_STATE_SELECTED];
+ week_view->colors[E_WEEK_VIEW_COLOR_TODAY] = style->base[GTK_STATE_SELECTED];
week_view->colors[E_WEEK_VIEW_COLOR_TODAY_BACKGROUND] = get_today_background (week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND]);
week_view->colors[E_WEEK_VIEW_COLOR_MONTH_NONWORKING_DAY] = color_inc (week_view->colors[E_WEEK_VIEW_COLOR_EVEN_MONTHS], -0x0A0A);
}
@@ -1021,6 +1036,7 @@ get_digit_width (PangoLayout *layout)
static GdkColor
e_week_view_get_text_color (EWeekView *week_view, EWeekViewEvent *event, GtkWidget *widget)
{
+ GtkStyle *style;
GdkColor bg_color;
guint16 red, green, blue;
gdouble cc = 65535.0;
@@ -1029,7 +1045,7 @@ e_week_view_get_text_color (EWeekView *week_view, EWeekViewEvent *event, GtkWidg
green = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].green;
blue = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].blue;
- if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), event->comp_data),
+ if (is_comp_data_valid (event) && gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), event->comp_data),
&bg_color)) {
GdkColormap *colormap;
colormap = gtk_widget_get_colormap (GTK_WIDGET (week_view));
@@ -1040,10 +1056,12 @@ e_week_view_get_text_color (EWeekView *week_view, EWeekViewEvent *event, GtkWidg
}
}
+ style = gtk_widget_get_style (widget);
+
if ((red/cc > 0.7) || (green/cc > 0.7) || (blue/cc > 0.7 ))
- return widget->style->black;
+ return style->black;
else
- return widget->style->white;
+ return style->white;
}
static void
@@ -1075,9 +1093,10 @@ e_week_view_style_set (GtkWidget *widget,
span = &g_array_index (week_view->spans,
EWeekViewEventSpan, span_num);
if (span->text_item) {
- gnome_canvas_item_set (span->text_item,
- "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL],
- NULL);
+ gnome_canvas_item_set (
+ span->text_item,
+ "fill_color_gdk", &style->text[GTK_STATE_NORMAL],
+ NULL);
}
}
}
@@ -1169,6 +1188,7 @@ static void
e_week_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
EWeekView *week_view;
+ GtkAllocation canvas_allocation;
gdouble old_x2, old_y2, new_x2, new_y2;
week_view = E_WEEK_VIEW (widget);
@@ -1178,23 +1198,31 @@ e_week_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
e_week_view_recalc_cell_sizes (week_view);
/* Set the scroll region of the top canvas to its allocated size. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (week_view->titles_canvas),
- NULL, NULL, &old_x2, &old_y2);
- new_x2 = week_view->titles_canvas->allocation.width - 1;
- new_y2 = week_view->titles_canvas->allocation.height - 1;
+ gnome_canvas_get_scroll_region (
+ GNOME_CANVAS (week_view->titles_canvas),
+ NULL, NULL, &old_x2, &old_y2);
+ gtk_widget_get_allocation (
+ week_view->titles_canvas, &canvas_allocation);
+ new_x2 = canvas_allocation.width - 1;
+ new_y2 = canvas_allocation.height - 1;
if (old_x2 != new_x2 || old_y2 != new_y2)
- gnome_canvas_set_scroll_region (GNOME_CANVAS (week_view->titles_canvas),
- 0, 0, new_x2, new_y2);
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (week_view->titles_canvas),
+ 0, 0, new_x2, new_y2);
/* Set the scroll region of the main canvas to its allocated width,
but with the height depending on the number of rows needed. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (week_view->main_canvas),
- NULL, NULL, &old_x2, &old_y2);
- new_x2 = week_view->main_canvas->allocation.width - 1;
- new_y2 = week_view->main_canvas->allocation.height - 1;
+ gnome_canvas_get_scroll_region (
+ GNOME_CANVAS (week_view->main_canvas),
+ NULL, NULL, &old_x2, &old_y2);
+ gtk_widget_get_allocation (
+ week_view->main_canvas, &canvas_allocation);
+ new_x2 = canvas_allocation.width - 1;
+ new_y2 = canvas_allocation.height - 1;
if (old_x2 != new_x2 || old_y2 != new_y2)
- gnome_canvas_set_scroll_region (GNOME_CANVAS (week_view->main_canvas),
- 0, 0, new_x2, new_y2);
+ gnome_canvas_set_scroll_region (
+ GNOME_CANVAS (week_view->main_canvas),
+ 0, 0, new_x2, new_y2);
/* Flag that we need to reshape the events. */
if (old_x2 != new_x2 || old_y2 != new_y2) {
@@ -1208,6 +1236,7 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view)
{
gfloat canvas_width, canvas_height, offset;
gint row, col;
+ GtkAllocation allocation;
GtkWidget *widget;
GtkStyle *style;
gint width, height, time_width;
@@ -1223,12 +1252,14 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view)
week_view->columns = 2;
}
+ gtk_widget_get_allocation (week_view->main_canvas, &allocation);
+
/* Calculate the column sizes, using floating point so that pixels
get divided evenly. Note that we use one more element than the
number of columns, to make it easy to get the column widths.
We also add one to the width so that the right border of the last
column is off the edge of the displayed area. */
- canvas_width = week_view->main_canvas->allocation.width + 1;
+ canvas_width = allocation.width + 1;
canvas_width /= week_view->columns;
offset = 0;
for (col = 0; col <= week_view->columns; col++) {
@@ -1243,7 +1274,7 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view)
}
/* Now do the same for the row heights. */
- canvas_height = week_view->main_canvas->allocation.height + 1;
+ canvas_height = allocation.height + 1;
canvas_height /= week_view->rows;
offset = 0;
for (row = 0; row <= week_view->rows; row++) {
@@ -1491,9 +1522,16 @@ e_week_view_focus (GtkWidget *widget, GtkDirectionType direction)
EWeekViewEventSpan *span;
gint current_day;
+ if (!is_array_index_in_bounds (week_view->events, new_event_num))
+ break;
+
event = &g_array_index (week_view->events,
EWeekViewEvent,
new_event_num);
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + new_span_num))
+ break;
+
span = &g_array_index (week_view->spans,
EWeekViewEventSpan,
event->spans_index + new_span_num);
@@ -1523,9 +1561,15 @@ e_week_view_get_selected_events (ECalendarView *cal_view)
g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), NULL);
if (week_view->editing_event_num != -1) {
+ if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+ return NULL;
+
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->editing_event_num);
} else if (week_view->popup_event_num != -1) {
+ if (!is_array_index_in_bounds (week_view->events, week_view->popup_event_num))
+ return NULL;
+
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->popup_event_num);
}
@@ -1565,22 +1609,25 @@ e_week_view_update_query (EWeekView *week_view)
static void
e_week_view_draw_shadow (EWeekView *week_view)
{
+ GtkAllocation allocation;
gint x1, y1, x2, y2;
GtkStyle *style;
GdkGC *light_gc, *dark_gc;
GdkWindow *window;
+ gtk_widget_get_allocation (week_view->main_canvas, &allocation);
+
/* Draw the shadow around the graphical displays. */
- x1 = week_view->main_canvas->allocation.x - 1;
- y1 = week_view->main_canvas->allocation.y - 1;
- x2 = x1 + week_view->main_canvas->allocation.width + 2;
- y2 = y1 + week_view->main_canvas->allocation.height + 2;
+ x1 = allocation.x - 1;
+ y1 = allocation.y - 1;
+ x2 = x1 + allocation.width + 2;
+ y2 = y1 + allocation.height + 2;
- style = GTK_WIDGET (week_view)->style;
+ style = gtk_widget_get_style (GTK_WIDGET (week_view));
dark_gc = style->dark_gc[GTK_STATE_NORMAL];
light_gc = style->light_gc[GTK_STATE_NORMAL];
- window = GTK_WIDGET (week_view)->window;
+ window = gtk_widget_get_window (GTK_WIDGET (week_view));
gdk_draw_line (window, dark_gc, x1, y1, x1, y2);
gdk_draw_line (window, dark_gc, x1, y1, x2, y1);
gdk_draw_line (window, light_gc, x2, y1, x2, y2);
@@ -1634,8 +1681,14 @@ e_week_view_set_selected_time_range (ECalendarView *cal_view,
/* Reset the adjustment value to 0 if the base address has changed.
Note that we do this after updating first_day_shown so that our
signal handler will not try to reload the events. */
- if (update_adjustment_value)
- gtk_adjustment_set_value (GTK_RANGE (week_view->vscrollbar)->adjustment, 0);
+ if (update_adjustment_value) {
+ GtkRange *range;
+ GtkAdjustment *adjustment;
+
+ range = GTK_RANGE (week_view->vscrollbar);
+ adjustment = gtk_range_get_adjustment (range);
+ gtk_adjustment_set_value (adjustment, 0);
+ }
gtk_widget_queue_draw (week_view->main_canvas);
}
@@ -1813,8 +1866,14 @@ e_week_view_set_first_day_shown (EWeekView *week_view,
/* Reset the adjustment value to 0 if the base address has changed.
Note that we do this after updating first_day_shown so that our
signal handler will not try to reload the events. */
- if (update_adjustment_value)
- gtk_adjustment_set_value (GTK_RANGE (week_view->vscrollbar)->adjustment, 0);
+ if (update_adjustment_value) {
+ GtkRange *range;
+ GtkAdjustment *adjustment;
+
+ range = GTK_RANGE (week_view->vscrollbar);
+ adjustment = gtk_range_get_adjustment (range);
+ gtk_adjustment_set_value (adjustment, 0);
+ }
e_week_view_update_query (week_view);
gtk_widget_queue_draw (week_view->main_canvas);
@@ -1865,6 +1924,7 @@ void
e_week_view_set_multi_week_view (EWeekView *week_view,
gboolean multi_week_view)
{
+ GtkRange *range;
GtkAdjustment *adjustment;
gint page_increment, page_size;
@@ -1899,10 +1959,10 @@ e_week_view_set_multi_week_view (EWeekView *week_view,
}
}
- adjustment = GTK_RANGE (week_view->vscrollbar)->adjustment;
- adjustment->page_increment = page_increment;
- adjustment->page_size = page_size;
- gtk_adjustment_changed (adjustment);
+ range = GTK_RANGE (week_view->vscrollbar);
+ adjustment = gtk_range_get_adjustment (range);
+ gtk_adjustment_set_page_increment (adjustment, page_increment);
+ gtk_adjustment_set_page_size (adjustment, page_size);
e_week_view_recalc_cell_sizes (week_view);
@@ -1939,6 +1999,7 @@ void
e_week_view_set_weeks_shown (EWeekView *week_view,
gint weeks_shown)
{
+ GtkRange *range;
GtkAdjustment *adjustment;
gint page_increment, page_size;
@@ -1960,10 +2021,10 @@ e_week_view_set_weeks_shown (EWeekView *week_view,
page_size = 5;
}
- adjustment = GTK_RANGE (week_view->vscrollbar)->adjustment;
- adjustment->page_increment = page_increment;
- adjustment->page_size = page_size;
- gtk_adjustment_changed (adjustment);
+ range = GTK_RANGE (week_view->vscrollbar);
+ adjustment = gtk_range_get_adjustment (range);
+ gtk_adjustment_set_page_increment (adjustment, page_increment);
+ gtk_adjustment_set_page_size (adjustment, page_size);
e_week_view_recalc_cell_sizes (week_view);
@@ -2083,6 +2144,9 @@ set_text_as_bold (EWeekViewEvent *event, EWeekViewEventSpan *span)
gchar *address;
ECalComponentAttendee *at = NULL;
+ if (!is_comp_data_valid (event))
+ return;
+
comp = e_cal_component_new ();
e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
address = itip_get_comp_attendee (comp, event->comp_data->client);
@@ -2128,6 +2192,9 @@ e_week_view_foreach_event_with_uid (EWeekView *week_view,
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ continue;
+
u = icalcomponent_get_uid (event->comp_data->icalcomp);
if (u && !strcmp (uid, u)) {
if (!(*callback) (week_view, event_num, data))
@@ -2145,6 +2212,9 @@ e_week_view_remove_event_cb (EWeekView *week_view,
EWeekViewEventSpan *span;
gint span_num;
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return TRUE;
+
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
if (!event)
return TRUE;
@@ -2157,13 +2227,17 @@ e_week_view_remove_event_cb (EWeekView *week_view,
if (week_view->popup_event_num == event_num)
week_view->popup_event_num = -1;
- g_object_unref (event->comp_data);
+ if (is_comp_data_valid (event))
+ g_object_unref (event->comp_data);
event->comp_data = NULL;
if (week_view->spans) {
/* We leave the span elements in the array, but set the canvas item
pointers to NULL. */
for (span_num = 0; span_num < event->num_spans; span_num++) {
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+ break;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
@@ -2261,6 +2335,9 @@ e_week_view_get_span_position (EWeekView *week_view,
g_return_val_if_fail (span_num < event->num_spans, FALSE);
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+ return FALSE;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
@@ -2303,7 +2380,14 @@ ewv_pass_gdkevent_to_etext (EWeekView *week_view, GdkEvent *gevent)
EWeekViewEvent *event;
EWeekViewEventSpan *span;
+ if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+ return FALSE;
+
event = &g_array_index (week_view->events, EWeekViewEvent, week_view->editing_event_num);
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + week_view->editing_span_num))
+ return FALSE;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + week_view->editing_span_num);
if (span->text_item && E_IS_TEXT (span->text_item)) {
@@ -2356,15 +2440,15 @@ e_week_view_on_button_press (GtkWidget *widget,
}
if (event->button == 1) {
+ GdkWindow *window;
+
/* Start the selection drag. */
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (week_view)) && !gtk_widget_has_focus (GTK_WIDGET (week_view->main_canvas)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (week_view) && !GTK_WIDGET_HAS_FOCUS (week_view->main_canvas))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (week_view));
- if (gdk_pointer_grab (GTK_LAYOUT (widget)->bin_window, FALSE,
+ window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
+
+ if (gdk_pointer_grab (window, FALSE,
GDK_POINTER_MOTION_MASK
| GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time) == 0) {
@@ -2380,11 +2464,7 @@ e_week_view_on_button_press (GtkWidget *widget,
gtk_widget_queue_draw (week_view->main_canvas);
}
} else if (event->button == 3) {
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (week_view)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (week_view))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (week_view));
if (day < week_view->selection_start_day || day > week_view->selection_end_day) {
@@ -2426,8 +2506,14 @@ e_week_view_on_scroll (GtkWidget *widget,
GdkEventScroll *scroll,
EWeekView *week_view)
{
- GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment;
- gfloat new_value;
+ GtkRange *range;
+ GtkAdjustment *adjustment;
+ gdouble page_increment;
+ gdouble new_value;
+ gdouble page_size;
+ gdouble lower;
+ gdouble upper;
+ gdouble value;
GtkWidget *tool_window = g_object_get_data (G_OBJECT (week_view), "tooltip-window");
guint timeout;
@@ -2442,19 +2528,28 @@ e_week_view_on_scroll (GtkWidget *widget,
g_object_set_data (G_OBJECT (week_view), "tooltip-window", NULL);
}
+ range = GTK_RANGE (week_view->vscrollbar);
+ adjustment = gtk_range_get_adjustment (range);
+
+ page_increment = gtk_adjustment_get_page_increment (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
+
switch (scroll->direction) {
- case GDK_SCROLL_UP:
- new_value = adj->value - adj->page_increment;
- break;
- case GDK_SCROLL_DOWN:
- new_value = adj->value + adj->page_increment;
- break;
- default:
- return FALSE;
+ case GDK_SCROLL_UP:
+ new_value = value - page_increment;
+ break;
+ case GDK_SCROLL_DOWN:
+ new_value = value + page_increment;
+ break;
+ default:
+ return FALSE;
}
- new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
- gtk_adjustment_set_value (adj, new_value);
+ new_value = CLAMP (new_value, lower, upper - page_size);
+ gtk_adjustment_set_value (adjustment, new_value);
return TRUE;
}
@@ -2603,7 +2698,9 @@ e_week_view_free_events (EWeekView *week_view)
for (event_num = 0; event_num < week_view->events->len; event_num++) {
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
- g_object_unref (event->comp_data);
+
+ if (is_comp_data_valid (event))
+ g_object_unref (event->comp_data);
}
g_array_set_size (week_view->events, 0);
@@ -2785,6 +2882,9 @@ e_week_view_reshape_events (EWeekView *week_view)
for (event_num = 0; event_num < week_view->events->len; event_num++) {
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ continue;
+
for (span_num = 0; span_num < event->num_spans; span_num++) {
gchar *current_comp_string;
@@ -2795,6 +2895,12 @@ e_week_view_reshape_events (EWeekView *week_view)
current_comp_string = icalcomponent_as_ical_string_r (event->comp_data->icalcomp);
if (strncmp (current_comp_string, week_view->last_edited_comp_string,50) == 0) {
EWeekViewEventSpan *span;
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num)) {
+ g_free (current_comp_string);
+ continue;
+ }
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num);
e_canvas_item_grab_focus (span->text_item, TRUE);
g_free (week_view->last_edited_comp_string);
@@ -2843,6 +2949,9 @@ tooltip_get_view_event (EWeekView *week_view, gint day, gint event_num)
{
EWeekViewEvent *pevent;
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return NULL;
+
pevent = &g_array_index (week_view->events, EWeekViewEvent, event_num);
return pevent;
@@ -2941,7 +3050,17 @@ e_week_view_reshape_event_span (EWeekView *week_view,
PangoFontMetrics *font_metrics;
PangoLayout *layout;
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return;
+
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+ return;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
comp = e_cal_component_new ();
@@ -3211,7 +3330,17 @@ e_week_view_start_editing_event (EWeekView *week_view,
&& span_num == week_view->editing_span_num)
return TRUE;
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return FALSE;
+
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+ if (!is_comp_data_valid (event))
+ return FALSE;
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+ return FALSE;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
@@ -3223,7 +3352,12 @@ e_week_view_start_editing_event (EWeekView *week_view,
return FALSE;
if (week_view->editing_event_num >= 0) {
- EWeekViewEvent *editing = &g_array_index (week_view->events, EWeekViewEvent, week_view->editing_event_num);
+ EWeekViewEvent *editing;
+
+ if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+ return FALSE;
+
+ editing = &g_array_index (week_view->events, EWeekViewEvent, week_view->editing_event_num);
/* do not change to other part of same component - the event is spread into more days */
if (editing && event && editing->comp_data == event->comp_data)
@@ -3260,6 +3394,10 @@ e_week_view_start_editing_event (EWeekView *week_view,
}
g_return_val_if_fail (event_num >= 0, FALSE);
}
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+ return FALSE;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num);
/* Try to move the cursor to the end of the text. */
@@ -3304,7 +3442,17 @@ cancel_editing (EWeekView *week_view)
g_return_if_fail (event_num != -1);
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return;
+
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+ return;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + span_num);
/* Reset the text to what was in the component */
@@ -3360,9 +3508,15 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
&event_num, &span_num))
return FALSE;
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return FALSE;
+
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ return FALSE;
+
/* if we started to editing new item on the canvas, then do not open editing dialog until it's saved,
because the save of the event recalculates event numbers and you can edit different one */
if (!is_icalcomp_on_the_server (event->comp_data->icalcomp, event->comp_data->client))
@@ -3389,13 +3543,12 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
return FALSE;
}
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return FALSE;
+
e = &g_array_index (week_view->events, EWeekViewEvent, event_num);
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_has_focus (GTK_WIDGET (week_view)))
-#else
- if (!GTK_WIDGET_HAS_FOCUS (week_view))
-#endif
gtk_widget_grab_focus (GTK_WIDGET (week_view));
e_week_view_set_selected_time_range_visible (week_view, e->start, e->end);
@@ -3530,8 +3683,14 @@ static gboolean e_week_view_event_move (ECalendarView *cal_view, ECalViewMoveDir
if (event_num == -1)
return FALSE;
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return FALSE;
+
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+ if (!is_comp_data_valid (event))
+ return FALSE;
+
end_dt = event->end;
start_time = icalcomponent_get_dtstart (event->comp_data->icalcomp);
end_time = icalcomponent_get_dtend (event->comp_data->icalcomp);
@@ -3601,27 +3760,43 @@ e_week_view_get_day_offset_of_event (EWeekView *week_view, time_t event_time)
void
e_week_view_scroll_a_step (EWeekView *week_view, ECalViewMoveDirection direction)
{
- GtkAdjustment *adj = GTK_RANGE (week_view->vscrollbar)->adjustment;
- gfloat new_value;
+ GtkAdjustment *adjustment;
+ GtkRange *range;
+ gdouble step_increment;
+ gdouble page_size;
+ gdouble new_value;
+ gdouble lower;
+ gdouble upper;
+ gdouble value;
+
+ range = GTK_RANGE (week_view->vscrollbar);
+ adjustment = gtk_range_get_adjustment (range);
+
+ step_increment = gtk_adjustment_get_step_increment (adjustment);
+ page_size = gtk_adjustment_get_page_size (adjustment);
+ lower = gtk_adjustment_get_lower (adjustment);
+ upper = gtk_adjustment_get_upper (adjustment);
+ value = gtk_adjustment_get_value (adjustment);
switch (direction) {
- case E_CAL_VIEW_MOVE_UP:
- new_value = adj->value - adj->step_increment;
- break;
- case E_CAL_VIEW_MOVE_DOWN:
- new_value = adj->value + adj->step_increment;
- break;
- case E_CAL_VIEW_MOVE_PAGE_UP:
- new_value = adj->value - adj->page_size;
- break;
- case E_CAL_VIEW_MOVE_PAGE_DOWN:
- new_value = adj->value + adj->page_size;
- break;
- default:
- return;
+ case E_CAL_VIEW_MOVE_UP:
+ new_value = value - step_increment;
+ break;
+ case E_CAL_VIEW_MOVE_DOWN:
+ new_value = value + step_increment;
+ break;
+ case E_CAL_VIEW_MOVE_PAGE_UP:
+ new_value = value - page_size;
+ break;
+ case E_CAL_VIEW_MOVE_PAGE_DOWN:
+ new_value = value + page_size;
+ break;
+ default:
+ return;
}
- new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
- gtk_adjustment_set_value (adj, new_value);
+
+ new_value = CLAMP (new_value, lower, upper - page_size);
+ gtk_adjustment_set_value (adjustment, new_value);
}
static void
@@ -3642,7 +3817,14 @@ e_week_view_change_event_time (EWeekView *week_view, time_t start_dt, time_t end
if (event_num == -1)
return;
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return;
+
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
+
client = event->comp_data->client;
/* We use a temporary shallow copy of the ico since we don't want to
@@ -3749,7 +3931,17 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
if (event_num == -1)
return;
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return;
+
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
+
+ if (!is_comp_data_valid (event))
+ return;
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+ return;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
@@ -3898,6 +4090,9 @@ e_week_view_find_event_from_item (EWeekView *week_view,
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
for (span_num = 0; span_num < event->num_spans; span_num++) {
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + span_num))
+ continue;
+
span = &g_array_index (week_view->spans,
EWeekViewEventSpan,
event->spans_index + span_num);
@@ -3940,6 +4135,9 @@ e_week_view_find_event_from_uid (EWeekView *week_view,
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
+ if (!is_comp_data_valid (event))
+ continue;
+
if (event->comp_data->client != client)
continue;
@@ -3971,10 +4169,16 @@ e_week_view_is_one_day_event (EWeekView *week_view,
EWeekViewEvent *event;
EWeekViewEventSpan *span;
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return FALSE;
+
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
if (event->num_spans != 1)
return FALSE;
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index))
+ return FALSE;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index);
@@ -4103,8 +4307,15 @@ e_week_view_add_new_event_in_selected_range (EWeekView *week_view, const gchar *
return FALSE;
}
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return FALSE;
+
wvevent = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
+
+ if (!is_array_index_in_bounds (week_view->spans, wvevent->spans_index + 0))
+ return FALSE;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
wvevent->spans_index + 0);
@@ -4484,8 +4695,15 @@ e_week_view_paste_text (ECalendarView *cal_view)
!e_week_view_add_new_event_in_selected_range (week_view, NULL))
return;
+ if (!is_array_index_in_bounds (week_view->events, week_view->editing_event_num))
+ return;
+
event = &g_array_index (week_view->events, EWeekViewEvent,
week_view->editing_event_num);
+
+ if (!is_array_index_in_bounds (week_view->spans, event->spans_index + week_view->editing_span_num))
+ return;
+
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + week_view->editing_span_num);
diff --git a/calendar/gui/ea-cal-view-event.c b/calendar/gui/ea-cal-view-event.c
index 230d7ca84f..b2bdc5c4b3 100644
--- a/calendar/gui/ea-cal-view-event.c
+++ b/calendar/gui/ea-cal-view-event.c
@@ -198,9 +198,17 @@ ea_cal_view_event_new (GObject *obj)
&event_num,
&span_num))
return NULL;
+
+ if (!is_array_index_in_bounds (week_view->events, event_num))
+ return NULL;
+
week_view_event = &g_array_index (week_view->events,
EWeekViewEvent,
event_num);
+
+ if (!is_array_index_in_bounds (week_view->spans, week_view_event->spans_index))
+ return NULL;
+
/* get the first span */
event_span = &g_array_index (week_view->spans,
EWeekViewEventSpan,
@@ -269,6 +277,8 @@ ea_cal_view_event_get_name (AtkObject *accessible)
if (!g_obj || !E_IS_TEXT (g_obj))
return NULL;
event = ea_calendar_helpers_get_cal_view_event_from (GNOME_CANVAS_ITEM(g_obj));
+ if (!is_comp_data_valid (event))
+ return NULL;
alarm_string = recur_string = meeting_string = "";
if (event && event->comp_data) {
@@ -445,6 +455,7 @@ ea_cal_view_get_extents (AtkComponent *component,
ECalendarView *cal_view;
gint item_x, item_y, item_w, item_h;
GtkWidget *canvas = NULL;
+ GdkWindow *window;
g_return_if_fail (EA_IS_CAL_VIEW_EVENT (component));
@@ -509,8 +520,8 @@ ea_cal_view_get_extents (AtkComponent *component,
if (!canvas)
return;
- gdk_window_get_origin (canvas->window,
- &x_window, &y_window);
+ window = gtk_widget_get_window (canvas);
+ gdk_window_get_origin (window, &x_window, &y_window);
gnome_canvas_get_scroll_offsets (GNOME_CANVAS (canvas), &scroll_x, &scroll_y);
*x = item_x + x_window - scroll_x;
@@ -519,10 +530,10 @@ ea_cal_view_get_extents (AtkComponent *component,
*height = item_h;
if (coord_type == ATK_XY_WINDOW) {
- GdkWindow *window;
gint x_toplevel, y_toplevel;
- window = gdk_window_get_toplevel (GTK_WIDGET (cal_view)->window);
+ window = gtk_widget_get_window (GTK_WIDGET (cal_view));
+ window = gdk_window_get_toplevel (window);
gdk_window_get_origin (window, &x_toplevel, &y_toplevel);
*x -= x_toplevel;
diff --git a/calendar/gui/ea-cal-view.c b/calendar/gui/ea-cal-view.c
index ceffaa0483..67969c75ec 100644
--- a/calendar/gui/ea-cal-view.c
+++ b/calendar/gui/ea-cal-view.c
@@ -331,11 +331,7 @@ action_interface_do_action (AtkAction *action, gint index)
*/
return FALSE;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
-#else
- if (!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
-#endif
return FALSE;
cal_view = E_CALENDAR_VIEW (widget);
@@ -399,11 +395,7 @@ action_interface_get_keybinding (AtkAction *action, gint index)
*/
return NULL;
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_sensitive (widget) || !gtk_widget_get_visible (widget))
-#else
- if (!GTK_WIDGET_IS_SENSITIVE (widget) || !GTK_WIDGET_VISIBLE (widget))
-#endif
return NULL;
switch (index) {
diff --git a/calendar/gui/ea-day-view.c b/calendar/gui/ea-day-view.c
index c75bf89f7b..d197f49e04 100644
--- a/calendar/gui/ea-day-view.c
+++ b/calendar/gui/ea-day-view.c
@@ -133,11 +133,7 @@ ea_day_view_get_name (AtkObject *accessible)
day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (day_view));
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_visible (GTK_WIDGET (gcal)))
-#else
- if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (gcal)))
-#endif
return NULL;
label_text = ea_gnome_calendar_get_label_description (gcal);
diff --git a/calendar/gui/ea-week-view.c b/calendar/gui/ea-week-view.c
index c3b4658e78..a34326cf74 100644
--- a/calendar/gui/ea-week-view.c
+++ b/calendar/gui/ea-week-view.c
@@ -134,11 +134,7 @@ ea_week_view_get_name (AtkObject *accessible)
week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
gcal = e_calendar_view_get_calendar (E_CALENDAR_VIEW (week_view));
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_visible (GTK_WIDGET (gcal)))
-#else
- if (!GTK_WIDGET_VISIBLE (GTK_WIDGET (gcal)))
-#endif
return NULL;
label_text = ea_gnome_calendar_get_label_description (gcal);
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index f22e70efc7..a24dfa26ed 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -138,7 +138,6 @@ struct _GnomeCalendarPrivate {
enum {
PROP_0,
PROP_DATE_NAVIGATOR,
- PROP_SHELL_SETTINGS,
PROP_VIEW,
PROP_MEMO_TABLE,
PROP_TASK_TABLE
@@ -231,14 +230,17 @@ update_adjustment (GnomeCalendar *gcal,
time_t lower;
guint32 old_first_day_julian, new_first_day_julian;
icaltimezone *timezone;
+ gdouble value;
/* If we don't have a valid date set yet, just return. */
if (!g_date_valid (&week_view->first_day_shown))
return;
+ value = gtk_adjustment_get_value (adjustment);
+
/* Determine the first date shown. */
date = week_view->base_date;
- week_offset = floor (adjustment->value + 0.5);
+ week_offset = floor (value + 0.5);
g_date_add_days (&date, week_offset * 7);
/* Convert the old & new first days shown to julian values. */
@@ -2087,11 +2089,7 @@ gnome_calendar_update_date_navigator (GnomeCalendar *gcal)
return;
/* If the ECalendar isn't visible, we just return. */
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_visible (GTK_WIDGET (priv->date_navigator)))
-#else
- if (!GTK_WIDGET_VISIBLE (priv->date_navigator))
-#endif
return;
if (priv->current_view_type == GNOME_CAL_LIST_VIEW && !priv->lview_select_daten_range)
diff --git a/calendar/gui/goto-dialog.ui b/calendar/gui/goto-dialog.ui
index 2e9fbf19d0..a7e3014712 100644
--- a/calendar/gui/goto-dialog.ui
+++ b/calendar/gui/goto-dialog.ui
@@ -81,7 +81,7 @@
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">_Select Today</property>
+ <property name="label" translatable="yes">Select _Today</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 9fe0f1bdb6..d40a7ac633 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -38,7 +38,6 @@
#include "dialogs/comp-editor-util.h"
#include <composer/e-msg-composer.h>
-#include <camel/camel-mime-filter-tohtml.h>
static const gchar *itip_methods[] = {
"PUBLISH",
@@ -1194,7 +1193,7 @@ append_cal_attachments (EMsgComposer *composer,
camel_mime_part_set_disposition (
attachment, "attachment");
e_msg_composer_attach (composer, attachment);
- camel_object_unref (attachment);
+ g_object_unref (attachment);
g_free (mime_attach->filename);
g_free (mime_attach->content_type);
@@ -1363,7 +1362,7 @@ itip_send_comp (ECalComponentItipMethod method, ECalComponent *send_comp,
camel_mime_part_set_description (attachment, description);
camel_mime_part_set_disposition (attachment, "inline");
e_msg_composer_attach (composer, attachment);
- camel_object_unref (attachment);
+ g_object_unref (attachment);
g_free (description);
}
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index a3e9af3bdd..ab2f784c33 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -1092,6 +1092,9 @@ print_day_long_event (GtkPrintContext *context,
struct tm date_tm;
gdouble red, green, blue;
+ if (!is_comp_data_valid (event))
+ return;
+
/* If the event starts before the first day being printed, draw a
triangle. (Note that I am assuming we are just showing 1 day at
the moment.) */
@@ -1172,6 +1175,9 @@ print_day_event (GtkPrintContext *context, PangoFontDescription *font,
struct tm date_tm;
gdouble red, green, blue;
+ if (!is_comp_data_valid (event))
+ return;
+
if ((event->start_minute >= pdi->end_minute_offset)
|| (event->end_minute <= pdi->start_minute_offset))
return;
@@ -1561,6 +1567,9 @@ print_week_event (GtkPrintContext *context, PangoFontDescription *font,
gdouble red, green, blue;
GdkPixbuf *pixbuf = NULL;
+ if (!is_comp_data_valid (event))
+ return;
+
text = get_summary_with_location (event->comp_data->icalcomp);
for (span_num = 0; span_num < event->num_spans; span_num++) {
@@ -2414,21 +2423,36 @@ print_date_label (GtkPrintContext *context, ECalComponent *comp, ECal *client,
if (start > 0)
write_label_piece (start, buffer, 1024, NULL, NULL);
- if (end > 0 && start > 0)
+ if (end > 0 && start > 0) {
+ /* Translators: This is part of "START to END" text,
+ * where START and END are date/times. */
write_label_piece (end, buffer, 1024, _(" to "), NULL);
+ }
if (complete > 0) {
- if (start > 0)
+ if (start > 0) {
+ /* Translators: This is part of "START to END
+ * (Completed COMPLETED)", where COMPLETED is a
+ * completed date/time. */
write_label_piece (complete, buffer, 1024, _(" (Completed "), ")");
- else
+ } else {
+ /* Translators: This is part of "Completed COMPLETED",
+ * where COMPLETED is a completed date/time. */
write_label_piece (complete, buffer, 1024, _("Completed "), NULL);
+ }
}
if (due > 0 && complete == 0) {
- if (start > 0)
+ if (start > 0) {
+ /* Translators: This is part of "START (Due DUE)",
+ * where START and DUE are dates/times. */
write_label_piece (due, buffer, 1024, _(" (Due "), ")");
- else
+ } else {
+ /* Translators: This is part of "Due DUE",
+ * where DUE is a date/time due the event
+ * should be finished. */
write_label_piece (due, buffer, 1024, _("Due "), NULL);
+ }
}
print_text_size_bold (context, buffer, PANGO_ALIGN_LEFT,
diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c
index a6a7e520ab..f700da5a3b 100644
--- a/calendar/gui/tag-calendar.c
+++ b/calendar/gui/tag-calendar.c
@@ -142,11 +142,7 @@ tag_calendar_by_client (ECalendar *ecal,
g_return_if_fail (E_IS_CAL (client));
/* If the ECalendar isn't visible, we just return. */
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_visible (GTK_WIDGET (ecal)))
-#else
- if (!GTK_WIDGET_VISIBLE (ecal))
-#endif
return;
if (e_cal_get_load_state (client) != E_CAL_LOAD_LOADED)
@@ -214,11 +210,7 @@ tag_calendar_by_comp (ECalendar *ecal,
g_return_if_fail (E_IS_CAL_COMPONENT (comp));
/* If the ECalendar isn't visible, we just return. */
-#if GTK_CHECK_VERSION(2,19,7)
if (!gtk_widget_get_visible (GTK_WIDGET (ecal)))
-#else
- if (!GTK_WIDGET_VISIBLE (ecal))
-#endif
return;
if (!prepare_tag (ecal, &c, display_zone, clear_first))
diff --git a/calendar/gui/weekday-picker.c b/calendar/gui/weekday-picker.c
index 12dd47d16a..69ba5b79f3 100644
--- a/calendar/gui/weekday-picker.c
+++ b/calendar/gui/weekday-picker.c
@@ -93,20 +93,22 @@ colorize_items (WeekdayPicker *wp)
GdkColor *fill, *sel_fill;
GdkColor *text_fill, *sel_text_fill;
GtkStateType state;
+ GtkStyle *style;
gint i;
priv = wp->priv;
state = gtk_widget_get_state (GTK_WIDGET (wp));
+ style = gtk_widget_get_style (GTK_WIDGET (wp));
- outline = &GTK_WIDGET (wp)->style->fg[state];
- focus_outline = &GTK_WIDGET (wp)->style->bg[state];
+ outline = &style->fg[state];
+ focus_outline = &style->bg[state];
- fill = &GTK_WIDGET (wp)->style->base[state];
- text_fill = &GTK_WIDGET (wp)->style->fg[state];
+ fill = &style->base[state];
+ text_fill = &style->fg[state];
- sel_fill = &GTK_WIDGET (wp)->style->bg[GTK_STATE_SELECTED];
- sel_text_fill = &GTK_WIDGET (wp)->style->fg[GTK_STATE_SELECTED];
+ sel_fill = &style->bg[GTK_STATE_SELECTED];
+ sel_text_fill = &style->fg[GTK_STATE_SELECTED];
for (i = 0; i < 7; i++) {
gint day;
@@ -144,14 +146,17 @@ static void
configure_items (WeekdayPicker *wp)
{
WeekdayPickerPrivate *priv;
+ GtkAllocation allocation;
gint width, height;
gint box_width;
gint i;
priv = wp->priv;
- width = GTK_WIDGET (wp)->allocation.width;
- height = GTK_WIDGET (wp)->allocation.height;
+ gtk_widget_get_allocation (GTK_WIDGET (wp), &allocation);
+
+ width = allocation.width;
+ height = allocation.height;
box_width = (width - 1) / 7;
@@ -321,11 +326,7 @@ weekday_picker_focus (GtkWidget *widget,
if (!gtk_widget_get_can_focus (widget))
return FALSE;
-#if GTK_CHECK_VERSION(2,19,7)
if (gtk_widget_has_focus (widget)) {
-#else
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
-#endif
priv->focus_day = -1;
colorize_items (wp);
return FALSE;