File eds-startup-crasher-set-default-alarm.diff of Package evolution-data-server-2.6

--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	2006-09-21 10:04:24.909596304 +0530
+++ /root/kharish/e-cal-backend-groupwise-utils.c	2006-09-26 15:21:27.995665200 +0530
@@ -808,60 +808,80 @@ static void
 set_default_alarms (ECalComponent *comp)
 {
 
-	GConfClient *gconf = gconf_client_get_default ();
+	static GConfClient *gconf = NULL;
+	static int interval;
+	static gboolean add_default = TRUE;
+	static enum {
+		DAYS,
+		HOURS,
+		MINUTES
+	} duration;
+	ECalComponentAlarm *acomp;
+	ECalComponentAlarmTrigger trigger;
+
+	if (!add_default)
+		return;
 
-	if (gconf_client_get_bool (gconf, CALENDAR_CONFIG_DEFAULT_REMINDER, NULL)) {
+	if (gconf == NULL) {
 
-			ECalComponentAlarm *acomp;
-			int interval;
+		gconf = gconf_client_get_default ();
+		
+		add_default = gconf_client_get_bool (gconf, CALENDAR_CONFIG_DEFAULT_REMINDER, NULL) ? TRUE : FALSE;
+		if (add_default) {
 			char * units;
-			enum {
-				DAYS,
-				HOURS,
-				MINUTES
-			} duration;	
-			ECalComponentAlarmTrigger trigger;
 
 			interval = gconf_client_get_int (gconf, CALENDAR_CONFIG_DEFAULT_REMINDER_INTERVAL, NULL);
 			units = gconf_client_get_string (gconf, CALENDAR_CONFIG_DEFAULT_REMINDER_UNITS, NULL);
-			g_object_unref (gconf);
 
-			if (units && !strcmp (units, "days"))
-				duration = DAYS;
-			else if (units && !strcmp (units, "hours"))
-				duration = HOURS;
-			else
+			if (units == NULL) 
 				duration = MINUTES;
-			g_free (units);
-			acomp = e_cal_component_alarm_new ();
+			else {
+				if (!strcmp (units, "days"))
+					duration = DAYS;
+				else if (!strcmp (units, "hours"))
+					duration = HOURS;
+				else
+					duration = MINUTES;
+				g_free (units);
+			}	
+		}
+		else {
+			g_object_unref (gconf);
+			return;
+		}	
 
-			e_cal_component_alarm_set_action (acomp, E_CAL_COMPONENT_ALARM_DISPLAY);
+		g_object_unref (gconf);
+	}
 
-			trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
-			memset (&trigger.u.rel_duration, 0, sizeof (trigger.u.rel_duration));
 
-			trigger.u.rel_duration.is_neg = TRUE;
+	acomp = e_cal_component_alarm_new ();
 
-			switch (duration) {
-			case MINUTES:
-				trigger.u.rel_duration.minutes = interval;
-				break;
-			case HOURS:	
-				trigger.u.rel_duration.hours = interval;
-				break;
-			case DAYS:	
-				trigger.u.rel_duration.days = interval;
-				break;
-			default:
-				e_cal_component_alarm_free (acomp);
-				return;
-			}
+	e_cal_component_alarm_set_action (acomp, E_CAL_COMPONENT_ALARM_DISPLAY);
 
-			e_cal_component_alarm_set_trigger (acomp, trigger);
-			e_cal_component_add_alarm (comp, acomp);
+	trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
+	memset (&trigger.u.rel_duration, 0, sizeof (trigger.u.rel_duration));
 
-			e_cal_component_alarm_free (acomp);
-			}
+	trigger.u.rel_duration.is_neg = TRUE;
+
+	switch (duration) {
+	case MINUTES:
+		trigger.u.rel_duration.minutes = interval;
+		break;
+	case HOURS:	
+		trigger.u.rel_duration.hours = interval;
+		break;
+	case DAYS:	
+		trigger.u.rel_duration.days = interval;
+		break;
+	default:
+		e_cal_component_alarm_free (acomp);
+		return;
+	}
+
+	e_cal_component_alarm_set_trigger (acomp, trigger);
+	e_cal_component_add_alarm (comp, acomp);
+
+	e_cal_component_alarm_free (acomp);
 }
 
 
openSUSE Build Service is sponsored by