aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/itip-formatter/itip-formatter.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@novell.com>2005-01-04 02:42:11 +0800
committerJP Rosevear <jpr@src.gnome.org>2005-01-04 02:42:11 +0800
commit9e247f541c8ed5fc2eca5cf1c1a521c33964483c (patch)
treef4c9445362e439251cdf6b641f17f84b9e4bd2c0 /plugins/itip-formatter/itip-formatter.c
parent625fd5b098cb6f8a8f68058977ac01bf18ca35b7 (diff)
downloadgsoc2013-evolution-9e247f541c8ed5fc2eca5cf1c1a521c33964483c.tar.gz
gsoc2013-evolution-9e247f541c8ed5fc2eca5cf1c1a521c33964483c.tar.zst
gsoc2013-evolution-9e247f541c8ed5fc2eca5cf1c1a521c33964483c.zip
move the adjust item work here when we actually have the calendar
2005-01-03 JP Rosevear <jpr@novell.com> * itip-formatter.c (find_cal_opened_cb): move the adjust item work here when we actually have the calendar (pitip_free): implement a free function (find_cal_opened_cb): check the methods instead of the show selector member (find_cal_opened_cb): default to true for the rsvp setting svn path=/trunk/; revision=28218
Diffstat (limited to 'plugins/itip-formatter/itip-formatter.c')
-rw-r--r--plugins/itip-formatter/itip-formatter.c116
1 files changed, 57 insertions, 59 deletions
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 6fe199f786..75b51b8433 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -100,8 +100,6 @@ typedef struct {
char *uid;
char *sexp;
-
- gboolean show_selector;
int count;
} EItipControlFindData;
@@ -202,6 +200,57 @@ find_my_address (FormatItipPObject *pitip, icalcomponent *ical_comp, icalparamet
*status = ICAL_PARTSTAT_NEEDSACTION;
}
+static ECalComponent *
+get_real_item (FormatItipPObject *pitip)
+{
+ ECalComponent *comp;
+ icalcomponent *icalcomp;
+ gboolean found = FALSE;
+ const char *uid;
+
+ e_cal_component_get_uid (pitip->comp, &uid);
+
+ found = e_cal_get_object (pitip->current_ecal, uid, NULL, &icalcomp, NULL);
+ if (!found)
+ return NULL;
+
+ comp = e_cal_component_new ();
+ if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
+ g_object_unref (comp);
+ icalcomponent_free (icalcomp);
+ return NULL;
+ }
+
+ return comp;
+}
+
+static void
+adjust_item (FormatItipPObject *pitip, ECalComponent *comp)
+{
+ ECalComponent *real_comp;
+
+ real_comp = get_real_item (pitip);
+ if (real_comp != NULL) {
+ ECalComponentText text;
+ const char *string;
+ GSList *l;
+
+ e_cal_component_get_summary (real_comp, &text);
+ e_cal_component_set_summary (comp, &text);
+ e_cal_component_get_location (real_comp, &string);
+ e_cal_component_set_location (comp, string);
+ e_cal_component_get_description_list (real_comp, &l);
+ e_cal_component_set_description_list (comp, l);
+ e_cal_component_free_text_list (l);
+
+ g_object_unref (real_comp);
+ } else {
+ ECalComponentText text = {_("Unknown"), NULL};
+
+ e_cal_component_set_summary (comp, &text);
+ }
+}
+
static void
set_buttons_sensitive (FormatItipPObject *pitip)
{
@@ -382,11 +431,11 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
cleanup:
if (fd->count == 0) {
- if (fd->show_selector && !pitip->current_ecal) {
+ if ((pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST)
+ && !pitip->current_ecal) {
ESource *source = NULL;
char *uid;
- /* FIXME Should we take into account any sources we failed to open? */
switch (pitip->type) {
case E_CAL_SOURCE_TYPE_EVENT:
uid = calendar_config_get_primary_calendar ();
@@ -413,6 +462,7 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
/* The only method that RSVP makes sense for is REQUEST */
/* FIXME Default to the suggestion for RSVP for my attendee */
+ itip_view_set_rsvp (ITIP_VIEW (pitip->view), TRUE);
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);
@@ -436,7 +486,7 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
}
static void
-find_server (FormatItipPObject *pitip, ECalComponent *comp, gboolean show_selector)
+find_server (FormatItipPObject *pitip, ECalComponent *comp)
{
EItipControlFindData *fd = NULL;
GSList *groups, *l;
@@ -469,7 +519,6 @@ find_server (FormatItipPObject *pitip, ECalComponent *comp, gboolean show_select
fd = g_new0 (EItipControlFindData, 1);
fd->pitip = pitip;
fd->uid = g_strdup (uid);
- fd->show_selector = show_selector;
if (pitip->start_time && pitip->end_time) {
start = isodate_from_time_t (pitip->start_time);
@@ -711,57 +760,6 @@ update_attendee_status (FormatItipPObject *pitip)
g_object_unref (comp);
}
-static ECalComponent *
-get_real_item (FormatItipPObject *pitip)
-{
- ECalComponent *comp;
- icalcomponent *icalcomp;
- gboolean found = FALSE;
- const char *uid;
-
- e_cal_component_get_uid (pitip->comp, &uid);
-
- found = e_cal_get_object (pitip->current_ecal, uid, NULL, &icalcomp, NULL);
- if (!found)
- return NULL;
-
- comp = e_cal_component_new ();
- if (!e_cal_component_set_icalcomponent (comp, icalcomp)) {
- g_object_unref (comp);
- icalcomponent_free (icalcomp);
- return NULL;
- }
-
- return comp;
-}
-
-static void
-adjust_item (FormatItipPObject *pitip, ECalComponent *comp)
-{
- ECalComponent *real_comp;
-
- real_comp = get_real_item (pitip);
- if (real_comp != NULL) {
- ECalComponentText text;
- const char *string;
- GSList *l;
-
- e_cal_component_get_summary (real_comp, &text);
- e_cal_component_set_summary (comp, &text);
- e_cal_component_get_location (real_comp, &string);
- e_cal_component_set_location (comp, string);
- e_cal_component_get_description_list (real_comp, &l);
- e_cal_component_set_description_list (comp, l);
- e_cal_component_free_text_list (l);
-
- g_object_unref (real_comp);
- } else {
- ECalComponentText text = {_("Unknown"), NULL};
-
- e_cal_component_set_summary (comp, &text);
- }
-}
-
static void
send_item (FormatItipPObject *pitip)
{
@@ -1156,8 +1154,8 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject
g_signal_connect (pitip->view, "response", G_CALLBACK (view_response_cb), pitip);
- /* FIXME Show selector should be handled in the itip view */
- find_server (pitip, pitip->comp, TRUE);
+ /* FIXME Do we always need to search for the server? */
+ find_server (pitip, pitip->comp);
return TRUE;
}