aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/Makefile.am1
-rw-r--r--calendar/gui/gnome-month-item.c199
-rw-r--r--calendar/gui/gnome-month-item.h19
-rw-r--r--calendar/gui/goto.c1
-rw-r--r--calendar/gui/main.c9
-rw-r--r--calendar/gui/month-view.c4
6 files changed, 217 insertions, 16 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 069609f38b..993cdf58b7 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -65,7 +65,6 @@ EXTRA_DIST = \
topic.dat \
gnome-cal.html \
bell.xpm \
- goto.xpm \
recur.xpm
diff --git a/calendar/gui/gnome-month-item.c b/calendar/gui/gnome-month-item.c
index 045a32d59d..308207f5a1 100644
--- a/calendar/gui/gnome-month-item.c
+++ b/calendar/gui/gnome-month-item.c
@@ -55,7 +55,15 @@ enum {
ARG_HEADING_HEIGHT,
ARG_HEADING_ANCHOR,
ARG_DAY_ANCHOR,
- ARG_START_ON_MONDAY
+ ARG_START_ON_MONDAY,
+ ARG_HEAD_FONT,
+ ARG_HEAD_FONT_GDK,
+ ARG_DAY_FONT,
+ ARG_DAY_FONT_GDK,
+ ARG_HEAD_COLOR,
+ ARG_HEAD_COLOR_GDK,
+ ARG_DAY_COLOR,
+ ARG_DAY_COLOR_GDK
};
@@ -115,13 +123,21 @@ gnome_month_item_class_init (GnomeMonthItemClass *class)
gtk_object_add_arg_type ("GnomeMonthItem::width", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH);
gtk_object_add_arg_type ("GnomeMonthItem::height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEIGHT);
gtk_object_add_arg_type ("GnomeMonthItem::anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR);
- gtk_object_add_arg_type ("GnomeMonthItem::head_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEAD_PADDING);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEAD_PADDING);
gtk_object_add_arg_type ("GnomeMonthItem::day_padding", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_DAY_PADDING);
- gtk_object_add_arg_type ("GnomeMonthItem::day_names", GTK_TYPE_POINTER, GTK_ARG_READABLE, ARG_DAY_NAMES);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_names", GTK_TYPE_POINTER, GTK_ARG_WRITABLE, ARG_DAY_NAMES);
gtk_object_add_arg_type ("GnomeMonthItem::heading_height", GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_HEADING_HEIGHT);
gtk_object_add_arg_type ("GnomeMonthItem::heading_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_HEADING_ANCHOR);
gtk_object_add_arg_type ("GnomeMonthItem::day_anchor", GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_DAY_ANCHOR);
gtk_object_add_arg_type ("GnomeMonthItem::start_on_monday", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_START_ON_MONDAY);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_FONT);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_HEAD_FONT_GDK);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_font", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_FONT);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_font_gdk", GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_DAY_FONT_GDK);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_HEAD_COLOR);
+ gtk_object_add_arg_type ("GnomeMonthItem::heading_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_HEAD_COLOR_GDK);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_color", GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_DAY_COLOR);
+ gtk_object_add_arg_type ("GnomeMonthItem::day_color_gdk", GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_DAY_COLOR_GDK);
object_class->destroy = gnome_month_item_destroy;
object_class->set_arg = gnome_month_item_set_arg;
@@ -274,6 +290,33 @@ reshape (GnomeMonthItem *mitem)
reshape_days (mitem);
}
+/* Sets the font for all the day headings */
+static void
+set_head_font (GnomeMonthItem *mitem)
+{
+ int i;
+
+ for (i = 0; i < 7; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
+ "font_gdk", mitem->head_font,
+ NULL);
+}
+
+/* Sets the color for all the day headings */
+static void
+set_head_color (GnomeMonthItem *mitem)
+{
+ int i;
+ GdkColor color;
+
+ color.pixel = mitem->head_pixel;
+
+ for (i = 0; i < 7; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
+ "fill_color_gdk", &color,
+ NULL);
+}
+
/* Creates the items for the day name headings */
static void
create_headings (GnomeMonthItem *mitem)
@@ -300,10 +343,11 @@ create_headings (GnomeMonthItem *mitem)
mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i]),
gnome_canvas_text_get_type (),
- "fill_color", "white",
- "font", "-adobe-helvetica-medium-r-normal--10-*-72-72-p-*-iso8859-1",
NULL);
}
+
+ set_head_font (mitem);
+ set_head_color (mitem);
}
/* Returns the number of leap years since year 1 up to (but not including) the specified year */
@@ -437,6 +481,33 @@ set_days (GnomeMonthItem *mitem)
NULL);
}
+/* Sets the font for all the day numbers */
+static void
+set_day_font (GnomeMonthItem *mitem)
+{
+ int i;
+
+ for (i = 0; i < 42; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
+ "font_gdk", mitem->day_font,
+ NULL);
+}
+
+/* Sets the color for all the day numbers */
+static void
+set_day_color (GnomeMonthItem *mitem)
+{
+ int i;
+ GdkColor color;
+
+ color.pixel = mitem->day_pixel;
+
+ for (i = 0; i < 42; i++)
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
+ "fill_color_gdk", &color,
+ NULL);
+}
+
/* Creates the items for the days */
static void
create_days (GnomeMonthItem *mitem)
@@ -464,11 +535,11 @@ create_days (GnomeMonthItem *mitem)
mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i]),
gnome_canvas_text_get_type (),
- "fill_color", "black",
- "font", "-adobe-helvetica-medium-r-normal--10-*-72-72-p-*-iso8859-1",
NULL);
}
+ set_day_font (mitem);
+ set_day_color (mitem);
set_days (mitem);
}
@@ -531,6 +602,20 @@ gnome_month_item_init (GnomeMonthItem *mitem)
mitem->head_height = 14.0;
mitem->head_anchor = GTK_ANCHOR_CENTER;
mitem->day_anchor = GTK_ANCHOR_CENTER;
+
+ /* Load the default fonts */
+
+ mitem->head_font = gdk_font_load ("-*-helvetica-medium-r-normal--10-*-*-*-p-*-iso8859-1");
+ if (!mitem->head_font) {
+ mitem->head_font = gdk_font_load ("fixed");
+ g_assert (mitem->head_font != NULL);
+ }
+
+ mitem->day_font = gdk_font_load ("-adobe-helvetica-medium-r-normal--10-*-72-72-p-*-iso8859-1");
+ if (!mitem->day_font) {
+ mitem->day_font = gdk_font_load ("fixed");
+ g_assert (mitem->day_font != NULL);
+ }
}
GnomeCanvasItem *
@@ -553,9 +638,17 @@ gnome_month_item_new (GnomeCanvasGroup *parent)
void
gnome_month_item_construct (GnomeMonthItem *mitem)
{
+ GdkColor color;
+
g_return_if_fail (mitem != NULL);
g_return_if_fail (GNOME_IS_MONTH_ITEM (mitem));
+ gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "#d6d6d6d6d6d6", &color);
+ mitem->head_pixel = color.pixel;
+
+ gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, "black", &color);
+ mitem->day_pixel = color.pixel;
+
create_items (mitem);
}
@@ -648,6 +741,7 @@ gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GnomeMonthItem *mitem;
char **day_names;
int i;
+ GdkColor color;
mitem = GNOME_MONTH_ITEM (object);
@@ -740,6 +834,74 @@ gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
set_days (mitem);
break;
+ case ARG_HEAD_FONT:
+ gdk_font_unref (mitem->head_font);
+
+ mitem->head_font = gdk_font_load (GTK_VALUE_STRING (*arg));
+ if (!mitem->head_font) {
+ mitem->head_font = gdk_font_load ("fixed");
+ g_assert (mitem->head_font != NULL);
+ }
+
+ set_head_font (mitem);
+ break;
+
+ case ARG_HEAD_FONT_GDK:
+ gdk_font_unref (mitem->head_font);
+
+ mitem->head_font = GTK_VALUE_BOXED (*arg);
+ gdk_font_ref (mitem->head_font);
+ set_head_font (mitem);
+ break;
+
+ case ARG_DAY_FONT:
+ gdk_font_unref (mitem->day_font);
+
+ mitem->day_font = gdk_font_load (GTK_VALUE_STRING (*arg));
+ if (!mitem->day_font) {
+ mitem->day_font = gdk_font_load ("fixed");
+ g_assert (mitem->day_font != NULL);
+ }
+
+ set_day_font (mitem);
+ break;
+
+ case ARG_DAY_FONT_GDK:
+ gdk_font_unref (mitem->day_font);
+
+ mitem->day_font = GTK_VALUE_BOXED (*arg);
+ gdk_font_ref (mitem->day_font);
+ set_day_font (mitem);
+ break;
+
+ case ARG_HEAD_COLOR:
+ if (gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, GTK_VALUE_STRING (*arg), &color))
+ mitem->head_pixel = color.pixel;
+ else
+ mitem->head_pixel = 0;
+
+ set_head_color (mitem);
+ break;
+
+ case ARG_HEAD_COLOR_GDK:
+ mitem->head_pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
+ set_head_color (mitem);
+ break;
+
+ case ARG_DAY_COLOR:
+ if (gnome_canvas_get_color (GNOME_CANVAS_ITEM (mitem)->canvas, GTK_VALUE_STRING (*arg), &color))
+ mitem->day_pixel = color.pixel;
+ else
+ mitem->day_pixel = 0;
+
+ set_day_color (mitem);
+ break;
+
+ case ARG_DAY_COLOR_GDK:
+ mitem->day_pixel = ((GdkColor *) GTK_VALUE_BOXED (*arg))->pixel;
+ set_day_color (mitem);
+ break;
+
default:
break;
}
@@ -749,6 +911,7 @@ static void
gnome_month_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
GnomeMonthItem *mitem;
+ GdkColor *color;
mitem = GNOME_MONTH_ITEM (object);
@@ -805,6 +968,28 @@ gnome_month_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GTK_VALUE_BOOL (*arg) = mitem->start_on_monday;
break;
+ case ARG_HEAD_FONT_GDK:
+ GTK_VALUE_BOXED (*arg) = mitem->head_font;
+ break;
+
+ case ARG_DAY_FONT_GDK:
+ GTK_VALUE_BOXED (*arg) = mitem->day_font;
+ break;
+
+ case ARG_HEAD_COLOR_GDK:
+ color = g_new (GdkColor, 1);
+ color->pixel = mitem->head_pixel;
+ gdk_color_context_query_color (GNOME_CANVAS_ITEM (mitem)->canvas->cc, color);
+ GTK_VALUE_BOXED (*arg) = color;
+ break;
+
+ case ARG_DAY_COLOR_GDK:
+ color = g_new (GdkColor, 1);
+ color->pixel = mitem->day_pixel;
+ gdk_color_context_query_color (GNOME_CANVAS_ITEM (mitem)->canvas->cc, color);
+ GTK_VALUE_BOXED (*arg) = color;
+ break;
+
default:
arg->type = GTK_TYPE_INVALID;
break;
diff --git a/calendar/gui/gnome-month-item.h b/calendar/gui/gnome-month-item.h
index 03ba0c84a7..405fda3702 100644
--- a/calendar/gui/gnome-month-item.h
+++ b/calendar/gui/gnome-month-item.h
@@ -59,13 +59,21 @@ typedef enum {
* width double RW Width of calendar in canvas units
* height double RW Height of calendar in canvas units
* anchor GtkAnchorType RW Anchor side for calendar
- * head_padding double RW Padding inside heading boxes
+ * heading_padding double RW Padding inside heading boxes
* day_padding double RW Padding inside day boxes
- * day_names char ** R Array of strings corresponding to the day names (sun-sat)
+ * day_names char ** W Array of strings corresponding to the day names (sun-sat)
* heading_height double RW Height of headings bar in canvas units
* heading_anchor GtkAnchorType RW Anchor side for headings inside heading boxes
* day_anchor GtkAnchorType RW Anchor side for day numbers inside day boxes
* start_on_monday boolean RW Specifies whether the week starts on Monday or Sunday
+ * heading_font string W X logical font descriptor for the headings
+ * heading_font_gdk GdkFont * RW Pointer to GdkFont for the headings
+ * day_font string W X logical font descriptor for the day numbers
+ * day_font_gdk GdkFont * RW Pointer to GdkFont for the day numbers
+ * heading_color string W X color specification for heading labels
+ * heading_color_gdk GdkColor * RW Pointer to an allocated GdkColor for heading labels
+ * day_color string W X color specification for day number labels
+ * day_color_gdk GdkColor * RW Pointer to an allocated GdkColor for day number labels
*/
#define GNOME_TYPE_MONTH_ITEM (gnome_month_item_get_type ())
@@ -95,12 +103,17 @@ struct _GnomeMonthItem {
double head_height; /* Height of the headings row */
GtkAnchorType head_anchor; /* Anchor side for the heading labels */
-
GtkAnchorType day_anchor; /* Anchor side for the day number labels */
GnomeCanvasItem **items; /* All the items that make up the calendar */
int day_numbers[42]; /* The numbers of the days */
+ GdkFont *head_font; /* Font for the headings */
+ GdkFont *day_font; /* Font for the day numbers */
+
+ gulong head_pixel; /* Color for heading labels */
+ gulong day_pixel; /* Color for day number labels */
+
int start_on_monday : 1; /* Start the week on Monday? If false, then start from Sunday */
};
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index db95fe0b27..c3ac3a157e 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -234,6 +234,7 @@ create_days (GtkWidget *dialog, GnomeCalendar *gcal, int day, int month, int yea
"month", month,
"year", year,
"start_on_monday", week_starts_on_monday,
+ "heading_color", "white",
NULL);
highlight_current_day (GNOME_MONTH_ITEM (mitem));
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 92b55b8172..066aac783c 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -19,10 +19,11 @@
#include "gnome-cal.h"
#include "main.h"
#include "timeutil.h"
-#include "goto.xpm"
+
#define COOKIE_USER_HOME_DIR ((char *) -1)
+
/* The username, used to set the `owner' field of the event */
char *user_name;
@@ -363,13 +364,13 @@ static GnomeUIInfo gnome_toolbar [] = {
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_MENU_BACK),
+ GNOMEUIINFO_ITEM_STOCK (N_("Prev"), N_("Go back in time"), previous_clicked, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK (N_("Today"), N_("Go to present time"), today_clicked, GNOME_STOCK_PIXMAP_HOME),
- GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_MENU_FORWARD),
+ GNOMEUIINFO_ITEM_STOCK (N_("Next"), N_("Go forward in time"), next_clicked, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM (N_("Go to"), N_("Go to a specific date"), goto_clicked, goto_xpm),
+ GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_JUMP_TO),
GNOMEUIINFO_END
};
diff --git a/calendar/gui/month-view.c b/calendar/gui/month-view.c
index 0abc717366..01d4391b25 100644
--- a/calendar/gui/month-view.c
+++ b/calendar/gui/month-view.c
@@ -78,10 +78,12 @@ month_view_init (MonthView *mv)
mv->mitem = gnome_month_item_new (GNOME_CANVAS_GROUP (mv->canvas.root));
gnome_canvas_item_set (mv->mitem,
"x", 0.0,
- "y", 0.0,
"anchor", GTK_ANCHOR_NW,
"day_anchor", GTK_ANCHOR_NE,
"start_on_monday", week_starts_on_monday,
+ "heading_height", 18.0,
+ "heading_font", "-*-helvetica-bold-r-normal--12-*-*-*-*-*-iso8859-1",
+ "day_font", "-*-helvetica-bold-r-normal--14-*-*-*-*-*-iso8859-1",
NULL);
}