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/ChangeLog | 4 ++++ calendar/Makefile.am | 1 + calendar/gnome-cal.html | 2 ++ calendar/gui/Makefile.am | 1 + calendar/gui/gnome-cal.html | 2 ++ calendar/gui/main.c | 57 ++++++++++++++++++++++++++++++++++++++++++++- calendar/main.c | 57 ++++++++++++++++++++++++++++++++++++++++++++- 7 files changed, 122 insertions(+), 2 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 948146f481..32aa1ba745 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,7 @@ +1999-04-25 Miguel de Icaza + + * main.c (dump_todo): Add --todo flag to dump the todo contents. + 1999-04-19 Miguel de Icaza * gncal-todo.c (add_activated): Use same hack used in edit_activated diff --git a/calendar/Makefile.am b/calendar/Makefile.am index 20f5f37132..8042e05d94 100644 --- a/calendar/Makefile.am +++ b/calendar/Makefile.am @@ -33,6 +33,7 @@ gnomecal_SOURCES = \ gnome-month-item.h \ gnome-cal.c \ gnome-cal.h \ + html-month.c \ goto.c \ layout.c \ layout.h \ diff --git a/calendar/gnome-cal.html b/calendar/gnome-cal.html index eeb8d4e25e..5a7d0a537f 100644 --- a/calendar/gnome-cal.html +++ b/calendar/gnome-cal.html @@ -28,6 +28,8 @@ Several options are available on the command line, they are:
  • --file FILE Set the calendar to the FILE specified on the command line. + +
  • --todo Dumps the to-do values to standard output.

    diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 20f5f37132..8042e05d94 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -33,6 +33,7 @@ gnomecal_SOURCES = \ gnome-month-item.h \ gnome-cal.c \ gnome-cal.h \ + html-month.c \ goto.c \ layout.c \ layout.h \ diff --git a/calendar/gui/gnome-cal.html b/calendar/gui/gnome-cal.html index eeb8d4e25e..5a7d0a537f 100644 --- a/calendar/gui/gnome-cal.html +++ b/calendar/gui/gnome-cal.html @@ -28,6 +28,8 @@ Several options are available on the command line, they are:

  • --file FILE Set the calendar to the FILE specified on the command line. + +
  • --todo Dumps the to-do values to standard output.

    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", diff --git a/calendar/main.c b/calendar/main.c index 76736acfbe..29e0049ae2 100644 --- a/calendar/main.c +++ b/calendar/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 v1.2.3