[pan2] added html parser



commit 9cd77f9d158835d1e113eedc4884ecf19d92a0da
Author: Heinrich MÃller <henmull src gnome org>
Date:   Mon Oct 1 23:12:00 2012 +0200

    added html parser

 configure.in         |   14 +++++++++-----
 pan/gui/body-pane.cc |   23 ++++++++++++++++++-----
 pan/gui/body-pane.h  |    3 ++-
 3 files changed, 29 insertions(+), 11 deletions(-)
---
diff --git a/configure.in b/configure.in
index 63f366d..5cf7ead 100644
--- a/configure.in
+++ b/configure.in
@@ -1,3 +1,5 @@
+dnl TODO : sasl, xzver, ....
+
 AC_INIT([Pan],[0.140],[https://bugzilla.gnome.org/enter_bug.cgi?product=Pan],[pan],[http://pan.rebelbase.com/])
 AC_DEFINE(VERSION_MAJOR,0,[Major part of version number])
 AC_DEFINE(VERSION_MINOR,140,[Minor part of version number])
@@ -53,6 +55,7 @@ ENCHANT_REQUIRED=1.6.0
 GNUTLS_REQUIRED=3.0.0
 LIBNOTIFY_REQUIRED=0.4.1
 LIBGKR_REQUIRED=3.2.0
+WEBKIT_REQUIRED=1.8.1
 AC_SUBST(GLIB_REQUIRED)
 AC_SUBST(GLIB_REQUIRED_FOR_DBUS)
 AC_SUBST(GMIME_REQUIRED)
@@ -61,9 +64,7 @@ AC_SUBST(GTKSPELL_REQUIRED)
 AC_SUBST(GNUTLS_REQUIRED)
 AC_SUBST(LIBNOTIFY_REQUIRED)
 AC_SUBST(LIBGKR_REQUIRED)
-
-dnl LIBGSASL_REQUIRED=1.6.1
-dnl AC_SUBST(LIBGSASL_REQUIRED)
+AC_SUBST(WEBKIT_REQUIRED)
 
 AC_PROG_CXX
 AC_HEADER_STDC
@@ -95,8 +96,6 @@ else
   AM_PATH_GLIB_2_0($GLIB_REQUIRED,,exit 1,gobject gmodule gthread)
 fi
 
-PKG_CHECK_MODULES([WEBKITGTK], [webkitgtk-3.0 >= 1.8.1],AC_DEFINE(HAVE_WEBKIT,[1],[webkit support for embedded html]),[])
-
 dnl Check for GMime
 PKG_CHECK_MODULES([GMIME], [gmime-2.6 >= $GMIME26_REQUIRED],[have_gmime26=yes],
   [
@@ -140,6 +139,8 @@ if test "x$want_gtk3" = "xyes" ; then
                       ])
   fi
 
+  PKG_CHECK_MODULES([WEBKITGTK], [webkitgtk-3.0 >= $WEBKIT_REQUIRED],AC_DEFINE(HAVE_WEBKIT,[1],[webkit support (3.0) for embedded html]),[])
+
 else
     if test "x$want_gtkspell" = "xyes" ; then
     PKG_CHECK_MODULES([GTKSPELL], [gtkspell-2.0 >= $GTKSPELL_REQUIRED enchant >= $ENCHANT_REQUIRED],
@@ -152,6 +153,9 @@ else
                       AC_MSG_RESULT(no)
                       ])
     fi
+
+    PKG_CHECK_MODULES([WEBKITGTK], [webkitgtk-1.0 >= $WEBKIT_REQUIRED],AC_DEFINE(HAVE_WEBKIT,[1],[webkit support (1.0) for embedded html]),[])
+
     AM_PATH_GTK_2_0($GTK_REQUIRED,,exit 1,gthread)
 fi
 
diff --git a/pan/gui/body-pane.cc b/pan/gui/body-pane.cc
index f79b2a7..33c5288 100644
--- a/pan/gui/body-pane.cc
+++ b/pan/gui/body-pane.cc
@@ -46,7 +46,7 @@ extern "C" {
 #include "save-attach-ui.h"
 
 #ifdef HAVE_WEBKIT
-  #include <webkitgtk-1.0/webkit/webkit.h>
+  #include <webkit/webkit.h>
 #endif
 
 #define FIRST_PICTURE "first-picture"
@@ -1645,9 +1645,7 @@ BodyPane :: add_attachment_to_toolbar (const char* fn)
   gtk_table_attach_defaults (GTK_TABLE(_att_toolbar), w, _cur_col, _cur_col+1, _cur_row,_cur_row+1);
 
   ++_cur_col;
-
 #else
-
   if (_attachments % 4 == 0 && _attachments != 0)
   {
     gtk_grid_insert_row (GTK_GRID(_att_toolbar), ++_cur_row);
@@ -1663,7 +1661,9 @@ BodyPane :: add_attachment_to_toolbar (const char* fn)
 void
 BodyPane :: set_html_text (const char* text)
 {
+#ifdef HAVE_WEBKIT
   webkit_web_view_load_string (WEBKIT_WEB_VIEW (_web_view), text, NULL, NULL, "");
+#endif
 }
 
 GtkWidget*
@@ -1709,8 +1709,10 @@ BodyPane :: BodyPane (Data& data, ArticleCache& cache, Prefs& prefs, GroupPrefs
 #endif
   _attachments(0),
   _current_attachment(0),
-  _cleared (true),
-  _web_view (webkit_web_view_new ())
+  _cleared (true)
+#ifdef HAVE_WEBKIT
+  ,_web_view (webkit_web_view_new ())
+#endif
 {
 
   GtkWidget * w, * l, * hbox;
@@ -1805,11 +1807,22 @@ BodyPane :: BodyPane (Data& data, ArticleCache& cache, Prefs& prefs, GroupPrefs
   gtk_expander_set_expanded (GTK_EXPANDER(_expander), expanded);
   expander_activated_idle (this);
 
+#ifdef HAVE_WEBKIT
   w = gtk_notebook_new ();
   GtkNotebook * n (GTK_NOTEBOOK (w));
   gtk_notebook_append_page (n, vbox, gtk_label_new (_("Text View")));
   gtk_notebook_append_page (n, _web_view, gtk_label_new (_("HTML View")));
 
+  // add scroll to html
+  GtkWidget* scroll = gtk_scrolled_window_new (NULL, NULL);
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
+  gtk_container_add (GTK_CONTAINER(scroll), _web_view);
+#else
+  w = vbox;
+#endif
   _root = w;
   _prefs.add_listener (this);
 
diff --git a/pan/gui/body-pane.h b/pan/gui/body-pane.h
index 43f50bf..9b83c48 100644
--- a/pan/gui/body-pane.h
+++ b/pan/gui/body-pane.h
@@ -126,8 +126,9 @@ namespace pan
 
     private:
       void set_html_text (const char* text);
+#ifdef HAVE_WEBKIT
       GtkWidget* _web_view;
-
+#endif
     private:
       void add_attachment_to_toolbar (const char* fn);
       void clear_attachments();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]