aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gncal-day-view.c
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>1998-04-22 13:19:51 +0800
committerArturo Espinosa <unammx@src.gnome.org>1998-04-22 13:19:51 +0800
commit821548d922e719881f5dff34a34b3d6285b10855 (patch)
tree54c20eeb1fc960a4a0d5ea864741efb8215d09e5 /calendar/gncal-day-view.c
parent6b159ed2c33a1a208395f9b57b7d61d7c1d04842 (diff)
downloadgsoc2013-evolution-821548d922e719881f5dff34a34b3d6285b10855.tar.gz
gsoc2013-evolution-821548d922e719881f5dff34a34b3d6285b10855.tar.zst
gsoc2013-evolution-821548d922e719881f5dff34a34b3d6285b10855.zip
1. Calendar property configuration is finally here with nice live-updates.
1. Calendar property configuration is finally here with nice live-updates. 2. Double clicking on week view jumps to that day in the day view; Context menu allows adding an appointment on that day. Miguel. svn path=/trunk/; revision=182
Diffstat (limited to 'calendar/gncal-day-view.c')
-rw-r--r--calendar/gncal-day-view.c62
1 files changed, 60 insertions, 2 deletions
diff --git a/calendar/gncal-day-view.c b/calendar/gncal-day-view.c
index e62d6ba2e6..59c11eab69 100644
--- a/calendar/gncal-day-view.c
+++ b/calendar/gncal-day-view.c
@@ -2,14 +2,16 @@
*
* Copyright (C) 1998 The Free Software Foundation
*
- * Author: Federico Mena <quartic@gimp.org>
+ * Authors: Federico Mena <quartic@gimp.org>
+ * Miguel de Icaza <miguel@kernel.org>
*/
#include <gtk/gtksignal.h>
#include "gncal-day-view.h"
#include "timeutil.h"
#include "view-utils.h"
-
+#include "main.h"
+#include "eventedit.h"
#define TEXT_BORDER 2
#define MIN_INFO_WIDTH 50
@@ -23,6 +25,8 @@ static void gncal_day_view_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static gint gncal_day_view_expose (GtkWidget *widget,
GdkEventExpose *event);
+static gint gncal_day_view_button_press (GtkWidget *widget,
+ GdkEventButton *event);
static GtkWidgetClass *parent_class;
@@ -66,6 +70,7 @@ gncal_day_view_class_init (GncalDayViewClass *class)
widget_class->realize = gncal_day_view_realize;
widget_class->size_request = gncal_day_view_size_request;
widget_class->expose_event = gncal_day_view_expose;
+ widget_class->button_press_event = gncal_day_view_button_press;
}
static void
@@ -100,6 +105,59 @@ gncal_day_view_destroy (GtkObject *object)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
+static int
+new_appointment (GtkWidget *widget, gpointer data)
+{
+ GncalDayView *dayview = GNCAL_DAY_VIEW (data);
+ iCalObject *ico;
+ GtkWidget *ee;
+ struct tm tm;
+
+ ico = ical_new ("", user_name, "");
+ ico->new = 1;
+
+ tm = *localtime (&dayview->lower);
+ tm.tm_hour = day_begin;
+ ico->dtstart = mktime (&tm);
+ tm.tm_hour++;
+ ico->dtend = mktime (&tm);
+ ee = event_editor_new (dayview->calendar, ico);
+ gtk_widget_show (ee);
+ return 1;
+}
+
+static void
+context_menu (GncalDayView *dayview, GdkEventButton *event)
+{
+ static struct menu_item main_items[] = {
+ { N_("New appointment..."), (GtkSignalFunc) new_appointment, NULL, TRUE }
+ };
+
+ main_items [0].data = dayview;
+ popup_menu (main_items, 1, event->time);
+}
+
+static void
+switch_to_day (GncalDayView *dayview)
+{
+}
+
+static gint
+gncal_day_view_button_press (GtkWidget *widget, GdkEventButton *event)
+{
+ GncalDayView *dayview;
+
+ dayview = GNCAL_DAY_VIEW (widget);
+
+ if (event->button == 3)
+ context_menu (dayview, event);
+
+ if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
+ gnome_calendar_dayjump (dayview->calendar, dayview->lower);
+
+ return TRUE;
+}
+
GtkWidget *
gncal_day_view_new (GnomeCalendar *calendar, time_t lower, time_t upper)
{