aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/component-factory.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-07-23 10:04:14 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-07-23 10:04:14 +0800
commit97cc1d57adcdefb5b63a704f42f692e3cffb4014 (patch)
tree8cf6ca737156fa7ae603a5b479813f6a6c5830d5 /calendar/gui/component-factory.c
parent13c7f54818b9b6a25a47289768d17e5a885cec7a (diff)
downloadgsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.tar.gz
gsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.tar.zst
gsoc2013-evolution-97cc1d57adcdefb5b63a704f42f692e3cffb4014.zip
Add an extra @type arg to the xferFolder and removeFolder methods in
the ShellComponent interface. Updated the EvolutionShellComponent GTK+ wrapper and all the component accordingly. Get the calendar to use this so it can delete both tasks and calendar folders. svn path=/trunk/; revision=11300
Diffstat (limited to 'calendar/gui/component-factory.c')
-rw-r--r--calendar/gui/component-factory.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index dd161a46dc..4b47fe697d 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -53,6 +53,20 @@ static const EvolutionShellComponentFolderType folder_types[] = {
};
+/* Utility functions. */
+
+static const char *
+get_local_file_name_for_folder_type (const char *type)
+{
+ if (strcmp (type, "calendar") == 0)
+ return "calendar.ics";
+ else if (strcmp (type, "tasks") == 0)
+ return "tasks.ics";
+ else
+ return NULL;
+}
+
+
/* EvolutionShellComponent methods and signals. */
static EvolutionShellComponentResult
@@ -107,10 +121,12 @@ create_folder (EvolutionShellComponent *shell_component,
static void
remove_folder (EvolutionShellComponent *shell_component,
const char *physical_uri,
+ const char *type,
const GNOME_Evolution_ShellComponentListener listener,
void *closure)
{
CORBA_Environment ev;
+ const char *file_name;
gchar *path;
int rv;
@@ -128,8 +144,17 @@ remove_folder (EvolutionShellComponent *shell_component,
/* FIXME: check if there are subfolders? */
+ file_name = get_local_file_name_for_folder_type (type);
+ if (file_name == NULL) {
+ GNOME_Evolution_ShellComponentListener_notifyResult (listener,
+ GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE,
+ &ev);
+ CORBA_exception_free (&ev);
+ return;
+ }
+
/* remove the .ics file */
- path = g_concat_dir_and_file (physical_uri + 7, "calendar.ics");
+ path = g_concat_dir_and_file (physical_uri + 7, file_name);
rv = unlink (path);
g_free (path);
if (rv == 0) {
@@ -169,6 +194,7 @@ static void
xfer_folder (EvolutionShellComponent *shell_component,
const char *source_physical_uri,
const char *destination_physical_uri,
+ const char *type,
gboolean remove_source,
const GNOME_Evolution_ShellComponentListener listener,
void *closure)
@@ -182,6 +208,7 @@ xfer_folder (EvolutionShellComponent *shell_component,
GnomeVFSURI *uri;
GnomeVFSFileSize out;
char *buf;
+ const char *file_name;
CORBA_exception_init (&ev);
@@ -196,6 +223,15 @@ xfer_folder (EvolutionShellComponent *shell_component,
return;
}
+ file_name = get_local_file_name_for_folder_type (type);
+ if (file_name == NULL) {
+ GNOME_Evolution_ShellComponentListener_notifyResult (listener,
+ GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE,
+ &ev);
+ CORBA_exception_free (&ev);
+ return;
+ }
+
/* open source and destination files */
source_path = g_concat_dir_and_file (source_physical_uri + 7, "calendar.ics");