aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/alarm-notify/alarm-queue.c
diff options
context:
space:
mode:
authorRodney Dawes <dobey@novell.com>2004-11-23 14:24:57 +0800
committerRodney Dawes <dobey@src.gnome.org>2004-11-23 14:24:57 +0800
commitb2954936ac553ea42cd6bb177b7e32c3ffcb0fe8 (patch)
treea9fd4ffda772ed0d0c3efab7fba71b587d469eee /calendar/gui/alarm-notify/alarm-queue.c
parenta737e6f5b5211259a18dece7710b51119365950f (diff)
downloadgsoc2013-evolution-b2954936ac553ea42cd6bb177b7e32c3ffcb0fe8.tar
gsoc2013-evolution-b2954936ac553ea42cd6bb177b7e32c3ffcb0fe8.tar.gz
gsoc2013-evolution-b2954936ac553ea42cd6bb177b7e32c3ffcb0fe8.tar.bz2
gsoc2013-evolution-b2954936ac553ea42cd6bb177b7e32c3ffcb0fe8.tar.lz
gsoc2013-evolution-b2954936ac553ea42cd6bb177b7e32c3ffcb0fe8.tar.xz
gsoc2013-evolution-b2954936ac553ea42cd6bb177b7e32c3ffcb0fe8.tar.zst
gsoc2013-evolution-b2954936ac553ea42cd6bb177b7e32c3ffcb0fe8.zip
Add gtkimage.h to includes, and remove gtkhtml headers Add and remove some
2004-11-23 Rodney Dawes <dobey@novell.com> * gui/alarm-notify/alarm-notify-dialog.[ch]: Add gtkimage.h to includes, and remove gtkhtml headers Add and remove some widgets in the AlarmNotify struct (dialog_destroy_cb, delete_event_cb, close_clicked_cb): (snooze_clicked_cb, edit_clicked_cb, url_requested_cb): (make_html_display, write_times, write_html_heading): (alarm_notify_dialog_disable_buttons): Remove all these unneeded functions (no more GtkHTML in the dialog) (alarm_notify_dialog): Add description and location arguments Rename message argument to summary Update gtk-doc comment block to reflect API changes Clean up code to use gtk_dialog_run () and use a HIG compliant dialog * gui/alarm-notify/alarm-notify.glade: Update the alarm notify dialog to be HIG compliant and not use GtkHTML, and display more information that is relevant to the appointment we are alerting of * gui/alarm-notify/alarm-queue.c: Add new variables to the TrayIconData structure so we can access the description and location (on_dialog_objs_removed_cb): Remove alarm_dialog bits (notify_dialog_cb): Remove alarm_dialog bits (tray_icon_destroyed_cb): Free the description and location as well (open_alarm_dialog): alarm_notify_dialog does all the work now, we don't need to trap the dialog widget here (display_notification): Add code to get the description and location information from the cal component Avoid using an alarm component which has less useful API Fix a warning when creating the tray_icon widget svn path=/trunk/; revision=27971
Diffstat (limited to 'calendar/gui/alarm-notify/alarm-queue.c')
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c83
1 files changed, 49 insertions, 34 deletions
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index 0679d00f08..028cd8d00a 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -699,7 +699,9 @@ edit_component (ECal *client, ECalComponent *comp)
}
typedef struct {
- char *message;
+ char *summary;
+ char *description;
+ char *location;
gboolean blink_state;
gint blink_id;
time_t trigger;
@@ -730,8 +732,6 @@ on_dialog_objs_removed_cb (ECal *client, GList *objects, gpointer data)
continue;
if (!strcmp (uid, our_uid)) {
- if (tray_data->alarm_dialog)
- alarm_notify_dialog_disable_buttons (tray_data->alarm_dialog);
tray_data->cqa = NULL;
tray_data->alarm_id = NULL;
@@ -767,7 +767,6 @@ notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data)
g_assert_not_reached ();
}
- tray_data->alarm_dialog = NULL;
gtk_widget_destroy (tray_data->tray_icon);
}
@@ -782,9 +781,19 @@ tray_icon_destroyed_cb (GtkWidget *tray, gpointer user_data)
if (tray_data->cqa != NULL)
remove_queued_alarm (tray_data->cqa, tray_data->alarm_id, TRUE, TRUE);
- if (tray_data->message != NULL) {
- g_free (tray_data->message);
- tray_data->message = NULL;
+ if (tray_data->summary != NULL) {
+ g_free (tray_data->summary);
+ tray_data->summary = NULL;
+ }
+
+ if (tray_data->description != NULL) {
+ g_free (tray_data->description);
+ tray_data->description = NULL;
+ }
+
+ if (tray_data->location != NULL) {
+ g_free (tray_data->location);
+ tray_data->location = NULL;
}
if (tray_data->blink_id)
@@ -806,19 +815,17 @@ open_alarm_dialog (TrayIconData *tray_data)
{
QueuedAlarm *qa;
- if (tray_data->alarm_dialog != NULL)
- return FALSE;
-
qa = lookup_queued_alarm (tray_data->cqa, tray_data->alarm_id);
if (qa) {
gtk_widget_hide (tray_data->tray_icon);
- tray_data->alarm_dialog = alarm_notify_dialog (
- tray_data->trigger,
- qa->instance->occur_start,
- qa->instance->occur_end,
- e_cal_component_get_vtype (tray_data->comp),
- tray_data->message,
- notify_dialog_cb, tray_data);
+ alarm_notify_dialog (tray_data->trigger,
+ qa->instance->occur_start,
+ qa->instance->occur_end,
+ e_cal_component_get_vtype (tray_data->comp),
+ tray_data->summary,
+ tray_data->description,
+ tray_data->location,
+ notify_dialog_cb, tray_data);
}
return TRUE;
@@ -917,12 +924,12 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
{
QueuedAlarm *qa;
ECalComponent *comp;
- const char *message;
- ECalComponentAlarm *alarm;
+ const char *summary, *description, *location;
GtkWidget *tray_icon, *image, *ebox;
GtkTooltips *tooltips;
TrayIconData *tray_data;
ECalComponentText text;
+ GSList *text_list;
char *str, *start_str, *end_str, *alarm_str;
icaltimezone *current_zone;
GdkPixbuf *pixbuf;
@@ -933,26 +940,32 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
return;
/* get a sensible description for the event */
- alarm = e_cal_component_get_alarm (comp, qa->instance->auid);
- g_assert (alarm != NULL);
+ e_cal_component_get_summary (comp, &text);
- e_cal_component_alarm_get_description (alarm, &text);
- e_cal_component_alarm_free (alarm);
+ if (text.value)
+ summary = text.value;
+ else
+ summary = _("No summary available.");
+ e_cal_component_get_description_list (comp, &text_list);
+
+ text = *((ECalComponentText *)text_list->data);
if (text.value)
- message = text.value;
- else {
- e_cal_component_get_summary (comp, &text);
- if (text.value)
- message = text.value;
- else
- message = _("No description available.");
- }
+ description = text.value;
+ else
+ description = _("No description available.");
+
+ e_cal_component_free_text_list (text_list);
+
+ e_cal_component_get_location (comp, &location);
+
+ if (!location)
+ location = _("No location information available.");
/* create the tray icon */
tooltips = gtk_tooltips_new ();
- tray_icon = egg_tray_icon_new (qa->instance->auid);
+ tray_icon = GTK_WIDGET (egg_tray_icon_new (qa->instance->auid));
pixbuf = e_icon_factory_get_icon ("stock_appointment-reminder", E_ICON_SIZE_LARGE_TOOLBAR);
image = gtk_image_new_from_pixbuf (pixbuf);
gdk_pixbuf_unref (pixbuf);
@@ -966,7 +979,7 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
start_str = timet_to_str_with_zone (qa->instance->occur_start, current_zone);
end_str = timet_to_str_with_zone (qa->instance->occur_end, current_zone);
str = g_strdup_printf (_("Alarm on %s\n%s\nStarting at %s\nEnding at %s"),
- alarm_str, message, start_str, end_str);
+ alarm_str, summary, start_str, end_str);
gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), ebox, str, str);
g_free (start_str);
g_free (end_str);
@@ -981,7 +994,9 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
/* create the private structure */
tray_data = g_new0 (TrayIconData, 1);
- tray_data->message = g_strdup (message);
+ tray_data->summary = g_strdup (summary);
+ tray_data->description = g_strdup (description);
+ tray_data->location = g_strdup (location);
tray_data->trigger = trigger;
tray_data->cqa = cqa;
tray_data->alarm_id = alarm_id;