/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Claws Mail 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
GtkTextIter *iter,
TextView *textview);
-static gboolean textview_uri_security_check (TextView *textview,
- ClickableText *uri);
static void textview_uri_list_remove_all (GSList *uri_list);
static void textview_toggle_quote (TextView *textview,
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 (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, "Claws Mail") != 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,
case GDK_t:
case GDK_l:
case GDK_c:
+ case GDK_a:
if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) == 0) {
KEY_PRESS_EVENT_STOP();
mimeview_pass_key_press_event(messageview->mimeview,
return FALSE;
}
+gchar *textview_get_visible_uri (TextView *textview,
+ ClickableText *uri)
+{
+ GtkTextBuffer *buffer;
+ GtkTextIter start, end;
+
+ buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview->text));
+
+ gtk_text_buffer_get_iter_at_offset(buffer, &start, uri->start);
+ gtk_text_buffer_get_iter_at_offset(buffer, &end, uri->end);
+
+ return gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
+}
+
/*!
*\brief Check to see if a web URL has been disguised as a different
* URL (possible with HTML email).
*\return gboolean TRUE if the URL is ok, or if the user chose to open
* it anyway, otherwise FALSE
*/
-static gboolean textview_uri_security_check(TextView *textview, ClickableText *uri)
+gboolean textview_uri_security_check(TextView *textview, ClickableText *uri)
{
gchar *visible_str;
gboolean retval = TRUE;
- GtkTextBuffer *buffer;
- GtkTextIter start, end;
if (is_uri_string(uri->uri) == FALSE)
return TRUE;
- buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview->text));
-
- gtk_text_buffer_get_iter_at_offset(buffer, &start, uri->start);
- gtk_text_buffer_get_iter_at_offset(buffer, &end, uri->end);
-
- visible_str = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
-
+ visible_str = textview_get_visible_uri(textview, uri);
if (visible_str == NULL)
return TRUE;
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;
+ }
+}