diff options
author | Federico Mena Quintero <federico@nuclecu.unam.mx> | 1998-09-04 08:43:06 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1998-09-04 08:43:06 +0800 |
commit | 84fa00e42a593a4e4e64866090df30c9d7c066b9 (patch) | |
tree | 2c5c5f1566aad424cdc537f55cf08d8c7e3bea1d /calendar/year-view.c | |
parent | de704a7b4576df4f84ed859c7d3337cce0f89e57 (diff) | |
download | gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.gz gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.bz2 gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.lz gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.xz gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.tar.zst gsoc2013-evolution-84fa00e42a593a4e4e64866090df30c9d7c066b9.zip |
Finished with the properties dialog. You can jump to days from the year
Finished with the properties dialog. You can jump to days from the year view
now. I'm off to rewrite gnome-popupmenu and friends.
1998-09-03 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gncal-full-day.c (gncal_full_day_forall): Updated foreach ->
forall from Gtk changes, bleah.
* year-view.c (day_event): New function to handle events from
days. Jumps to the day that is clicked.
* main.c: Use a watch cursor while the previous/today/next
functions are doing their job.
* mark.c (month_item_prepare_prelight): New public utility
function to prepare a month item for prelighting. It will store
the proper prelight information and attach the appropriate signals.
(mark_current_day): Make the current day bold as well (useful for
color-blind people, I guess).
* prop.c (set_current_day): Reset the date in the sample calendar
and mark the current day.
(fake_mark_days): Mark fake events in the sample calendar.
* year-view.c (year_view_set): Use the general prelighting engine.
* goto.c (day_event): Just process button presses, as prelighting
is done behind the scenes now.
(update): Use the general prelighting engine.
* prop.c (create_colors_page): We can now configure the colors of
svn path=/trunk/; revision=361
Diffstat (limited to 'calendar/year-view.c')
-rw-r--r-- | calendar/year-view.c | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/calendar/year-view.c b/calendar/year-view.c index 7458b61500..97795628a4 100644 --- a/calendar/year-view.c +++ b/calendar/year-view.c @@ -154,6 +154,56 @@ need_resize (YearView *yv) yv->idle_id = gtk_idle_add (idle_handler, 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; + 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); + + yv = gtk_object_get_user_data (GTK_OBJECT (mitem)); + + switch (event->type) { + case GDK_BUTTON_PRESS: + if ((event->button.button == 1) && (day != 0)) + gnome_calendar_dayjump (yv->calendar, + time_from_day (GNOME_MONTH_ITEM (mitem)->year, + GNOME_MONTH_ITEM (mitem)->month, + day)); + break; + + default: + break; + } + + return FALSE; +} + +/* Sets up the month item with the specified index -- connects signals for handling events, etc. */ +static void +setup_month_item (YearView *yv, int n) +{ + GnomeCanvasItem *mitem; + GnomeCanvasItem *item; + int i; + + mitem = yv->mitems[n]; + + /* Connect signals */ + + for (i = 0; i < 42; i++) { + item = gnome_month_item_num2child (GNOME_MONTH_ITEM (mitem), GNOME_MONTH_ITEM_DAY_GROUP + i); + gtk_signal_connect (GTK_OBJECT (item), "event", + (GtkSignalFunc) day_event, + mitem); + } +} + static void year_view_init (YearView *yv) { @@ -191,10 +241,12 @@ 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, NULL); + setup_month_item (yv, i); } /* We will need to resize the items when we paint for the first time */ @@ -317,10 +369,7 @@ year_view_set (YearView *yv, time_t year) /* Unmark and re-mark all the months */ - for (i = 0; i < 12; i++) { - unmark_month_item (GNOME_MONTH_ITEM (yv->mitems[i])); - mark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), yv->calendar->cal); - } + year_view_colors_changed (yv); } void @@ -350,5 +399,6 @@ year_view_colors_changed (YearView *yv) for (i = 0; i < 12; i++) { unmark_month_item (GNOME_MONTH_ITEM (yv->mitems[i])); mark_month_item (GNOME_MONTH_ITEM (yv->mitems[i]), yv->calendar->cal); + month_item_prepare_prelight (GNOME_MONTH_ITEM (yv->mitems[i]), default_prelight_func, NULL); } } |