From 65d69a92f1ee494743b9207a38ff7285848f37d3 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 7 May 2002 20:17:07 +0000 Subject: start a server a uri (start_default_server): start a default server 2002-05-07 JP Rosevear * gui/e-itip-control.c (start_calendar_server): start a server a uri (start_default_server): start a default server (get_servers): get all clients for all folders of the given type(s) (find_server): locate a server for a particular uid (init): get_servers, listen for object_requested signal (destroy): destroy all clients (write_html): put options is there own cell (get_publish_options): place selector in if param is true (get_request_options): ditto (get_real_item): only try and look up the item if we know its in the server (show_current_event): find the server (if any) for the current comp (show_current_todo): ditto (update_attendee_status): if there is no server for the comp, it doesn't exist (remove_item): ditto (button_selected_cb): get a client for the selected folder (object_requested_cb): draw the folder button in * gui/calendar-config.h: new protos * gui/calendar-config.c (calendar_config_default_tasks_folder): get default tasks uri (calendar_config_default_calendar_folder): get default calendar uri * cal-client/cal-client.c (get_default_uri): use cal_util_expand_uri * cal-util/cal-util.h: new proto * cal-util/cal-util.c (cal_util_expand_uri): tack on the file name if its a file uri svn path=/trunk/; revision=16709 --- calendar/cal-util/cal-util.c | 30 ++++++++++++++++++++++++++++++ calendar/cal-util/cal-util.h | 2 ++ 2 files changed, 32 insertions(+) (limited to 'calendar/cal-util') diff --git a/calendar/cal-util/cal-util.c b/calendar/cal-util/cal-util.c index a30329c638..8ba1ff7d63 100644 --- a/calendar/cal-util/cal-util.c +++ b/calendar/cal-util/cal-util.c @@ -21,9 +21,11 @@ #include #include +#include #include #include #include +#include #include "cal-util.h" @@ -528,3 +530,31 @@ cal_util_priority_from_string (const char *string) return priority; } + +char * +cal_util_expand_uri (char *uri, gboolean tasks) +{ + char *file_uri, *file_name; + + if (!strncmp (uri, "file://", 7)) { + file_uri = uri + 7; + if (strlen (file_uri) > 4 + && !strcmp (file_uri + strlen (file_uri) - 4, ".ics")) { + + /* it's a .ics file */ + return g_strdup (uri); + } + + /* we assume it's a dir and glom .ics onto the end. */ + if (tasks) + file_name = g_concat_dir_and_file (file_uri, "tasks.ics"); + else + file_name = g_concat_dir_and_file (file_uri, "calendar.ics"); + file_uri = g_strdup_printf("file://%s", file_name); + g_free(file_name); + } else { + file_uri = g_strdup (uri); + } + + return file_uri; +} diff --git a/calendar/cal-util/cal-util.h b/calendar/cal-util/cal-util.h index 8a5dce9b03..d4ccfb5388 100644 --- a/calendar/cal-util/cal-util.h +++ b/calendar/cal-util/cal-util.h @@ -83,6 +83,8 @@ icaltimezone *cal_util_resolve_tzid (const char *tzid, gpointer data); char *cal_util_priority_to_string (int priority); int cal_util_priority_from_string (const char *string); +char *cal_util_expand_uri (char *uri, gboolean tasks); + END_GNOME_DECLS -- cgit v1.2.3