/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
gchar *filename;
ClickableText *uri;
gchar *uri_str;
+ gint err;
START_TIMING("inserting image");
filename = procmime_get_tmp_file_name(mimeinfo);
- if (procmime_get_part(filename, mimeinfo) < 0) {
- g_warning("Can't get the image file.");
+ if ((err = procmime_get_part(filename, mimeinfo)) < 0) {
+ g_warning("Can't get the image file.(%s)", strerror(-err));
g_free(filename);
END_TIMING();
return;
} else {
gint w, h;
gdk_pixbuf_get_file_info(filename, &w, &h);
- if (w > textview->scrolledwin->allocation.width - 100)
+ if (textview->scrolledwin->allocation.width - 100 > 0 &&
+ w > textview->scrolledwin->allocation.width - 100)
pixbuf = gdk_pixbuf_new_from_file_at_scale(filename,
textview->scrolledwin->allocation.width - 100,
-1, TRUE, &error);
if (parser->state == SC_HTML_HREF) {
/* first time : get and copy the URL */
if (parser->href == NULL) {
- /* ALF - the sylpheed html parser returns an empty string,
+ /* ALF - the claws html parser returns an empty string,
* if still inside an <a>, but already parsed past HREF */
str = strtok(str, " ");
if (str) {
if (font_desc) {
gtk_widget_modify_font(textview->text, font_desc);
CHANGE_TAG_FONT("header", font_desc);
+ CHANGE_TAG_FONT("hlink", font_desc);
pango_font_description_free(font_desc);
}
if (bold_font_desc) {
{"AF:", "NF:", "PS:", "SRH:", "SFN:", "DSR:", "MID:",
"CFG:", "PT:", "S:", "RQ:", "SSV:", "NSV:", "SSH:",
"R:", "MAID:", "SCF:", "RMID:", "FMID:", "NAID:",
+ "X-Claws-Account-Id:", "X-Claws-Sign:", "X-Claws-Encrypt:",
+ "X-Claws-Privacy-System:", "X-Claws-End-Special-Headers:",
"X-Sylpheed-Account-Id:", "X-Sylpheed-Sign:", "X-Sylpheed-Encrypt:",
"X-Sylpheed-Privacy-System:", "X-Sylpheed-End-Special-Headers:",
NULL};
if ((procheader_headername_equal(header->name, "X-Mailer") ||
procheader_headername_equal(header->name,
"X-Newsreader")) &&
- strstr(header->body, "Sylpheed-Claws") != NULL) {
+ (strstr(header->body, "Claws Mail") != NULL ||
+ strstr(header->body, "Sylpheed-Claws") != NULL)) {
gtk_text_buffer_get_end_iter (buffer, &iter);
gtk_text_buffer_insert_with_tags_by_name
(buffer, &iter, header->body, -1,
filedir = g_path_get_dirname(filename);
if (filedir && strcmp(filedir, ".")) {
g_free(prefs_common.attach_save_dir);
- prefs_common.attach_save_dir = g_strdup(filedir);
+ prefs_common.attach_save_dir = g_filename_to_utf8(filedir, -1, NULL, NULL, NULL);
}
g_free(filedir);
/* Hiroyuki: please put this function in utils.c! */
fromname = procheader_get_fromname(fromaddress);
extract_address(fromaddress);
- g_message("adding from textview %s <%s>", fromname, fromaddress);
+
/* Add to address book - Match */
addressbook_add_contact( fromname, fromaddress, NULL );
NULL);
}
+void textview_get_selection_offsets(TextView *textview, gint *sel_start, gint *sel_end)
+{
+ GtkTextView *text = GTK_TEXT_VIEW(textview->text);
+ GtkTextBuffer *buffer = gtk_text_view_get_buffer(text);
+ GtkTextIter start, end;
+ if (gtk_text_buffer_get_selection_bounds(buffer, &start, &end)) {
+ if (sel_start)
+ *sel_start = gtk_text_iter_get_offset(&start);
+ if (sel_end)
+ *sel_end = gtk_text_iter_get_offset(&end);
+ } else {
+ if (sel_start)
+ *sel_start = -1;
+ if (sel_end)
+ *sel_end = -1;
+ }
+}