[evolution-patches] Patch for #51624 and #51627, Calendar and widgets releated



Rodrigo and JPR,
Attached is the patch for #51624 and #51627 based on HEAD. Please review them.

http://bugzilla.ximian.com/show_bug.cgi?id=51624
http://bugzilla.ximian.com/show_bug.cgi?id=51627

Please note I added back the "clicked" handler in e-calendar.c since this is needed for the keyboard navigation.
   Thanks a lot!
      Harry
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1997
diff -u -r1.1997 ChangeLog
--- calendar/ChangeLog	3 Dec 2003 17:58:57 -0000	1.1997
+++ calendar/ChangeLog	4 Dec 2003 08:12:45 -0000
@@ -1,3 +1,11 @@
+2003-12-04  Harry Lu  <harry lu sun com>
+
+	Fix for bugzilla bug #51627.
+
+	* gui/goto.c: (create_ecal): set calitem's move_selection_when_moving 
+	to FALSE so that changing month and year won't send out 
+	a "selection_changed" signal.
+
 2003-12-03  Ettore Perazzoli  <ettore ximian com>
 
 	* gui/tasks-control.c (tasks_control_activate): Do not call
Index: calendar/gui/goto.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/goto.c,v
retrieving revision 1.41
diff -u -r1.41 goto.c
--- calendar/gui/goto.c	12 Nov 2003 04:55:03 -0000	1.41
+++ calendar/gui/goto.c	4 Dec 2003 08:12:45 -0000
@@ -138,6 +138,9 @@
 	dlg->ecal = E_CALENDAR (e_calendar_new ());
 	calitem = dlg->ecal->calitem;
 	
+	gnome_canvas_item_set (GNOME_CANVAS_ITEM (calitem),
+			"move_selection_when_moving", FALSE,
+			NULL);
 	e_calendar_item_set_display_popup (calitem, FALSE);
 	gtk_widget_show (GTK_WIDGET (dlg->ecal));
 	gtk_box_pack_start (GTK_BOX (dlg->vbox), GTK_WIDGET (dlg->ecal), TRUE, TRUE, 0);
Index: widgets/misc/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/ChangeLog,v
retrieving revision 1.251
diff -u -r1.251 ChangeLog
--- widgets/misc/ChangeLog	2 Dec 2003 20:31:02 -0000	1.251
+++ widgets/misc/ChangeLog	4 Dec 2003 08:07:24 -0000
@@ -1,3 +1,23 @@
+2003-12-04  Harry Lu <harry lu sun com> 
+
+	Fix for bugzilla bug #51624 and #51627.
+
+	* e-calendar-item.c: (e_calendar_item_selection_add_days):
+	set the date to the first day of the month so that user can use
+	keyboard's arrow key to select a date.
+	(e_calendar_item_set_selection_if_emission): only set selection_changed
+	if emission is TRUE.
+	* e-calendar.c: (e_calendar_init): add back the "clicked" handler so
+	that user can use keyboard to click the button.
+	 (e_calendar_start_auto_move): no need to move since it is already 
+	handled by the clicked handler
+	(e_calendar_on_prev_clicked), (e_calendar_on_next_clicked): move the 
+	month here.
+	* e-dateedit.c: (e_date_edit_show_date_popup): use gdk_window_focus 
+	instead of gdk_keyboard_grab so that the focus won't lost if user click
+	the button with keyboard.
+	(hide_date_popup): no need to call gdk_keyboard_ungrab.
+
 2003-12-02  Ettore Perazzoli  <ettore ximian com>
 
 	* e-source-selector.c (init): Set the mode on the text cell
Index: widgets/misc/e-calendar-item.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-calendar-item.c,v
retrieving revision 1.39
diff -u -r1.39 e-calendar-item.c
--- widgets/misc/e-calendar-item.c	13 Nov 2003 03:33:53 -0000	1.39
+++ widgets/misc/e-calendar-item.c	4 Dec 2003 08:07:29 -0000
@@ -1624,8 +1624,12 @@
 
 	g_return_if_fail (E_IS_CALENDAR_ITEM (calitem));
 
-	if (!e_calendar_item_get_selection (calitem, &gdate_start, &gdate_end))
-		return;
+	if (!e_calendar_item_get_selection (calitem, &gdate_start, &gdate_end)) {
+		/* We set the date to the first day of the month */
+		g_date_set_dmy (&gdate_start, 1, calitem->month + 1, calitem->year);
+		gdate_end = gdate_start;
+	}
+
 	if (multi_selection && calitem->max_days_selected > 1) {
 		gint days_between;
 
@@ -2898,9 +2902,10 @@
 	    || calitem->selection_end_month_offset != new_end_month_offset
 	    || calitem->selection_end_day != new_end_day) {
 		need_update = TRUE;
-		calitem->selection_changed = TRUE;
-		if (emission)
+		if (emission) {
+			calitem->selection_changed = TRUE;
 			e_calendar_item_queue_signal_emission (calitem);
+		}
 		calitem->selection_set = TRUE;
 		calitem->selection_start_month_offset = new_start_month_offset;
 		calitem->selection_start_day = new_start_day;
Index: widgets/misc/e-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-calendar.c,v
retrieving revision 1.22
diff -u -r1.22 e-calendar.c
--- widgets/misc/e-calendar.c	1 Dec 2003 12:14:27 -0000	1.22
+++ widgets/misc/e-calendar.c	4 Dec 2003 08:07:29 -0000
@@ -93,8 +93,10 @@
 
 static void e_calendar_on_prev_pressed	(ECalendar	*cal);
 static void e_calendar_on_prev_released	(ECalendar	*cal);
+static void e_calendar_on_prev_clicked  (ECalendar      *cal);
 static void e_calendar_on_next_pressed	(ECalendar	*cal);
 static void e_calendar_on_next_released	(ECalendar	*cal);
+static void e_calendar_on_next_clicked  (ECalendar      *cal);
 
 static void e_calendar_start_auto_move	(ECalendar	*cal,
 					 gboolean	 moving_forward);
@@ -165,6 +167,9 @@
 	gtk_signal_connect_object (GTK_OBJECT (button), "released",
 				   G_CALLBACK (e_calendar_on_prev_released),
 				   GTK_OBJECT (cal));
+	gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
+				   G_CALLBACK (e_calendar_on_prev_clicked),
+				   GTK_OBJECT (cal));
 
 	pixmap = gtk_arrow_new (GTK_ARROW_LEFT, GTK_SHADOW_NONE);
 	gtk_widget_show (pixmap);
@@ -184,6 +189,9 @@
 	gtk_signal_connect_object (GTK_OBJECT (button), "released",
 				   G_CALLBACK (e_calendar_on_next_released),
 				   GTK_OBJECT (cal));
+	gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
+				   G_CALLBACK (e_calendar_on_next_clicked),
+				   GTK_OBJECT (cal));
 
 	pixmap = gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
 	gtk_widget_show (pixmap);
@@ -442,9 +450,6 @@
 e_calendar_start_auto_move	(ECalendar	*cal,
 				 gboolean	 moving_forward)
 {
-	ECalendarItem *calitem;
-	gint offset;
-
 	if (cal->timeout_id == 0) {
 		cal->timeout_id = g_timeout_add (E_CALENDAR_AUTO_MOVE_TIMEOUT,
 						 e_calendar_auto_move_handler,
@@ -453,10 +458,6 @@
 	cal->timeout_delay = E_CALENDAR_AUTO_MOVE_TIMEOUT_DELAY;
 	cal->moving_forward = moving_forward;
 
-	calitem = cal->calitem;
-	offset = cal->moving_forward ? 1 : -1;
-	e_calendar_item_set_first_month (calitem, calitem->year,
-					 calitem->month + offset);
 }
 
 
@@ -510,6 +511,20 @@
 	}
 }
 
+static void
+e_calendar_on_prev_clicked      (ECalendar      *cal)
+{
+	e_calendar_item_set_first_month (cal->calitem, cal->calitem->year,
+		cal->calitem->month - 1);
+}
+
+static void
+e_calendar_on_next_clicked      (ECalendar      *cal)
+{
+	e_calendar_item_set_first_month (cal->calitem, cal->calitem->year,
+		cal->calitem->month + 1);
+}
+
 
 static gint
 e_calendar_drag_motion (GtkWidget      *widget,
Index: widgets/misc/e-dateedit.c
===================================================================
RCS file: /cvs/gnome/evolution/widgets/misc/e-dateedit.c,v
retrieving revision 1.37
diff -u -r1.37 e-dateedit.c
--- widgets/misc/e-dateedit.c	22 Sep 2003 03:19:00 -0000	1.37
+++ widgets/misc/e-dateedit.c	4 Dec 2003 08:07:31 -0000
@@ -1180,7 +1180,6 @@
 
         position_date_popup (dedit);
 	gtk_widget_show (priv->cal_popup);
-	gdk_keyboard_grab (priv->cal_popup->window, TRUE, GDK_CURRENT_TIME);
 	gtk_widget_grab_focus (priv->cal_popup);
 	gtk_grab_add (priv->cal_popup);
 	gdk_pointer_grab (priv->cal_popup->window, TRUE,
@@ -1188,6 +1187,7 @@
 			   | GDK_BUTTON_RELEASE_MASK
 			   | GDK_POINTER_MOTION_MASK),
 			  NULL, NULL, GDK_CURRENT_TIME);
+	gdk_window_focus (priv->cal_popup->window, GDK_CURRENT_TIME);
 }
 
 
@@ -1366,7 +1366,6 @@
 	gtk_widget_hide (dedit->priv->cal_popup);
 	gtk_grab_remove (dedit->priv->cal_popup);
 	gdk_pointer_ungrab (GDK_CURRENT_TIME);
-	gdk_keyboard_ungrab (GDK_CURRENT_TIME);
 }
 
 


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