Doh. Actually recalculate the days using the month and year.

1998-08-13  Federico Mena Quintero  <federico@nuclecu.unam.mx>

	* 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
This commit is contained in:
Federico Mena Quintero
1998-08-14 00:33:01 +00:00
committed by Arturo Espinosa
parent a6266876c6
commit 43fd11d9b8
13 changed files with 61 additions and 40 deletions

View File

@ -1,3 +1,14 @@
1998-08-13 Federico Mena Quintero <federico@nuclecu.unam.mx>
* 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 <nmrf@rnl.ist.utl.pt> 1998-08-11 Nuno Ferreira <nmrf@rnl.ist.utl.pt>
* main.c (new_calendar): Made title i18n friendly. This was bug * main.c (new_calendar): Made title i18n friendly. This was bug

View File

@ -37,6 +37,7 @@ gnomecal_SOURCES = \
getdate.y \ getdate.y \
gnome-cal.c \ gnome-cal.c \
gnome-cal.h \ gnome-cal.h \
goto.c \
main.c \ main.c \
main.h \ main.h \
month-view.c \ month-view.c \

View File

@ -452,8 +452,6 @@ static void
create_days (GnomeMonthItem *mitem) create_days (GnomeMonthItem *mitem)
{ {
int i; int i;
char buf[100];
GdkColor *c;
/* Just create the items; they will be positioned and configured by a call to reshape() */ /* Just create the items; they will be positioned and configured by a call to reshape() */
@ -465,13 +463,11 @@ create_days (GnomeMonthItem *mitem)
NULL); NULL);
/* Box */ /* Box */
c = &GTK_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] = mitem->items[ITEM_DAY_BOX + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_DAY_GROUP + i]), gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_DAY_GROUP + i]),
gnome_canvas_rect_get_type (), gnome_canvas_rect_get_type (),
"outline_color", "black", "outline_color", "black",
"fill_color", buf, "fill_color", "#d6d6d6",
NULL); NULL);
/* Label */ /* Label */
@ -666,12 +662,6 @@ reanchor (GnomeMonthItem *mitem)
NULL); NULL);
} }
static void
recalc_month (GnomeMonthItem *mitem)
{
/* FIXME */
}
static void static void
gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) 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) { switch (arg_id) {
case ARG_YEAR: case ARG_YEAR:
mitem->year = GTK_VALUE_UINT (*arg); mitem->year = GTK_VALUE_UINT (*arg);
recalc_month (mitem); set_days (mitem);
break; break;
case ARG_MONTH: case ARG_MONTH:
mitem->month = GTK_VALUE_UINT (*arg); mitem->month = GTK_VALUE_UINT (*arg);
recalc_month (mitem); set_days (mitem);
break; break;
case ARG_X: case ARG_X:

View File

@ -37,6 +37,7 @@ gnomecal_SOURCES = \
getdate.y \ getdate.y \
gnome-cal.c \ gnome-cal.c \
gnome-cal.h \ gnome-cal.h \
goto.c \
main.c \ main.c \
main.h \ main.h \
month-view.c \ month-view.c \

View File

@ -452,8 +452,6 @@ static void
create_days (GnomeMonthItem *mitem) create_days (GnomeMonthItem *mitem)
{ {
int i; int i;
char buf[100];
GdkColor *c;
/* Just create the items; they will be positioned and configured by a call to reshape() */ /* Just create the items; they will be positioned and configured by a call to reshape() */
@ -465,13 +463,11 @@ create_days (GnomeMonthItem *mitem)
NULL); NULL);
/* Box */ /* Box */
c = &GTK_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] = mitem->items[ITEM_DAY_BOX + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_DAY_GROUP + i]), gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_DAY_GROUP + i]),
gnome_canvas_rect_get_type (), gnome_canvas_rect_get_type (),
"outline_color", "black", "outline_color", "black",
"fill_color", buf, "fill_color", "#d6d6d6",
NULL); NULL);
/* Label */ /* Label */
@ -666,12 +662,6 @@ reanchor (GnomeMonthItem *mitem)
NULL); NULL);
} }
static void
recalc_month (GnomeMonthItem *mitem)
{
/* FIXME */
}
static void static void
gnome_month_item_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) 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) { switch (arg_id) {
case ARG_YEAR: case ARG_YEAR:
mitem->year = GTK_VALUE_UINT (*arg); mitem->year = GTK_VALUE_UINT (*arg);
recalc_month (mitem); set_days (mitem);
break; break;
case ARG_MONTH: case ARG_MONTH:
mitem->month = GTK_VALUE_UINT (*arg); mitem->month = GTK_VALUE_UINT (*arg);
recalc_month (mitem); set_days (mitem);
break; break;
case ARG_X: case ARG_X:

View File

@ -134,7 +134,10 @@ about_calendar_cmd (GtkWidget *widget, void *data)
authors, authors,
_("The GNOME personal calendar and schedule manager."), _("The GNOME personal calendar and schedule manager."),
NULL); NULL);
gnome_dialog_run_and_destroy (GNOME_DIALOG (about));
#if 0
gtk_widget_show (about); gtk_widget_show (about);
#endif
} }
static void static void
@ -223,6 +226,12 @@ today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
gnome_calendar_goto (gcal, time (NULL)); gnome_calendar_goto (gcal, time (NULL));
} }
static void
goto_clicked (GtkWidget *widget, GnomeCalendar *gcal)
{
goto_dialog (gcal);
}
static void static void
new_calendar_cmd (GtkWidget *widget, void *data) 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_UI_ITEM, N_("Next"), N_("Go forward in time"), next_clicked, 0, 0,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD }, 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 GNOMEUIINFO_END
}; };

View File

@ -7,5 +7,6 @@ extern int am_pm_flag;
void properties (void); void properties (void);
void day_range_changed (void); void day_range_changed (void);
void goto_dialog (GnomeCalendar *gcal);
#endif #endif

View File

@ -65,9 +65,9 @@ month_view_init (MonthView *mv)
"y", 0.0, "y", 0.0,
"anchor", GTK_ANCHOR_NW, "anchor", GTK_ANCHOR_NW,
"day_anchor", GTK_ANCHOR_NE, "day_anchor", GTK_ANCHOR_NE,
#if 0
"start_on_monday", TRUE, "start_on_monday", TRUE,
#endif
NULL); 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_set_scroll_region (GNOME_CANVAS (mv), 0, 0, allocation->width, allocation->height);
gnome_canvas_item_set (mv->mitem, gnome_canvas_item_set (mv->mitem,
"width", (double) allocation->width, "width", (double) (allocation->width - 1),
"height", (double) allocation->height, "height", (double) (allocation->height - 1),
NULL); NULL);
} }

View File

@ -6,13 +6,13 @@
*/ */
#include <config.h> #include <config.h>
#include <gnome.h> #include <gnome.h>
#include "main.h"
#include "gnome-cal.h" #include "gnome-cal.h"
#include "main.h"
static GtkWidget *prop_win, *r1; static GtkWidget *prop_win, *r1;
static GtkObject *sa, *ea; static GtkObject *sa, *ea;
void static void
start_changed (GtkAdjustment *sa, GtkAdjustment *ea) start_changed (GtkAdjustment *sa, GtkAdjustment *ea)
{ {
if (sa->value > 23.0){ if (sa->value > 23.0){
@ -27,7 +27,7 @@ start_changed (GtkAdjustment *sa, GtkAdjustment *ea)
gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win)); gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win));
} }
void static void
end_changed (GtkAdjustment *ea, GtkAdjustment *sa) end_changed (GtkAdjustment *ea, GtkAdjustment *sa)
{ {
if (ea->value < 1.0){ if (ea->value < 1.0){

View File

@ -134,7 +134,10 @@ about_calendar_cmd (GtkWidget *widget, void *data)
authors, authors,
_("The GNOME personal calendar and schedule manager."), _("The GNOME personal calendar and schedule manager."),
NULL); NULL);
gnome_dialog_run_and_destroy (GNOME_DIALOG (about));
#if 0
gtk_widget_show (about); gtk_widget_show (about);
#endif
} }
static void static void
@ -223,6 +226,12 @@ today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
gnome_calendar_goto (gcal, time (NULL)); gnome_calendar_goto (gcal, time (NULL));
} }
static void
goto_clicked (GtkWidget *widget, GnomeCalendar *gcal)
{
goto_dialog (gcal);
}
static void static void
new_calendar_cmd (GtkWidget *widget, void *data) 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_UI_ITEM, N_("Next"), N_("Go forward in time"), next_clicked, 0, 0,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_FORWARD }, 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 GNOMEUIINFO_END
}; };

View File

@ -7,5 +7,6 @@ extern int am_pm_flag;
void properties (void); void properties (void);
void day_range_changed (void); void day_range_changed (void);
void goto_dialog (GnomeCalendar *gcal);
#endif #endif

View File

@ -65,9 +65,9 @@ month_view_init (MonthView *mv)
"y", 0.0, "y", 0.0,
"anchor", GTK_ANCHOR_NW, "anchor", GTK_ANCHOR_NW,
"day_anchor", GTK_ANCHOR_NE, "day_anchor", GTK_ANCHOR_NE,
#if 0
"start_on_monday", TRUE, "start_on_monday", TRUE,
#endif
NULL); 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_set_scroll_region (GNOME_CANVAS (mv), 0, 0, allocation->width, allocation->height);
gnome_canvas_item_set (mv->mitem, gnome_canvas_item_set (mv->mitem,
"width", (double) allocation->width, "width", (double) (allocation->width - 1),
"height", (double) allocation->height, "height", (double) (allocation->height - 1),
NULL); NULL);
} }

View File

@ -6,13 +6,13 @@
*/ */
#include <config.h> #include <config.h>
#include <gnome.h> #include <gnome.h>
#include "main.h"
#include "gnome-cal.h" #include "gnome-cal.h"
#include "main.h"
static GtkWidget *prop_win, *r1; static GtkWidget *prop_win, *r1;
static GtkObject *sa, *ea; static GtkObject *sa, *ea;
void static void
start_changed (GtkAdjustment *sa, GtkAdjustment *ea) start_changed (GtkAdjustment *sa, GtkAdjustment *ea)
{ {
if (sa->value > 23.0){ if (sa->value > 23.0){
@ -27,7 +27,7 @@ start_changed (GtkAdjustment *sa, GtkAdjustment *ea)
gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win)); gnome_property_box_changed (GNOME_PROPERTY_BOX (prop_win));
} }
void static void
end_changed (GtkAdjustment *ea, GtkAdjustment *sa) end_changed (GtkAdjustment *ea, GtkAdjustment *sa)
{ {
if (ea->value < 1.0){ if (ea->value < 1.0){