aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchen@src.gnome.org>2006-01-25 18:48:16 +0800
committerChenthill Palanisamy <pchen@src.gnome.org>2006-01-25 18:48:16 +0800
commitec86e3f4d5d20bd6ce273030f7f6201fa6cc9851 (patch)
treeec2fdc7652c058d0d4a0a2e24291ebbef72d3d96 /calendar
parentc31d93ccb23c2c7ba2faa82668d0a45a7bddf369 (diff)
downloadgsoc2013-evolution-ec86e3f4d5d20bd6ce273030f7f6201fa6cc9851.tar.gz
gsoc2013-evolution-ec86e3f4d5d20bd6ce273030f7f6201fa6cc9851.tar.zst
gsoc2013-evolution-ec86e3f4d5d20bd6ce273030f7f6201fa6cc9851.zip
fixes #325762
svn path=/trunk/; revision=31308
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog29
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.c22
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c328
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.c78
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.glade98
-rw-r--r--calendar/gui/dialogs/cal-prefs-dialog.h6
6 files changed, 258 insertions, 303 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 7f18df0647..5369bf45c1 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,34 @@
2006-01-25 Chenthill Palanisamy <pchenthill@novell.com>
+ * gui/alarm-notify/alarm-queue.c: (popup_notification):
+ Removed the unsed variable filename. Do not set the icon
+ from pixbuf. Just pass the icon name to notification_new.
+
+2006-01-25 Srinivasa Ragavan <sragavan@novell.com>
+
+ Fixes #325762
+ * gui/alarm-notify/alarm-notify.c: (process_removal_in_hash),
+ (list_changed_cb), (load_calendars), (alarm_notify_init):
+ * gui/alarm-notify/alarm-queue.c: (open_alarm_dialog),
+ (tray_icon_clicked_cb), (icon_activated), (tray_icon_blink_cb),
+ (display_notification), , (alarm_queue_init),
+ (alarm_queue_remove_client):
+ * gui/dialogs/cal-prefs-dialog.c: (alarms_selection_changed),
+ (setup_changes), (initialize_selection), (show_alarms_config),
+ (show_config), (calendar_prefs_dialog_construct):
+ * gui/dialogs/cal-prefs-dialog.glade:
+ * gui/dialogs/cal-prefs-dialog.h: The alarms icon is show in the
+ notification tray only when there is an alarm. The selection
+ of calendars for alarms is moved to preferences.
+
+2006-01-25 Chenthill Palanisamy <pchenthill@novell.com>
+
+ Fixes #
+ * gui/e-calendar-view.c: (on_unrecur_appointment):
+
+
+2006-01-25 Chenthill Palanisamy <pchenthill@novell.com>
+
Fixes #327879
* gui/dialogs/recurrence-page.c: (clear_widgets):
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c
index edef6d34bb..d268c6ffda 100644
--- a/calendar/gui/alarm-notify/alarm-notify.c
+++ b/calendar/gui/alarm-notify/alarm-notify.c
@@ -92,10 +92,13 @@ process_removal_in_hash (gpointer key, gpointer value, gpointer data)
for (q = sources; q != NULL; q = q->next) {
ESource *source = E_SOURCE (q->data);
char *source_uri;
-
+ const char *completion = e_source_get_property (source, "alarm");
+
source_uri = e_source_get_uri (source);
if (strcmp (source_uri, uri) == 0)
- found = TRUE;
+ if (!completion || !g_ascii_strcasecmp (completion, "true"))
+ found = TRUE;
+
g_free (source_uri);
if (found)
@@ -118,6 +121,7 @@ list_changed_cb (ESourceList *source_list, gpointer data)
GList *l;
int i;
+ printf("LIST CHANGED\n");
priv = an->priv;
/* Figure out the source type */
@@ -139,9 +143,9 @@ list_changed_cb (ESourceList *source_list, gpointer data)
for (q = sources; q != NULL; q = q->next) {
ESource *source = E_SOURCE (q->data);
char *uri;
- const char *uid = e_source_peek_uid (source);
-
- if (!e_source_list_peek_source_by_uid (priv->selected_calendars, uid))
+ const char *completion = e_source_get_property (source, "alarm");
+
+ if (completion && !g_ascii_strcasecmp (completion, "false"))
continue;
uri = e_source_get_uri (source);
@@ -195,9 +199,9 @@ load_calendars (AlarmNotify *an, ECalSourceType source_type)
for (q = sources; q != NULL; q = q->next) {
ESource *source = E_SOURCE (q->data);
char *uri;
- const char *uid = e_source_peek_uid (source);
-
- if (!e_source_list_peek_source_by_uid (priv->selected_calendars, uid))
+ const char *completion = e_source_get_property (source, "alarm");
+
+ if (completion && !g_ascii_strcasecmp (completion, "false"))
continue;
uri = e_source_get_uri (source);
@@ -236,7 +240,7 @@ alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass)
priv = g_new0 (AlarmNotifyPrivate, 1);
an->priv = priv;
priv->mutex = g_mutex_new ();
- priv->selected_calendars = config_data_get_calendars ("/apps/evolution/calendar/notify/calendars");
+ priv->selected_calendars = config_data_get_calendars ("/apps/evolution/calendar/sources");
for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++)
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 0f15ce342d..73e6be43f9 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -102,6 +102,7 @@ static GList *tray_icons_list = NULL;
/* Top Tray Image */
#ifndef USE_GTK_STATUS_ICON
+static GtkWidget *tray_icon = NULL;
static GtkWidget *tray_image = NULL;
static GtkWidget *tray_event_box = NULL;
#else
@@ -964,27 +965,15 @@ open_alarm_dialog (TrayIconData *tray_data)
qa = lookup_queued_alarm (tray_data->cqa, tray_data->alarm_id);
if (qa) {
- GdkPixbuf *pixbuf;
- GtkTooltips *tooltips = gtk_tooltips_new ();
-
- pixbuf = e_icon_factory_get_icon ("stock_appointment-reminder", E_ICON_SIZE_LARGE_TOOLBAR);
-
-#ifndef USE_GTK_STATUS_ICON
- gtk_image_set_from_pixbuf (GTK_IMAGE (tray_image), pixbuf);
-#else
- gtk_status_icon_set_from_pixbuf (tray_icon, pixbuf);
-#endif
- g_object_unref (pixbuf);
if (tray_blink_id > -1)
g_source_remove (tray_blink_id);
tray_blink_id = -1;
-#ifndef USE_GTK_STATUS_ICON
- gtk_tooltips_set_tip (tooltips, tray_event_box, NULL, NULL);
-#else
- gtk_status_icon_set_tooltip (tray_icon, NULL);
-#endif
+ gtk_widget_destroy (tray_icon);
+ tray_icon = NULL;
+ tray_image = NULL;
+
if (!alarm_notifications_dialog)
alarm_notifications_dialog = notified_alarms_dialog_new ();
@@ -1018,204 +1007,6 @@ open_alarm_dialog (TrayIconData *tray_data)
return TRUE;
}
-static void
-alarm_quit (EPopup *ep, EPopupItem *pitem, void *data)
-{
- bonobo_main_quit ();
-}
-
-static void
-menu_item_toggle_callback (GtkToggleButton *item, void *data)
-{
- gboolean state = gtk_toggle_button_get_active (item);
- ESource *source = e_source_copy ((ESource *) data);
- GSList *groups, *sel_groups, *p;
-
- if (e_source_get_uri ((ESource *)data)) {
- g_free (e_source_get_uri (source));
- e_source_set_absolute_uri (source, g_strdup (e_source_get_uri ((ESource *)data)));
- }
-
- if (state) {
- const char *uid = e_source_peek_uid (source);
- ESourceList *selected_cal = alarm_notify_get_selected_calendars (an);
- ESourceList *all_cal;
- ESourceGroup *group = NULL, *sel_group = NULL;
- const char *grp_uid = NULL;
- char * check_grp_uid = NULL;
- ESource *source_got = NULL;
- gboolean found_grp = FALSE;
-
- e_cal_get_sources (&all_cal, E_CAL_SOURCE_TYPE_EVENT, NULL);
-
- alarm_notify_add_calendar (an, E_CAL_SOURCE_TYPE_EVENT, source, FALSE);
-
- /* Browse the list of all calendars for the newly added calendar*/
- groups = e_source_list_peek_groups (all_cal);
- for (p = groups; p != NULL; p = p->next) {
- group = E_SOURCE_GROUP (p->data);
- source_got = e_source_group_peek_source_by_uid (group, uid);
-
- if (source_got) { /* You have got the group */
- break;
- }
- }
-
- /* Ensure that the source is under some source group in all calendar list */
- if (group == NULL){
- g_warning ("Source Group selected is *NOT* in all calendar list");
- g_object_unref (all_cal);
- return;
- }
-
- /* Get the group id from the above */
- grp_uid = e_source_group_peek_uid (group);
-
- /* Look for the particular group in the original selected calendars list */
- sel_groups = e_source_list_peek_groups (selected_cal);
- for (p = sel_groups; p != NULL; p = p->next) {
- sel_group = E_SOURCE_GROUP (p->data);
- check_grp_uid = g_strdup ((const char *)e_source_group_peek_uid (sel_group));
- if (!strcmp (grp_uid, check_grp_uid)) {
- g_free (check_grp_uid);
- found_grp = TRUE;
- break;
- }
- g_free (check_grp_uid);
- }
-
- if (found_grp != TRUE) {
- g_warning ("Did not find the source group to add the source in the selected calendars");
- g_object_unref (all_cal);
- return;
- }
-
- e_source_group_add_source (sel_group, source, -1);
-
- g_object_unref (all_cal);
-
- } else {
- const char *uid = e_source_peek_uid (source);
- ESourceList *selected_cal = alarm_notify_get_selected_calendars (an);
- alarm_notify_remove_calendar (an, E_CAL_SOURCE_TYPE_EVENT, e_source_get_uri (source));
-
- /* Browse the calendar for alarms and remove the source */
- groups = e_source_list_peek_groups (selected_cal);
- for (p = groups; p != NULL; p = p->next) {
- ESourceGroup *group = E_SOURCE_GROUP (p->data);
- ESource *del_source;
-
- del_source = e_source_group_peek_source_by_uid (group, uid);
- if (del_source) {
- e_source_group_remove_source_by_uid (group, uid);
- break;
- }
- }
- }
-
-}
-
-static GtkWidget *
-populate ()
-{
- GtkWidget *frame = gtk_frame_new (NULL);
- GtkWidget *label1 = gtk_label_new (NULL);
- GtkWidget *box = gtk_vbox_new(FALSE, 0);
- ESourceList *selected_cal = alarm_notify_get_selected_calendars (an);
- GSList *groups;
- GSList *p;
- ESourceList *source_list;
-
- gtk_label_set_markup (GTK_LABEL(label1), _("<b>Calendars</b>"));
- gtk_frame_set_label_widget (GTK_FRAME(frame), label1);
-
- if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) {
- g_message (G_STRLOC ": Could not get the list of sources to load");
-
- return NULL;
- }
-
- groups = e_source_list_peek_groups (source_list);
-
- for (p = groups; p != NULL; p = p->next) {
- ESourceGroup *group = E_SOURCE_GROUP (p->data);
- char *txt = g_strdup_printf ("<b>%s</b>", e_source_group_peek_name (group));
- GtkWidget *item = gtk_label_new (NULL);
- GSList *q;
- GtkWidget *hbox, *image;
-
- hbox = gtk_hbox_new (FALSE, 0);
- image = e_icon_factory_get_image ("stock_appointment-reminder", E_ICON_SIZE_SMALL_TOOLBAR);
-
- gtk_box_pack_start ((GtkBox *)hbox, image, FALSE, FALSE, 2);
- gtk_box_pack_start ((GtkBox *)hbox, item, FALSE, FALSE, 2);
-
- gtk_label_set_markup (GTK_LABEL(item), txt);
- gtk_label_set_justify (GTK_LABEL(item), GTK_JUSTIFY_LEFT);
- g_free (txt);
-
- gtk_box_pack_start (GTK_BOX(box), hbox, TRUE, TRUE, 4);
- gtk_widget_show_all (hbox);
-
- for (q = e_source_group_peek_sources (group); q != NULL; q = q->next) {
- ESource *source = E_SOURCE (q->data);
- GtkWidget *hbox = gtk_hbox_new (FALSE, 0);
- GtkWidget *item = gtk_check_button_new_with_label (e_source_peek_name (source));
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(item), e_source_list_peek_source_by_uid (selected_cal, e_source_peek_uid (source)) ? TRUE:FALSE);
-
- gtk_box_pack_start ((GtkBox *)hbox, item, FALSE, FALSE, 24);
- gtk_object_set_data_full (GTK_OBJECT (item), "ESourceMenu", source,
- (GtkDestroyNotify) g_object_unref);
-
- g_signal_connect (item, "toggled", G_CALLBACK (menu_item_toggle_callback), source);
-
- gtk_box_pack_start (GTK_BOX(box), hbox, FALSE, FALSE, 2);
- gtk_widget_show_all (hbox);
- }
- }
-
- gtk_container_add (GTK_CONTAINER(frame), box);
- gtk_container_set_border_width (GTK_CONTAINER(frame), 6);
- return frame;
-}
-
-static void
-alarm_pref_response (GtkWidget *widget, int response, gpointer dummy)
-{
- gtk_widget_destroy (widget);
-}
-
-static void
-alarms_configure (EPopup *ep, EPopupItem *pitem, void *data)
-{
- GtkWidget *box = populate ();
- GtkWidget *dialog;
-
- dialog = gtk_dialog_new_with_buttons (_("Preferences"),
- NULL,0,
- GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
- GTK_STOCK_HELP, GTK_RESPONSE_HELP,
- NULL);
-
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), box);
- gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE);
- g_signal_connect (dialog, "response", G_CALLBACK (alarm_pref_response), NULL);
- gtk_widget_show_all (dialog);
-}
-
-static EPopupItem tray_items[] = {
- { E_POPUP_ITEM, "00.configure", N_("_Configure Alarms"), alarms_configure, NULL, GTK_STOCK_PREFERENCES },
- { E_POPUP_BAR , "10.bar" },
- { E_POPUP_ITEM, "10.quit", N_("_Quit"), alarm_quit, NULL, GTK_STOCK_QUIT },
-};
-
-static void
-tray_popup_free(EPopup *ep, GSList *items, void *data)
-{
- g_slist_free(items);
-}
-
static gint
tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
@@ -1230,42 +1021,14 @@ tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_da
return TRUE;
} else if (event->button == 3) {
- GtkMenu *menu;
- GSList *menus = NULL;
- EPopup *ep;
- int i;
- GdkPixbuf *pixbuf;
- GtkTooltips *tooltips = gtk_tooltips_new ();
- tray_blink_state = FALSE;
- pixbuf = e_icon_factory_get_icon (tray_blink_state == TRUE ?
- "stock_appointment-reminder-excl" :
- "stock_appointment-reminder",
- E_ICON_SIZE_LARGE_TOOLBAR);
-
-#ifndef USE_GTK_STATUS_ICON
- gtk_image_set_from_pixbuf (GTK_IMAGE (tray_image), pixbuf);
-#else
- gtk_status_icon_set_from_pixbuf (tray_icon, pixbuf);
-#endif
- g_object_unref (pixbuf);
-
if (tray_blink_id > -1)
g_source_remove (tray_blink_id);
tray_blink_id = -1;
-#ifndef USE_GTK_STATUS_ICON
- gtk_tooltips_set_tip (tooltips, tray_event_box, NULL, NULL);
-#else
- gtk_status_icon_set_tooltip (tray_icon, NULL);
-#endif
-
- ep = e_popup_new("org.gnome.evolution.alarmNotify.popup");
- for (i=0;i<sizeof(tray_items)/sizeof(tray_items[0]);i++)
- menus = g_slist_prepend(menus, &tray_items[i]);
- e_popup_add_items(ep, menus, NULL, tray_popup_free, tray_data);
- menu = e_popup_create_menu_once(ep, NULL, 0);
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time);
+ gtk_widget_destroy (tray_icon);
+ tray_icon = NULL;
+ tray_image = NULL;
return TRUE;
}
@@ -1286,20 +1049,6 @@ icon_activated (GtkStatusIcon *icon)
tray_icon_clicked_cb (NULL, &event, NULL);
}
-
-static void
-popup_menu (GtkStatusIcon *icon,
- guint button,
- guint32 activate_time)
-{
- GdkEventButton event;
-
- event.type = GDK_BUTTON_PRESS;
- event.button = button;
- event.time = activate_time;
-
- tray_icon_clicked_cb (NULL, &event, NULL);
-}
#endif
static gboolean
@@ -1315,9 +1064,11 @@ tray_icon_blink_cb (gpointer data)
E_ICON_SIZE_LARGE_TOOLBAR);
#ifndef USE_GTK_STATUS_ICON
- gtk_image_set_from_pixbuf (GTK_IMAGE (tray_image), pixbuf);
+ if (tray_icon && tray_image)
+ gtk_image_set_from_pixbuf (GTK_IMAGE (tray_image), pixbuf);
#else
- gtk_status_icon_set_from_pixbuf (tray_icon, pixbuf);
+ if (tray_icon)
+ gtk_status_icon_set_from_pixbuf (tray_icon, pixbuf);
#endif
g_object_unref (pixbuf);
@@ -1333,7 +1084,7 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
ECalComponent *comp;
const char *summary, *description, *location;
#ifndef USE_GTK_STATUS_ICON
- GtkWidget *tray_icon=NULL, *image=NULL;
+ GtkWidget *image=NULL;
GtkTooltips *tooltips;
#endif
TrayIconData *tray_data;
@@ -1378,8 +1129,27 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
/* create the tray icon */
#ifndef USE_GTK_STATUS_ICON
+ if (tray_icon == NULL) {
+ tray_icon = GTK_WIDGET (egg_tray_icon_new ("Evolution Alarm"));
+ tray_image = e_icon_factory_get_image ("stock_appointment-reminder", E_ICON_SIZE_LARGE_TOOLBAR);
+ tray_event_box = gtk_event_box_new ();
+ gtk_container_add (GTK_CONTAINER (tray_event_box), tray_image);
+ gtk_container_add (GTK_CONTAINER (tray_icon), tray_event_box);
+ g_signal_connect (G_OBJECT (tray_event_box), "button_press_event",
+ G_CALLBACK (tray_icon_clicked_cb), NULL);
+ gtk_widget_show_all (tray_icon);
+ }
tooltips = gtk_tooltips_new ();
+
+#else
+ if (tray_icon == NULL) {
+ tray_icon = gtk_status_icon_new ();
+ gtk_status_icon_set_from_pixbuf (tray_icon, e_icon_factory_get_icon ("stock_appointment-reminder", E_ICON_SIZE_LARGE_TOOLBAR));
+ g_signal_connect (G_OBJECT (tray_icon), "activate",
+ G_CALLBACK (icon_activated), NULL);
+ }
#endif
+
current_zone = config_data_get_timezone ();
alarm_str = timet_to_str_with_zone (trigger, current_zone);
start_str = timet_to_str_with_zone (qa->instance->occur_start, current_zone);
@@ -1425,7 +1195,7 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
#ifndef USE_GTK_STATUS_ICON
gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), tray_event_box, str, NULL);
#else
- gtk_status_icon_set_tooltip (tray_icon, NULL);
+ gtk_status_icon_set_tooltip (tray_icon, str);
#endif
}
@@ -1447,7 +1217,7 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
if (tray_blink_id == -1)
tray_blink_id = g_timeout_add (500, tray_icon_blink_cb, tray_data);
}
- }
+}
#ifdef HAVE_LIBNOTIFY
static void
@@ -1462,7 +1232,6 @@ popup_notification (time_t trigger, CompQueuedAlarms *cqa,
char *str, *start_str, *end_str, *alarm_str, *time_str;
icaltimezone *current_zone;
ECalComponentOrganizer organiser;
- char *filename;
char *body;
comp = cqa->alarms->comp;
@@ -1471,8 +1240,6 @@ popup_notification (time_t trigger, CompQueuedAlarms *cqa,
return;
if (!notify_is_initted ())
notify_init("Evolution Alarm Notify");
- GdkPixbuf *icon = e_icon_factory_get_icon("stock_appointment-reminder", E_ICON_SIZE_DIALOG);
- g_free (filename);
/* get a sensible description for the event */
e_cal_component_get_summary (comp, &text);
@@ -1509,10 +1276,9 @@ popup_notification (time_t trigger, CompQueuedAlarms *cqa,
body = g_strdup_printf ("%s %s\n%s %s", _("Location:"), location, start_str, time_str);
else
body = g_strdup_printf ("%s %s", start_str, time_str);
-}
+ }
- NotifyNotification *n = notify_notification_new (summary, body, "", NULL);
- notify_notification_set_icon_data_from_pixbuf (n, icon);
+ NotifyNotification *n = notify_notification_new (summary, body, "stock_appointment-reminder", NULL);
if (!notify_notification_show(n, NULL))
g_warning ("Could not send notification to daemon\n");
@@ -1727,9 +1493,6 @@ check_midnight_refresh (gpointer user_data)
void
alarm_queue_init (gpointer data)
{
-#ifndef USE_GTK_STATUS_ICON
- GtkWidget *tray_icon;
-#endif
an = data;
g_return_if_fail (alarm_queue_inited == FALSE);
@@ -1745,24 +1508,6 @@ alarm_queue_init (gpointer data)
/* install timeout handler (every 30 mins) for not missing the midnight refresh */
g_timeout_add (1800000, (GSourceFunc) check_midnight_refresh, NULL);
-#ifndef USE_GTK_STATUS_ICON
- tray_icon = GTK_WIDGET (egg_tray_icon_new ("Evolution Alarm"));
- tray_image = e_icon_factory_get_image ("stock_appointment-reminder", E_ICON_SIZE_LARGE_TOOLBAR);
- tray_event_box = gtk_event_box_new ();
- gtk_container_add (GTK_CONTAINER (tray_event_box), tray_image);
- gtk_container_add (GTK_CONTAINER (tray_icon), tray_event_box);
- g_signal_connect (G_OBJECT (tray_event_box), "button_press_event",
- G_CALLBACK (tray_icon_clicked_cb), NULL);
- gtk_widget_show_all (tray_icon);
-#else
- tray_icon = gtk_status_icon_new ();
- gtk_status_icon_set_from_pixbuf (tray_icon, e_icon_factory_get_icon ("stock_appointment-reminder", E_ICON_SIZE_LARGE_TOOLBAR));
- g_signal_connect (G_OBJECT (tray_icon), "activate",
- G_CALLBACK (icon_activated), NULL);
- g_signal_connect (G_OBJECT (tray_icon), "popup-menu",
- G_CALLBACK (popup_menu), NULL);
-#endif
-
#ifdef HAVE_LIBNOTIFY
notify_init("Evolution Alarms");
#endif
@@ -1929,7 +1674,6 @@ alarm_queue_remove_client (ECal *client)
remove_client_alarms (ca);
/* Clean up */
-
if (ca->client) {
g_signal_handlers_disconnect_matched (ca->client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, ca);
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index 2f548b66c1..996b257353 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -303,6 +303,41 @@ default_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs)
}
static void
+alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs)
+{
+ ESourceList *source_list = prefs->alarms_list;
+ GSList *selection;
+ GSList *l;
+ GSList *groups;
+
+ /* first we clear all the alarm flags from all sources */
+ g_message ("Clearing selection");
+ for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) {
+ ESourceGroup *group = E_SOURCE_GROUP (groups->data);
+ GSList *sources;
+ for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
+ ESource *source = E_SOURCE (sources->data);
+
+ g_message ("Unsetting for %s", e_source_peek_name (source));
+ e_source_set_property (source, "alarm", "false");
+ }
+ }
+
+ /* then we loop over the selector's selection, setting the
+ property on those sources */
+ selection = e_source_selector_get_selection (selector);
+ for (l = selection; l; l = l->next) {
+ g_message ("Setting for %s", e_source_peek_name (E_SOURCE (l->data)));
+ e_source_set_property (E_SOURCE (l->data), "alarm", "true");
+ }
+ e_source_selector_free_selection (selection);
+
+ /* FIXME show an error if this fails? */
+ e_source_list_sync (source_list, NULL);
+ printf("changed\n");
+}
+
+static void
template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs)
{
calendar_config_set_free_busy_template (gtk_entry_get_text (entry));
@@ -347,6 +382,9 @@ setup_changes (CalendarPrefsDialog *prefs)
G_CALLBACK (default_reminder_interval_changed), prefs);
g_signal_connect (G_OBJECT (prefs->default_reminder_units), "changed", G_CALLBACK (default_reminder_units_changed), prefs);
+ g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs);
+
+
g_signal_connect (G_OBJECT (prefs->template_url), "changed", G_CALLBACK (template_url_changed), prefs);
}
@@ -402,6 +440,38 @@ show_task_list_config (CalendarPrefsDialog *prefs)
gtk_widget_set_sensitive (prefs->tasks_hide_completed_units, hide_completed_tasks);
}
+static void
+initialize_selection (ESourceSelector *selector, ESourceList *source_list)
+{
+ GSList *groups;
+
+ for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) {
+ ESourceGroup *group = E_SOURCE_GROUP (groups->data);
+ GSList *sources;
+ for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
+ ESource *source = E_SOURCE (sources->data);
+ const char *completion = e_source_get_property (source, "alarm");
+ if (!completion || !g_ascii_strcasecmp (completion, "true")) {
+ if (!completion)
+ e_source_set_property (E_SOURCE (source), "alarm", "true");
+ e_source_selector_select_source (selector, source);
+ }
+ }
+ }
+}
+
+static void
+show_alarms_config (CalendarPrefsDialog *prefs)
+{
+ if (!e_cal_get_sources (&prefs->alarms_list, E_CAL_SOURCE_TYPE_EVENT, NULL))
+ return;
+
+ prefs->alarm_list_widget = e_source_selector_new (prefs->alarms_list);
+ atk_object_set_name (gtk_widget_get_accessible (prefs->alarm_list_widget), _("Selected Calendars for Alarms"));
+ gtk_container_add (GTK_CONTAINER (prefs->scrolled_window), prefs->alarm_list_widget);
+ initialize_selection (prefs->alarm_list_widget, prefs->alarms_list);
+}
+
/* Shows the current config settings in the dialog. */
static void
show_config (CalendarPrefsDialog *prefs)
@@ -460,6 +530,9 @@ show_config (CalendarPrefsDialog *prefs)
/* Task list */
show_task_list_config (prefs);
+ /* Alarms list*/
+ show_alarms_config (prefs);
+
/* Free/Busy */
show_fb_config (prefs);
@@ -480,6 +553,7 @@ static ECalConfigItem eccp_items[] = {
{ E_CONFIG_PAGE, "10.display", "display", eccp_widget_glade },
{ E_CONFIG_SECTION, "10.display/00.general", "displayGeneral", eccp_widget_glade },
{ E_CONFIG_SECTION, "10.display/10.taskList", "taskList", eccp_widget_glade },
+ { E_CONFIG_PAGE, "15.alarms", "alarms", eccp_widget_glade },
{ E_CONFIG_PAGE, "20.freeBusy", "freebusy", eccp_widget_glade },
{ E_CONFIG_SECTION, "20.freeBusy/00.defaultServer", "defaultFBServer", eccp_widget_glade },
};
@@ -558,6 +632,10 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs)
prefs->tasks_hide_completed_interval = glade_xml_get_widget (gui, "tasks_hide_completed_interval");
prefs->tasks_hide_completed_units = glade_xml_get_widget (gui, "tasks_hide_completed_units");
+
+ /* Alarms tab */
+ prefs->scrolled_window = glade_xml_get_widget (gui, "calendar-source-scrolled-window");
+
/* Free/Busy tab */
prefs->template_url = glade_xml_get_widget (gui, "template_url");
target = e_cal_config_target_new_prefs (ec, prefs->gconf);
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.glade b/calendar/gui/dialogs/cal-prefs-dialog.glade
index fbc149683a..09966cb4ca 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.glade
+++ b/calendar/gui/dialogs/cal-prefs-dialog.glade
@@ -1210,7 +1210,7 @@ Days</property>
<property name="can_focus">True</property>
<property name="dither">True</property>
<property name="use_alpha">False</property>
- <property name="title" translatable="yes">Color for tasks due today</property>
+ <property name="title" translatable="yes">Pick a color</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
@@ -1229,7 +1229,7 @@ Days</property>
<property name="can_focus">True</property>
<property name="dither">True</property>
<property name="use_alpha">False</property>
- <property name="title" translatable="yes">Color for overdue tasks</property>
+ <property name="title" translatable="yes">Pick a color</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
@@ -1360,6 +1360,100 @@ Days</property>
</child>
<child>
+ <widget class="GtkVBox" id="vbox16">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox24">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label62">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Select the calendars for alarm notification</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="calendar-source-scrolled-window">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="alarm-label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Alarms</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkVBox" id="freebusy">
<property name="border_width">12</property>
<property name="visible">True</property>
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h
index ab717d85a9..3575e9baca 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.h
+++ b/calendar/gui/dialogs/cal-prefs-dialog.h
@@ -28,6 +28,7 @@
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <gconf/gconf-client.h>
+#include <libedataserverui/e-source-selector.h>
#include "evolution-config-control.h"
G_BEGIN_DECLS
@@ -66,6 +67,11 @@ struct _CalendarPrefsDialog {
GtkWidget *tasks_hide_completed_interval;
GtkWidget *tasks_hide_completed_units;
+ /* Alarms tab */
+ GtkWidget *scrolled_window;
+ ESourceList *alarms_list;
+ GtkWidget *alarm_list_widget;
+
/* Free/Busy tab */
GtkWidget *url_add;
GtkWidget *url_edit;