[evolution-patches] related to #60900, expanding inline state of generated parts
- From: Not Zed <notzed ximian com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] related to #60900, expanding inline state of generated parts
- Date: Thu, 08 Jul 2004 12:30:28 +0800
generated parts usually change address on each redraw, so base the 'has user overriden inline state' on their unique id name rather than the address. this covers encrypted parts and scanned inline parts.
related to 60900 but not a fix for it, i think.
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3411
diff -u -3 -r1.3411 ChangeLog
--- mail/ChangeLog 5 Jul 2004 15:08:21 -0000 1.3411
+++ mail/ChangeLog 8 Jul 2004 04:27:46 -0000
@@ -1,3 +1,29 @@
+2004-07-08 Not Zed <NotZed Ximian com>
+
+ ** See bug #60900.
+
+ * em-format-html-display.c (efhd_attachment_show): let set_inline
+ do the redraw itself if required. kill some dead code.
+
+ * em-format.c (em_format_set_inline): trigger a redraw here like
+ the other em_format_set methods, if the state changed.
+
+ * em-format.c (emf_format_clone): free inline table keys & setup
+ string hash table.
+
+ * em-format-quote.c (emfq_format_attachment):
+ * em-format-html-display.c (efhd_format_attachment):
+ * em-format-html.c (efh_format_attachment): is_inline api changes.
+
+ * em-format-html-display.c (efhd_attachment_show): set_inline api
+ changes.
+
+ * em-format.c (em_format_is_inline): make this use the partid
+ rather than the part address as a key, which may change.
+ (emf_init): make the inline talbe a string hashtable.
+ (emf_finalise): free inline keys.
+ (emf_clone_inlines): copy the key string.
+
2004-07-02 JP Rosevaer <jpr novell com>
* Makefile.am (SUBDIRS): Revert previous error change
Index: mail/em-format-html-display.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.c,v
retrieving revision 1.47
diff -u -3 -r1.47 em-format-html-display.c
--- mail/em-format-html-display.c 23 Jun 2004 08:08:40 -0000 1.47
+++ mail/em-format-html-display.c 8 Jul 2004 04:27:46 -0000
@@ -1046,38 +1046,7 @@
d(printf("show attachment button called\n"));
info->shown = ~info->shown;
- em_format_set_inline(info->puri.format, info->puri.part, info->shown);
- /* FIXME: do this in an idle handler */
- em_format_redraw(info->puri.format);
-#if 0
- /* FIXME: track shown state in parent */
-
- if (info->shown) {
- d(printf("hiding\n"));
- info->shown = FALSE;
- if (info->frame)
- gtk_widget_hide((GtkWidget *)info->frame);
- gtk_widget_show(info->forward);
- gtk_widget_hide(info->down);
- } else {
- d(printf("showing\n"));
- info->shown = TRUE;
- if (info->frame)
- gtk_widget_show((GtkWidget *)info->frame);
- gtk_widget_hide(info->forward);
- gtk_widget_show(info->down);
-
- /* have we decoded it yet? */
- if (info->output) {
- info->handle->handler(info->puri.format, info->output, info->puri.part, info->handle);
- camel_stream_close(info->output);
- camel_object_unref(info->output);
- info->output = NULL;
- }
- }
-
- em_format_set_inline(info->puri.format, info->puri.part, info->shown);
-#endif
+ em_format_set_inline(info->puri.format, info->puri.part_id, info->shown);
}
static EMPopupItem efhd_menu_items[] = {
@@ -1498,7 +1467,7 @@
info = (struct _attach_puri *)em_format_add_puri(emf, sizeof(*info), classid, part, efhd_attachment_frame);
em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_attachment_button);
info->handle = handle;
- info->shown = em_format_is_inline(emf, info->puri.part, handle);
+ info->shown = em_format_is_inline(emf, info->puri.part_id, info->puri.part, handle);
info->snoop_mime_type = emf->snoop_mime_type;
camel_stream_write_string(stream,
Index: mail/em-format-html.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html.c,v
retrieving revision 1.60
diff -u -3 -r1.60 em-format-html.c
--- mail/em-format-html.c 24 May 2004 08:02:25 -0000 1.60
+++ mail/em-format-html.c 8 Jul 2004 04:27:47 -0000
@@ -1744,7 +1744,7 @@
camel_stream_write_string(stream, "</font></td></tr><tr></table>");
- if (handle && em_format_is_inline(emf, part, handle))
+ if (handle && em_format_is_inline(emf, emf->part_id->str, part, handle))
handle->handler(emf, stream, part, handle);
}
Index: mail/em-format-quote.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-quote.c,v
retrieving revision 1.10
diff -u -3 -r1.10 em-format-quote.c
--- mail/em-format-quote.c 25 May 2004 16:16:25 -0000 1.10
+++ mail/em-format-quote.c 8 Jul 2004 04:27:47 -0000
@@ -394,7 +394,7 @@
static void
emfq_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const char *mime_type, const EMFormatHandler *handle)
{
- if (handle && em_format_is_inline(emf, part, handle)) {
+ if (handle && em_format_is_inline(emf, emf->part_id->str, part, handle)) {
char *text, *html;
camel_stream_write_string(stream,
Index: mail/em-format.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format.c,v
retrieving revision 1.37
diff -u -3 -r1.37 em-format.c
--- mail/em-format.c 19 May 2004 07:02:12 -0000 1.37
+++ mail/em-format.c 8 Jul 2004 04:27:47 -0000
@@ -75,7 +75,7 @@
{
EMFormat *emf = (EMFormat *)o;
- emf->inline_table = g_hash_table_new(NULL, NULL);
+ emf->inline_table = g_hash_table_new(g_str_hash, g_str_equal);
e_dlist_init(&emf->header_list);
em_format_default_headers(emf);
emf->part_id = g_string_new("");
@@ -89,8 +89,8 @@
if (emf->session)
camel_object_unref(emf->session);
- if (emf->inline_table)
- g_hash_table_destroy(emf->inline_table);
+ g_hash_table_foreach(emf->inline_table, (GHFunc)g_free, NULL);
+ g_hash_table_destroy(emf->inline_table);
em_format_clear_headers(emf);
camel_cipher_validity_free(emf->valid);
@@ -526,7 +526,7 @@
static void
emf_clone_inlines(void *key, void *val, void *data)
{
- g_hash_table_insert(((EMFormat *)data)->inline_table, key, val);
+ g_hash_table_insert(((EMFormat *)data)->inline_table, g_strdup(key), val);
}
static void
@@ -535,8 +535,9 @@
em_format_clear_puri_tree(emf);
if (emf != emfsource) {
+ g_hash_table_foreach(emf->inline_table, (GHFunc)g_free, NULL);
g_hash_table_destroy(emf->inline_table);
- emf->inline_table = g_hash_table_new(NULL, NULL);
+ emf->inline_table = g_hash_table_new(g_str_hash, g_str_equal);
if (emfsource) {
struct _EMFormatHeader *h;
@@ -829,6 +830,7 @@
* em_format_is_inline:
* @emf:
* @part:
+ * @partid: format->part_id part id of this part.
* @handle: handler for this part
*
* Returns true if the part should be displayed inline. Any part with
@@ -840,7 +842,7 @@
*
* Return value:
**/
-int em_format_is_inline(EMFormat *emf, CamelMimePart *part, const EMFormatHandler *handle)
+int em_format_is_inline(EMFormat *emf, const char *partid, CamelMimePart *part, const EMFormatHandler *handle)
{
void *dummy, *override;
const char *tmp;
@@ -848,7 +850,7 @@
if (handle == NULL)
return FALSE;
- if (g_hash_table_lookup_extended(emf->inline_table, part, &dummy, &override))
+ if (g_hash_table_lookup_extended(emf->inline_table, partid, &dummy, &override))
return GPOINTER_TO_INT(override);
/* some types need to override the disposition, e.g. application/x-pkcs7-mime */
@@ -866,16 +868,27 @@
/**
* em_format_set_inline:
* @emf:
- * @part:
+ * @partid: id of part
* @state:
*
* Force the attachment @part to be expanded or hidden explictly to match
* @state. This is used only to record the change for a redraw or
* cloned layout render and does not force a redraw.
**/
-void em_format_set_inline(EMFormat *emf, CamelMimePart *part, int state)
+void em_format_set_inline(EMFormat *emf, const char *partid, int state)
{
- g_hash_table_insert(emf->inline_table, part, GINT_TO_POINTER(state));
+ char *oldkey;
+ void *override;
+
+ if (!g_hash_table_lookup_extended(emf->inline_table, partid, (void *)&oldkey, &override))
+ oldkey = g_strdup(partid);
+ else if (GPOINTER_TO_INT(override) == state)
+ return;
+
+ g_hash_table_insert(emf->inline_table, oldkey, GINT_TO_POINTER(state));
+
+ if (emf->message)
+ emf_format_redraw(emf);
}
void em_format_format_error(EMFormat *emf, CamelStream *stream, const char *fmt, ...)
Index: mail/em-format.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format.h,v
retrieving revision 1.11
diff -u -3 -r1.11 em-format.h
--- mail/em-format.h 15 Mar 2004 15:19:00 -0000 1.11
+++ mail/em-format.h 8 Jul 2004 04:27:47 -0000
@@ -190,9 +190,10 @@
Or maybe it should live with sub-classes? */
int em_format_is_attachment(EMFormat *emf, struct _CamelMimePart *part);
-int em_format_is_inline(EMFormat *emf, struct _CamelMimePart *part, const EMFormatHandler *handle);
-/* FIXME: not sure about this api */
-void em_format_set_inline(EMFormat *emf, struct _CamelMimePart *part, int state);
+
+int em_format_is_inline(EMFormat *emf, const char *partid, struct _CamelMimePart *part, const EMFormatHandler *handle);
+void em_format_set_inline(EMFormat *emf, const char *partid, int state);
+
char *em_format_describe_part(struct _CamelMimePart *part, const char *mimetype);
/* for implementers */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]