[evolution-patches] Patch for #45775, Calendar related



Rodrigo and JPR,
Hi, I'm a new intern at SUN. Bug #45775 has been reassigned to me. Here is a patch for it based on HEAD and it simply adds a calendar keyboard navigation(ctrl+o) to open a dialog for editing the currently selected item in DayView and WeekView. Would you like to spend a little time to review it? Thanks.
       Merry Christmas:-)

Index: evolution/calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2027
diff -u -r1.2027 ChangeLog
--- evolution/calendar/ChangeLog    21 Dec 2003 17:05:14 -0000    1.2027
+++ evolution/calendar/ChangeLog    23 Dec 2003 09:16:18 -0000
@@ -1,3 +1,11 @@
+2003-12-23  Kidd Wang  <kidd wang sun com>
+
+ * gui/calendar-commands.c (file_open_event_cb): add a menu item for "open appointment".
+
+ * gui/e-cal-view.[ch] (e_calendar_view_open_event): add a signal--"open_event", and bind it to "ctrl+o". When the signal is delivered, a dialog will be opened to edit the selected event.
+
+ * gui/e-calendar-table.c (e_calendar_table_on_key_press): press "ctrl-o" to open a dialog.
+
2003-12-21  JP Rosevear <jpr ximian com>

    * gui/e-itip-control.[hc]: rewrite for new ecal api, cache all
Index: evolution/calendar/gui/calendar-commands.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-commands.c,v
retrieving revision 1.138
diff -u -r1.138 calendar-commands.c
--- evolution/calendar/gui/calendar-commands.c 19 Dec 2003 19:50:49 -0000 1.138
+++ evolution/calendar/gui/calendar-commands.c    23 Dec 2003 09:16:21 -0000
@@ -71,6 +71,17 @@
    guint taskpad_focused : 1;
} FocusData;

+static void
+file_open_event_cb (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+    GnomeCalendar *gcal;
+
+    gcal = GNOME_CALENDAR (data);
+
+ e_calendar_view_open_event (gnome_calendar_get_current_view_widget (gcal));
+}
+
+
/* Prints the calendar at its current view and time range */
static void
print (GnomeCalendar *gcal, gboolean preview)
@@ -532,6 +543,9 @@
            read_only = TRUE;
    }

+    bonobo_ui_component_set_prop (uic, "/commands/EventOpen", "sensitive",
+                      n_selected == 0 || read_only ? "0" : "1",
+                      NULL);
    bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive",
                      n_selected == 0 || read_only ? "0" : "1",
                      NULL);
@@ -685,6 +699,7 @@


static BonoboUIVerb verbs [] = {
+    BONOBO_UI_VERB ("EventOpen", file_open_event_cb),
    BONOBO_UI_VERB ("CalendarPrint", file_print_cb),
    BONOBO_UI_VERB ("CalendarPrintPreview", file_print_preview_cb),

Index: evolution/calendar/gui/e-cal-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-view.c,v
retrieving revision 1.27
diff -u -r1.27 e-cal-view.c
--- evolution/calendar/gui/e-cal-view.c 16 Dec 2003 23:29:07 -0000 1.27
+++ evolution/calendar/gui/e-cal-view.c    23 Dec 2003 09:16:29 -0000
@@ -25,6 +25,8 @@
#include <string.h>
#include <gtk/gtkimage.h>
#include <gtk/gtkstock.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtkbindings.h>
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
#include "e-util/e-dialog-utils.h"
@@ -94,6 +96,7 @@
    TIMEZONE_CHANGED,
    EVENT_CHANGED,
    EVENT_ADDED,
+    OPEN_EVENT,
    LAST_SIGNAL
};

@@ -143,6 +146,8 @@
    GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
    GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);

+    GtkBindingSet *binding_set;
+
    parent_class = g_type_class_peek_parent (klass);

    /* Method override */
@@ -160,6 +165,7 @@
    klass->set_selected_time_range = NULL;
    klass->get_visible_time_range = NULL;
    klass->update_query = NULL;
+    klass->open_event = e_calendar_view_open_event;

    g_object_class_install_property (gobject_class, PROP_MODEL,
g_param_spec_object ("model", NULL, NULL, E_TYPE_CAL_MODEL,
@@ -202,6 +208,15 @@
                  G_TYPE_NONE, 1,
                  G_TYPE_POINTER);

+    e_calendar_view_signals[OPEN_EVENT] =
+        g_signal_new ("open_event",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                  G_STRUCT_OFFSET (ECalendarViewClass, open_event),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__VOID,
+                  G_TYPE_NONE, 0);
+
    e_calendar_view_signals[EVENT_ADDED] =
        g_signal_new ("event_added",
                  G_TYPE_FROM_CLASS (object_class),
@@ -216,6 +231,17 @@
    if (!clipboard_atom)
        clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);

+
+        /*
+         * Key bindings
+         */
+
+    binding_set = gtk_binding_set_by_class (klass);
+
+    gtk_binding_entry_add_signal (binding_set, GDK_o,
+                                      GDK_CONTROL_MASK,
+                                      "open_event", 0);
+
    /* init the accessibility support for e_day_view */
     e_cal_view_a11y_init ();
}
@@ -1331,6 +1357,23 @@
g_signal_connect (popup, "selection-done", G_CALLBACK (free_view_popup), cal_view);

    return popup;
+}
+
+void
+e_calendar_view_open_event (ECalendarView *cal_view)
+{
+    GList *selected;
+
+    selected = e_calendar_view_get_selected_events (cal_view);
+    if (selected) {
+        ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
+
+        if (event)
+ e_calendar_view_edit_appointment (cal_view, event->comp_data->client,
+                             event->comp_data->icalcomp, FALSE);
+
+        g_list_free (selected);
+    }
}

/**
Index: evolution/calendar/gui/e-cal-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-view.h,v
retrieving revision 1.17
diff -u -r1.17 e-cal-view.h
--- evolution/calendar/gui/e-cal-view.h    7 Nov 2003 05:51:58 -0000    1.17
+++ evolution/calendar/gui/e-cal-view.h    23 Dec 2003 09:16:30 -0000
@@ -87,6 +87,7 @@
void (* set_selected_time_range) (ECalendarView *cal_view, time_t start_time, time_t end_time); gboolean (* get_visible_time_range) (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
    void (* update_query) (ECalendarView *cal_view);
+    void (* open_event) (ECalendarView *cal_view);
};

GType          e_calendar_view_get_type (void);
@@ -131,6 +132,8 @@
                        ECal *client,
                        icalcomponent *icalcomp,
                        gboolean meeting);
+void           e_calendar_view_open_event (ECalendarView *cal_view);
+

G_END_DECLS

Index: evolution/calendar/gui/e-calendar-table.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-table.c,v
retrieving revision 1.103
diff -u -r1.103 e-calendar-table.c
--- evolution/calendar/gui/e-calendar-table.c 16 Dec 2003 23:29:07 -0000 1.103
+++ evolution/calendar/gui/e-calendar-table.c    23 Dec 2003 09:16:37 -0000
@@ -1283,6 +1283,10 @@
    if (event->keyval == GDK_Delete) {
        delete_cb (NULL, cal_table);
        return TRUE;
+    } else if ((event->keyval == GDK_o)
+           &&(event->state & GDK_CONTROL_MASK)) {
+        open_task_by_row (cal_table, row);
+ return TRUE; }

    return FALSE;
Index: evolution/calendar/gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.229
diff -u -r1.229 e-day-view.c
--- evolution/calendar/gui/e-day-view.c 9 Dec 2003 01:23:48 -0000 1.229
+++ evolution/calendar/gui/e-day-view.c    23 Dec 2003 09:17:16 -0000
@@ -2101,7 +2101,7 @@
    day_view->lower = start_time;
    day_view->upper = day_view->day_starts[day_view->days_shown];

-    e_day_view_update_query (day_view);
+    e_day_view_update_query ((ECalendarView *) day_view);
}


Index: evolution/ui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ui/ChangeLog,v
retrieving revision 1.368
diff -u -r1.368 ChangeLog
--- evolution/ui/ChangeLog    18 Dec 2003 16:08:39 -0000    1.368
+++ evolution/ui/ChangeLog    23 Dec 2003 09:17:42 -0000
@@ -1,3 +1,7 @@
+2003-12-23  Kidd Wang  <kidd wang sun com>
+
+    * evolution-calendar.xml: Add a menu item [Open Appointment] to [File].
+
2003-12-18  Rodney Dawes  <dobey ximian com>

    * evolution-mail-message.xml:
Index: evolution/ui/evolution-calendar.xml
===================================================================
RCS file: /cvs/gnome/evolution/ui/evolution-calendar.xml,v
retrieving revision 1.65
diff -u -r1.65 evolution-calendar.xml
--- evolution/ui/evolution-calendar.xml 17 Dec 2003 13:57:28 -0000 1.65
+++ evolution/ui/evolution-calendar.xml    23 Dec 2003 09:17:43 -0000
@@ -1,5 +1,6 @@
<Root>
  <commands>
+ <cmd name="EventOpen" _tip="View the current appointment" accel="*Control*o"/> <cmd name="CalendarPrint" _tip="Print this calendar" pixtype="stock" pixname="gtk-print"
     accel="*Control*p"/>
<cmd name="CalendarPrintPreview" _tip="Previews the calendar to be printed" pixtype="stock" pixname="gtk-print-preview"/>
@@ -29,6 +30,9 @@

  <menu>
    <submenu name="File">
+      <placeholder name="FileOps">
+ <menuitem name="EventOpen" verb="EventOpen" _label="_Open Appointment"/>
+      </placeholder>
      <placeholder name="Print">
    <menuitem name="PrintPreview" verb="CalendarPrintPreview"
          _label="Print Pre_view"/>

Index: evolution/calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2027
diff -u -r1.2027 ChangeLog
--- evolution/calendar/ChangeLog	21 Dec 2003 17:05:14 -0000	1.2027
+++ evolution/calendar/ChangeLog	23 Dec 2003 09:16:18 -0000
@@ -1,3 +1,11 @@
+2003-12-23  Kidd Wang  <kidd wang sun com>
+
+	* gui/calendar-commands.c (file_open_event_cb): add a menu item for "open appointment".
+
+	* gui/e-cal-view.[ch] (e_calendar_view_open_event): add a signal--"open_event", and bind it to "ctrl+o". When the signal is delivered, a dialog will be opened to edit the selected event.
+
+	* gui/e-calendar-table.c (e_calendar_table_on_key_press): press "ctrl-o" to open a dialog.
+
 2003-12-21  JP Rosevear <jpr ximian com>
 
 	* gui/e-itip-control.[hc]: rewrite for new ecal api, cache all
Index: evolution/calendar/gui/calendar-commands.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-commands.c,v
retrieving revision 1.138
diff -u -r1.138 calendar-commands.c
--- evolution/calendar/gui/calendar-commands.c	19 Dec 2003 19:50:49 -0000	1.138
+++ evolution/calendar/gui/calendar-commands.c	23 Dec 2003 09:16:21 -0000
@@ -71,6 +71,17 @@
 	guint taskpad_focused : 1;
 } FocusData;
 
+static void
+file_open_event_cb (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+	GnomeCalendar *gcal;
+
+	gcal = GNOME_CALENDAR (data);
+
+	e_calendar_view_open_event (gnome_calendar_get_current_view_widget (gcal));
+}
+
+
 /* Prints the calendar at its current view and time range */
 static void
 print (GnomeCalendar *gcal, gboolean preview)
@@ -532,6 +543,9 @@
 			read_only = TRUE;
 	}
 
+	bonobo_ui_component_set_prop (uic, "/commands/EventOpen", "sensitive",
+				      n_selected == 0 || read_only ? "0" : "1",
+				      NULL);
 	bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive",
 				      n_selected == 0 || read_only ? "0" : "1",
 				      NULL);
@@ -685,6 +699,7 @@
 
 
 static BonoboUIVerb verbs [] = {
+	BONOBO_UI_VERB ("EventOpen", file_open_event_cb),
 	BONOBO_UI_VERB ("CalendarPrint", file_print_cb),
 	BONOBO_UI_VERB ("CalendarPrintPreview", file_print_preview_cb),
 
Index: evolution/calendar/gui/e-cal-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-view.c,v
retrieving revision 1.27
diff -u -r1.27 e-cal-view.c
--- evolution/calendar/gui/e-cal-view.c	16 Dec 2003 23:29:07 -0000	1.27
+++ evolution/calendar/gui/e-cal-view.c	23 Dec 2003 09:16:29 -0000
@@ -25,6 +25,8 @@
 #include <string.h>
 #include <gtk/gtkimage.h>
 #include <gtk/gtkstock.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtkbindings.h>
 #include <libgnome/gnome-i18n.h>
 #include <gal/util/e-util.h>
 #include "e-util/e-dialog-utils.h"
@@ -94,6 +96,7 @@
 	TIMEZONE_CHANGED,
 	EVENT_CHANGED,
 	EVENT_ADDED,
+	OPEN_EVENT,
 	LAST_SIGNAL
 };
 
@@ -143,6 +146,8 @@
 	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 	GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
 
+	GtkBindingSet *binding_set;
+
 	parent_class = g_type_class_peek_parent (klass);
 
 	/* Method override */
@@ -160,6 +165,7 @@
 	klass->set_selected_time_range = NULL;
 	klass->get_visible_time_range = NULL;
 	klass->update_query = NULL;
+	klass->open_event = e_calendar_view_open_event;
 
 	g_object_class_install_property (gobject_class, PROP_MODEL, 
 					 g_param_spec_object ("model", NULL, NULL, E_TYPE_CAL_MODEL,
@@ -202,6 +208,15 @@
 			      G_TYPE_NONE, 1,
 			      G_TYPE_POINTER);
 
+	e_calendar_view_signals[OPEN_EVENT] =
+		g_signal_new ("open_event",
+			      G_TYPE_FROM_CLASS (klass),
+			      G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+			      G_STRUCT_OFFSET (ECalendarViewClass, open_event),
+			      NULL, NULL,
+			      g_cclosure_marshal_VOID__VOID,
+			      G_TYPE_NONE, 0);
+
 	e_calendar_view_signals[EVENT_ADDED] =
 		g_signal_new ("event_added",
 			      G_TYPE_FROM_CLASS (object_class),
@@ -216,6 +231,17 @@
 	if (!clipboard_atom)
 		clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
 
+
+        /*
+         * Key bindings
+         */
+
+	binding_set = gtk_binding_set_by_class (klass);
+
+	gtk_binding_entry_add_signal (binding_set, GDK_o,
+                                      GDK_CONTROL_MASK,
+                                      "open_event", 0);
+
 	/* init the accessibility support for e_day_view */
  	e_cal_view_a11y_init ();
 }
@@ -1331,6 +1357,23 @@
 	g_signal_connect (popup, "selection-done", G_CALLBACK (free_view_popup), cal_view);
 
 	return popup;
+}
+
+void 
+e_calendar_view_open_event (ECalendarView *cal_view)
+{
+	GList *selected;
+
+	selected = e_calendar_view_get_selected_events (cal_view);
+	if (selected) {
+		ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data;
+
+		if (event)
+			e_calendar_view_edit_appointment (cal_view, event->comp_data->client,
+						     event->comp_data->icalcomp, FALSE);
+
+		g_list_free (selected);
+	}
 }
 
 /**
Index: evolution/calendar/gui/e-cal-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-view.h,v
retrieving revision 1.17
diff -u -r1.17 e-cal-view.h
--- evolution/calendar/gui/e-cal-view.h	7 Nov 2003 05:51:58 -0000	1.17
+++ evolution/calendar/gui/e-cal-view.h	23 Dec 2003 09:16:30 -0000
@@ -87,6 +87,7 @@
 	void (* set_selected_time_range) (ECalendarView *cal_view, time_t start_time, time_t end_time);
 	gboolean (* get_visible_time_range) (ECalendarView *cal_view, time_t *start_time, time_t *end_time);
 	void (* update_query) (ECalendarView *cal_view);
+	void (* open_event) (ECalendarView *cal_view);
 };
 
 GType          e_calendar_view_get_type (void);
@@ -131,6 +132,8 @@
 					    ECal *client,
 					    icalcomponent *icalcomp,
 					    gboolean meeting);
+void           e_calendar_view_open_event (ECalendarView *cal_view);
+
 
 G_END_DECLS
 
Index: evolution/calendar/gui/e-calendar-table.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-table.c,v
retrieving revision 1.103
diff -u -r1.103 e-calendar-table.c
--- evolution/calendar/gui/e-calendar-table.c	16 Dec 2003 23:29:07 -0000	1.103
+++ evolution/calendar/gui/e-calendar-table.c	23 Dec 2003 09:16:37 -0000
@@ -1283,6 +1283,10 @@
 	if (event->keyval == GDK_Delete) {
 		delete_cb (NULL, cal_table);
 		return TRUE;
+	} else if ((event->keyval == GDK_o)
+		   &&(event->state & GDK_CONTROL_MASK)) {
+		open_task_by_row (cal_table, row);
+		return TRUE;	
 	}
 
 	return FALSE;
Index: evolution/calendar/gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.229
diff -u -r1.229 e-day-view.c
--- evolution/calendar/gui/e-day-view.c	9 Dec 2003 01:23:48 -0000	1.229
+++ evolution/calendar/gui/e-day-view.c	23 Dec 2003 09:17:16 -0000
@@ -2101,7 +2101,7 @@
 	day_view->lower = start_time;
 	day_view->upper = day_view->day_starts[day_view->days_shown];
 
-	e_day_view_update_query (day_view);
+	e_day_view_update_query ((ECalendarView *) day_view);
 }
 
 
Index: evolution/ui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ui/ChangeLog,v
retrieving revision 1.368
diff -u -r1.368 ChangeLog
--- evolution/ui/ChangeLog	18 Dec 2003 16:08:39 -0000	1.368
+++ evolution/ui/ChangeLog	23 Dec 2003 09:17:42 -0000
@@ -1,3 +1,7 @@
+2003-12-23  Kidd Wang  <kidd wang sun com>
+
+	* evolution-calendar.xml: Add a menu item [Open Appointment] to [File].
+
 2003-12-18  Rodney Dawes  <dobey ximian com>
 
 	* evolution-mail-message.xml:
Index: evolution/ui/evolution-calendar.xml
===================================================================
RCS file: /cvs/gnome/evolution/ui/evolution-calendar.xml,v
retrieving revision 1.65
diff -u -r1.65 evolution-calendar.xml
--- evolution/ui/evolution-calendar.xml	17 Dec 2003 13:57:28 -0000	1.65
+++ evolution/ui/evolution-calendar.xml	23 Dec 2003 09:17:43 -0000
@@ -1,5 +1,6 @@
 <Root>
   <commands>
+    <cmd name="EventOpen" _tip="View the current appointment" accel="*Control*o"/>
     <cmd name="CalendarPrint" _tip="Print this calendar" pixtype="stock" pixname="gtk-print"
 	 accel="*Control*p"/>
     <cmd name="CalendarPrintPreview" _tip="Previews the calendar to be printed" pixtype="stock" pixname="gtk-print-preview"/>
@@ -29,6 +30,9 @@
 
   <menu>
     <submenu name="File">
+      <placeholder name="FileOps">
+        <menuitem name="EventOpen" verb="EventOpen" _label="_Open Appointment"/>
+      </placeholder>
       <placeholder name="Print">
 	<menuitem name="PrintPreview" verb="CalendarPrintPreview"
 		  _label="Print Pre_view"/>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]