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-cal.c6
-rw-r--r--calendar/gui/gnome-cal.h2
-rw-r--r--calendar/gui/gnome-month-item.c146
-rw-r--r--calendar/gui/gnome-month-item.h52
-rw-r--r--calendar/gui/goto.c117
-rw-r--r--calendar/gui/main.c5
7 files changed, 272 insertions, 57 deletions
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 039e866306..87225447f6 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -68,6 +68,7 @@ EXTRA_DIST = \
topic.dat \
gnome-cal.html \
bell.xpm \
+ goto.xpm \
recur.xpm
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 234f782fa3..67061dd505 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -153,6 +153,12 @@ gnome_calendar_dayjump (GnomeCalendar *gcal, time_t time)
}
void
+gnome_calendar_goto_today (GnomeCalendar *gcal)
+{
+ gnome_calendar_goto (gcal, time (NULL));
+}
+
+void
gnome_calendar_set_view (GnomeCalendar *gcal, char *page_name)
{
int page = 0;
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index ec1290a652..7f1534714c 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -52,6 +52,8 @@ void gnome_calendar_goto (GnomeCalendar *gcal,
time_t new_time);
void gnome_calendar_dayjump (GnomeCalendar *gcal,
time_t time);
+/* Jumps to the current day */
+void gnome_calendar_goto_today (GnomeCalendar *gcal);
void gnome_calendar_tag_calendar (GnomeCalendar *cal,
GtkCalendar *gtk_cal);
char *gnome_calendar_get_current_view_name (GnomeCalendar *gcal);
diff --git a/calendar/gui/gnome-month-item.c b/calendar/gui/gnome-month-item.c
index 9b00d4d3c8..045a32d59d 100644
--- a/calendar/gui/gnome-month-item.c
+++ b/calendar/gui/gnome-month-item.c
@@ -12,15 +12,6 @@
#include "gnome-month-item.h"
-/* These are indices into the items array of a GnomeMonthItem structure */
-enum {
- ITEM_HEAD_GROUP = 0, /* 7 groups */
- ITEM_HEAD_BOX = 7, /* 7 boxes */
- ITEM_HEAD_LABEL = 14, /* 7 labels */
- ITEM_DAY_GROUP = 21, /* 42 groups */
- ITEM_DAY_BOX = 63, /* 42 boxes */
- ITEM_DAY_LABEL = 105 /* 42 labels */
-};
/* Number of days in a month, for normal and leap years */
@@ -196,13 +187,13 @@ reshape_headings (GnomeMonthItem *mitem)
for (i = 0; i < 7; i++) {
/* Group */
- gnome_canvas_item_set (mitem->items[ITEM_HEAD_GROUP + i],
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i],
"x", width * i,
"y", 0.0,
NULL);
/* Box */
- gnome_canvas_item_set (mitem->items[ITEM_HEAD_BOX + i],
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_BOX + i],
"x1", 0.0,
"y1", 0.0,
"x2", width,
@@ -217,7 +208,7 @@ reshape_headings (GnomeMonthItem *mitem)
mitem->head_height - mitem->head_padding,
&x, &y);
- gnome_canvas_item_set (mitem->items[ITEM_HEAD_LABEL + i],
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
"x", x,
"y", y,
"anchor", mitem->head_anchor,
@@ -242,13 +233,13 @@ reshape_days (GnomeMonthItem *mitem)
for (row = 0; row < 6; row++)
for (col = 0; col < 7; col++) {
/* Group */
- gnome_canvas_item_set (mitem->items[ITEM_DAY_GROUP + i],
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i],
"x", width * col,
"y", mitem->head_height + height * row,
NULL);
/* Box */
- gnome_canvas_item_set (mitem->items[ITEM_DAY_BOX + i],
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_BOX + i],
"x1", 0.0,
"y1", 0.0,
"x2", width,
@@ -263,7 +254,7 @@ reshape_days (GnomeMonthItem *mitem)
height - mitem->day_padding,
&x, &y);
- gnome_canvas_item_set (mitem->items[ITEM_DAY_LABEL + i],
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
"x", x,
"y", y,
"anchor", mitem->day_anchor,
@@ -293,21 +284,21 @@ create_headings (GnomeMonthItem *mitem)
for (i = 0; i < 7; i++) {
/* Group */
- mitem->items[ITEM_HEAD_GROUP + i] =
+ mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem),
gnome_canvas_group_get_type (),
NULL);
/* Box */
- mitem->items[ITEM_HEAD_BOX + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_HEAD_GROUP + i]),
+ mitem->items[GNOME_MONTH_ITEM_HEAD_BOX + i] =
+ gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_HEAD_GROUP + i]),
gnome_canvas_rect_get_type (),
"fill_color", "black",
NULL);
/* Label */
- mitem->items[ITEM_HEAD_LABEL + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_HEAD_GROUP + i]),
+ 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",
@@ -412,11 +403,10 @@ static void
set_days (GnomeMonthItem *mitem)
{
int i, ofs;
- int days[42];
int start, end;
char buf[100];
- build_month (mitem->month, mitem->year, days, &start, &end);
+ build_month (mitem->month, mitem->year, mitem->day_numbers, &start, &end);
if (mitem->start_on_monday)
ofs = (start + 6) % 7;
@@ -426,15 +416,15 @@ set_days (GnomeMonthItem *mitem)
/* Clear days before start of month */
for (i = 0; i < ofs; i++)
- gnome_canvas_item_set (mitem->items[ITEM_DAY_LABEL + i],
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
"text", NULL,
NULL);
/* Set days of month */
for (; start <= end; start++, i++) {
- sprintf (buf, "%d", days[start]);
- gnome_canvas_item_set (mitem->items[ITEM_DAY_LABEL + i],
+ sprintf (buf, "%d", mitem->day_numbers[start]);
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
"text", buf,
NULL);
}
@@ -442,7 +432,7 @@ set_days (GnomeMonthItem *mitem)
/* Clear days after end of month */
for (; i < 42; i++)
- gnome_canvas_item_set (mitem->items[ITEM_DAY_LABEL + i],
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_DAY_LABEL + i],
"text", NULL,
NULL);
}
@@ -457,22 +447,22 @@ create_days (GnomeMonthItem *mitem)
for (i = 0; i < 42; i++) {
/* Group */
- mitem->items[ITEM_DAY_GROUP + i] =
+ mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i] =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem),
gnome_canvas_group_get_type (),
NULL);
/* Box */
- mitem->items[ITEM_DAY_BOX + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_DAY_GROUP + i]),
+ mitem->items[GNOME_MONTH_ITEM_DAY_BOX + i] =
+ gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[GNOME_MONTH_ITEM_DAY_GROUP + i]),
gnome_canvas_rect_get_type (),
"outline_color", "black",
- "fill_color", "#d6d6d6",
+ "fill_color", "#d6d6d6d6d6d6",
NULL);
/* Label */
- mitem->items[ITEM_DAY_LABEL + i] =
- gnome_canvas_item_new (GNOME_CANVAS_GROUP (mitem->items[ITEM_DAY_GROUP + i]),
+ 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",
@@ -489,7 +479,7 @@ set_day_names (GnomeMonthItem *mitem)
int i;
for (i = 0; i < 7; i++)
- gnome_canvas_item_set (mitem->items[ITEM_HEAD_LABEL + i],
+ gnome_canvas_item_set (mitem->items[GNOME_MONTH_ITEM_HEAD_LABEL + i],
"text", mitem->day_names[mitem->start_on_monday ? ((i + 1) % 7) : i],
NULL);
}
@@ -498,30 +488,20 @@ set_day_names (GnomeMonthItem *mitem)
static void
create_items (GnomeMonthItem *mitem)
{
- /* 7 heading groups
- * 7 heading boxes
- * 7 heading labels
- * 42 day groups
- * 42 day boxes
- * 42 day labels
- * ------------------
- * 147 items total
- */
-
- mitem->items = g_new (GnomeCanvasItem *, 147);
+ mitem->items = g_new (GnomeCanvasItem *, GNOME_MONTH_ITEM_LAST);
create_headings (mitem);
create_days (mitem);
/* Initialize by default to three-letter day names */
- mitem->day_names[0] = _("Sun");
- mitem->day_names[1] = _("Mon");
- mitem->day_names[2] = _("Tue");
- mitem->day_names[3] = _("Wed");
- mitem->day_names[4] = _("Thu");
- mitem->day_names[5] = _("Fri");
- mitem->day_names[6] = _("Sat");
+ mitem->day_names[0] = g_strdup (_("Sun"));
+ mitem->day_names[1] = g_strdup (_("Mon"));
+ mitem->day_names[2] = g_strdup (_("Tue"));
+ mitem->day_names[3] = g_strdup (_("Wed"));
+ mitem->day_names[4] = g_strdup (_("Thu"));
+ mitem->day_names[5] = g_strdup (_("Fri"));
+ mitem->day_names[6] = g_strdup (_("Sat"));
set_day_names (mitem);
reshape (mitem);
@@ -830,3 +810,67 @@ gnome_month_item_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
break;
}
}
+
+GnomeCanvasItem *
+gnome_month_item_num2child (GnomeMonthItem *mitem, GnomeMonthItemChild child_num)
+{
+ g_return_val_if_fail (mitem != NULL, NULL);
+ g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), NULL);
+
+ return mitem->items[child_num];
+}
+
+GnomeMonthItemChild
+gnome_month_item_child2num (GnomeMonthItem *mitem, GnomeCanvasItem *child)
+{
+ int i;
+
+ g_return_val_if_fail (mitem != NULL, -1);
+ g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), -1);
+ g_return_val_if_fail (child != NULL, -1);
+ g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (child), -1);
+
+ for (i = 0; i < GNOME_MONTH_ITEM_LAST; i++)
+ if (mitem->items[i] == child)
+ return i;
+
+ return -1;
+}
+
+int
+gnome_month_item_num2day (GnomeMonthItem *mitem, GnomeMonthItemChild child_num)
+{
+ g_return_val_if_fail (mitem != NULL, 0);
+ g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), 0);
+
+ if ((child_num >= GNOME_MONTH_ITEM_DAY_GROUP) && (child_num < GNOME_MONTH_ITEM_LAST)) {
+ child_num = (child_num - GNOME_MONTH_ITEM_DAY_GROUP) % 42;
+ return mitem->day_numbers[child_num];
+ } else
+ return 0;
+}
+
+int
+gnome_month_item_day2index (GnomeMonthItem *mitem, int day_num)
+{
+ int i;
+
+ g_return_val_if_fail (mitem != NULL, -1);
+ g_return_val_if_fail (GNOME_IS_MONTH_ITEM (mitem), -1);
+ g_return_val_if_fail (day_num >= 1, -1);
+
+ /* Find first day of month */
+
+ for (i = 0; mitem->day_numbers[i] == 0; i++)
+ ;
+
+ /* Find the specified day */
+
+ for (; (mitem->day_numbers[i] != 0) && (i < 42); i++)
+ if (mitem->day_numbers[i] == day_num)
+ return i;
+
+ /* Bail out */
+
+ return -1;
+}
diff --git a/calendar/gui/gnome-month-item.h b/calendar/gui/gnome-month-item.h
index f6523aff94..b1b11f9d01 100644
--- a/calendar/gui/gnome-month-item.h
+++ b/calendar/gui/gnome-month-item.h
@@ -16,6 +16,37 @@
BEGIN_GNOME_DECLS
+/* These values are used to identify the canvas items that make up a complete GnomeMonthItem, which
+ * is made up of the following "pieces":
+ *
+ * Headings line:
+ * - 7 GnomeCanvasGroups:
+ * Each group contains one box (GnomeCanvasRectangle) and one label
+ * (GnomeCanvasText)
+ *
+ * Day slots:
+ * - 42 GnomeCanvasGroups:
+ * Each group contains one box (GnomeCanvasRectangle) and one label
+ * (GnomeCanvasText)
+ *
+ * The headings are organized from left to right. The day slots are organized as a table in
+ * row-major order.
+ *
+ * If you want to access the individual items of the GnomeMonthItem, you can use these numbers with
+ * the gnome_month_item_num2child() function. If you want to convert a number into the
+ * corresponding GnomeCanvasItem, you can use the gnome_month_item_child2num() function.
+ */
+typedef enum {
+ GNOME_MONTH_ITEM_HEAD_GROUP = 0, /* 7 groups for headings */
+ GNOME_MONTH_ITEM_HEAD_BOX = 7, /* 7 boxes for headings */
+ GNOME_MONTH_ITEM_HEAD_LABEL = 14, /* 7 labels for headings */
+ GNOME_MONTH_ITEM_DAY_GROUP = 21, /* 42 groups for days */
+ GNOME_MONTH_ITEM_DAY_BOX = 63, /* 42 boxes for days */
+ GNOME_MONTH_ITEM_DAY_LABEL = 105, /* 42 labels for days */
+ GNOME_MONTH_ITEM_LAST = 147 /* total number of items */
+} GnomeMonthItemChild;
+
+
#define GNOME_TYPE_MONTH_ITEM (gnome_month_item_get_type ())
#define GNOME_MONTH_ITEM(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_MONTH_ITEM, GnomeMonthItem))
#define GNOME_MONTH_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_MONTH_ITEM, GnomeMonthItemClass))
@@ -47,6 +78,7 @@ struct _GnomeMonthItem {
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 */
int start_on_monday : 1; /* Start the week on Monday? If false, then start from Sunday */
};
@@ -65,6 +97,26 @@ GnomeCanvasItem *gnome_month_item_new (GnomeCanvasGroup *parent);
/* Constructor function useful for derived classes */
void gnome_month_item_construct (GnomeMonthItem *mitem);
+/* Returns the child item defined by the child number (as specified on the GnomeMonthItemChild
+ * enumeration above).
+ */
+GnomeCanvasItem *gnome_month_item_num2child (GnomeMonthItem *mitem, GnomeMonthItemChild child_num);
+
+/* Returns the number of the specified child item, as defined on the GnomeMonthItemChild enumeration
+ * above. If the specified object is not found, it returns -1.
+ */
+GnomeMonthItemChild gnome_month_item_child2num (GnomeMonthItem *mitem, GnomeCanvasItem *child);
+
+/* Returns the number of the day relevant to the specified child item. Day numbers are 1-based. If
+ * the specified child is outside the range of displayed days, then it returns 0.
+ */
+int gnome_month_item_num2day (GnomeMonthItem *mitem, GnomeMonthItemChild child_num);
+
+/* Returns the index (0-41) of the specified date within the table of days. If the day number is
+ * invalid for the current monthly calendar, then -1 is returned.
+ */
+int gnome_month_item_day2index (GnomeMonthItem *mitem, int day_num);
+
END_GNOME_DECLS
diff --git a/calendar/gui/goto.c b/calendar/gui/goto.c
index a21e162e00..7ba464bd7c 100644
--- a/calendar/gui/goto.c
+++ b/calendar/gui/goto.c
@@ -9,6 +9,7 @@
#include <gnome.h>
#include "gnome-cal.h"
#include "gnome-month-item.h"
+#include "timeutil.h"
static void
@@ -16,13 +17,29 @@ highlight_current_day (GnomeMonthItem *mitem)
{
struct tm *tm;
time_t t;
+ GnomeCanvasItem *label;
+ int i;
t = time (NULL);
tm = localtime (&t);
+ /* First clear all the days to normal */
+
+ for (i = 0; i < 42; i++) {
+ label = gnome_month_item_num2child (mitem, i + GNOME_MONTH_ITEM_DAY_LABEL);
+ gnome_canvas_item_set (label,
+ "fill_color", "black",
+ NULL);
+ }
+
+ /* Highlight the current day, if appropriate */
+
if ((mitem->year == (tm->tm_year + 1900)) && (mitem->month == tm->tm_mon)) {
- ;
- /* FIXME */
+ i = gnome_month_item_day2index (mitem, tm->tm_mday);
+ label = gnome_month_item_num2child (mitem, i + GNOME_MONTH_ITEM_DAY_LABEL);
+ gnome_canvas_item_set (label,
+ "fill_color", "blue",
+ NULL);
}
}
@@ -147,12 +164,66 @@ set_scroll_region (GtkWidget *widget, GtkAllocation *allocation, gpointer data)
allocation->width, allocation->height);
}
+/* Event handler for day groups in the month item. A button press makes the calendar jump to the
+ * selected day and destroys the Go-to dialog box. Days are prelighted as appropriate on
+ * enter_notify and leave_notify events.
+ */
+static gint
+day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
+{
+ GtkWidget *dialog;
+ GnomeCalendar *gcal;
+ GnomeMonthItem *mitem;
+ GnomeCanvasItem *box;
+ int child_num, day;
+
+ dialog = GTK_WIDGET (data);
+ gcal = gtk_object_get_data (GTK_OBJECT (dialog), "gnome_calendar");
+ mitem = gtk_object_get_data (GTK_OBJECT (dialog), "month_item");
+
+ child_num = gnome_month_item_child2num (mitem, item);
+ day = gnome_month_item_num2day (mitem, child_num);
+
+ if (day == 0)
+ return FALSE;
+
+ switch (event->type) {
+ case GDK_BUTTON_PRESS:
+ if ((event->button.button == 1) && (day != 0)) {
+ gnome_calendar_goto (gcal, time_from_day (mitem->year, mitem->month, day));
+ gtk_widget_destroy (dialog);
+ }
+ break;
+
+ case GDK_ENTER_NOTIFY:
+ box = gnome_month_item_num2child (mitem, child_num - GNOME_MONTH_ITEM_DAY_GROUP + GNOME_MONTH_ITEM_DAY_BOX);
+ gnome_canvas_item_set (box,
+ "fill_color", "#ea60ea60ea60",
+ NULL);
+ break;
+
+ case GDK_LEAVE_NOTIFY:
+ box = gnome_month_item_num2child (mitem, child_num - GNOME_MONTH_ITEM_DAY_GROUP + GNOME_MONTH_ITEM_DAY_BOX);
+ gnome_canvas_item_set (box,
+ "fill_color", "#d6d6d6d6d6d6",
+ NULL);
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
/* Creates the canvas with the month item for selecting days */
static GtkWidget *
create_days (GtkWidget *dialog, GnomeCalendar *gcal, int day, int month, int year)
{
GtkWidget *canvas;
GnomeCanvasItem *mitem;
+ int i;
+ GnomeCanvasItem *day_group;
canvas = gnome_canvas_new ();
gnome_canvas_set_size (GNOME_CANVAS (canvas), 150, 120);
@@ -174,15 +245,38 @@ create_days (GtkWidget *dialog, GnomeCalendar *gcal, int day, int month, int yea
(GtkSignalFunc) set_scroll_region,
mitem);
+ /* Bind the day groups to our event handler */
+
+ for (i = 0; i < 42; i++) {
+ day_group = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), i + GNOME_MONTH_ITEM_DAY_GROUP);
+ gtk_signal_connect (GTK_OBJECT (day_group), "event",
+ (GtkSignalFunc) day_event,
+ dialog);
+ }
+
return canvas;
}
+static void
+goto_today (GtkWidget *widget, gpointer data)
+{
+ GtkWidget *dialog;
+ GnomeCalendar *gcal;
+
+ dialog = GTK_WIDGET (data);
+ gcal = gtk_object_get_data (GTK_OBJECT (dialog), "gnome_calendar");
+
+ gnome_calendar_goto_today (gcal);
+ gtk_widget_destroy (dialog);
+}
+
/* Creates a "goto date" dialog and runs it */
void
goto_dialog (GnomeCalendar *gcal)
{
GtkWidget *dialog;
GtkWidget *vbox;
+ GtkWidget *hbox;
GtkWidget *w;
struct tm *tm;
@@ -191,6 +285,7 @@ goto_dialog (GnomeCalendar *gcal)
dialog = gnome_dialog_new (_("Go to date"),
GNOME_STOCK_BUTTON_CANCEL,
NULL);
+ gtk_object_set_data (GTK_OBJECT (dialog), "gnome_calendar", gcal);
vbox = GNOME_DIALOG (dialog)->vbox;
@@ -222,9 +317,23 @@ goto_dialog (GnomeCalendar *gcal)
gtk_box_pack_start (GTK_BOX (vbox), w, TRUE, TRUE, 0);
gtk_widget_show (w);
+ /* Today button */
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
+ w = gtk_button_new_with_label (_("Go to today"));
+ gtk_signal_connect (GTK_OBJECT (w), "clicked",
+ (GtkSignalFunc) goto_today,
+ dialog);
+ gtk_box_pack_start (GTK_BOX (hbox), w, FALSE, FALSE, 0);
+ gtk_widget_show (w);
+
/* Run! */
gnome_dialog_set_modal (GNOME_DIALOG (dialog));
-
- printf ("el dialogo regreso %d\n", gnome_dialog_run_and_destroy (GNOME_DIALOG (dialog)));
+ gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
+ gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (gcal));
+ gtk_widget_show (dialog);
}
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index ebb008927f..9240acdfc1 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -19,6 +19,7 @@
#include "gnome-cal.h"
#include "main.h"
#include "timeutil.h"
+#include "goto.xpm"
#define COOKIE_USER_HOME_DIR ((char *) -1)
@@ -223,7 +224,7 @@ next_clicked (GtkWidget *widget, GnomeCalendar *gcal)
static void
today_clicked (GtkWidget *widget, GnomeCalendar *gcal)
{
- gnome_calendar_goto (gcal, time (NULL));
+ gnome_calendar_goto_today (gcal);
}
static void
@@ -386,7 +387,7 @@ static GnomeUIInfo gnome_toolbar [] = {
GNOMEUIINFO_SEPARATOR,
- GNOMEUIINFO_ITEM_STOCK (N_("Go to"), N_("Go to a specific date"), goto_clicked, GNOME_STOCK_PIXMAP_STOP),
+ GNOMEUIINFO_ITEM (N_("Go to"), N_("Go to a specific date"), goto_clicked, goto_xpm),
GNOMEUIINFO_END
};