aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJP Rosevear <jpr@novell.com>2005-01-08 01:38:49 +0800
committerJP Rosevear <jpr@src.gnome.org>2005-01-08 01:38:49 +0800
commitf679ec6e047ae7fad54444965827497a33118624 (patch)
tree31813a6959db0014ab688ca8130ef810b4d92124 /plugins
parent754665c5aa85c322f31c74d4e2d0467efd4a3a38 (diff)
downloadgsoc2013-evolution-f679ec6e047ae7fad54444965827497a33118624.tar.gz
gsoc2013-evolution-f679ec6e047ae7fad54444965827497a33118624.tar.zst
gsoc2013-evolution-f679ec6e047ae7fad54444965827497a33118624.zip
protos
2005-01-07 JP Rosevear <jpr@novell.com> * itip-view.h: protos * itip-view.c (rsvp_toggled_cb): set comment sensitivity (itip_view_init): add comment entry (itip_view_set_rsvp): make comment entry sensitive when rsvp is (itip_view_set_rsvp_comment): accessor (itip_view_get_rsvp_comment): ditto * itip-formatter.c (find_cal_opened_cb): set error message if we can't find the item (view_response_cb): add comment if the user sets one svn path=/trunk/; revision=28275
Diffstat (limited to 'plugins')
-rw-r--r--plugins/itip-formatter/ChangeLog14
-rw-r--r--plugins/itip-formatter/itip-formatter.c32
-rw-r--r--plugins/itip-formatter/itip-view.c97
-rw-r--r--plugins/itip-formatter/itip-view.h3
4 files changed, 124 insertions, 22 deletions
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog
index 974fdaabac..6e6c2e1041 100644
--- a/plugins/itip-formatter/ChangeLog
+++ b/plugins/itip-formatter/ChangeLog
@@ -1,5 +1,19 @@
2005-01-07 JP Rosevear <jpr@novell.com>
+ * itip-view.h: protos
+
+ * itip-view.c (rsvp_toggled_cb): set comment sensitivity
+ (itip_view_init): add comment entry
+ (itip_view_set_rsvp): make comment entry sensitive when rsvp is
+ (itip_view_set_rsvp_comment): accessor
+ (itip_view_get_rsvp_comment): ditto
+
+ * itip-formatter.c (find_cal_opened_cb): set error message if we
+ can't find the item
+ (view_response_cb): add comment if the user sets one
+
+2005-01-07 JP Rosevear <jpr@novell.com>
+
* itip-view.h: add protos
* itip-view.c (set_sender_text): update descriptions better
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 9a4d5d49cb..8e22e7d239 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -407,6 +407,7 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
itip_view_clear_lower_info_items (ITIP_VIEW (pitip->view));
pitip->progress_info_id = 0;
+ /* FIXME Check read only state of calendar? */
itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO,
"Found the appointment in the calendar '%s'", e_source_peek_name (source));
@@ -418,6 +419,9 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
cleanup:
if (fd->count == 0) {
+ itip_view_remove_lower_info_item (ITIP_VIEW (pitip->view), pitip->progress_info_id);
+ pitip->progress_info_id = 0;
+
if ((pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST)
&& !pitip->current_ecal) {
ESource *source = NULL;
@@ -451,9 +455,6 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
/* FIXME Default to the suggestion for RSVP for my attendee */
itip_view_set_rsvp (ITIP_VIEW (pitip->view), pitip->method == ICAL_METHOD_REQUEST ? TRUE : FALSE);
itip_view_set_show_rsvp (ITIP_VIEW (pitip->view), pitip->method == ICAL_METHOD_REQUEST ? TRUE : FALSE);
-
- itip_view_remove_lower_info_item (ITIP_VIEW (pitip->view), pitip->progress_info_id);
- pitip->progress_info_id = 0;
if (source) {
itip_view_set_source (ITIP_VIEW (pitip->view), source);
@@ -463,8 +464,9 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to find any calendars");
itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE);
}
- } else {
- /* FIXME Display error message to user */
+ } else if (!pitip->current_ecal) {
+ itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING,
+ "Unable to find this meeting in any calendar");
}
g_free (fd->uid);
@@ -923,7 +925,7 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
icalcomponent *ical_comp;
icalproperty *prop;
icalvalue *value;
- const char *attendee;
+ const char *attendee, *comment;
GSList *l, *list = NULL;
comp = e_cal_component_clone (pitip->comp);
@@ -937,7 +939,8 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
g_assert (pitip->my_address != NULL);
ical_comp = e_cal_component_get_icalcomponent (comp);
-
+
+ /* Remove all attendees except the one we are responding as */
for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY);
prop != NULL;
prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY))
@@ -964,6 +967,21 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
}
g_slist_free (list);
+ /* Add a comment if there user set one */
+ comment = itip_view_get_rsvp_comment (ITIP_VIEW (pitip->view));
+ if (comment) {
+ GSList comments;
+ ECalComponentText text;
+
+ text.value = comment;
+ text.altrep = NULL;
+
+ comments.data = &text;
+ comments.next = NULL;
+
+ e_cal_component_set_comment_list (comp, &comments);
+ }
+
e_cal_component_rescan (comp);
itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, pitip->current_ecal, pitip->top_level);
diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c
index 0c76fc316a..455325db15 100644
--- a/plugins/itip-formatter/itip-view.c
+++ b/plugins/itip-formatter/itip-view.c
@@ -100,13 +100,15 @@ struct _ItipViewPrivate {
GtkWidget *description_label;
char *description;
- GtkWidget *details_box;
-
+ GtkWidget *selector_box;
GtkWidget *esom;
GtkWidget *esom_header;
ESourceList *source_list;
+ GtkWidget *rsvp_box;
GtkWidget *rsvp_check;
+ GtkWidget *rsvp_comment_header;
+ GtkWidget *rsvp_comment_entry;
gboolean rsvp_show;
GtkWidget *button_box;
@@ -658,10 +660,25 @@ itip_view_class_init (ItipViewClass *klass)
}
static void
+rsvp_toggled_cb (GtkWidget *widget, gpointer data)
+{
+ ItipView *view = data;
+ ItipViewPrivate *priv;
+ gboolean rsvp;
+
+ priv = view->priv;
+
+ rsvp = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->rsvp_check));
+
+ gtk_widget_set_sensitive (priv->rsvp_comment_header, rsvp);
+ gtk_widget_set_sensitive (priv->rsvp_comment_entry, rsvp);
+}
+
+static void
itip_view_init (ItipView *view)
{
ItipViewPrivate *priv;
- GtkWidget *icon, *vbox, *details_vbox, *separator, *table;
+ GtkWidget *icon, *vbox, *hbox, *separator, *table, *label;
priv = g_new0 (ItipViewPrivate, 1);
view->priv = priv;
@@ -765,17 +782,38 @@ itip_view_init (ItipView *view)
gtk_widget_show (priv->lower_info_box);
gtk_box_pack_start (GTK_BOX (vbox), priv->lower_info_box, FALSE, FALSE, 6);
- /* Detail area */
- details_vbox = gtk_vbox_new (FALSE, 0);
- gtk_widget_show (details_vbox);
- gtk_box_pack_start (GTK_BOX (vbox), details_vbox, FALSE, FALSE, 0);
-
- priv->details_box = gtk_hbox_new (FALSE, 0);
- gtk_widget_show (priv->details_box);
- gtk_box_pack_start (GTK_BOX (details_vbox), priv->details_box, FALSE, FALSE, 0);
+ /* Selector area */
+ priv->selector_box = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (priv->selector_box);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->selector_box, FALSE, FALSE, 0);
+ /* RSVP area */
+ priv->rsvp_box = gtk_vbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->rsvp_box, FALSE, FALSE, 0);
+
priv->rsvp_check = gtk_check_button_new_with_mnemonic ("Send _reply to sender");
- gtk_box_pack_end (GTK_BOX (details_vbox), priv->rsvp_check, FALSE, FALSE, 6);
+ gtk_widget_show (priv->rsvp_check);
+ gtk_box_pack_start (GTK_BOX (priv->rsvp_box), priv->rsvp_check, FALSE, FALSE, 6);
+
+ g_signal_connect (priv->rsvp_check, "toggled", G_CALLBACK (rsvp_toggled_cb), view);
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (hbox);
+ gtk_box_pack_start (GTK_BOX (priv->rsvp_box), hbox, FALSE, FALSE, 12);
+
+ label = gtk_label_new (NULL);
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 12);
+
+ priv->rsvp_comment_header = gtk_label_new (_("Comment:"));
+ gtk_widget_set_sensitive (priv->rsvp_comment_header, FALSE);
+ gtk_widget_show (priv->rsvp_comment_header);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->rsvp_comment_header, FALSE, FALSE, 6);
+
+ priv->rsvp_comment_entry = gtk_entry_new ();
+ gtk_widget_set_sensitive (priv->rsvp_comment_entry, FALSE);
+ gtk_widget_show (priv->rsvp_comment_entry);
+ gtk_box_pack_start (GTK_BOX (hbox), priv->rsvp_comment_entry, FALSE, TRUE, 6);
/* The buttons for actions */
priv->button_box = gtk_hbutton_box_new ();
@@ -1389,8 +1427,8 @@ itip_view_set_source_list (ItipView *view, ESourceList *source_list)
gtk_widget_show (priv->esom_header);
}
- gtk_box_pack_start (GTK_BOX (priv->details_box), priv->esom_header, FALSE, TRUE, 6);
- gtk_box_pack_start (GTK_BOX (priv->details_box), priv->esom, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->selector_box), priv->esom_header, FALSE, TRUE, 6);
+ gtk_box_pack_start (GTK_BOX (priv->selector_box), priv->esom, FALSE, TRUE, 0);
}
ESourceList *
@@ -1449,6 +1487,9 @@ itip_view_set_rsvp (ItipView *view, gboolean rsvp)
priv = view->priv;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->rsvp_check), rsvp);
+
+ gtk_widget_set_sensitive (priv->rsvp_comment_header, rsvp);
+ gtk_widget_set_sensitive (priv->rsvp_comment_entry, rsvp);
}
gboolean
@@ -1476,7 +1517,7 @@ itip_view_set_show_rsvp (ItipView *view, gboolean rsvp)
priv->rsvp_show = rsvp;
- priv->rsvp_show ? gtk_widget_show (priv->rsvp_check) : gtk_widget_hide (priv->rsvp_check);
+ priv->rsvp_show ? gtk_widget_show (priv->rsvp_box) : gtk_widget_hide (priv->rsvp_box);
}
gboolean
@@ -1493,6 +1534,32 @@ itip_view_get_show_rsvp (ItipView *view)
}
void
+itip_view_set_rsvp_comment (ItipView *view, const char *comment)
+{
+ ItipViewPrivate *priv;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (ITIP_IS_VIEW (view));
+
+ priv = view->priv;
+
+ gtk_entry_set_text (GTK_ENTRY (priv->rsvp_comment_entry), comment);
+}
+
+const char *
+itip_view_get_rsvp_comment (ItipView *view)
+{
+ ItipViewPrivate *priv;
+
+ g_return_val_if_fail (view != NULL, FALSE);
+ g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE);
+
+ priv = view->priv;
+
+ return gtk_entry_get_text (GTK_ENTRY (priv->rsvp_comment_entry));
+}
+
+void
itip_view_set_buttons_sensitive (ItipView *view, gboolean sensitive)
{
ItipViewPrivate *priv;
diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h
index f786ad330f..b2a12a5ad0 100644
--- a/plugins/itip-formatter/itip-view.h
+++ b/plugins/itip-formatter/itip-view.h
@@ -148,6 +148,9 @@ gboolean itip_view_get_rsvp (ItipView *view);
void itip_view_set_show_rsvp (ItipView *view, gboolean rsvp);
gboolean itip_view_get_show_rsvp (ItipView *view);
+void itip_view_set_rsvp_comment (ItipView *view, const char *comment);
+const char *itip_view_get_rsvp_comment (ItipView *view);
+
void itip_view_set_buttons_sensitive (ItipView *view, gboolean sensitive);
gboolean itip_view_get_buttons_sensitive (ItipView *view);