2001-04-19 14:21:46 +02:00
|
|
|
/*
|
|
|
|
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
|
2003-04-05 10:58:21 +02:00
|
|
|
* Copyright (C) 1999-2003 Hiroyuki Yamamoto
|
2001-04-19 14:21:46 +02:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
|
|
|
#include <glib.h>
|
2005-02-10 13:06:07 +01:00
|
|
|
#include <glib/gi18n.h>
|
2001-04-19 14:21:46 +02:00
|
|
|
#include <gdk/gdkkeysyms.h>
|
2002-02-25 10:25:17 +01:00
|
|
|
#include <gtk/gtknotebook.h>
|
2001-04-19 14:21:46 +02:00
|
|
|
#include <gtk/gtkscrolledwindow.h>
|
|
|
|
#include <gtk/gtkctree.h>
|
|
|
|
#include <gtk/gtkvbox.h>
|
2003-07-24 02:40:01 +02:00
|
|
|
#include <gtk/gtkhbox.h>
|
|
|
|
#include <gtk/gtkvpaned.h>
|
2001-04-19 14:21:46 +02:00
|
|
|
#include <gtk/gtktext.h>
|
|
|
|
#include <gtk/gtksignal.h>
|
|
|
|
#include <gtk/gtkmenu.h>
|
|
|
|
#include <gtk/gtkdnd.h>
|
|
|
|
#include <gtk/gtkselection.h>
|
2003-07-19 15:50:29 +02:00
|
|
|
#include <gtk/gtktooltips.h>
|
|
|
|
#include <gtk/gtkcontainer.h>
|
2003-07-24 02:40:01 +02:00
|
|
|
#include <gtk/gtkbutton.h>
|
2001-04-19 14:21:46 +02:00
|
|
|
#include <stdio.h>
|
2003-06-07 03:01:50 +02:00
|
|
|
|
|
|
|
#ifndef HAVE_APACHE_FNMATCH
|
|
|
|
/* kludge: apache's fnmatch clashes with <regex.h>, don't include
|
|
|
|
* fnmatch.h */
|
2003-06-07 00:09:46 +02:00
|
|
|
#include <fnmatch.h>
|
|
|
|
#endif
|
2003-06-06 23:11:42 +02:00
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
#include "main.h"
|
|
|
|
#include "mimeview.h"
|
|
|
|
#include "textview.h"
|
|
|
|
#include "procmime.h"
|
|
|
|
#include "summaryview.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "filesel.h"
|
|
|
|
#include "alertpanel.h"
|
2001-05-10 13:19:38 +02:00
|
|
|
#include "inputdialog.h"
|
2001-04-19 14:21:46 +02:00
|
|
|
#include "utils.h"
|
|
|
|
#include "gtkutils.h"
|
|
|
|
#include "prefs_common.h"
|
2003-07-05 12:45:46 +02:00
|
|
|
#include "stock_pixmap.h"
|
2003-07-19 15:50:29 +02:00
|
|
|
#include "gtk/gtkvscrollbutton.h"
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COL_MIMETYPE = 0,
|
|
|
|
COL_SIZE = 1,
|
|
|
|
COL_NAME = 2
|
|
|
|
} MimeViewColumnPos;
|
|
|
|
|
|
|
|
#define N_MIMEVIEW_COLS 3
|
|
|
|
|
|
|
|
static void mimeview_set_multipart_tree (MimeView *mimeview,
|
|
|
|
MimeInfo *mimeinfo,
|
|
|
|
GtkCTreeNode *parent);
|
|
|
|
static GtkCTreeNode *mimeview_append_part (MimeView *mimeview,
|
|
|
|
MimeInfo *partinfo,
|
|
|
|
GtkCTreeNode *parent);
|
|
|
|
static void mimeview_show_message_part (MimeView *mimeview,
|
|
|
|
MimeInfo *partinfo);
|
|
|
|
static void mimeview_change_view_type (MimeView *mimeview,
|
2001-06-30 13:40:01 +02:00
|
|
|
MimeViewType type);
|
2004-05-10 12:22:28 +02:00
|
|
|
gchar *mimeview_get_filename_for_part (MimeInfo *partinfo,
|
|
|
|
const gchar *basedir,
|
|
|
|
gint number);
|
|
|
|
static gboolean mimeview_write_part (const gchar *filename,
|
|
|
|
MimeInfo *partinfo);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
static void mimeview_selected (GtkCTree *ctree,
|
|
|
|
GtkCTreeNode *node,
|
|
|
|
gint column,
|
|
|
|
MimeView *mimeview);
|
|
|
|
static void mimeview_start_drag (GtkWidget *widget,
|
|
|
|
gint button,
|
|
|
|
GdkEvent *event,
|
|
|
|
MimeView *mimeview);
|
2002-01-29 11:03:33 +01:00
|
|
|
static gint mimeview_button_pressed (GtkWidget *widget,
|
2001-04-19 14:21:46 +02:00
|
|
|
GdkEventButton *event,
|
|
|
|
MimeView *mimeview);
|
2002-01-29 11:03:33 +01:00
|
|
|
static gint mimeview_key_pressed (GtkWidget *widget,
|
2001-04-19 14:21:46 +02:00
|
|
|
GdkEventKey *event,
|
|
|
|
MimeView *mimeview);
|
|
|
|
|
|
|
|
static void mimeview_drag_data_get (GtkWidget *widget,
|
|
|
|
GdkDragContext *drag_context,
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint info,
|
|
|
|
guint time,
|
|
|
|
MimeView *mimeview);
|
|
|
|
|
|
|
|
static void mimeview_display_as_text (MimeView *mimeview);
|
|
|
|
static void mimeview_save_as (MimeView *mimeview);
|
2002-07-21 18:06:50 +02:00
|
|
|
static void mimeview_save_all (MimeView *mimeview);
|
2001-04-19 14:21:46 +02:00
|
|
|
static void mimeview_launch (MimeView *mimeview);
|
2001-05-10 13:19:38 +02:00
|
|
|
static void mimeview_open_with (MimeView *mimeview);
|
2001-04-19 14:21:46 +02:00
|
|
|
static void mimeview_view_file (const gchar *filename,
|
2001-05-10 13:19:38 +02:00
|
|
|
MimeInfo *partinfo,
|
|
|
|
const gchar *cmdline);
|
2003-07-19 15:50:29 +02:00
|
|
|
static gboolean icon_clicked_cb (GtkWidget *button,
|
|
|
|
GdkEventButton *event,
|
|
|
|
MimeView *mimeview);
|
2003-07-24 02:40:01 +02:00
|
|
|
static void icon_selected (MimeView *mimeview,
|
|
|
|
gint num,
|
|
|
|
MimeInfo *partinfo);
|
|
|
|
static gint icon_key_pressed (GtkWidget *button,
|
|
|
|
GdkEventKey *event,
|
|
|
|
MimeView *mimeview);
|
2003-07-27 21:04:30 +02:00
|
|
|
static void toggle_icon (GtkToggleButton *button,
|
2003-07-24 08:34:22 +02:00
|
|
|
MimeView *mimeview);
|
2003-07-19 15:50:29 +02:00
|
|
|
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);
|
2003-07-24 08:34:22 +02:00
|
|
|
static void icon_list_toggle_by_mime_info (MimeView *mimeview,
|
|
|
|
MimeInfo *mimeinfo);
|
2003-08-02 20:27:04 +02:00
|
|
|
static gboolean icon_list_select_by_number(MimeView *mimeview,
|
|
|
|
gint number);
|
2003-07-19 15:50:29 +02:00
|
|
|
static void mime_toggle_button_cb (GtkWidget *button,
|
|
|
|
MimeView *mimeview);
|
2003-10-05 12:25:17 +02:00
|
|
|
static gboolean part_button_pressed (MimeView *mimeview,
|
2003-07-19 15:50:29 +02:00
|
|
|
GdkEventButton *event,
|
|
|
|
MimeInfo *partinfo);
|
|
|
|
static void icon_scroll_size_allocate_cb(GtkWidget *widget,
|
|
|
|
GtkAllocation *layout_size,
|
|
|
|
MimeView *mimeview);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
static GtkItemFactoryEntry mimeview_popup_entries[] =
|
|
|
|
{
|
|
|
|
{N_("/_Open"), NULL, mimeview_launch, 0, NULL},
|
2001-05-10 13:19:38 +02:00
|
|
|
{N_("/Open _with..."), NULL, mimeview_open_with, 0, NULL},
|
2001-04-19 14:21:46 +02:00
|
|
|
{N_("/_Display as text"), NULL, mimeview_display_as_text, 0, NULL},
|
2002-07-21 18:06:50 +02:00
|
|
|
{N_("/_Save as..."), NULL, mimeview_save_as, 0, NULL},
|
2004-01-12 22:28:31 +01:00
|
|
|
{N_("/Save _all..."), NULL, mimeview_save_all, 0, NULL},
|
2001-04-19 14:21:46 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
static GtkTargetEntry mimeview_mime_types[] =
|
|
|
|
{
|
|
|
|
{"text/uri-list", 0, 0}
|
|
|
|
};
|
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
GSList *mimeviewer_factories;
|
2003-03-16 18:11:03 +01:00
|
|
|
GSList *mimeviews;
|
2003-03-15 00:58:57 +01:00
|
|
|
|
2003-07-05 12:45:46 +02:00
|
|
|
MimeView *mimeview_create(MainWindow *mainwin)
|
2001-04-19 14:21:46 +02:00
|
|
|
{
|
|
|
|
MimeView *mimeview;
|
|
|
|
|
|
|
|
GtkWidget *paned;
|
|
|
|
GtkWidget *scrolledwin;
|
|
|
|
GtkWidget *ctree;
|
2003-07-16 19:47:36 +02:00
|
|
|
GtkWidget *mime_notebook;
|
2001-04-19 14:21:46 +02:00
|
|
|
GtkWidget *popupmenu;
|
2003-07-19 15:50:29 +02:00
|
|
|
GtkWidget *ctree_mainbox;
|
2004-01-12 22:28:31 +01:00
|
|
|
GtkWidget *vbox;
|
2003-07-19 15:50:29 +02:00
|
|
|
GtkWidget *mime_toggle;
|
|
|
|
GtkWidget *icon_mainbox;
|
|
|
|
GtkWidget *icon_scroll;
|
|
|
|
GtkWidget *icon_vbox;
|
|
|
|
GtkWidget *arrow;
|
|
|
|
GtkWidget *scrollbutton;
|
2003-07-24 02:40:01 +02:00
|
|
|
GtkWidget *hbox;
|
2003-07-19 15:50:29 +02:00
|
|
|
GtkTooltips *tooltips;
|
2001-04-19 14:21:46 +02:00
|
|
|
GtkItemFactory *popupfactory;
|
2004-01-12 22:28:31 +01:00
|
|
|
NoticeView *siginfoview;
|
2002-02-08 11:07:11 +01:00
|
|
|
gchar *titles[N_MIMEVIEW_COLS];
|
2001-04-19 14:21:46 +02:00
|
|
|
gint n_entries;
|
|
|
|
gint i;
|
|
|
|
|
2002-08-15 09:38:17 +02:00
|
|
|
debug_print("Creating MIME view...\n");
|
2001-04-19 14:21:46 +02:00
|
|
|
mimeview = g_new0(MimeView, 1);
|
|
|
|
|
2002-02-08 11:07:11 +01:00
|
|
|
titles[COL_MIMETYPE] = _("MIME Type");
|
|
|
|
titles[COL_SIZE] = _("Size");
|
|
|
|
titles[COL_NAME] = _("Name");
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
scrolledwin = gtk_scrolled_window_new(NULL, NULL);
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_widget_show(scrolledwin);
|
2001-04-19 14:21:46 +02:00
|
|
|
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
|
|
|
|
GTK_POLICY_AUTOMATIC,
|
2004-08-03 10:46:10 +02:00
|
|
|
GTK_POLICY_AUTOMATIC);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
ctree = gtk_sctree_new_with_titles(N_MIMEVIEW_COLS, 0, titles);
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_widget_show(ctree);
|
2001-06-03 12:34:31 +02:00
|
|
|
gtk_clist_set_selection_mode(GTK_CLIST(ctree), GTK_SELECTION_BROWSE);
|
2001-04-19 14:21:46 +02:00
|
|
|
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);
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_clist_set_column_width(GTK_CLIST(ctree), COL_MIMETYPE, 240);
|
|
|
|
gtk_clist_set_column_width(GTK_CLIST(ctree), COL_SIZE, 90);
|
2001-04-19 14:21:46 +02:00
|
|
|
for (i = 0; i < N_MIMEVIEW_COLS; i++)
|
|
|
|
GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(ctree)->column[i].button,
|
|
|
|
GTK_CAN_FOCUS);
|
|
|
|
gtk_container_add(GTK_CONTAINER(scrolledwin), ctree);
|
|
|
|
|
2003-10-05 12:10:30 +02:00
|
|
|
g_signal_connect(G_OBJECT(ctree), "tree_select_row",
|
|
|
|
G_CALLBACK(mimeview_selected), mimeview);
|
2004-07-16 13:12:46 +02:00
|
|
|
g_signal_connect(G_OBJECT(ctree), "button_release_event",
|
2003-10-05 12:10:30 +02:00
|
|
|
G_CALLBACK(mimeview_button_pressed), mimeview);
|
|
|
|
g_signal_connect(G_OBJECT(ctree), "key_press_event",
|
|
|
|
G_CALLBACK(mimeview_key_pressed), mimeview);
|
|
|
|
g_signal_connect(G_OBJECT (ctree),"start_drag",
|
|
|
|
G_CALLBACK (mimeview_start_drag), mimeview);
|
|
|
|
g_signal_connect(G_OBJECT(ctree), "drag_data_get",
|
|
|
|
G_CALLBACK(mimeview_drag_data_get), mimeview);
|
2003-07-16 19:47:36 +02:00
|
|
|
|
|
|
|
mime_notebook = gtk_notebook_new();
|
|
|
|
gtk_widget_show(mime_notebook);
|
|
|
|
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);
|
2003-07-19 15:50:29 +02:00
|
|
|
|
2003-08-18 19:08:48 +02:00
|
|
|
icon_vbox = gtk_vbox_new(FALSE, 2);
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_widget_show(icon_vbox);
|
2003-07-19 15:50:29 +02:00
|
|
|
icon_scroll = gtk_layout_new(NULL, NULL);
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_widget_show(icon_scroll);
|
2003-07-19 15:50:29 +02:00
|
|
|
gtk_layout_put(GTK_LAYOUT(icon_scroll), icon_vbox, 0, 0);
|
|
|
|
scrollbutton = gtk_vscrollbutton_new(gtk_layout_get_vadjustment(GTK_LAYOUT(icon_scroll)));
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_widget_show(scrollbutton);
|
2003-07-19 15:50:29 +02:00
|
|
|
|
|
|
|
mime_toggle = gtk_toggle_button_new();
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_widget_show(mime_toggle);
|
2003-07-19 15:50:29 +02:00
|
|
|
arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
|
|
|
|
gtk_widget_show(arrow);
|
|
|
|
gtk_container_add(GTK_CONTAINER(mime_toggle), arrow);
|
2003-10-05 12:10:30 +02:00
|
|
|
g_signal_connect(G_OBJECT(mime_toggle), "toggled",
|
|
|
|
G_CALLBACK(mime_toggle_button_cb), mimeview);
|
2003-07-19 15:50:29 +02:00
|
|
|
|
|
|
|
icon_mainbox = gtk_vbox_new(FALSE, 0);
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_widget_show(icon_mainbox);
|
2003-07-19 15:50:29 +02:00
|
|
|
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);
|
2003-10-05 12:10:30 +02:00
|
|
|
g_signal_connect(G_OBJECT(icon_mainbox), "size_allocate",
|
|
|
|
G_CALLBACK(icon_scroll_size_allocate_cb), mimeview);
|
2003-07-19 15:50:29 +02:00
|
|
|
|
2003-07-24 02:40:01 +02:00
|
|
|
ctree_mainbox = gtk_hbox_new(FALSE, 0);
|
2003-07-19 15:50:29 +02:00
|
|
|
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);
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
vbox = gtk_vbox_new(FALSE, 0);
|
|
|
|
gtk_widget_show(vbox);
|
|
|
|
siginfoview = noticeview_create(mainwin);
|
|
|
|
noticeview_hide(siginfoview);
|
|
|
|
gtk_box_pack_start(GTK_BOX(vbox), mime_notebook, TRUE, TRUE, 0);
|
|
|
|
gtk_box_pack_end(GTK_BOX(vbox), GTK_WIDGET_PTR(siginfoview), FALSE, FALSE, 0);
|
|
|
|
|
2003-07-24 02:40:01 +02:00
|
|
|
paned = gtk_vpaned_new();
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_widget_show(paned);
|
|
|
|
gtk_paned_set_gutter_size(GTK_PANED(paned), 0);
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_paned_pack1(GTK_PANED(paned), ctree_mainbox, FALSE, TRUE);
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_paned_pack2(GTK_PANED(paned), vbox, TRUE, TRUE);
|
2003-07-19 15:50:29 +02:00
|
|
|
|
2003-07-24 02:40:01 +02:00
|
|
|
hbox = gtk_hbox_new(FALSE, 0);
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_box_pack_start(GTK_BOX(hbox), paned, TRUE, TRUE, 0);
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_box_pack_start(GTK_BOX(hbox), icon_mainbox, FALSE, FALSE, 0);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_widget_show(hbox);
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_widget_hide(ctree_mainbox);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2003-07-24 02:40:01 +02:00
|
|
|
mimeview->hbox = hbox;
|
2003-07-16 19:47:36 +02:00
|
|
|
mimeview->paned = paned;
|
|
|
|
mimeview->scrolledwin = scrolledwin;
|
|
|
|
mimeview->ctree = ctree;
|
|
|
|
mimeview->mime_notebook = mime_notebook;
|
|
|
|
mimeview->popupmenu = popupmenu;
|
|
|
|
mimeview->popupfactory = popupfactory;
|
|
|
|
mimeview->type = -1;
|
2003-07-19 15:50:29 +02:00
|
|
|
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;
|
2003-07-24 02:40:01 +02:00
|
|
|
mimeview->oldsize = 60;
|
2003-07-19 23:08:55 +02:00
|
|
|
mimeview->mime_toggle = mime_toggle;
|
2004-01-12 22:28:31 +01:00
|
|
|
mimeview->siginfoview = siginfoview;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2003-07-17 10:39:41 +02:00
|
|
|
mimeview->target_list = gtk_target_list_new(mimeview_mime_types, 1);
|
|
|
|
|
2003-03-16 18:11:03 +01:00
|
|
|
mimeviews = g_slist_prepend(mimeviews, mimeview);
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
return mimeview;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mimeview_init(MimeView *mimeview)
|
|
|
|
{
|
2003-06-30 08:21:21 +02:00
|
|
|
textview_init(mimeview->textview);
|
2003-07-16 19:47:36 +02:00
|
|
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(mimeview->mime_notebook),
|
|
|
|
GTK_WIDGET_PTR(mimeview->textview));
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void mimeview_show_message(MimeView *mimeview, MimeInfo *mimeinfo,
|
|
|
|
const gchar *file)
|
|
|
|
{
|
|
|
|
GtkCTree *ctree = GTK_CTREE(mimeview->ctree);
|
|
|
|
GtkCTreeNode *node;
|
|
|
|
|
|
|
|
mimeview_clear(mimeview);
|
|
|
|
|
|
|
|
g_return_if_fail(file != NULL);
|
|
|
|
g_return_if_fail(mimeinfo != NULL);
|
|
|
|
|
|
|
|
mimeview->mimeinfo = mimeinfo;
|
|
|
|
|
|
|
|
mimeview->file = g_strdup(file);
|
|
|
|
|
2003-10-05 12:10:30 +02:00
|
|
|
g_signal_handlers_block_by_func(G_OBJECT(ctree), mimeview_selected,
|
|
|
|
mimeview);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
mimeview_set_multipart_tree(mimeview, mimeinfo, NULL);
|
2003-07-19 15:50:29 +02:00
|
|
|
icon_list_create(mimeview, mimeinfo);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2003-10-05 12:10:30 +02:00
|
|
|
g_signal_handlers_unblock_by_func(G_OBJECT(ctree),
|
|
|
|
mimeview_selected, mimeview);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
node = GTK_CTREE_NODE(GTK_CLIST(ctree)->row_list);
|
2001-09-20 13:53:09 +02:00
|
|
|
if (node) {
|
2001-04-19 14:21:46 +02:00
|
|
|
gtk_ctree_select(ctree, node);
|
2003-07-24 08:34:22 +02:00
|
|
|
icon_list_toggle_by_mime_info
|
|
|
|
(mimeview, gtk_ctree_node_get_row_data(ctree, node));
|
2001-09-20 13:53:09 +02:00
|
|
|
gtkut_ctree_set_focus_row(ctree, node);
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void mimeview_destroy(MimeView *mimeview)
|
|
|
|
{
|
2003-03-15 00:58:57 +01:00
|
|
|
GSList *cur;
|
|
|
|
|
|
|
|
for (cur = mimeview->viewers; cur != NULL; cur = g_slist_next(cur)) {
|
|
|
|
MimeViewer *viewer = (MimeViewer *) cur->data;
|
2003-07-16 19:47:36 +02:00
|
|
|
gtk_container_remove(GTK_CONTAINER(mimeview->mime_notebook),
|
|
|
|
GTK_WIDGET(viewer->get_widget(viewer)));
|
2003-03-15 00:58:57 +01:00
|
|
|
viewer->destroy_viewer(viewer);
|
|
|
|
}
|
|
|
|
g_slist_free(mimeview->viewers);
|
2003-07-17 10:39:41 +02:00
|
|
|
gtk_target_list_unref(mimeview->target_list);
|
2003-03-15 00:58:57 +01:00
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
procmime_mimeinfo_free_all(mimeview->mimeinfo);
|
|
|
|
g_free(mimeview->file);
|
|
|
|
g_free(mimeview);
|
2003-03-16 18:11:03 +01:00
|
|
|
|
|
|
|
mimeviews = g_slist_remove(mimeviews, mimeview);
|
2003-07-19 15:50:29 +02:00
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
2003-04-22 15:53:19 +02:00
|
|
|
MimeInfo *mimeview_get_selected_part(MimeView *mimeview)
|
|
|
|
{
|
|
|
|
return gtk_ctree_node_get_row_data
|
|
|
|
(GTK_CTREE(mimeview->ctree), mimeview->opened);
|
|
|
|
}
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
static void mimeview_set_multipart_tree(MimeView *mimeview,
|
|
|
|
MimeInfo *mimeinfo,
|
|
|
|
GtkCTreeNode *parent)
|
|
|
|
{
|
2003-05-07 09:36:15 +02:00
|
|
|
GtkCTreeNode *node;
|
2001-12-22 17:09:08 +01:00
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
g_return_if_fail(mimeinfo != NULL);
|
|
|
|
|
2003-05-07 09:36:15 +02:00
|
|
|
while (mimeinfo != NULL) {
|
|
|
|
node = mimeview_append_part(mimeview, mimeinfo, parent);
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if (mimeinfo->node->children)
|
|
|
|
mimeview_set_multipart_tree(mimeview, (MimeInfo *) mimeinfo->node->children->data, node);
|
|
|
|
mimeinfo = mimeinfo->node->next != NULL ? (MimeInfo *) mimeinfo->node->next->data : NULL;
|
2003-05-07 09:36:15 +02:00
|
|
|
}
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
static const gchar *get_part_name(MimeInfo *partinfo)
|
2001-04-19 14:21:46 +02:00
|
|
|
{
|
2004-01-12 22:28:31 +01:00
|
|
|
const gchar *name;
|
|
|
|
|
|
|
|
name = procmime_mimeinfo_get_parameter(partinfo, "filename");
|
|
|
|
if (name == NULL)
|
|
|
|
name = procmime_mimeinfo_get_parameter(partinfo, "name");
|
|
|
|
if (name == NULL)
|
|
|
|
name = "";
|
|
|
|
|
|
|
|
return name;
|
2003-02-22 13:09:38 +01:00
|
|
|
}
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
static const gchar *get_part_description(MimeInfo *partinfo)
|
2003-02-22 13:09:38 +01:00
|
|
|
{
|
|
|
|
if (partinfo->description)
|
|
|
|
return partinfo->description;
|
2001-04-19 14:21:46 +02:00
|
|
|
else
|
2004-01-12 22:28:31 +01:00
|
|
|
return get_part_name(partinfo);
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static GtkCTreeNode *mimeview_append_part(MimeView *mimeview,
|
|
|
|
MimeInfo *partinfo,
|
|
|
|
GtkCTreeNode *parent)
|
|
|
|
{
|
|
|
|
GtkCTree *ctree = GTK_CTREE(mimeview->ctree);
|
|
|
|
GtkCTreeNode *node;
|
2004-01-12 22:28:31 +01:00
|
|
|
static gchar content_type[64];
|
2001-04-19 14:21:46 +02:00
|
|
|
gchar *str[N_MIMEVIEW_COLS];
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if (partinfo->type != MIMETYPE_UNKNOWN && partinfo->subtype) {
|
2004-10-12 11:45:18 +02:00
|
|
|
g_snprintf(content_type, 64, "%s/%s", procmime_get_media_type_str(partinfo->type), partinfo->subtype);
|
2004-01-12 22:28:31 +01:00
|
|
|
} else {
|
|
|
|
g_snprintf(content_type, 64, "UNKNOWN");
|
|
|
|
}
|
|
|
|
|
|
|
|
str[COL_MIMETYPE] = content_type;
|
|
|
|
str[COL_SIZE] = to_human_readable(partinfo->length);
|
2003-02-22 13:09:38 +01:00
|
|
|
if (prefs_common.attach_desc)
|
2004-01-12 22:28:31 +01:00
|
|
|
str[COL_NAME] = (gchar *) get_part_description(partinfo);
|
2003-02-22 13:09:38 +01:00
|
|
|
else
|
2004-01-12 22:28:31 +01:00
|
|
|
str[COL_NAME] = (gchar *) get_part_name(partinfo);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
node = gtk_ctree_insert_node(ctree, parent, NULL, str, 0,
|
|
|
|
NULL, NULL, NULL, NULL,
|
|
|
|
FALSE, TRUE);
|
|
|
|
gtk_ctree_node_set_row_data(ctree, node, partinfo);
|
|
|
|
|
|
|
|
return node;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mimeview_show_message_part(MimeView *mimeview, MimeInfo *partinfo)
|
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
const gchar *fname;
|
|
|
|
|
|
|
|
if (!partinfo) return;
|
|
|
|
|
|
|
|
fname = mimeview->file;
|
|
|
|
if (!fname) return;
|
|
|
|
|
2005-08-19 11:30:30 +02:00
|
|
|
if ((fp = g_fopen(fname, "rb")) == NULL) {
|
2001-04-19 14:21:46 +02:00
|
|
|
FILE_OP_ERROR(fname, "fopen");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if (fseek(fp, partinfo->offset, SEEK_SET) < 0) {
|
2001-04-19 14:21:46 +02:00
|
|
|
FILE_OP_ERROR(mimeview->file, "fseek");
|
|
|
|
fclose(fp);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mimeview_change_view_type(mimeview, MIMEVIEW_TEXT);
|
|
|
|
textview_show_part(mimeview->textview, partinfo, fp);
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
}
|
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
static MimeViewer *get_viewer_for_content_type(MimeView *mimeview, const gchar *content_type)
|
|
|
|
{
|
|
|
|
GSList *cur;
|
|
|
|
MimeViewerFactory *factory = NULL;
|
|
|
|
MimeViewer *viewer = NULL;
|
2003-06-07 00:09:46 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* FNM_CASEFOLD is a GNU extension
|
|
|
|
* if its not defined copy the string to the stack and
|
|
|
|
* convert the copy to lower case
|
|
|
|
*/
|
|
|
|
#ifndef FNM_CASEFOLD
|
|
|
|
#define FNM_CASEFOLD 0
|
|
|
|
Xstrdup_a(content_type, content_type, return NULL);
|
|
|
|
g_strdown((gchar *)content_type);
|
|
|
|
#endif
|
2003-03-15 00:58:57 +01:00
|
|
|
|
|
|
|
for (cur = mimeviewer_factories; cur != NULL; cur = g_slist_next(cur)) {
|
|
|
|
MimeViewerFactory *curfactory = cur->data;
|
2003-05-18 18:15:33 +02:00
|
|
|
gint i = 0;
|
|
|
|
|
|
|
|
while (curfactory->content_types[i] != NULL) {
|
2003-06-07 00:09:46 +02:00
|
|
|
if(!fnmatch(curfactory->content_types[i], content_type, FNM_CASEFOLD)) {
|
2004-01-12 22:28:31 +01:00
|
|
|
debug_print("%s\n", curfactory->content_types[i]);
|
2003-05-18 18:15:33 +02:00
|
|
|
factory = curfactory;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
i++;
|
2003-03-15 00:58:57 +01:00
|
|
|
}
|
2003-05-18 18:15:33 +02:00
|
|
|
if (factory != NULL)
|
|
|
|
break;
|
2003-03-15 00:58:57 +01:00
|
|
|
}
|
|
|
|
if (factory == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
for (cur = mimeview->viewers; cur != NULL; cur = g_slist_next(cur)) {
|
|
|
|
MimeViewer *curviewer = cur->data;
|
|
|
|
|
|
|
|
if (curviewer->factory == factory)
|
|
|
|
return curviewer;
|
|
|
|
}
|
|
|
|
viewer = factory->create_viewer();
|
2003-07-16 19:47:36 +02:00
|
|
|
gtk_container_add(GTK_CONTAINER(mimeview->mime_notebook),
|
|
|
|
GTK_WIDGET(viewer->get_widget(viewer)));
|
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
mimeview->viewers = g_slist_append(mimeview->viewers, viewer);
|
|
|
|
|
|
|
|
return viewer;
|
|
|
|
}
|
|
|
|
|
2003-03-26 00:35:47 +01:00
|
|
|
static MimeViewer *get_viewer_for_mimeinfo(MimeView *mimeview, MimeInfo *partinfo)
|
|
|
|
{
|
|
|
|
gchar *content_type = NULL;
|
2003-03-26 16:51:31 +01:00
|
|
|
MimeViewer *viewer = NULL;
|
2003-03-26 00:35:47 +01:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if ((partinfo->type == MIMETYPE_APPLICATION) &&
|
2004-10-26 12:43:50 +02:00
|
|
|
(!g_ascii_strcasecmp(partinfo->subtype, "octet-stream"))) {
|
2004-01-12 22:28:31 +01:00
|
|
|
const gchar *filename;
|
|
|
|
|
|
|
|
filename = procmime_mimeinfo_get_parameter(partinfo, "filename");
|
|
|
|
if (filename == NULL)
|
|
|
|
filename = procmime_mimeinfo_get_parameter(partinfo, "name");
|
|
|
|
if (filename != NULL)
|
|
|
|
content_type = procmime_get_mime_type(filename);
|
2003-03-26 00:35:47 +01:00
|
|
|
} else {
|
2004-05-10 12:22:28 +02:00
|
|
|
content_type = procmime_get_content_type_str(partinfo->type, partinfo->subtype);
|
2003-03-26 00:35:47 +01:00
|
|
|
}
|
|
|
|
|
2003-03-26 16:51:31 +01:00
|
|
|
if (content_type != NULL) {
|
|
|
|
viewer = get_viewer_for_content_type(mimeview, content_type);
|
|
|
|
g_free(content_type);
|
|
|
|
}
|
2003-03-26 00:35:47 +01:00
|
|
|
|
|
|
|
return viewer;
|
|
|
|
}
|
|
|
|
|
2005-02-09 09:59:12 +01:00
|
|
|
gboolean mimeview_show_part(MimeView *mimeview, MimeInfo *partinfo)
|
2003-03-15 00:58:57 +01:00
|
|
|
{
|
|
|
|
MimeViewer *viewer;
|
|
|
|
|
2003-03-26 00:35:47 +01:00
|
|
|
viewer = get_viewer_for_mimeinfo(mimeview, partinfo);
|
2003-03-15 00:58:57 +01:00
|
|
|
if (viewer == NULL) {
|
|
|
|
if (mimeview->mimeviewer != NULL)
|
|
|
|
mimeview->mimeviewer->clear_viewer(mimeview->mimeviewer);
|
|
|
|
mimeview->mimeviewer = NULL;
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-06-20 18:51:40 +02:00
|
|
|
if (mimeview->mimeviewer != NULL)
|
|
|
|
mimeview->mimeviewer->clear_viewer(mimeview->mimeviewer);
|
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
if (mimeview->mimeviewer != viewer) {
|
|
|
|
mimeview->mimeviewer = viewer;
|
|
|
|
mimeview_change_view_type(mimeview, MIMEVIEW_VIEWER);
|
|
|
|
}
|
|
|
|
viewer->show_mimepart(viewer, mimeview->file, partinfo);
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
return TRUE;
|
2003-03-15 00:58:57 +01:00
|
|
|
}
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
static void mimeview_change_view_type(MimeView *mimeview, MimeViewType type)
|
|
|
|
{
|
|
|
|
TextView *textview = mimeview->textview;
|
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
if ((mimeview->type != MIMEVIEW_VIEWER) &&
|
|
|
|
(mimeview->type == type)) return;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case MIMEVIEW_TEXT:
|
2004-11-18 08:11:16 +01:00
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(mimeview->mime_notebook),
|
2003-07-16 19:47:36 +02:00
|
|
|
gtk_notebook_page_num(GTK_NOTEBOOK(mimeview->mime_notebook),
|
|
|
|
GTK_WIDGET_PTR(textview)));
|
2001-04-19 14:21:46 +02:00
|
|
|
break;
|
2003-03-15 00:58:57 +01:00
|
|
|
case MIMEVIEW_VIEWER:
|
2004-11-18 08:11:16 +01:00
|
|
|
gtk_notebook_set_current_page(GTK_NOTEBOOK(mimeview->mime_notebook),
|
2003-07-16 19:47:36 +02:00
|
|
|
gtk_notebook_page_num(GTK_NOTEBOOK(mimeview->mime_notebook),
|
|
|
|
GTK_WIDGET(mimeview->mimeviewer->get_widget(mimeview->mimeviewer))));
|
2003-03-15 00:58:57 +01:00
|
|
|
break;
|
2001-04-19 14:21:46 +02:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mimeview->type = type;
|
|
|
|
}
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
void mimeview_clear(MimeView *mimeview)
|
2001-04-19 14:21:46 +02:00
|
|
|
{
|
|
|
|
GtkCList *clist = GTK_CLIST(mimeview->ctree);
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
noticeview_hide(mimeview->siginfoview);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
gtk_clist_clear(clist);
|
|
|
|
textview_clear(mimeview->textview);
|
2003-03-15 00:58:57 +01:00
|
|
|
if (mimeview->mimeviewer != NULL)
|
|
|
|
mimeview->mimeviewer->clear_viewer(mimeview->mimeviewer);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if (mimeview->mimeinfo != NULL)
|
|
|
|
procmime_mimeinfo_free_all(mimeview->mimeinfo);
|
|
|
|
mimeview->mimeinfo = NULL;
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
mimeview->opened = NULL;
|
|
|
|
|
|
|
|
g_free(mimeview->file);
|
|
|
|
mimeview->file = NULL;
|
2003-07-29 15:14:26 +02:00
|
|
|
|
2003-07-19 15:50:29 +02:00
|
|
|
icon_list_clear(mimeview);
|
2004-01-12 22:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void check_signature_cb(GtkWidget *widget, gpointer user_data);
|
|
|
|
static void display_full_info_cb(GtkWidget *widget, gpointer user_data);
|
|
|
|
|
|
|
|
static void update_signature_noticeview(MimeView *mimeview, MimeInfo *mimeinfo)
|
|
|
|
{
|
|
|
|
gchar *text = NULL, *button_text = NULL;
|
2004-07-17 18:58:04 +02:00
|
|
|
void *func = NULL;
|
2004-01-12 22:28:31 +01:00
|
|
|
StockPixmap icon = STOCK_PIXMAP_PRIVACY_SIGNED;
|
|
|
|
|
|
|
|
g_return_if_fail(mimeview != NULL);
|
|
|
|
g_return_if_fail(mimeinfo != NULL);
|
|
|
|
|
|
|
|
switch (privacy_mimeinfo_get_sig_status(mimeinfo)) {
|
|
|
|
case SIGNATURE_UNCHECKED:
|
|
|
|
button_text = _("Check");
|
|
|
|
func = check_signature_cb;
|
|
|
|
icon = STOCK_PIXMAP_PRIVACY_SIGNED;
|
|
|
|
break;
|
|
|
|
case SIGNATURE_OK:
|
|
|
|
button_text = _("Full info");
|
|
|
|
func = display_full_info_cb;
|
|
|
|
icon = STOCK_PIXMAP_PRIVACY_PASSED;
|
|
|
|
break;
|
|
|
|
case SIGNATURE_WARN:
|
|
|
|
button_text = _("Full info");
|
|
|
|
func = display_full_info_cb;
|
|
|
|
icon = STOCK_PIXMAP_PRIVACY_WARN;
|
|
|
|
break;
|
|
|
|
case SIGNATURE_INVALID:
|
|
|
|
button_text = _("Full info");
|
|
|
|
func = display_full_info_cb;
|
|
|
|
icon = STOCK_PIXMAP_PRIVACY_FAILED;
|
|
|
|
break;
|
|
|
|
case SIGNATURE_CHECK_FAILED:
|
|
|
|
button_text = _("Check again");
|
|
|
|
func = check_signature_cb;
|
|
|
|
icon = STOCK_PIXMAP_PRIVACY_UNKNOWN;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
text = privacy_mimeinfo_sig_info_short(mimeinfo);
|
|
|
|
noticeview_set_text(mimeview->siginfoview, text);
|
|
|
|
g_free(text);
|
|
|
|
noticeview_set_button_text(mimeview->siginfoview, button_text);
|
|
|
|
noticeview_set_button_press_callback(
|
|
|
|
mimeview->siginfoview,
|
2004-12-04 12:26:52 +01:00
|
|
|
G_CALLBACK(func),
|
2004-01-12 22:28:31 +01:00
|
|
|
(gpointer) mimeview);
|
|
|
|
noticeview_set_icon(mimeview->siginfoview, icon);
|
|
|
|
}
|
2002-02-25 10:25:17 +01:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
static void check_signature_cb(GtkWidget *widget, gpointer user_data)
|
|
|
|
{
|
|
|
|
MimeView *mimeview = (MimeView *) user_data;
|
|
|
|
MimeInfo *mimeinfo = mimeview->siginfo;
|
|
|
|
|
|
|
|
privacy_mimeinfo_check_signature(mimeinfo);
|
|
|
|
update_signature_noticeview(mimeview, mimeview->siginfo);
|
2004-06-25 10:05:09 +02:00
|
|
|
icon_list_clear(mimeview);
|
|
|
|
icon_list_create(mimeview, mimeview->mimeinfo);
|
2004-01-12 22:28:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void display_full_info_cb(GtkWidget *widget, gpointer user_data)
|
|
|
|
{
|
|
|
|
MimeView *mimeview = (MimeView *) user_data;
|
|
|
|
gchar *siginfo;
|
|
|
|
|
|
|
|
siginfo = privacy_mimeinfo_sig_info_full(mimeview->siginfo);
|
|
|
|
textview_set_text(mimeview->textview, siginfo);
|
|
|
|
g_free(siginfo);
|
|
|
|
noticeview_set_button_text(mimeview->siginfoview, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void update_signature_info(MimeView *mimeview, MimeInfo *selected)
|
|
|
|
{
|
|
|
|
MimeInfo *siginfo;
|
|
|
|
|
|
|
|
g_return_if_fail(mimeview != NULL);
|
|
|
|
g_return_if_fail(selected != NULL);
|
|
|
|
|
|
|
|
siginfo = selected;
|
|
|
|
while (siginfo != NULL) {
|
|
|
|
if (privacy_mimeinfo_is_signed(siginfo))
|
|
|
|
break;
|
|
|
|
siginfo = procmime_mimeinfo_parent(siginfo);
|
|
|
|
}
|
|
|
|
mimeview->siginfo = siginfo;
|
|
|
|
|
|
|
|
if (siginfo == NULL) {
|
|
|
|
noticeview_hide(mimeview->siginfoview);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
update_signature_noticeview(mimeview, siginfo);
|
|
|
|
noticeview_show(mimeview->siginfoview);
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mimeview_selected(GtkCTree *ctree, GtkCTreeNode *node, gint column,
|
|
|
|
MimeView *mimeview)
|
|
|
|
{
|
|
|
|
MimeInfo *partinfo;
|
|
|
|
|
|
|
|
if (mimeview->opened == node) return;
|
|
|
|
mimeview->opened = node;
|
|
|
|
gtk_ctree_node_moveto(ctree, node, -1, 0.5, 0);
|
|
|
|
|
|
|
|
partinfo = gtk_ctree_node_get_row_data(ctree, node);
|
|
|
|
if (!partinfo) return;
|
|
|
|
|
2001-06-03 12:34:31 +02:00
|
|
|
/* ungrab the mouse event */
|
|
|
|
if (GTK_WIDGET_HAS_GRAB(ctree)) {
|
|
|
|
gtk_grab_remove(GTK_WIDGET(ctree));
|
|
|
|
if (gdk_pointer_is_grabbed())
|
|
|
|
gdk_pointer_ungrab(GDK_CURRENT_TIME);
|
|
|
|
}
|
2002-07-16 01:56:33 +02:00
|
|
|
|
|
|
|
mimeview->textview->default_text = FALSE;
|
2004-01-12 22:28:31 +01:00
|
|
|
|
|
|
|
update_signature_info(mimeview, partinfo);
|
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
if (!mimeview_show_part(mimeview, partinfo)) {
|
2004-01-12 22:28:31 +01:00
|
|
|
switch (partinfo->type) {
|
|
|
|
case MIMETYPE_TEXT:
|
|
|
|
case MIMETYPE_MESSAGE:
|
|
|
|
case MIMETYPE_MULTIPART:
|
2003-03-15 00:58:57 +01:00
|
|
|
mimeview_show_message_part(mimeview, partinfo);
|
2002-07-16 01:56:33 +02:00
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
mimeview->textview->default_text = TRUE;
|
|
|
|
mimeview_change_view_type(mimeview, MIMEVIEW_TEXT);
|
2004-01-12 22:28:31 +01:00
|
|
|
textview_show_mime_part(mimeview->textview, partinfo);
|
2003-03-15 00:58:57 +01:00
|
|
|
break;
|
|
|
|
}
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-25 10:25:17 +01:00
|
|
|
static void mimeview_start_drag(GtkWidget *widget, gint button,
|
|
|
|
GdkEvent *event, MimeView *mimeview)
|
2001-04-19 14:21:46 +02:00
|
|
|
{
|
|
|
|
GdkDragContext *context;
|
|
|
|
MimeInfo *partinfo;
|
|
|
|
|
|
|
|
g_return_if_fail(mimeview != NULL);
|
2003-04-22 15:53:19 +02:00
|
|
|
|
|
|
|
partinfo = mimeview_get_selected_part(mimeview);
|
2004-01-12 22:28:31 +01:00
|
|
|
if (partinfo->disposition == DISPOSITIONTYPE_INLINE) return;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2003-07-17 10:39:41 +02:00
|
|
|
context = gtk_drag_begin(widget, mimeview->target_list,
|
2001-04-19 14:21:46 +02:00
|
|
|
GDK_ACTION_COPY, button, event);
|
|
|
|
gtk_drag_set_icon_default(context);
|
|
|
|
}
|
|
|
|
|
2002-01-29 11:03:33 +01:00
|
|
|
static gint mimeview_button_pressed(GtkWidget *widget, GdkEventButton *event,
|
2001-04-19 14:21:46 +02:00
|
|
|
MimeView *mimeview)
|
|
|
|
{
|
|
|
|
GtkCList *clist = GTK_CLIST(widget);
|
|
|
|
gint row, column;
|
|
|
|
|
2002-01-29 11:03:33 +01:00
|
|
|
if (!event) return FALSE;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
if (event->button == 2 || event->button == 3) {
|
|
|
|
if (!gtk_clist_get_selection_info(clist, event->x, event->y,
|
|
|
|
&row, &column))
|
2002-01-29 11:03:33 +01:00
|
|
|
return FALSE;
|
2001-04-19 14:21:46 +02:00
|
|
|
gtk_clist_unselect_all(clist);
|
|
|
|
gtk_clist_select_row(clist, row, column);
|
|
|
|
gtkut_clist_set_focus_row(clist, row);
|
|
|
|
}
|
2003-07-19 15:50:29 +02:00
|
|
|
part_button_pressed(mimeview, event, mimeview_get_selected_part(mimeview));
|
|
|
|
|
2004-01-27 23:24:47 +01:00
|
|
|
return FALSE;
|
2003-07-19 15:50:29 +02:00
|
|
|
}
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2004-07-17 11:38:14 +02:00
|
|
|
/* from gdkevents.c */
|
|
|
|
#define DOUBLE_CLICK_TIME 250
|
|
|
|
|
2003-10-05 12:25:17 +02:00
|
|
|
static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event,
|
|
|
|
MimeInfo *partinfo)
|
2003-07-19 15:50:29 +02:00
|
|
|
{
|
2004-07-17 11:38:14 +02:00
|
|
|
static MimeInfo *lastinfo;
|
|
|
|
static guint32 lasttime;
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
if (event->button == 2 ||
|
2004-07-17 11:38:14 +02:00
|
|
|
(event->button == 1 && (event->time - lasttime) < DOUBLE_CLICK_TIME && lastinfo == partinfo)) {
|
2001-04-19 14:21:46 +02:00
|
|
|
/* call external program for image, audio or html */
|
|
|
|
mimeview_launch(mimeview);
|
2003-10-05 12:25:17 +02:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
} else if (event->button == 3) {
|
2004-01-12 22:28:31 +01:00
|
|
|
if (partinfo && (partinfo->type == MIMETYPE_TEXT ||
|
|
|
|
partinfo->type == MIMETYPE_MESSAGE ||
|
|
|
|
partinfo->type == MIMETYPE_IMAGE ||
|
|
|
|
partinfo->type == MIMETYPE_MULTIPART))
|
2001-04-19 14:21:46 +02:00
|
|
|
menu_set_sensitive(mimeview->popupfactory,
|
|
|
|
"/Display as text", FALSE);
|
|
|
|
else
|
|
|
|
menu_set_sensitive(mimeview->popupfactory,
|
|
|
|
"/Display as text", TRUE);
|
2001-08-01 09:22:54 +02:00
|
|
|
if (partinfo &&
|
2004-01-12 22:28:31 +01:00
|
|
|
partinfo->type == MIMETYPE_APPLICATION &&
|
2004-10-26 12:43:50 +02:00
|
|
|
!g_ascii_strcasecmp(partinfo->subtype, "octet-stream"))
|
2001-08-01 09:22:54 +02:00
|
|
|
menu_set_sensitive(mimeview->popupfactory,
|
|
|
|
"/Open", FALSE);
|
|
|
|
else
|
|
|
|
menu_set_sensitive(mimeview->popupfactory,
|
|
|
|
"/Open", TRUE);
|
2002-04-21 13:27:07 +02:00
|
|
|
|
2004-05-25 10:39:41 +02:00
|
|
|
g_object_set_data(G_OBJECT(mimeview->popupmenu),
|
|
|
|
"pop_partinfo", partinfo);
|
2003-07-31 00:50:01 +02:00
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
gtk_menu_popup(GTK_MENU(mimeview->popupmenu),
|
|
|
|
NULL, NULL, NULL, NULL,
|
|
|
|
event->button, event->time);
|
2003-10-05 12:25:17 +02:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
2002-01-29 11:03:33 +01:00
|
|
|
|
2004-07-17 11:38:14 +02:00
|
|
|
lastinfo = partinfo;
|
|
|
|
lasttime = event->time;
|
2003-10-05 12:25:17 +02:00
|
|
|
return FALSE;
|
2002-01-29 11:03:33 +01:00
|
|
|
}
|
|
|
|
|
2003-07-19 15:50:29 +02:00
|
|
|
|
2002-01-29 11:03:33 +01:00
|
|
|
void mimeview_pass_key_press_event(MimeView *mimeview, GdkEventKey *event)
|
|
|
|
{
|
|
|
|
mimeview_key_pressed(mimeview->ctree, event, mimeview);
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#define BREAK_ON_MODIFIER_KEY() \
|
|
|
|
if ((event->state & (GDK_MOD1_MASK|GDK_CONTROL_MASK)) != 0) break
|
|
|
|
|
2002-01-29 11:03:33 +01:00
|
|
|
#define KEY_PRESS_EVENT_STOP() \
|
2004-07-03 18:31:08 +02:00
|
|
|
g_signal_stop_emission_by_name(G_OBJECT(ctree), \
|
|
|
|
"key_press_event");
|
2002-01-29 11:03:33 +01:00
|
|
|
|
|
|
|
static gint mimeview_key_pressed(GtkWidget *widget, GdkEventKey *event,
|
2001-04-19 14:21:46 +02:00
|
|
|
MimeView *mimeview)
|
|
|
|
{
|
|
|
|
SummaryView *summaryview;
|
2002-01-29 11:03:33 +01:00
|
|
|
GtkCTree *ctree = GTK_CTREE(widget);
|
2001-04-19 14:21:46 +02:00
|
|
|
GtkCTreeNode *node;
|
|
|
|
|
2002-01-29 11:03:33 +01:00
|
|
|
if (!event) return FALSE;
|
|
|
|
if (!mimeview->opened) return FALSE;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2004-07-17 23:15:07 +02:00
|
|
|
summaryview = mimeview->messageview->mainwin->summaryview;
|
|
|
|
|
|
|
|
if (summaryview && quicksearch_has_focus(summaryview->quicksearch))
|
|
|
|
return FALSE;
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
switch (event->keyval) {
|
|
|
|
case GDK_space:
|
2002-01-29 11:03:33 +01:00
|
|
|
if (textview_scroll_page(mimeview->textview, FALSE))
|
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
node = GTK_CTREE_NODE_NEXT(mimeview->opened);
|
|
|
|
if (node) {
|
|
|
|
gtk_sctree_unselect_all(GTK_SCTREE(ctree));
|
|
|
|
gtk_sctree_select(GTK_SCTREE(ctree), node);
|
2002-01-29 11:03:33 +01:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GDK_BackSpace:
|
|
|
|
textview_scroll_page(mimeview->textview, TRUE);
|
2002-01-29 11:03:33 +01:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
case GDK_Return:
|
|
|
|
textview_scroll_one_line(mimeview->textview,
|
|
|
|
(event->state & GDK_MOD1_MASK) != 0);
|
2002-01-29 11:03:33 +01:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
case GDK_n:
|
|
|
|
case GDK_N:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
|
|
|
if (!GTK_CTREE_NODE_NEXT(mimeview->opened)) break;
|
2002-01-29 11:03:33 +01:00
|
|
|
KEY_PRESS_EVENT_STOP();
|
2003-10-05 12:10:30 +02:00
|
|
|
g_signal_emit_by_name(G_OBJECT(ctree), "scroll_vertical",
|
2001-04-19 14:21:46 +02:00
|
|
|
GTK_SCROLL_STEP_FORWARD, 0.0);
|
2002-01-29 11:03:33 +01:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
case GDK_p:
|
|
|
|
case GDK_P:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
|
|
|
if (!GTK_CTREE_NODE_PREV(mimeview->opened)) break;
|
2002-01-29 11:03:33 +01:00
|
|
|
KEY_PRESS_EVENT_STOP();
|
2003-10-05 12:10:30 +02:00
|
|
|
g_signal_emit_by_name(G_OBJECT(ctree), "scroll_vertical",
|
2001-04-19 14:21:46 +02:00
|
|
|
GTK_SCROLL_STEP_BACKWARD, 0.0);
|
2002-01-29 11:03:33 +01:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
case GDK_y:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
2002-01-29 11:03:33 +01:00
|
|
|
KEY_PRESS_EVENT_STOP();
|
2001-04-19 14:21:46 +02:00
|
|
|
mimeview_save_as(mimeview);
|
2002-01-29 11:03:33 +01:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
case GDK_t:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
2002-01-29 11:03:33 +01:00
|
|
|
KEY_PRESS_EVENT_STOP();
|
2001-04-19 14:21:46 +02:00
|
|
|
mimeview_display_as_text(mimeview);
|
2002-04-21 13:27:07 +02:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
case GDK_l:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
2002-01-29 11:03:33 +01:00
|
|
|
KEY_PRESS_EVENT_STOP();
|
2001-04-19 14:21:46 +02:00
|
|
|
mimeview_launch(mimeview);
|
2002-01-29 11:03:33 +01:00
|
|
|
return TRUE;
|
2004-01-12 22:28:31 +01:00
|
|
|
case GDK_o:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
|
|
|
KEY_PRESS_EVENT_STOP();
|
|
|
|
mimeview_open_with(mimeview);
|
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
default:
|
2002-03-07 14:22:39 +01:00
|
|
|
break;
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
2002-01-29 11:03:33 +01:00
|
|
|
if (!mimeview->messageview->mainwin) return FALSE;
|
2004-07-17 23:15:07 +02:00
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
summary_pass_key_press_event(summaryview, event);
|
2002-01-29 11:03:33 +01:00
|
|
|
return TRUE;
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mimeview_drag_data_get(GtkWidget *widget,
|
|
|
|
GdkDragContext *drag_context,
|
|
|
|
GtkSelectionData *selection_data,
|
|
|
|
guint info,
|
|
|
|
guint time,
|
|
|
|
MimeView *mimeview)
|
|
|
|
{
|
2004-07-17 18:58:04 +02:00
|
|
|
gchar *filename, *uriname, *tmp;
|
2001-04-19 14:21:46 +02:00
|
|
|
MimeInfo *partinfo;
|
|
|
|
|
|
|
|
if (!mimeview->opened) return;
|
|
|
|
if (!mimeview->file) return;
|
|
|
|
|
2003-04-22 15:53:19 +02:00
|
|
|
partinfo = mimeview_get_selected_part(mimeview);
|
2001-04-19 14:21:46 +02:00
|
|
|
if (!partinfo) return;
|
|
|
|
|
2004-07-17 18:58:04 +02:00
|
|
|
filename = g_path_get_basename(get_part_name(partinfo));
|
2004-01-12 22:28:31 +01:00
|
|
|
if (*filename == '\0') return;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2004-07-17 18:58:04 +02:00
|
|
|
tmp = filename;
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
filename = g_strconcat(get_mime_tmp_dir(), G_DIR_SEPARATOR_S,
|
2004-01-12 22:28:31 +01:00
|
|
|
filename, NULL);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2004-07-17 18:58:04 +02:00
|
|
|
g_free(tmp);
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if (procmime_get_part(filename, partinfo) < 0)
|
2001-04-19 14:21:46 +02:00
|
|
|
alertpanel_error
|
|
|
|
(_("Can't save the part of multipart message."));
|
|
|
|
|
2004-09-06 11:59:38 +02:00
|
|
|
uriname = g_strconcat("file://", filename, NULL);
|
2001-04-19 14:21:46 +02:00
|
|
|
gtk_selection_data_set(selection_data, selection_data->target, 8,
|
|
|
|
uriname, strlen(uriname));
|
|
|
|
|
|
|
|
g_free(uriname);
|
|
|
|
g_free(filename);
|
|
|
|
}
|
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
/**
|
|
|
|
* Returns a filename (with path) for an attachment
|
|
|
|
* \param partinfo The attachment to save
|
|
|
|
* \param basedir The target directory
|
|
|
|
* \param number Used for dummy filename if attachment is unnamed
|
|
|
|
*/
|
|
|
|
gchar *mimeview_get_filename_for_part(MimeInfo *partinfo,
|
|
|
|
const gchar *basedir,
|
|
|
|
gint number)
|
|
|
|
{
|
|
|
|
gchar *fullname;
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
filename = g_strdup(get_part_name(partinfo));
|
|
|
|
if (!filename || !*filename)
|
|
|
|
filename = g_strdup_printf("noname.%d", number);
|
2005-02-15 16:00:28 +01:00
|
|
|
|
2005-02-17 09:54:47 +01:00
|
|
|
if (!g_utf8_validate(filename, -1, NULL)) {
|
|
|
|
gchar *tmp = conv_filename_to_utf8(filename);
|
|
|
|
g_free(filename);
|
|
|
|
filename = tmp;
|
|
|
|
}
|
|
|
|
|
2005-02-15 16:00:28 +01:00
|
|
|
subst_for_filename(filename);
|
2004-05-10 12:22:28 +02:00
|
|
|
|
|
|
|
fullname = g_strconcat
|
|
|
|
(basedir, G_DIR_SEPARATOR_S, (filename[0] == G_DIR_SEPARATOR)
|
|
|
|
? &filename[1] : filename, NULL);
|
|
|
|
|
|
|
|
g_free(filename);
|
|
|
|
return fullname;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write a single attachment to file
|
|
|
|
* \param filename Filename with path
|
|
|
|
* \param partinfo Attachment to save
|
|
|
|
*/
|
|
|
|
static gboolean mimeview_write_part(const gchar *filename,
|
|
|
|
MimeInfo *partinfo)
|
|
|
|
{
|
|
|
|
gchar *dir;
|
|
|
|
|
2004-11-12 10:21:06 +01:00
|
|
|
dir= g_path_get_dirname(filename);
|
2004-05-10 12:22:28 +02:00
|
|
|
if (!is_dir_exist(dir))
|
|
|
|
make_dir_hier(dir);
|
|
|
|
g_free(dir);
|
|
|
|
|
|
|
|
if (is_file_exist(filename)) {
|
|
|
|
AlertValue aval;
|
|
|
|
gchar *res;
|
|
|
|
|
|
|
|
res = g_strdup_printf(_("Overwrite existing file '%s'?"),
|
|
|
|
filename);
|
2005-01-29 17:53:23 +01:00
|
|
|
aval = alertpanel(_("Overwrite"), res, GTK_STOCK_OK,
|
|
|
|
GTK_STOCK_CANCEL, NULL);
|
2004-05-10 12:22:28 +02:00
|
|
|
g_free(res);
|
|
|
|
if (G_ALERTDEFAULT != aval) return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (procmime_get_part(filename, partinfo) < 0) {
|
|
|
|
alertpanel_error
|
|
|
|
(_("Can't save the part of multipart message."));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Menu callback: Save all attached files
|
|
|
|
* \param mimeview Current display
|
|
|
|
*/
|
2002-07-21 18:06:50 +02:00
|
|
|
static void mimeview_save_all(MimeView *mimeview)
|
|
|
|
{
|
2004-05-10 12:22:28 +02:00
|
|
|
MimeInfo *partinfo;
|
2002-07-21 18:06:50 +02:00
|
|
|
gchar *dirname;
|
2004-05-10 12:22:28 +02:00
|
|
|
gchar *startdir = NULL;
|
|
|
|
gint number = 1;
|
2002-07-21 18:06:50 +02:00
|
|
|
|
|
|
|
if (!mimeview->opened) return;
|
|
|
|
if (!mimeview->file) return;
|
2004-05-10 12:22:28 +02:00
|
|
|
if (!mimeview->mimeinfo) return;
|
2002-07-21 18:06:50 +02:00
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
partinfo = mimeview->mimeinfo;
|
|
|
|
if (prefs_common.attach_save_dir)
|
|
|
|
startdir = g_strconcat(prefs_common.attach_save_dir,
|
|
|
|
G_DIR_SEPARATOR_S, NULL);
|
2002-07-21 18:06:50 +02:00
|
|
|
|
2005-08-30 18:49:27 +02:00
|
|
|
dirname = filesel_select_file_save_folder(_("Select destination folder"), startdir);
|
2004-05-10 12:22:28 +02:00
|
|
|
if (!dirname) {
|
|
|
|
if (startdir) g_free(startdir);
|
|
|
|
return;
|
|
|
|
}
|
2002-07-21 18:06:50 +02:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if (!is_dir_exist (dirname)) {
|
2005-07-17 09:30:07 +02:00
|
|
|
alertpanel_error(_("'%s' is not a directory."),
|
2004-01-12 22:28:31 +01:00
|
|
|
dirname);
|
2004-05-10 12:22:28 +02:00
|
|
|
if (startdir) g_free(startdir);
|
2004-01-12 22:28:31 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
if (dirname[strlen(dirname)-1] == G_DIR_SEPARATOR)
|
|
|
|
dirname[strlen(dirname)-1] = '\0';
|
|
|
|
|
2004-10-01 14:00:51 +02:00
|
|
|
/* Skip the first part, that is sometimes DISPOSITIONTYPE_UNKNOWN */
|
|
|
|
if (partinfo && partinfo->type == MIMETYPE_MESSAGE)
|
|
|
|
partinfo = procmime_mimeinfo_next(partinfo);
|
|
|
|
if (partinfo && partinfo->type == MIMETYPE_MULTIPART) {
|
|
|
|
partinfo = procmime_mimeinfo_next(partinfo);
|
|
|
|
if (partinfo && partinfo->type == MIMETYPE_TEXT)
|
|
|
|
partinfo = procmime_mimeinfo_next(partinfo);
|
|
|
|
}
|
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
while (partinfo != NULL) {
|
|
|
|
if (partinfo->type != MIMETYPE_MESSAGE &&
|
|
|
|
partinfo->type != MIMETYPE_MULTIPART &&
|
2004-10-01 14:00:51 +02:00
|
|
|
partinfo->disposition != DISPOSITIONTYPE_INLINE) {
|
2004-05-10 12:22:28 +02:00
|
|
|
gchar *filename = mimeview_get_filename_for_part
|
|
|
|
(partinfo, dirname, number++);
|
|
|
|
|
|
|
|
mimeview_write_part(filename, partinfo);
|
|
|
|
g_free(filename);
|
2002-07-21 18:06:50 +02:00
|
|
|
}
|
2004-05-10 12:22:28 +02:00
|
|
|
partinfo = procmime_mimeinfo_next(partinfo);
|
2002-07-21 18:06:50 +02:00
|
|
|
}
|
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
if (prefs_common.attach_save_dir)
|
|
|
|
g_free(prefs_common.attach_save_dir);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
prefs_common.attach_save_dir = g_strdup(dirname);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
if (startdir) g_free(startdir);
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
/**
|
|
|
|
* Menu callback: Save the selected attachment
|
|
|
|
* \param mimeview Current display
|
|
|
|
*/
|
2001-04-19 14:21:46 +02:00
|
|
|
static void mimeview_save_as(MimeView *mimeview)
|
|
|
|
{
|
|
|
|
gchar *filename;
|
2004-05-10 12:22:28 +02:00
|
|
|
gchar *filepath = NULL;
|
|
|
|
gchar *filedir = NULL;
|
2001-04-19 14:21:46 +02:00
|
|
|
MimeInfo *partinfo;
|
2005-02-15 16:00:28 +01:00
|
|
|
gchar *partname = NULL;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
if (!mimeview->opened) return;
|
|
|
|
if (!mimeview->file) return;
|
|
|
|
|
2003-04-22 15:53:19 +02:00
|
|
|
partinfo = mimeview_get_selected_part(mimeview);
|
2003-07-31 00:50:01 +02:00
|
|
|
if (!partinfo) {
|
2004-05-25 10:39:41 +02:00
|
|
|
partinfo = (MimeInfo *) g_object_get_data
|
|
|
|
(G_OBJECT(mimeview->popupmenu),
|
2003-07-31 00:50:01 +02:00
|
|
|
"pop_partinfo");
|
2004-05-25 10:39:41 +02:00
|
|
|
g_object_set_data(G_OBJECT(mimeview->popupmenu),
|
|
|
|
"pop_partinfo", NULL);
|
2003-07-31 00:50:01 +02:00
|
|
|
}
|
2001-04-19 14:21:46 +02:00
|
|
|
g_return_if_fail(partinfo != NULL);
|
2004-01-12 22:28:31 +01:00
|
|
|
|
2005-02-15 16:00:28 +01:00
|
|
|
if (get_part_name(partinfo) == NULL) {
|
2004-08-30 00:56:20 +02:00
|
|
|
return;
|
2002-01-16 12:48:36 +01:00
|
|
|
}
|
2005-02-15 16:00:28 +01:00
|
|
|
partname = g_strdup(get_part_name(partinfo));
|
|
|
|
|
2005-02-17 09:54:47 +01:00
|
|
|
if (!g_utf8_validate(partname, -1, NULL)) {
|
|
|
|
gchar *tmp = conv_filename_to_utf8(partname);
|
|
|
|
g_free(partname);
|
|
|
|
partname = tmp;
|
|
|
|
}
|
|
|
|
|
2005-02-15 16:00:28 +01:00
|
|
|
subst_for_filename(partname);
|
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
if (prefs_common.attach_save_dir)
|
|
|
|
filepath = g_strconcat(prefs_common.attach_save_dir,
|
2004-08-30 00:56:20 +02:00
|
|
|
G_DIR_SEPARATOR_S, partname, NULL);
|
2004-05-10 12:22:28 +02:00
|
|
|
else
|
2004-08-30 00:56:20 +02:00
|
|
|
filepath = g_strdup(partname);
|
2004-05-10 12:22:28 +02:00
|
|
|
|
2005-02-15 16:00:28 +01:00
|
|
|
g_free(partname);
|
|
|
|
|
2004-07-21 11:39:52 +02:00
|
|
|
filename = filesel_select_file_save(_("Save as"), filepath);
|
2004-05-10 12:22:28 +02:00
|
|
|
if (!filename) {
|
|
|
|
g_free(filepath);
|
|
|
|
return;
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
mimeview_write_part(filename, partinfo);
|
|
|
|
|
2004-11-12 10:21:06 +01:00
|
|
|
filedir = g_path_get_dirname(filename);
|
2004-05-10 12:22:28 +02:00
|
|
|
if (filedir && strcmp(filedir, ".")) {
|
|
|
|
if (prefs_common.attach_save_dir)
|
|
|
|
g_free(prefs_common.attach_save_dir);
|
|
|
|
prefs_common.attach_save_dir = g_strdup(filedir);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free(filedir);
|
|
|
|
g_free(filepath);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mimeview_display_as_text(MimeView *mimeview)
|
|
|
|
{
|
|
|
|
MimeInfo *partinfo;
|
|
|
|
|
|
|
|
if (!mimeview->opened) return;
|
|
|
|
|
|
|
|
partinfo = mimeview_get_selected_part(mimeview);
|
|
|
|
if (!partinfo) {
|
2004-05-25 10:39:41 +02:00
|
|
|
partinfo = (MimeInfo *) g_object_get_data
|
|
|
|
(G_OBJECT(mimeview->popupmenu),
|
2004-05-10 12:22:28 +02:00
|
|
|
"pop_partinfo");
|
2004-05-25 10:39:41 +02:00
|
|
|
g_object_set_data(G_OBJECT(mimeview->popupmenu),
|
|
|
|
"pop_partinfo", NULL);
|
2004-05-10 12:22:28 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
g_return_if_fail(partinfo != NULL);
|
|
|
|
mimeview_show_message_part(mimeview, partinfo);
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mimeview_launch(MimeView *mimeview)
|
|
|
|
{
|
|
|
|
MimeInfo *partinfo;
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
if (!mimeview->opened) return;
|
|
|
|
if (!mimeview->file) return;
|
|
|
|
|
2003-04-22 15:53:19 +02:00
|
|
|
partinfo = mimeview_get_selected_part(mimeview);
|
2003-07-31 00:50:01 +02:00
|
|
|
if (!partinfo) {
|
2004-05-25 10:39:41 +02:00
|
|
|
partinfo = (MimeInfo *) g_object_get_data
|
|
|
|
(G_OBJECT(mimeview->popupmenu),
|
2003-07-31 00:50:01 +02:00
|
|
|
"pop_partinfo");
|
2004-05-25 10:39:41 +02:00
|
|
|
g_object_set_data(G_OBJECT(mimeview->popupmenu),
|
|
|
|
"pop_partinfo", NULL);
|
2003-07-31 00:50:01 +02:00
|
|
|
}
|
2001-04-19 14:21:46 +02:00
|
|
|
g_return_if_fail(partinfo != NULL);
|
|
|
|
|
|
|
|
filename = procmime_get_tmp_file_name(partinfo);
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if (procmime_get_part(filename, partinfo) < 0)
|
2001-04-19 14:21:46 +02:00
|
|
|
alertpanel_error
|
|
|
|
(_("Can't save the part of multipart message."));
|
|
|
|
else
|
2001-05-10 13:19:38 +02:00
|
|
|
mimeview_view_file(filename, partinfo, NULL);
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
g_free(filename);
|
|
|
|
}
|
|
|
|
|
2001-05-10 13:19:38 +02:00
|
|
|
static void mimeview_open_with(MimeView *mimeview)
|
|
|
|
{
|
|
|
|
MimeInfo *partinfo;
|
|
|
|
gchar *filename;
|
2001-11-07 11:29:45 +01:00
|
|
|
gchar *cmd;
|
2005-09-07 08:41:01 +02:00
|
|
|
gchar *mime_command = NULL;
|
|
|
|
gchar *content_type = NULL;
|
2001-05-10 13:19:38 +02:00
|
|
|
|
|
|
|
if (!mimeview->opened) return;
|
|
|
|
if (!mimeview->file) return;
|
|
|
|
|
2003-04-22 15:53:19 +02:00
|
|
|
partinfo = mimeview_get_selected_part(mimeview);
|
2003-07-31 00:50:01 +02:00
|
|
|
if (!partinfo) {
|
2004-05-25 10:39:41 +02:00
|
|
|
partinfo = (MimeInfo *) g_object_get_data
|
|
|
|
(G_OBJECT(mimeview->popupmenu),
|
2003-07-31 00:50:01 +02:00
|
|
|
"pop_partinfo");
|
2004-05-25 10:39:41 +02:00
|
|
|
g_object_set_data(G_OBJECT(mimeview->popupmenu),
|
|
|
|
"pop_partinfo", NULL);
|
2003-07-31 00:50:01 +02:00
|
|
|
}
|
2001-05-10 13:19:38 +02:00
|
|
|
g_return_if_fail(partinfo != NULL);
|
|
|
|
|
|
|
|
filename = procmime_get_tmp_file_name(partinfo);
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
if (procmime_get_part(filename, partinfo) < 0) {
|
2001-05-10 13:19:38 +02:00
|
|
|
alertpanel_error
|
|
|
|
(_("Can't save the part of multipart message."));
|
2001-11-07 11:29:45 +01:00
|
|
|
g_free(filename);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!prefs_common.mime_open_cmd_history)
|
|
|
|
prefs_common.mime_open_cmd_history =
|
|
|
|
add_history(NULL, prefs_common.mime_open_cmd);
|
|
|
|
|
2005-09-07 08:41:01 +02:00
|
|
|
content_type = procmime_get_content_type_str(partinfo->type,
|
|
|
|
partinfo->subtype);
|
|
|
|
mime_command = mailcap_get_command_for_type(content_type);
|
|
|
|
g_free(content_type);
|
2001-11-07 11:29:45 +01:00
|
|
|
cmd = input_dialog_combo
|
|
|
|
(_("Open with"),
|
|
|
|
_("Enter the command line to open file:\n"
|
2005-07-17 09:30:07 +02:00
|
|
|
"('%s' will be replaced with file name)"),
|
2005-09-07 08:41:01 +02:00
|
|
|
mime_command ? mime_command : prefs_common.mime_open_cmd,
|
2002-04-21 11:24:27 +02:00
|
|
|
prefs_common.mime_open_cmd_history,
|
|
|
|
TRUE);
|
2005-09-07 08:41:01 +02:00
|
|
|
g_free(mime_command);
|
2001-11-07 11:29:45 +01:00
|
|
|
if (cmd) {
|
|
|
|
mimeview_view_file(filename, partinfo, cmd);
|
|
|
|
g_free(prefs_common.mime_open_cmd);
|
|
|
|
prefs_common.mime_open_cmd = cmd;
|
|
|
|
prefs_common.mime_open_cmd_history =
|
|
|
|
add_history(prefs_common.mime_open_cmd_history, cmd);
|
2001-05-10 13:19:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free(filename);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mimeview_view_file(const gchar *filename, MimeInfo *partinfo,
|
|
|
|
const gchar *cmdline)
|
2001-04-19 14:21:46 +02:00
|
|
|
{
|
2005-08-22 12:36:39 +02:00
|
|
|
static gchar *default_image_cmdline = DEFAULT_IMAGE_VIEWER_CMD;
|
|
|
|
static gchar *default_audio_cmdline = DEFAULT_AUDIO_PLAYER_CMD;
|
2002-12-20 08:33:23 +01:00
|
|
|
static gchar *default_html_cmdline = DEFAULT_BROWSER_CMD;
|
2005-08-22 12:36:39 +02:00
|
|
|
static gchar *mime_cmdline = DEFAULT_MIME_CMD;
|
2001-04-19 14:21:46 +02:00
|
|
|
gchar buf[1024];
|
|
|
|
gchar m_buf[1024];
|
2001-05-10 13:19:38 +02:00
|
|
|
const gchar *cmd;
|
|
|
|
const gchar *def_cmd;
|
|
|
|
const gchar *p;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2001-05-10 13:19:38 +02:00
|
|
|
if (cmdline) {
|
|
|
|
cmd = cmdline;
|
|
|
|
def_cmd = NULL;
|
2004-01-12 22:28:31 +01:00
|
|
|
} else if (MIMETYPE_APPLICATION == partinfo->type &&
|
2004-10-26 12:43:50 +02:00
|
|
|
!g_ascii_strcasecmp(partinfo->subtype, "octet-stream")) {
|
2001-04-19 14:21:46 +02:00
|
|
|
return;
|
2004-01-12 22:28:31 +01:00
|
|
|
} else if (MIMETYPE_IMAGE == partinfo->type) {
|
2001-04-19 14:21:46 +02:00
|
|
|
cmd = prefs_common.mime_image_viewer;
|
|
|
|
def_cmd = default_image_cmdline;
|
2004-01-12 22:28:31 +01:00
|
|
|
} else if (MIMETYPE_AUDIO == partinfo->type) {
|
2001-04-19 14:21:46 +02:00
|
|
|
cmd = prefs_common.mime_audio_player;
|
|
|
|
def_cmd = default_audio_cmdline;
|
2004-01-12 22:28:31 +01:00
|
|
|
} else if (MIMETYPE_TEXT == partinfo->type && !strcmp(partinfo->subtype, "html")) {
|
2001-04-19 14:21:46 +02:00
|
|
|
cmd = prefs_common.uri_cmd;
|
|
|
|
def_cmd = default_html_cmdline;
|
|
|
|
} else {
|
2004-01-12 22:28:31 +01:00
|
|
|
gchar *content_type;
|
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
content_type = procmime_get_content_type_str(partinfo->type, partinfo->subtype);
|
2001-04-19 14:21:46 +02:00
|
|
|
g_snprintf(m_buf, sizeof(m_buf), mime_cmdline,
|
2004-01-12 22:28:31 +01:00
|
|
|
content_type, "%s");
|
|
|
|
g_free(content_type);
|
2001-04-19 14:21:46 +02:00
|
|
|
cmd = m_buf;
|
|
|
|
def_cmd = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmd && (p = strchr(cmd, '%')) && *(p + 1) == 's' &&
|
|
|
|
!strchr(p + 2, '%'))
|
|
|
|
g_snprintf(buf, sizeof(buf), cmd, filename);
|
|
|
|
else {
|
|
|
|
if (cmd)
|
2005-07-17 09:30:07 +02:00
|
|
|
g_warning("MIME viewer command line is invalid: '%s'", cmd);
|
2001-04-19 14:21:46 +02:00
|
|
|
if (def_cmd)
|
|
|
|
g_snprintf(buf, sizeof(buf), def_cmd, filename);
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-09-13 15:38:32 +02:00
|
|
|
execute_command_line(buf, TRUE);
|
2001-04-19 14:21:46 +02:00
|
|
|
}
|
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
void mimeview_register_viewer_factory(MimeViewerFactory *factory)
|
|
|
|
{
|
|
|
|
mimeviewer_factories = g_slist_append(mimeviewer_factories, factory);
|
|
|
|
}
|
|
|
|
|
2003-03-16 18:11:03 +01:00
|
|
|
static gint cmp_viewer_by_factroy(gconstpointer a, gconstpointer b)
|
|
|
|
{
|
|
|
|
return ((MimeViewer *) a)->factory == (MimeViewerFactory *) b ? 0 : -1;
|
|
|
|
}
|
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
void mimeview_unregister_viewer_factory(MimeViewerFactory *factory)
|
|
|
|
{
|
2003-03-16 18:11:03 +01:00
|
|
|
GSList *mimeview_list, *viewer_list;
|
|
|
|
|
|
|
|
for (mimeview_list = mimeviews; mimeview_list != NULL; mimeview_list = g_slist_next(mimeview_list)) {
|
|
|
|
MimeView *mimeview = (MimeView *) mimeview_list->data;
|
|
|
|
|
|
|
|
if (mimeview->mimeviewer && mimeview->mimeviewer->factory == factory) {
|
|
|
|
mimeview_change_view_type(mimeview, MIMEVIEW_TEXT);
|
|
|
|
mimeview->mimeviewer = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((viewer_list = g_slist_find_custom(mimeview->viewers, factory, cmp_viewer_by_factroy)) != NULL) {
|
|
|
|
MimeViewer *mimeviewer = (MimeViewer *) viewer_list->data;
|
|
|
|
|
|
|
|
mimeviewer->destroy_viewer(mimeviewer);
|
|
|
|
mimeview->viewers = g_slist_remove(mimeview->viewers, mimeviewer);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-15 00:58:57 +01:00
|
|
|
mimeviewer_factories = g_slist_remove(mimeviewer_factories, factory);
|
|
|
|
}
|
2003-07-19 15:50:29 +02:00
|
|
|
|
|
|
|
static gboolean icon_clicked_cb (GtkWidget *button, GdkEventButton *event, MimeView *mimeview)
|
|
|
|
{
|
2003-07-24 02:40:01 +02:00
|
|
|
gint num;
|
2003-07-19 15:50:29 +02:00
|
|
|
MimeInfo *partinfo;
|
2003-07-24 02:40:01 +02:00
|
|
|
|
2004-05-25 10:39:41 +02:00
|
|
|
num = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "icon_number"));
|
|
|
|
partinfo = g_object_get_data(G_OBJECT(button), "partinfo");
|
2004-01-12 22:28:31 +01:00
|
|
|
|
|
|
|
icon_selected(mimeview, num, partinfo);
|
|
|
|
gtk_widget_grab_focus(button);
|
|
|
|
if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) {
|
|
|
|
toggle_icon(GTK_TOGGLE_BUTTON(button), mimeview);
|
|
|
|
if (event->button == 2 || event->button == 3)
|
|
|
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
|
|
|
|
TRUE);
|
|
|
|
}
|
2003-07-27 21:04:30 +02:00
|
|
|
|
2003-07-19 15:50:29 +02:00
|
|
|
part_button_pressed(mimeview, event, partinfo);
|
2003-07-27 21:04:30 +02:00
|
|
|
|
2003-10-05 12:25:17 +02:00
|
|
|
return FALSE;
|
2003-07-19 15:50:29 +02:00
|
|
|
}
|
|
|
|
|
2003-07-24 02:40:01 +02:00
|
|
|
static void icon_selected (MimeView *mimeview, gint num, MimeInfo *partinfo)
|
|
|
|
{
|
2004-01-12 22:28:31 +01:00
|
|
|
GtkCTreeNode *node;
|
|
|
|
node = gtk_ctree_find_by_row_data(GTK_CTREE(mimeview->ctree), NULL, partinfo);
|
|
|
|
if (node)
|
|
|
|
gtk_ctree_select(GTK_CTREE(mimeview->ctree), node);
|
2003-07-24 02:40:01 +02:00
|
|
|
}
|
|
|
|
|
2003-08-02 20:27:04 +02:00
|
|
|
#undef KEY_PRESS_EVENT_STOP
|
|
|
|
#define KEY_PRESS_EVENT_STOP() \
|
2004-07-03 18:31:08 +02:00
|
|
|
g_signal_stop_emission_by_name(G_OBJECT(button), \
|
|
|
|
"key_press_event");
|
|
|
|
|
2003-07-24 02:40:01 +02:00
|
|
|
static gint icon_key_pressed(GtkWidget *button, GdkEventKey *event,
|
|
|
|
MimeView *mimeview)
|
|
|
|
{
|
2003-08-02 20:27:04 +02:00
|
|
|
gint num;
|
|
|
|
MimeInfo *partinfo;
|
|
|
|
SummaryView *summaryview;
|
|
|
|
TextView *textview;
|
2003-07-24 02:40:01 +02:00
|
|
|
|
2004-05-25 10:39:41 +02:00
|
|
|
num = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "icon_number"));
|
|
|
|
partinfo = g_object_get_data(G_OBJECT(button), "partinfo");
|
2003-07-24 02:40:01 +02:00
|
|
|
|
|
|
|
if (!event) return FALSE;
|
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
textview = mimeview->textview;
|
2003-08-02 20:27:04 +02:00
|
|
|
|
2003-07-24 02:40:01 +02:00
|
|
|
switch (event->keyval) {
|
2003-08-02 20:27:04 +02:00
|
|
|
case GDK_space:
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) {
|
|
|
|
/* stop the button being untoggled */
|
|
|
|
KEY_PRESS_EVENT_STOP();
|
|
|
|
if (textview_scroll_page(textview, FALSE))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if (icon_list_select_by_number(mimeview, num + 1))
|
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
icon_selected(mimeview, num, partinfo);
|
|
|
|
toggle_icon(GTK_TOGGLE_BUTTON(button), mimeview);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case GDK_BackSpace:
|
|
|
|
textview_scroll_page(textview, TRUE);
|
2003-07-24 02:40:01 +02:00
|
|
|
return TRUE;
|
2003-08-02 20:27:04 +02:00
|
|
|
case GDK_Return:
|
|
|
|
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) {
|
|
|
|
KEY_PRESS_EVENT_STOP();
|
|
|
|
textview_scroll_one_line(textview,
|
|
|
|
(event->state & GDK_MOD1_MASK) != 0);
|
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
icon_selected(mimeview, num, partinfo);
|
|
|
|
toggle_icon(GTK_TOGGLE_BUTTON(button), mimeview);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
case GDK_n:
|
|
|
|
case GDK_N:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
2004-01-12 22:28:31 +01:00
|
|
|
if (icon_list_select_by_number(mimeview, num + 1)) {
|
2003-08-02 20:27:04 +02:00
|
|
|
KEY_PRESS_EVENT_STOP();
|
|
|
|
return TRUE;
|
2004-01-12 22:28:31 +01:00
|
|
|
}
|
2003-07-24 02:40:01 +02:00
|
|
|
break;
|
2003-08-02 20:27:04 +02:00
|
|
|
|
|
|
|
case GDK_p:
|
|
|
|
case GDK_P:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
2004-01-12 22:28:31 +01:00
|
|
|
if (icon_list_select_by_number(mimeview, num - 1)) {
|
2003-08-02 20:27:04 +02:00
|
|
|
KEY_PRESS_EVENT_STOP();
|
|
|
|
return TRUE;
|
2004-01-12 22:28:31 +01:00
|
|
|
}
|
2003-08-02 20:27:04 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GDK_y:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
|
|
|
KEY_PRESS_EVENT_STOP();
|
|
|
|
mimeview_save_as(mimeview);
|
|
|
|
return TRUE;
|
|
|
|
case GDK_t:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
|
|
|
KEY_PRESS_EVENT_STOP();
|
|
|
|
mimeview_display_as_text(mimeview);
|
|
|
|
return TRUE;
|
|
|
|
case GDK_l:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
|
|
|
KEY_PRESS_EVENT_STOP();
|
|
|
|
mimeview_launch(mimeview);
|
|
|
|
return TRUE;
|
2004-01-12 22:28:31 +01:00
|
|
|
case GDK_o:
|
|
|
|
BREAK_ON_MODIFIER_KEY();
|
|
|
|
KEY_PRESS_EVENT_STOP();
|
|
|
|
mimeview_open_with(mimeview);
|
|
|
|
return TRUE;
|
2003-07-24 02:40:01 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-08-02 20:27:04 +02:00
|
|
|
|
|
|
|
if (!mimeview->messageview->mainwin) return FALSE;
|
|
|
|
summaryview = mimeview->messageview->mainwin->summaryview;
|
|
|
|
summary_pass_key_press_event(summaryview, event);
|
|
|
|
return TRUE;
|
2003-07-24 02:40:01 +02:00
|
|
|
}
|
|
|
|
|
2003-07-27 21:04:30 +02:00
|
|
|
static void toggle_icon(GtkToggleButton *button, MimeView *mimeview)
|
2003-07-24 08:34:22 +02:00
|
|
|
{
|
|
|
|
GList *child;
|
|
|
|
|
2003-10-05 12:10:30 +02:00
|
|
|
child = gtk_container_get_children(GTK_CONTAINER(mimeview->icon_vbox));
|
2003-07-24 08:34:22 +02:00
|
|
|
for (; child != NULL; child = g_list_next(child)) {
|
2003-07-27 21:04:30 +02:00
|
|
|
if (GTK_IS_TOGGLE_BUTTON(child->data) &&
|
|
|
|
GTK_TOGGLE_BUTTON(child->data) != button &&
|
|
|
|
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(child->data)))
|
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON(child->data),
|
|
|
|
FALSE);
|
2003-07-24 08:34:22 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-19 15:50:29 +02:00
|
|
|
static void icon_list_append_icon (MimeView *mimeview, MimeInfo *mimeinfo)
|
|
|
|
{
|
2005-05-31 21:00:21 +02:00
|
|
|
GtkWidget *pixmap = NULL;
|
2003-07-19 15:50:29 +02:00
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *button;
|
|
|
|
gchar *tip;
|
2004-06-25 10:05:09 +02:00
|
|
|
gchar *tiptmp;
|
2004-05-10 12:22:28 +02:00
|
|
|
const gchar *desc = NULL;
|
2004-06-25 10:05:09 +02:00
|
|
|
gchar *sigshort = NULL;
|
2004-05-10 12:22:28 +02:00
|
|
|
gchar *content_type;
|
2003-07-19 15:50:29 +02:00
|
|
|
StockPixmap stockp;
|
2004-06-25 10:05:09 +02:00
|
|
|
MimeInfo *partinfo;
|
|
|
|
MimeInfo *siginfo = NULL;
|
|
|
|
MimeInfo *encrypted = NULL;
|
2003-07-19 15:50:29 +02:00
|
|
|
|
|
|
|
vbox = mimeview->icon_vbox;
|
|
|
|
mimeview->icon_count++;
|
2003-07-24 08:34:22 +02:00
|
|
|
button = gtk_toggle_button_new();
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
|
2004-05-25 10:39:41 +02:00
|
|
|
g_object_set_data(G_OBJECT(button), "icon_number",
|
|
|
|
GINT_TO_POINTER(mimeview->icon_count));
|
|
|
|
g_object_set_data(G_OBJECT(button), "partinfo",
|
|
|
|
mimeinfo);
|
2003-07-19 15:50:29 +02:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
switch (mimeinfo->type) {
|
2003-07-19 15:50:29 +02:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
case MIMETYPE_TEXT:
|
2004-10-26 12:43:50 +02:00
|
|
|
if (mimeinfo->subtype && !g_ascii_strcasecmp(mimeinfo->subtype, "html"))
|
2004-01-12 22:28:31 +01:00
|
|
|
stockp = STOCK_PIXMAP_MIME_TEXT_HTML;
|
2004-10-26 12:43:50 +02:00
|
|
|
else if (mimeinfo->subtype && !g_ascii_strcasecmp(mimeinfo->subtype, "enriched"))
|
2004-01-12 22:28:31 +01:00
|
|
|
stockp = STOCK_PIXMAP_MIME_TEXT_ENRICHED;
|
|
|
|
else
|
|
|
|
stockp = STOCK_PIXMAP_MIME_TEXT_PLAIN;
|
2003-07-19 15:50:29 +02:00
|
|
|
break;
|
2004-01-12 22:28:31 +01:00
|
|
|
case MIMETYPE_MESSAGE:
|
|
|
|
stockp = STOCK_PIXMAP_MIME_MESSAGE;
|
2003-07-19 15:50:29 +02:00
|
|
|
break;
|
2004-01-12 22:28:31 +01:00
|
|
|
case MIMETYPE_APPLICATION:
|
|
|
|
stockp = STOCK_PIXMAP_MIME_APPLICATION;
|
2003-07-19 15:50:29 +02:00
|
|
|
break;
|
2004-01-12 22:28:31 +01:00
|
|
|
case MIMETYPE_IMAGE:
|
2003-07-19 15:50:29 +02:00
|
|
|
stockp = STOCK_PIXMAP_MIME_IMAGE;
|
|
|
|
break;
|
2004-01-12 22:28:31 +01:00
|
|
|
case MIMETYPE_AUDIO:
|
2003-07-19 15:50:29 +02:00
|
|
|
stockp = STOCK_PIXMAP_MIME_AUDIO;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
stockp = STOCK_PIXMAP_MIME_UNKNOWN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-06-25 10:05:09 +02:00
|
|
|
partinfo = mimeinfo;
|
|
|
|
while (partinfo != NULL) {
|
|
|
|
if (privacy_mimeinfo_is_signed(partinfo)) {
|
|
|
|
siginfo = partinfo;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (privacy_mimeinfo_is_encrypted(partinfo)) {
|
|
|
|
encrypted = partinfo;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
partinfo = procmime_mimeinfo_parent(partinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (siginfo != NULL) {
|
|
|
|
switch (privacy_mimeinfo_get_sig_status(siginfo)) {
|
|
|
|
case SIGNATURE_UNCHECKED:
|
|
|
|
case SIGNATURE_CHECK_FAILED:
|
|
|
|
pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
|
|
|
|
STOCK_PIXMAP_PRIVACY_EMBLEM_SIGNED, OVERLAY_BOTTOM_RIGHT, 6, 3);
|
|
|
|
break;
|
|
|
|
case SIGNATURE_OK:
|
|
|
|
pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
|
|
|
|
STOCK_PIXMAP_PRIVACY_EMBLEM_PASSED, OVERLAY_BOTTOM_RIGHT, 6, 3);
|
|
|
|
break;
|
|
|
|
case SIGNATURE_WARN:
|
|
|
|
pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
|
|
|
|
STOCK_PIXMAP_PRIVACY_EMBLEM_WARN, OVERLAY_BOTTOM_RIGHT, 6, 3);
|
|
|
|
break;
|
|
|
|
case SIGNATURE_INVALID:
|
|
|
|
pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
|
|
|
|
STOCK_PIXMAP_PRIVACY_EMBLEM_FAILED, OVERLAY_BOTTOM_RIGHT, 6, 3);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sigshort = privacy_mimeinfo_sig_info_short(siginfo);
|
|
|
|
} else if (encrypted != NULL) {
|
|
|
|
pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp,
|
|
|
|
STOCK_PIXMAP_PRIVACY_EMBLEM_ENCRYPTED, OVERLAY_BOTTOM_RIGHT, 6, 3);
|
|
|
|
} else {
|
|
|
|
pixmap = stock_pixmap_widget_with_overlay(mimeview->mainwin->window, stockp, 0,
|
|
|
|
OVERLAY_NONE, 6, 3);
|
|
|
|
}
|
2003-07-19 15:50:29 +02:00
|
|
|
gtk_container_add(GTK_CONTAINER(button), pixmap);
|
|
|
|
|
|
|
|
if (!desc) {
|
|
|
|
if (prefs_common.attach_desc)
|
|
|
|
desc = get_part_description(mimeinfo);
|
|
|
|
else
|
|
|
|
desc = get_part_name(mimeinfo);
|
|
|
|
}
|
2004-01-12 22:28:31 +01:00
|
|
|
|
2004-05-10 12:22:28 +02:00
|
|
|
content_type = procmime_get_content_type_str(mimeinfo->type,
|
|
|
|
mimeinfo->subtype);
|
|
|
|
|
2004-06-25 10:05:09 +02:00
|
|
|
tip = g_strjoin("\n", content_type,
|
|
|
|
to_human_readable(mimeinfo->length), NULL);
|
2004-05-10 12:22:28 +02:00
|
|
|
g_free(content_type);
|
2004-06-25 10:05:09 +02:00
|
|
|
if (desc && *desc) {
|
2005-02-17 09:54:47 +01:00
|
|
|
gchar *tmp = NULL;
|
|
|
|
if (!g_utf8_validate(desc, -1, NULL)) {
|
|
|
|
tmp = conv_filename_to_utf8(desc);
|
|
|
|
} else {
|
|
|
|
tmp = g_strdup(desc);
|
|
|
|
}
|
|
|
|
tiptmp = g_strjoin("\n", tmp, tip, NULL);
|
2004-06-25 10:05:09 +02:00
|
|
|
g_free(tip);
|
|
|
|
tip = tiptmp;
|
2005-02-17 09:54:47 +01:00
|
|
|
g_free(tmp);
|
2004-06-25 10:05:09 +02:00
|
|
|
}
|
|
|
|
if (sigshort && *sigshort) {
|
|
|
|
tiptmp = g_strjoin("\n", tip, sigshort, NULL);
|
|
|
|
g_free(tip);
|
|
|
|
tip = tiptmp;
|
|
|
|
}
|
|
|
|
g_free(sigshort);
|
2003-07-19 15:50:29 +02:00
|
|
|
|
|
|
|
gtk_tooltips_set_tip(mimeview->tooltips, button, tip, NULL);
|
|
|
|
g_free(tip);
|
|
|
|
gtk_widget_show_all(button);
|
2004-07-16 13:12:46 +02:00
|
|
|
g_signal_connect(G_OBJECT(button), "button_release_event",
|
2003-10-05 12:10:30 +02:00
|
|
|
G_CALLBACK(icon_clicked_cb), mimeview);
|
|
|
|
g_signal_connect(G_OBJECT(button), "key_press_event",
|
|
|
|
G_CALLBACK(icon_key_pressed), mimeview);
|
2003-07-19 15:50:29 +02:00
|
|
|
gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
|
2003-07-24 02:40:01 +02:00
|
|
|
|
2003-07-19 15:50:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void icon_list_clear (MimeView *mimeview)
|
|
|
|
{
|
|
|
|
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));
|
2005-02-15 11:19:29 +01:00
|
|
|
gtk_adjustment_set_value(adj, adj->lower);
|
2003-07-19 15:50:29 +02:00
|
|
|
}
|
|
|
|
|
2003-07-24 08:34:22 +02:00
|
|
|
static void icon_list_toggle_by_mime_info(MimeView *mimeview,
|
|
|
|
MimeInfo *mimeinfo)
|
|
|
|
{
|
|
|
|
GList *child;
|
|
|
|
|
|
|
|
child = gtk_container_children(GTK_CONTAINER(mimeview->icon_vbox));
|
|
|
|
for (; child != NULL; child = g_list_next(child)) {
|
|
|
|
if (GTK_IS_TOGGLE_BUTTON(child->data) &&
|
2004-05-25 10:39:41 +02:00
|
|
|
g_object_get_data(G_OBJECT(child->data),
|
|
|
|
"partinfo") == (gpointer)mimeinfo) {
|
2003-08-02 20:27:04 +02:00
|
|
|
toggle_icon(GTK_TOGGLE_BUTTON(child->data), mimeview);
|
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON(child->data), TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
*\brief Used to 'click' the next or previous icon.
|
|
|
|
*
|
|
|
|
*\return true if the icon 'number' exists and was selected.
|
|
|
|
*/
|
|
|
|
static gboolean icon_list_select_by_number(MimeView *mimeview,
|
|
|
|
gint number)
|
|
|
|
{
|
|
|
|
GList *child;
|
|
|
|
|
|
|
|
if (number == 0) return FALSE;
|
|
|
|
child = gtk_container_children(GTK_CONTAINER(mimeview->icon_vbox));
|
|
|
|
for (; child != NULL; child = g_list_next(child)) {
|
|
|
|
if (GTK_IS_TOGGLE_BUTTON(child->data) &&
|
2004-05-25 10:39:41 +02:00
|
|
|
GPOINTER_TO_INT(g_object_get_data(G_OBJECT(child->data),
|
2003-08-02 20:27:04 +02:00
|
|
|
"icon_number")) == number) {
|
|
|
|
icon_selected(mimeview, number,
|
2004-05-25 10:39:41 +02:00
|
|
|
(MimeInfo*)g_object_get_data(G_OBJECT(child->data),
|
|
|
|
"partinfo"));
|
2003-08-02 20:27:04 +02:00
|
|
|
toggle_icon(GTK_TOGGLE_BUTTON(child->data), mimeview);
|
2003-07-24 08:34:22 +02:00
|
|
|
gtk_toggle_button_set_active
|
|
|
|
(GTK_TOGGLE_BUTTON(child->data), TRUE);
|
2003-08-02 20:27:04 +02:00
|
|
|
gtk_widget_grab_focus(GTK_WIDGET(child->data));
|
|
|
|
|
|
|
|
return TRUE;
|
2003-07-24 08:34:22 +02:00
|
|
|
}
|
|
|
|
}
|
2003-08-02 20:27:04 +02:00
|
|
|
return FALSE;
|
2003-07-24 08:34:22 +02:00
|
|
|
}
|
|
|
|
|
2003-07-19 15:50:29 +02:00
|
|
|
static void icon_scroll_size_allocate_cb(GtkWidget *widget,
|
2003-10-05 12:25:17 +02:00
|
|
|
GtkAllocation *size, MimeView *mimeview)
|
2003-07-19 15:50:29 +02:00
|
|
|
{
|
|
|
|
GtkAllocation *mainbox_size;
|
|
|
|
GtkAllocation *vbox_size;
|
|
|
|
GtkAllocation *layout_size;
|
|
|
|
GtkAdjustment *adj;
|
|
|
|
|
|
|
|
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;
|
2004-07-03 18:31:08 +02:00
|
|
|
|
2003-07-20 00:24:05 +02:00
|
|
|
gtk_layout_set_size(GTK_LAYOUT(mimeview->icon_scroll),
|
|
|
|
GTK_LAYOUT(mimeview->icon_scroll)->width,
|
|
|
|
MAX(vbox_size->height, layout_size->height));
|
2003-07-19 15:50:29 +02:00
|
|
|
adj->step_increment = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void icon_list_create(MimeView *mimeview, MimeInfo *mimeinfo)
|
|
|
|
{
|
2003-07-24 02:40:01 +02:00
|
|
|
GtkRequisition size;
|
2004-07-27 10:52:20 +02:00
|
|
|
|
2003-07-19 15:50:29 +02:00
|
|
|
g_return_if_fail(mimeinfo != NULL);
|
|
|
|
|
|
|
|
while (mimeinfo != NULL) {
|
2004-01-12 22:28:31 +01:00
|
|
|
if (mimeinfo->type != MIMETYPE_MULTIPART)
|
2003-07-19 15:50:29 +02:00
|
|
|
icon_list_append_icon(mimeview, mimeinfo);
|
2004-01-12 22:28:31 +01:00
|
|
|
if (mimeinfo->node->children != NULL)
|
2004-07-27 10:52:20 +02:00
|
|
|
icon_list_create(mimeview,
|
|
|
|
(MimeInfo *) mimeinfo->node->children->data);
|
|
|
|
mimeinfo = mimeinfo->node->next != NULL
|
|
|
|
? (MimeInfo *) mimeinfo->node->next->data
|
|
|
|
: NULL;
|
2003-07-19 15:50:29 +02:00
|
|
|
}
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_widget_size_request(mimeview->icon_vbox, &size);
|
2004-07-27 10:52:20 +02:00
|
|
|
if (size.width > mimeview->icon_mainbox->requisition.width) {
|
2003-10-05 12:10:30 +02:00
|
|
|
gtk_widget_set_size_request(mimeview->icon_mainbox,
|
2004-07-27 10:52:20 +02:00
|
|
|
size.width, -1);
|
2003-07-24 02:40:01 +02:00
|
|
|
}
|
|
|
|
|
2003-07-19 15:50:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void mime_toggle_button_cb (GtkWidget *button, MimeView *mimeview)
|
|
|
|
{
|
|
|
|
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);
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_widget_hide(mimeview->icon_mainbox);
|
|
|
|
gtk_widget_show(mimeview->ctree_mainbox);
|
|
|
|
gtk_paned_set_position(GTK_PANED(mimeview->paned), mimeview->oldsize);
|
|
|
|
|
2003-07-19 15:50:29 +02:00
|
|
|
gtkut_container_remove(GTK_CONTAINER(mimeview->icon_mainbox),
|
|
|
|
button);
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_box_pack_end(GTK_BOX(mimeview->ctree_mainbox),
|
2003-07-19 15:50:29 +02:00
|
|
|
button, FALSE, FALSE, 0);
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_paned_set_gutter_size(GTK_PANED(mimeview->paned), 6);
|
2003-07-19 15:50:29 +02:00
|
|
|
} else {
|
|
|
|
gtk_arrow_set(GTK_ARROW(GTK_BIN(button)->child), GTK_ARROW_LEFT,
|
|
|
|
GTK_SHADOW_NONE);
|
2003-07-24 02:40:01 +02:00
|
|
|
mimeview->oldsize = mimeview->ctree_mainbox->allocation.height;
|
|
|
|
gtk_widget_hide(mimeview->ctree_mainbox);
|
|
|
|
gtk_widget_show(mimeview->icon_mainbox);
|
|
|
|
gtk_paned_set_position(GTK_PANED(mimeview->paned), 0);
|
2003-07-19 15:50:29 +02:00
|
|
|
|
|
|
|
gtkut_container_remove(GTK_CONTAINER(mimeview->ctree_mainbox),
|
|
|
|
button);
|
|
|
|
gtk_box_pack_start(GTK_BOX(mimeview->icon_mainbox),
|
|
|
|
button, FALSE, FALSE, 0);
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_box_reorder_child(GTK_BOX(button->parent), button, 0);
|
2003-07-25 14:39:29 +02:00
|
|
|
if (mimeview->opened)
|
|
|
|
icon_list_toggle_by_mime_info
|
|
|
|
(mimeview, gtk_ctree_node_get_row_data(GTK_CTREE(mimeview->ctree),
|
|
|
|
mimeview->opened));
|
2003-07-24 02:40:01 +02:00
|
|
|
|
2004-01-12 22:28:31 +01:00
|
|
|
gtk_paned_set_gutter_size(GTK_PANED(mimeview->paned), 0);
|
2003-07-19 15:50:29 +02:00
|
|
|
}
|
2003-07-24 02:40:01 +02:00
|
|
|
gtk_widget_grab_focus(button);
|
2003-07-19 15:50:29 +02:00
|
|
|
gtk_widget_unref(button);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void mimeview_update (MimeView *mimeview) {
|
|
|
|
if (mimeview && mimeview->mimeinfo) {
|
|
|
|
icon_list_clear(mimeview);
|
|
|
|
icon_list_create(mimeview, mimeview->mimeinfo);
|
|
|
|
}
|
|
|
|
}
|