aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/prop.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-09-04 08:43:06 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-09-04 08:43:06 +0800
commit84fa00e42a593a4e4e64866090df30c9d7c066b9 (patch)
tree2c5c5f1566aad424cdc537f55cf08d8c7e3bea1d /calendar/prop.c
parentde704a7b4576df4f84ed859c7d3337cce0f89e57 (diff)
downloadgsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar
gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.gz
gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.bz2
gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.lz
gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.xz
gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.zst
gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.zip
Finished with the properties dialog. You can jump to days from the year
Finished with the properties dialog. You can jump to days from the year view now. I'm off to rewrite gnome-popupmenu and friends. 1998-09-03 Federico Mena Quintero <federico@nuclecu.unam.mx> * gncal-full-day.c (gncal_full_day_forall): Updated foreach -> forall from Gtk changes, bleah. * year-view.c (day_event): New function to handle events from days. Jumps to the day that is clicked. * main.c: Use a watch cursor while the previous/today/next functions are doing their job. * mark.c (month_item_prepare_prelight): New public utility function to prepare a month item for prelighting. It will store the proper prelight information and attach the appropriate signals. (mark_current_day): Make the current day bold as well (useful for color-blind people, I guess). * prop.c (set_current_day): Reset the date in the sample calendar and mark the current day. (fake_mark_days): Mark fake events in the sample calendar. * year-view.c (year_view_set): Use the general prelighting engine. * goto.c (day_event): Just process button presses, as prelighting is done behind the scenes now. (update): Use the general prelighting engine. * prop.c (create_colors_page): We can now configure the colors of svn path=/trunk/; revision=361
Diffstat (limited to 'calendar/prop.c')
-rw-r--r--calendar/prop.c78
1 files changed, 70 insertions, 8 deletions
diff --git a/calendar/prop.c b/calendar/prop.c
index bdc8c9e937..936170855f 100644
--- a/calendar/prop.c
+++ b/calendar/prop.c
@@ -1,6 +1,6 @@
-/*
- * Calendar properties dialog box
- * (C) 1998 the Free Software Foundation
+/* Calendar properties dialog box
+ *
+ * Copyright (C) 1998 the Free Software Foundation
*
* Authors: Miguel de Icaza <miguel@kernel.org>
* Federico Mena <federico@nuclecu.unam.mx>
@@ -9,8 +9,9 @@
#include <langinfo.h>
#include <gnome.h>
#include "gnome-cal.h"
-#include "main.h"
#include "gnome-month-item.h"
+#include "main.h"
+#include "mark.h"
/* These specify the page numbers in the preferences notebook */
enum {
@@ -344,6 +345,60 @@ color_spec_from_picker (int num)
return build_color_spec (r, g, b);
}
+/* Callback used to query prelight color information for the properties box */
+static char *
+fetch_prelight_spec (gpointer data)
+{
+ return color_spec_from_picker (COLOR_PROP_PRELIGHT_DAY_BG);
+}
+
+/* Marks fake event days in the month item sample */
+static void
+fake_mark_days (void)
+{
+ static int day_nums[] = { 1, 4, 8, 16, 17, 18, 20, 25, 28 }; /* some random days */
+ int day_index;
+ int i;
+ GnomeCanvasItem *item;
+
+ for (i = 0; i < (sizeof (day_nums) / sizeof (day_nums[0])); i++) {
+ day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), day_nums[i]);
+ item = gnome_month_item_num2child (GNOME_MONTH_ITEM (month_item), GNOME_MONTH_ITEM_DAY_BOX + day_index);
+ gnome_canvas_item_set (item,
+ "fill_color", color_spec_from_picker (COLOR_PROP_MARK_DAY_BG),
+ NULL);
+ }
+}
+
+/* Switches the month item to the current date and highlights the current day's number */
+static void
+set_current_day (void)
+{
+ struct tm *tm;
+ time_t t;
+ GnomeCanvasItem *item;
+ int day_index;
+
+ /* Set the date */
+
+ t = time (NULL);
+ tm = localtime (&t);
+
+ gnome_canvas_item_set (month_item,
+ "year", tm->tm_year + 1900,
+ "month", tm->tm_mon,
+ NULL);
+
+ /* Highlight current day */
+
+ day_index = gnome_month_item_day2index (GNOME_MONTH_ITEM (month_item), tm->tm_mday);
+ item = gnome_month_item_num2child (GNOME_MONTH_ITEM (month_item), GNOME_MONTH_ITEM_DAY_LABEL + day_index);
+ gnome_canvas_item_set (item,
+ "fill_color", color_spec_from_picker (COLOR_PROP_CURRENT_DAY_FG),
+ "font", CURRENT_DAY_FONT,
+ NULL);
+}
+
/* Sets the colors of the month item to the current prerences */
static void
reconfigure_month (void)
@@ -360,10 +415,6 @@ reconfigure_month (void)
"outline_color", color_spec_from_picker (COLOR_PROP_OUTLINE_COLOR),
NULL);
- /* FIXME: set the rest of the colors -- simulate marking of the month item, set the
- * current day, etc. The following is incorrect.
- */
-
gnome_canvas_item_set (month_item,
"day_box_color", color_spec_from_picker (COLOR_PROP_EMPTY_DAY_BG),
NULL);
@@ -371,6 +422,17 @@ reconfigure_month (void)
gnome_canvas_item_set (month_item,
"day_color", color_spec_from_picker (COLOR_PROP_DAY_FG),
NULL);
+
+ gnome_canvas_item_set (month_item,
+ "day_font", NORMAL_DAY_FONT,
+ NULL);
+
+ fake_mark_days ();
+ set_current_day ();
+
+ /* Reset prelighting information */
+
+ month_item_prepare_prelight (GNOME_MONTH_ITEM (month_item), fetch_prelight_spec, NULL);
}
/* Callback used when a color is changed */