diff options
author | nobody <nobody@localhost> | 2003-04-02 01:15:53 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2003-04-02 01:15:53 +0800 |
commit | 2e5b2bbb530b642dda56b332cfd93810ac415098 (patch) | |
tree | e2b63c11a404a5dd99d407c989c8846fd0d5379d /calendar/gui/e-itip-control.c | |
parent | 5cda225087bfdc66e19edb703689e8af655e171c (diff) | |
download | gsoc2013-evolution-EVOLUTION_1_2_4.tar.gz gsoc2013-evolution-EVOLUTION_1_2_4.tar.zst gsoc2013-evolution-EVOLUTION_1_2_4.zip |
This commit was manufactured by cvs2svn to create tagEVOLUTION_1_2_4
'EVOLUTION_1_2_4'.
svn path=/tags/EVOLUTION_1_2_4/; revision=20614
Diffstat (limited to 'calendar/gui/e-itip-control.c')
-rw-r--r-- | calendar/gui/e-itip-control.c | 482 |
1 files changed, 251 insertions, 231 deletions
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 48eeae1672..ff2d8079e2 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -28,17 +28,17 @@ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> -#include <unistd.h> #include <glib.h> #include <gtk/gtkmisc.h> +#include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <libgnome/gnome-util.h> -#include <libgnomeui/gnome-stock-icons.h> +#include <libgnomeui/gnome-stock.h> #include <libgnomeui/gnome-uidefs.h> #include <libgnomeui/gnome-dialog.h> #include <libgnomeui/gnome-dialog-util.h> -#include <bonobo/bonobo-object.h> #include <bonobo/bonobo-exception.h> +#include <gal/util/e-unicode-i18n.h> #include <gal/widgets/e-unicode.h> #include <gtkhtml/gtkhtml.h> #include <gtkhtml/gtkhtml-stream.h> @@ -47,18 +47,17 @@ #include <cal-util/timeutil.h> #include <cal-client/cal-client.h> #include <e-util/e-time-utils.h> +#include <e-util/e-html-utils.h> #include <e-util/e-dialog-widgets.h> #include <evolution-shell-client.h> #include <evolution-folder-selector-button.h> -#include <camel/camel-mime-filter-tohtml.h> #include "calendar-config.h" #include "itip-utils.h" #include "e-itip-control.h" struct _EItipControlPrivate { GtkWidget *html; - gboolean html_destroyed; - + GPtrArray *event_clients; CalClient *event_client; GPtrArray *task_clients; @@ -77,15 +76,12 @@ struct _EItipControlPrivate { gchar *calendar_uri; - EAccountList *accounts; - + GList *addresses; gchar *from_address; gchar *delegator_address; gchar *delegator_name; gchar *my_address; gboolean view_only; - - gboolean destroyed; }; /* HTML Strings */ @@ -104,8 +100,7 @@ static const char *tasks_types[] = { "tasks", NULL }; static void class_init (EItipControlClass *klass); static void init (EItipControl *itip); -static void destroy (GtkObject *obj); -static void finalize (GObject *obj); +static void finalize (GtkObject *obj); static void url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, gpointer data); static gboolean object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data); @@ -113,21 +108,39 @@ static void ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, static GtkVBoxClass *parent_class = NULL; -E_MAKE_TYPE (e_itip_control, "EItipControl", EItipControl, class_init, init, - GTK_TYPE_VBOX); + +GtkType +e_itip_control_get_type (void) +{ + static GtkType type = 0; + + if (type == 0) { + static const GtkTypeInfo info = + { + "EItipControl", + sizeof (EItipControl), + sizeof (EItipControlClass), + (GtkClassInitFunc) class_init, + (GtkObjectInitFunc) init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + type = gtk_type_unique (gtk_vbox_get_type (), &info); + } + + return type; +} static void class_init (EItipControlClass *klass) { - GObjectClass *object_class; - GtkObjectClass *gtkobject_class; - - object_class = G_OBJECT_CLASS (klass); - gtkobject_class = GTK_OBJECT_CLASS (klass); - - parent_class = g_type_class_peek_parent (klass); + GtkObjectClass *object_class; + + object_class = GTK_OBJECT_CLASS (klass); - gtkobject_class->destroy = destroy; + parent_class = gtk_type_class (gtk_vbox_get_type ()); object_class->finalize = finalize; } @@ -157,28 +170,29 @@ start_calendar_server (EItipControl *itip, char *uri) client = cal_client_new (); - g_signal_connect (client, "cal_opened", G_CALLBACK (start_calendar_server_cb), &success); + gtk_signal_connect (GTK_OBJECT (client), "cal_opened", + start_calendar_server_cb, &success); - if (!cal_client_open_calendar (client, uri, TRUE)) - goto error; + if (!cal_client_open_calendar (client, uri, TRUE)) + goto error; /* run a sub event loop to turn cal-client's async load notification into a synchronous call */ - if (!itip->priv->destroyed) { - gtk_signal_connect (GTK_OBJECT (itip), "destroy", - gtk_main_quit, NULL); - + if (!GTK_OBJECT_DESTROYED (itip)) { + gtk_signal_connect (GTK_OBJECT (itip), "destroy", + gtk_main_quit, NULL); + gtk_main (); + + gtk_signal_disconnect_by_func (GTK_OBJECT (itip), + gtk_main_quit, NULL); + } - gtk_signal_disconnect_by_func (GTK_OBJECT (itip), - gtk_main_quit, NULL); - } - if (success) return client; -error: - g_object_unref (client); + error: + gtk_object_unref (GTK_OBJECT (client)); return NULL; } @@ -191,7 +205,8 @@ start_default_server (EItipControl *itip, gboolean tasks) client = cal_client_new (); - g_signal_connect (client, "cal_opened", G_CALLBACK (start_calendar_server_cb), &success); + gtk_signal_connect (GTK_OBJECT (client), "cal_opened", + start_calendar_server_cb, &success); if (tasks) { if (!cal_client_open_default_tasks (client, FALSE)) @@ -203,7 +218,7 @@ start_default_server (EItipControl *itip, gboolean tasks) /* run a sub event loop to turn cal-client's async load notification into a synchronous call */ - if (!itip->priv->destroyed) { + if (!GTK_OBJECT_DESTROYED (itip)) { gtk_signal_connect (GTK_OBJECT (itip), "destroy", gtk_main_quit, NULL); @@ -217,7 +232,7 @@ start_default_server (EItipControl *itip, gboolean tasks) return client; error: - g_object_unref (client); + gtk_object_unref (GTK_OBJECT (client)); return NULL; } @@ -233,7 +248,7 @@ get_servers (EItipControl *itip, EvolutionShellClient *shell_client, const char servers = g_ptr_array_new (); - g_object_ref (shell_client); + bonobo_object_ref (BONOBO_OBJECT (shell_client)); registry = evolution_shell_client_get_storage_registry_interface (shell_client); CORBA_exception_init (&ev); @@ -266,7 +281,7 @@ get_servers (EItipControl *itip, EvolutionShellClient *shell_client, const char CalClient *client; char *uri; - if (itip->priv->destroyed) + if (GTK_OBJECT_DESTROYED (itip)) continue; if (strcmp (possible_types[k], folder.type)) @@ -285,7 +300,7 @@ get_servers (EItipControl *itip, EvolutionShellClient *shell_client, const char CORBA_free (folder_list); } - g_object_unref (shell_client); + bonobo_object_unref (BONOBO_OBJECT (shell_client)); return servers; } @@ -305,8 +320,8 @@ find_server (GPtrArray *servers, CalComponent *comp) client = g_ptr_array_index (servers, i); status = cal_client_get_object (client, uid, &found_comp); if (status == CAL_CLIENT_GET_SUCCESS) { - g_object_unref (found_comp); - g_object_ref (client); + gtk_object_unref (GTK_OBJECT (found_comp)); + gtk_object_ref (GTK_OBJECT (client)); return client; } @@ -316,17 +331,6 @@ find_server (GPtrArray *servers, CalComponent *comp) } static void -html_destroyed (gpointer data) -{ - EItipControl *itip = data; - EItipControlPrivate *priv; - - priv = itip->priv; - - priv->html_destroyed = TRUE; -} - -static void init (EItipControl *itip) { EItipControlPrivate *priv; @@ -337,7 +341,7 @@ init (EItipControl *itip) itip->priv = priv; /* Addresses */ - priv->accounts = itip_addresses_get (); + priv->addresses = itip_addresses_get (); /* Initialize the cal clients */ priv->event_clients = NULL; @@ -355,7 +359,6 @@ init (EItipControl *itip) /* Html Widget */ priv->html = gtk_html_new (); - priv->html_destroyed = FALSE; gtk_html_set_default_content_type (GTK_HTML (priv->html), "text/html; charset=utf-8"); gtk_html_load_from_string (GTK_HTML (priv->html), " ", 1); @@ -368,15 +371,18 @@ init (EItipControl *itip) gtk_widget_show (scrolled_window); gtk_container_add (GTK_CONTAINER (scrolled_window), priv->html); - gtk_object_weakref (GTK_OBJECT (priv->html), html_destroyed, itip); + gtk_object_ref (GTK_OBJECT (priv->html)); gtk_widget_set_usize (scrolled_window, 600, 400); gtk_box_pack_start (GTK_BOX (itip), scrolled_window, FALSE, FALSE, 4); - g_signal_connect (priv->html, "url_requested", G_CALLBACK (url_requested_cb), itip); - g_signal_connect (priv->html, "object_requested", G_CALLBACK (object_requested_cb), itip); - g_signal_connect (priv->html, "submit", G_CALLBACK (ok_clicked_cb), itip); + gtk_signal_connect (GTK_OBJECT (priv->html), "url_requested", + url_requested_cb, itip); + gtk_signal_connect (GTK_OBJECT (priv->html), "object_requested", + GTK_SIGNAL_FUNC (object_requested_cb), + itip); + gtk_signal_connect (GTK_OBJECT (priv->html), "submit", + ok_clicked_cb, itip); - priv->destroyed = FALSE; } static void @@ -385,26 +391,18 @@ clean_up (EItipControl *itip) EItipControlPrivate *priv; priv = itip->priv; - if (!priv) - return; g_free (priv->vcalendar); priv->vcalendar = NULL; - if (priv->comp) { - g_object_unref (priv->comp); - priv->comp = NULL; - } - - if (priv->top_level) { - icalcomponent_free (priv->top_level); - priv->top_level = NULL; - } + if (priv->comp) + gtk_object_unref (GTK_OBJECT (priv->comp)); + priv->comp = NULL; - if (priv->main_comp) { - icalcomponent_free (priv->main_comp); - priv->main_comp = NULL; - } + icalcomponent_free (priv->top_level); + priv->top_level = NULL; + icalcomponent_free (priv->main_comp); + priv->main_comp = NULL; priv->ical_comp = NULL; priv->current = 0; @@ -424,18 +422,7 @@ clean_up (EItipControl *itip) } static void -destroy (GtkObject *obj) -{ - EItipControl *itip = E_ITIP_CONTROL (obj); - EItipControlPrivate *priv; - - priv = itip->priv; - - priv->destroyed = TRUE; -} - -static void -finalize (GObject *obj) +finalize (GtkObject *obj) { EItipControl *itip = E_ITIP_CONTROL (obj); EItipControlPrivate *priv; @@ -445,38 +432,34 @@ finalize (GObject *obj) clean_up (itip); - if (priv->html) - gtk_object_weakunref (GTK_OBJECT (priv->html), html_destroyed, itip); - - priv->accounts = NULL; + if (priv->html) + gtk_object_unref (GTK_OBJECT (priv->html)); + itip_addresses_free (priv->addresses); + priv->addresses = NULL; + if (priv->event_clients) { - for (i = 0; i < priv->event_clients->len; i++) - g_object_unref (g_ptr_array_index (priv->event_clients, i)); + for (i = 0; i < priv->event_clients->len; i++) + gtk_object_unref (GTK_OBJECT (g_ptr_array_index (priv->event_clients, i))); g_ptr_array_free (priv->event_clients, TRUE); - priv->event_client = NULL; - priv->event_clients = NULL; } - if (priv->task_clients) { - for (i = 0; i < priv->task_clients->len; i++) - g_object_unref (g_ptr_array_index (priv->task_clients, i)); + for (i = 0; i < priv->task_clients->len; i++) + gtk_object_unref (GTK_OBJECT (g_ptr_array_index (priv->task_clients, i))); g_ptr_array_free (priv->task_clients, TRUE); - priv->task_client = NULL; - priv->task_clients = NULL; } g_free (priv); itip->priv = NULL; - - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (obj); + + if (GTK_OBJECT_CLASS (parent_class)->finalize) + (* GTK_OBJECT_CLASS (parent_class)->finalize) (obj); } GtkWidget * e_itip_control_new (void) { - return g_object_new (E_TYPE_ITIP_CONTROL, NULL); + return gtk_type_new (E_TYPE_ITIP_CONTROL); } static void @@ -503,7 +486,7 @@ find_my_address (EItipControl *itip, icalcomponent *ical_comp) icalparameter *param; const char *attendee, *name; char *attendee_clean, *name_clean; - EIterator *it; + GList *l; value = icalproperty_get_value (prop); if (value != NULL) { @@ -524,32 +507,26 @@ find_my_address (EItipControl *itip, icalcomponent *ical_comp) name = NULL; name_clean = NULL; } - - it = e_list_get_iterator((EList *)priv->accounts); - while (e_iterator_is_valid(it)) { - const EAccount *account = e_iterator_get(it); - + + for (l = priv->addresses; l != NULL; l = l->next) { + ItipAddress *a = l->data; + /* Check for a matching address */ if (attendee_clean != NULL - && !g_ascii_strcasecmp (account->id->address, attendee_clean)) { - priv->my_address = g_strdup (account->id->address); + && !g_strcasecmp (a->address, attendee_clean)) { + priv->my_address = g_strdup (a->address); g_free (attendee_clean); g_free (name_clean); - g_free (my_alt_address); - g_object_unref(it); return; } /* Check for a matching cname to fall back on */ if (name_clean != NULL - && !g_ascii_strcasecmp (account->id->name, name_clean)) + && !g_strcasecmp (a->name, name_clean)) my_alt_address = g_strdup (attendee_clean); - - e_iterator_next(it); } g_free (attendee_clean); g_free (name_clean); - g_object_unref(it); } priv->my_address = my_alt_address; @@ -624,7 +601,7 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt, FALSE, FALSE, time_buf, sizeof (time_buf)); - time_utf8 = g_locale_to_utf8 (time_buf, -1, NULL, NULL, NULL); + time_utf8 = e_utf8_from_locale_string (time_buf); strcat (buffer, time_utf8); g_free (time_utf8); @@ -641,9 +618,12 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt, strcat (buffer, " <font size=-1>["); /* We check if it is one of our builtin timezone names, - in which case we call gettext to translate it. */ + in which case we call gettext to translate it, and + we need to convert to UTF-8. If it isn't a builtin + timezone name, we use it as-is, as it is already + UTF-8. */ if (icaltimezone_get_builtin_timezone (display_name)) { - strcat (buffer, _(display_name)); + strcat (buffer, U_(display_name)); } else { strcat (buffer, display_name); } @@ -655,15 +635,52 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt, strcat (buffer, etext); } +/* copied from recurrence-page.c, so it should be pre-translated */ +static const char *date_suffix[] = { + N_("st"), + N_("nd"), + N_("rd"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("st"), + N_("nd"), + N_("rd"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("th"), + N_("st") +}; + static const char * nth (int n) { + static char buffer[10]; + if (n == -1) return "last"; - else if (n < 1 || n > 31) + if (n < 1 || n >= (sizeof (date_suffix) / sizeof (const char *))) return "?"; - else - return cal_recur_nth[n]; + sprintf (buffer, "%d%s", n, date_suffix[n - 1]); + return buffer; } static const char *dayname[] = { @@ -818,7 +835,7 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream, cal_component_get_dtstart (comp, &datetime); if (datetime.value) { write_label_piece (itip, &datetime, buffer, 1024, - _("<b>Starts:</b> "), + U_("<b>Starts:</b> "), "<br>", FALSE); gtk_html_write (html, html_stream, buffer, strlen(buffer)); wrote = TRUE; @@ -828,7 +845,7 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream, buffer[0] = '\0'; cal_component_get_dtend (comp, &datetime); if (datetime.value){ - write_label_piece (itip, &datetime, buffer, 1024, _("<b>Ends:</b> "), "<br>", FALSE); + write_label_piece (itip, &datetime, buffer, 1024, U_("<b>Ends:</b> "), "<br>", FALSE); gtk_html_write (html, html_stream, buffer, strlen (buffer)); wrote = TRUE; } @@ -848,7 +865,7 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream, /* Pass TRUE as is_utc, so it gets converted to the current timezone. */ datetime.value->is_utc = TRUE; - write_label_piece (itip, &datetime, buffer, 1024, _("<b>Completed:</b> "), "<br>", FALSE); + write_label_piece (itip, &datetime, buffer, 1024, U_("<b>Completed:</b> "), "<br>", FALSE); gtk_html_write (html, html_stream, buffer, strlen (buffer)); wrote = TRUE; task_completed = TRUE; @@ -858,7 +875,7 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream, buffer[0] = '\0'; cal_component_get_due (comp, &datetime); if (type == CAL_COMPONENT_TODO && !task_completed && datetime.value) { - write_label_piece (itip, &datetime, buffer, 1024, _("<b>Due:</b> "), "<br>", FALSE); + write_label_piece (itip, &datetime, buffer, 1024, U_("<b>Due:</b> "), "<br>", FALSE); gtk_html_write (html, html_stream, buffer, strlen (buffer)); wrote = TRUE; } @@ -895,7 +912,7 @@ write_error_html (EItipControl *itip, const gchar *itip_err) html_stream = gtk_html_begin (GTK_HTML (priv->html)); gtk_html_stream_printf (html_stream, "<html><head><title>%s</title></head>", - _("iCalendar Information")); + U_("iCalendar Information")); gtk_html_write (GTK_HTML (priv->html), html_stream, HTML_BODY_START, strlen(HTML_BODY_START)); @@ -910,7 +927,7 @@ write_error_html (EItipControl *itip, const gchar *itip_err) gtk_html_stream_printf (html_stream, "<td align=\"left\" valign=\"top\">"); /* Title */ - set_message (GTK_HTML (priv->html), html_stream, _("iCalendar Error"), TRUE); + set_message (GTK_HTML (priv->html), html_stream, U_("iCalendar Error"), TRUE); /* Error */ gtk_html_write (GTK_HTML (priv->html), html_stream, itip_err, strlen(itip_err)); @@ -941,14 +958,14 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, priv = itip->priv; - if (priv->html_destroyed) + if (GTK_OBJECT_DESTROYED (priv->html)) return; /* Html widget */ html_stream = gtk_html_begin (GTK_HTML (priv->html)); gtk_html_stream_printf (html_stream, "<html><head><title>%s</title></head>", - _("iCalendar Information")); + U_("iCalendar Information")); gtk_html_write (GTK_HTML (priv->html), html_stream, HTML_BODY_START, strlen(HTML_BODY_START)); @@ -979,7 +996,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, attendee->cn : itip_strip_mailto (attendee->value)); } else { - html = g_strdup_printf (itip_desc, _("An unknown person")); + html = g_strdup_printf (itip_desc, U_("An unknown person")); } break; case ICAL_METHOD_REQUEST: @@ -995,7 +1012,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, priv->delegator_name : priv->delegator_address); else - html = g_strdup_printf (itip_desc, _("An unknown person"), + html = g_strdup_printf (itip_desc, U_("An unknown person"), priv->delegator_name ? priv->delegator_name : priv->delegator_address); @@ -1006,7 +1023,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, organizer.cn : itip_strip_mailto (organizer.value)); else - html = g_strdup_printf (itip_desc, _("An unknown person")); + html = g_strdup_printf (itip_desc, U_("An unknown person")); } break; @@ -1023,14 +1040,14 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, organizer.cn : itip_strip_mailto (organizer.value)); else - html = g_strdup_printf (itip_desc, _("An unknown person")); + html = g_strdup_printf (itip_desc, U_("An unknown person")); break; } gtk_html_write (GTK_HTML (priv->html), html_stream, html, strlen(html)); g_free (html); /* Describe what the user can do */ - const_html = _("<br> Please review the following information, " + const_html = U_("<br> Please review the following information, " "and then select an action from the menu below."); gtk_html_write (GTK_HTML (priv->html), html_stream, const_html, strlen(const_html)); @@ -1045,17 +1062,17 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, /* Summary */ cal_component_get_summary (priv->comp, &text); - html = text.value ? camel_text_to_html (text.value, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0) : _("<i>None</i>"); + html = e_text_to_html (text.value ? text.value : U_("<i>None</i>"), E_TEXT_TO_HTML_CONVERT_NL); gtk_html_stream_printf (html_stream, "<b>%s</b><br>%s<br><br>", - _("Summary:"), html); + U_("Summary:"), html); g_free (html); /* Location */ cal_component_get_location (priv->comp, &string); if (string != NULL) { - html = camel_text_to_html (string, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0); + html = e_text_to_html (string, E_TEXT_TO_HTML_CONVERT_NL); gtk_html_stream_printf (html_stream, "<b>%s</b><br>%s<br><br>", - _("Location:"), html); + U_("Location:"), html); g_free (html); } @@ -1069,24 +1086,24 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, CalComponentAttendee *a = alist->data; gtk_html_stream_printf (html_stream, "<b>%s</b><br>", - _("Status:")); + U_("Status:")); switch (a->status) { case ICAL_PARTSTAT_ACCEPTED: gtk_html_stream_printf (html_stream, "%s<br><br>", - _("Accepted")); + U_("Accepted")); break; case ICAL_PARTSTAT_TENTATIVE: gtk_html_stream_printf (html_stream, "%s<br><br>", - _("Tentatively Accepted")); + U_("Tentatively Accepted")); break; case ICAL_PARTSTAT_DECLINED: gtk_html_stream_printf (html_stream, "%s<br><br>", - _("Declined")); + U_("Declined")); break; default: gtk_html_stream_printf (html_stream, "%s<br><br>", - _("Unknown")); + U_("Unknown")); } } @@ -1099,9 +1116,9 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title, text = *((CalComponentText *)l->data); if (l && text.value) { - html = camel_text_to_html (text.value, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0); + html = e_text_to_html (text.value, E_TEXT_TO_HTML_CONVERT_NL); gtk_html_stream_printf (html_stream, "<b>%s</b><br>%s", - _("Description:"), html); + U_("Description:"), html); g_free (html); } cal_component_free_text_list (l); @@ -1141,9 +1158,9 @@ get_publish_options (gboolean selector) "</select>    " "<input TYPE=Submit name=\"ok\" value=\"%s\">" "</form>", - _("Choose an action:"), - _("Update"), - _("OK")); + U_("Choose an action:"), + U_("Update"), + U_("OK")); if (selector) { char *sel; @@ -1169,12 +1186,12 @@ get_request_options (gboolean selector) "<input TYPE=\"checkbox\" name=\"rsvp\" value=\"1\" checked>%s  " "<input TYPE=\"submit\" name=\"ok\" value=\"%s\"><br> " "</form>", - _("Choose an action:"), - _("Accept"), - _("Tentatively accept"), - _("Decline"), - _("RSVP"), - _("OK")); + U_("Choose an action:"), + U_("Accept"), + U_("Tentatively accept"), + U_("Decline"), + U_("RSVP"), + U_("OK")); if (selector) { char *sel; @@ -1195,9 +1212,9 @@ get_request_fb_options () "<option VALUE=\"F\">%s</option></select>    " "<input TYPE=Submit name=\"ok\" value=\"%s\">" "</form>", - _("Choose an action:"), - _("Send Free/Busy Information"), - _("OK")); + U_("Choose an action:"), + U_("Send Free/Busy Information"), + U_("OK")); } static char* @@ -1208,9 +1225,9 @@ get_reply_options () "<option VALUE=\"R\">%s</option></select>    " "<input TYPE=Submit name=\"ok\" value=\"%s\">" "</form>", - _("Choose an action:"), - _("Update respondent status"), - _("OK")); + U_("Choose an action:"), + U_("Update respondent status"), + U_("OK")); } static char* @@ -1221,9 +1238,9 @@ get_refresh_options () "<option VALUE=\"S\">%s</option></select>    " "<input TYPE=Submit name=\"ok\" value=\"%s\">" "</form>", - _("Choose an action:"), - _("Send Latest Information"), - _("OK")); + U_("Choose an action:"), + U_("Send Latest Information"), + U_("OK")); } static char* @@ -1234,9 +1251,9 @@ get_cancel_options () "<option VALUE=\"C\">%s</option></select>    " "<input TYPE=Submit name=\"ok\" value=\"%s\">" "</form>", - _("Choose an action:"), - _("Cancel"), - _("OK")); + U_("Choose an action:"), + U_("Cancel"), + U_("OK")); } @@ -1292,7 +1309,7 @@ adjust_item (EItipControl *itip, CalComponent *comp) cal_component_set_description_list (comp, l); cal_component_free_text_list (l); - g_object_unref (real_comp); + gtk_object_unref (GTK_OBJECT (real_comp)); } else { CalComponentText text = {_("Unknown"), NULL}; @@ -1316,50 +1333,50 @@ show_current_event (EItipControl *itip) switch (priv->method) { case ICAL_METHOD_PUBLISH: - itip_desc = _("<b>%s</b> has published meeting information."); - itip_title = _("Meeting Information"); + itip_desc = U_("<b>%s</b> has published meeting information."); + itip_title = U_("Meeting Information"); options = get_publish_options (priv->event_client ? FALSE : TRUE); break; case ICAL_METHOD_REQUEST: if (priv->delegator_address != NULL) - itip_desc = _("<b>%s</b> requests the presence of %s at a meeting."); + itip_desc = U_("<b>%s</b> requests the presence of %s at a meeting."); else - itip_desc = _("<b>%s</b> requests your presence at a meeting."); - itip_title = _("Meeting Proposal"); + itip_desc = U_("<b>%s</b> requests your presence at a meeting."); + itip_title = U_("Meeting Proposal"); options = get_request_options (priv->event_client ? FALSE : TRUE); break; case ICAL_METHOD_ADD: - itip_desc = _("<b>%s</b> wishes to add to an existing meeting."); - itip_title = _("Meeting Update"); + itip_desc = U_("<b>%s</b> wishes to add to an existing meeting."); + itip_title = U_("Meeting Update"); options = get_publish_options (priv->event_client ? FALSE : TRUE); break; case ICAL_METHOD_REFRESH: - itip_desc = _("<b>%s</b> wishes to receive the latest meeting information."); - itip_title = _("Meeting Update Request"); + itip_desc = U_("<b>%s</b> wishes to receive the latest meeting information."); + itip_title = U_("Meeting Update Request"); options = get_refresh_options (); /* Provide extra info, since its not in the component */ adjust_item (itip, priv->comp); break; case ICAL_METHOD_REPLY: - itip_desc = _("<b>%s</b> has replied to a meeting request."); - itip_title = _("Meeting Reply"); + itip_desc = U_("<b>%s</b> has replied to a meeting request."); + itip_title = U_("Meeting Reply"); options = get_reply_options (); /* Provide extra info, since might not be in the component */ adjust_item (itip, priv->comp); break; case ICAL_METHOD_CANCEL: - itip_desc = _("<b>%s</b> has cancelled a meeting."); - itip_title = _("Meeting Cancellation"); + itip_desc = U_("<b>%s</b> has cancelled a meeting."); + itip_title = U_("Meeting Cancellation"); options = get_cancel_options (); /* Provide extra info, since might not be in the component */ adjust_item (itip, priv->comp); break; default: - itip_desc = _("<b>%s</b> has sent an unintelligible message."); - itip_title = _("Bad Meeting Message"); + itip_desc = U_("<b>%s</b> has sent an unintelligible message."); + itip_title = U_("Bad Meeting Message"); options = NULL; } @@ -1383,50 +1400,50 @@ show_current_todo (EItipControl *itip) switch (priv->method) { case ICAL_METHOD_PUBLISH: - itip_desc = _("<b>%s</b> has published task information."); - itip_title = _("Task Information"); + itip_desc = U_("<b>%s</b> has published task information."); + itip_title = U_("Task Information"); options = get_publish_options (priv->task_client ? FALSE : TRUE); break; case ICAL_METHOD_REQUEST: if (priv->delegator_address != NULL) - itip_desc = _("<b>%s</b> requests %s to perform a task."); + itip_desc = U_("<b>%s</b> requests %s to perform a task."); else - itip_desc = _("<b>%s</b> requests you perform a task."); - itip_title = _("Task Proposal"); + itip_desc = U_("<b>%s</b> requests you perform a task."); + itip_title = U_("Task Proposal"); options = get_request_options (priv->task_client ? FALSE : TRUE); break; case ICAL_METHOD_ADD: - itip_desc = _("<b>%s</b> wishes to add to an existing task."); - itip_title = _("Task Update"); + itip_desc = U_("<b>%s</b> wishes to add to an existing task."); + itip_title = U_("Task Update"); options = get_publish_options (priv->task_client ? FALSE : TRUE); break; case ICAL_METHOD_REFRESH: - itip_desc = _("<b>%s</b> wishes to receive the latest task information."); - itip_title = _("Task Update Request"); + itip_desc = U_("<b>%s</b> wishes to receive the latest task information."); + itip_title = U_("Task Update Request"); options = get_refresh_options (); /* Provide extra info, since its not in the component */ adjust_item (itip, priv->comp); break; case ICAL_METHOD_REPLY: - itip_desc = _("<b>%s</b> has replied to a task assignment."); - itip_title = _("Task Reply"); + itip_desc = U_("<b>%s</b> has replied to a task assignment."); + itip_title = U_("Task Reply"); options = get_reply_options (); /* Provide extra info, since might not be in the component */ adjust_item (itip, priv->comp); break; case ICAL_METHOD_CANCEL: - itip_desc = _("<b>%s</b> has cancelled a task."); - itip_title = _("Task Cancellation"); + itip_desc = U_("<b>%s</b> has cancelled a task."); + itip_title = U_("Task Cancellation"); options = get_cancel_options (); /* Provide extra info, since might not be in the component */ adjust_item (itip, priv->comp); break; default: - itip_desc = _("<b>%s</b> has sent an unintelligible message."); - itip_title = _("Bad Task Message"); + itip_desc = U_("<b>%s</b> has sent an unintelligible message."); + itip_title = U_("Bad Task Message"); options = NULL; } @@ -1445,23 +1462,23 @@ show_current_freebusy (EItipControl *itip) switch (priv->method) { case ICAL_METHOD_PUBLISH: - itip_desc = _("<b>%s</b> has published free/busy information."); - itip_title = _("Free/Busy Information"); + itip_desc = U_("<b>%s</b> has published free/busy information."); + itip_title = U_("Free/Busy Information"); options = NULL; break; case ICAL_METHOD_REQUEST: - itip_desc = _("<b>%s</b> requests your free/busy information."); - itip_title = _("Free/Busy Request"); + itip_desc = U_("<b>%s</b> requests your free/busy information."); + itip_title = U_("Free/Busy Request"); options = get_request_fb_options (); break; case ICAL_METHOD_REPLY: - itip_desc = _("<b>%s</b> has replied to a free/busy request."); - itip_title = _("Free/Busy Reply"); + itip_desc = U_("<b>%s</b> has replied to a free/busy request."); + itip_title = U_("Free/Busy Reply"); options = NULL; break; default: - itip_desc = _("<b>%s</b> has sent an unintelligible message."); - itip_title = _("Bad Free/Busy Message"); + itip_desc = U_("<b>%s</b> has sent an unintelligible message."); + itip_title = U_("Bad Free/Busy Message"); options = NULL; } @@ -1498,15 +1515,15 @@ show_current (EItipControl *itip) priv = itip->priv; - g_object_ref (itip); + gtk_object_ref (GTK_OBJECT (itip)); if (priv->comp) - g_object_unref (priv->comp); + gtk_object_unref (GTK_OBJECT (priv->comp)); if (priv->event_client != NULL) - g_object_unref (priv->event_client); + gtk_object_unref (GTK_OBJECT (priv->event_client)); priv->event_client = NULL; if (priv->task_client != NULL) - g_object_unref (priv->task_client); + gtk_object_unref (GTK_OBJECT (priv->task_client)); priv->task_client = NULL; /* Determine any delegate sections */ @@ -1537,10 +1554,10 @@ show_current (EItipControl *itip) priv->comp = cal_component_new (); if (!cal_component_set_icalcomponent (priv->comp, priv->ical_comp)) { - write_error_html (itip, _("The message does not appear to be properly formed")); - g_object_unref (priv->comp); + write_error_html (itip, U_("The message does not appear to be properly formed")); + gtk_object_unref (GTK_OBJECT (priv->comp)); priv->comp = NULL; - g_object_unref (itip); + gtk_object_unref (GTK_OBJECT (itip)); return; }; @@ -1600,12 +1617,12 @@ show_current (EItipControl *itip) show_current_freebusy (itip); break; default: - write_error_html (itip, _("The message contains only unsupported requests.")); + write_error_html (itip, U_("The message contains only unsupported requests.")); } find_my_address (itip, priv->ical_comp); - g_object_unref (itip); + gtk_object_unref (GTK_OBJECT (itip)); } void @@ -1631,13 +1648,13 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text) priv->main_comp = icalparser_parse_string (priv->vcalendar); if (priv->main_comp == NULL) { - write_error_html (itip, _("The attachment does not contain a valid calendar message")); + write_error_html (itip, U_("The attachment does not contain a valid calendar message")); return; } prop = icalcomponent_get_first_property (priv->main_comp, ICAL_METHOD_PROPERTY); if (prop == NULL) { - write_error_html (itip, _("The attachment does not contain a valid calendar message")); + write_error_html (itip, U_("The attachment does not contain a valid calendar message")); return; } @@ -1662,7 +1679,7 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text) priv->ical_comp = get_next (&priv->iter); if (priv->ical_comp == NULL) { - write_error_html (itip, _("The attachment has no viewable calendar items")); + write_error_html (itip, U_("The attachment has no viewable calendar items")); return; } @@ -1841,14 +1858,14 @@ change_status (icalcomponent *ical_comp, const char *address, icalparameter_part param = icalparameter_new_partstat (status); icalproperty_add_parameter (prop, param); } else { - EAccount *a; + ItipAddress *a; a = itip_addresses_get_default (); - prop = icalproperty_new_attendee (a->id->address); + prop = icalproperty_new_attendee (a->address); icalcomponent_add_property (ical_comp, prop); - param = icalparameter_new_cn (a->id->name); + param = icalparameter_new_cn (a->name); icalproperty_add_parameter (prop, param); param = icalparameter_new_role (ICAL_ROLE_REQPARTICIPANT); @@ -1856,6 +1873,8 @@ change_status (icalcomponent *ical_comp, const char *address, icalparameter_part param = icalparameter_new_partstat (status); icalproperty_add_parameter (prop, param); + + itip_address_free (a); } } @@ -2019,7 +2038,7 @@ update_attendee_status (EItipControl *itip) cleanup: if (comp != NULL) - g_object_unref (comp); + gtk_object_unref (GTK_OBJECT (comp)); gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); } @@ -2074,7 +2093,7 @@ send_item (EItipControl *itip) default: itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, NULL, NULL); } - g_object_unref (comp); + gtk_object_unref (GTK_OBJECT (comp)); dialog = gnome_ok_dialog (_("Item sent!\n")); } else { dialog = gnome_warning_dialog (_("The item could not be sent!\n")); @@ -2123,7 +2142,7 @@ send_freebusy (EItipControl *itip) CalComponent *comp = CAL_COMPONENT (l->data); itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp, priv->event_client, NULL); - g_object_unref (comp); + gtk_object_unref (GTK_OBJECT (comp)); } dialog = gnome_ok_dialog (_("Item sent!\n")); @@ -2150,7 +2169,7 @@ button_selected_cb (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folde else uri = cal_util_expand_uri (folder->physicalUri, FALSE); - g_object_unref (priv->event_client); + gtk_object_unref (GTK_OBJECT (priv->event_client)); priv->event_client = start_calendar_server (itip, uri); g_free (uri); @@ -2162,7 +2181,7 @@ url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, gpoint int len, fd; char *path; - path = g_strdup_printf ("%s/%s", EVOLUTION_IMAGESDIR, url); + path = g_strdup_printf ("%s/%s", EVOLUTION_ICONSDIR, url); if ((fd = open (path, O_RDONLY)) == -1) { g_warning ("%s", g_strerror (errno)); @@ -2218,7 +2237,8 @@ object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data) button = NULL; } - g_signal_connect (button, "selected", G_CALLBACK (button_selected_cb), itip); + gtk_signal_connect (GTK_OBJECT (button), "selected", + button_selected_cb, itip); gtk_container_add (GTK_CONTAINER (eb), button); gtk_widget_show (button); @@ -2358,6 +2378,6 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar default: itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp, NULL, NULL); } - g_object_unref (comp); + gtk_object_unref (GTK_OBJECT (comp)); } } |