[evolution-patches] patch for #45406



Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1808
diff -u -p -r1.1808 ChangeLog
--- ChangeLog	1 Jul 2003 02:31:28 -0000	1.1808
+++ ChangeLog	1 Jul 2003 12:04:23 -0000
@@ -1,3 +1,11 @@
+2003-07-01  Rodrigo Moya <rodrigo ximian com>
+
+	Fixes #45406
+
+	* gui/goto.c: added 'internal_update' member to keep track of
+	internal updates.
+	(ecal_date_range_changed): update the value in the year spin button.
+
 2003-07-01  Bolian Yin <bolian yin sun com>
 
        Fixes #45274
Index: gui/goto.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/goto.c,v
retrieving revision 1.38
diff -u -p -r1.38 goto.c
--- gui/goto.c	24 Jan 2003 22:02:49 -0000	1.38
+++ gui/goto.c	1 Jul 2003 12:04:23 -0000
@@ -37,7 +37,8 @@ typedef struct 
 	gint year_val;
 	gint month_val;
 	gint day_val;
-	
+
+	gboolean internal_update;
 } GoToDialog;
 
 GoToDialog *dlg = NULL;
@@ -49,7 +50,8 @@ year_changed (GtkAdjustment *adj, gpoint
 	GoToDialog *dlg = data;
 
 	dlg->year_val = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (dlg->year));
-	e_calendar_item_set_first_month (dlg->ecal->calitem, dlg->year_val, dlg->month_val);
+	if (!dlg->internal_update)
+		e_calendar_item_set_first_month (dlg->ecal->calitem, dlg->year_val, dlg->month_val);
 }
 
 /* Callback used when a month button is toggled */
@@ -71,10 +73,19 @@ ecal_date_range_changed (ECalendarItem *
 {
 	GoToDialog *dlg = user_data;
 	CalClient *client;
+	gint start_year, start_month, start_day, end_year, end_month, end_day;
 	
 	client = gnome_calendar_get_cal_client (dlg->gcal);
 	if (client)
 		tag_calendar_by_client (dlg->ecal, client);
+
+	/* update the value in the year spin button */
+	if (e_calendar_item_get_date_range (calitem, &start_year, &start_month, &start_day,
+					    &end_year, &end_month, &end_day)) {
+		dlg->internal_update = TRUE;
+		gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->year), start_year);
+		dlg->internal_update = FALSE;
+	}
 }
 
 /* Event handler for day groups in the month item.  A button press makes the calendar jump to the
@@ -137,7 +148,7 @@ create_ecal (GoToDialog *dlg)
 	
 	dlg->ecal = E_CALENDAR (e_calendar_new ());
 	calitem = dlg->ecal->calitem;
-	
+
 	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);


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