From fad4af8a3d4c6f50f7bcceca8d545eb17d6fd056 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 May 2009 11:13:25 -0400 Subject: Prefer GLib basic types over C types. --- mail/em-format-html-display.c | 120 +++++++++++++++++++++--------------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'mail/em-format-html-display.c') diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index 8d25923658..044ffe598a 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -98,9 +98,9 @@ struct _EMFormatHTMLDisplayPrivate { GtkWidget *attachment_view; /* weak reference */ }; -static int efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efh); -static void efhd_html_link_clicked (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd); -static void efhd_html_on_url (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd); +static gint efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efh); +static void efhd_html_link_clicked (GtkHTML *html, const gchar *url, EMFormatHTMLDisplay *efhd); +static void efhd_html_on_url (GtkHTML *html, const gchar *url, EMFormatHTMLDisplay *efhd); static void efhd_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri); static gboolean efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject); @@ -111,14 +111,14 @@ struct _attach_puri { const EMFormatHandler *handle; - const char *snoop_mime_type; + const gchar *snoop_mime_type; /* for the > and V buttons */ GtkWidget *forward, *down; /* currently no way to correlate this data to the frame :( */ GtkHTML *frame; CamelStream *output; - unsigned int shown:1; + guint shown:1; /* Embedded Frame */ GtkHTMLEmbedded *html; @@ -127,8 +127,8 @@ struct _attach_puri { EAttachment *attachment; /* image stuff */ - int fit_width; - int fit_height; + gint fit_width; + gint fit_height; GtkImage *image; GtkWidget *event_box; @@ -142,16 +142,16 @@ struct _attach_puri { static void efhd_iframe_created(GtkHTML *html, GtkHTML *iframe, EMFormatHTMLDisplay *efh); -/*static void efhd_url_requested(GtkHTML *html, const char *url, GtkHTMLStream *handle, EMFormatHTMLDisplay *efh); +/*static void efhd_url_requested(GtkHTML *html, const gchar *url, GtkHTMLStream *handle, EMFormatHTMLDisplay *efh); static gboolean efhd_object_requested(GtkHTML *html, GtkHTMLEmbedded *eb, EMFormatHTMLDisplay *efh);*/ static void efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info); -static const EMFormatHandler *efhd_find_handler(EMFormat *emf, const char *mime_type); -static void efhd_format_clone(EMFormat *, CamelFolder *folder, const char *, CamelMimeMessage *msg, EMFormat *); -static void efhd_format_error(EMFormat *emf, CamelStream *stream, const char *txt); +static const EMFormatHandler *efhd_find_handler(EMFormat *emf, const gchar *mime_type); +static void efhd_format_clone(EMFormat *, CamelFolder *folder, const gchar *, CamelMimeMessage *msg, EMFormat *); +static void efhd_format_error(EMFormat *emf, CamelStream *stream, const gchar *txt); static void efhd_format_source(EMFormat *, CamelStream *, CamelMimePart *); -static void efhd_format_attachment(EMFormat *, CamelStream *, CamelMimePart *, const char *, const EMFormatHandler *); +static void efhd_format_attachment(EMFormat *, CamelStream *, CamelMimePart *, const gchar *, const EMFormatHandler *); static void efhd_format_optional(EMFormat *, CamelStream *, CamelMimePart *, CamelStream *); static void efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid); @@ -181,7 +181,7 @@ efhd_gtkhtml_realise(GtkHTML *html, EMFormatHTMLDisplay *efhd) when we are printing. */ style = gtk_widget_get_style((GtkWidget *)html); if (style) { - int state = GTK_WIDGET_STATE(html); + gint state = GTK_WIDGET_STATE(html); gushort r, g, b; r = style->fg[state].red >> 8; @@ -254,7 +254,7 @@ efhd_finalise(GObject *o) } static gboolean -efhd_bool_accumulator(GSignalInvocationHint *ihint, GValue *out, const GValue *in, void *data) +efhd_bool_accumulator(GSignalInvocationHint *ihint, GValue *out, const GValue *in, gpointer data) { gboolean val = g_value_get_boolean(in); @@ -364,7 +364,7 @@ EMFormatHTMLDisplay *em_format_html_display_new(void) return efhd; } -void em_format_html_display_goto_anchor(EMFormatHTMLDisplay *efhd, const char *name) +void em_format_html_display_goto_anchor(EMFormatHTMLDisplay *efhd, const gchar *name) { printf("FIXME: go to anchor '%s'\n", name); } @@ -430,9 +430,9 @@ efhd_iframe_created(GtkHTML *html, GtkHTML *iframe, EMFormatHTMLDisplay *efh) } static void -efhd_get_uri_puri (GtkWidget *html, GdkEventButton *event, EMFormatHTMLDisplay *efhd, char **uri, EMFormatPURI **puri) +efhd_get_uri_puri (GtkWidget *html, GdkEventButton *event, EMFormatHTMLDisplay *efhd, gchar **uri, EMFormatPURI **puri) { - char *url, *img_url; + gchar *url, *img_url; g_return_if_fail (html != NULL); g_return_if_fail (GTK_IS_HTML (html)); @@ -448,7 +448,7 @@ efhd_get_uri_puri (GtkWidget *html, GdkEventButton *event, EMFormatHTMLDisplay * if (img_url) { if (!(strstr (img_url, "://") || g_ascii_strncasecmp (img_url, "cid:", 4) == 0)) { - char *u = g_filename_to_uri (img_url, NULL, NULL); + gchar *u = g_filename_to_uri (img_url, NULL, NULL); g_free (img_url); img_url = u; } @@ -484,7 +484,7 @@ efhd_get_uri_puri (GtkWidget *html, GdkEventButton *event, EMFormatHTMLDisplay * static int efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efhd) { - char *uri = NULL; + gchar *uri = NULL; EMFormatPURI *puri = NULL; gboolean res = FALSE; @@ -511,7 +511,7 @@ gboolean em_format_html_display_popup_menu (EMFormatHTMLDisplay *efhd) { GtkHTML *html; - char *uri = NULL; + gchar *uri = NULL; EMFormatPURI *puri = NULL; gboolean res = FALSE; @@ -527,7 +527,7 @@ em_format_html_display_popup_menu (EMFormatHTMLDisplay *efhd) } static void -efhd_html_link_clicked (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd) +efhd_html_link_clicked (GtkHTML *html, const gchar *url, EMFormatHTMLDisplay *efhd) { d(printf("link clicked event '%s'\n", url)); if (url && !strncmp(url, "##", 2)) { @@ -553,7 +553,7 @@ efhd_html_link_clicked (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efh } static void -efhd_html_on_url (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd) +efhd_html_on_url (GtkHTML *html, const gchar *url, EMFormatHTMLDisplay *efhd) { d(printf("on_url event '%s'\n", url)); @@ -565,7 +565,7 @@ efhd_html_on_url (GtkHTML *html, const char *url, EMFormatHTMLDisplay *efhd) /* TODO: move the dialogue elsehwere */ /* FIXME: also in em-format-html.c */ static const struct { - const char *icon, *shortdesc, *description; + const gchar *icon, *shortdesc, *description; } smime_sign_table[5] = { { "stock_signature-bad", N_("Unsigned"), N_("This message is not signed. There is no guarantee that this message is authentic.") }, { "stock_signature-ok", N_("Valid signature"), N_("This message is signed and is valid meaning that it is very likely that this message is authentic.") }, @@ -576,7 +576,7 @@ static const struct { }; static const struct { - const char *icon, *shortdesc, *description; + const gchar *icon, *shortdesc, *description; } smime_encrypt_table[4] = { { "stock_lock-broken", N_("Unencrypted"), N_("This message is not encrypted. Its content may be viewed in transit across the Internet.") }, { "stock_lock-ok", N_("Encrypted, weak"), N_("This message is encrypted, but with a weak encryption algorithm. It would be difficult, but not impossible for an outsider to view the content of this message in a practical amount of time.") }, @@ -584,14 +584,14 @@ static const struct { { "stock_lock-ok", N_("Encrypted, strong"), N_("This message is encrypted, with a strong encryption algorithm. It would be very difficult for an outsider to view the content of this message in a practical amount of time.") }, }; -static const char *smime_sign_colour[5] = { +static const gchar *smime_sign_colour[5] = { "", " bgcolor=\"#88bb88\"", " bgcolor=\"#bb8888\"", " bgcolor=\"#e8d122\"","" }; struct _smime_pobject { EMFormatHTMLPObject object; - int signature; + gint signature; CamelCipherValidity *valid; GtkWidget *widget; }; @@ -655,11 +655,11 @@ efhd_xpkcs7mime_add_cert_table(GtkWidget *vbox, CamelDList *certlist, struct _sm { CamelCipherCertInfo *info = (CamelCipherCertInfo *)certlist->head; GtkTable *table = (GtkTable *)gtk_table_new(camel_dlist_length(certlist), 2, FALSE); - int n = 0; + gint n = 0; while (info->next) { - char *la = NULL; - const char *l = NULL; + gchar *la = NULL; + const gchar *l = NULL; if (info->name) { if (info->email && strcmp(info->name, info->email) != 0) @@ -715,7 +715,7 @@ efhd_xpkcs7mime_validity_clicked(GtkWidget *button, EMFormatHTMLPObject *pobject struct _smime_pobject *po = (struct _smime_pobject *)pobject; GladeXML *xml; GtkWidget *vbox, *w; - char *gladefile; + gchar *gladefile; if (po->widget) /* FIXME: window raise? */ @@ -804,7 +804,7 @@ efhd_xpkcs7mime_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje { GtkWidget *icon, *button; struct _smime_pobject *po = (struct _smime_pobject *)pobject; - const char *icon_name; + const gchar *icon_name; /* FIXME: need to have it based on encryption and signing too */ if (po->valid->sign.status != 0) @@ -835,7 +835,7 @@ efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Came if (emf->valid == valid && (valid->encrypt.status != CAMEL_CIPHER_VALIDITY_ENCRYPT_NONE || valid->sign.status != CAMEL_CIPHER_VALIDITY_SIGN_NONE)) { - char *classid; + gchar *classid; struct _smime_pobject *pobj; camel_stream_printf (stream, "", @@ -865,7 +865,7 @@ efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, Came static void efhd_image(EMFormatHTML *efh, CamelStream *stream, CamelMimePart *part, EMFormatHandler *handle) { - char *classid; + gchar *classid; struct _attach_puri *info; classid = g_strdup_printf("image%s", ((EMFormat *)efh)->part_id->str); @@ -919,19 +919,19 @@ static EMFormatHandler type_builtin_table[] = { static void efhd_builtin_init(EMFormatHTMLDisplayClass *efhc) { - int i; + gint i; for (i=0;ifind_handler (emf, mime_type); } -static void efhd_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeMessage *msg, EMFormat *src) +static void efhd_format_clone(EMFormat *emf, CamelFolder *folder, const gchar *uid, CamelMimeMessage *msg, EMFormat *src) { if (emf != src) ((EMFormatHTML *) emf)->header_wrap_flags = 0; @@ -952,11 +952,11 @@ efhd_write_image(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri) static void efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMFormatHandler *info) { - const char *flag, *comp, *due; + const gchar *flag, *comp, *due; time_t date; - char due_date[128]; + gchar due_date[128]; struct tm due_tm; - char *iconpath; + gchar *iconpath; if (emf->folder == NULL || emf->uid == NULL || (flag = camel_folder_get_message_user_tag(emf->folder, emf->uid, "follow-up")) == NULL @@ -974,7 +974,7 @@ static void efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePar iconpart = em_format_html_file_part((EMFormatHTML *)emf, "image/png", iconpath); g_free (iconpath); if (iconpart) { - char *classid; + gchar *classid; classid = g_strdup_printf("icon:///em-format-html-display/%s/%s", emf->part_id->str, comp&&comp[0]?"comp":"uncomp"); camel_stream_printf(stream, "", classid); @@ -1010,7 +1010,7 @@ static void efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePar } /* TODO: if these aren't going to do anything should remove */ -static void efhd_format_error(EMFormat *emf, CamelStream *stream, const char *txt) +static void efhd_format_error(EMFormat *emf, CamelStream *stream, const gchar *txt) { ((EMFormatClass *)efhd_parent)->format_error(emf, stream, txt); } @@ -1039,7 +1039,7 @@ efhd_can_process_attachment (GtkWidget *button) /* if it hasn't been processed yet, format the attachment */ static void -efhd_attachment_show(EPopup *ep, EPopupItem *item, void *data) +efhd_attachment_show(EPopup *ep, EPopupItem *item, gpointer data) { struct _attach_puri *info = data; @@ -1061,7 +1061,7 @@ efhd_attachment_button_expanded (GtkWidget *widget, } static void -efhd_image_fit(EPopup *ep, EPopupItem *item, void *data) +efhd_image_fit(EPopup *ep, EPopupItem *item, gpointer data) { struct _attach_puri *info = data; @@ -1070,7 +1070,7 @@ efhd_image_fit(EPopup *ep, EPopupItem *item, void *data) } static void -efhd_image_unfit(EPopup *ep, EPopupItem *item, void *data) +efhd_image_unfit(EPopup *ep, EPopupItem *item, gpointer data) { struct _attach_puri *info = data; @@ -1087,13 +1087,13 @@ static EPopupItem efhd_menu_items[] = { }; static void -efhd_menu_items_free(EPopup *ep, GSList *items, void *data) +efhd_menu_items_free(EPopup *ep, GSList *items, gpointer data) { g_slist_free(items); } static void -efhd_popup_place_widget(GtkMenu *menu, int *x, int *y, gboolean *push_in, gpointer user_data) +efhd_popup_place_widget(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) { GtkWidget *w = user_data; @@ -1178,7 +1178,7 @@ static void efhd_drag_data_get(GtkWidget *w, GdkDragContext *drag, GtkSelectionData *data, guint info, guint time, EMFormatHTMLPObject *pobject) { CamelMimePart *part = pobject->part; - char *uri, *uri_crlf, *path; + gchar *uri, *uri_crlf, *path; CamelStream *stream; switch (info) { @@ -1204,7 +1204,7 @@ efhd_drag_data_get(GtkWidget *w, GdkDragContext *drag, GtkSelectionData *data, g /* Kludge around Nautilus requesting the same data many times */ uri = g_object_get_data((GObject *)w, "e-drag-uri"); if (uri) { - gtk_selection_data_set(data, data->target, 8, (unsigned char *)uri, strlen(uri)); + gtk_selection_data_set(data, data->target, 8, (guchar *)uri, strlen(uri)); return; } @@ -1216,7 +1216,7 @@ efhd_drag_data_get(GtkWidget *w, GdkDragContext *drag, GtkSelectionData *data, g g_free(path); uri_crlf = g_strconcat(uri, "\r\n", NULL); g_free(uri); - gtk_selection_data_set(data, data->target, 8, (unsigned char *)uri_crlf, strlen(uri_crlf)); + gtk_selection_data_set(data, data->target, 8, (guchar *)uri_crlf, strlen(uri_crlf)); g_object_set_data_full((GObject *)w, "e-drag-uri", uri_crlf, g_free); break; default: @@ -1227,7 +1227,7 @@ efhd_drag_data_get(GtkWidget *w, GdkDragContext *drag, GtkSelectionData *data, g static void efhd_drag_data_delete(GtkWidget *w, GdkDragContext *drag, EMFormatHTMLPObject *pobject) { - char *uri; + gchar *uri; uri = g_object_get_data((GObject *)w, "e-drag-uri"); if (uri) { @@ -1236,7 +1236,7 @@ efhd_drag_data_delete(GtkWidget *w, GdkDragContext *drag, EMFormatHTMLPObject *p /* NB even more: doesn't the e-drag-uri have \r\n * appended? (see efhd_drag_data_get()) */ - char *filename = g_filename_from_uri (uri, NULL, NULL); + gchar *filename = g_filename_from_uri (uri, NULL, NULL); g_unlink(filename); g_free(filename); g_object_set_data((GObject *)w, "e-drag-uri", NULL); @@ -1244,7 +1244,7 @@ efhd_drag_data_delete(GtkWidget *w, GdkDragContext *drag, EMFormatHTMLPObject *p } static void -efhd_write_icon_job(struct _EMFormatHTMLJob *job, int cancelled) +efhd_write_icon_job(struct _EMFormatHTMLJob *job, gint cancelled) { EMFormatHTMLPObject *pobject; CamelDataWrapper *dw; @@ -1262,7 +1262,7 @@ static void efhd_image_resized(GtkWidget *w, GtkAllocation *event, struct _attach_puri *info) { GdkPixbuf *pb; - int width; + gint width; if (info->fit_width == 0) return; @@ -1294,7 +1294,7 @@ efhd_change_cursor(GtkWidget *w, GdkEventCrossing *event, struct _attach_puri *i static void efhd_image_fit_width(GtkWidget *widget, GdkEventButton *event, struct _attach_puri *info) { - int width; + gint width; width = ((GtkWidget *)((EMFormatHTML *)info->puri.format)->html)->allocation.width - 12; @@ -1345,7 +1345,7 @@ efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObjec { NULL, 0, 0 }, { (gchar *) "text/uri-list", 0, 1 }, }; - char *simple_type; + gchar *simple_type; info = (struct _attach_puri *)em_format_find_puri((EMFormat *)efh, pobject->classid); @@ -1509,7 +1509,7 @@ efhd_message_add_bar (EMFormat *emf, CamelMimePart *part, const EMFormatHandler *info) { - const char *classid = "attachment-bar"; + const gchar *classid = "attachment-bar"; em_format_html_add_pobject ( (EMFormatHTML *) emf, @@ -1521,9 +1521,9 @@ efhd_message_add_bar (EMFormat *emf, } static void -efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const char *mime_type, const EMFormatHandler *handle) +efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const gchar *mime_type, const EMFormatHandler *handle) { - char *classid, *text, *html; + gchar *classid, *text, *html; struct _attach_puri *info; classid = g_strdup_printf ("attachment%s", emf->part_id->str); @@ -1666,7 +1666,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE); gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE); buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (view)); - gtk_text_buffer_set_text (buffer, (char *)info->mstream->buffer->data, info->mstream->buffer->len); + gtk_text_buffer_set_text (buffer, (gchar *)info->mstream->buffer->data, info->mstream->buffer->len); camel_object_unref(info->mstream); info->mstream = NULL; gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), @@ -1693,7 +1693,7 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb static void efhd_format_optional(EMFormat *emf, CamelStream *fstream, CamelMimePart *part, CamelStream *mstream) { - char *classid, *html; + gchar *classid, *html; struct _attach_puri *info; CamelStream *stream; -- cgit v1.2.3