From 43fd11d9b80259b3b6ec64de4fdff0767b5611c5 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 14 Aug 1998 00:33:01 +0000 Subject: Doh. Actually recalculate the days using the month and year. 1998-08-13 Federico Mena Quintero * gnome-month-item.c (gnome_month_item_set_arg): Doh. Actually recalculate the days using the month and year. * main.c: Added "Go to" button to quickly jump to a specific date. * goto.c: New file that defines the quick go-to date dialog. * Makefile.am (gnomecal_SOURCES): Added goto.c to the sources. svn path=/trunk/; revision=317 --- calendar/ChangeLog | 11 +++++++++++ calendar/Makefile.am | 1 + calendar/gnome-month-item.c | 16 +++------------- calendar/gui/Makefile.am | 1 + calendar/gui/gnome-month-item.c | 16 +++------------- calendar/gui/main.c | 13 +++++++++++++ calendar/gui/main.h | 1 + calendar/gui/month-view.c | 8 ++++---- calendar/gui/prop.c | 6 +++--- calendar/main.c | 13 +++++++++++++ calendar/main.h | 1 + calendar/month-view.c | 8 ++++---- calendar/prop.c | 6 +++--- 13 files changed, 61 insertions(+), 40 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index dac6928599..182cb295d7 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,14 @@ +1998-08-13 Federico Mena Quintero + + * gnome-month-item.c (gnome_month_item_set_arg): Doh. Actually + recalculate the days using the month and year. + + * main.c: Added "Go to" button to quickly jump to a specific date. + + * goto.c: New file that defines the quick go-to date dialog. + + * Makefile.am (gnomecal_SOURCES): Added goto.c to the sources. + 1998-08-11 Nuno Ferreira * main.c (new_calendar): Made title i18n friendly. This was bug diff --git a/calendar/Makefile.am b/calendar/Makefile.am index 59260889c2..039e866306 100644 --- a/calendar/Makefile.am +++ b/calendar/Makefile.am @@ -37,6 +37,7 @@ gnomecal_SOURCES = \ getdate.y \ gnome-cal.c \ gnome-cal.h \ + goto.c \ main.c \ main.h \ month-view.c \ diff --git a/calendar/gnome-month-item.c b/calendar/gnome-month-item.c index f5e3a5b8df..9b00d4d3c8 100644 --- a/calendar/gnome-month-item.c +++ b/calendar/gnome-month-item.c @@ -452,8 +452,6 @@ static void create_days (GnomeMonthItem *mitem) { int i; - char buf[100]; - GdkColor *c; /* Just create the items; they will be positioned and configured by a call to reshape() */ @@ -465,13 +463,11 @@ create_days (GnomeMonthItem *mitem) NULL); /* Box */ - c = >K_WIDGET (GNOME_CANVAS_ITEM (mitem)->canvas)->style->bg[GTK_STATE_NORMAL]; - sprintf (buf, "#%04x%04x%04x", c->red, c->green, c->blue); mitem->items[ITEM_DAY_BOX + i] = gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_DAY_GROUP + i]), gnome_canvas_rect_get_type (), "outline_color", "black", - "fill_color", buf, + "fill_color", "#d6d6d6", NULL); /* Label */ @@ -666,12 +662,6 @@ reanchor (GnomeMonthItem *mitem) NULL); } -static void -recalc_month (GnomeMonthItem *mitem) -{ - /* FIXME */ -} - static void gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { @@ -684,12 +674,12 @@ gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) switch (arg_id) { case ARG_YEAR: mitem->year = GTK_VALUE_UINT (*arg); - recalc_month (mitem); + set_days (mitem); break; case ARG_MONTH: mitem->month = GTK_VALUE_UINT (*arg); - recalc_month (mitem); + set_days (mitem); break; case ARG_X: diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 59260889c2..039e866306 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -37,6 +37,7 @@ gnomecal_SOURCES = \ getdate.y \ gnome-cal.c \ gnome-cal.h \ + goto.c \ main.c \ main.h \ month-view.c \ diff --git a/calendar/gui/gnome-month-item.c b/calendar/gui/gnome-month-item.c index f5e3a5b8df..9b00d4d3c8 100644 --- a/calendar/gui/gnome-month-item.c +++ b/calendar/gui/gnome-month-item.c @@ -452,8 +452,6 @@ static void create_days (GnomeMonthItem *mitem) { int i; - char buf[100]; - GdkColor *c; /* Just create the items; they will be positioned and configured by a call to reshape() */ @@ -465,13 +463,11 @@ create_days (GnomeMonthItem *mitem) NULL); /* Box */ - c = >K_WIDGET (GNOME_CANVAS_ITEM (mitem)->canvas)->style->bg[GTK_STATE_NORMAL]; - sprintf (buf, "#%04x%04x%04x", c->red, c->green, c->blue); mitem->items[ITEM_DAY_BOX + i] = gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_DAY_GROUP + i]), gnome_canvas_rect_get_type (), "outline_color", "black", - "fill_color", buf, + "fill_color", "#d6d6d6", NULL); /* Label */ @@ -666,12 +662,6 @@ reanchor (GnomeMonthItem *mitem) NULL); } -static void -recalc_month (GnomeMonthItem *mitem) -{ - /* FIXME */ -} - static void gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { @@ -684,12 +674,12 @@ gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) switch (arg_id) { case ARG_YEAR: mitem->year = GTK_VALUE_UINT (*arg); - recalc_month (mitem); + set_days (mitem); break; case ARG_MONTH: mitem->month = GTK_VALUE_UINT (*arg); - recalc_month (mitem); + set_days (mitem); break; case ARG_X: diff --git a/calendar/gui/main.c b/calendar/gui/main.c index 6d2a334163..ebb008927f 100644 --- a/calendar/gui/main.c +++ b/calendar/gui/main.c @@ -134,7 +134,10 @@ about_calendar_cmd (GtkWidget *widget, void *data) authors, _("The GNOME personal calendar and schedule manager."), NULL); + gnome_dialog_run_and_destroy (GNOME_DIALOG (about)); +#if 0 gtk_widget_show (about); +#endif } static void @@ -223,6 +226,12 @@ today_clicked (GtkWidget *widget, GnomeCalendar *gcal) gnome_calendar_goto (gcal, time (NULL)); } +static void +goto_clicked (GtkWidget *widget, GnomeCalendar *gcal) +{ + goto_dialog (gcal); +} + static void new_calendar_cmd (GtkWidget *widget, void *data) { @@ -375,6 +384,10 @@ static GnomeUIInfo gnome_toolbar [] = { { GNOME_APP_UI_ITEM, N_("Next"), N_("Go forward in time"), next_clicked, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD }, + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_STOP), + GNOMEUIINFO_END }; diff --git a/calendar/gui/main.h b/calendar/gui/main.h index 81605a55f6..374f8199e6 100644 --- a/calendar/gui/main.h +++ b/calendar/gui/main.h @@ -7,5 +7,6 @@ extern int am_pm_flag; void properties (void); void day_range_changed (void); +void goto_dialog (GnomeCalendar *gcal); #endif diff --git a/calendar/gui/month-view.c b/calendar/gui/month-view.c index 4b96aa4bcb..a23938b350 100644 --- a/calendar/gui/month-view.c +++ b/calendar/gui/month-view.c @@ -65,9 +65,9 @@ month_view_init (MonthView *mv) "y", 0.0, "anchor", GTK_ANCHOR_NW, "day_anchor", GTK_ANCHOR_NE, - +#if 0 "start_on_monday", TRUE, - +#endif NULL); } @@ -115,7 +115,7 @@ month_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) gnome_canvas_set_scroll_region (GNOME_CANVAS (mv), 0, 0, allocation->width, allocation->height); gnome_canvas_item_set (mv->mitem, - "width", (double) allocation->width, - "height", (double) allocation->height, + "width", (double) (allocation->width - 1), + "height", (double) (allocation->height - 1), NULL); } diff --git a/calendar/gui/prop.c b/calendar/gui/prop.c index eab5d00be0..58abe2f8db 100644 --- a/calendar/gui/prop.c +++ b/calendar/gui/prop.c @@ -6,13 +6,13 @@ */ #include #include -#include "main.h" #include "gnome-cal.h" +#include "main.h" static GtkWidget *prop_win, *r1; static GtkObject *sa, *ea; -void +static void start_changed (GtkAdjustment *sa, GtkAdjustment *ea) { if (sa->value > 23.0){ @@ -27,7 +27,7 @@ start_changed (GtkAdjustment *sa, GtkAdjustment *ea) gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win)); } -void +static void end_changed (GtkAdjustment *ea, GtkAdjustment *sa) { if (ea->value < 1.0){ diff --git a/calendar/main.c b/calendar/main.c index 6d2a334163..ebb008927f 100644 --- a/calendar/main.c +++ b/calendar/main.c @@ -134,7 +134,10 @@ about_calendar_cmd (GtkWidget *widget, void *data) authors, _("The GNOME personal calendar and schedule manager."), NULL); + gnome_dialog_run_and_destroy (GNOME_DIALOG (about)); +#if 0 gtk_widget_show (about); +#endif } static void @@ -223,6 +226,12 @@ today_clicked (GtkWidget *widget, GnomeCalendar *gcal) gnome_calendar_goto (gcal, time (NULL)); } +static void +goto_clicked (GtkWidget *widget, GnomeCalendar *gcal) +{ + goto_dialog (gcal); +} + static void new_calendar_cmd (GtkWidget *widget, void *data) { @@ -375,6 +384,10 @@ static GnomeUIInfo gnome_toolbar [] = { { GNOME_APP_UI_ITEM, N_("Next"), N_("Go forward in time"), next_clicked, 0, 0, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD }, + GNOMEUIINFO_SEPARATOR, + + GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_STOP), + GNOMEUIINFO_END }; diff --git a/calendar/main.h b/calendar/main.h index 81605a55f6..374f8199e6 100644 --- a/calendar/main.h +++ b/calendar/main.h @@ -7,5 +7,6 @@ extern int am_pm_flag; void properties (void); void day_range_changed (void); +void goto_dialog (GnomeCalendar *gcal); #endif diff --git a/calendar/month-view.c b/calendar/month-view.c index 4b96aa4bcb..a23938b350 100644 --- a/calendar/month-view.c +++ b/calendar/month-view.c @@ -65,9 +65,9 @@ month_view_init (MonthView *mv) "y", 0.0, "anchor", GTK_ANCHOR_NW, "day_anchor", GTK_ANCHOR_NE, - +#if 0 "start_on_monday", TRUE, - +#endif NULL); } @@ -115,7 +115,7 @@ month_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation) gnome_canvas_set_scroll_region (GNOME_CANVAS (mv), 0, 0, allocation->width, allocation->height); gnome_canvas_item_set (mv->mitem, - "width", (double) allocation->width, - "height", (double) allocation->height, + "width", (double) (allocation->width - 1), + "height", (double) (allocation->height - 1), NULL); } diff --git a/calendar/prop.c b/calendar/prop.c index eab5d00be0..58abe2f8db 100644 --- a/calendar/prop.c +++ b/calendar/prop.c @@ -6,13 +6,13 @@ */ #include #include -#include "main.h" #include "gnome-cal.h" +#include "main.h" static GtkWidget *prop_win, *r1; static GtkObject *sa, *ea; -void +static void start_changed (GtkAdjustment *sa, GtkAdjustment *ea) { if (sa->value > 23.0){ @@ -27,7 +27,7 @@ start_changed (GtkAdjustment *sa, GtkAdjustment *ea) gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win)); } -void +static void end_changed (GtkAdjustment *ea, GtkAdjustment *sa) { if (ea->value < 1.0){ -- cgit v1.2.3