sm-commit AT lists.ibiblio.org
Subject: Source Mage code commit list
List archive
[SM-Commit] GIT changes to master grimoire by George Sherwood (660d3bb1e4c77c680308612a9430b095505826f9)
- From: George Sherwood <scm AT sourcemage.org>
- To: sm-commit AT lists.ibiblio.org
- Subject: [SM-Commit] GIT changes to master grimoire by George Sherwood (660d3bb1e4c77c680308612a9430b095505826f9)
- Date: Sat, 29 Dec 2007 09:48:54 -0600
GIT changes to master grimoire by George Sherwood <george AT beernabeer.com>:
news/liferea/HISTORY | 5
news/liferea/PRE_BUILD | 2
news/liferea/webkit-current-api-update.diff | 190 ---------------------
news/liferea/webkit.c | 252
++++++++++++++++++++++++++++
4 files changed, 258 insertions(+), 191 deletions(-)
New commits:
commit 660d3bb1e4c77c680308612a9430b095505826f9
Author: George Sherwood <george AT beernabeer.com>
Commit: George Sherwood <george AT beernabeer.com>
liferea: Added file to provide webkit fixes. Removed original patch.
diff --git a/news/liferea/HISTORY b/news/liferea/HISTORY
index d919e46..87e9301 100644
--- a/news/liferea/HISTORY
+++ b/news/liferea/HISTORY
@@ -1,3 +1,8 @@
+2007-12-29 George Sherwood <george AT beernabeer.com>
+ * PRE_BUILD: Removed patch. Added new webkit.c file.
+ * webkit.c: Added. Better then patching with all the changes.
+ * webkit-current-api-update.diff: Removed.
+
2007-12-28 George Sherwood <george AT beernabeer.com>
* DEPENDS: depends libglade2. optional_depends webkitgtk
* PRE_BUILD: Added to apply patch
diff --git a/news/liferea/PRE_BUILD b/news/liferea/PRE_BUILD
index 32f7423..ca7430e 100755
--- a/news/liferea/PRE_BUILD
+++ b/news/liferea/PRE_BUILD
@@ -1,3 +1,3 @@
default_pre_build &&
cd $SOURCE_DIRECTORY &&
-patch -p0 < $SCRIPT_DIRECTORY/webkit-current-api-update.diff
+cp -v $SCRIPT_DIRECTORY/webkit.c src/webkit
diff --git a/news/liferea/webkit-current-api-update.diff
b/news/liferea/webkit-current-api-update.diff
deleted file mode 100644
index 549e35b..0000000
--- a/news/liferea/webkit-current-api-update.diff
+++ /dev/null
@@ -1,190 +0,0 @@
---- src/webkit/webkit.c.orig 2007-12-27 08:06:22.000000000 +0100
-+++ src/webkit/webkit.c 2007-12-27 08:05:38.000000000 +0100
-@@ -18,10 +18,7 @@
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
--
--#include <webkitgtkpage.h>
--#include <webkitgtkframe.h>
--#include <webkitgtksettings.h>
-+#include <webkit.h>
-
- #include "conf.h"
- #include "ui/ui_htmlview.h"
-@@ -29,98 +26,96 @@
- static void
- liferea_webkit_init (void)
- {
-- webkit_init ();
--
- g_print ("Note: WebKit HTML rendering support is experimental and\n");
- g_print ("not everything is working properly with WebKit right
now!!!\n");
- }
-
--static void liferea_webkit_deinit (void) { }
-+static void
-+liferea_webkit_deinit (void)
-+{
-+ g_print("Shutting down WebKit\n");
-+}
-
- static void
--webkit_write_html (GtkWidget *scrollpane,
-+webkit_write_html (GtkWidget *scrollpane,
- const gchar *string,
-- guint length,
-- const gchar *base,
-- const gchar *contentType)
-+ guint length,
-+ const gchar *base,
-+ const gchar *contentType)
- {
- GtkWidget *htmlwidget = gtk_bin_get_child (GTK_BIN (scrollpane));
-
-- webkit_page_load_string (WEBKIT_PAGE (htmlwidget), string,
"application/xhtml", "UTF-8", base);
-+ webkit_web_view_load_string (WEBKIT_WEB_VIEW (htmlwidget), string,
"application/xhtml", "UTF-8", base);
- }
-
- static void
--webkit_title_changed (WebKitPage *page, const gchar* title, const gchar*
url, gpointer user_data)
-+webkit_title_changed (WebKitWebView *view, const gchar* title, const gchar*
url, gpointer user_data)
- {
-- ui_tabs_set_title (GTK_WIDGET (page), title);
-+ ui_tabs_set_title (GTK_WIDGET (view), title);
- }
-
- static void
--webkit_progress_changed (WebKitPage *page, gint progress, gpointer
user_data)
-+webkit_progress_changed (WebKitWebView *view, gint progress, gpointer
user_data)
- {
- }
-
- static void
--webkit_on_url (WebKitPage *page, const gchar *title, const gchar *url,
gpointer user_data)
-+webkit_on_url (WebKitWebView *view, const gchar *title, const gchar *url,
gpointer user_data)
- {
- LifereaHtmlView *htmlview;
-- gchar *selectedURL;
-+ gchar *selectedURL;
-
-- htmlview = g_object_get_data (G_OBJECT (page), "htmlview");
-- selectedURL = g_object_get_data (G_OBJECT (page), "selectedURL");
-+ htmlview = g_object_get_data (G_OBJECT (view), "htmlview");
-+ selectedURL = g_object_get_data (G_OBJECT (view), "selectedURL");
- g_free (selectedURL);
--
-- if (url)
-- selectedURL = g_strdup (url);
-- else
-- selectedURL = g_strdup ("");
-+
-+ selectedURL = url ? g_strdup (url) : g_strdup ("");
-
- /* overwrite or clear last status line text */
- liferea_htmlview_on_url (htmlview, selectedURL);
-
-- g_object_set_data (G_OBJECT (page), "selectedURL", selectedURL);
-+ g_object_set_data (G_OBJECT (view), "selectedURL", selectedURL);
- }
-
- static GtkWidget *
- webkit_new (LifereaHtmlView *htmlview, gboolean forceInternalBrowsing)
- {
-- gulong handler;
-- GtkWidget *page;
-+ gulong handler;
-+ GtkWidget *view;
- GtkWidget *scrollpane;
-- WebKitSettings *settings;
-
-- scrollpane = gtk_scrolled_window_new(NULL, NULL);
-+ scrollpane = gtk_scrolled_window_new (NULL, NULL);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollpane),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW
(scrollpane), GTK_SHADOW_IN);
-
- /* create html widget and pack it into the scrolled window */
-- page = webkit_page_new ();
-+ view = webkit_web_view_new ();
-
- /* // empty functions in current webkit code...
- settings = webkit_web_settings_copy (webkit_web_settings_get_global
());
- settings->is_java_script_enabled = !conf_get_bool_value
(DISABLE_JAVASCRIPT);
- settings->java_script_can_open_windows_automatically = FALSE;
-- webkit_page_set_settings (WEBKIT_PAGE (htmlwidget), settings);
-+ webkit_page_set_settings (WEBKIT_WEB_VIEW (htmlwidget), settings);
- */
-- gtk_container_add (GTK_CONTAINER (scrollpane), GTK_WIDGET (page));
-+ gtk_container_add (GTK_CONTAINER (scrollpane), GTK_WIDGET (view));
-
-- g_object_set_data (G_OBJECT (page), "htmlview", htmlview);
-- g_object_set_data (G_OBJECT (page), "internal_browsing",
GINT_TO_POINTER (forceInternalBrowsing));
-+ g_object_set_data (G_OBJECT (view), "htmlview", htmlview);
-+ g_object_set_data (G_OBJECT (view), "internal_browsing",
GINT_TO_POINTER (forceInternalBrowsing));
-
-- g_signal_connect (page, "title-changed", G_CALLBACK
(webkit_title_changed), page);
-- g_signal_connect (page, "load-progress-changed", G_CALLBACK
(webkit_progress_changed), page);
-- g_signal_connect (page, "hovering-over-link", G_CALLBACK
(webkit_on_url), page);
-+ g_signal_connect (view, "title-changed", G_CALLBACK
(webkit_title_changed), view);
-+ g_signal_connect (view, "load-progress-changed", G_CALLBACK
(webkit_progress_changed), view);
-+ g_signal_connect (view, "hovering-over-link", G_CALLBACK
(webkit_on_url), view);
- /* FIXME: clicked callback */
-
-- gtk_widget_show (page);
-+ gtk_widget_show (view);
- return scrollpane;
- }
-
- static void
- webkit_launch_url (GtkWidget *scrollpane, const gchar *url)
- {
-- webkit_page_open (WEBKIT_PAGE (gtk_bin_get_child (GTK_BIN
(scrollpane))), url);
-+ webkit_web_view_open (WEBKIT_WEB_VIEW (gtk_bin_get_child (GTK_BIN
(scrollpane))), url);
- }
-
- static gboolean
-@@ -149,21 +144,21 @@
- }
-
- static struct htmlviewPlugin webkitInfo = {
-- .api_version = HTMLVIEW_PLUGIN_API_VERSION,
-- .name = "WebKit",
-- .priority = 100,
-- .externalCss = FALSE,
-- .plugin_init = liferea_webkit_init,
-- .plugin_deinit = liferea_webkit_deinit,
-- .create = webkit_new,
-- .write = webkit_write_html,
-- .launch = webkit_launch_url,
-+ .api_version = HTMLVIEW_PLUGIN_API_VERSION,
-+ .name = "WebKit",
-+ .priority = 100,
-+ .externalCss = FALSE,
-+ .plugin_init = liferea_webkit_init,
-+ .plugin_deinit = liferea_webkit_deinit,
-+ .create = webkit_new,
-+ .write = webkit_write_html,
-+ .launch = webkit_launch_url,
- .launchInsidePossible = webkit_launch_inside_possible,
-- .zoomLevelGet = webkit_get_zoom_level,
-- .zoomLevelSet = webkit_change_zoom_level,
-- .scrollPagedown = webkit_scroll_pagedown,
-- .setProxy = NULL,
-- .setOffLine = NULL
-+ .zoomLevelGet = webkit_get_zoom_level,
-+ .zoomLevelSet = webkit_change_zoom_level,
-+ .scrollPagedown = webkit_scroll_pagedown,
-+ .setProxy = NULL,
-+ .setOffLine = NULL
- };
-
- static struct plugin pi = {
-@@ -173,5 +168,5 @@
- &webkitInfo
- };
-
--DECLARE_PLUGIN(pi);
--DECLARE_HTMLVIEW_PLUGIN(webkitInfo);
-+DECLARE_PLUGIN (pi);
-+DECLARE_HTMLVIEW_PLUGIN (webkitInfo);
diff --git a/news/liferea/webkit.c b/news/liferea/webkit.c
new file mode 100644
index 0000000..4d4f1c0
--- /dev/null
+++ b/news/liferea/webkit.c
@@ -0,0 +1,252 @@
+/**
+ * @file webkit.c WebKit browser module for Liferea
+ *
+ * Copyright (C) 2007 Lars Lindner <lars.lindner AT gmail.com>
+ *
+ * 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
+ */
+
+#include <webkit.h>
+
+#include "conf.h"
+#include "common.h"
+#include "ui/ui_htmlview.h"
+
+/**
+ * HTML plugin init callback
+ */
+static void
+liferea_webkit_init (void)
+{
+ g_print ("Note: WebKit HTML rendering support is experimental and\n");
+ g_print ("not everything is working properly with WebKit right
now!!!\n");
+}
+
+/**
+ * HTML plugin de-init callback
+ */
+static void
+liferea_webkit_deinit (void)
+{
+ g_print ("Shutting down WebKit\n");
+}
+
+/**
+ * Load HTML string
+ *
+ * Load an HTML string into the view frame. This is used to render newsfeed
entries.
+ */
+static void
+webkit_write_html (GtkWidget *scrollpane,
+ const gchar *string,
+ guint length,
+ const gchar *base,
+ const gchar *content_type)
+{
+ GtkWidget *htmlwidget = gtk_bin_get_child (GTK_BIN (scrollpane));
+
+ // WebKit does not like application/xhtml+xml:
http://bugs.webkit.org/show_bug.cgi?id=9677
+ content_type = g_ascii_strcasecmp
(content_type,"application/xhtml+xml") == 0 ? "application/xhtml" :
content_type;
+ webkit_web_view_load_string (WEBKIT_WEB_VIEW (htmlwidget), string,
content_type, "UTF-8", base);
+}
+
+/**
+ *
+ */
+static void
+webkit_title_changed (WebKitWebView *view, const gchar* title, const gchar*
url, gpointer user_data)
+{
+ ui_tabs_set_title (GTK_WIDGET (view), title);
+}
+
+static void
+webkit_progress_changed (WebKitWebView *view, gint progress, gpointer
user_data)
+{
+}
+
+/**
+ * Action executed when user hovers over a link
+ */
+static void
+webkit_on_url (WebKitWebView *view, const gchar *title, const gchar *url,
gpointer user_data)
+{
+ LifereaHtmlView *htmlview;
+ gchar *selected_url;
+
+ htmlview = g_object_get_data (G_OBJECT (view), "htmlview");
+ selected_url = g_object_get_data (G_OBJECT (view), "selected_url");
+ g_free (selected_url);
+
+ selected_url = url ? g_strdup (url) : g_strdup ("");
+
+ /* overwrite or clear last status line text */
+ liferea_htmlview_on_url (htmlview, selected_url);
+
+ g_object_set_data (G_OBJECT (view), "selected_url", selected_url);
+}
+
+/**
+ * A link has been clicked
+ *
+ * When a link has been clicked the the link management is dispatched to
Liferea core in
+ * order to manage the different filetypes, remote URLs.
+ */
+static void
+webkit_link_clicked (WebKitWebView *view, WebKitWebFrame *frame,
WebKitNetworkRequest *request)
+{
+ const gchar *uri;
+
+ g_return_if_fail (WEBKIT_IS_WEB_VIEW (view));
+ g_return_if_fail (WEBKIT_IS_NETWORK_REQUEST (request));
+
+ /** Bug in WebKit. See http://bugs.webkit.org/show_bug.cgi?id=16654
for details */
+ g_signal_stop_emission_by_name (WEBKIT_WEB_VIEW (view),
"navigation-requested");
+
+ uri = webkit_network_request_get_uri (WEBKIT_NETWORK_REQUEST
(request));
+
+ LifereaHtmlView *htmlview = g_object_get_data (G_OBJECT (view),
"htmlview");
+ liferea_htmlview_launch_URL (
+ htmlview, uri, GPOINTER_TO_INT (g_object_get_data (G_OBJECT
(view), "internal_browsing"))
+ ? UI_HTMLVIEW_LAUNCH_INTERNAL
+ : UI_HTMLVIEW_LAUNCH_DEFAULT
+ );
+
+ return TRUE;
+}
+
+/**
+ * Initializes WebKit
+ *
+ * Initializes the WebKit HTML rendering engine. Creates a GTK scrollpane
widget
+ * and embeds WebKitWebView into it.
+ *
+ * FIXME: there is currently no API for settings present
(http://bugs.webkit.org/show_bug.cgi?id=16219)
+ */
+static GtkWidget *
+webkit_new (LifereaHtmlView *htmlview, gboolean forceInternalBrowsing)
+{
+ gulong handler;
+ GtkWidget *view;
+ GtkWidget *scrollpane;
+
+ scrollpane = gtk_scrolled_window_new (NULL, NULL);
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollpane),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW
(scrollpane), GTK_SHADOW_IN);
+
+ /** Create HTML widget and pack it into the scrolled window */
+ view = webkit_web_view_new ();
+ gtk_container_add (GTK_CONTAINER (scrollpane), GTK_WIDGET (view));
+
+ /** Pass LifereaHtmlView into the WebKitWebView object */
+ g_object_set_data (G_OBJECT (view), "htmlview", htmlview);
+ /** Pass internal browsing param */
+ g_object_set_data (G_OBJECT (view), "internal_browsing",
GINT_TO_POINTER (forceInternalBrowsing));
+
+ /** Connect signal callbacks */
+ g_signal_connect (view, "title-changed", G_CALLBACK
(webkit_title_changed), view);
+ g_signal_connect (view, "load-progress-changed", G_CALLBACK
(webkit_progress_changed), view);
+ g_signal_connect (view, "hovering-over-link", G_CALLBACK
(webkit_on_url), view);
+ g_signal_connect (view, "navigation-requested", G_CALLBACK
(webkit_link_clicked), view);
+
+ gtk_widget_show (view);
+ return scrollpane;
+}
+
+/**
+ * Launch URL
+ */
+static void
+webkit_launch_url (GtkWidget *scrollpane, const gchar *url)
+{
+ webkit_web_view_open (WEBKIT_WEB_VIEW (gtk_bin_get_child (GTK_BIN
(scrollpane))), url);
+}
+
+static gboolean
+webkit_launch_inside_possible (void)
+{
+ return FALSE;
+}
+
+/**
+ * FIXME: No API, see http://bugs.webkit.org/show_bug.cgi?id=14998
+ */
+static void
+webkit_change_zoom_level (GtkWidget *scrollpane, gfloat zoomLevel)
+{}
+
+/**
+ * FIXME: No API, see http://bugs.webkit.org/show_bug.cgi?id=14998
+ */
+static gfloat
+webkit_get_zoom_level (GtkWidget *scrollpane)
+{
+ return 1.0;
+}
+
+/**
+ * Scroll page down (via shortcut key)
+ *
+ * Copied from gtkhtml/gtkhtml.c
+ */
+static gboolean
+webkit_scroll_pagedown (GtkWidget *scrollpane)
+{
+ GtkScrolledWindow *itemview;
+ GtkAdjustment *vertical_adjustment;
+ gdouble old_value;
+ gdouble new_value;
+ gdouble limit;
+
+ itemview = GTK_SCROLLED_WINDOW (scrollpane);
+ g_assert (NULL != itemview);
+ vertical_adjustment = gtk_scrolled_window_get_vadjustment (itemview);
+ old_value = gtk_adjustment_get_value (vertical_adjustment);
+ new_value = old_value + vertical_adjustment->page_increment;
+ limit = vertical_adjustment->upper - vertical_adjustment->page_size;
+ if (new_value > limit)
+ new_value = limit;
+ gtk_adjustment_set_value (vertical_adjustment, new_value);
+ gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (itemview),
vertical_adjustment);
+ return (new_value > old_value);
+}
+
+static struct htmlviewPlugin webkitInfo = {
+ .api_version = HTMLVIEW_PLUGIN_API_VERSION,
+ .name = "WebKit",
+ .priority = 100,
+ .externalCss = FALSE,
+ .plugin_init = liferea_webkit_init,
+ .plugin_deinit = liferea_webkit_deinit,
+ .create = webkit_new,
+ .write = webkit_write_html,
+ .launch = webkit_launch_url,
+ .launchInsidePossible = webkit_launch_inside_possible,
+ .zoomLevelGet = webkit_get_zoom_level,
+ .zoomLevelSet = webkit_change_zoom_level,
+ .scrollPagedown = webkit_scroll_pagedown,
+ .setProxy = NULL,
+ .setOffLine = NULL
+};
+
+static struct plugin pi = {
+ PLUGIN_API_VERSION,
+ "WebKit Rendering Plugin",
+ PLUGIN_TYPE_HTML_RENDERER,
+ &webkitInfo
+};
+
+DECLARE_PLUGIN (pi);
+DECLARE_HTMLVIEW_PLUGIN (webkitInfo);
- [SM-Commit] GIT changes to master grimoire by George Sherwood (660d3bb1e4c77c680308612a9430b095505826f9), George Sherwood, 12/29/2007
Archive powered by MHonArc 2.6.24.