static GdkCursor *hand_cursor = NULL;
static GdkCursor *text_cursor = NULL;
+static GdkCursor *watch_cursor= NULL;
#define TEXTVIEW_STATUSBAR_PUSH(textview, str) \
{ if (textview->messageview->statusbar) \
static void open_image_cb (TextView *textview,
guint action,
void *data);
+static void textview_show_icon(TextView *textview, const gchar *stock_id);
static GtkItemFactoryEntry textview_link_popup_entries[] =
{
"pixels-below-lines", 0,
"pixels-below-lines-set", TRUE,
"font-desc", font_desc,
- "left-margin", 0,
+ "left-margin", 3,
"left-margin-set", TRUE,
NULL);
gtk_text_buffer_create_tag(buffer, "header_title",
hand_cursor = gdk_cursor_new(GDK_HAND2);
if (!text_cursor)
text_cursor = gdk_cursor_new(GDK_XTERM);
+ if (!watch_cursor)
+ watch_cursor = gdk_cursor_new(GDK_WATCH);
textview_reflect_prefs(textview);
textview_set_all_headers(textview, FALSE);
}
#define TEXT_INSERT(str) \
- gtk_text_buffer_insert(buffer, &iter, str, -1)
+ gtk_text_buffer_insert_with_tags_by_name \
+ (buffer, &iter, str, -1,\
+ "header", NULL)
+
+#define TEXT_INSERT_LINK(str, fname) { \
+ RemoteURI *uri; \
+ uri = g_new(RemoteURI, 1); \
+ uri->uri = g_strdup(""); \
+ uri->start = gtk_text_iter_get_offset(&iter); \
+ gtk_text_buffer_insert_with_tags_by_name \
+ (buffer, &iter, str, -1, \
+ "link", "header_title", "header", \
+ NULL); \
+ uri->end = gtk_text_iter_get_offset(&iter); \
+ uri->filename = g_strdup(fname); \
+ textview->uri_list = \
+ g_slist_append(textview->uri_list, uri); \
+}
void textview_show_error(TextView *textview)
{
buffer = gtk_text_view_get_buffer(text);
gtk_text_buffer_get_start_iter(buffer, &iter);
- TEXT_INSERT(_("This message can't be displayed.\n"));
+ TEXT_INSERT(_("\n"
+ " This message can't be displayed.\n"
+ " This is probably due to a network error.\n"
+ "\n"
+ " Use "));
+ TEXT_INSERT_LINK(_("'View Log'"), "sc://view_log");
+ TEXT_INSERT(_(" in the Tools menu for more information."));
+ textview_show_icon(textview, GTK_STOCK_DIALOG_ERROR);
}
buffer = gtk_text_view_get_buffer(text);
gtk_text_buffer_get_start_iter(buffer, &iter);
- TEXT_INSERT(_("The following can be performed on this part by "));
- TEXT_INSERT(_("right-clicking the icon or list item:\n"));
-
- TEXT_INSERT(_(" To save select 'Save as...' (Shortcut key: 'y')\n"));
- TEXT_INSERT(_(" To display as text select 'Display as text' "));
- TEXT_INSERT(_("(Shortcut key: 't')\n"));
- TEXT_INSERT(_(" To open with an external program select 'Open' "));
- TEXT_INSERT(_("(Shortcut key: 'l'),\n"));
- TEXT_INSERT(_(" (alternately double-click, or click the middle "));
- TEXT_INSERT(_("mouse button),\n"));
- TEXT_INSERT(_(" or 'Open with...' (Shortcut key: 'o')\n"));
+ TEXT_INSERT("\n");
+ TEXT_INSERT(_(" The following can be performed on this part by\n"));
+ TEXT_INSERT(_(" right-clicking the icon or list item:\n"));
+
+ TEXT_INSERT(_(" - To save, select "));
+ TEXT_INSERT_LINK(_("'Save as...'"), "sc://save_as");
+ TEXT_INSERT(_(" (Shortcut key: 'y')\n"));
+ TEXT_INSERT(_(" - To display as text, select "));
+ TEXT_INSERT_LINK(_("'Display as text'"), "sc://display_as_text");
+ TEXT_INSERT(_(" (Shortcut key: 't')\n"));
+ TEXT_INSERT(_(" - To open with an external program, select "));
+ TEXT_INSERT_LINK(_("'Open'"), "sc://open");
+ TEXT_INSERT(_(" (Shortcut key: 'l')\n"));
+ TEXT_INSERT(_(" (alternately double-click, or click the middle "));
+ TEXT_INSERT(_("mouse button)\n"));
+ TEXT_INSERT(_(" - Or use "));
+ TEXT_INSERT_LINK(_("'Open with...'"), "sc://open_with");
+ TEXT_INSERT(_(" (Shortcut key: 'o')\n"));
+ textview_show_icon(textview, GTK_STOCK_DIALOG_INFO);
}
#undef TEXT_INSERT
+#undef TEXT_INSERT_LINK
static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
{
{
GtkTextView *text = GTK_TEXT_VIEW(textview->text);
GtkTextBuffer *buffer;
+ GdkWindow *window = gtk_text_view_get_window(text,
+ GTK_TEXT_WINDOW_TEXT);
buffer = gtk_text_view_get_buffer(text);
gtk_text_buffer_set_text(buffer, "", -1);
if (textview->image)
gtk_widget_destroy(textview->image);
textview->image = NULL;
+
+ if (textview->messageview->mainwin->cursor_count == 0) {
+ gdk_window_set_cursor(window, text_cursor);
+ } else {
+ gdk_window_set_cursor(window, watch_cursor);
+ }
}
void textview_destroy(TextView *textview)
textview->image = NULL;
}
+static void textview_show_icon(TextView *textview, const gchar *stock_id)
+{
+ GtkTextView *text = GTK_TEXT_VIEW(textview->text);
+ int x = 0;
+
+ if (textview->image)
+ gtk_widget_destroy(textview->image);
+
+ textview->image = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_DIALOG);
+ g_return_if_fail(textview->image != NULL);
+
+ gtk_widget_show(textview->image);
+
+ x = textview->text->allocation.width - WIDTH -5;
+
+ gtk_text_view_add_child_in_window(text, textview->image,
+ GTK_TEXT_WINDOW_TEXT, x, 5);
+
+ gtk_widget_show_all(textview->text);
+
+
+ return;
+}
+
#if HAVE_LIBCOMPFACE
static void textview_show_xface(TextView *textview)
{
return FALSE;
}
+void textview_cursor_wait(TextView *textview)
+{
+ GdkWindow *window = gtk_text_view_get_window(
+ GTK_TEXT_VIEW(textview->text),
+ GTK_TEXT_WINDOW_TEXT);
+ gdk_window_set_cursor(window, watch_cursor);
+}
+
+void textview_cursor_normal(TextView *textview)
+{
+ GdkWindow *window = gtk_text_view_get_window(
+ GTK_TEXT_VIEW(textview->text),
+ GTK_TEXT_WINDOW_TEXT);
+ gdk_window_set_cursor(window, text_cursor);
+}
+
static void textview_uri_update(TextView *textview, gint x, gint y)
{
GtkTextBuffer *buffer;
window = gtk_text_view_get_window(GTK_TEXT_VIEW(textview->text),
GTK_TEXT_WINDOW_TEXT);
- gdk_window_set_cursor(window, uri ? hand_cursor : text_cursor);
+ if (textview->messageview->mainwin->cursor_count == 0) {
+ gdk_window_set_cursor(window, uri ? hand_cursor : text_cursor);
+ } else {
+ gdk_window_set_cursor(window, watch_cursor);
+ }
TEXTVIEW_STATUSBAR_POP(textview);
/* doubleclick: open compose / add address / browser */
if ((event->type == GDK_BUTTON_PRESS && bevent->button == 1) ||
bevent->button == 2 || bevent->button == 3) {
- if (!g_ascii_strncasecmp(uri->uri, "mailto:", 7)) {
+ if (uri->filename && !g_ascii_strncasecmp(uri->filename, "sc://", 5)) {
+ if (bevent->button == 1) {
+ MimeView *mimeview =
+ (textview->messageview)?
+ textview->messageview->mimeview:NULL;
+ mimeview_handle_cmd(mimeview, uri->filename);
+ }
+ return TRUE;
+ } else if (!g_ascii_strncasecmp(uri->uri, "mailto:", 7)) {
if (bevent->button == 3) {
g_object_set_data(
G_OBJECT(textview->mail_popup_menu),
filedir = g_path_get_dirname(filename);
if (filedir && strcmp(filedir, ".")) {
- if (prefs_common.attach_save_dir)
- g_free(prefs_common.attach_save_dir);
+ g_free(prefs_common.attach_save_dir);
prefs_common.attach_save_dir = g_strdup(filedir);
}