aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-29 14:49:05 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-29 14:49:05 +0800
commitb14e3c892ce8feac4e72ab80800fb7b6e0408002 (patch)
tree2a102490907ff4a3870b6216e88e79ac966986e5
parent282114a676e69a0b4c0656b3a6266d27165b2039 (diff)
downloadgsoc2013-evolution-b14e3c892ce8feac4e72ab80800fb7b6e0408002.tar
gsoc2013-evolution-b14e3c892ce8feac4e72ab80800fb7b6e0408002.tar.gz
gsoc2013-evolution-b14e3c892ce8feac4e72ab80800fb7b6e0408002.tar.bz2
gsoc2013-evolution-b14e3c892ce8feac4e72ab80800fb7b6e0408002.tar.lz
gsoc2013-evolution-b14e3c892ce8feac4e72ab80800fb7b6e0408002.tar.xz
gsoc2013-evolution-b14e3c892ce8feac4e72ab80800fb7b6e0408002.tar.zst
gsoc2013-evolution-b14e3c892ce8feac4e72ab80800fb7b6e0408002.zip
Added Session management to GnomeCal -miguel
svn path=/trunk/; revision=200
-rw-r--r--calendar/Makefile.am2
-rw-r--r--calendar/gui/Makefile.am2
-rw-r--r--calendar/gui/main.c164
-rw-r--r--calendar/gui/test.vcf153
-rw-r--r--calendar/main.c164
-rw-r--r--calendar/test.vcf153
6 files changed, 392 insertions, 246 deletions
diff --git a/calendar/Makefile.am b/calendar/Makefile.am
index c0d18f5b55..43726a6714 100644
--- a/calendar/Makefile.am
+++ b/calendar/Makefile.am
@@ -1,6 +1,8 @@
SUBDIRS = versit
help_base = $(datadir)/gnome/help/cal
+CFLAGS += -Wall
+
INCLUDES = \
-I$(includedir) \
$(GNOME_INCLUDEDIR) \
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index c0d18f5b55..43726a6714 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -1,6 +1,8 @@
SUBDIRS = versit
help_base = $(datadir)/gnome/help/cal
+CFLAGS += -Wall
+
INCLUDES = \
-I$(includedir) \
$(GNOME_INCLUDEDIR) \
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index f24371d79a..aab8c9947b 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -12,6 +12,7 @@
#include <pwd.h>
#include <sys/types.h>
#include <string.h>
+#include <ctype.h>
#include "alarm.h"
#include "calendar.h"
#include "eventedit.h"
@@ -19,6 +20,8 @@
#include "main.h"
#include "timeutil.h"
+#define COOKIE_USER_HOME_DIR ((char *) -1)
+
/* The username, used to set the `owner' field of the event */
char *user_name;
@@ -40,7 +43,7 @@ int active_calendars = 0;
/* A list of all of the calendars started */
GList *all_calendars = NULL;
-static void new_calendar (char *full_name, char *calendar_file);
+static void new_calendar (char *full_name, char *calendar_file, char *geometry);
/* For dumping part of a calendar */
static time_t from_t, to_t;
@@ -51,9 +54,6 @@ static char *load_file;
/* If set, show events for the specified date and quit */
static int show_events;
-/* Session management */
-static GnomeClient *sm_client;
-
static void
init_username (void)
{
@@ -210,14 +210,14 @@ today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
static void
new_calendar_cmd (GtkWidget *widget, void *data)
{
- new_calendar (full_name, NULL);
+ new_calendar (full_name, NULL, NULL);
}
static void
open_ok (GtkWidget *widget, GtkFileSelection *fs)
{
/* FIXME: find out who owns this calendar and use that name */
- new_calendar ("Somebody", gtk_file_selection_get_filename (fs));
+ new_calendar ("Somebody", gtk_file_selection_get_filename (fs), NULL);
gtk_widget_destroy (GTK_WIDGET (fs));
}
@@ -376,14 +376,21 @@ calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal)
}
static void
-new_calendar (char *full_name, char *calendar_file)
+new_calendar (char *full_name, char *calendar_file, char *geometry)
{
GtkWidget *toplevel;
char *title;
-
+ int xpos, ypos, width, height;
+
title = g_copy_strings (full_name, "'s calendar", NULL);
toplevel = gnome_calendar_new (title);
+ if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)){
+ if (xpos != -1)
+ gtk_widget_set_uposition (toplevel, xpos, ypos);
+ if (width != -1)
+ gtk_widget_set_usize (toplevel, width, height);
+ }
g_free (title);
setup_menu (toplevel);
@@ -410,14 +417,24 @@ process_dates (void)
to_t = time_add_day (from_t, 1);
}
+enum {
+ GEOMETRY_KEY = -1,
+ USERFILE_KEY = -2
+};
+
static struct argp_option argp_options [] = {
- { "events", 'e', NULL, 0, N_("Show events and quit"), 0 },
- { "from", 'f', N_("DATE"), 0, N_("Specifies start date [for --events]"), 1 },
- { "file", 'F', N_("FILE"), 0, N_("File to load calendar from"), 1 },
- { "to", 't', N_("DATE"), 0, N_("Specifies ending date [for --events]"), 1 },
+ { "events", 'e', NULL, 0, N_("Show events and quit"), 0 },
+ { "from", 'f', N_("DATE"), 0, N_("Specifies start date [for --events]"), 1 },
+ { "file", 'F', N_("FILE"), 0, N_("File to load calendar from"), 1 },
+ { "userfile", USERFILE_KEY, NULL, 0, N_("Load the user calendar"), 1 },
+ { "geometry", GEOMETRY_KEY, N_("GEOMETRY"), 0, N_("Geometry for starting up"), 1 },
+ { "to", 't', N_("DATE"), 0, N_("Specifies ending date [for --events]"), 1 },
{ NULL, 0, NULL, 0, NULL, 0 },
};
+static GList *start_calendars;
+static GList *start_geometries;
+
static int
same_day (struct tm *a, struct tm *b)
{
@@ -486,8 +503,21 @@ parse_an_arg (int key, char *arg, struct argp_state *state)
to_t = get_date (arg, NULL);
break;
+ case GEOMETRY_KEY:
+ start_geometries = g_list_append (start_geometries, arg);
+ break;
+
+ case USERFILE_KEY:
+ /* This is a special key that tells the program to load
+ * the user's calendar file. This allows session management
+ * to work even if the User's home directory changes location
+ * (ie, on a networked setup).
+ */
+ arg = COOKIE_USER_HOME_DIR;
+ /* fall trough */
+
case 'F':
- load_file = arg;
+ start_calendars = g_list_append (start_calendars, arg);
break;
case 'e':
@@ -515,53 +545,111 @@ session_die (void)
quit_cmd ();
}
+/*
+ * Save the session callback
+ */
static int
session_save_state (GnomeClient *client, gint phase, GnomeRestartStyle save_style, gint shutdown,
GnomeInteractStyle interact_style, gint fast, gpointer client_data)
{
- printf ("Got a message to save the state\n");
-}
-
-/* Setup the Session Manager shutdown routine */
-static GnomeClient *
-new_client (void)
-{
- GnomeClient *client;
- char buf [4096];
-
- client = gnome_client_new_default ();
- if (client)
- return NULL;
+ char *sess_id;
+ char **argv = (char **) g_malloc ((active_calendars * 4) + 2);
+ GList *l, *free_list = 0;
+ int i;
+
+ sess_id = gnome_client_get_id (client);
- getcwd ((void *)&buf, sizeof (buf));
+ argv [0] = client_data;
+ for (i = 1, l = all_calendars; l; l = l->next){
+ GnomeCalendar *gcal = GNOME_CALENDAR (l->data);
+ int x, y, w, h;
+ char *buffer = g_malloc (32);
+
+ gdk_window_get_origin (GTK_WIDGET (gcal)->window, &x, &y);
+ gdk_window_get_size (GTK_WIDGET (gcal)->window, &w, &h);
+ printf ("X, Y = %d, %d\n", x, y);
+ printf ("w, h = %d, %d\n", w, h);
+ sprintf (buffer, "%dx%d+%d+%d", w, h, x, y);
+
+ if (strcmp (gcal->cal->filename, user_calendar_file) == 0)
+ argv [i++] = "--userfile";
+ else {
+ argv [i++] = "--file";
+ argv [i++] = gcal->cal->filename;
+ }
+ argv [i++] = "--geometry";
+ argv [i++] = buffer;
+ free_list = g_list_append (free_list, buffer);
+ calendar_save (gcal->cal, gcal->cal->filename);
+ }
+ argv [i] = NULL;
+ gnome_client_set_clone_command (client, i, argv);
+ gnome_client_set_restart_command (client, i, argv);
+
+ for (l = free_list; l; l = l->next)
+ g_free (l->data);
+ g_list_free (free_list);
- gtk_object_ref(GTK_OBJECT(client));
- gtk_object_sink(GTK_OBJECT(client));
-
- gtk_signal_connect (GTK_OBJECT (client), "save_yourself",
- GTK_SIGNAL_FUNC (session_save_state), NULL);
- gtk_signal_connect (GTK_OBJECT (client), "die",
- GTK_SIGNAL_FUNC (session_die), NULL);
- return client;
+ return 1;
}
int
main(int argc, char *argv[])
{
+ GnomeClient *client;
+
argp_program_version = VERSION;
bindtextdomain(PACKAGE, GNOMELOCALEDIR);
textdomain(PACKAGE);
+ client = gnome_client_new_default ();
+ if (client){
+ gtk_signal_connect (GTK_OBJECT (client), "save_yourself",
+ GTK_SIGNAL_FUNC (session_save_state), argv [0]);
+ gtk_signal_connect (GTK_OBJECT (client), "die",
+ GTK_SIGNAL_FUNC (session_die), NULL);
+ }
gnome_init ("calendar", &parser, argc, argv, 0, NULL);
- sm_client = new_client ();
-
process_dates ();
alarm_init ();
init_calendar ();
- new_calendar (full_name, load_file ? load_file : user_calendar_file);
+ /*
+ * Load all of the calendars specifies in the command line with
+ * the geometry specificied -if any-
+ */
+ if (start_calendars){
+ GList *p, *g;
+ char *title;
+
+ p = start_calendars;
+ g = start_geometries;
+ while (p){
+ char *file = p->data;
+ char *geometry = g ? g->data : NULL;
+
+ if (file == COOKIE_USER_HOME_DIR)
+ file = user_calendar_file;
+
+ if (strcmp (file, user_calendar_file) == 0)
+ title = full_name;
+ else
+ title = file;
+ new_calendar (title, file, geometry);
+
+ p = p->next;
+ if (g)
+ g = g->next;
+ }
+ g_list_free (p);
+ } else {
+ char *geometry = start_geometries ? start_geometries->data : NULL;
+
+ new_calendar (full_name, user_calendar_file, geometry);
+ }
gtk_main ();
return 0;
}
+
diff --git a/calendar/gui/test.vcf b/calendar/gui/test.vcf
index 4010e70457..bfe93b3c14 100644
--- a/calendar/gui/test.vcf
+++ b/calendar/gui/test.vcf
@@ -1,150 +1,133 @@
BEGIN:VCALENDAR
-
-PRODID:-//K Desktop Environment//NONSGML KOrganizer//EN
-TZ:-05
-VERSION:1.0
-BEGIN:VTODO
-DCREATED:19980402T023552
-UID:KOrganizer - 1804289383
+PRODID:-//GNOME//NONSGML GnomeCalendar//EN
+TZ:MST
+VERSION:0.13
+BEGIN:VEVENT
+UID:KOrganizer - 846930886
SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980415T003000
-DTEND:19980415T010000
-SUMMARY: Semana: Mi, Ju, Vi, Dom (10 veces)
+DTSTART:19980601T150000
+DTEND:19980601T150000
+DCREATED:19980402T023558
+LAST-MODIFIED:19980402T023558
+SUMMARY:Cada dos dias de 06/01 al 07/01
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
-RRULE:W1 WE TH FR SU #10
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VTODO
+RRULE:D2 19980701T140000
+END:VEVENT
BEGIN:VEVENT
-DCREATED:19980402T023552
-UID:KOrganizer - 1804289383
+UID:KOrganizer - 846930886
SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980415T006000
-DTEND:19980415T009000
-SUMMARY:Diario durante 5 dias
+DTSTART:19980501T140000
+DTEND:19980501T140000
+DCREATED:19980402T023558
+LAST-MODIFIED:19980402T023558
+SUMMARY:5 dias.
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
-RRULE:D1 #5
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
+RRULE:D1 #5
END:VEVENT
-BEGIN:VTODO
-DCREATED:19980402T023552
-UID:KOrganizer - 1804289383
+BEGIN:VEVENT
+UID:KOrganizer - 846930886
SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980415T116000
-DTEND:19980415T119000
-SUMMARY:Semanal -- 4 semanas
+DTSTART:19980501T140000
+DTEND:19980501T150000
+DCREATED:19980402T023558
+LAST-MODIFIED:19980429T004635
+SUMMARY:Diariamente de 05/01 al 06/01
STATUS:NEEDS ACTION
-CLASS:PUBLIC
+CLASS:PRIVATE
PRIORITY:0
TRANSP:0
-RRULE:W1 #4
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VTODO
+RRULE:D1 19980601T000000
+END:VEVENT
BEGIN:VEVENT
-DCREATED:19980402T023552
UID:KOrganizer - 1804289383
SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980415T006000
-DTEND:19980415T009000
+DTSTART:19980415T010000
+DTEND:19980415T013000
+DCREATED:19980402T023552
+LAST-MODIFIED:19980330T225948
SUMMARY:Diario durante 5 dias
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
-RRULE:D1 #5
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
+RRULE:D1 #5
END:VEVENT
-BEGIN:VTODO
-DCREATED:19980402T023558
-UID:KOrganizer - 846930886
+BEGIN:VEVENT
+UID:KOrganizer - 1804289383
SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980415T140000
-DTEND:19980415T160000
-SUMMARY:Normal
+DTSTART:19980415T010000
+DTEND:19980415T013000
+DCREATED:19980402T023552
+LAST-MODIFIED:19980330T225948
+SUMMARY:Diario durante 5 dias
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VTODO
+RRULE:D1 #5
+END:VEVENT
-BEGIN:VEVENT
-DCREATED:19980402T023558
+BEGIN:VTODO
UID:KOrganizer - 846930886
SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980501T140000
-DTEND:19980501T140000
-RRULE:D1 19980601T140000
-SUMMARY:Diariamente de 05/01 al 06/01
+DTSTART:19980415T140000
+DUE:19691231T180000
+DCREATED:19980402T023558
+LAST-MODIFIED:19980402T023558
+SUMMARY:Normal
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
+END:VTODO
-BEGIN:VEVENT
-DCREATED:19980402T023558
-UID:KOrganizer - 846930886
+BEGIN:VTODO
+UID:KOrganizer - 1804289383
SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980501T140000
-DTEND:19980501T140000
-RRULE:D1 #5
-SUMMARY:5 dias.
+DTSTART:19980415T120000
+DUE:19691231T180000
+DCREATED:19980402T023552
+LAST-MODIFIED:19980330T225948
+SUMMARY:Semanal -- 4 semanas
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
+RRULE:W1 WE #4
+END:VTODO
-BEGIN:VEVENT
-DCREATED:19980402T023558
-UID:KOrganizer - 846930886
+BEGIN:VTODO
+UID:KOrganizer - 1804289383
SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980601T150000
-DTEND:19980601T150000
-RRULE:D2 19980701T140000
-SUMMARY:Cada dos dias de 06/01 al 07/01
+DTSTART:19980415T003000
+DUE:19691231T180000
+DCREATED:19980402T023552
+LAST-MODIFIED:19980330T225948
+SUMMARY:Semana: Mi, Ju, Vi, Dom (10 veces)
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
+RRULE:W1 SU WE TH FR #10
+END:VTODO
END:VCALENDAR
diff --git a/calendar/main.c b/calendar/main.c
index f24371d79a..aab8c9947b 100644
--- a/calendar/main.c
+++ b/calendar/main.c
@@ -12,6 +12,7 @@
#include <pwd.h>
#include <sys/types.h>
#include <string.h>
+#include <ctype.h>
#include "alarm.h"
#include "calendar.h"
#include "eventedit.h"
@@ -19,6 +20,8 @@
#include "main.h"
#include "timeutil.h"
+#define COOKIE_USER_HOME_DIR ((char *) -1)
+
/* The username, used to set the `owner' field of the event */
char *user_name;
@@ -40,7 +43,7 @@ int active_calendars = 0;
/* A list of all of the calendars started */
GList *all_calendars = NULL;
-static void new_calendar (char *full_name, char *calendar_file);
+static void new_calendar (char *full_name, char *calendar_file, char *geometry);
/* For dumping part of a calendar */
static time_t from_t, to_t;
@@ -51,9 +54,6 @@ static char *load_file;
/* If set, show events for the specified date and quit */
static int show_events;
-/* Session management */
-static GnomeClient *sm_client;
-
static void
init_username (void)
{
@@ -210,14 +210,14 @@ today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
static void
new_calendar_cmd (GtkWidget *widget, void *data)
{
- new_calendar (full_name, NULL);
+ new_calendar (full_name, NULL, NULL);
}
static void
open_ok (GtkWidget *widget, GtkFileSelection *fs)
{
/* FIXME: find out who owns this calendar and use that name */
- new_calendar ("Somebody", gtk_file_selection_get_filename (fs));
+ new_calendar ("Somebody", gtk_file_selection_get_filename (fs), NULL);
gtk_widget_destroy (GTK_WIDGET (fs));
}
@@ -376,14 +376,21 @@ calendar_close_event (GtkWidget *widget, GdkEvent *event, GnomeCalendar *gcal)
}
static void
-new_calendar (char *full_name, char *calendar_file)
+new_calendar (char *full_name, char *calendar_file, char *geometry)
{
GtkWidget *toplevel;
char *title;
-
+ int xpos, ypos, width, height;
+
title = g_copy_strings (full_name, "'s calendar", NULL);
toplevel = gnome_calendar_new (title);
+ if (gnome_parse_geometry (geometry, &xpos, &ypos, &width, &height)){
+ if (xpos != -1)
+ gtk_widget_set_uposition (toplevel, xpos, ypos);
+ if (width != -1)
+ gtk_widget_set_usize (toplevel, width, height);
+ }
g_free (title);
setup_menu (toplevel);
@@ -410,14 +417,24 @@ process_dates (void)
to_t = time_add_day (from_t, 1);
}
+enum {
+ GEOMETRY_KEY = -1,
+ USERFILE_KEY = -2
+};
+
static struct argp_option argp_options [] = {
- { "events", 'e', NULL, 0, N_("Show events and quit"), 0 },
- { "from", 'f', N_("DATE"), 0, N_("Specifies start date [for --events]"), 1 },
- { "file", 'F', N_("FILE"), 0, N_("File to load calendar from"), 1 },
- { "to", 't', N_("DATE"), 0, N_("Specifies ending date [for --events]"), 1 },
+ { "events", 'e', NULL, 0, N_("Show events and quit"), 0 },
+ { "from", 'f', N_("DATE"), 0, N_("Specifies start date [for --events]"), 1 },
+ { "file", 'F', N_("FILE"), 0, N_("File to load calendar from"), 1 },
+ { "userfile", USERFILE_KEY, NULL, 0, N_("Load the user calendar"), 1 },
+ { "geometry", GEOMETRY_KEY, N_("GEOMETRY"), 0, N_("Geometry for starting up"), 1 },
+ { "to", 't', N_("DATE"), 0, N_("Specifies ending date [for --events]"), 1 },
{ NULL, 0, NULL, 0, NULL, 0 },
};
+static GList *start_calendars;
+static GList *start_geometries;
+
static int
same_day (struct tm *a, struct tm *b)
{
@@ -486,8 +503,21 @@ parse_an_arg (int key, char *arg, struct argp_state *state)
to_t = get_date (arg, NULL);
break;
+ case GEOMETRY_KEY:
+ start_geometries = g_list_append (start_geometries, arg);
+ break;
+
+ case USERFILE_KEY:
+ /* This is a special key that tells the program to load
+ * the user's calendar file. This allows session management
+ * to work even if the User's home directory changes location
+ * (ie, on a networked setup).
+ */
+ arg = COOKIE_USER_HOME_DIR;
+ /* fall trough */
+
case 'F':
- load_file = arg;
+ start_calendars = g_list_append (start_calendars, arg);
break;
case 'e':
@@ -515,53 +545,111 @@ session_die (void)
quit_cmd ();
}
+/*
+ * Save the session callback
+ */
static int
session_save_state (GnomeClient *client, gint phase, GnomeRestartStyle save_style, gint shutdown,
GnomeInteractStyle interact_style, gint fast, gpointer client_data)
{
- printf ("Got a message to save the state\n");
-}
-
-/* Setup the Session Manager shutdown routine */
-static GnomeClient *
-new_client (void)
-{
- GnomeClient *client;
- char buf [4096];
-
- client = gnome_client_new_default ();
- if (client)
- return NULL;
+ char *sess_id;
+ char **argv = (char **) g_malloc ((active_calendars * 4) + 2);
+ GList *l, *free_list = 0;
+ int i;
+
+ sess_id = gnome_client_get_id (client);
- getcwd ((void *)&buf, sizeof (buf));
+ argv [0] = client_data;
+ for (i = 1, l = all_calendars; l; l = l->next){
+ GnomeCalendar *gcal = GNOME_CALENDAR (l->data);
+ int x, y, w, h;
+ char *buffer = g_malloc (32);
+
+ gdk_window_get_origin (GTK_WIDGET (gcal)->window, &x, &y);
+ gdk_window_get_size (GTK_WIDGET (gcal)->window, &w, &h);
+ printf ("X, Y = %d, %d\n", x, y);
+ printf ("w, h = %d, %d\n", w, h);
+ sprintf (buffer, "%dx%d+%d+%d", w, h, x, y);
+
+ if (strcmp (gcal->cal->filename, user_calendar_file) == 0)
+ argv [i++] = "--userfile";
+ else {
+ argv [i++] = "--file";
+ argv [i++] = gcal->cal->filename;
+ }
+ argv [i++] = "--geometry";
+ argv [i++] = buffer;
+ free_list = g_list_append (free_list, buffer);
+ calendar_save (gcal->cal, gcal->cal->filename);
+ }
+ argv [i] = NULL;
+ gnome_client_set_clone_command (client, i, argv);
+ gnome_client_set_restart_command (client, i, argv);
+
+ for (l = free_list; l; l = l->next)
+ g_free (l->data);
+ g_list_free (free_list);
- gtk_object_ref(GTK_OBJECT(client));
- gtk_object_sink(GTK_OBJECT(client));
-
- gtk_signal_connect (GTK_OBJECT (client), "save_yourself",
- GTK_SIGNAL_FUNC (session_save_state), NULL);
- gtk_signal_connect (GTK_OBJECT (client), "die",
- GTK_SIGNAL_FUNC (session_die), NULL);
- return client;
+ return 1;
}
int
main(int argc, char *argv[])
{
+ GnomeClient *client;
+
argp_program_version = VERSION;
bindtextdomain(PACKAGE, GNOMELOCALEDIR);
textdomain(PACKAGE);
+ client = gnome_client_new_default ();
+ if (client){
+ gtk_signal_connect (GTK_OBJECT (client), "save_yourself",
+ GTK_SIGNAL_FUNC (session_save_state), argv [0]);
+ gtk_signal_connect (GTK_OBJECT (client), "die",
+ GTK_SIGNAL_FUNC (session_die), NULL);
+ }
gnome_init ("calendar", &parser, argc, argv, 0, NULL);
- sm_client = new_client ();
-
process_dates ();
alarm_init ();
init_calendar ();
- new_calendar (full_name, load_file ? load_file : user_calendar_file);
+ /*
+ * Load all of the calendars specifies in the command line with
+ * the geometry specificied -if any-
+ */
+ if (start_calendars){
+ GList *p, *g;
+ char *title;
+
+ p = start_calendars;
+ g = start_geometries;
+ while (p){
+ char *file = p->data;
+ char *geometry = g ? g->data : NULL;
+
+ if (file == COOKIE_USER_HOME_DIR)
+ file = user_calendar_file;
+
+ if (strcmp (file, user_calendar_file) == 0)
+ title = full_name;
+ else
+ title = file;
+ new_calendar (title, file, geometry);
+
+ p = p->next;
+ if (g)
+ g = g->next;
+ }
+ g_list_free (p);
+ } else {
+ char *geometry = start_geometries ? start_geometries->data : NULL;
+
+ new_calendar (full_name, user_calendar_file, geometry);
+ }
gtk_main ();
return 0;
}
+
diff --git a/calendar/test.vcf b/calendar/test.vcf
index 4010e70457..bfe93b3c14 100644
--- a/calendar/test.vcf
+++ b/calendar/test.vcf
@@ -1,150 +1,133 @@
BEGIN:VCALENDAR
-
-PRODID:-//K Desktop Environment//NONSGML KOrganizer//EN
-TZ:-05
-VERSION:1.0
-BEGIN:VTODO
-DCREATED:19980402T023552
-UID:KOrganizer - 1804289383
+PRODID:-//GNOME//NONSGML GnomeCalendar//EN
+TZ:MST
+VERSION:0.13
+BEGIN:VEVENT
+UID:KOrganizer - 846930886
SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980415T003000
-DTEND:19980415T010000
-SUMMARY: Semana: Mi, Ju, Vi, Dom (10 veces)
+DTSTART:19980601T150000
+DTEND:19980601T150000
+DCREATED:19980402T023558
+LAST-MODIFIED:19980402T023558
+SUMMARY:Cada dos dias de 06/01 al 07/01
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
-RRULE:W1 WE TH FR SU #10
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VTODO
+RRULE:D2 19980701T140000
+END:VEVENT
BEGIN:VEVENT
-DCREATED:19980402T023552
-UID:KOrganizer - 1804289383
+UID:KOrganizer - 846930886
SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980415T006000
-DTEND:19980415T009000
-SUMMARY:Diario durante 5 dias
+DTSTART:19980501T140000
+DTEND:19980501T140000
+DCREATED:19980402T023558
+LAST-MODIFIED:19980402T023558
+SUMMARY:5 dias.
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
-RRULE:D1 #5
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
+RRULE:D1 #5
END:VEVENT
-BEGIN:VTODO
-DCREATED:19980402T023552
-UID:KOrganizer - 1804289383
+BEGIN:VEVENT
+UID:KOrganizer - 846930886
SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980415T116000
-DTEND:19980415T119000
-SUMMARY:Semanal -- 4 semanas
+DTSTART:19980501T140000
+DTEND:19980501T150000
+DCREATED:19980402T023558
+LAST-MODIFIED:19980429T004635
+SUMMARY:Diariamente de 05/01 al 06/01
STATUS:NEEDS ACTION
-CLASS:PUBLIC
+CLASS:PRIVATE
PRIORITY:0
TRANSP:0
-RRULE:W1 #4
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VTODO
+RRULE:D1 19980601T000000
+END:VEVENT
BEGIN:VEVENT
-DCREATED:19980402T023552
UID:KOrganizer - 1804289383
SEQUENCE:1
-LAST-MODIFIED:19980330T225948
-DTSTART:19980415T006000
-DTEND:19980415T009000
+DTSTART:19980415T010000
+DTEND:19980415T013000
+DCREATED:19980402T023552
+LAST-MODIFIED:19980330T225948
SUMMARY:Diario durante 5 dias
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
-RRULE:D1 #5
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
+RRULE:D1 #5
END:VEVENT
-BEGIN:VTODO
-DCREATED:19980402T023558
-UID:KOrganizer - 846930886
+BEGIN:VEVENT
+UID:KOrganizer - 1804289383
SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980415T140000
-DTEND:19980415T160000
-SUMMARY:Normal
+DTSTART:19980415T010000
+DTEND:19980415T013000
+DCREATED:19980402T023552
+LAST-MODIFIED:19980330T225948
+SUMMARY:Diario durante 5 dias
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VTODO
+RRULE:D1 #5
+END:VEVENT
-BEGIN:VEVENT
-DCREATED:19980402T023558
+BEGIN:VTODO
UID:KOrganizer - 846930886
SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980501T140000
-DTEND:19980501T140000
-RRULE:D1 19980601T140000
-SUMMARY:Diariamente de 05/01 al 06/01
+DTSTART:19980415T140000
+DUE:19691231T180000
+DCREATED:19980402T023558
+LAST-MODIFIED:19980402T023558
+SUMMARY:Normal
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
+END:VTODO
-BEGIN:VEVENT
-DCREATED:19980402T023558
-UID:KOrganizer - 846930886
+BEGIN:VTODO
+UID:KOrganizer - 1804289383
SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980501T140000
-DTEND:19980501T140000
-RRULE:D1 #5
-SUMMARY:5 dias.
+DTSTART:19980415T120000
+DUE:19691231T180000
+DCREATED:19980402T023552
+LAST-MODIFIED:19980330T225948
+SUMMARY:Semanal -- 4 semanas
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
+RRULE:W1 WE #4
+END:VTODO
-BEGIN:VEVENT
-DCREATED:19980402T023558
-UID:KOrganizer - 846930886
+BEGIN:VTODO
+UID:KOrganizer - 1804289383
SEQUENCE:1
-LAST-MODIFIED:19980402T023558
-DTSTART:19980601T150000
-DTEND:19980601T150000
-RRULE:D2 19980701T140000
-SUMMARY:Cada dos dias de 06/01 al 07/01
+DTSTART:19980415T003000
+DUE:19691231T180000
+DCREATED:19980402T023552
+LAST-MODIFIED:19980330T225948
+SUMMARY:Semana: Mi, Ju, Vi, Dom (10 veces)
STATUS:NEEDS ACTION
CLASS:PUBLIC
PRIORITY:0
TRANSP:0
RELATED-TO:0
-X-PILOTID:0
-X-PILOTSTAT:0
-END:VEVENT
+RRULE:W1 SU WE TH FR #10
+END:VTODO
END:VCALENDAR