+static void icon_selected (MimeView *mimeview, gint num, MimeInfo *partinfo)
+{
+ if (num == 1 && (partinfo->mime_type == MIME_TEXT ||
+ partinfo->mime_type == MIME_TEXT_HTML)) {
+ gtk_notebook_set_page(GTK_NOTEBOOK(mimeview->notebook), 0);
+ /* don't set the ctree, as it will unload the plugin, and
+ * we want to be able to switch quickly between the text
+ * part and the attachment */
+ } else {
+ GtkCTreeNode *node;
+ gtk_notebook_set_page(GTK_NOTEBOOK(mimeview->notebook), 1);
+ node = gtk_ctree_find_by_row_data(GTK_CTREE(mimeview->ctree), NULL, partinfo);
+ if (node)
+ gtk_ctree_select(GTK_CTREE(mimeview->ctree), node);
+ }
+}
+
+static gint icon_key_pressed(GtkWidget *button, GdkEventKey *event,
+ MimeView *mimeview)
+{
+ gint num;
+ MimeInfo *partinfo;
+
+ num = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(button), "icon_number"));
+ partinfo = gtk_object_get_data(GTK_OBJECT(button), "partinfo");
+
+ if (!event) return FALSE;
+
+ switch (event->keyval) {
+ case GDK_Return:
+ icon_selected(mimeview, num, partinfo);
+ return TRUE;
+ break;
+ default:
+ break;
+ }
+ return FALSE;
+}
+