diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-03-15 03:42:28 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-03-15 03:42:28 +0800 |
commit | 238c20117fc8d3fdddb270e3ef197593e45e1a85 (patch) | |
tree | db878b0600605fb4931134f6854a39bacbdd2c98 | |
parent | dbf748d3d227da9903dfd0cbd0ddcfaa6fc2dd1a (diff) | |
download | gsoc2013-evolution-238c20117fc8d3fdddb270e3ef197593e45e1a85.tar.gz gsoc2013-evolution-238c20117fc8d3fdddb270e3ef197593e45e1a85.tar.zst gsoc2013-evolution-238c20117fc8d3fdddb270e3ef197593e45e1a85.zip |
Fixes #39740
2003-03-14 Rodrigo Moya <rodrigo@ximian.com>
Fixes #39740
* gui/e-meeting-model.c (is_cell_editable): check row number is valid
before using it as index for the GPtrArray.
2003-03-14 Rodrigo Moya <rodrigo@ximian.com>
Fixes #39356
* gui/Makefile.am:
* gui/tasks-migrate.[ch]: removed tasks migration obsolete stuff.
* gui/calendar-component.c (owner_set_cb): don't call tasks_migrate.
svn path=/trunk/; revision=20301
-rw-r--r-- | calendar/ChangeLog | 16 | ||||
-rw-r--r-- | calendar/gui/Makefile.am | 2 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 9 | ||||
-rw-r--r-- | calendar/gui/e-meeting-model.c | 2 | ||||
-rw-r--r-- | calendar/gui/tasks-migrate.c | 303 | ||||
-rw-r--r-- | calendar/gui/tasks-migrate.h | 28 |
6 files changed, 18 insertions, 342 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 300b8027a6..8c2278732d 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,21 @@ 2003-03-14 Rodrigo Moya <rodrigo@ximian.com> + Fixes #39740 + + * gui/e-meeting-model.c (is_cell_editable): check row number is valid + before using it as index for the GPtrArray. + +2003-03-14 Rodrigo Moya <rodrigo@ximian.com> + + Fixes #39356 + + * gui/Makefile.am: + * gui/tasks-migrate.[ch]: removed tasks migration obsolete stuff. + + * gui/calendar-component.c (owner_set_cb): don't call tasks_migrate. + +2003-03-14 Rodrigo Moya <rodrigo@ximian.com> + * pcs/cal-factory.c (impl_CalFactory_uriList): set_release on the sequence we create. diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index d513ed4901..2b0e08e5b0 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -175,8 +175,6 @@ libevolution_calendar_la_SOURCES = \ tag-calendar.h \ tasks-control.c \ tasks-control.h \ - tasks-migrate.c \ - tasks-migrate.h \ weekday-picker.c \ weekday-picker.h diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 6beb5964e3..7380b7a91e 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -41,7 +41,6 @@ #include "control-factory.h" #include "calendar-config.h" #include "tasks-control.h" -#include "tasks-migrate.h" #include "e-comp-editor-registry.h" #include "dialogs/comp-editor.h" @@ -507,15 +506,7 @@ owner_set_cb (EvolutionShellComponent *shell_component, const char *evolution_homedir, gpointer user_data) { - static gboolean migrated = FALSE; - evolution_dir = g_strdup (evolution_homedir); - - if (!migrated) { - tasks_migrate (); - migrated = TRUE; - } - global_shell_client = shell_client; } diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c index d3261bd125..7122792ec4 100644 --- a/calendar/gui/e-meeting-model.c +++ b/calendar/gui/e-meeting-model.c @@ -497,6 +497,8 @@ is_cell_editable (ETableModel *etm, int col, int row) if (row == -1) return TRUE; + if (row >= priv->attendees->len) + return TRUE; ia = g_ptr_array_index (priv->attendees, row); level = e_meeting_attendee_get_edit_level (ia); diff --git a/calendar/gui/tasks-migrate.c b/calendar/gui/tasks-migrate.c deleted file mode 100644 index 5c9ebd85fc..0000000000 --- a/calendar/gui/tasks-migrate.c +++ /dev/null @@ -1,303 +0,0 @@ -/* Evolution calendar - Migrate tasks from the calendar folder to the tasks folder - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gtk/gtkwindow.h> -#include <gtk/gtksignal.h> -#include <libgnome/gnome-i18n.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <cal-client/cal-client.h> - -#include "calendar-component.h" -#include "tasks-migrate.h" - - - -/* Client for the calendar folder */ -static CalClient *calendar_client = NULL; - -/* Client for the tasks folder */ -static CalClient *tasks_client = NULL; - -/* Whether we have done the migration yet */ -static gboolean migrated = FALSE; - - - -/* Performs the actual migration process */ -static void -migrate (void) -{ - GList *uids; - GList *l; - gboolean success; - gboolean at_least_one; - - g_assert (calendar_client != NULL); - g_assert (tasks_client != NULL); - g_assert (cal_client_get_load_state (calendar_client) == CAL_CLIENT_LOAD_LOADED); - g_assert (cal_client_get_load_state (tasks_client) == CAL_CLIENT_LOAD_LOADED); - - uids = cal_client_get_uids (calendar_client, CALOBJ_TYPE_TODO); - - success = TRUE; - at_least_one = FALSE; - - for (l = uids; l; l = l->next) { - const char *uid; - CalComponent *comp; - CalClientGetStatus status; - - at_least_one = TRUE; - - uid = l->data; - status = cal_client_get_object (calendar_client, uid, &comp); - - switch (status) { - case CAL_CLIENT_GET_SUCCESS: - if (cal_client_update_object (tasks_client, comp) == CAL_CLIENT_RESULT_SUCCESS) - cal_client_remove_object (calendar_client, uid); - else - success = FALSE; - - g_object_unref (comp); - break; - - case CAL_CLIENT_GET_NOT_FOUND: - /* This is OK; the object may have disappeared from the server */ - break; - - case CAL_CLIENT_GET_SYNTAX_ERROR: - success = FALSE; - break; - - default: - g_assert_not_reached (); - } - } - - cal_obj_uid_list_free (uids); - - if (!at_least_one) - return; - - if (success) - gnome_ok_dialog (_("Evolution has taken the tasks that were in your calendar folder " - "and automatically migrated them to the new tasks folder.")); - else - gnome_ok_dialog (_("Evolution has tried to take the tasks that were in your " - "calendar folder and migrate them to the new tasks folder.\n" - "Some of the tasks could not be migrated, so " - "this process may be attempted again in the future.")); -} - -/* Displays an error to indicate that a calendar could not be opened */ -static void -open_error (const char *uri) -{ - char *msg; - - msg = g_strdup_printf (_("Could not open `%s'; no items from the calendar folder " - "will be migrated to the tasks folder."), - uri); - gnome_error_dialog (msg); - g_free (msg); -} - -/* Displays an error to indicate that a URI method is not supported */ -static void -method_error (const char *uri) -{ - char *msg; - - msg = g_strdup_printf (_("The method required to load `%s' is not supported; " - "no items from the calendar folder will be migrated " - "to the tasks folder."), - uri); - gnome_error_dialog (msg); - g_free (msg); -} - -/* Callback used when the tasks client is finished loading */ -static void -tasks_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) -{ - g_assert (calendar_client != NULL); - g_assert (cal_client_get_load_state (calendar_client) == CAL_CLIENT_LOAD_LOADED); - - switch (status) { - case CAL_CLIENT_OPEN_SUCCESS: - migrate (); - break; - - case CAL_CLIENT_OPEN_ERROR: - open_error (cal_client_get_uri (client)); - migrated = FALSE; - break; - - case CAL_CLIENT_OPEN_NOT_FOUND: - /* This can't happen because we did not specify only_if_exists when - * issuing the open request. - */ - g_assert_not_reached (); - break; - - case CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED: - method_error (cal_client_get_uri (client)); - migrated = FALSE; - break; - - default: - g_assert_not_reached (); - } - - g_object_unref (calendar_client); - calendar_client = NULL; - - g_object_unref (tasks_client); - tasks_client = NULL; -} - -/* Initiates the loading process for the tasks client */ -static gboolean -load_tasks_client (void) -{ - char *uri; - gboolean success; - - g_assert (calendar_client != NULL); - g_assert (cal_client_get_load_state (calendar_client) == CAL_CLIENT_LOAD_LOADED); - - tasks_client = cal_client_new (); - if (!tasks_client) - goto error; - - g_signal_connect (tasks_client, "cal_opened", G_CALLBACK (tasks_opened_cb), NULL); - - uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir); - success = cal_client_open_calendar (tasks_client, uri, FALSE); - g_free (uri); - - if (success) - return TRUE; - - error: - g_message ("load_tasks_client(): could not issue open request for the tasks client"); - - if (tasks_client) { - g_object_unref (tasks_client); - tasks_client = NULL; - } - - return FALSE; -} - -/* Callback used when the calendar client finishes loading */ -static void -calendar_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) -{ - switch (status) { - case CAL_CLIENT_OPEN_SUCCESS: - if (!load_tasks_client ()) { - migrated = FALSE; - break; - } - - return; - - case CAL_CLIENT_OPEN_ERROR: - open_error (cal_client_get_uri (client)); - migrated = FALSE; - break; - - case CAL_CLIENT_OPEN_NOT_FOUND: - /* This is OK; the calendar folder did not exist in the first - * place so there is nothing to migrate. - */ - break; - - case CAL_CLIENT_OPEN_METHOD_NOT_SUPPORTED: - method_error (cal_client_get_uri (client)); - migrated = FALSE; - break; - - default: - g_assert_not_reached (); - } - - g_object_unref (calendar_client); - calendar_client = NULL; -} - -/* Initiates the loading process for the calendar client */ -static gboolean -load_calendar_client (void) -{ - char *uri; - gboolean success; - - /* First we load the calendar client; the tasks client will be loaded - * later only if the former one succeeds. - */ - - calendar_client = cal_client_new (); - if (!calendar_client) - goto error; - - g_signal_connect (calendar_client, "cal_opened", G_CALLBACK (calendar_opened_cb), NULL); - - uri = g_strdup_printf ("%s/local/Calendar/calendar.ics", evolution_dir); - success = cal_client_open_calendar (calendar_client, uri, TRUE); - g_free (uri); - - if (success) - return TRUE; - - error: - g_message ("load_calendar_client(): could not issue open request for the calendar client"); - - if (calendar_client) { - g_object_unref (calendar_client); - calendar_client = NULL; - } - - return FALSE; -} - -/** - * tasks_migrate: - * - * Initiates the asynchronous process that migrates the tasks from the default - * user calendar folder to the default tasks folder. This is because Evolution - * used to store tasks in the same folder as the calendar by default, but they - * are separate folders now. - **/ -void -tasks_migrate (void) -{ - g_assert (!migrated); - migrated = TRUE; - - if (!load_calendar_client ()) - migrated = FALSE; -} diff --git a/calendar/gui/tasks-migrate.h b/calendar/gui/tasks-migrate.h deleted file mode 100644 index 0307d533b9..0000000000 --- a/calendar/gui/tasks-migrate.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Evolution calendar - Migrate tasks from the calendar folder to the tasks folder - * - * Copyright (C) 2001 Ximian, Inc. - * - * Authors: Federico Mena-Quintero <federico@ximian.com> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef TASKS_MIGRATE_H -#define TASKS_MIGRATE_H - - -void tasks_migrate (void); - - -#endif |