File bnc-167330-default-GW-alarms.patch of Package evolution-data-server

Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.568.2.16
diff -u -p -r1.568.2.16 ChangeLog
--- calendar/ChangeLog	14 Jun 2006 11:02:55 -0000	1.568.2.16
+++ calendar/ChangeLog	17 Jul 2006 06:05:27 -0000
@@ -1,3 +1,12 @@
+2006-07-17  Harish Krishnaswamy  <kharish@novell.com>
+
+	* backends/groupwise/e-cal-backend-groupwise-utils.c:
+	(set_default_alarms), (e_gw_item_to_cal_component):
+	* backends/groupwise/e-cal-backend-groupwise-utils.h:
+	Apply default alarm client preference to GW events if
+	the event does not already have one. Fixes Bug 
+	#167330 on bugzilla.novell.com.
+
 2006-06-14  Wang Xin  <jedy.wang@sun.com>
 
 	Fixes #344253
Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c,v
retrieving revision 1.73
diff -u -p -r1.73 e-cal-backend-groupwise-utils.c
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	9 Dec 2005 11:21:49 -0000	1.73
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	17 Jul 2006 06:05:27 -0000
@@ -803,6 +803,67 @@ set_attachments_to_cal_component (EGwIte
 
 }
 
+static void
+set_default_alarms (ECalComponent *comp)
+{
+
+	GConfClient *gconf = gconf_client_get_default ();
+
+	if (gconf_client_get_bool (gconf, CALENDAR_CONFIG_DEFAULT_REMINDER, NULL)) {
+
+			ECalComponentAlarm *acomp;
+			int interval;
+			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
+				duration = MINUTES;
+			g_free (units);
+			acomp = e_cal_component_alarm_new ();
+
+			e_cal_component_alarm_set_action (acomp, E_CAL_COMPONENT_ALARM_DISPLAY);
+
+			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;
+
+			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);
+			}
+}
+
+
 ECalComponent *
 e_gw_item_to_cal_component (EGwItem *item, ECalBackendGroupwise *cbgw)
 {
@@ -1111,9 +1172,9 @@ e_gw_item_to_cal_component (EGwItem *ite
 			trigger.u.rel_duration = icaldurationtype_from_int (alarm_duration);
 			e_cal_component_alarm_set_trigger (alarm, trigger);
 			e_cal_component_add_alarm (comp, alarm);
-		}
 
-		
+		} else 
+			set_default_alarms (comp);
 
 		break;
 	case E_GW_ITEM_TYPE_TASK :
Index: calendar/backends/groupwise/e-cal-backend-groupwise-utils.h
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.h,v
retrieving revision 1.18
diff -u -p -r1.18 e-cal-backend-groupwise-utils.h
--- calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	11 Oct 2005 07:56:18 -0000	1.18
+++ calendar/backends/groupwise/e-cal-backend-groupwise-utils.h	17 Jul 2006 06:05:27 -0000
@@ -33,6 +33,13 @@ G_BEGIN_DECLS
 #define GW_EVENT_TYPE_ID "@4:"
 #define GW_TODO_TYPE_ID "@3:"
 
+
+/* Default reminder */
+#define CALENDAR_CONFIG_PREFIX "/apps/evolution/calendar"
+#define CALENDAR_CONFIG_DEFAULT_REMINDER CALENDAR_CONFIG_PREFIX "/other/use_default_reminder"
+#define CALENDAR_CONFIG_DEFAULT_REMINDER_INTERVAL CALENDAR_CONFIG_PREFIX "/other/default_reminder_interval"
+#define CALENDAR_CONFIG_DEFAULT_REMINDER_UNITS CALENDAR_CONFIG_PREFIX "/other/default_reminder_units"
+
 /*
  * Items management
  */
openSUSE Build Service is sponsored by