aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@nuclecu.unam.mx>1998-09-25 10:45:31 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-09-25 10:45:31 +0800
commit9a44eaa38478fdc0642938c824b3238f50d9ad07 (patch)
tree2b78017d632a7cb7ac084f72fd626b1dfd929061
parent492f635013b6bc90847c8dd629517d2592971fc2 (diff)
downloadgsoc2013-evolution-9a44eaa38478fdc0642938c824b3238f50d9ad07.tar
gsoc2013-evolution-9a44eaa38478fdc0642938c824b3238f50d9ad07.tar.gz
gsoc2013-evolution-9a44eaa38478fdc0642938c824b3238f50d9ad07.tar.bz2
gsoc2013-evolution-9a44eaa38478fdc0642938c824b3238f50d9ad07.tar.lz
gsoc2013-evolution-9a44eaa38478fdc0642938c824b3238f50d9ad07.tar.xz
gsoc2013-evolution-9a44eaa38478fdc0642938c824b3238f50d9ad07.tar.zst
gsoc2013-evolution-9a44eaa38478fdc0642938c824b3238f50d9ad07.zip
New function to execute the popup menu in the year view. (day_event):
1998-09-24 Federico Mena Quintero <federico@nuclecu.unam.mx> * year-view.c (do_popup_menu): New function to execute the popup menu in the year view. (day_event): Invoke the popup menu with the context set to days. (new_appointment): New function to create a new appointment from the year view. (do_jump): New function to do the appropriate view/date jumping from the popup menu. * main.c: Fixed two icons in the File menu. svn path=/trunk/; revision=398
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/gui/main.c4
-rw-r--r--calendar/gui/year-view.c224
-rw-r--r--calendar/main.c4
-rw-r--r--calendar/year-view.c224
5 files changed, 442 insertions, 26 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 8440184509..11d14a3d89 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,15 @@
+1998-09-24 Federico Mena Quintero <federico@nuclecu.unam.mx>
+
+ * year-view.c (do_popup_menu): New function to execute the popup
+ menu in the year view.
+ (day_event): Invoke the popup menu with the context set to days.
+ (new_appointment): New function to create a new appointment from
+ the year view.
+ (do_jump): New function to do the appropriate view/date jumping
+ from the popup menu.
+
+ * main.c: Fixed two icons in the File menu.
+
1998-09-21 Federico Mena Quintero <federico@nuclecu.unam.mx>
* main.c: Added underlined shortcuts and accelerators to the main menu.
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index e47eb3e98c..d8a5af2b87 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -399,7 +399,7 @@ static GnomeUIInfo gnome_cal_file_menu [] = {
{ GNOME_APP_UI_ITEM, N_("_Save calendar"), NULL, save_calendar_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE, 's', GDK_CONTROL_MASK, NULL },
{ GNOME_APP_UI_ITEM, N_("Save calendar _as..."), NULL, save_as_calendar_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE, 0, 0, NULL },
+ GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE_AS, 0, 0, NULL },
GNOMEUIINFO_SEPARATOR,
@@ -409,7 +409,7 @@ static GnomeUIInfo gnome_cal_file_menu [] = {
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("_Close this calendar"), NULL, close_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT, 'w', GDK_CONTROL_MASK, NULL },
+ GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CLOSE, 'w', GDK_CONTROL_MASK, NULL },
{ GNOME_APP_UI_ITEM, N_("E_xit"), NULL, quit_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT, 'x', GDK_CONTROL_MASK, NULL },
diff --git a/calendar/gui/year-view.c b/calendar/gui/year-view.c
index 4bf330c1fd..2027cac398 100644
--- a/calendar/gui/year-view.c
+++ b/calendar/gui/year-view.c
@@ -8,7 +8,8 @@
#include <config.h>
#include <gtk/gtkmain.h>
-#include <libgnomeui/gnome-canvas-text.h>
+#include <gnome.h>
+#include "eventedit.h"
#include "year-view.h"
#include "main.h"
#include "mark.h"
@@ -155,28 +156,224 @@ need_resize (YearView *yv)
yv->idle_id = gtk_idle_add (idle_handler, yv);
}
+/* Callback used to destroy the year view's popup menu when the year view itself is destroyed */
+static void
+destroy_menu (GtkWidget *widget, gpointer data)
+{
+ gtk_widget_destroy (GTK_WIDGET (data));
+}
+
+/* Create a new appointment in the highlighted day from the year view's popup menu */
+static void
+new_appointment (GtkWidget *widget, gpointer data)
+{
+ YearView *yv;
+ GtkWidget *ee;
+ time_t *t;
+ struct tm tm;
+ iCalObject *ico;
+
+ yv = YEAR_VIEW (data);
+
+ /* Get the time data from the menu item */
+
+ t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
+ tm = *localtime (t);
+
+ ico = ical_new ("", user_name, "");
+ ico->new = TRUE;
+
+ /* Set the start time of the event to the beginning of the day */
+
+ tm.tm_hour = day_begin;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ ico->dtstart = mktime (&tm);
+
+ /* Set the end time of the event to the end of the day */
+
+ tm.tm_hour = day_end;
+ ico->dtend = mktime (&tm);
+
+ /* Launch the event editor */
+
+ ee = event_editor_new (yv->calendar, ico);
+ gtk_widget_show (ee);
+}
+
+/* Convenience functions to jump to a view and set the time */
+static void
+do_jump (GtkWidget *widget, gpointer data, char *view_name)
+{
+ YearView *yv;
+ time_t *t;
+
+ yv = YEAR_VIEW (data);
+
+ /* Get the time data from the menu item */
+
+ t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
+
+ /* Set the view and time */
+
+ gnome_calendar_set_view (yv->calendar, view_name);
+ gnome_calendar_goto (yv->calendar, *t);
+}
+
+/* The following three callbacks set the view in the calendar and change the time */
+
+static void
+jump_to_day (GtkWidget *widget, gpointer data)
+{
+ do_jump (widget, data, "dayview");
+}
+
+static void
+jump_to_week (GtkWidget *widget, gpointer data)
+{
+ do_jump (widget, data, "weekview");
+}
+
+static void
+jump_to_month (GtkWidget *widget, gpointer data)
+{
+ do_jump (widget, data, "monthview");
+}
+
+/* Information for the year view's popup menu */
+static GnomeUIInfo yv_popup_menu[] = {
+ GNOMEUIINFO_ITEM_STOCK ("_New appointment in this day...", NULL, new_appointment, GNOME_STOCK_MENU_NEW),
+
+ GNOMEUIINFO_SEPARATOR,
+
+ GNOMEUIINFO_ITEM_STOCK ("Jump to this _day", NULL, jump_to_day, GNOME_STOCK_MENU_JUMP_TO),
+ GNOMEUIINFO_ITEM_STOCK ("Jump to this _week", NULL, jump_to_week, GNOME_STOCK_MENU_JUMP_TO),
+ GNOMEUIINFO_ITEM_STOCK ("Jump to this _month", NULL, jump_to_month, GNOME_STOCK_MENU_JUMP_TO),
+ GNOMEUIINFO_END
+};
+
+/* Returns the popup menu cooresponding to the specified year view. If the menu has not been
+ * created yet, it creates it and attaches it to the year view.
+ */
+static GtkWidget *
+get_popup_menu (YearView *yv)
+{
+ GtkWidget *menu;
+
+ menu = gtk_object_get_data (GTK_OBJECT (yv), "popup_menu");
+
+ if (!menu) {
+ menu = gnome_popup_menu_new (yv_popup_menu);
+ gtk_object_set_data (GTK_OBJECT (yv), "popup_menu", menu);
+ gtk_signal_connect (GTK_OBJECT (yv), "destroy",
+ (GtkSignalFunc) destroy_menu,
+ menu);
+ }
+
+ return menu;
+}
+
+/* Executes the year view's popup menu. It may disable/enable some menu items based on the
+ * specified flags. A pointer to a time_t value containing the specified time data is set in the
+ * "time_data" object data key of the menu items.
+ */
+static void
+do_popup_menu (YearView *yv, GdkEventButton *event, int allow_new, int allow_day, int allow_week, int allow_month,
+ int year, int month, int day)
+{
+ GtkWidget *menu;
+ static time_t t;
+
+ menu = get_popup_menu (yv);
+
+ /* Enable/disable items as appropriate */
+
+ gtk_widget_set_sensitive (yv_popup_menu[0].widget, allow_new);
+ gtk_widget_set_sensitive (yv_popup_menu[2].widget, allow_day);
+ gtk_widget_set_sensitive (yv_popup_menu[3].widget, allow_week);
+ gtk_widget_set_sensitive (yv_popup_menu[4].widget, allow_month);
+
+ /* Set the day item relevant to the context */
+
+ t = time_from_day (year, month, day);
+
+ gtk_object_set_data (GTK_OBJECT (yv_popup_menu[0].widget), "time_data", &t);
+ gtk_object_set_data (GTK_OBJECT (yv_popup_menu[2].widget), "time_data", &t);
+ gtk_object_set_data (GTK_OBJECT (yv_popup_menu[3].widget), "time_data", &t);
+ gtk_object_set_data (GTK_OBJECT (yv_popup_menu[4].widget), "time_data", &t);
+
+ gnome_popup_menu_do_popup (menu, NULL, NULL, event, yv);
+}
+
/* Event handler for days in the year's month items */
static gint
day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
{
YearView *yv;
- GnomeCanvasItem *mitem;
+ GnomeMonthItem *mitem;
int child_num, day;
- mitem = data;
- child_num = gnome_month_item_child2num (GNOME_MONTH_ITEM (mitem), item);
- day = gnome_month_item_num2day (GNOME_MONTH_ITEM (mitem), child_num);
+ mitem = GNOME_MONTH_ITEM (data);
+ child_num = gnome_month_item_child2num (mitem, item);
+ day = gnome_month_item_num2day (mitem, child_num);
- yv = gtk_object_get_user_data (GTK_OBJECT (mitem));
+ yv = YEAR_VIEW (item->canvas);
switch (event->type) {
case GDK_BUTTON_PRESS:
- if ((event->button.button == 1) && (day != 0))
+ if (day == 0)
+ break;
+
+ if (event->button.button == 1) {
gnome_calendar_dayjump (yv->calendar,
- time_from_day (GNOME_MONTH_ITEM (mitem)->year,
- GNOME_MONTH_ITEM (mitem)->month,
+ time_from_day (mitem->year,
+ mitem->month,
day));
+ return TRUE;
+ } else if (event->button.button == 3) {
+ do_popup_menu (yv, (GdkEventButton *) event, TRUE, TRUE, TRUE, TRUE,
+ mitem->year, mitem->month, day);
+
+ /* We have to stop the signal emission because mark.c will grab it too and
+ * set the return value to FALSE. Blargh.
+ */
+ gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
+ return TRUE;
+ }
+
+ break;
+
+ default:
break;
+ }
+
+ return FALSE;
+}
+
+/* Event handler for whole month items */
+static gint
+month_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
+{
+ YearView *yv;
+ GnomeMonthItem *mitem;
+
+ mitem = GNOME_MONTH_ITEM (item);
+
+ yv = YEAR_VIEW (item->canvas);
+
+ switch (event->type) {
+ case GDK_BUTTON_PRESS:
+ if (event->button.button != 3)
+ break;
+
+ do_popup_menu (yv, (GdkEventButton *) event, FALSE, FALSE, FALSE, TRUE,
+ mitem->year, mitem->month, 1);
+
+ /* We have to stop the signal emission because mark.c will grab it too and
+ * set the return value to FALSE. Blargh.
+ */
+ gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
+ return TRUE;
default:
break;
@@ -195,7 +392,7 @@ setup_month_item (YearView *yv, int n)
mitem = yv->mitems[n];
- /* Connect signals */
+ /* Connect the day signals */
for (i = 0; i < 42; i++) {
item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), GNOME_MONTH_ITEM_DAY_GROUP + i);
@@ -203,6 +400,12 @@ setup_month_item (YearView *yv, int n)
(GtkSignalFunc) day_event,
mitem);
}
+
+ /* Connect the month signals */
+
+ gtk_signal_connect (GTK_OBJECT (mitem), "event",
+ (GtkSignalFunc) month_event,
+ NULL);
}
static void
@@ -242,7 +445,6 @@ year_view_init (YearView *yv)
/* Month item */
yv->mitems[i] = gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (yv)));
- gtk_object_set_user_data (GTK_OBJECT (yv->mitems[i]), yv);
gnome_canvas_item_set (yv->mitems[i],
"anchor", GTK_ANCHOR_NW,
"start_on_monday", week_starts_on_monday,
diff --git a/calendar/main.c b/calendar/main.c
index e47eb3e98c..d8a5af2b87 100644
--- a/calendar/main.c
+++ b/calendar/main.c
@@ -399,7 +399,7 @@ static GnomeUIInfo gnome_cal_file_menu [] = {
{ GNOME_APP_UI_ITEM, N_("_Save calendar"), NULL, save_calendar_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE, 's', GDK_CONTROL_MASK, NULL },
{ GNOME_APP_UI_ITEM, N_("Save calendar _as..."), NULL, save_as_calendar_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE, 0, 0, NULL },
+ GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_SAVE_AS, 0, 0, NULL },
GNOMEUIINFO_SEPARATOR,
@@ -409,7 +409,7 @@ static GnomeUIInfo gnome_cal_file_menu [] = {
GNOMEUIINFO_SEPARATOR,
{ GNOME_APP_UI_ITEM, N_("_Close this calendar"), NULL, close_cmd, NULL, NULL,
- GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT, 'w', GDK_CONTROL_MASK, NULL },
+ GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CLOSE, 'w', GDK_CONTROL_MASK, NULL },
{ GNOME_APP_UI_ITEM, N_("E_xit"), NULL, quit_cmd, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT, 'x', GDK_CONTROL_MASK, NULL },
diff --git a/calendar/year-view.c b/calendar/year-view.c
index 4bf330c1fd..2027cac398 100644
--- a/calendar/year-view.c
+++ b/calendar/year-view.c
@@ -8,7 +8,8 @@
#include <config.h>
#include <gtk/gtkmain.h>
-#include <libgnomeui/gnome-canvas-text.h>
+#include <gnome.h>
+#include "eventedit.h"
#include "year-view.h"
#include "main.h"
#include "mark.h"
@@ -155,28 +156,224 @@ need_resize (YearView *yv)
yv->idle_id = gtk_idle_add (idle_handler, yv);
}
+/* Callback used to destroy the year view's popup menu when the year view itself is destroyed */
+static void
+destroy_menu (GtkWidget *widget, gpointer data)
+{
+ gtk_widget_destroy (GTK_WIDGET (data));
+}
+
+/* Create a new appointment in the highlighted day from the year view's popup menu */
+static void
+new_appointment (GtkWidget *widget, gpointer data)
+{
+ YearView *yv;
+ GtkWidget *ee;
+ time_t *t;
+ struct tm tm;
+ iCalObject *ico;
+
+ yv = YEAR_VIEW (data);
+
+ /* Get the time data from the menu item */
+
+ t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
+ tm = *localtime (t);
+
+ ico = ical_new ("", user_name, "");
+ ico->new = TRUE;
+
+ /* Set the start time of the event to the beginning of the day */
+
+ tm.tm_hour = day_begin;
+ tm.tm_min = 0;
+ tm.tm_sec = 0;
+ ico->dtstart = mktime (&tm);
+
+ /* Set the end time of the event to the end of the day */
+
+ tm.tm_hour = day_end;
+ ico->dtend = mktime (&tm);
+
+ /* Launch the event editor */
+
+ ee = event_editor_new (yv->calendar, ico);
+ gtk_widget_show (ee);
+}
+
+/* Convenience functions to jump to a view and set the time */
+static void
+do_jump (GtkWidget *widget, gpointer data, char *view_name)
+{
+ YearView *yv;
+ time_t *t;
+
+ yv = YEAR_VIEW (data);
+
+ /* Get the time data from the menu item */
+
+ t = gtk_object_get_data (GTK_OBJECT (widget), "time_data");
+
+ /* Set the view and time */
+
+ gnome_calendar_set_view (yv->calendar, view_name);
+ gnome_calendar_goto (yv->calendar, *t);
+}
+
+/* The following three callbacks set the view in the calendar and change the time */
+
+static void
+jump_to_day (GtkWidget *widget, gpointer data)
+{
+ do_jump (widget, data, "dayview");
+}
+
+static void
+jump_to_week (GtkWidget *widget, gpointer data)
+{
+ do_jump (widget, data, "weekview");
+}
+
+static void
+jump_to_month (GtkWidget *widget, gpointer data)
+{
+ do_jump (widget, data, "monthview");
+}
+
+/* Information for the year view's popup menu */
+static GnomeUIInfo yv_popup_menu[] = {
+ GNOMEUIINFO_ITEM_STOCK ("_New appointment in this day...", NULL, new_appointment, GNOME_STOCK_MENU_NEW),
+
+ GNOMEUIINFO_SEPARATOR,
+
+ GNOMEUIINFO_ITEM_STOCK ("Jump to this _day", NULL, jump_to_day, GNOME_STOCK_MENU_JUMP_TO),
+ GNOMEUIINFO_ITEM_STOCK ("Jump to this _week", NULL, jump_to_week, GNOME_STOCK_MENU_JUMP_TO),
+ GNOMEUIINFO_ITEM_STOCK ("Jump to this _month", NULL, jump_to_month, GNOME_STOCK_MENU_JUMP_TO),
+ GNOMEUIINFO_END
+};
+
+/* Returns the popup menu cooresponding to the specified year view. If the menu has not been
+ * created yet, it creates it and attaches it to the year view.
+ */
+static GtkWidget *
+get_popup_menu (YearView *yv)
+{
+ GtkWidget *menu;
+
+ menu = gtk_object_get_data (GTK_OBJECT (yv), "popup_menu");
+
+ if (!menu) {
+ menu = gnome_popup_menu_new (yv_popup_menu);
+ gtk_object_set_data (GTK_OBJECT (yv), "popup_menu", menu);
+ gtk_signal_connect (GTK_OBJECT (yv), "destroy",
+ (GtkSignalFunc) destroy_menu,
+ menu);
+ }
+
+ return menu;
+}
+
+/* Executes the year view's popup menu. It may disable/enable some menu items based on the
+ * specified flags. A pointer to a time_t value containing the specified time data is set in the
+ * "time_data" object data key of the menu items.
+ */
+static void
+do_popup_menu (YearView *yv, GdkEventButton *event, int allow_new, int allow_day, int allow_week, int allow_month,
+ int year, int month, int day)
+{
+ GtkWidget *menu;
+ static time_t t;
+
+ menu = get_popup_menu (yv);
+
+ /* Enable/disable items as appropriate */
+
+ gtk_widget_set_sensitive (yv_popup_menu[0].widget, allow_new);
+ gtk_widget_set_sensitive (yv_popup_menu[2].widget, allow_day);
+ gtk_widget_set_sensitive (yv_popup_menu[3].widget, allow_week);
+ gtk_widget_set_sensitive (yv_popup_menu[4].widget, allow_month);
+
+ /* Set the day item relevant to the context */
+
+ t = time_from_day (year, month, day);
+
+ gtk_object_set_data (GTK_OBJECT (yv_popup_menu[0].widget), "time_data", &t);
+ gtk_object_set_data (GTK_OBJECT (yv_popup_menu[2].widget), "time_data", &t);
+ gtk_object_set_data (GTK_OBJECT (yv_popup_menu[3].widget), "time_data", &t);
+ gtk_object_set_data (GTK_OBJECT (yv_popup_menu[4].widget), "time_data", &t);
+
+ gnome_popup_menu_do_popup (menu, NULL, NULL, event, yv);
+}
+
/* Event handler for days in the year's month items */
static gint
day_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
{
YearView *yv;
- GnomeCanvasItem *mitem;
+ GnomeMonthItem *mitem;
int child_num, day;
- mitem = data;
- child_num = gnome_month_item_child2num (GNOME_MONTH_ITEM (mitem), item);
- day = gnome_month_item_num2day (GNOME_MONTH_ITEM (mitem), child_num);
+ mitem = GNOME_MONTH_ITEM (data);
+ child_num = gnome_month_item_child2num (mitem, item);
+ day = gnome_month_item_num2day (mitem, child_num);
- yv = gtk_object_get_user_data (GTK_OBJECT (mitem));
+ yv = YEAR_VIEW (item->canvas);
switch (event->type) {
case GDK_BUTTON_PRESS:
- if ((event->button.button == 1) && (day != 0))
+ if (day == 0)
+ break;
+
+ if (event->button.button == 1) {
gnome_calendar_dayjump (yv->calendar,
- time_from_day (GNOME_MONTH_ITEM (mitem)->year,
- GNOME_MONTH_ITEM (mitem)->month,
+ time_from_day (mitem->year,
+ mitem->month,
day));
+ return TRUE;
+ } else if (event->button.button == 3) {
+ do_popup_menu (yv, (GdkEventButton *) event, TRUE, TRUE, TRUE, TRUE,
+ mitem->year, mitem->month, day);
+
+ /* We have to stop the signal emission because mark.c will grab it too and
+ * set the return value to FALSE. Blargh.
+ */
+ gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
+ return TRUE;
+ }
+
+ break;
+
+ default:
break;
+ }
+
+ return FALSE;
+}
+
+/* Event handler for whole month items */
+static gint
+month_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
+{
+ YearView *yv;
+ GnomeMonthItem *mitem;
+
+ mitem = GNOME_MONTH_ITEM (item);
+
+ yv = YEAR_VIEW (item->canvas);
+
+ switch (event->type) {
+ case GDK_BUTTON_PRESS:
+ if (event->button.button != 3)
+ break;
+
+ do_popup_menu (yv, (GdkEventButton *) event, FALSE, FALSE, FALSE, TRUE,
+ mitem->year, mitem->month, 1);
+
+ /* We have to stop the signal emission because mark.c will grab it too and
+ * set the return value to FALSE. Blargh.
+ */
+ gtk_signal_emit_stop_by_name (GTK_OBJECT (item), "event");
+ return TRUE;
default:
break;
@@ -195,7 +392,7 @@ setup_month_item (YearView *yv, int n)
mitem = yv->mitems[n];
- /* Connect signals */
+ /* Connect the day signals */
for (i = 0; i < 42; i++) {
item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), GNOME_MONTH_ITEM_DAY_GROUP + i);
@@ -203,6 +400,12 @@ setup_month_item (YearView *yv, int n)
(GtkSignalFunc) day_event,
mitem);
}
+
+ /* Connect the month signals */
+
+ gtk_signal_connect (GTK_OBJECT (mitem), "event",
+ (GtkSignalFunc) month_event,
+ NULL);
}
static void
@@ -242,7 +445,6 @@ year_view_init (YearView *yv)
/* Month item */
yv->mitems[i] = gnome_month_item_new (gnome_canvas_root (GNOME_CANVAS (yv)));
- gtk_object_set_user_data (GTK_OBJECT (yv->mitems[i]), yv);
gnome_canvas_item_set (yv->mitems[i],
"anchor", GTK_ANCHOR_NW,
"start_on_monday", week_starts_on_monday,