evolution-3.6.4/calendar/gui/dialogs/save-comp.c

No issues found

 1 /*
 2  *
 3  * This program is free software; you can redistribute it and/or
 4  * modify it under the terms of the GNU Lesser General Public
 5  * License as published by the Free Software Foundation; either
 6  * version 2 of the License, or (at your option) version 3.
 7  *
 8  * This program is distributed in the hope that it will be useful,
 9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with the program; if not, see <http://www.gnu.org/licenses/>
15  *
16  *
17  * Authors:
18  *		Federico Mena-Quintero <federico@ximian.com>
19  *
20  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
21  *
22  */
23 
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27 
28 #include "libevolution-utils/e-alert-dialog.h"
29 #include "save-comp.h"
30 #include "comp-editor.h"
31 
32 /**
33  * save_component_dialog:
34  * @parent: Window to use as the transient dialog's parent.
35  * @comp: Pointer to the EcalComponent
36  *
37  * Pops up a dialog box asking the user whether he wants to save changes for
38  * a calendar component.
39  *
40  * Return value: the response_id of the button selected.
41  **/
42 
43 GtkResponseType
44 save_component_dialog (GtkWindow *parent,
45                        ECalComponent *comp)
46 {
47 	ECalComponentVType vtype = e_cal_component_get_vtype (comp);
48 	CompEditorFlags flags;
49 
50 	switch (vtype) {
51 		case E_CAL_COMPONENT_EVENT:
52 			flags = comp_editor_get_flags (COMP_EDITOR (parent));
53 			if (flags & COMP_EDITOR_MEETING)
54 				return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-meeting", NULL);
55 			else
56 				return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-appointment", NULL);
57 		case E_CAL_COMPONENT_TODO:
58 			return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-task", NULL);
59 		case E_CAL_COMPONENT_JOURNAL:
60 			return e_alert_run_dialog_for_args (parent, "calendar:prompt-save-memo", NULL);
61 		default:
62 			return GTK_RESPONSE_NO;
63 	}
64 }