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 #include <webkit/webkitglobals.h>
39 #include <prefs_common.h>
40 #include "common/claws.h"
41 #include "common/version.h"
42 #include "common/utils.h"
43 #include "mimeview.h"
44 #include "gdk/gdkkeysyms.h"
45 #include "main.h"
46 #include "plugin.h"
47 #include "menu.h"
48 #include "defs.h"
49 #include "utils.h"
50 #include "folder.h"
51 #ifdef USE_PTHREAD
52 #include <pthread.h>
53 #endif
54 
55 #include <curl/curl.h>
56 #include <curl/curlver.h>
57 #include "filesel.h"
58 
59 #ifdef HAVE_LIBSOUP_GNOME
60 #include <libsoup/soup-gnome.h>
61 #endif
62 
63 typedef enum _NavigationMode {
64 	NAV_DEFAULT,
65 	NAV_INNER,
66 	NAV_OUTER
67 } NavigationMode;
68 
69 typedef struct _FancyViewer FancyViewer;
70 struct _FancyViewer
71 {
72 	MimeViewer        mimeviewer;
73 	GtkWidget         *scrollwin;
74 	WebKitWebView     *view;
75 	GtkWidget         *vbox;
76 	GtkWidget         *l_link;
77 	/* Zoom Widgets  */
78 	GtkWidget         *zoom_100;
79 	GtkWidget         *ev_zoom_100;
80 	GtkWidget         *zoom_in;
81 	GtkWidget         *ev_zoom_in;
82 	GtkWidget         *zoom_out;
83 	GtkWidget         *ev_zoom_out;
84 	GtkWidget         *stop_loading;
85 	GtkWidget         *ev_stop_loading;
86 	/* Preferences Widgets  */
87 	GtkWidget         *fancy_prefs;
88 	GtkWidget         *ev_fancy_prefs;
89 	GtkWidget         *fancy_prefs_menu;
90 	/* Menu Items */
91 	GtkWidget         *enable_images;
92 	GtkWidget         *enable_scripts;
93 	GtkWidget         *enable_plugins;
94 	GtkWidget	  *enable_java;
95 	GtkWidget         *enable_remote_content;
96 	GtkWidget         *open_external;
97 	GtkWidget         *stylesheet;
98 
99 	GtkWidget         *progress;
100 	WebKitWebSettings *settings;
101 	gboolean          printing;
102 	gboolean          override_prefs_images;
103 	gboolean          override_prefs_remote_content;
104 	gboolean          override_prefs_scripts;
105 	gboolean          override_prefs_plugins;
106 	gboolean          override_prefs_external;
107 	gboolean	  override_prefs_java;
108 	gchar		 *override_stylesheet;
109 
110 	const gchar       *curlfile;
111 	FILE              *stream;
112 
113 	gchar             *cur_link;
114 	gchar             *filename;
115 	MimeInfo          *to_load;
116 	gulong            doc_handle;
117 	gint              loading;
118 
119 	/* Coordinates of the last mouse click. */
120 	gint              click_x;
121 	gint              click_y;
122 
123 	/* DOM Objects */
124 	WebKitDOMDocument	  *doc;
125 	WebKitDOMDOMWindow    *window;
126 	WebKitDOMDOMSelection *selection;
127 	WebKitDOMRange		  *range;
128 };
129 #define OPEN_INTERNAL FALSE
130 #define OPEN_EXTERNAL TRUE
131 #define CTRL_KEY 4
132 #define GOOGLE_SEARCH "http://www.google.com/search?hl=en&q="
133 
134 #endif
135 
136