aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/month-view.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-08-25 10:19:20 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-08-25 10:19:20 +0800
commitbf844f9fa82ee8540f99df6bd1bb533e99a70562 (patch)
tree5c75b30f1a5ac3d7a9978e8efc511b8adc7162c6 /calendar/gui/month-view.c
parent4d075f28b587361a5014edd4946f30d9ae113e9f (diff)
downloadgsoc2013-evolution-bf844f9fa82ee8540f99df6bd1bb533e99a70562.tar.gz
gsoc2013-evolution-bf844f9fa82ee8540f99df6bd1bb533e99a70562.tar.zst
gsoc2013-evolution-bf844f9fa82ee8540f99df6bd1bb533e99a70562.zip
Today: Beautification of the Preferences dialog. Made the menus more
Today: Beautification of the Preferences dialog. Made the menus more consistent with the rest of GNOME. Started work on the meat of the month view. Minor fixups on some of the other views. 1998-08-24 Federico Mena Quintero <federico@nuclecu.unam.mx> * prop.c (build_two_radio_group): Doh. Set the state of the radio buttons properly. * month-view.c (month_view_time_format_changed): New public function that notifies the month view of a time format change. * gnome-cal.c (gnome_calendar_time_format_changed): New public function that notifies the calendar of a time format change. * main.c (time_format_changed): Use gnome_calendar_time_format_changed(). * month-view.c (month_view_update): New public function to update the month view when an event changes. This is still unfinished. (month_view_set): New public function to set the month in the month view. * gnome-cal.c (gnome_calendar_direction): Add case for month view. (gnome_calendar_set_view): Likewise. (gnome_calendar_update_all): Likewise. * timeutil.c (time_add_week): Implemented the time_add_week() function, which was on the header file. (time_add_month): Added public month-adding routine. * gnome-cal.c (gnome_calendar_get_current_view_name): Add case for month view. (gnome_calendar_goto): Likewise, and set the time on the month view. * month-view.c (month_view_new): Now it takes the calendar plus the time_t representing the month. * gnome-month-item.h: Added documentation on the object arguments for the month item. * month-view.c (month_view_init): Added a month/year heading to the month view. * TODO: Updated the TODO list a bit. * main.c (gnome_cal_file_menu): The preferences menu option should go in the File menu. (gnome_cal_edit_menu): Added stock pixmaps to the menu items. (gnome_cal_menu): Renamed the Calendar menu to Edit. (gnome_cal_help_menu): Use "About Gnomecal", not just "About". * prop.c (hour_activated): Notify the property box that it has changed. svn path=/trunk/; revision=337
Diffstat (limited to 'calendar/gui/month-view.c')
-rw-r--r--calendar/gui/month-view.c91
1 files changed, 88 insertions, 3 deletions
diff --git a/calendar/gui/month-view.c b/calendar/gui/month-view.c
index de6b89db2b..0abc717366 100644
--- a/calendar/gui/month-view.c
+++ b/calendar/gui/month-view.c
@@ -6,10 +6,14 @@
*/
#include <config.h>
+#include <libgnomeui/gnome-canvas-text.h>
#include "month-view.h"
#include "main.h"
+#define SPACING 4 /* Spacing between title and calendar */
+
+
static void month_view_class_init (MonthViewClass *class);
static void month_view_init (MonthView *mv);
static void month_view_size_request (GtkWidget *widget,
@@ -60,6 +64,17 @@ month_view_class_init (MonthViewClass *class)
static void
month_view_init (MonthView *mv)
{
+ /* Title */
+
+ mv->title = gnome_canvas_item_new (GNOME_CANVAS_GROUP (mv->canvas.root),
+ gnome_canvas_text_get_type (),
+ "anchor", GTK_ANCHOR_N,
+ "font", "-*-helvetica-bold-r-normal--18-*-*-*-p-*-iso8859-1",
+ "fill_color", "black",
+ NULL);
+
+ /* Month item */
+
mv->mitem = gnome_month_item_new (GNOME_CANVAS_GROUP (mv->canvas.root));
gnome_canvas_item_set (mv->mitem,
"x", 0.0,
@@ -71,16 +86,17 @@ month_view_init (MonthView *mv)
}
GtkWidget *
-month_view_new (GnomeCalendar *calendar)
+month_view_new (GnomeCalendar *calendar, time_t month)
{
MonthView *mv;
g_return_val_if_fail (calendar != NULL, NULL);
mv = gtk_type_new (month_view_get_type ());
-
mv->calendar = calendar;
+ month_view_set (mv, month);
+
return GTK_WIDGET (mv);
}
@@ -102,6 +118,9 @@ static void
month_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
{
MonthView *mv;
+ GdkFont *font;
+ GtkArg arg;
+ int y;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -113,8 +132,74 @@ month_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
(* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
gnome_canvas_set_scroll_region (GNOME_CANVAS (mv), 0, 0, allocation->width, allocation->height);
+
+ /* Adjust items to new size */
+
+ arg.name = "font_gdk";
+ gtk_object_getv (GTK_OBJECT (mv->title), 1, &arg);
+ font = GTK_VALUE_BOXED (arg);
+
+ gnome_canvas_item_set (mv->title,
+ "x", (double) allocation->width / 2.0,
+ "y", (double) SPACING,
+ NULL);
+
+ y = font->ascent + font->descent + 2 * SPACING;
gnome_canvas_item_set (mv->mitem,
+ "y", (double) y,
"width", (double) (allocation->width - 1),
- "height", (double) (allocation->height - 1),
+ "height", (double) (allocation->height - y - 1),
+ NULL);
+
+ /* FIXME: adjust events */
+}
+
+void
+month_view_update (MonthView *mv, iCalObject *object, int flags)
+{
+ g_return_if_fail (mv != NULL);
+ g_return_if_fail (IS_MONTH_VIEW (mv));
+
+ /* FIXME */
+}
+
+void
+month_view_set (MonthView *mv, time_t month)
+{
+ struct tm *tm;
+ char buf[100];
+
+ g_return_if_fail (mv != NULL);
+ g_return_if_fail (IS_MONTH_VIEW (mv));
+
+ /* Title */
+
+ tm = localtime (&month);
+ strftime (buf, 100, "%B %Y", tm);
+
+ gnome_canvas_item_set (mv->title,
+ "text", buf,
+ NULL);
+
+ /* Month item */
+
+ gnome_canvas_item_set (mv->mitem,
+ "year", tm->tm_year + 1900,
+ "month", tm->tm_mon,
NULL);
+
+ /* FIXME: update events */
+}
+
+void
+month_view_time_format_changed (MonthView *mv)
+{
+ g_return_if_fail (mv != NULL);
+ g_return_if_fail (IS_MONTH_VIEW (mv));
+
+ gnome_canvas_item_set (mv->mitem,
+ "start_on_monday", week_starts_on_monday,
+ NULL);
+
+ /* FIXME: update events */
}