[evolution-patches] Patch for 39375 and 40257



-JP
-- 
JP Rosevear <jpr ximian com>
Ximian, Inc.
? e-meeting.diff
? for-conduit.patch
? org-attendee.patch
? pane.patch
? temp.patch
? gui/org-attendee.patch
? gui/pane.patch
? gui/paned.patch
? gui/tmp.patch
? gui/dialogs/Evolution-Addressbook-SelectNames-common.c
? gui/dialogs/Evolution-Addressbook-SelectNames-skels.c
? gui/dialogs/Evolution-Addressbook-SelectNames-stubs.c
? gui/dialogs/alarm-options.gladep
? gui/dialogs/event-page.gladep
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1733
diff -u -r1.1733 ChangeLog
--- ChangeLog	11 Apr 2003 18:18:19 -0000	1.1733
+++ ChangeLog	15 Apr 2003 15:03:09 -0000
@@ -1,3 +1,33 @@
+2003-04-15  JP Rosevear  <jpr ximian com>
+
+	Fixes #39735 and 40257
+	
+	* gui/gnome-cal.c: convert float pane positions to ints
+	(setup_widgets): set the initial position after realization and
+	track the drags to get the new position, pack the panes slightly
+	differently
+	(gnome_calendar_set_pane_positions): set purely pixel oriented
+	positions
+	(gnome_calendar_update_config_settings): no need to update quanta
+	setting
+	(gnome_calendar_hpane_realized): realization callback
+	(gnome_calendar_vpane_realized): ditto
+	(gnome_calendar_vpane_resized): resize callback, store new size
+	(gnome_calendar_hpane_resized): ditto
+
+	* gui/calendar-model.c (get_due_status): handle an error getting
+	the timezone
+
+	* gui/calendar-config.c (calendar_config_get_hpane_pos): return an int
+	(calendar_config_set_hpane_pos): take an int
+	(calendar_config_get_vpane_pos): return an int
+	(calendar_config_set_vpane_pos): take an int
+
+	* gui/calendar-config.h: update protos
+
+	* gui/apps_evolution_calendar.schemas: update defaults for pane
+	positions
+
 2003-04-11  Dan Winship  <danw ximian com>
 
 	* gui/dialogs/Makefile.am (IDL_GENERATED, etc): Oops. Add this
Index: gui/apps_evolution_calendar.schemas
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/apps_evolution_calendar.schemas,v
retrieving revision 1.3
diff -u -r1.3 apps_evolution_calendar.schemas
--- gui/apps_evolution_calendar.schemas	5 Mar 2003 16:35:49 -0000	1.3
+++ gui/apps_evolution_calendar.schemas	15 Apr 2003 15:03:09 -0000
@@ -106,8 +106,8 @@
       <key>/schemas/apps/evolution/calendar/display/hpane_position</key>
       <applyto>/apps/evolution/calendar/display/hpane_position</applyto>
       <owner>evolution-calendar</owner>
-      <type>float</type>
-      <default>1.0</default>
+      <type>int</type>
+      <default>400</default>
       <locale name="C">
         <short>Position of the horizontal pane</short>
       </locale>
@@ -117,8 +117,8 @@
       <key>/schemas/apps/evolution/calendar/display/vpane_position</key>
       <applyto>/apps/evolution/calendar/display/vpane_position</applyto>
       <owner>evolution-calendar</owner>
-      <type>float</type>
-      <default>1.0</default>
+      <type>int</type>
+      <default>150</default>
       <locale name="C">
         <short>Position of the vertical pane</short>
       </locale>
@@ -128,8 +128,8 @@
       <key>/schemas/apps/evolution/calendar/display/month_hpane_position</key>
       <applyto>/apps/evolution/calendar/display/month_hpane_position</applyto>
       <owner>evolution-calendar</owner>
-      <type>float</type>
-      <default>0.0</default>
+      <type>int</type>
+      <default>640</default>
       <locale name="C">
         <short>Position of the horizontal pane in the month view</short>
       </locale>
@@ -139,8 +139,8 @@
       <key>/schemas/apps/evolution/calendar/display/month_vpane_position</key>
       <applyto>/apps/evolution/calendar/display/month_vpane_position</applyto>
       <owner>evolution-calendar</owner>
-      <type>float</type>
-      <default>1.0</default>
+      <type>int</type>
+      <default>150</default>
       <locale name="C">
         <short>Position of the vertical pane in the month view</short>
       </locale>
Index: gui/calendar-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.c,v
retrieving revision 1.50
diff -u -r1.50 calendar-config.c
--- gui/calendar-config.c	11 Mar 2003 22:23:44 -0000	1.50
+++ gui/calendar-config.c	15 Apr 2003 15:03:09 -0000
@@ -281,61 +281,61 @@
 
 
 /* The positions of the panes in the normal and month views. */
-gfloat
+gint
 calendar_config_get_hpane_pos		(void)
 {
-	return e_config_listener_get_float_with_default (config,
-							 "/apps/evolution/calendar/display/hpane_position",
-							 1.0, NULL);
+	return e_config_listener_get_long_with_default (config,
+						       "/apps/evolution/calendar/display/hpane_position",
+						       -1, NULL);
 }
 
 
 void
-calendar_config_set_hpane_pos		(gfloat	      hpane_pos)
+calendar_config_set_hpane_pos		(gint	      hpane_pos)
 {
-	e_config_listener_set_float (config, "/apps/evolution/calendar/display/hpane_position", hpane_pos);
+	e_config_listener_set_long (config, "/apps/evolution/calendar/display/hpane_position", hpane_pos);
 }
 
 
-gfloat
+gint
 calendar_config_get_vpane_pos		(void)
 {
-	return e_config_listener_get_float_with_default (config, "/apps/evolution/calendar/display/vpane_position", 1.0, NULL);
+	return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/vpane_position", -1, NULL);
 }
 
 
 void
-calendar_config_set_vpane_pos		(gfloat	      vpane_pos)
+calendar_config_set_vpane_pos		(gint	      vpane_pos)
 {
-	e_config_listener_set_float (config, "/apps/evolution/calendar/display/vpane_position", vpane_pos);
+	e_config_listener_set_long (config, "/apps/evolution/calendar/display/vpane_position", vpane_pos);
 }
 
 
-gfloat
+gint
 calendar_config_get_month_hpane_pos	(void)
 {
-	return e_config_listener_get_float_with_default (config, "/apps/evolution/calendar/display/month_hpane_position", 0.0, NULL);
+	return e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/month_hpane_position", -1, NULL);
 }
 
 
 void
-calendar_config_set_month_hpane_pos	(gfloat	      hpane_pos)
+calendar_config_set_month_hpane_pos	(gint	      hpane_pos)
 {
-	e_config_listener_set_float (config, "/apps/evolution/calendar/display/month_hpane_position", hpane_pos);
+	e_config_listener_set_long (config, "/apps/evolution/calendar/display/month_hpane_position", hpane_pos);
 }
 
 
-gfloat
+gint
 calendar_config_get_month_vpane_pos	(void)
 {
-	return  e_config_listener_get_float_with_default (config, "/apps/evolution/calendar/display/month_vpane_position", 1.0, NULL);
+	return  e_config_listener_get_long_with_default (config, "/apps/evolution/calendar/display/month_vpane_position", 0, NULL);
 }
 
 
 void
-calendar_config_set_month_vpane_pos	(gfloat	      vpane_pos)
+calendar_config_set_month_vpane_pos	(gint	      vpane_pos)
 {
-	e_config_listener_set_float (config, "/apps/evolution/calendar/display/month_vpane_position", vpane_pos);
+	e_config_listener_set_long (config, "/apps/evolution/calendar/display/month_vpane_position", vpane_pos);
 }
 
 
Index: gui/calendar-config.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.h,v
retrieving revision 1.22
diff -u -r1.22 calendar-config.h
--- gui/calendar-config.h	2 Apr 2003 19:30:34 -0000	1.22
+++ gui/calendar-config.h	15 Apr 2003 15:03:09 -0000
@@ -117,17 +117,17 @@
 void	  calendar_config_set_default_view	(gint	      view);
 
 /* The positions of the panes in the normal and month views. */
-gfloat    calendar_config_get_hpane_pos		(void);
-void	  calendar_config_set_hpane_pos		(gfloat	      hpane_pos);
+gint      calendar_config_get_hpane_pos		(void);
+void	  calendar_config_set_hpane_pos		(gint	      hpane_pos);
 
-gfloat    calendar_config_get_vpane_pos		(void);
-void	  calendar_config_set_vpane_pos		(gfloat	      vpane_pos);
+gint      calendar_config_get_vpane_pos		(void);
+void	  calendar_config_set_vpane_pos		(gint	      vpane_pos);
 
-gfloat    calendar_config_get_month_hpane_pos	(void);
-void	  calendar_config_set_month_hpane_pos	(gfloat	      hpane_pos);
+gint      calendar_config_get_month_hpane_pos	(void);
+void	  calendar_config_set_month_hpane_pos	(gint	      hpane_pos);
 
-gfloat    calendar_config_get_month_vpane_pos	(void);
-void	  calendar_config_set_month_vpane_pos	(gfloat	      vpane_pos);
+gint      calendar_config_get_month_vpane_pos	(void);
+void	  calendar_config_set_month_vpane_pos	(gint	      vpane_pos);
 
 /* Colors for the task list */
 const char *calendar_config_get_tasks_due_today_color	(void);
Index: gui/calendar-model.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-model.c,v
retrieving revision 1.107
diff -u -r1.107 calendar-model.c
--- gui/calendar-model.c	9 Apr 2003 14:39:37 -0000	1.107
+++ gui/calendar-model.c	15 Apr 2003 15:03:10 -0000
@@ -673,9 +673,13 @@
 				retval = CALENDAR_MODEL_DUE_FUTURE;
 		} else {
 			/* Get the current time in the same timezone as the DUE date.*/
-			/* FIXME: TIMEZONES: Handle error. */
 			status = cal_client_get_timezone (model->priv->client, dt.tzid,
 							  &zone);
+			if (status != CAL_CLIENT_GET_SUCCESS) {
+				retval = CALENDAR_MODEL_DUE_FUTURE;
+				goto out;
+			}
+			
 			now_tt = icaltime_current_time_with_zone (zone);
 
 			if (icaltime_compare (*dt.value, now_tt) <= 0) 
Index: gui/gnome-cal.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/gnome-cal.c,v
retrieving revision 1.236
diff -u -r1.236 gnome-cal.c
--- gui/gnome-cal.c	8 Apr 2003 14:58:26 -0000	1.236
+++ gui/gnome-cal.c	15 Apr 2003 15:03:11 -0000
@@ -119,10 +119,10 @@
 	/* These are the saved positions of the panes. They are multiples of
 	   calendar month widths & heights in the date navigator, so that they
 	   will work OK after theme changes. */
-	gfloat	     hpane_pos;
-	gfloat	     vpane_pos;
-	gfloat	     hpane_pos_month_view;
-	gfloat	     vpane_pos_month_view;
+	gint	     hpane_pos;
+	gint	     vpane_pos;
+	gint	     hpane_pos_month_view;
+	gint	     vpane_pos_month_view;
 
 	/* The signal handler id for our GtkCalendar "day_selected" handler. */
 	guint	     day_selected_id;
@@ -172,13 +172,11 @@
 static void gnome_calendar_update_view_times (GnomeCalendar *gcal);
 static void gnome_calendar_update_date_navigator (GnomeCalendar *gcal);
 
-static void gnome_calendar_on_date_navigator_style_set (GtkWidget *widget,
-							GtkStyle  *previous_style,
-							gpointer data);
-static void gnome_calendar_update_paned_quanta (GnomeCalendar	*gcal);
-static void gnome_calendar_on_date_navigator_size_allocate (GtkWidget     *widget,
-							    GtkAllocation *allocation,
-							    gpointer data);
+static void gnome_calendar_hpane_realized (GtkWidget *w, GnomeCalendar *gcal);
+static void gnome_calendar_vpane_realized (GtkWidget *w, GnomeCalendar *gcal);
+static gboolean gnome_calendar_vpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gcal);
+static gboolean gnome_calendar_hpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gcal);
+
 static void gnome_calendar_on_date_navigator_date_range_changed (ECalendarItem *calitem,
 								 GnomeCalendar *gcal);
 static void gnome_calendar_on_date_navigator_selection_changed (ECalendarItem    *calitem,
@@ -748,6 +746,10 @@
 	/* The main HPaned, with the notebook of calendar views on the left
 	   and the ECalendar and ToDo list on the right. */
 	priv->hpane = gtk_hpaned_new ();
+	g_signal_connect_after(priv->hpane, "realize", 
+			       G_CALLBACK(gnome_calendar_hpane_realized), gcal);
+	g_signal_connect (priv->hpane, "button_release_event",
+			  G_CALLBACK (gnome_calendar_hpane_resized), gcal);
 	gtk_widget_show (priv->hpane);
 	gtk_box_pack_start (GTK_BOX (gcal), priv->hpane, TRUE, TRUE, 0);
 
@@ -756,12 +758,16 @@
 	gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->notebook), FALSE);
 	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->notebook), FALSE);
 	gtk_widget_show (priv->notebook);
-	gtk_paned_pack1 (GTK_PANED (priv->hpane), priv->notebook, TRUE, TRUE);
+	gtk_paned_pack1 (GTK_PANED (priv->hpane), priv->notebook, FALSE, TRUE);
 
 	/* The VPaned widget, to contain the GtkCalendar & ToDo list. */
 	priv->vpane = gtk_vpaned_new ();
+	g_signal_connect_after (priv->vpane, "realize",
+				G_CALLBACK(gnome_calendar_vpane_realized), gcal);
+	g_signal_connect (priv->vpane, "button_release_event",
+			  G_CALLBACK (gnome_calendar_vpane_resized), gcal);
 	gtk_widget_show (priv->vpane);
-	gtk_paned_pack2 (GTK_PANED (priv->hpane), priv->vpane, FALSE, TRUE);
+	gtk_paned_pack2 (GTK_PANED (priv->hpane), priv->vpane, TRUE, TRUE);
 
 	/* The ECalendar. */
 	w = e_calendar_new ();
@@ -773,11 +779,8 @@
 					       (ECalendarItemGetTimeCallback) get_current_time,
 					       gcal, NULL);
 
-	gtk_paned_pack1 (GTK_PANED (priv->vpane), w, FALSE, TRUE);
-	g_signal_connect (priv->date_navigator, "style_set",
-			  G_CALLBACK (gnome_calendar_on_date_navigator_style_set), gcal);
-	g_signal_connect_after (priv->date_navigator, "size_allocate",
-				G_CALLBACK (gnome_calendar_on_date_navigator_size_allocate), gcal);
+	gtk_paned_pack1 (GTK_PANED (priv->vpane), w, FALSE, TRUE);	
+
 	g_signal_connect (priv->date_navigator->calitem, "selection_changed",
 			  G_CALLBACK (gnome_calendar_on_date_navigator_selection_changed), gcal);
 	g_signal_connect (priv->date_navigator->calitem, "date_range_changed",
@@ -1447,49 +1450,16 @@
 gnome_calendar_set_pane_positions	(GnomeCalendar	*gcal)
 {
 	GnomeCalendarPrivate *priv;
-	gint top_border, bottom_border, left_border, right_border;
-	gint col_width, row_height;
-	gfloat right_pane_width, top_pane_height;
 
 	priv = gcal->priv;
 
-	/* Get the size of the calendar month width & height. */
-	e_calendar_get_border_size (priv->date_navigator,
-				    &top_border, &bottom_border,
-				    &left_border, &right_border);
-	g_object_get (G_OBJECT (priv->date_navigator->calitem),
-		      "row_height", &row_height,
-		      "column_width", &col_width,
-		      NULL);
-
 	if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) {
-		right_pane_width = priv->hpane_pos_month_view;
-		top_pane_height = priv->vpane_pos_month_view;
+		gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos_month_view);
+		gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos_month_view);
 	} else {
-		right_pane_width = priv->hpane_pos;
-		top_pane_height = priv->vpane_pos;
+		gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos);
+		gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos);
 	}
-
-	/* We add the borders before multiplying due to the way we are using
-	   the EPaned quantum feature. */
-	if (right_pane_width < 0.001)
-		right_pane_width = 0.0;
-	else
-		right_pane_width = (right_pane_width * (col_width + left_border + right_border)
-				    + 0.5);
-	if (top_pane_height < 0.001)
-		top_pane_height = 0.0;
-	else
-		top_pane_height = (top_pane_height * (row_height + top_border + bottom_border)
-				   + 0.5);
-
-	gtk_paned_set_position (GTK_PANED (priv->hpane), -1);
-	gtk_paned_set_position (GTK_PANED (priv->vpane), -1);
-
-	/* We add one to each dimension since we can't use 0. */
-
-	gtk_widget_set_usize (priv->vpane, right_pane_width + 1, -2);
-	gtk_widget_set_usize (GTK_WIDGET (priv->date_navigator), -2, top_pane_height + 1);
 }
 
 /* Displays an error to indicate that opening a calendar failed */
@@ -2160,8 +2130,6 @@
 		priv->vpane_pos = calendar_config_get_vpane_pos ();
 		priv->hpane_pos_month_view = calendar_config_get_month_hpane_pos ();
 		priv->vpane_pos_month_view = calendar_config_get_month_vpane_pos ();
-	} else {
-		gnome_calendar_update_paned_quanta (gcal);
 	}
 
 	/* The range of days shown may have changed, so we update the date
@@ -2614,100 +2582,68 @@
 	update_query (gcal);
 }
 
-
 static void
-gnome_calendar_on_date_navigator_style_set (GtkWidget     *widget,
-					    GtkStyle      *previous_style,
-					    gpointer       data)
+gnome_calendar_hpane_realized (GtkWidget *w, GnomeCalendar *gcal)
 {
-	gnome_calendar_update_paned_quanta (GNOME_CALENDAR (data));
-}
+	GnomeCalendarPrivate *priv;
 
+	priv = gcal->priv;
+
+	if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) {
+		gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos_month_view);
+	} else {
+		gtk_paned_set_position (GTK_PANED (priv->hpane), priv->hpane_pos);
+	}
+}
 
 static void
-gnome_calendar_update_paned_quanta (GnomeCalendar	*gcal)
+gnome_calendar_vpane_realized (GtkWidget *w, GnomeCalendar *gcal)
 {
 	GnomeCalendarPrivate *priv;
-	gint row_height, col_width;
-	gint top_border, bottom_border, left_border, right_border;
 
 	priv = gcal->priv;
 
-	e_calendar_get_border_size (priv->date_navigator,
-				    &top_border, &bottom_border,
-				    &left_border, &right_border);
-	g_object_get (G_OBJECT (priv->date_navigator->calitem),
-		      "row_height", &row_height,
-		      "column_width", &col_width,
-		      NULL);
-
-	/* The EPaned quantum feature works better if we add on the calendar
-	   borders to the quantum size. Otherwise if you shrink the date
-	   navigator you get left with the border widths/heights which looks
-	   bad. EPaned should be more flexible really. */
-	col_width += left_border + right_border;
-	row_height += top_border + bottom_border;
-
-	/* We don't have to use the EPaned quantum feature. We could just let
-	   the calendar expand to fill the allocated space, showing as many
-	   months as will fit. But for that to work nicely the EPaned should
-	   resize the widgets as the bar is dragged. Otherwise the user has
-	   to mess around to get the number of months that they want. */
-#if 0
-	g_object_set (G_OBJECT (priv->hpane), "quantum", (guint) col_width, NULL);
-	g_object_set (G_OBJECT (priv->vpane), "quantum", (guint) row_height, NULL);
-#endif
-
-	gnome_calendar_set_pane_positions (gcal);
+	if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) {
+		gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos_month_view);
+	} else {
+		gtk_paned_set_position (GTK_PANED (priv->vpane), priv->vpane_pos);
+	}
 }
 
-
-static void
-gnome_calendar_on_date_navigator_size_allocate (GtkWidget     *widget,
-						GtkAllocation *allocation,
-						gpointer data)
+static gboolean
+gnome_calendar_vpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gcal)
 {
-	GnomeCalendar *gcal;
 	GnomeCalendarPrivate *priv;
-	gint width, height, row_height, col_width;
-	gint top_border, bottom_border, left_border, right_border;
-	gfloat hpane_pos, vpane_pos;
 
-	gcal = GNOME_CALENDAR (data);
 	priv = gcal->priv;
 
-	e_calendar_get_border_size (priv->date_navigator,
-				    &top_border, &bottom_border,
-				    &left_border, &right_border);
-	g_object_get (G_OBJECT (priv->date_navigator->calitem),
-		      "row_height", &row_height,
-		      "column_width", &col_width,
-		      NULL);
+	if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) {
+		priv->vpane_pos_month_view = gtk_paned_get_position (priv->vpane);
+		calendar_config_set_month_vpane_pos (priv->vpane_pos_month_view);
+	} else {
+		priv->vpane_pos = gtk_paned_get_position (priv->vpane);
+		calendar_config_set_vpane_pos (priv->vpane_pos);
+	}
+
+	return FALSE;
+}
 
-	/* We subtract one from each dimension since we added 1 in
-	   set_view(). */
-	width = allocation->width - 1;
-	height = allocation->height - 1;
-
-	/* We add the border sizes to work around the EPaned
-	   quantized feature. */
-	col_width += left_border + right_border;
-	row_height += top_border + bottom_border;
+static gboolean
+gnome_calendar_hpane_resized (GtkWidget *w, GdkEventButton *e, GnomeCalendar *gcal)
+{
+	GnomeCalendarPrivate *priv;
 
-	hpane_pos = (gfloat) width / col_width;
-	vpane_pos = (gfloat) height / row_height;
+	priv = gcal->priv;
 
 	if (priv->current_view_type == GNOME_CAL_MONTH_VIEW && !priv->range_selected) {
-		priv->hpane_pos_month_view = hpane_pos;
-		priv->vpane_pos_month_view = vpane_pos;
-		calendar_config_set_month_hpane_pos (hpane_pos);
-		calendar_config_set_month_vpane_pos (vpane_pos);
+		priv->hpane_pos_month_view = gtk_paned_get_position (priv->hpane);
+		calendar_config_set_month_hpane_pos (priv->hpane_pos_month_view);
 	} else {
-		priv->hpane_pos = hpane_pos;
-		priv->vpane_pos = vpane_pos;
-		calendar_config_set_hpane_pos (hpane_pos);
-		calendar_config_set_vpane_pos (vpane_pos);
+		priv->hpane_pos = gtk_paned_get_position (priv->hpane);
+		calendar_config_set_hpane_pos (priv->hpane_pos);
 	}
+
+	return FALSE;
 }
 
 void


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