From fd232f60704b5bf9ff068d39c25318bb21c301df Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Sat, 18 Aug 2001 04:01:50 +0000 Subject: new function to open the task editor to add a new task. 2001-08-17 Damon Chaplin * gui/gnome-cal.c (gnome_calendar_new_task): new function to open the task editor to add a new task. * gui/calendar-commands.c: added new_task_cb() to create a new task in the calendar folder, and added menu commands for it, and a toolbar button (I think that is what Ettore wanted. Maybe he just meant menu commands. Anyway, it is easy to take out.) Note that we don't have a decent icon for 'New Task' for the toolbar. Also added the new Goto button (but we don't have a similar one for the menu command). svn path=/trunk/; revision=12195 --- calendar/ChangeLog | 13 +++++++++++++ calendar/gui/calendar-commands.c | 17 +++++++++++++++++ calendar/gui/gnome-cal.c | 34 ++++++++++++++++++++++++++++++++++ calendar/gui/gnome-cal.h | 2 ++ 4 files changed, 66 insertions(+) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 017a1cea13..5153925678 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,16 @@ +2001-08-17 Damon Chaplin + + * gui/gnome-cal.c (gnome_calendar_new_task): new function to open the + task editor to add a new task. + + * gui/calendar-commands.c: added new_task_cb() to create a new task + in the calendar folder, and added menu commands for it, and a toolbar + button (I think that is what Ettore wanted. Maybe he just meant menu + commands. Anyway, it is easy to take out.) Note that we don't have a + decent icon for 'New Task' for the toolbar. + Also added the new Goto button (but we don't have a similar one for + the menu command). + 2001-08-16 Iain Holmes * gui/Makefile.am: Add the libetimezonedialog.a lib link diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c index b9e1ec7bb4..7c10f906e2 100644 --- a/calendar/gui/calendar-commands.c +++ b/calendar/gui/calendar-commands.c @@ -84,6 +84,15 @@ new_event_cb (BonoboUIComponent *uic, gpointer data, const char *path) gnome_calendar_new_appointment_for (gcal, dtstart, dtend, TRUE); } +static void +new_task_cb (BonoboUIComponent *uic, gpointer data, const char *path) +{ + GnomeCalendar *gcal; + + gcal = GNOME_CALENDAR (data); + gnome_calendar_new_task (gcal); +} + /* Prints the calendar at its current view and time range */ static void print (GnomeCalendar *gcal, gboolean preview) @@ -474,8 +483,11 @@ control_util_set_folder_bar_label (BonoboControl *control, char *label) static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("CalendarPrint", file_print_cb), BONOBO_UI_VERB ("CalendarPrintPreview", file_print_preview_cb), + BONOBO_UI_VERB ("CalendarNewAppointment", new_appointment_cb), BONOBO_UI_VERB ("CalendarNewEvent", new_event_cb), + BONOBO_UI_VERB ("CalendarNewTask", new_task_cb), + BONOBO_UI_VERB ("CalendarSettings", settings_cmd), BONOBO_UI_VERB ("CutEvent", cut_event_cmd), @@ -500,15 +512,20 @@ static BonoboUIVerb verbs [] = { static EPixmap pixmaps [] = { E_PIXMAP ("/menu/File/New/NewFirstItem/NewAppointment", "new_appointment.xpm"), + E_PIXMAP ("/menu/File/New/NewFirstItem/NewTask", "task.xpm"), E_PIXMAP ("/menu/File/Print/Print", "print.xpm"), E_PIXMAP ("/menu/File/Print/PrintPreview", "print-preview.xpm"), E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewAppointment", "new_appointment.xpm"), + E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewEvent", "new_appointment.xpm"), + E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewTask", "task.xpm"), E_PIXMAP ("/menu/ComponentToolsPlaceholder/Tools/CalendarSettings", "configure_16_calendar.xpm"), E_PIXMAP ("/Toolbar/New", "buttons/new_appointment.png"), + E_PIXMAP ("/Toolbar/NewTask", "task.xpm"), E_PIXMAP ("/Toolbar/Print", "buttons/print.png"), E_PIXMAP ("/Toolbar/Prev", "buttons/arrow-left-24.png"), E_PIXMAP ("/Toolbar/Next", "buttons/arrow-right-24.png"), + E_PIXMAP ("/Toolbar/Goto", "buttons/goto-24.png"), E_PIXMAP ("/Toolbar/DayView", "buttons/dayview.xpm"), E_PIXMAP ("/Toolbar/WorkWeekView", "buttons/workweekview.xpm"), E_PIXMAP ("/Toolbar/WeekView", "buttons/weekview.xpm"), diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index e26150a86f..6d0e7cbb53 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -41,6 +41,7 @@ #include #include "widgets/menus/gal-view-menus.h" #include "dialogs/event-editor.h" +#include "dialogs/task-editor.h" #include "e-calendar-table.h" #include "e-day-view.h" #include "e-week-view.h" @@ -1958,6 +1959,39 @@ gnome_calendar_new_appointment (GnomeCalendar *gcal) gnome_calendar_new_appointment_for (gcal, dtstart, dtend, FALSE); } +/** + * gnome_calendar_new_task: + * @gcal: An Evolution calendar. + * + * Opens a task editor dialog for a new task. + **/ +void +gnome_calendar_new_task (GnomeCalendar *gcal) +{ + GnomeCalendarPrivate *priv; + TaskEditor *tedit; + CalComponent *comp; + + g_print ("In gnome_calendar_new_task\n"); + + g_return_if_fail (gcal != NULL); + g_return_if_fail (GNOME_IS_CALENDAR (gcal)); + + priv = gcal->priv; + + tedit = task_editor_new (); + comp_editor_set_cal_client (COMP_EDITOR (tedit), priv->task_pad_client); + + comp = cal_component_new (); + cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO); + + comp_editor_edit_comp (COMP_EDITOR (tedit), comp); + gtk_object_unref (GTK_OBJECT (comp)); + + comp_editor_focus (COMP_EDITOR (tedit)); +} + + /* Returns the selected time range for the current view. Note that this may be different from the fields in the GnomeCalendar, since the view may clip this or choose a more appropriate time. */ diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h index 443a0f38da..4bb232680c 100644 --- a/calendar/gui/gnome-cal.h +++ b/calendar/gui/gnome-cal.h @@ -114,6 +114,8 @@ void gnome_calendar_new_appointment_for (GnomeCalendar *cal, time_t dtstart, time_t dtend, gboolean all_day); +void gnome_calendar_new_task (GnomeCalendar *gcal); + /* Returns the selected time range for the current view. Note that this may be different from the fields in the GnomeCalendar, since the view may clip this or choose a more appropriate time. */ -- cgit v1.2.3