Fix Fancy showing a previous email in some cases.
[claws.git] / src / plugins / fancy / fancy_viewer.h
1 /*
2  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3  * == Fancy Plugin ==
4  * Copyright (C) 1999-2013 Hiroyuki Yamamoto and the Claws Mail Team
5  * This file Copyright (C) 2009-2013 Salvatore De Paolis <iwkse@claws-mail.org>
6  *  and the Claws Mail Team
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22
23 #ifndef FANCY_VIEWER_H
24 #define FANCY_VIEWER_H
25
26 #include <unistd.h>
27 #include <stdio.h>
28
29 #include <glib.h>
30 #include <glib/gi18n.h>
31 #include <gtk/gtk.h>
32 #include <webkit/webkitwebview.h>
33 #include <webkit/webkitversion.h>
34 #include <webkit/webkitwebframe.h>
35 #include <webkit/webkitnetworkrequest.h>
36 #include <webkit/webkitwebnavigationaction.h>
37 #include <webkit/webkitwebpolicydecision.h>
38 #if WEBKIT_CHECK_VERSION (1,3,10)
39 #include <webkit/webkitglobals.h>
40 #endif
41 #include <prefs_common.h>
42 #include "common/claws.h"
43 #include "common/version.h"
44 #include "common/utils.h"
45 #include "mimeview.h"
46 #include "gdk/gdkkeysyms.h"
47 #include "main.h"
48 #include "plugin.h"
49 #include "menu.h"
50 #include "defs.h"
51 #include "utils.h"
52 #include "folder.h"
53 #ifdef USE_PTHREAD
54 #include <pthread.h>
55 #endif
56
57 #include <curl/curl.h>
58 #include <curl/curlver.h>
59 #include "filesel.h"
60
61 #ifdef HAVE_LIBSOUP_GNOME
62 #include <libsoup/soup-gnome.h>
63 #endif
64
65 typedef enum _NavigationMode {
66         NAV_DEFAULT,
67         NAV_INNER,
68         NAV_OUTER
69 } NavigationMode;
70
71 typedef struct _FancyViewer FancyViewer;
72 struct _FancyViewer
73 {
74         MimeViewer        mimeviewer;
75         GtkWidget         *scrollwin;
76         WebKitWebView     *view;
77         GtkWidget         *vbox;
78         GtkWidget         *l_link;
79         /* Zoom Widgets  */
80         GtkWidget         *zoom_100;
81         GtkWidget         *ev_zoom_100;
82         GtkWidget         *zoom_in;
83         GtkWidget         *ev_zoom_in;
84         GtkWidget         *zoom_out;
85         GtkWidget         *ev_zoom_out;
86         GtkWidget         *stop_loading;
87         GtkWidget         *ev_stop_loading;
88         /* Preferences Widgets  */
89         GtkWidget         *fancy_prefs;
90         GtkWidget         *ev_fancy_prefs;
91         GtkWidget         *fancy_prefs_menu;
92         /* Menu Items */
93         GtkWidget         *enable_images;
94         GtkWidget         *enable_scripts;
95         GtkWidget         *enable_plugins;
96         GtkWidget         *enable_java;
97         GtkWidget         *enable_remote_content;
98         GtkWidget         *open_external;
99         GtkWidget         *stylesheet;
100
101         GtkWidget         *progress;
102         WebKitWebSettings *settings;
103         gboolean          printing;
104         gboolean          override_prefs_images;
105         gboolean          override_prefs_remote_content;
106         gboolean          override_prefs_scripts;
107         gboolean          override_prefs_plugins;
108         gboolean          override_prefs_external;
109         gboolean          override_prefs_java;
110         gchar            *override_stylesheet;
111
112         const gchar       *curlfile;
113         FILE              *stream;
114
115         gchar             *cur_link;
116         gchar             *filename;
117         MimeInfo          *to_load;
118         gulong            doc_handle;
119         gint              loading;
120
121         /* Coordinates of the last mouse click. */
122         gint              click_x;
123         gint              click_y;
124
125         /* DOM Objects */
126 #if WEBKIT_CHECK_VERSION(1,5,1)
127         WebKitDOMDocument         *doc;
128         WebKitDOMDOMWindow    *window;
129         WebKitDOMDOMSelection *selection;
130         WebKitDOMRange            *range;
131 #endif
132 };
133 #define OPEN_INTERNAL FALSE
134 #define OPEN_EXTERNAL TRUE
135 #define CTRL_KEY 4
136 #define GOOGLE_SEARCH "http://www.google.com/search?hl=en&q="
137
138 #endif
139