aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-12 07:32:49 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-12 07:32:49 +0800
commitb265b27dfc1e68424d509a17b9c6466adbae3fc9 (patch)
tree1e51ab8e242cdba68272961308da8be4ef1f628a /calendar/gui
parent5f869ecc19985407b08a29f03afbad7a37e1a43f (diff)
downloadgsoc2013-evolution-b265b27dfc1e68424d509a17b9c6466adbae3fc9.tar
gsoc2013-evolution-b265b27dfc1e68424d509a17b9c6466adbae3fc9.tar.gz
gsoc2013-evolution-b265b27dfc1e68424d509a17b9c6466adbae3fc9.tar.bz2
gsoc2013-evolution-b265b27dfc1e68424d509a17b9c6466adbae3fc9.tar.lz
gsoc2013-evolution-b265b27dfc1e68424d509a17b9c6466adbae3fc9.tar.xz
gsoc2013-evolution-b265b27dfc1e68424d509a17b9c6466adbae3fc9.tar.zst
gsoc2013-evolution-b265b27dfc1e68424d509a17b9c6466adbae3fc9.zip
More work on the recurrence dialog box, day navigation -mig
svn path=/trunk/; revision=126
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/eventedit.c141
-rw-r--r--calendar/gui/eventedit.h6
-rw-r--r--calendar/gui/gnome-cal.c36
-rw-r--r--calendar/gui/gnome-cal.h1
4 files changed, 98 insertions, 86 deletions
diff --git a/calendar/gui/eventedit.c b/calendar/gui/eventedit.c
index ac11841581..d87f838f0e 100644
--- a/calendar/gui/eventedit.c
+++ b/calendar/gui/eventedit.c
@@ -509,45 +509,24 @@ recurrence_toggled (GtkRadioButton *radio, EventEditor *ee)
if (!GTK_TOGGLE_BUTTON (radio)->active)
return;
- {
- GtkWidget *child = GTK_BIN (ee->recur_content)->child;
-
- if (child){
- gtk_widget_ref (child);
- gtk_container_remove (GTK_CONTAINER (ee->recur_content), child);
- }
- }
- printf ("Aņadiendo\n");
for (which = 0; list; list = list->next, which++){
if (list->data == radio){
- GtkWidget *w;
-
- switch (which){
- case 3:
- w = ee->recur_content_daily;
- break;
- case 2:
- w = ee->recur_content_weekly;
- break;
- case 1:
- w = ee->recur_content_monthly;
- break;
- default:
- return;
- }
- printf ("Aņadiendo\n");
- gtk_widget_show_all (w);
- gtk_container_add (GTK_CONTAINER (ee->recur_content), w);
+ gtk_notebook_set_page (GTK_NOTEBOOK (ee->recur_content), 3-which);
+ return;
}
}
}
static GtkWidget *
-small_entry (void)
+small_entry (int v)
{
GtkWidget *entry = gtk_entry_new ();
-
+ char buffer [40];
+
+ sprintf (buffer, "%d", v);
gtk_widget_set_usize (GTK_WIDGET (entry), gdk_string_width (entry->style->font, "WWW"), 0);
+ gtk_entry_set_text (GTK_ENTRY (entry), buffer);
+ gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
return entry;
}
@@ -636,45 +615,72 @@ ee_rp_init_frequency (EventEditor *ee)
{
char *day_names [] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
GtkWidget *r, *re, *r1, *f, *vbox, *hbox, *content, *week_hbox, *week_day, *w;
+ GtkWidget *daily, *weekly, *monthly, *yearly;
+ GtkNotebook *notebook;
GSList *group;
- int i;
+ int i, page, day_period, week_period, month_period, year_period;
f = gtk_frame_new (_("Frequency"));
vbox = gtk_vbox_new (0, 0);
hbox = gtk_hbox_new (0, 0);
- ee->recur_content = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
+ ee->recur_content = gtk_notebook_new ();
+ notebook = (GtkNotebook *) ee->recur_content;
+
gtk_container_add (GTK_CONTAINER (f), hbox);
gtk_box_pack_start (GTK_BOX (hbox), vbox, 0, 0, 0);
gtk_box_pack_start (GTK_BOX (hbox), gtk_vseparator_new (), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (hbox), ee->recur_content, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), ee->recur_content, TRUE, TRUE, 10);
+
+ day_period = 1;
+ week_period = 1;
+ month_period = 1;
+ year_period = 1;
+
+ /* Determine which should be the default selection */
+ if (ee->ical->recur){
+ enum RecurType type = ee->ical->recur->type;
+ int freq = ee->ical->recur->frequency;
+
+ switch (type){
+ case RECUR_DAILY: page = 0; day_period = freq; break;
+ case RECUR_WEEKLY: page = 1; week_period = freq; break;
+ case RECUR_MONTHLY_BY_POS: page = 2; month_period = freq; break;
+ case RECUR_MONTHLY_BY_DAY: page = 2; month_period = freq; break;
+ case RECUR_YEARLY_BY_MONTH: page = 3; year_period = freq; break;
+ case RECUR_YEARLY_BY_DAY: page = 4; year_period = freq; break;
+ }
+ } else {
+ page = 0;
+ }
/* The recureency selector */
for (i = 0, group = NULL; recurrence_types [i].name; i++){
r = gtk_radio_button_new_with_label (group, _(recurrence_types [i].name));
group = gtk_radio_button_group (GTK_RADIO_BUTTON (r));
- gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (r), i == 0);
+
+ gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (r), i == page);
gtk_signal_connect (GTK_OBJECT (r), "toggled", GTK_SIGNAL_FUNC (recurrence_toggled), ee);
gtk_box_pack_start_defaults (GTK_BOX (vbox), r);
}
ee->recur_group = group;
/* 1. The daily recurrence */
- ee->recur_content_daily = gtk_hbox_new (0, 0);
- ee->recur_day_period = small_entry ();
- gtk_box_pack_start (GTK_BOX (ee->recur_content_daily), gtk_label_new (_("Every")), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (ee->recur_content_daily), ee->recur_day_period, 0, 0, 5);
- gtk_box_pack_start (GTK_BOX (ee->recur_content_daily), gtk_label_new (_("day(s)")), 0, 0, 0);
+ daily = gtk_hbox_new (0, 0);
+ ee->recur_day_period = small_entry (day_period);
+ gtk_box_pack_start (GTK_BOX (daily), gtk_label_new (_("Every")), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (daily), ee->recur_day_period, 0, 0, 5);
+ gtk_box_pack_start (GTK_BOX (daily), gtk_label_new (_("day(s)")), 0, 0, 0);
/* 2. The weekly recurrence */
- ee->recur_content_weekly = gtk_vbox_new (0, 0);
+ weekly = gtk_vbox_new (0, 0);
week_hbox = gtk_hbox_new (0, 0);
/* 2.1 The week period selector */
- ee->recur_week_period = small_entry ();
+ ee->recur_week_period = small_entry (week_period);
gtk_box_pack_start (GTK_BOX (week_hbox), gtk_label_new _("Every"), 0, 0, 0);
gtk_box_pack_start (GTK_BOX (week_hbox), ee->recur_week_period, 0, 0, 5);
gtk_box_pack_start (GTK_BOX (week_hbox), gtk_label_new (_("week(s)")), 0, 0, 0);
- gtk_box_pack_start (GTK_BOX (ee->recur_content_weekly), week_hbox, 1, 1, 0);
+ gtk_box_pack_start (GTK_BOX (weekly), week_hbox, 1, 1, 0);
/* 2.2 The week day selector */
week_day = gtk_hbox_new (0, 0);
@@ -682,48 +688,63 @@ ee_rp_init_frequency (EventEditor *ee)
ee->recur_week_days [i] = gtk_check_button_new_with_label (_(day_names [i]));
gtk_box_pack_start (GTK_BOX (week_day), ee->recur_week_days [i], 1, 1, 5);
}
- gtk_box_pack_start (GTK_BOX (ee->recur_content_weekly), week_day, 1, 1, 0);
+ gtk_box_pack_start (GTK_BOX (weekly), week_day, 1, 1, 0);
/* 3. The monthly recurrence */
- ee->recur_content_monthly = gtk_table_new (0, 0, 0);
+ monthly = gtk_table_new (0, 0, 0);
re = gtk_radio_button_new_with_label (NULL, _("Recur on the"));
ee->recur_month_date = make_day_list_widget (numeral_day_names);
w = gtk_label_new (_("day"));
- gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
- gtk_table_attach (GTK_TABLE (ee->recur_content_monthly), re,
+ gtk_table_attach (GTK_TABLE (monthly), re,
0, 1, 0, 1, 0, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (ee->recur_content_monthly), ee->recur_month_date,
+ gtk_table_attach (GTK_TABLE (monthly), ee->recur_month_date,
1, 2, 0, 1, 0, 0, 5, 0);
- gtk_table_attach (GTK_TABLE (ee->recur_content_monthly), w,
+ gtk_table_attach (GTK_TABLE (monthly), w,
2, 3, 0, 1, 0, 0, 0, 0);
gtk_signal_connect (GTK_OBJECT (re), "toggled", GTK_SIGNAL_FUNC (recur_month_enable_date), ee);
r1 = gtk_radio_button_new_with_label (gtk_radio_button_group (GTK_RADIO_BUTTON (r)), _("Recur on the"));
ee->recur_month_day = make_day_list_widget (numeral_day_names);
ee->recur_month_weekday = make_day_list_widget (weekday_names);
- gtk_table_attach (GTK_TABLE (ee->recur_content_monthly), r1,
+ gtk_table_attach (GTK_TABLE (monthly), r1,
0, 1, 1, 2, 0, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (ee->recur_content_monthly), ee->recur_month_day,
+ gtk_table_attach (GTK_TABLE (monthly), ee->recur_month_day,
1, 2, 1, 2, 0, 0, 5, 0);
- gtk_table_attach (GTK_TABLE (ee->recur_content_monthly), ee->recur_month_weekday,
+ gtk_table_attach (GTK_TABLE (monthly), ee->recur_month_weekday,
2, 3, 1, 2, 0, 0, 5, 0);
- month_sensitize (ee, 0);
-
-/* recurrence_toggled (GTK_RADIO_BUTTON (r), ee); */
- gtk_container_add (GTK_CONTAINER (ee->recur_content), gtk_label_new ("hola!"));
- gtk_widget_show_all (ee->recur_content);
+ gtk_table_attach (GTK_TABLE (monthly), gtk_label_new (_("Every")),
+ 3, 4, 0, 2, 0, 0, 0, 0);
+ ee->recur_month_period = small_entry (month_period);
+ gtk_table_attach (GTK_TABLE (monthly), ee->recur_month_period,
+ 4, 5, 0, 2, 0, 0, 5, 0);
+ gtk_table_attach (GTK_TABLE (monthly), gtk_label_new (_("month(s)")),
+ 5, 6, 0, 2, 0, 0, 0, 0);
+ /* 4. The yearly recurrence */
+ yearly = gtk_hbox_new (0, 0);
+ ee->recur_year_period = small_entry (year_period);
+ gtk_box_pack_start (GTK_BOX (yearly), gtk_label_new (_("Every")), 0, 0, 0);
+ gtk_box_pack_start (GTK_BOX (yearly), ee->recur_year_period, 0, 0, 5);
+ gtk_box_pack_start (GTK_BOX (yearly), gtk_label_new (_("year(s)")), 0, 0, 0);
+
+ /* Finish setting this up */
+ gtk_notebook_append_page (notebook, daily, gtk_label_new (""));
+ gtk_notebook_append_page (notebook, weekly, gtk_label_new (""));
+ gtk_notebook_append_page (notebook, monthly, gtk_label_new (""));
+ gtk_notebook_append_page (notebook, yearly, gtk_label_new (""));
+ gtk_notebook_set_show_tabs (notebook, FALSE);
+ gtk_notebook_set_show_border (notebook, FALSE);
+
+ gtk_notebook_set_page (notebook, page);
/* Attach to the main table */
- gtk_table_attach (GTK_TABLE (ee->recur_table), f,
- 0, 1, 0, 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, 0, 0);
-}
+ gtk_box_pack_start (GTK_BOX (ee->recur_table), f, 1, 0, 0);
+};
static void
ee_init_recurrent_page (EventEditor *ee)
{
- ee->recur_table = gtk_table_new (1, 1, 0);
+ ee->recur_table = gtk_vbox_new (0, 0);
gtk_notebook_append_page (GTK_NOTEBOOK (ee->notebook), GTK_WIDGET (ee->recur_table),
gtk_label_new (_("Repeating")));
ee_rp_init_frequency (ee);
diff --git a/calendar/gui/eventedit.h b/calendar/gui/eventedit.h
index c2d5d1123f..6de4d09256 100644
--- a/calendar/gui/eventedit.h
+++ b/calendar/gui/eventedit.h
@@ -38,17 +38,17 @@ typedef struct {
GSList *recur_group;
GtkWidget *recur_content;
- GtkWidget *recur_content_daily;
GtkWidget *recur_day_period; /* GtkEntry */
- GtkWidget *recur_content_weekly;
GtkWidget *recur_week_period; /* GtkEntry */
GtkWidget *recur_week_days [7];
- GtkWidget *recur_content_monthly;
GtkWidget *recur_month_date;
GtkWidget *recur_month_day;
GtkWidget *recur_month_weekday;
+ GtkWidget *recur_month_period; /* GtkEntry */
+
+ GtkWidget *recur_year_period; /* GtkEntry */
/* The associated ical object */
iCalObject *ical;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 873ee3f908..18409e3318 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -41,44 +41,32 @@ static void
setup_widgets (GnomeCalendar *gcal)
{
time_t now;
- GtkWidget *sw;
now = time (NULL);
gcal->notebook = gtk_notebook_new ();
- gcal->day_view = day_view_create (gcal);
gcal->week_view = gncal_week_view_new (gcal, now);
gcal->year_view = year_view_create (gcal);
gcal->task_view = tasks_create (gcal);
if (1)
{
- struct tm tm;
time_t a, b;
- tm = *localtime (&now);
-/* tm.tm_mday = 2; */
- tm.tm_hour = 0;
- tm.tm_min = 0;
- tm.tm_sec = 0;
-
- a = mktime (&tm);
-
- tm.tm_mday++;
-
- b = mktime (&tm);
-
+ a = time_start_of_day (now);
+ b = time_end_of_day (now);
+
gcal->day_view = gncal_full_day_new (gcal, a, b);
- sw = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ 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 (sw), gcal->day_view);
+ gtk_container_add (GTK_CONTAINER (gcal->day_view_container), gcal->day_view);
gtk_widget_show (gcal->day_view);
}
- gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), sw, gtk_label_new (_("Day View")));
+ 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")));
gtk_notebook_append_page (GTK_NOTEBOOK (gcal->notebook), gcal->task_view, gtk_label_new (_("Todo")));
@@ -114,9 +102,11 @@ gnome_calendar_goto (GnomeCalendar *gcal, time_t new_time)
if (current == gcal->week_view)
gncal_week_view_set (GNCAL_WEEK_VIEW (gcal->week_view), new_time);
- else if (current == gcal->day_view)
- printf ("updating day view\n");
- else if (current == gcal->year_view)
+ else if (current == gcal->day_view_container){
+ gncal_full_day_set_bounds (GNCAL_FULL_DAY (gcal->day_view),
+ time_start_of_day (new_time),
+ time_end_of_day (new_time));
+ } else if (current == gcal->year_view)
printf ("updating year view\n");
else
printf ("My penguin is gone!\n");
@@ -131,7 +121,7 @@ gnome_calendar_direction (GnomeCalendar *gcal, int direction)
if (cp == gcal->week_view)
new_time = time_add_day (gcal->current_display, 7 * direction);
- else if (cp == gcal->day_view)
+ else if (cp == gcal->day_view_container)
new_time = time_add_day (gcal->current_display, 1 * direction);
else if (cp == gcal->year_view)
new_time = time_add_year (gcal->current_display, 1 * direction);
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 2a91237f81..dcb4b2ffa1 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -25,6 +25,7 @@ typedef struct {
GtkWidget *notebook;
GtkWidget *week_view;
GtkWidget *day_view;
+ GtkWidget *day_view_container;
GtkWidget *year_view;
GtkWidget *task_view;
void *event_editor;