diff options
author | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-12 08:17:12 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-04-12 08:17:12 +0800 |
commit | fbc607b0edbdc39297d17c0ecc75b45e4bfbb0c8 (patch) | |
tree | fcb69b57676e25f102083069ffc71651dc182e8e /calendar | |
parent | b265b27dfc1e68424d509a17b9c6466adbae3fc9 (diff) | |
download | gsoc2013-evolution-fbc607b0edbdc39297d17c0ecc75b45e4bfbb0c8.tar gsoc2013-evolution-fbc607b0edbdc39297d17c0ecc75b45e4bfbb0c8.tar.gz gsoc2013-evolution-fbc607b0edbdc39297d17c0ecc75b45e4bfbb0c8.tar.bz2 gsoc2013-evolution-fbc607b0edbdc39297d17c0ecc75b45e4bfbb0c8.tar.lz gsoc2013-evolution-fbc607b0edbdc39297d17c0ecc75b45e4bfbb0c8.tar.xz gsoc2013-evolution-fbc607b0edbdc39297d17c0ecc75b45e4bfbb0c8.tar.zst gsoc2013-evolution-fbc607b0edbdc39297d17c0ecc75b45e4bfbb0c8.zip |
Begginning of the create-appointment-on-range-selection-and-enter code -miguel
svn path=/trunk/; revision=127
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/cal-util/calobj.h | 2 | ||||
-rw-r--r-- | calendar/calobj.h | 2 | ||||
-rw-r--r-- | calendar/eventedit.c | 12 | ||||
-rw-r--r-- | calendar/eventedit.h | 1 | ||||
-rw-r--r-- | calendar/gncal-full-day.c | 18 | ||||
-rw-r--r-- | calendar/gnome-cal.c | 59 | ||||
-rw-r--r-- | calendar/gui/eventedit.c | 12 | ||||
-rw-r--r-- | calendar/gui/eventedit.h | 1 | ||||
-rw-r--r-- | calendar/gui/gncal-full-day.c | 18 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 59 | ||||
-rw-r--r-- | calendar/pcs/calobj.h | 2 |
11 files changed, 136 insertions, 50 deletions
diff --git a/calendar/cal-util/calobj.h b/calendar/cal-util/calobj.h index 560c4ca99e..37ea79040d 100644 --- a/calendar/cal-util/calobj.h +++ b/calendar/cal-util/calobj.h @@ -131,6 +131,8 @@ typedef struct { CalendarAlarm malarm; Recurrence *recur; + + int new; } iCalObject; iCalObject *ical_new (char *comment, char *organizer, char *summary); diff --git a/calendar/calobj.h b/calendar/calobj.h index 560c4ca99e..37ea79040d 100644 --- a/calendar/calobj.h +++ b/calendar/calobj.h @@ -131,6 +131,8 @@ typedef struct { CalendarAlarm malarm; Recurrence *recur; + + int new; } iCalObject; iCalObject *ical_new (char *comment, char *organizer, char *summary); diff --git a/calendar/eventedit.c b/calendar/eventedit.c index d87f838f0e..c0cfb1aa81 100644 --- a/calendar/eventedit.c +++ b/calendar/eventedit.c @@ -370,7 +370,7 @@ ee_store_dlg_values_to_ical (EventEditor *ee) /* FIXME: This is not entirely correct; we should check if the values actually changed */ ical->last_mod = now; - if (ee->new_ical) + if (ee->ical->new) ical->created = now; g_free (ical->summary); @@ -382,7 +382,7 @@ ee_ok (GtkWidget *widget, EventEditor *ee) { ee_store_dlg_values_to_ical (ee); - if (ee->new_ical) + if (ee->ical->new) gnome_calendar_add_object (GNOME_CALENDAR (ee->gnome_cal), ee->ical); gtk_widget_destroy (GTK_WIDGET (ee)); @@ -391,7 +391,7 @@ ee_ok (GtkWidget *widget, EventEditor *ee) static void ee_cancel (GtkWidget *widget, EventEditor *ee) { - if (ee->new_ical) + if (ee->ical->new) ical_object_destroy (ee->ical); gtk_widget_destroy (GTK_WIDGET (ee)); } @@ -793,11 +793,9 @@ event_editor_new (GnomeCalendar *gcal, iCalObject *ical) 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; - + ical->new = 1; + } ee->ical = ical; ee->gnome_cal = gcal; event_editor_init_widgets (ee); diff --git a/calendar/eventedit.h b/calendar/eventedit.h index 6de4d09256..82d4c94ecf 100644 --- a/calendar/eventedit.h +++ b/calendar/eventedit.h @@ -52,7 +52,6 @@ typedef struct { /* The associated ical object */ iCalObject *ical; - int new_ical; /* The calendar owner of this event */ GnomeCalendar *gnome_cal; diff --git a/calendar/gncal-full-day.c b/calendar/gncal-full-day.c index acf937f14f..9a14230f92 100644 --- a/calendar/gncal-full-day.c +++ b/calendar/gncal-full-day.c @@ -1469,3 +1469,21 @@ gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper) gncal_full_day_update (fullday); } } + +/* + * Returns the selected range + */ +int +gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper) +{ + struct drag_info *di; + + g_return_val_if_fail (fullday != NULL, 0); + g_return_val_if_fail (GNCAL_IS_FULL_DAY (fullday), 0); + g_return_val_if_fail (lower != NULL, 0); + g_return_val_if_fail (upper != NULL, 0); + + di = fullday->drag_info; + + return 1; +} diff --git a/calendar/gnome-cal.c b/calendar/gnome-cal.c index 18409e3318..00344a79f0 100644 --- a/calendar/gnome-cal.c +++ b/calendar/gnome-cal.c @@ -6,12 +6,14 @@ */ #include <gnome.h> +#include <gdk/gdkkeysyms.h> #include "calendar.h" #include "gnome-cal.h" #include "gncal-full-day.h" #include "gncal-week-view.h" #include "timeutil.h" #include "views.h" +#include "main.h" static void gnome_calendar_init (GnomeCalendar *gcal); @@ -38,6 +40,44 @@ gnome_calendar_get_type (void) } static void +day_view_key_press (GncalFullDay *fday, GdkEventKey *kevent, GnomeCalendar *gcal) +{ + iCalObject *ical; + time_t start, end; + + if (kevent->keyval != GDK_Return) + return; + + /* Create a new event on the selected range */ + ical = ical_new ("", user_name, ""); + ical->new = 1; +/* gncal_full_day_selection_range (gcal->day_view, &ical->dtstart, &ical->dtend); */ + event_editor_new (gcal, ical); +} + +static void +setup_day_view (GnomeCalendar *gcal) +{ + time_t a, b, now; + + now = time (NULL); + a = time_start_of_day (now); + b = time_end_of_day (now); + + gcal->day_view = gncal_full_day_new (gcal, a, b); + gtk_widget_set_events (gcal->day_view, + gtk_widget_get_events (gcal->day_view) | GDK_KEY_PRESS_MASK); + gcal->day_view_container = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (gcal->day_view_container), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_container_add (GTK_CONTAINER (gcal->day_view_container), gcal->day_view); + gtk_widget_show (gcal->day_view); + gtk_signal_connect (GTK_OBJECT (gcal->day_view), "key_press_event", + GTK_SIGNAL_FUNC (day_view_key_press), gcal); +} + +static void setup_widgets (GnomeCalendar *gcal) { time_t now; @@ -49,23 +89,8 @@ setup_widgets (GnomeCalendar *gcal) gcal->year_view = year_view_create (gcal); gcal->task_view = tasks_create (gcal); - if (1) - { - time_t a, b; - - a = time_start_of_day (now); - b = time_end_of_day (now); - - gcal->day_view = gncal_full_day_new (gcal, a, b); - - gcal->day_view_container = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (gcal->day_view_container), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (gcal->day_view_container), gcal->day_view); - gtk_widget_show (gcal->day_view); - } - + setup_day_view (gcal); + gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->day_view_container, gtk_label_new (_("Day View"))); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->week_view, gtk_label_new (_("Week View"))); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view, gtk_label_new (_("Year View"))); diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c index d87f838f0e..c0cfb1aa81 100644 --- a/calendar/gui/eventedit.c +++ b/calendar/gui/eventedit.c @@ -370,7 +370,7 @@ ee_store_dlg_values_to_ical (EventEditor *ee) /* FIXME: This is not entirely correct; we should check if the values actually changed */ ical->last_mod = now; - if (ee->new_ical) + if (ee->ical->new) ical->created = now; g_free (ical->summary); @@ -382,7 +382,7 @@ ee_ok (GtkWidget *widget, EventEditor *ee) { ee_store_dlg_values_to_ical (ee); - if (ee->new_ical) + if (ee->ical->new) gnome_calendar_add_object (GNOME_CALENDAR (ee->gnome_cal), ee->ical); gtk_widget_destroy (GTK_WIDGET (ee)); @@ -391,7 +391,7 @@ ee_ok (GtkWidget *widget, EventEditor *ee) static void ee_cancel (GtkWidget *widget, EventEditor *ee) { - if (ee->new_ical) + if (ee->ical->new) ical_object_destroy (ee->ical); gtk_widget_destroy (GTK_WIDGET (ee)); } @@ -793,11 +793,9 @@ event_editor_new (GnomeCalendar *gcal, iCalObject *ical) 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; - + ical->new = 1; + } ee->ical = ical; ee->gnome_cal = gcal; event_editor_init_widgets (ee); diff --git a/calendar/gui/eventedit.h b/calendar/gui/eventedit.h index 6de4d09256..82d4c94ecf 100644 --- a/calendar/gui/eventedit.h +++ b/calendar/gui/eventedit.h @@ -52,7 +52,6 @@ typedef struct { /* The associated ical object */ iCalObject *ical; - int new_ical; /* The calendar owner of this event */ GnomeCalendar *gnome_cal; diff --git a/calendar/gui/gncal-full-day.c b/calendar/gui/gncal-full-day.c index acf937f14f..9a14230f92 100644 --- a/calendar/gui/gncal-full-day.c +++ b/calendar/gui/gncal-full-day.c @@ -1469,3 +1469,21 @@ gncal_full_day_set_bounds (GncalFullDay *fullday, time_t lower, time_t upper) gncal_full_day_update (fullday); } } + +/* + * Returns the selected range + */ +int +gncal_full_day_selection_range (GncalFullDay *fullday, time_t *lower, time_t *upper) +{ + struct drag_info *di; + + g_return_val_if_fail (fullday != NULL, 0); + g_return_val_if_fail (GNCAL_IS_FULL_DAY (fullday), 0); + g_return_val_if_fail (lower != NULL, 0); + g_return_val_if_fail (upper != NULL, 0); + + di = fullday->drag_info; + + return 1; +} diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 18409e3318..00344a79f0 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -6,12 +6,14 @@ */ #include <gnome.h> +#include <gdk/gdkkeysyms.h> #include "calendar.h" #include "gnome-cal.h" #include "gncal-full-day.h" #include "gncal-week-view.h" #include "timeutil.h" #include "views.h" +#include "main.h" static void gnome_calendar_init (GnomeCalendar *gcal); @@ -38,6 +40,44 @@ gnome_calendar_get_type (void) } static void +day_view_key_press (GncalFullDay *fday, GdkEventKey *kevent, GnomeCalendar *gcal) +{ + iCalObject *ical; + time_t start, end; + + if (kevent->keyval != GDK_Return) + return; + + /* Create a new event on the selected range */ + ical = ical_new ("", user_name, ""); + ical->new = 1; +/* gncal_full_day_selection_range (gcal->day_view, &ical->dtstart, &ical->dtend); */ + event_editor_new (gcal, ical); +} + +static void +setup_day_view (GnomeCalendar *gcal) +{ + time_t a, b, now; + + now = time (NULL); + a = time_start_of_day (now); + b = time_end_of_day (now); + + gcal->day_view = gncal_full_day_new (gcal, a, b); + gtk_widget_set_events (gcal->day_view, + gtk_widget_get_events (gcal->day_view) | GDK_KEY_PRESS_MASK); + gcal->day_view_container = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (gcal->day_view_container), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_container_add (GTK_CONTAINER (gcal->day_view_container), gcal->day_view); + gtk_widget_show (gcal->day_view); + gtk_signal_connect (GTK_OBJECT (gcal->day_view), "key_press_event", + GTK_SIGNAL_FUNC (day_view_key_press), gcal); +} + +static void setup_widgets (GnomeCalendar *gcal) { time_t now; @@ -49,23 +89,8 @@ setup_widgets (GnomeCalendar *gcal) gcal->year_view = year_view_create (gcal); gcal->task_view = tasks_create (gcal); - if (1) - { - time_t a, b; - - a = time_start_of_day (now); - b = time_end_of_day (now); - - gcal->day_view = gncal_full_day_new (gcal, a, b); - - gcal->day_view_container = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (gcal->day_view_container), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_container_add (GTK_CONTAINER (gcal->day_view_container), gcal->day_view); - gtk_widget_show (gcal->day_view); - } - + setup_day_view (gcal); + gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->day_view_container, gtk_label_new (_("Day View"))); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->week_view, gtk_label_new (_("Week View"))); gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->year_view, gtk_label_new (_("Year View"))); diff --git a/calendar/pcs/calobj.h b/calendar/pcs/calobj.h index 560c4ca99e..37ea79040d 100644 --- a/calendar/pcs/calobj.h +++ b/calendar/pcs/calobj.h @@ -131,6 +131,8 @@ typedef struct { CalendarAlarm malarm; Recurrence *recur; + + int new; } iCalObject; iCalObject *ical_new (char *comment, char *organizer, char *summary); |