* src/messageview.c
authorLuke Plant <L.Plant.98@cantab.net>
Sat, 19 Jul 2003 13:50:29 +0000 (13:50 +0000)
committerLuke Plant <L.Plant.98@cantab.net>
Sat, 19 Jul 2003 13:50:29 +0000 (13:50 +0000)
* src/mimeview.c
* src/mimeview.h
* src/procmime.h
* src/rfc2015.c
* src/stock_pixmap.c
* src/stock_pixmap.h
* src/gtk/Makefile.am
* src/Makefile.am
* src/gtk/gtkvscrollbutton.[ch]  ** new **
* src/pixmaps/mime_*.xpm         ** new **

mimeview rearrangement with a new icon shortcut bar
VS: ----------------------------------------------------------------------

22 files changed:
src/Makefile.am
src/gtk/Makefile.am
src/gtk/gtkvscrollbutton.c [new file with mode: 0644]
src/gtk/gtkvscrollbutton.h [new file with mode: 0644]
src/messageview.c
src/mimeview.c
src/mimeview.h
src/pixmaps/mime_application.xpm [new file with mode: 0644]
src/pixmaps/mime_application_octect_stream.xpm [new file with mode: 0644]
src/pixmaps/mime_audio.xpm [new file with mode: 0644]
src/pixmaps/mime_gpg_failed.xpm [new file with mode: 0644]
src/pixmaps/mime_gpg_passed.xpm [new file with mode: 0644]
src/pixmaps/mime_gpg_signed.xpm [new file with mode: 0644]
src/pixmaps/mime_image.xpm [new file with mode: 0644]
src/pixmaps/mime_text_enriched.xpm [new file with mode: 0644]
src/pixmaps/mime_text_html.xpm [new file with mode: 0644]
src/pixmaps/mime_text_plain.xpm [new file with mode: 0644]
src/pixmaps/mime_unknown.xpm [new file with mode: 0644]
src/procmime.h
src/rfc2015.c
src/stock_pixmap.c
src/stock_pixmap.h

index 9f04cbb..a2112d8 100644 (file)
@@ -172,6 +172,17 @@ EXTRA_DIST = \
        pixmaps/mail.xpm \
        pixmaps/mark.xpm \
        pixmaps/messageview_text.xpm \
+       pixmaps/mime_application_octect_stream.xpm \
+       pixmaps/mime_application.xpm \
+       pixmaps/mime_audio.xpm \
+       pixmaps/mime_gpg_failed.xpm \
+       pixmaps/mime_gpg_passed.xpm \
+       pixmaps/mime_gpg_signed.xpm \
+       pixmaps/mime_image.xpm \
+       pixmaps/mime_text_enriched.xpm \
+       pixmaps/mime_text_html.xpm \
+       pixmaps/mime_text_plain.xpm \
+       pixmaps/mime_unknown.xpm \
        pixmaps/news_compose.xpm \
        pixmaps/new.xpm \
        pixmaps/notice_error.xpm \
index 1ac992b..57b961c 100644 (file)
@@ -14,7 +14,8 @@ libsylpheedgtk_la_SOURCES = \
        menu.c menu.h \
        pluginwindow.c pluginwindow.h \
        prefswindow.c prefswindow.h \
-       sslcertwindow.c sslcertwindow.h
+       sslcertwindow.c sslcertwindow.h \
+       gtkvscrollbutton.c gtkvscrollbutton.h
 
 CPPFLAGS = \
        -I../common \
diff --git a/src/gtk/gtkvscrollbutton.c b/src/gtk/gtkvscrollbutton.c
new file mode 100644 (file)
index 0000000..539e5f8
--- /dev/null
@@ -0,0 +1,351 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+ /*
+  * Simple composite widget to provide vertical scrolling, based
+  * on GtkRange widget code.
+  * Modified by the Sylpheed Team and others 2003
+  */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <gtk/gtksignal.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtkmisc.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkbox.h>
+#include <gtk/gtkmain.h>
+
+#include "gtkvscrollbutton.h"
+
+#define SCROLL_TIMER_LENGTH  20
+#define SCROLL_INITIAL_DELAY 100       /* must hold button this long before ... */
+#define SCROLL_LATER_DELAY   20        /* ... it starts repeating at this rate  */
+#define SCROLL_DELAY_LENGTH  300
+
+
+enum {
+    ARG_0,
+    ARG_ADJUSTMENT
+};
+
+static void gtk_vscrollbutton_class_init(GtkVScrollbuttonClass * klass);
+static void gtk_vscrollbutton_init(GtkVScrollbutton * vscrollbutton);
+
+GtkType gtk_vscrollbutton_get_type             (void);
+GtkWidget *gtk_vscrollbutton_new               (GtkAdjustment    *adjustment);
+
+static gint gtk_vscrollbutton_button_release   (GtkWidget        *widget,
+                                                GdkEventButton   *event,
+                                                GtkVScrollbutton *scrollbutton);
+
+static void gtk_vscrollbutton_set_adjustment   (GtkVScrollbutton *scrollbutton,
+                                                GtkAdjustment    *adjustment);
+
+static gint gtk_vscrollbutton_button_press     (GtkWidget        *widget,
+                                                GdkEventButton   *event,
+                                                GtkVScrollbutton *scrollbutton);
+
+static gint gtk_vscrollbutton_button_release   (GtkWidget        *widget,
+                                                GdkEventButton   *event,
+                                                GtkVScrollbutton *scrollbutton);
+
+static gint gtk_vscrollbutton_scroll           (GtkVScrollbutton *scrollbutton);
+
+static gboolean gtk_vscrollbutton_timer_1st_time(GtkVScrollbutton *scrollbutton);
+
+static void gtk_vscrollbutton_add_timer                (GtkVScrollbutton *scrollbutton);
+
+static void gtk_vscrollbutton_remove_timer     (GtkVScrollbutton *scrollbutton);
+
+static gint gtk_real_vscrollbutton_timer       (GtkVScrollbutton *scrollbutton);
+
+GtkType gtk_vscrollbutton_get_type(void)
+{
+    static GtkType vscrollbutton_type = 0;
+
+    if (!vscrollbutton_type) {
+       static const GtkTypeInfo vscrollbutton_info = {
+           "GtkVScrollbutton",
+           sizeof(GtkVScrollbutton),
+           sizeof(GtkVScrollbuttonClass),
+           (GtkClassInitFunc) gtk_vscrollbutton_class_init,
+           (GtkObjectInitFunc) gtk_vscrollbutton_init,
+           /* reserved_1 */ NULL,
+           /* reserved_2 */ NULL,
+           (GtkClassInitFunc) NULL,
+       };
+
+       vscrollbutton_type =
+           gtk_type_unique(GTK_TYPE_VBOX, &vscrollbutton_info);
+    }
+
+    return vscrollbutton_type;
+}
+
+static void gtk_vscrollbutton_class_init(GtkVScrollbuttonClass *class)
+{
+}
+
+static void gtk_vscrollbutton_init(GtkVScrollbutton *scrollbutton)
+{
+    GtkWidget *arrow;
+    scrollbutton->upbutton = gtk_button_new();
+    scrollbutton->downbutton = gtk_button_new();
+    arrow = gtk_arrow_new(GTK_ARROW_UP, GTK_SHADOW_NONE);
+    gtk_widget_show(arrow);
+    gtk_container_add(GTK_CONTAINER(scrollbutton->upbutton), arrow);
+    gtk_widget_set_usize(scrollbutton->upbutton, -1, 16);
+    arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+    gtk_widget_show(arrow);
+    gtk_container_add(GTK_CONTAINER(scrollbutton->downbutton), arrow);
+    gtk_widget_set_usize(scrollbutton->downbutton, -1, 16);
+    GTK_WIDGET_UNSET_FLAGS(scrollbutton->upbutton, GTK_CAN_FOCUS);
+    GTK_WIDGET_UNSET_FLAGS(scrollbutton->downbutton, GTK_CAN_FOCUS);
+    gtk_widget_show(scrollbutton->downbutton);
+    gtk_widget_show(scrollbutton->upbutton);
+
+    gtk_signal_connect(GTK_OBJECT(scrollbutton->upbutton),
+                      "button_press_event",
+                      GTK_SIGNAL_FUNC(gtk_vscrollbutton_button_press),
+                      scrollbutton);
+    gtk_signal_connect(GTK_OBJECT(scrollbutton->downbutton),
+                      "button_press_event",
+                      GTK_SIGNAL_FUNC(gtk_vscrollbutton_button_press),
+                      scrollbutton);
+    gtk_signal_connect(GTK_OBJECT(scrollbutton->upbutton),
+                      "button_release_event",
+                      GTK_SIGNAL_FUNC
+                      (gtk_vscrollbutton_button_release), scrollbutton);
+    gtk_signal_connect(GTK_OBJECT(scrollbutton->downbutton),
+                      "button_release_event",
+                      GTK_SIGNAL_FUNC
+                      (gtk_vscrollbutton_button_release), scrollbutton);
+    gtk_box_pack_start(GTK_BOX(&scrollbutton->vbox),
+                      scrollbutton->upbutton, TRUE, TRUE, 0);
+    gtk_box_pack_end(GTK_BOX(&scrollbutton->vbox),
+                    scrollbutton->downbutton, TRUE, TRUE, 0);
+    scrollbutton->timer = 0;
+}
+
+GtkWidget *gtk_vscrollbutton_new(GtkAdjustment *adjustment)
+{
+    GtkWidget *vscrollbutton;
+    vscrollbutton = GTK_WIDGET(gtk_type_new(gtk_vscrollbutton_get_type()));
+    gtk_vscrollbutton_set_adjustment(GTK_VSCROLLBUTTON(vscrollbutton),
+                                    adjustment);
+    return vscrollbutton;
+}
+
+
+void gtk_vscrollbutton_set_adjustment(GtkVScrollbutton *scrollbutton,
+                                     GtkAdjustment *adjustment)
+{
+    g_return_if_fail(scrollbutton != NULL);
+    g_return_if_fail(GTK_IS_VSCROLLBUTTON(scrollbutton));
+
+    if (!adjustment)
+           adjustment =
+           GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
+    else
+       g_return_if_fail(GTK_IS_ADJUSTMENT(adjustment));
+
+    if (scrollbutton->adjustment != adjustment) {
+       if (scrollbutton->adjustment) {
+           gtk_signal_disconnect_by_data(GTK_OBJECT
+                                         (scrollbutton->
+                                          adjustment), (gpointer)
+                                         scrollbutton);
+           gtk_object_unref(GTK_OBJECT(scrollbutton->adjustment));
+       }
+
+       scrollbutton->adjustment = adjustment;
+       gtk_object_ref(GTK_OBJECT(adjustment));
+       gtk_object_sink(GTK_OBJECT(adjustment));
+    }
+}
+
+
+static gint gtk_vscrollbutton_button_press(GtkWidget *widget,
+                                          GdkEventButton *event,
+                                          GtkVScrollbutton *scrollbutton)
+{
+    if (!GTK_WIDGET_HAS_FOCUS(widget))
+       gtk_widget_grab_focus(widget);
+
+    if (scrollbutton->button == 0) {
+       gtk_grab_add(widget);
+       scrollbutton->button = event->button;
+
+       if (widget == scrollbutton->downbutton)
+           scrollbutton->scroll_type = GTK_SCROLL_STEP_FORWARD;
+       else
+           scrollbutton->scroll_type = GTK_SCROLL_STEP_BACKWARD;
+       gtk_vscrollbutton_scroll(scrollbutton);
+       gtk_vscrollbutton_add_timer(scrollbutton);
+    }
+    return TRUE;
+}
+
+
+static gint gtk_vscrollbutton_button_release(GtkWidget *widget,
+                                            GdkEventButton *event,
+                                            GtkVScrollbutton *scrollbutton)
+{
+    if (!GTK_WIDGET_HAS_FOCUS(widget))
+       gtk_widget_grab_focus(widget);
+
+    if (scrollbutton->button == event->button) {
+       gtk_grab_remove(widget);
+
+       scrollbutton->button = 0;
+       gtk_vscrollbutton_remove_timer(scrollbutton);
+    }
+    return TRUE;
+}
+
+static gint gtk_vscrollbutton_scroll(GtkVScrollbutton *scrollbutton)
+{
+    gfloat new_value;
+    gint return_val;
+
+    g_return_val_if_fail(scrollbutton != NULL, FALSE);
+    g_return_val_if_fail(GTK_IS_VSCROLLBUTTON(scrollbutton), FALSE);
+
+    new_value = scrollbutton->adjustment->value;
+    return_val = TRUE;
+
+    switch (scrollbutton->scroll_type) {
+
+    case GTK_SCROLL_STEP_BACKWARD:
+       new_value -= scrollbutton->adjustment->step_increment;
+       if (new_value <= scrollbutton->adjustment->lower) {
+           new_value = scrollbutton->adjustment->lower;
+           return_val = FALSE;
+           scrollbutton->timer = 0;
+       }
+       break;
+
+    case GTK_SCROLL_STEP_FORWARD:
+       new_value += scrollbutton->adjustment->step_increment;
+       if (new_value >=
+           (scrollbutton->adjustment->upper -
+            scrollbutton->adjustment->page_size)) {
+           new_value =
+               scrollbutton->adjustment->upper -
+               scrollbutton->adjustment->page_size;
+           return_val = FALSE;
+           scrollbutton->timer = 0;
+       }
+       break;
+    }
+
+    if (new_value != scrollbutton->adjustment->value) {
+       scrollbutton->adjustment->value = new_value;
+       gtk_signal_emit_by_name(GTK_OBJECT
+                               (scrollbutton->adjustment),
+                               "value_changed");
+    }
+
+    return return_val;
+}
+
+static gboolean
+gtk_vscrollbutton_timer_1st_time(GtkVScrollbutton *scrollbutton)
+{
+    /*
+     * If the real timeout function succeeds and the timeout is still set,
+     * replace it with a quicker one so successive scrolling goes faster.
+     */
+    gtk_object_ref(GTK_OBJECT(scrollbutton));
+    if (scrollbutton->timer) {
+       /* We explicitely remove ourselves here in the paranoia
+        * that due to things happening above in the callback
+        * above, we might have been removed, and another added.
+        */
+       g_source_remove(scrollbutton->timer);
+       scrollbutton->timer = gtk_timeout_add(SCROLL_LATER_DELAY,
+                                             (GtkFunction)
+                                             gtk_real_vscrollbutton_timer,
+                                             scrollbutton);
+    }
+    gtk_object_unref(GTK_OBJECT(scrollbutton));
+    return FALSE;              /* don't keep calling this function */
+}
+
+
+static void gtk_vscrollbutton_add_timer(GtkVScrollbutton *scrollbutton)
+{
+    g_return_if_fail(scrollbutton != NULL);
+    g_return_if_fail(GTK_IS_VSCROLLBUTTON(scrollbutton));
+
+    if (!scrollbutton->timer) {
+       scrollbutton->need_timer = TRUE;
+       scrollbutton->timer = gtk_timeout_add(SCROLL_INITIAL_DELAY,
+                                             (GtkFunction)
+                                             gtk_vscrollbutton_timer_1st_time,
+                                             scrollbutton);
+    }
+}
+
+static void gtk_vscrollbutton_remove_timer(GtkVScrollbutton *scrollbutton)
+{
+    g_return_if_fail(scrollbutton != NULL);
+    g_return_if_fail(GTK_IS_VSCROLLBUTTON(scrollbutton));
+
+    if (scrollbutton->timer) {
+       gtk_timeout_remove(scrollbutton->timer);
+       scrollbutton->timer = 0;
+    }
+    scrollbutton->need_timer = FALSE;
+}
+
+static gint gtk_real_vscrollbutton_timer(GtkVScrollbutton *scrollbutton)
+{
+    gint return_val;
+
+    GDK_THREADS_ENTER();
+
+    return_val = TRUE;
+    if (!scrollbutton->timer) {
+       return_val = FALSE;
+       if (scrollbutton->need_timer)
+           scrollbutton->timer =
+               gtk_timeout_add(SCROLL_TIMER_LENGTH, 
+                               (GtkFunction) gtk_real_vscrollbutton_timer,
+                               (gpointer) scrollbutton);
+       else {
+           GDK_THREADS_LEAVE();
+           return FALSE;
+       }
+       scrollbutton->need_timer = FALSE;
+    }
+    GDK_THREADS_LEAVE();
+    return_val = gtk_vscrollbutton_scroll(scrollbutton);
+    return return_val;
+}
diff --git a/src/gtk/gtkvscrollbutton.h b/src/gtk/gtkvscrollbutton.h
new file mode 100644 (file)
index 0000000..08a63ee
--- /dev/null
@@ -0,0 +1,84 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+ /*
+  * Modified by the Sylpheed Team and others 2003
+  */
+
+#ifndef __GTK_VSCROLLBUTTON_H__
+#define __GTK_VSCROLLBUTTON_H__
+
+
+#include <gdk/gdk.h>
+#include <gtk/gtkwidget.h>
+#include <gtk/gtkvbox.h>
+
+
+#define GTK_TYPE_VSCROLLBUTTON            (gtk_vscrollbutton_get_type ())
+#define GTK_VSCROLLBUTTON(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_VSCROLLBUTTON, GtkVScrollbutton))
+#define GTK_VSCROLLBUTTON_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_VSCROLLBUTTON, GtkVScrollbuttonClass))
+#define GTK_IS_VSCROLLBUTTON(obj)         (GTK_CHECK_TYPE ((obj), GTK_TYPE_VSCROLLBUTTON))
+#define GTK_IS_VSCROLLBUTTON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_VSCROLLBUTTON))
+
+typedef struct _GtkVScrollbutton       GtkVScrollbutton;
+typedef struct _GtkVScrollbuttonClass  GtkVScrollbuttonClass;
+
+struct _GtkVScrollbutton
+{
+       GtkVBox vbox;
+       GtkWidget *upbutton;
+       GtkWidget *downbutton;
+       guint need_timer : 1;
+       guint32 timer;
+       GtkAdjustment *adjustment;
+       gint button;
+       GtkScrollType scroll_type;
+
+};
+
+struct _GtkVScrollbuttonClass
+{
+       GtkVBoxClass parent_class;
+};
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+GtkType    gtk_vscrollbutton_get_type (void);
+GtkWidget* gtk_vscrollbutton_new      (GtkAdjustment *adjustment);
+
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __GTK_VSCROLLBUTTON_H__ */
index 8f41f3c..353ba8a 100644 (file)
@@ -759,6 +759,7 @@ void messageview_reflect_prefs_pixmap_theme(void)
        for (cur = msgview_list; cur != NULL; cur = cur->next) {
                msgview = (MessageView*)cur->data;
                toolbar_update(TOOLBAR_MSGVIEW, msgview);
+               mimeview_update(msgview->mimeview);
        }
 }
 
index eee0f61..c7bb05f 100644 (file)
 #include <gtk/gtkscrolledwindow.h>
 #include <gtk/gtkctree.h>
 #include <gtk/gtkvbox.h>
-#include <gtk/gtkvpaned.h>
+#include <gtk/gtkhpaned.h>
 #include <gtk/gtktext.h>
 #include <gtk/gtksignal.h>
 #include <gtk/gtkmenu.h>
 #include <gtk/gtkdnd.h>
 #include <gtk/gtkselection.h>
+#include <gtk/gtktooltips.h>
+#include <gtk/gtkcontainer.h>
 #include <stdio.h>
 
 #ifndef HAVE_APACHE_FNMATCH
@@ -58,6 +60,8 @@
 #include "prefs_common.h"
 #include "rfc2015.h"
 #include "stock_pixmap.h"
+#include "gtk/gtkvscrollbutton.h"
+
 
 typedef enum
 {
@@ -67,6 +71,7 @@ typedef enum
 } MimeViewColumnPos;
 
 #define N_MIMEVIEW_COLS        3
+#define ICONBOX_DEFAULT_WIDTH 36
 
 static void mimeview_set_multipart_tree                (MimeView       *mimeview,
                                                 MimeInfo       *mimeinfo,
@@ -110,6 +115,22 @@ static void mimeview_open_with             (MimeView       *mimeview);
 static void mimeview_view_file         (const gchar    *filename,
                                         MimeInfo       *partinfo,
                                         const gchar    *cmdline);
+static gboolean icon_clicked_cb                (GtkWidget      *button, 
+                                        GdkEventButton *event, 
+                                        MimeView       *mimeview);
+static void icon_list_append_icon      (MimeView       *mimeview, 
+                                        MimeInfo       *mimeinfo);
+static void icon_list_create           (MimeView       *mimeview, 
+                                        MimeInfo       *mimeinfo);
+static void icon_list_clear            (MimeView       *mimeview);
+static void mime_toggle_button_cb      (GtkWidget      *button,
+                                        MimeView       *mimeview);
+static void part_button_pressed                (MimeView       *mimeview, 
+                                        GdkEventButton *event, 
+                                        MimeInfo       *partinfo);
+static void icon_scroll_size_allocate_cb(GtkWidget     *widget, 
+                                        GtkAllocation  *layout_size, 
+                                        MimeView       *mimeview);
 
 static GtkItemFactoryEntry mimeview_popup_entries[] =
 {
@@ -143,7 +164,14 @@ MimeView *mimeview_create(MainWindow *mainwin)
        GtkWidget *ctree;
        GtkWidget *mime_notebook;
        GtkWidget *popupmenu;
-       GtkWidget *icon;
+       GtkWidget *ctree_mainbox;
+       GtkWidget *mime_toggle;
+       GtkWidget *icon_mainbox;
+       GtkWidget *icon_scroll;
+       GtkWidget *icon_vbox;
+       GtkWidget *arrow;
+       GtkWidget *scrollbutton;
+       GtkTooltips *tooltips;
        GtkItemFactory *popupfactory;
        gchar *titles[N_MIMEVIEW_COLS];
        gint n_entries;
@@ -158,26 +186,25 @@ MimeView *mimeview_create(MainWindow *mainwin)
 
        notebook = gtk_notebook_new();
        gtk_notebook_set_scrollable(GTK_NOTEBOOK(notebook), TRUE);
+       gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
+       gtk_notebook_set_show_border(GTK_NOTEBOOK(notebook), FALSE);
 
        vbox = gtk_vbox_new(FALSE, 0);
        gtk_container_add(GTK_CONTAINER(notebook), vbox);
-       icon = stock_pixmap_widget(mainwin->window, STOCK_PIXMAP_MESSAGEVIEW_TEXT); 
-       gtk_widget_show(icon);
-       gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook), vbox, icon);
        
        scrolledwin = gtk_scrolled_window_new(NULL, NULL);
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
                                       GTK_POLICY_AUTOMATIC,
                                       GTK_POLICY_ALWAYS);
-       gtk_widget_set_usize(scrolledwin, -1, 80);
 
        ctree = gtk_sctree_new_with_titles(N_MIMEVIEW_COLS, 0, titles);
        gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_BROWSE);
        gtk_ctree_set_line_style(GTK_CTREE(ctree), GTK_CTREE_LINES_NONE);
        gtk_clist_set_column_justification(GTK_CLIST(ctree), COL_SIZE,
                                           GTK_JUSTIFY_RIGHT);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), COL_MIMETYPE, 240);
-       gtk_clist_set_column_width(GTK_CLIST(ctree), COL_SIZE, 64);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), COL_MIMETYPE, 200);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), COL_SIZE, 50);
+       gtk_clist_set_column_width(GTK_CLIST(ctree), COL_NAME, 200);
        for (i = 0; i < N_MIMEVIEW_COLS; i++)
                GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(ctree)->column[i].button,
                                       GTK_CAN_FOCUS);
@@ -199,24 +226,52 @@ MimeView *mimeview_create(MainWindow *mainwin)
         GTK_WIDGET_UNSET_FLAGS(mime_notebook, GTK_CAN_FOCUS);
         gtk_notebook_set_show_tabs(GTK_NOTEBOOK(mime_notebook), FALSE);
         gtk_notebook_set_show_border(GTK_NOTEBOOK(mime_notebook), FALSE);
+       
+       gtk_container_add(GTK_CONTAINER(notebook), mime_notebook);
+       gtk_notebook_set_page(GTK_NOTEBOOK(notebook), 0);
+                               
+       icon_vbox = gtk_vbox_new(FALSE,0);
+       icon_scroll = gtk_layout_new(NULL, NULL);
+       gtk_layout_put(GTK_LAYOUT(icon_scroll), icon_vbox, 0, 0);
+       scrollbutton = gtk_vscrollbutton_new(gtk_layout_get_vadjustment(GTK_LAYOUT(icon_scroll)));
+
+       mime_toggle = gtk_toggle_button_new();
+       arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
+       gtk_widget_show(arrow);
+       gtk_container_add(GTK_CONTAINER(mime_toggle), arrow);
+       gtk_signal_connect(GTK_OBJECT(mime_toggle), "toggled", 
+                          GTK_SIGNAL_FUNC(mime_toggle_button_cb), mimeview);
+
+       icon_mainbox = gtk_vbox_new(FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(icon_mainbox), mime_toggle, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(icon_mainbox), icon_scroll, TRUE, TRUE, 3);
+       gtk_box_pack_end(GTK_BOX(icon_mainbox), scrollbutton, FALSE, FALSE, 0);
+       gtk_signal_connect(GTK_OBJECT(icon_mainbox), "size_allocate", 
+                       GTK_SIGNAL_FUNC(icon_scroll_size_allocate_cb), mimeview);
+       gtk_widget_set_usize(icon_mainbox, ICONBOX_DEFAULT_WIDTH, -1);
+       
+       ctree_mainbox = gtk_vbox_new(FALSE, 0); 
+       gtk_box_pack_start(GTK_BOX(ctree_mainbox), scrolledwin, TRUE, TRUE, 0);
+
+       n_entries = sizeof(mimeview_popup_entries) /
+               sizeof(mimeview_popup_entries[0]);
+       popupmenu = menu_create_items(mimeview_popup_entries, n_entries,
+                                     "<MimeView>", &popupfactory, mimeview);
+       tooltips = gtk_tooltips_new();
+       gtk_tooltips_set_delay(tooltips, 0); 
+
+       paned = gtk_hpaned_new();
+       gtk_paned_set_gutter_size(GTK_PANED(paned), 0);
+       gtk_paned_pack1(GTK_PANED(paned), notebook, TRUE, TRUE);
+       gtk_paned_pack2(GTK_PANED(paned), icon_mainbox, FALSE, FALSE);
+       
+       
+       gtk_widget_ref(icon_mainbox);
+       gtk_widget_ref(ctree_mainbox);
 
-       paned = gtk_vpaned_new();
-       gtk_paned_add1(GTK_PANED(paned), scrolledwin);
-       gtk_paned_add2(GTK_PANED(paned), mime_notebook);
-       gtk_container_add(GTK_CONTAINER(notebook), paned);
-       icon = stock_pixmap_widget(mainwin->window, STOCK_PIXMAP_CLIP); 
-       gtk_widget_show(icon);
-       gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook), paned, icon);
-       gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_RIGHT);
-
-       gtk_widget_show_all(notebook);
-
-       gtk_notebook_set_page(GTK_NOTEBOOK(notebook), 0);
-
-       n_entries = sizeof(mimeview_popup_entries) /
-               sizeof(mimeview_popup_entries[0]);
-       popupmenu = menu_create_items(mimeview_popup_entries, n_entries,
-                                     "<MimeView>", &popupfactory, mimeview);
+       gtk_widget_show_all(paned);
+       gtk_widget_show_all(icon_mainbox);
+       gtk_widget_show_all(ctree_mainbox);
 
        mimeview->notebook      = notebook;
        mimeview->vbox          = vbox;
@@ -227,6 +282,14 @@ MimeView *mimeview_create(MainWindow *mainwin)
        mimeview->popupmenu     = popupmenu;
        mimeview->popupfactory  = popupfactory;
        mimeview->type          = -1;
+       mimeview->ctree_mainbox = ctree_mainbox;
+       mimeview->icon_scroll   = icon_scroll;
+       mimeview->icon_vbox     = icon_vbox;
+       mimeview->icon_mainbox  = icon_mainbox;
+       mimeview->icon_count    = 0;
+       mimeview->mainwin       = mainwin;
+       mimeview->tooltips      = tooltips;
+       mimeview->oldsize       = 160;
 
        mimeview->target_list   = gtk_target_list_new(mimeview_mime_types, 1); 
        
@@ -326,6 +389,7 @@ void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
                                         mimeview);
 
        mimeview_set_multipart_tree(mimeview, mimeinfo, NULL);
+       icon_list_create(mimeview, mimeinfo);
 
        gtk_signal_handler_unblock_by_func(GTK_OBJECT(ctree),
                                           mimeview_selected, mimeview);
@@ -371,6 +435,9 @@ void mimeview_destroy(MimeView *mimeview)
        g_free(mimeview);
 
        mimeviews = g_slist_remove(mimeviews, mimeview);
+       
+       gtk_widget_unref(mimeview->icon_mainbox);
+       gtk_widget_unref(mimeview->ctree_mainbox);
 }
 
 MimeInfo *mimeview_get_selected_part(MimeView *mimeview)
@@ -631,6 +698,7 @@ static void mimeview_clear(MimeView *mimeview)
 
        g_free(mimeview->file);
        mimeview->file = NULL;
+       icon_list_clear(mimeview);
 
        /* gtk_notebook_set_page(GTK_NOTEBOOK(mimeview->notebook), 0); */
 }
@@ -702,7 +770,6 @@ static gint mimeview_button_pressed(GtkWidget *widget, GdkEventButton *event,
                                    MimeView *mimeview)
 {
        GtkCList *clist = GTK_CLIST(widget);
-       MimeInfo *partinfo;
        gint row, column;
 
        if (!event) return FALSE;
@@ -715,13 +782,19 @@ static gint mimeview_button_pressed(GtkWidget *widget, GdkEventButton *event,
                gtk_clist_select_row(clist, row, column);
                gtkut_clist_set_focus_row(clist, row);
        }
+       part_button_pressed(mimeview, event, mimeview_get_selected_part(mimeview));
+
+       return TRUE;
+}
 
+static void part_button_pressed(MimeView *mimeview, GdkEventButton *event, 
+                               MimeInfo *partinfo)
+{
        if (event->button == 2 ||
            (event->button == 1 && event->type == GDK_2BUTTON_PRESS)) {
                /* call external program for image, audio or html */
                mimeview_launch(mimeview);
        } else if (event->button == 3) {
-               partinfo = mimeview_get_selected_part(mimeview);
                if (partinfo && (partinfo->mime_type == MIME_TEXT ||
                                 partinfo->mime_type == MIME_TEXT_HTML ||
                                 partinfo->mime_type == MIME_TEXT_ENRICHED ||
@@ -752,9 +825,9 @@ static gint mimeview_button_pressed(GtkWidget *widget, GdkEventButton *event,
                               event->button, event->time);
        }
 
-       return TRUE;
 }
 
+
 void mimeview_pass_key_press_event(MimeView *mimeview, GdkEventKey *event)
 {
        mimeview_key_pressed(mimeview->ctree, event, mimeview);
@@ -1198,3 +1271,245 @@ void mimeview_unregister_viewer_factory(MimeViewerFactory *factory)
 
        mimeviewer_factories = g_slist_remove(mimeviewer_factories, factory);
 }
+
+static gboolean icon_clicked_cb (GtkWidget *button, GdkEventButton *event, MimeView *mimeview)
+{
+       gint num;
+       MimeInfo *partinfo;
+       GtkCTreeNode *node;
+       num = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(button), "icon_number"));
+       partinfo = gtk_object_get_data(GTK_OBJECT(button), "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 {
+               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);
+       }
+       part_button_pressed(mimeview, event, partinfo);
+       return TRUE;
+}
+
+static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo) 
+{
+       GtkWidget *pixmap;
+       GtkWidget *vbox;
+       GtkWidget *icon_scroll = mimeview->icon_scroll;
+       GtkWidget *button;
+       GtkWidget *sep;
+       GtkTooltips *tooltips = mimeview->tooltips;
+       gchar *tip;
+       gchar *desc = NULL;
+       gint width;
+       StockPixmap stockp;
+       
+       vbox = mimeview->icon_vbox;
+       mimeview->icon_count++;
+       if (mimeview->icon_count > 1) {
+               sep = gtk_hseparator_new();
+               gtk_widget_show(sep);
+               gtk_widget_set_usize(sep, ICONBOX_DEFAULT_WIDTH, -1);
+               gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 3);
+       }
+       button = gtk_event_box_new();
+       gtk_object_set_data(GTK_OBJECT(button), "icon_number", 
+               GINT_TO_POINTER(mimeview->icon_count));
+       gtk_object_set_data(GTK_OBJECT(button), "partinfo", 
+               mimeinfo);
+       
+       switch (mimeinfo->mime_type) {
+               
+       case MIME_TEXT:
+       case MIME_MESSAGE_RFC822:
+               stockp = STOCK_PIXMAP_MIME_TEXT_PLAIN;
+               break;
+       case MIME_TEXT_HTML:
+               stockp = STOCK_PIXMAP_MIME_TEXT_HTML;
+               break;
+       case MIME_APPLICATION:
+#ifdef USE_GPGME       
+               if (mimeinfo->content_type
+                       &&  g_strcasecmp(mimeinfo->content_type, 
+                                        "application/pgp-signature")  == 0) {
+                       if (mimeinfo->sigstatus_full) {
+                               desc = mimeinfo->sigstatus;
+                               if (mimeinfo->sig_ok)
+                                       stockp = STOCK_PIXMAP_MIME_GPG_PASSED;
+                               else
+                                       stockp = STOCK_PIXMAP_MIME_GPG_FAILED;
+                       } else
+                               stockp = STOCK_PIXMAP_MIME_GPG_SIGNED;
+               } else
+#endif 
+                       stockp = STOCK_PIXMAP_MIME_APPLICATION;
+               break;
+       case MIME_APPLICATION_OCTET_STREAM:
+               stockp = STOCK_PIXMAP_MIME_APPLICATION_OCTET_STREAM;
+               break;
+       case MIME_IMAGE:
+               stockp = STOCK_PIXMAP_MIME_IMAGE;
+               break;
+       case MIME_AUDIO:
+               stockp = STOCK_PIXMAP_MIME_AUDIO;
+               break;
+       case MIME_TEXT_ENRICHED:
+               stockp = STOCK_PIXMAP_MIME_TEXT_ENRICHED;
+               break;
+       default:
+               stockp = STOCK_PIXMAP_MIME_UNKNOWN;
+               break;
+       }
+       
+       pixmap = stock_pixmap_widget(mimeview->mainwin->window, stockp);
+       gtk_container_add(GTK_CONTAINER(button), pixmap);
+       
+       width = MAX(ICONBOX_DEFAULT_WIDTH, pixmap->requisition.width);
+       if (width > mimeview->icon_mainbox->requisition.width) {
+               gtk_widget_set_usize(mimeview->icon_mainbox, 
+                                    width, -1);
+       }
+       if (!desc) {
+               if (prefs_common.attach_desc)
+                       desc = get_part_description(mimeinfo);
+               else
+                       desc = get_part_name(mimeinfo);
+       }
+       if (desc && *desc)
+               tip = g_strdup_printf("%s\n%s\n%s", desc, mimeinfo->content_type, 
+                               to_human_readable(mimeinfo->size), NULL);
+       else            
+               tip = g_strdup_printf("%s\n%s", mimeinfo->content_type, 
+                               to_human_readable(mimeinfo->size), NULL);
+
+       gtk_tooltips_set_tip(mimeview->tooltips, button, tip, NULL);
+       g_free(tip);
+       gtk_widget_show_all(button);
+       gtk_signal_connect(GTK_OBJECT(button), "button_press_event", 
+                          GTK_SIGNAL_FUNC(icon_clicked_cb), mimeview);
+       gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
+       
+}
+
+static void icon_list_clear (MimeView *mimeview)
+{
+       GtkWidget *wid;
+       GList     *child;
+       GtkAdjustment *adj;
+       
+       child = gtk_container_children(GTK_CONTAINER(mimeview->icon_vbox));
+       for (; child != NULL; child = g_list_next(child)) {
+               gtkut_container_remove(GTK_CONTAINER(mimeview->icon_vbox), 
+                                      GTK_WIDGET(child->data));
+       }
+       mimeview->icon_count = 0;
+       adj  = gtk_layout_get_vadjustment(GTK_LAYOUT(mimeview->icon_scroll));
+       adj->value = 0;
+       gtk_adjustment_value_changed(adj);
+       gtk_signal_handler_block_by_func(GTK_OBJECT(mimeview->icon_mainbox),
+               GTK_SIGNAL_FUNC(icon_scroll_size_allocate_cb), mimeview);
+       gtk_widget_set_usize(mimeview->icon_mainbox, ICONBOX_DEFAULT_WIDTH, -1);
+       gtk_signal_handler_unblock_by_func(GTK_OBJECT(mimeview->icon_mainbox),
+               GTK_SIGNAL_FUNC(icon_scroll_size_allocate_cb), mimeview);
+       
+}
+
+static void icon_scroll_size_allocate_cb(GtkWidget *widget, 
+                                       GtkAllocation *size, MimeView *mimeview)
+{
+       GtkAllocation *mainbox_size;
+       GtkAllocation *vbox_size;
+       GtkAllocation *layout_size;
+       GtkAdjustment *adj;
+       GtkWidget     *wid;
+       
+       adj = gtk_layout_get_vadjustment(GTK_LAYOUT(mimeview->icon_scroll));
+
+       mainbox_size = &mimeview->icon_mainbox->allocation;
+       vbox_size = &mimeview->icon_vbox->allocation;
+       layout_size = &mimeview->icon_scroll->allocation;
+       
+       /* centralise the vbox */
+       gtk_layout_move(GTK_LAYOUT(mimeview->icon_scroll), mimeview->icon_vbox, 
+                       (mainbox_size->width - vbox_size->width)/2, 0);
+       
+       gtk_layout_set_size(GTK_LAYOUT(mimeview->icon_scroll), GTK_LAYOUT(mimeview->icon_scroll)->width, MAX(vbox_size->height, layout_size->height));
+       adj->step_increment = 5;
+}
+
+static void icon_list_create(MimeView *mimeview, MimeInfo *mimeinfo)
+{
+       g_return_if_fail(mimeinfo != NULL);
+
+       if (mimeinfo->children)
+               mimeinfo = mimeinfo->children;
+
+       while (mimeinfo != NULL) {
+               if (mimeinfo->children)
+                       icon_list_create(mimeview, mimeinfo);
+               else if (mimeinfo->sub &&
+                        mimeinfo->sub->mime_type != MIME_TEXT &&
+                        mimeinfo->sub->mime_type != MIME_TEXT_HTML)
+                       icon_list_create(mimeview, mimeinfo->sub);
+               else 
+                       icon_list_append_icon(mimeview, mimeinfo);
+               mimeinfo = mimeinfo->next;
+       }
+}
+
+static void mime_toggle_button_cb (GtkWidget *button, MimeView *mimeview) 
+{
+       GtkWidget *paned = mimeview->paned;
+       gtk_widget_ref(button); 
+
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) {
+               gtk_arrow_set(GTK_ARROW(GTK_BIN(button)->child), GTK_ARROW_RIGHT, 
+                                       GTK_SHADOW_NONE);
+               gtkut_container_remove(GTK_CONTAINER(paned), 
+                                      mimeview->icon_mainbox);
+               gtk_paned_pack2(GTK_PANED(paned), 
+                               mimeview->ctree_mainbox, 
+                               FALSE, TRUE);
+               gtk_paned_set_gutter_size(GTK_PANED(paned), -1);
+               gtk_widget_set_usize(mimeview->ctree_mainbox, mimeview->oldsize, -1);
+               gtk_paned_set_position(GTK_PANED(paned),  paned->allocation.width 
+                                      - mimeview->oldsize
+                                      - GTK_PANED (paned)->gutter_size);
+               
+               gtkut_container_remove(GTK_CONTAINER(mimeview->icon_mainbox), 
+                                       button);
+               gtk_box_pack_start(GTK_BOX(mimeview->ctree_mainbox), 
+                                  button, FALSE, FALSE, 0);
+               gtk_notebook_set_page(GTK_NOTEBOOK(mimeview->notebook), 1); 
+       } else {
+               gtk_arrow_set(GTK_ARROW(GTK_BIN(button)->child), GTK_ARROW_LEFT, 
+                             GTK_SHADOW_NONE);
+               mimeview->oldsize = mimeview->ctree_mainbox->allocation.width;
+               gtkut_container_remove(GTK_CONTAINER(paned), 
+                                      mimeview->ctree_mainbox);
+               gtk_paned_pack2(GTK_PANED(paned), mimeview->icon_mainbox, 
+                               FALSE, FALSE);
+               gtk_paned_set_gutter_size(GTK_PANED(paned), 0);
+               gtk_paned_set_position(GTK_PANED(paned), -1);
+
+               gtkut_container_remove(GTK_CONTAINER(mimeview->ctree_mainbox), 
+                                       button);
+               gtk_box_pack_start(GTK_BOX(mimeview->icon_mainbox), 
+                                  button, FALSE, FALSE, 0);
+       }
+               
+       gtk_widget_unref(button);
+       gtk_box_reorder_child(GTK_BOX(button->parent), button, 0);
+
+}
+
+void mimeview_update (MimeView *mimeview) {
+       if (mimeview && mimeview->mimeinfo) {
+               icon_list_clear(mimeview);
+               icon_list_create(mimeview, mimeview->mimeinfo);
+       }
+}
index 997c5c7..67f00df 100644 (file)
@@ -28,6 +28,7 @@ extern "C" {
 #include <gdk/gdk.h>
 #include <gtk/gtkwidget.h>
 #include <gtk/gtkctree.h>
+#include <gtk/gtktooltips.h>
 
 typedef struct _MimeView               MimeView;
 typedef struct _MimeViewerFactory      MimeViewerFactory;
@@ -45,13 +46,16 @@ typedef enum
 
 struct _MimeView
 {
+       GtkWidget *paned;
        GtkWidget *notebook;
        GtkWidget *vbox;
-
-       GtkWidget *paned;
        GtkWidget *scrolledwin;
        GtkWidget *ctree;
        GtkWidget *mime_notebook;
+       GtkWidget *ctree_mainbox;
+       GtkWidget *icon_scroll;
+       GtkWidget *icon_vbox;
+       GtkWidget *icon_mainbox;
 
        MimeViewType type;
 
@@ -72,6 +76,11 @@ struct _MimeView
        GSList *viewers;
 
        GtkTargetList *target_list; /* DnD */
+
+       gint icon_count;
+       MainWindow *mainwin;
+       GtkTooltips *tooltips;
+       gint oldsize;
 };
 
 struct _MimeViewerFactory
@@ -102,6 +111,7 @@ void mimeview_show_message  (MimeView       *mimeview,
                                 MimeInfo       *mimeinfo,
                                 const gchar    *file);
 void mimeview_destroy          (MimeView       *mimeview);
+void mimeview_update           (MimeView       *mimeview);
 
 MimeInfo *mimeview_get_selected_part   (MimeView       *mimeview);
 
@@ -114,6 +124,7 @@ void mimeview_pass_key_press_event  (MimeView       *mimeview,
 void mimeview_register_viewer_factory  (MimeViewerFactory *factory);
 void mimeview_unregister_viewer_factory        (MimeViewerFactory *factory);
 
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/src/pixmaps/mime_application.xpm b/src/pixmaps/mime_application.xpm
new file mode 100644 (file)
index 0000000..ee933aa
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char * mime_application_xpm[] = {
+"14 18 4 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #000000",
+"..............",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".+++@@@++++++.",
+".++@+++@+++++.",
+".++@+++@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@+@@+@+++++.",
+".+@++++@+++++.",
+".+@++++@+++++.",
+".++@@@@++++++.",
+".++++++++++++.",
+".............."};
diff --git a/src/pixmaps/mime_application_octect_stream.xpm b/src/pixmaps/mime_application_octect_stream.xpm
new file mode 100644 (file)
index 0000000..d5b7170
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char * mime_application_octect_stream_xpm[] = {
+"14 18 4 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #000000",
+"..............",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".+++@@@++++++.",
+".++@+++@+++++.",
+".++@+++@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@+@@+@+++++.",
+".+@++++@+++++.",
+".+@++++@+++++.",
+".++@@@@++++++.",
+".++++++++++++.",
+".............."};
diff --git a/src/pixmaps/mime_audio.xpm b/src/pixmaps/mime_audio.xpm
new file mode 100644 (file)
index 0000000..58eab2d
--- /dev/null
@@ -0,0 +1,118 @@
+/* XPM */
+static char * mime_audio_xpm[] = {
+"14 18 97 2",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #F1F1F1",
+"#     c #CDCDCD",
+"$     c #C9C9C9",
+"%     c #EDEDED",
+"&     c #F4F4F4",
+"*     c #F5F5F5",
+"=     c #F6F6F6",
+"-     c #F2F2F2",
+";     c #D9D9DA",
+">     c #4277AE",
+",     c #3380D0",
+"'     c #2B6CAF",
+")     c #3E71A7",
+"!     c #5A7FA7",
+"~     c #7690AC",
+"{     c #B3BAC0",
+"]     c #F3F3F3",
+"^     c #B3BDC7",
+"/     c #27619E",
+"(     c #1C446E",
+"_     c #275C94",
+":     c #2C6DB0",
+"<     c #3483D5",
+"[     c #3C95F2",
+"}     c #6085AC",
+"|     c #7C92AA",
+"1     c #479CF4",
+"2     c #3E8EE2",
+"3     c #3176BF",
+"4     c #2A63A0",
+"5     c #1D4978",
+"6     c #2865A4",
+"7     c #99A3AE",
+"8     c #E4E4E4",
+"9     c #5C82A9",
+"0     c #6684A2",
+"a     c #6988A8",
+"b     c #4D79A8",
+"c     c #326EAC",
+"d     c #317AC8",
+"e     c #2E74BE",
+"f     c #DFE1E3",
+"g     c #CFD3D7",
+"h     c #5F82A7",
+"i     c #CFD0D1",
+"j     c #F9F9F9",
+"k     c #FAFAFA",
+"l     c #8093A6",
+"m     c #4F79A5",
+"n     c #F7F7F7",
+"o     c #DCDCDC",
+"p     c #8090A1",
+"q     c #768AA0",
+"r     c #6D7B89",
+"s     c #7F94AB",
+"t     c #FBFBFB",
+"u     c #FCFCFC",
+"v     c #567FAA",
+"w     c #8A9AAC",
+"x     c #FDFDFD",
+"y     c #6283A5",
+"z     c #73B4F8",
+"A     c #93C5FA",
+"B     c #ABCDF0",
+"C     c #A9B0B7",
+"D     c #F0F0F0",
+"E     c #909DAA",
+"F     c #6A8FB6",
+"G     c #57799C",
+"H     c #356EA8",
+"I     c #CBD0D4",
+"J     c #6088B1",
+"K     c #79B7F9",
+"L     c #9DCBFA",
+"M     c #A0B6CD",
+"N     c #CBCBCC",
+"O     c #B4BABF",
+"P     c #91BAE4",
+"Q     c #7DB9F9",
+"R     c #5EA9F7",
+"S     c #5283B5",
+"T     c #C6C8CA",
+"U     c #778BA0",
+"V     c #8293A4",
+"W     c #B3B6B8",
+"X     c #C2C6CA",
+"Y     c #84ACD6",
+"Z     c #78B7F8",
+"`     c #559BE4",
+" .    c #8A9AAB",
+"..    c #FEFEFE",
+"+.    c #BBBDC0",
+"@.    c #99A7B5",
+"#.    c #ADB2B6",
+". . . . . . . . . . . . . . ",
+". + + + + + + + + + + + + . ",
+". + + + + + + + + + + + + . ",
+". + + + + @ # $ % & & * = . ",
+". + + + - ; > , ' ) ! ~ { . ",
+". + + + ] ^ / ( _ : < [ } . ",
+". + + + & | 1 2 3 4 5 6 7 . ",
+". + & * 8 9 0 a b c d e f . ",
+". * = = g h i j k k l m n . ",
+". o p q r s * k t u v w x . ",
+". y z A B C D E F G H I + . ",
+". J K L M N O P Q R S ] + . ",
+". T U V W x X Y Z `  ...+ . ",
+". + + x ....x +.@.#.j + + . ",
+". + + + + + + + + + + + + . ",
+". + + + + + + + + + + + + . ",
+". + + + + + + + + + + + + . ",
+". . . . . . . . . . . . . . "};
diff --git a/src/pixmaps/mime_gpg_failed.xpm b/src/pixmaps/mime_gpg_failed.xpm
new file mode 100644 (file)
index 0000000..3fb8c78
--- /dev/null
@@ -0,0 +1,52 @@
+/* XPM */
+static char * mime_gpg_failed_xpm[] = {
+"16 18 31 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #D39C0A",
+"#     c #E4AB0B",
+"$     c #DA7D25",
+"%     c #E4B600",
+"&     c #E96B00",
+"*     c #FF0000",
+"=     c #E9AD00",
+"-     c #E94500",
+";     c #000000",
+">     c #E7BC01",
+",     c #E99400",
+"'     c #E02F00",
+")     c #E9BD00",
+"!     c #E97800",
+"~     c #CA2B04",
+"{     c #E7C50E",
+"]     c #E9B802",
+"^     c #E55902",
+"/     c #E9CE07",
+"(     c #E9AB06",
+"_     c #D64707",
+":     c #E9CF16",
+"<     c #E69E0E",
+"[     c #C86B37",
+"}     c #999999",
+"|     c #E6CF8D",
+"1     c #C47535",
+"2     c #853823",
+"..............  ",
+".++++++++++++.  ",
+".++++++++++++.  ",
+".++++++++++++.  ",
+".++++++++++++.  ",
+".++++++++++++.  ",
+".+++@#$++++++.  ",
+".+++%&*+++**+.  ",
+".+++=-**+***;.  ",
+".++>,'+****;;.  ",
+".++)!~++**;;+.  ",
+".+{]^++****++.  ",
+".+/(_++*****+.  ",
+".+:<[+**;;**}.  ",
+".+|1++*;;++*;}  ",
+".+2++++;++++;.  ",
+".++++++++++++.  ",
+"..............  "};
diff --git a/src/pixmaps/mime_gpg_passed.xpm b/src/pixmaps/mime_gpg_passed.xpm
new file mode 100644 (file)
index 0000000..15bc2b6
--- /dev/null
@@ -0,0 +1,53 @@
+/* XPM */
+static char * mime_gpg_passed_xpm[] = {
+"16 18 32 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #D39C0A",
+"#     c #E4AB0B",
+"$     c #DA7D25",
+"%     c #E4B600",
+"&     c #E96B00",
+"*     c #DA2D01",
+"=     c #00AA02",
+"-     c #E9AD00",
+";     c #E94500",
+">     c #B11E04",
+",     c #000000",
+"'     c #E7BC01",
+")     c #E99400",
+"!     c #E02F00",
+"~     c #E9BD00",
+"{     c #E97800",
+"]     c #CA2B04",
+"^     c #E7C50E",
+"/     c #E9B802",
+"(     c #E55902",
+"_     c #E9CE07",
+":     c #E9AB06",
+"<     c #D64707",
+"[     c #E9CF16",
+"}     c #E69E0E",
+"|     c #C86B37",
+"1     c #E6CF8D",
+"2     c #C47535",
+"3     c #853823",
+"..............  ",
+".++++++++++++.  ",
+".++++++++++++.  ",
+".++++++++++++.  ",
+".++++++++++++.  ",
+".++++++++++++.  ",
+".+++@#$++++++.  ",
+".+++%&*++++++=  ",
+".+++-;>+++++==, ",
+".++')!+++++===, ",
+".++~{]=+++===,, ",
+".+^/(===+===,,  ",
+".+_:<+=====,,.  ",
+".+[}|++===,,+.  ",
+".+12++++=,,++.  ",
+".+3++++++,+++.  ",
+".++++++++++++.  ",
+"..............  "};
diff --git a/src/pixmaps/mime_gpg_signed.xpm b/src/pixmaps/mime_gpg_signed.xpm
new file mode 100644 (file)
index 0000000..f7a05b4
--- /dev/null
@@ -0,0 +1,51 @@
+/* XPM */
+static char * mime_gpg_signed_xpm[] = {
+"14 18 30 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #D39C0A",
+"#     c #E4AB0B",
+"$     c #DA7D25",
+"%     c #E4B600",
+"&     c #E96B00",
+"*     c #DA2D01",
+"=     c #E9AD00",
+"-     c #E94500",
+";     c #B11E04",
+">     c #E7BC01",
+",     c #E99400",
+"'     c #E02F00",
+")     c #E9BD00",
+"!     c #E97800",
+"~     c #CA2B04",
+"{     c #E7C50E",
+"]     c #E9B802",
+"^     c #E55902",
+"/     c #E9CE07",
+"(     c #E9AB06",
+"_     c #D64707",
+":     c #E9CF16",
+"<     c #E69E0E",
+"[     c #C86B37",
+"}     c #E6CF8D",
+"|     c #C47535",
+"1     c #853823",
+"..............",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".+++@#$++++++.",
+".+++%&*++++++.",
+".+++=-;++++++.",
+".++>,'+++++++.",
+".++)!~+++++++.",
+".+{]^++++++++.",
+".+/(_++++++++.",
+".+:<[++++++++.",
+".+}|+++++++++.",
+".+1++++++++++.",
+".++++++++++++.",
+".............."};
diff --git a/src/pixmaps/mime_image.xpm b/src/pixmaps/mime_image.xpm
new file mode 100644 (file)
index 0000000..d6f9a11
--- /dev/null
@@ -0,0 +1,159 @@
+/* XPM */
+static char * mime_image_xpm[] = {
+"15 18 138 2",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #9F9F9F",
+"#     c #525252",
+"$     c #979797",
+"%     c #505050",
+"&     c #ADADAD",
+"*     c #A9A9A9",
+"=     c #606060",
+"-     c #777777",
+";     c #BABABA",
+">     c #6C6C6C",
+",     c #5A5A5A",
+"'     c #E3E3E3",
+")     c #CACACA",
+"!     c #757575",
+"~     c #747474",
+"{     c #74726D",
+"]     c #B7B5AF",
+"^     c #A2A19E",
+"/     c #4E4D49",
+"(     c #9E9E9E",
+"_     c #564513",
+":     c #826A16",
+"<     c #BEBEBE",
+"[     c #D8D8D8",
+"}     c #999999",
+"|     c #817B6B",
+"1     c #8F8158",
+"2     c #8E805B",
+"3     c #96938D",
+"4     c #B4B2AF",
+"5     c #8E6E15",
+"6     c #68521F",
+"7     c #746941",
+"8     c #AA8B05",
+"9     c #715C07",
+"0     c #96770C",
+"a     c #C99910",
+"b     c #D9A820",
+"c     c #8F8565",
+"d     c #7D7C6E",
+"e     c #A78C30",
+"f     c #7B6B32",
+"g     c #D6D6D6",
+"h     c #82754C",
+"i     c #C08A09",
+"j     c #886316",
+"k     c #909090",
+"l     c #63625D",
+"m     c #655A07",
+"n     c #DBBE14",
+"o     c #F8C209",
+"p     c #F2B811",
+"q     c #9C8B67",
+"r     c #3555E4",
+"s     c #0B45D7",
+"t     c #4660C3",
+"u     c #AE9631",
+"v     c #817751",
+"w     c #80703E",
+"x     c #C7910E",
+"y     c #A97710",
+"z     c #817F7D",
+"A     c #707070",
+"B     c #615112",
+"C     c #D1AF11",
+"D     c #F9C606",
+"E     c #F1BB0E",
+"F     c #CA8436",
+"G     c #92397E",
+"H     c #7B2F84",
+"I     c #785997",
+"J     c #CFAE2E",
+"K     c #856C07",
+"L     c #9F9C92",
+"M     c #AC9451",
+"N     c #C29537",
+"O     c #70644D",
+"P     c #8D8D8D",
+"Q     c #786A33",
+"R     c #D0B63E",
+"S     c #9FC22D",
+"T     c #71A623",
+"U     c #A87720",
+"V     c #EB5732",
+"W     c #B00D07",
+"X     c #DF351D",
+"Y     c #FD720D",
+"Z     c #8B6E01",
+"`     c #94928E",
+" .    c #A29B8A",
+"..    c #685F49",
+"+.    c #B4B4B4",
+"@.    c #575757",
+"#.    c #9AA097",
+"$.    c #59B863",
+"%.    c #3EA148",
+"&.    c #508F3F",
+"*.    c #C0632A",
+"=.    c #E54C14",
+"-.    c #F45E15",
+";.    c #ED9406",
+">.    c #766425",
+",.    c #B8B7B7",
+"'.    c #4F4F4B",
+").    c #7E7B74",
+"!.    c #675F53",
+"~.    c #908656",
+"{.    c #B1AE36",
+"].    c #82B129",
+"^.    c #6DB641",
+"/.    c #97BA2E",
+"(.    c #F0B109",
+"_.    c #DCA604",
+":.    c #8F741A",
+"<.    c #AEACA5",
+"[.    c #808080",
+"}.    c #946612",
+"|.    c #7C350D",
+"1.    c #632A05",
+"2.    c #6F6417",
+"3.    c #7B7133",
+"4.    c #786C3C",
+"5.    c #8C8468",
+"6.    c #837A5C",
+"7.    c #918B79",
+"8.    c #CECECE",
+"9.    c #A4A4A4",
+"0.    c #9D5218",
+"a.    c #AA1F0E",
+"b.    c #AE170D",
+"c.    c #6D4242",
+"d.    c #9F918E",
+"e.    c #694743",
+"f.    c #61211F",
+"g.    c #ACA6A6",
+"  . . . . . . . . . . . . . . ",
+"  . + + + + + + + + + + + + . ",
+"  @ # + + + + + + + + + + + . ",
+"  $ % & + + + + + + + + + + . ",
+"  * = - + + + + + + + + + + . ",
+"  ; > , ' + + + + + + + + + . ",
+"  ) ! ~ { ] + + + + + + + + . ",
+"  ^ / ( _ : < [ } | 1 2 3 + . ",
+"4 5 6 ( 7 8 9 0 a b c d e f g ",
+"h i j k l m n o p q r s t u v ",
+"w x y z A B C D E F G H I J K ",
+"L M N O P Q R S T U V W X Y Z ",
+"  `  ...+.@.#.$.%.&.*.=.-.;.>.",
+"  . ,.'.).!.~.{.].^./.(._.:.<.",
+"  . + [.}.|.1.2.3.4.5.6.7.8.. ",
+"  . + 9.0.a.b.c.+ + + + + + . ",
+"  . + + d.e.f.g.+ + + + + + . ",
+"  . . . . . . . . . . . . . . "};
diff --git a/src/pixmaps/mime_text_enriched.xpm b/src/pixmaps/mime_text_enriched.xpm
new file mode 100644 (file)
index 0000000..3787576
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char * mime_text_enriched_xpm[] = {
+"14 18 4 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #000000",
+"..............",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".+++@@@++++++.",
+".++@+++@+++++.",
+".++@+++@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@+@@+@+++++.",
+".+@++++@+++++.",
+".+@++++@+++++.",
+".++@@@@++++++.",
+".++++++++++++.",
+".............."};
diff --git a/src/pixmaps/mime_text_html.xpm b/src/pixmaps/mime_text_html.xpm
new file mode 100644 (file)
index 0000000..5de72ac
--- /dev/null
@@ -0,0 +1,28 @@
+/* XPM */
+static char * mime_text_html_xpm[] = {
+"18 18 7 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #002EE8",
+"#     c #0000FF",
+"$     c #000000",
+"%     c #FF0000",
+"  ..............  ",
+"  .++++++++++++.  ",
+"  .+++@@@@@@+++.  ",
+"  .++++++++++++.  ",
+"  .++++++++++++.  ",
+"  .+##########+.  ",
+"  .++++++++++++.  ",
+"  .++++++++++++.  ",
+"  .+$$$$$$$$$$+.  ",
+"  .++++++++++++.  ",
+"  .++++++++++++.  ",
+"  .+$$$$$$$$$$+.  ",
+"  .++++++++++++.  ",
+"  .++++++++++++.  ",
+"  .+%%%%%%%%%++.  ",
+"  .++++++++++++.  ",
+"  .++++++++++++.  ",
+"  ..............  "};
diff --git a/src/pixmaps/mime_text_plain.xpm b/src/pixmaps/mime_text_plain.xpm
new file mode 100644 (file)
index 0000000..2d89e03
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char * mime_text_plain_xpm[] = {
+"14 18 4 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #000000",
+"..............",
+".++++++++++++.",
+".+@@@@@@@++++.",
+".++++++++++++.",
+".++++++++++++.",
+".+@@@@+++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".+@@@@@@@@@@+.",
+".++++++++++++.",
+".++++++++++++.",
+".+@@@@@@@@@@+.",
+".++++++++++++.",
+".++++++++++++.",
+".+@@@@@@@@@++.",
+".++++++++++++.",
+".++++++++++++.",
+".............."};
diff --git a/src/pixmaps/mime_unknown.xpm b/src/pixmaps/mime_unknown.xpm
new file mode 100644 (file)
index 0000000..3975c5e
--- /dev/null
@@ -0,0 +1,25 @@
+/* XPM */
+static char * mime_unknown_xpm[] = {
+"14 18 4 1",
+"      c None",
+".     c #8E8E8E",
+"+     c #FFFFFF",
+"@     c #000000",
+"..............",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".++++++++++++.",
+".+++@@@++++++.",
+".++@+++@+++++.",
+".++@+++@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@@++@@+++++.",
+".+@+@@+@+++++.",
+".+@++++@+++++.",
+".+@++++@+++++.",
+".++@@@@++++++.",
+".++++++++++++.",
+".............."};
index 239ebd8..a4a3824 100644 (file)
@@ -118,6 +118,7 @@ struct _MimeInfo
        gchar *plaintextfile;
        gchar *sigstatus;
        gchar *sigstatus_full;
+       gboolean sig_ok;
 #endif
 
        gint level;
index 5026be4..8c5b5f0 100644 (file)
@@ -411,6 +411,7 @@ leave:
 
     g_free (partinfo->sigstatus);
     partinfo->sigstatus = g_strdup (result);
+    partinfo->sig_ok = (status == GPGME_SIG_STAT_GOOD);
 
     gpgme_data_release (sig);
     gpgme_data_release (text);
index 7c7cb14..82f362e 100644 (file)
 #include "pixmaps/drafts_close.xpm"
 #include "pixmaps/drafts_open.xpm"
 #include "pixmaps/messageview_text.xpm"
-                  
+#include "pixmaps/mime_text_plain.xpm"
+#include "pixmaps/mime_text_html.xpm"
+#include "pixmaps/mime_application.xpm"
+#include "pixmaps/mime_application_octect_stream.xpm"
+#include "pixmaps/mime_image.xpm"
+#include "pixmaps/mime_audio.xpm"
+#include "pixmaps/mime_text_enriched.xpm"
+#include "pixmaps/mime_unknown.xpm"
+#include "pixmaps/mime_gpg_signed.xpm"
+#include "pixmaps/mime_gpg_passed.xpm"
+#include "pixmaps/mime_gpg_failed.xpm"                  
+
 typedef struct _StockPixmapData        StockPixmapData;
 
 struct _StockPixmapData
@@ -189,6 +200,17 @@ static StockPixmapData pixmaps[] =
        {drafts_close_xpm                       , NULL, NULL, "drafts_close", "  "},
        {drafts_open_xpm                        , NULL, NULL, "drafts_open", "  "},
        {messageview_text_xpm                   , NULL, NULL, "messageview_text", "  "},
+       {mime_text_plain_xpm                    , NULL, NULL, "mime_text_plain", "  "},
+       {mime_text_html_xpm                     , NULL, NULL, "mime_text_html", "  "},
+       {mime_application_xpm                   , NULL, NULL, "mime_application", "  "},
+       {mime_application_octect_stream_xpm     , NULL, NULL, "mime_application_octect_stream", "  "},
+       {mime_image_xpm                         , NULL, NULL, "mime_image", "  "},
+       {mime_audio_xpm                         , NULL, NULL, "mime_audio", "  "},
+       {mime_text_enriched_xpm                 , NULL, NULL, "mime_text_enriched", "  "},
+       {mime_unknown_xpm                       , NULL, NULL, "mime_unknown", "  "},    
+       {mime_gpg_signed_xpm                    , NULL, NULL, "mime_gpg_signed", "  "},
+       {mime_gpg_passed_xpm                    , NULL, NULL, "mime_gpg_passed", "  "},
+       {mime_gpg_failed_xpm                    , NULL, NULL, "mime_gpg_failed", "  "}, 
        {sylpheed_logo_xpm                      , NULL, NULL, "sylpheed_logo", "  "},
 };
 
index 99d7ac8..27d0850 100644 (file)
@@ -103,7 +103,18 @@ typedef enum
        STOCK_PIXMAP_DRAFTS_CLOSE,
        STOCK_PIXMAP_DRAFTS_OPEN,
        STOCK_PIXMAP_MESSAGEVIEW_TEXT,
-
+       STOCK_PIXMAP_MIME_TEXT_PLAIN,
+       STOCK_PIXMAP_MIME_TEXT_HTML,
+       STOCK_PIXMAP_MIME_APPLICATION,
+       STOCK_PIXMAP_MIME_APPLICATION_OCTET_STREAM,
+       STOCK_PIXMAP_MIME_IMAGE,
+       STOCK_PIXMAP_MIME_AUDIO,
+       STOCK_PIXMAP_MIME_TEXT_ENRICHED,
+       STOCK_PIXMAP_MIME_UNKNOWN,
+       STOCK_PIXMAP_MIME_GPG_SIGNED,
+       STOCK_PIXMAP_MIME_GPG_PASSED,
+       STOCK_PIXMAP_MIME_GPG_FAILED,
+       
        STOCK_PIXMAP_SYLPHEED_LOGO,             /* last entry */
        
        N_STOCK_PIXMAPS