aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-03 15:33:34 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-03 15:33:34 +0800
commit45a75ede7ff27645c23cd0b009bf023bea2b6d2f (patch)
treead115a999db4f5a0ecb8073858ce7343ab66a3ca /calendar/gui
parent197ca7ac5bd990427d8c5e7683b6408ffc23f261 (diff)
downloadgsoc2013-evolution-45a75ede7ff27645c23cd0b009bf023bea2b6d2f.tar.gz
gsoc2013-evolution-45a75ede7ff27645c23cd0b009bf023bea2b6d2f.tar.zst
gsoc2013-evolution-45a75ede7ff27645c23cd0b009bf023bea2b6d2f.zip
add test.vcf, more code progress -mig
svn path=/trunk/; revision=100
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/eventedit.c149
-rw-r--r--calendar/gui/eventedit.h6
-rw-r--r--calendar/gui/gncal-full-day.h2
-rw-r--r--calendar/gui/gnome-cal.c2
-rw-r--r--calendar/gui/main.c4
-rw-r--r--calendar/gui/test.vcf40
6 files changed, 186 insertions, 17 deletions
diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c
index c8a5ad58bf..26616f06a0 100644
--- a/calendar/gui/eventedit.c
+++ b/calendar/gui/eventedit.c
@@ -6,6 +6,7 @@
*/
#include <gnome.h>
+#include "calendar.h"
#include "eventedit.h"
#include "main.h"
@@ -62,15 +63,15 @@ static GtkWidget *
event_editor_setup_time_frame (EventEditor *ee)
{
GtkWidget *frame;
- GtkWidget *start_time, *end_time;
+ GtkWidget *start_time, *end_time, *allday, *recur;
GtkTable *t;
frame = gtk_frame_new (_("Time"));
t = GTK_TABLE (ee->general_time_table = gtk_table_new (1, 1, 0));
gtk_container_add (GTK_CONTAINER (frame), ee->general_time_table);
- ee->start_time = start_time = gnome_date_edit_new (0);
- ee->end_time = end_time = gnome_date_edit_new (0);
+ ee->start_time = start_time = gnome_date_edit_new (ee->ical->dtstart);
+ ee->end_time = end_time = gnome_date_edit_new (ee->ical->dtend);
gnome_date_edit_set_popup_range ((GnomeDateEdit *) start_time, day_begin, day_end);
gnome_date_edit_set_popup_range ((GnomeDateEdit *) end_time, day_begin, day_end);
gtk_signal_connect (GTK_OBJECT (start_time), "time_changed",
@@ -78,33 +79,127 @@ event_editor_setup_time_frame (EventEditor *ee)
gtk_table_attach (t, gtk_label_new (_("Start time")), 1, 2, 1, 2, 0, 0, 0, 0);
gtk_table_attach (t, gtk_label_new (_("End time")), 1, 2, 2, 3, 0, 0, 0, 0);
- gtk_table_attach (t, start_time, 2, 3, 1, 2, 0, 0, 0, 0);
- gtk_table_attach (t, end_time, 2, 3, 2, 3, 0, 0, 0, 0);
+ gtk_table_attach (t, start_time, 2, 3, 1, 2, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+ gtk_table_attach (t, end_time, 2, 3, 2, 3, GTK_EXPAND | GTK_FILL, 0, 0, 0);
+
+ allday = gtk_check_button_new_with_label (_("All day event"));
+ gtk_table_attach (t, allday, 3, 4, 1, 2, 0, 0, 0, 0);
+
+ recur = gtk_check_button_new_with_label (_("Recurring event"));
+ gtk_table_attach (t, recur, 3, 4, 2, 3, 0, 0, 0, 0);
+
+ gtk_container_border_width (GTK_CONTAINER (frame), 5);
return frame;
}
static GtkWidget *
-ee_create_buttons ()
+ee_single_alarm (char *text, CalendarAlarm **alarm, void *x)
+{
+ GtkWidget *hbox;
+ GtkWidget *check;
+ GtkWidget *entry;
+
+ hbox = gtk_hbox_new (0, 0);
+
+ check = gtk_check_button_new_with_label (text);
+ entry = gtk_entry_new ();
+ gtk_widget_set_usize (entry, 40, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), check, 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), entry, 0, 0, 0);
+
+ return hbox;
+}
+
+#define FX GTK_FILL | GTK_EXPAND
+static GtkWidget *
+ee_alarm_widgets (EventEditor *ee)
+{
+ GtkWidget *table, *aalarm, *dalarm, *palarm, *malarm, *mailto, *mailte, *l;
+
+ l = gtk_frame_new (_("Alarm"));
+
+ table = gtk_table_new (1, 1, 0);
+ gtk_table_set_row_spacings (GTK_TABLE (table), 3);
+ gtk_container_add (GTK_CONTAINER (l), table);
+
+ mailto = gtk_label_new (_("Mail to:"));
+ mailte = gtk_entry_new ();
+ dalarm = gtk_check_button_new_with_label (_("Display"));
+ aalarm = gtk_check_button_new_with_label (_("Audio"));
+ palarm = gtk_check_button_new_with_label (_("Program"));
+ malarm = gtk_check_button_new_with_label (_("Mail"));
+
+ gtk_table_attach (GTK_TABLE (table), dalarm, 2, 3, 1, 2, FX, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), aalarm, 2, 3, 2, 3, FX, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), palarm, 2, 3, 3, 4, FX, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), malarm, 2, 3, 4, 5, FX, 0, 0, 0);
+#if 0
+ gtk_table_attach (GTK_TABLE (table), mailto, 1, 2, 5, 6, 0, 0, 0, 0);
+ gtk_table_attach (GTK_TABLE (table), mailte, 1, 2, 5, 6, 0, 0, 0, 0);
+#endif
+ return l;
+}
+
+static void
+ee_ok (GtkWidget *widget, EventEditor *ee)
{
- return gtk_label_new ("xx");
+}
+
+static void
+ee_cancel (GtkWidget *widget, EventEditor *ee)
+{
+}
+
+static GtkWidget *
+ee_create_buttons (EventEditor *ee)
+{
+ GtkWidget *box = gtk_hbox_new (1, 5);
+ GtkWidget *ok, *cancel;
+
+ ok = gnome_stock_button (GNOME_STOCK_BUTTON_OK);
+ cancel = gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL);
+
+ gtk_box_pack_start (GTK_BOX (box), ok, 0, 0, 5);
+ gtk_box_pack_start (GTK_BOX (box), cancel, 0, 0, 5);
+
+ gtk_signal_connect (GTK_OBJECT (ok), "clicked", GTK_SIGNAL_FUNC(ee_ok), ee);
+ gtk_signal_connect (GTK_OBJECT (cancel), "clicked", GTK_SIGNAL_FUNC(ee_cancel), ee);
+
+ return box;
+}
+
+/*
+ * Load the contents in a delayed fashion, as the GtkText widget needs it
+ */
+static void
+ee_fill_summary (GtkWidget *widget, EventEditor *ee)
+{
+ int pos = 0;
+
+ gtk_text_freeze (GTK_TEXT (ee->general_summary));
+ gtk_editable_insert_text (GTK_EDITABLE (ee->general_summary), ee->ical->summary,
+ strlen (ee->ical->summary), &pos);
+ gtk_text_thaw (GTK_TEXT (ee->general_summary));
}
enum {
OWNER_LINE,
DESC_LINE,
SUMMARY_LINE,
- TIME_LINE = 4
+ TIME_LINE = 4,
+ ALARM_LINE
};
#define LABEL_SPAN 2
static void
-event_editor_init (EventEditor *ee)
+event_editor_init_widgets (EventEditor *ee)
{
GtkWidget *frame, *l;
ee->hbox = gtk_vbox_new (0, 0);
gtk_container_add (GTK_CONTAINER (ee), ee->hbox);
+ gtk_container_border_width (GTK_CONTAINER (ee), 5);
ee->notebook = gtk_notebook_new ();
gtk_box_pack_start (GTK_BOX (ee->hbox), ee->notebook, 1, 1, 0);
@@ -117,7 +212,7 @@ event_editor_init (EventEditor *ee)
gtk_table_attach (ee->general_table, l,
1, LABEL_SPAN, OWNER_LINE, OWNER_LINE + 1, GTK_FILL|GTK_EXPAND, 0, 0, 6);
- ee->general_owner = gtk_label_new ("");
+ ee->general_owner = gtk_label_new (ee->ical->organizer);
gtk_table_attach (ee->general_table, ee->general_owner,
LABEL_SPAN, LABEL_SPAN + 1, OWNER_LINE, OWNER_LINE + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
@@ -126,6 +221,8 @@ event_editor_init (EventEditor *ee)
1, LABEL_SPAN, DESC_LINE, DESC_LINE + 1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
ee->general_summary = gtk_text_new (NULL, NULL);
+ gtk_signal_connect (GTK_OBJECT (ee->general_summary), "realize",
+ GTK_SIGNAL_FUNC (ee_fill_summary), ee);
gtk_widget_set_usize (ee->general_summary, 0, 60);
gtk_text_set_editable (GTK_TEXT (ee->general_summary), 1);
gtk_table_attach (ee->general_table, ee->general_summary,
@@ -136,11 +233,16 @@ event_editor_init (EventEditor *ee)
1, 40, TIME_LINE + 2, TIME_LINE + 3,
GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ l = ee_alarm_widgets (ee);
+ gtk_table_attach (ee->general_table, l,
+ 1, 40, ALARM_LINE, ALARM_LINE + 1,
+ 0, 0, 0, 0);
+
/* Separator */
gtk_box_pack_start (GTK_BOX (ee->hbox), gtk_hseparator_new (), 1, 1, 0);
/* Buttons */
- gtk_box_pack_start (GTK_BOX (ee->hbox), ee_create_buttons (), 1, 1, 0);
+ gtk_box_pack_start (GTK_BOX (ee->hbox), ee_create_buttons (ee), 0, 0, 5);
/* We show all of the contained widgets */
gtk_widget_show_all (GTK_WIDGET (ee));
@@ -148,11 +250,34 @@ event_editor_init (EventEditor *ee)
gtk_widget_hide (GTK_WIDGET (ee));
}
+static void
+event_editor_init (EventEditor *ee)
+{
+ ee->ical = 0;
+}
+
GtkWidget *
-event_editor_new (void)
+event_editor_new (iCalObject *ical)
{
GtkWidget *retval;
+ EventEditor *ee;
retval = gtk_type_new (event_editor_get_type ());
+ ee = EVENT_EDITOR (retval);
+
+ if (ical == 0){
+ ee->new_ical = 1;
+ ical = ical_new ("Test Comment", user_name, "Test Summary");
+ } else
+ ee->new_ical = 0;
+
+ ee->ical = ical;
+ event_editor_init_widgets (ee);
+
return retval;
}
+
+/*
+ * New event: Create iCal, edit, check result: Ok: insert; Cancel: destroy iCal
+ * Edit event: fetch iCal, edit, check result: Ok: remove from calendar, add to calendar; Cancel: nothing
+ */
diff --git a/calendar/gui/eventedit.h b/calendar/gui/eventedit.h
index edd8059af1..85b5b86790 100644
--- a/calendar/gui/eventedit.h
+++ b/calendar/gui/eventedit.h
@@ -26,13 +26,17 @@ typedef struct {
GtkWidget *general_owner;
GtkWidget *general_summary;
GtkWidget *start_time, *end_time;
+
+ /* The associated ical object */
+ iCalObject *ical;
+ int new_ical;
} EventEditor;
typedef struct {
GnomePropertyBoxClass parent_class;
} EventEditorClass;
-GtkWidget *event_editor_new (void);
+GtkWidget *event_editor_new (iCalObject *);
END_GNOME_DECLS
#endif
diff --git a/calendar/gui/gncal-full-day.h b/calendar/gui/gncal-full-day.h
index e482e8b63d..eeee2278cd 100644
--- a/calendar/gui/gncal-full-day.h
+++ b/calendar/gui/gncal-full-day.h
@@ -37,7 +37,7 @@ struct _GncalFullDay {
};
struct _GncalFullDayClass {
- GtkContainerClass *parent_class;
+ GtkContainerClass parent_class;
};
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 07fb3b03fa..ede2e0825d 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -58,7 +58,7 @@ setup_widgets (GnomeCalendar *gcal)
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), day_view, gtk_label_new (_("Day View")));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), gcal->week_view, gtk_label_new (_("Week View")));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), year_view, gtk_label_new (_("Year View")));
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), task_view, gtk_label_new (_("Tasks")));
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook), task_view, gtk_label_new (_("Todo")));
gtk_widget_show_all (notebook);
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 0c41fb77a5..54fdbaaa2b 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -123,7 +123,7 @@ void
display_objedit (GtkWidget *widget, GnomeCalendar *gcal)
{
if (!gcal->event_editor){
- gcal->event_editor = event_editor_new ();
+ gcal->event_editor = event_editor_new (NULL);
gtk_widget_show (gcal->event_editor);
}
}
@@ -178,7 +178,7 @@ GnomeUIInfo gnome_cal_about_menu [] = {
};
GnomeUIInfo gnome_cal_edit_menu [] = {
- { GNOME_APP_UI_ITEM, N_("Appointment"), NULL, display_objedit },
+ { GNOME_APP_UI_ITEM, N_("New appointment"), NULL, display_objedit },
GNOMEUIINFO_END
};
diff --git a/calendar/gui/test.vcf b/calendar/gui/test.vcf
new file mode 100644
index 0000000000..0e5809021d
--- /dev/null
+++ b/calendar/gui/test.vcf
@@ -0,0 +1,40 @@
+BEGIN:VCALENDAR
+PRODID:-//K Desktop Environment//NONSGML KOrganizer//EN
+TZ:-05
+VERSION:1.0
+BEGIN:VEVENT
+DCREATED:19980402T023552
+UID:KOrganizer - 1804289383
+SEQUENCE:1
+LAST-MODIFIED:19980330T225948
+DTSTART:19980330T120000
+DTEND:19980330T120000
+SUMMARY:asdfasdfasfasdfasdf
+STATUS:NEEDS ACTION
+CLASS:PUBLIC
+PRIORITY:0
+TRANSP:0
+RELATED-TO:0
+X-PILOTID:0
+X-PILOTSTAT:0
+END:VEVENT
+
+BEGIN:VEVENT
+DCREATED:19980402T023558
+UID:KOrganizer - 846930886
+SEQUENCE:1
+LAST-MODIFIED:19980402T023558
+DTSTART:19980402T120000
+DTEND:19980402T120000
+SUMMARY:asdfasfdasfasdfasfd
+STATUS:NEEDS ACTION
+CLASS:PUBLIC
+PRIORITY:0
+TRANSP:0
+RELATED-TO:0
+X-PILOTID:0
+X-PILOTSTAT:0
+END:VEVENT
+
+END:VCALENDAR
+