From 519a5a0b5bf1a1431d0ddbb0605c3b8c84f16977 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Sun, 25 Apr 1999 22:33:47 +0000 Subject: Add --todo support Add --todo support svn path=/trunk/; revision=880 --- calendar/gui/main.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) (limited to 'calendar/gui/main.c') diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 76736acfbe..29e0049ae2 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -77,6 +77,9 @@ static char *load_file; /* If set, show events for the specified date and quit */ static int show_events; +/* If set, show todo items quit */ +static int show_todo; + static void init_username (void) { @@ -439,6 +442,14 @@ save_default_calendar (GnomeCalendar *gcal) save_calendar_cmd (NULL, gcal); } +#if 0 +static void +make_html_cmd (GtkWidget *widget, GtkWidget *gcal) +{ + make_month_html (gcal, "output.html"); +} +#endif + static GnomeUIInfo gnome_cal_file_menu [] = { GNOMEUIINFO_MENU_NEW_ITEM(N_("_New calendar"), N_("Create a new calendar"), @@ -452,6 +463,13 @@ static GnomeUIInfo gnome_cal_file_menu [] = { GNOMEUIINFO_SEPARATOR, +#if 0 + GNOMEUIINFO_ITEM(N_("Create HTML for this month"), + N_("Creates an HTML version of this month's appointments"), + make_html_cmd, NULL); +#endif + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_CLOSE_ITEM(close_cmd, NULL), GNOMEUIINFO_MENU_EXIT_ITEM(quit_cmd, NULL), @@ -596,6 +614,7 @@ enum { USERFILE_KEY = -2, VIEW_KEY = -3, HIDDEN_KEY = -4, + TODO_KEY = -5 }; /* Lists used to startup various GnomeCalendars */ @@ -657,6 +676,34 @@ dump_events (void) exit (0); } +static void +dump_todo (void) +{ + Calendar *cal; + GList *l; + char *s; + + process_dates (); + init_calendar (); + + cal = calendar_new (full_name); + s = calendar_load (cal, load_file ? load_file : user_calendar_file); + if (s){ + printf ("error: %s\n", s); + exit (1); + } + for (l = cal->todo; l; l = l->next){ + iCalObject *object = l->data; + + if (object->type != ICAL_TODO) + continue; + + printf ("[%s]: %s\n", object->organizer, object->summary); + } + calendar_destroy (cal); + exit (0); +} + extern time_t get_date (); static void @@ -695,6 +742,10 @@ parse_an_arg (poptContext ctx, start_calendars = g_list_append (start_calendars, arg); break; + case TODO_KEY: + show_todo = 1; + break; + case 'e': show_events = 1; break; @@ -711,6 +762,8 @@ static const struct poptOption options [] = { { NULL, '\0', POPT_ARG_CALLBACK, parse_an_arg, 0, NULL, NULL }, { "events", 'e', POPT_ARG_NONE, NULL, 'e', N_("Show events and quit"), NULL }, + { "todo", 0, POPT_ARG_NONE, NULL, TODO_KEY, N_("Show TO-DO items and quit"), + NULL }, { "from", 'f', POPT_ARG_STRING, NULL, 'f', N_("Specifies start date [for --events]"), N_("DATE") }, { "file", 'F', POPT_ARG_STRING, NULL, 'F', N_("File to load calendar from"), N_("FILE") }, { "userfile", '\0', POPT_ARG_NONE, NULL, USERFILE_KEY, N_("Load the user calendar"), NULL }, @@ -785,7 +838,9 @@ main(int argc, char *argv[]) if (show_events) dump_events (); - + if (show_todo) + dump_todo (); + client = gnome_master_client (); if (client){ gtk_signal_connect (GTK_OBJECT (client), "save_yourself", -- cgit