diff options
author | Damon Chaplin <damon@helixcode.com> | 2000-04-24 22:01:46 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2000-04-24 22:01:46 +0800 |
commit | 94a486a7b4207e617da30b172aa9873e0fbb0215 (patch) | |
tree | 032fd6642291a41b61a17692bf5a69e3dd41d316 /calendar/gui/e-day-view-time-item.c | |
parent | 0c3a86937674a6214f68746ee5a273e195228fde (diff) | |
download | gsoc2013-evolution-94a486a7b4207e617da30b172aa9873e0fbb0215.tar.gz gsoc2013-evolution-94a486a7b4207e617da30b172aa9873e0fbb0215.tar.zst gsoc2013-evolution-94a486a7b4207e617da30b172aa9873e0fbb0215.zip |
added new source files and pixmaps, and removed old source files, which
2000-04-24 Damon Chaplin <damon@helixcode.com>
* gui/Makefile.am: added new source files and pixmaps, and removed
old source files, which can be deleted.
* gui/e-week-view-titles-item.[hc]:
* gui/e-week-view-main-item.[hc]:
* gui/e-week-view-event-item.[hc]:
* gui/e-week-view.[hc]: new files implementing the week/month views.
* gui/yearview.xpm:
* gui/monthview.xpm:
* gui/weekview.xpm:
* gui/workweekview.xpm:
* gui/dayview.xpm: new pixmaps for the toolbar buttons. These aren't
intended to be the final pixmaps.
* gui/calendar-commands.c: added radio buttons to the toolbar to
switch between the calendar views, and moved the am_pm_flag here so we
can get rid of view-utils.c.
* gui/gnome-cal.[hc]: made it a subclass of GtkVBox, rearranged the
widgets into 2 notebooks, and added the selection_start_time and
selection_end_time fields.
* gui/goto.c: updated to use new selection time range.
* gui/quick-view.c: added '#include <gtk/gtkwindow.h>' so it compiles.
* gui/e-day-view.[hc]: changed the interface to support the new
selection time range, got rid of a few debugging messages and changed
a few bits.
svn path=/trunk/; revision=2583
Diffstat (limited to 'calendar/gui/e-day-view-time-item.c')
-rw-r--r-- | calendar/gui/e-day-view-time-item.c | 103 |
1 files changed, 102 insertions, 1 deletions
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index aa86cc2ca8..149da55830 100644 --- a/calendar/gui/e-day-view-time-item.c +++ b/calendar/gui/e-day-view-time-item.c @@ -27,6 +27,9 @@ * the EDayView. */ +#include <config.h> +#include <gtk/gtkmenu.h> +#include <gtk/gtkradiomenuitem.h> #include "e-day-view-time-item.h" @@ -62,7 +65,12 @@ static double e_day_view_time_item_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item); - +static gint e_day_view_time_item_event (GnomeCanvasItem *item, + GdkEvent *event); +static void e_day_view_time_item_show_popup_menu (EDayViewTimeItem *dvtmitem, + GdkEvent *event); +static void e_day_view_time_item_on_set_divisions (GtkWidget *item, + EDayViewTimeItem *dvtmitem); static GnomeCanvasItemClass *parent_class; @@ -120,6 +128,7 @@ e_day_view_time_item_class_init (EDayViewTimeItemClass *class) item_class->update = e_day_view_time_item_update; item_class->draw = e_day_view_time_item_draw; item_class->point = e_day_view_time_item_point; + item_class->event = e_day_view_time_item_event; } @@ -310,3 +319,95 @@ e_day_view_time_item_point (GnomeCanvasItem *item, double x, double y, *actual_item = item; return 0.0; } + + +static gint +e_day_view_time_item_event (GnomeCanvasItem *item, + GdkEvent *event) +{ + EDayViewTimeItem *dvtmitem; + + dvtmitem = E_DAY_VIEW_TIME_ITEM (item); + + switch (event->type) { + case GDK_BUTTON_PRESS: + if (event->button.button == 3) { + e_day_view_time_item_show_popup_menu (dvtmitem, event); + return TRUE; + } + break; + case GDK_BUTTON_RELEASE: + + case GDK_MOTION_NOTIFY: + + default: + break; + } + + return FALSE; +} + + +static void +e_day_view_time_item_show_popup_menu (EDayViewTimeItem *dvtmitem, + GdkEvent *event) +{ + static gint divisions[] = { 60, 30, 15, 10, 5 }; + EDayView *day_view; + gint num_divisions = sizeof (divisions) / sizeof (divisions[0]); + GtkWidget *menu, *item; + gchar buffer[256]; + GSList *group = NULL; + gint current_divisions, i; + + g_print ("In e_day_view_time_item_show_popup_menu\n"); + + day_view = dvtmitem->day_view; + g_return_if_fail (day_view != NULL); + + current_divisions = e_day_view_get_mins_per_row (day_view); + + menu = gtk_menu_new (); + + for (i = 0; i < num_divisions; i++) { + sprintf (buffer, _("%02i minute divisions"), divisions[i]); + item = gtk_radio_menu_item_new_with_label (group, buffer); + group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item)); + gtk_widget_show (item); + gtk_menu_append (GTK_MENU (menu), item); + + if (current_divisions == divisions[i]) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE); + + gtk_object_set_data (GTK_OBJECT (item), "divisions", + GINT_TO_POINTER (divisions[i])); + + gtk_signal_connect (GTK_OBJECT (item), "toggled", + e_day_view_time_item_on_set_divisions, + dvtmitem); + } + + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, + event->button.button, event->button.time); + + /* FIXME: Use e-util function to destroy menu when hidden. */ +} + + +static void +e_day_view_time_item_on_set_divisions (GtkWidget *item, + EDayViewTimeItem *dvtmitem) +{ + EDayView *day_view; + gint divisions; + + day_view = dvtmitem->day_view; + g_return_if_fail (day_view != NULL); + + if (!GTK_CHECK_MENU_ITEM (item)->active) + return; + + divisions = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item), + "divisions")); + e_day_view_set_mins_per_row (day_view, divisions); +} |