aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/main.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-09-03 13:33:07 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-09-03 13:33:07 +0800
commitde704a7b4576df4f84ed859c7d3337cce0f89e57 (patch)
tree3a95fc12ba32383476faf9d09abe3ed3ab200aa8 /calendar/gui/main.c
parent0e94defc997236d4cd07fd101159d2ea063c082c (diff)
downloadgsoc2013-evolution-de704a7b4576df4f84ed859c7d3337cce0f89e57.tar
gsoc2013-evolution-de704a7b4576df4f84ed859c7d3337cce0f89e57.tar.gz
gsoc2013-evolution-de704a7b4576df4f84ed859c7d3337cce0f89e57.tar.bz2
gsoc2013-evolution-de704a7b4576df4f84ed859c7d3337cce0f89e57.tar.lz
gsoc2013-evolution-de704a7b4576df4f84ed859c7d3337cce0f89e57.tar.xz
gsoc2013-evolution-de704a7b4576df4f84ed859c7d3337cce0f89e57.tar.zst
gsoc2013-evolution-de704a7b4576df4f84ed859c7d3337cce0f89e57.zip
Today: we can now configure the colors for the monthly items, courtesy of
Today: we can now configure the colors for the monthly items, courtesy of the canvas and GnomeColorPicker. Look at the preferences dialog, it is kind of nice. There are still some bugs to be fixed, nothing major. 1998-09-03 Federico Mena Quintero <federico@nuclecu.unam.mx> * prop.c (create_colors_page): We can now configure the colors of the monthly calendars! Wheeeeee! There are still some nits to be fixed, which are listed in the TODO file. (build_color_spec): New function to build color specifications. (parse_color_spec): New function to parse color specifications. * mark.c: Modified all functions to use the configured colors. * goto.c: Likewise. * main.c (colors_changed): New function that notifies all calendars that colors have changed. * gnome-cal.c (gnome_calendar_colors_changed): New function that notifies all the views that the colors have changed. * month-view.c (month_view_colors_changed): New function that notifies the month view that colors have changed. * year-view.c (year_view_colors_changed): New function that notifies the year view that colors have changed. * gnome-month-item.h (struct _GnomeMonthItem): Added fields for outline and day box colors. * gnome-month-item.c (gnome_month_item_set_arg): Added outline_color, outline_color_gdk, day_box_color, and day_box_color_gdk arguments to month items. These are convenient to quickly set the colors of the month item. (gnome_month_item_get_arg): Likewise. * main.[ch]: Added a global array of structures for color preferences. svn path=/trunk/; revision=360
Diffstat (limited to 'calendar/gui/main.c')
-rw-r--r--calendar/gui/main.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 066aac783c..5ccdeee3ff 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -42,7 +42,20 @@ int day_begin, day_end;
/* Whether weeks starts on Sunday or Monday */
int week_starts_on_monday;
-/* Number of calendars active */
+/* The array of color properties -- keep in sync with the enumeration defined in main.h. The color
+ * values specified here are the defaults for the program.
+ */
+struct color_prop color_props[] = {
+ { 0x0000, 0x0000, 0x0000, "Outline:", "/calendar/Colors/outline" },
+ { 0xffff, 0xffff, 0xffff, "Headings:", "/calendar/Colors/headings" },
+ { 0xd6d6, 0xd6d6, 0xd6d6, "Empty days:", "/calendar/Colors/empty_bg" },
+ { 0xd2d2, 0xb4b4, 0x8c8c, "Appointment days:", "/calendar/Colors/mark_bg" },
+ { 0xea60, 0xea60, 0xea60, "Highlighted day:", "/calendar/Colors/prelight_bg" },
+ { 0x0000, 0x0000, 0x0000, "Day numbers:", "/calendar/Colors/day_fg" },
+ { 0x0000, 0x0000, 0xffff, "Current day's number:", "/calendar/Colors/current_fg" }
+};
+
+/* Number of active calendars */
int active_calendars = 0;
/* A list of all of the calendars started */
@@ -105,10 +118,17 @@ range_check_hour (int hour)
static void
init_calendar (void)
{
+ int i;
+ char *cspec, *color;
+ char *str;
+
init_username ();
user_calendar_file = g_concat_dir_and_file (gnome_util_user_home (), ".gnome/user-cal.vcf");
gnome_config_push_prefix (calendar_settings);
+
+ /* Read calendar settings */
+
day_begin = range_check_hour (gnome_config_get_int ("/calendar/Calendar/Day start=8"));
day_end = range_check_hour (gnome_config_get_int ("/calendar/Calendar/Day end=17"));
am_pm_flag = gnome_config_get_bool ("/calendar/Calendar/AM PM flag=0");
@@ -119,6 +139,21 @@ init_calendar (void)
day_end = 17;
}
+ /* Read color settings */
+
+ for (i = 0; i < COLOR_PROP_LAST; i++) {
+ cspec = build_color_spec (color_props[i].r, color_props[i].g, color_props[i].b);
+ str = g_copy_strings (color_props[i].key, "=", cspec, NULL);
+
+ color = gnome_config_get_string (str);
+ parse_color_spec (color, &color_props[i].r, &color_props[i].g, &color_props[i].b);
+
+ g_free (str);
+ g_free (color);
+ }
+
+ /* Done */
+
gnome_config_pop_prefix ();
}
@@ -197,6 +232,15 @@ time_format_changed (void)
gnome_calendar_time_format_changed (GNOME_CALENDAR (l->data));
}
+void
+colors_changed (void)
+{
+ GList *l;
+
+ for (l = all_calendars; l; l = l->next)
+ gnome_calendar_colors_changed (GNOME_CALENDAR (l->data));
+}
+
static void
quit_cmd (void)
{