diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2002-02-14 21:02:59 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2002-02-14 21:02:59 +0800 |
commit | 378a7c56b720dd4240d192c859737ea19e709fbf (patch) | |
tree | 45f82ede882ca6ad9fa16e0a059e4a0140e7ec03 /calendar | |
parent | de5b206ef73db4f87f19ae4e5b943c28334425a8 (diff) | |
download | gsoc2013-evolution-378a7c56b720dd4240d192c859737ea19e709fbf.tar.gz gsoc2013-evolution-378a7c56b720dd4240d192c859737ea19e709fbf.tar.zst gsoc2013-evolution-378a7c56b720dd4240d192c859737ea19e709fbf.zip |
don't append 'calendar.ics' to the URI. (get_prop): finished.
2002-02-13 Rodrigo Moya <rodrigo@ximian.com>
* gui/control-factory.c (set_prop): don't append 'calendar.ics'
to the URI.
(get_prop): finished.
* gui/tasks-control.c (tasks_control_set_property): don't append
'tasks.ics' to the URI.
(tasks_control_get_property): finished.
* gui/gnome-cal.c (gnome_calendar_open):
* gui/e-tasks.c (e_tasks_open): append $filename.ics to the uri to be
opened if the uri is local. Leave intact in other cases.
svn path=/trunk/; revision=15724
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 14 | ||||
-rw-r--r-- | calendar/gui/control-factory.c | 19 | ||||
-rw-r--r-- | calendar/gui/e-tasks.c | 18 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 21 | ||||
-rw-r--r-- | calendar/gui/tasks-control.c | 17 |
5 files changed, 57 insertions, 32 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index a7a470acce..a3afa5f74b 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,17 @@ +2002-02-13 Rodrigo Moya <rodrigo@ximian.com> + + * gui/control-factory.c (set_prop): don't append 'calendar.ics' + to the URI. + (get_prop): finished. + + * gui/tasks-control.c (tasks_control_set_property): don't append + 'tasks.ics' to the URI. + (tasks_control_get_property): finished. + + * gui/gnome-cal.c (gnome_calendar_open): + * gui/e-tasks.c (e_tasks_open): append $filename.ics to the uri to be + opened if the uri is local. Leave intact in other cases. + 2002-02-08 Damon Chaplin <damon@ximian.com> * gui/comp-util.c (cal_comp_util_compare_event_timezones): check if diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c index f497d633e3..724d5881df 100644 --- a/calendar/gui/control-factory.c +++ b/calendar/gui/control-factory.c @@ -68,17 +68,14 @@ get_prop (BonoboPropertyBag *bag, CORBA_Environment *ev, gpointer user_data) { - /*GnomeCalendar *gcal = user_data;*/ + GnomeCalendar *gcal = user_data; + char *uri; switch (arg_id) { case PROPERTY_CALENDAR_URI_IDX: - /* - if (fb && fb->uri) - BONOBO_ARG_SET_STRING (arg, fb->uri); - else - BONOBO_ARG_SET_STRING (arg, ""); - */ + uri = cal_client_get_uri (gnome_calendar_get_cal_client (gcal)); + BONOBO_ARG_SET_STRING (arg, uri); break; default: @@ -95,14 +92,10 @@ set_prop (BonoboPropertyBag *bag, gpointer user_data) { GnomeCalendar *gcal = user_data; - char *filename; switch (arg_id) { case PROPERTY_CALENDAR_URI_IDX: - filename = g_strdup_printf ("%s/calendar.ics", - BONOBO_ARG_GET_STRING (arg)); - gnome_calendar_open (gcal, filename); /* FIXME: result value -> exception? */ - g_free (filename); + gnome_calendar_open (gcal, BONOBO_ARG_GET_STRING (arg)); /* FIXME: result value -> exception? */ break; default: @@ -156,7 +149,7 @@ control_factory_init (void) factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, control_factory_fn, NULL); bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory)); - + if (factory == NULL) g_error ("I could not register a Calendar control factory."); } diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 2fa52dd652..b9443a2875 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -29,6 +29,7 @@ #include <gal/menus/gal-view-instance.h> #include <gal/menus/gal-view-factory-etable.h> #include <gal/menus/gal-view-etable.h> +#include "e-util/e-url.h" #include "widgets/menus/gal-view-menus.h" #include "dialogs/task-editor.h" #include "cal-search-bar.h" @@ -332,6 +333,8 @@ e_tasks_open (ETasks *tasks, ETasksPrivate *priv; char *config_filename; char *message; + EUri *uri; + char *real_uri; g_return_val_if_fail (tasks != NULL, FALSE); g_return_val_if_fail (E_IS_TASKS (tasks), FALSE); @@ -339,12 +342,21 @@ e_tasks_open (ETasks *tasks, priv = tasks->priv; - message = g_strdup_printf (_("Opening tasks at %s"), file); + uri = e_uri_new (file); + if (!uri || !g_strncasecmp (uri->protocol, "file", 4)) + real_uri = g_concat_dir_and_file (file, "tasks.ics"); + else + real_uri = g_strdup (file); + + message = g_strdup_printf (_("Opening tasks at %s"), real_uri); set_status_message (tasks, message); g_free (message); - if (!cal_client_open_calendar (priv->client, file, FALSE)) { + if (!cal_client_open_calendar (priv->client, real_uri, FALSE)) { g_message ("e_tasks_open(): Could not issue the request"); + g_free (real_uri); + e_uri_free (uri); + return FALSE; } @@ -352,6 +364,8 @@ e_tasks_open (ETasks *tasks, e_calendar_table_load_state (E_CALENDAR_TABLE (priv->tasks_view), config_filename); g_free (config_filename); + g_free (real_uri); + e_uri_free (uri); return TRUE; } diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 8d75a39c75..0799c6a218 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1847,6 +1847,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) gboolean success; EUri *uri; char *message; + char *real_uri; g_return_val_if_fail (gcal != NULL, FALSE); g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE); @@ -1862,20 +1863,28 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_NOT_LOADED, FALSE); - message = g_strdup_printf (_("Opening calendar at %s"), str_uri); + uri = e_uri_new (str_uri); + if (!uri || !g_strncasecmp (uri->protocol, "file", 4)) + real_uri = g_concat_dir_and_file (str_uri, "calendar.ics"); + else + real_uri = g_strdup (str_uri); + + message = g_strdup_printf (_("Opening calendar at %s"), real_uri); e_week_view_set_status_message (E_WEEK_VIEW (priv->week_view), message); g_free (message); - if (!cal_client_open_calendar (priv->client, str_uri, FALSE)) { + if (!cal_client_open_calendar (priv->client, real_uri, FALSE)) { g_message ("gnome_calendar_open(): Could not issue the request"); + g_free (real_uri); + e_uri_free (uri); + return FALSE; } - add_alarms (str_uri); + add_alarms (real_uri); /* Open the appropriate Tasks folder to show in the TaskPad */ - uri = e_uri_new (str_uri); if (!uri) { tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir); success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE); @@ -1912,9 +1921,11 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri) success = TRUE; } - e_uri_free (uri); } + g_free (real_uri); + e_uri_free (uri); + if (!success) { g_message ("gnome_calendar_open(): Could not issue the request"); return FALSE; diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c index 22d87a1e08..08e363fe8e 100644 --- a/calendar/gui/tasks-control.c +++ b/calendar/gui/tasks-control.c @@ -150,17 +150,14 @@ tasks_control_get_property (BonoboPropertyBag *bag, CORBA_Environment *ev, gpointer user_data) { - /*GnomeCalendar *gcal = user_data;*/ + ETasks *tasks = user_data; + char *uri; switch (arg_id) { case TASKS_CONTROL_PROPERTY_URI_IDX: - /* - if (fb && fb->uri) - BONOBO_ARG_SET_STRING (arg, fb->uri); - else - BONOBO_ARG_SET_STRING (arg, ""); - */ + uri = cal_client_get_uri (e_tasks_get_cal_client (tasks)); + BONOBO_ARG_SET_STRING (arg, uri); break; default: @@ -177,15 +174,11 @@ tasks_control_set_property (BonoboPropertyBag *bag, gpointer user_data) { ETasks *tasks = user_data; - char *filename; switch (arg_id) { case TASKS_CONTROL_PROPERTY_URI_IDX: - filename = g_strdup_printf ("%s/tasks.ics", - BONOBO_ARG_GET_STRING (arg)); - e_tasks_open (tasks, filename); - g_free (filename); + e_tasks_open (tasks, BONOBO_ARG_GET_STRING (arg)); break; default: |