diff options
author | Dan Vrátil <dvratil@redhat.com> | 2011-06-23 15:35:26 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2011-06-23 15:35:26 +0800 |
commit | cc96d85ef9a68ab4898a9c77bffcc5097e10d7e8 (patch) | |
tree | 79f8a4d7497f3b0d147a38f74f6d9dde2268e5d3 /calendar | |
parent | 5b1dc9a806557f139200ddbec710bc457cd3f305 (diff) | |
download | gsoc2013-evolution-cc96d85ef9a68ab4898a9c77bffcc5097e10d7e8.tar gsoc2013-evolution-cc96d85ef9a68ab4898a9c77bffcc5097e10d7e8.tar.gz gsoc2013-evolution-cc96d85ef9a68ab4898a9c77bffcc5097e10d7e8.tar.bz2 gsoc2013-evolution-cc96d85ef9a68ab4898a9c77bffcc5097e10d7e8.tar.lz gsoc2013-evolution-cc96d85ef9a68ab4898a9c77bffcc5097e10d7e8.tar.xz gsoc2013-evolution-cc96d85ef9a68ab4898a9c77bffcc5097e10d7e8.tar.zst gsoc2013-evolution-cc96d85ef9a68ab4898a9c77bffcc5097e10d7e8.zip |
Bug #646442 - [mail-to-task] Edit event details before adding to calendar
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/Makefile.am | 3 | ||||
-rw-r--r-- | calendar/gui/cal-editor-utils.c | 118 | ||||
-rw-r--r-- | calendar/gui/cal-editor-utils.h | 37 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 16 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.h | 2 |
5 files changed, 18 insertions, 158 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 09cc0559b0..1531bb8d60 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -5,7 +5,6 @@ privsolib_LTLIBRARIES = libevolution-calendar.la ecalendarincludedir = $(privincludedir)/calendar/gui ecalendarinclude_HEADERS = \ - cal-editor-utils.h \ calendar-config.h \ calendar-config-keys.h \ calendar-view.h \ @@ -80,8 +79,6 @@ etspec_DATA = \ e-memo-table.etspec libevolution_calendar_la_SOURCES = \ - cal-editor-utils.c \ - cal-editor-utils.h \ calendar-config.c \ calendar-config.h \ calendar-config-keys.h \ diff --git a/calendar/gui/cal-editor-utils.c b/calendar/gui/cal-editor-utils.c deleted file mode 100644 index 4ddc3899b9..0000000000 --- a/calendar/gui/cal-editor-utils.c +++ /dev/null @@ -1,118 +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/> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib/gi18n.h> -#include <gtk/gtk.h> -#include <e-util/e-dialog-utils.h> - -#include "cal-editor-utils.h" - -#include "dialogs/event-editor.h" -#include "dialogs/task-editor.h" -#include "dialogs/memo-editor.h" - -/** - * open_component_editor: - * @client: Already opened #ECalClient, where to store the component - * @comp: #ECalComponent component to be stored - * @is_new: Whether the @comp is a new component or an existing - * @error: #GError for possible error reporting - * - * Opens component editor for the event stored in the comp component. - * If such component exists in the client already (with the same UID), - * then there's opened already stored event, instead of the comp. - * - * It blocks until finished and should be called in the main thread. - **/ -void -open_component_editor (EShell *shell, - ECalClient *client, - ECalComponent *comp, - gboolean is_new, - GError **error) -{ - ECalComponentId *id; - CompEditorFlags flags = 0; - CompEditor *editor = NULL; - - g_return_if_fail (E_IS_SHELL (shell)); - g_return_if_fail (E_IS_CAL_CLIENT (client)); - g_return_if_fail (E_IS_CAL_COMPONENT (comp)); - - id = e_cal_component_get_id (comp); - g_return_if_fail (id != NULL); - g_return_if_fail (id->uid != NULL); - - if (is_new) { - flags |= COMP_EDITOR_NEW_ITEM; - } else { - editor = comp_editor_find_instance (id->uid); - } - - if (!editor) { - if (itip_organizer_is_user (comp, client)) - flags |= COMP_EDITOR_USER_ORG; - - switch (e_cal_component_get_vtype (comp)) { - case E_CAL_COMPONENT_EVENT: - if (e_cal_component_has_attendees (comp)) - flags |= COMP_EDITOR_MEETING; - - editor = event_editor_new (client, shell, flags); - - if (flags & COMP_EDITOR_MEETING) - event_editor_show_meeting (EVENT_EDITOR (editor)); - break; - case E_CAL_COMPONENT_TODO: - if (e_cal_component_has_attendees (comp)) - flags |= COMP_EDITOR_IS_ASSIGNED; - - editor = task_editor_new (client, shell, flags); - - if (flags & COMP_EDITOR_IS_ASSIGNED) - task_editor_show_assignment (TASK_EDITOR (editor)); - break; - case E_CAL_COMPONENT_JOURNAL: - if (e_cal_component_has_organizer (comp)) - flags |= COMP_EDITOR_IS_SHARED; - - editor = memo_editor_new (client, shell, flags); - break; - default: - if (error) - *error = e_client_error_create (E_CLIENT_ERROR_INVALID_ARG, NULL); - break; - } - - if (editor) { - comp_editor_edit_comp (editor, comp); - - /* request save for new events */ - comp_editor_set_changed (editor, is_new); - } - } - - if (editor) - gtk_window_present (GTK_WINDOW (editor)); - - e_cal_component_free_id (id); -} diff --git a/calendar/gui/cal-editor-utils.h b/calendar/gui/cal-editor-utils.h deleted file mode 100644 index 26b2104ea4..0000000000 --- a/calendar/gui/cal-editor-utils.h +++ /dev/null @@ -1,37 +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/> - * - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef CAL_EDITOR_UTILS_H -#define CAL_EDITOR_UTILS_H - -#include <libecal/e-cal-client.h> -#include <libecal/e-cal-component.h> -#include <shell/e-shell.h> - -G_BEGIN_DECLS - -void open_component_editor (EShell *shell, - ECalClient *client, - ECalComponent *comp, - gboolean is_new, - GError **error); - -G_END_DECLS - -#endif /* CAL_EDITOR_UTILS_H */ diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 21ac86e9c3..da7759523e 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -121,6 +121,8 @@ struct _CompEditorPrivate { gboolean changed; gboolean needs_send; + gboolean saved; + CalObjModType mod; gboolean existing_org; @@ -212,6 +214,7 @@ G_DEFINE_TYPE_WITH_CODE ( enum { OBJECT_CREATED, + COMP_CLOSED, LAST_SIGNAL }; @@ -624,6 +627,7 @@ save_comp (CompEditor *editor) } priv->changed = FALSE; + priv->saved = TRUE; } g_free (orig_uid_copy); @@ -1868,6 +1872,15 @@ comp_editor_class_init (CompEditorClass *class) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); + + signals[COMP_CLOSED] = g_signal_new ( + "comp_closed", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (CompEditorClass, comp_closed), + NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); } static void @@ -1920,6 +1933,7 @@ comp_editor_init (CompEditor *editor) priv->user_org = FALSE; priv->warned = FALSE; priv->is_group_item = FALSE; + priv->saved = FALSE; priv->ui_manager = e_ui_manager_new (); e_ui_manager_set_express_mode ( @@ -2201,6 +2215,8 @@ close_dialog (CompEditor *editor) { CompEditorPrivate *priv = editor->priv; + g_signal_emit_by_name (editor, "comp_closed", priv->saved); + /* FIXME Unfortunately we do this here because otherwise corba calls happen during destruction and we might get a change notification back when we are in an inconsistent state */ diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 3f1ddbb673..aca5c8ef11 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -86,6 +86,8 @@ struct _CompEditorClass { gboolean visible); void (*show_type) (CompEditor *editor, gboolean visible); + void (*comp_closed) (CompEditor *editor, + gboolean saved); }; typedef enum { |