- GtkTextBuffer *buf;
-
-#ifdef ACTIVATE_HACKS /* it still doesn't work, don't bother! */
- GtkWidget *html, *win;
- TnyStreamIface *stream;
- GtkClipboard *clip;
- gchar *text;
-
- win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- html = gtk_html_new ();
- gtk_container_add (GTK_CONTAINER (win), html);
-
- gtk_html_set_editable (GTK_HTML (html), FALSE);
- gtk_html_allow_selection (GTK_HTML (html), TRUE);
- stream = TNY_STREAM_IFACE (modest_tny_stream_gtkhtml_new
- (gtk_html_begin (GTK_HTML (html))));
-
- tny_stream_iface_reset (stream);
- tny_msg_mime_part_iface_decode_to_stream (body, stream);
- tny_stream_iface_reset (stream);
- g_object_unref (G_OBJECT (stream));
-
- gtk_widget_show_all (win);
- gtk_html_select_all (GTK_HTML (html));
- clip = gtk_widget_get_clipboard (html, GDK_SELECTION_PRIMARY);
- /*clip = gtk_widget_get_clipboard(html, GDK_SELECTION_CLIPBOARD);*/
- text = gtk_clipboard_wait_for_text (clip);
-
- buf = gtk_text_buffer_new (NULL);
- gtk_text_buffer_set_text (buf, text, -1);
- g_free (text);
- /* destroy win & html */
-#else
- buf = gtk_text_buffer_new (NULL);
-#endif
- return buf;
-}
-
-gchar *
-modest_tny_msg_actions_quote (const TnyMsgIface * self, const gchar * from,
- time_t sent_date, gint limit,
- const gchar * to_quote)
-{
- gchar *quoted;
-
- /* 3 cases: */
-
- /* a) quote text from selection */
- if (to_quote != NULL)
- return modest_text_utils_quote (to_quote, from, sent_date,
- limit);
-
- /* b) try to find a text/plain part in the msg and quote it */
- quoted = quote_msg (self, from, sent_date, limit, FALSE);
- if (quoted)
- return quoted;
-
- /* c) if that fails, try text/html */
- return quote_msg (self, from, sent_date, limit, TRUE);
-}
-
-
-static gchar *
-quote_msg (const TnyMsgIface * src, const gchar * from, time_t sent_date,
- gint limit, gboolean want_html)
-{
- TnyStreamIface *stream;
- TnyMsgMimePartIface *body;