[Commits] [SCM] claws branch, litehtml, updated. 3.17.0-163-g5427888
miras at claws-mail.org
miras at claws-mail.org
Fri Nov 9 01:57:41 CET 2018
The branch, litehtml has been updated
via 5427888c812e7b2df34a8f8c7a225c1e78ef8c16 (commit)
via dcb488bc6404ec20310df8dcf6df7dacdf3bfe8c (commit)
via 1be889f4b95868e903943e30be2b8dc5203852dd (commit)
via 6eba2085ac98ff8e39eefbd046314954be2673cd (commit)
via eade694613c19ffe747ccb77466070e474e3f968 (commit)
via f4607b4b60f88fecd36f0c67c5d02462b8229a5f (commit)
via e6df99dfbc3e0c08b1d2a62aa8511cc981fca28f (commit)
via 4d8b3527479afa351d2752a1e654efd1ff5d2f14 (commit)
via 45fa8affd2bcce904ab1fb2be9bed2aed5741ffa (commit)
from 47e7c627912d250e1aaf279196d644499de373fe (commit)
Summary of changes:
configure.ac | 14 +--
src/action.c | 7 --
src/addr_compl.c | 8 --
src/gtk/Makefile.am | 7 +-
src/gtk/colorlabel.c | 20 +---
src/gtk/foldersort.c | 10 --
src/gtk/gtkcmclist.c | 162 +----------------------------
src/gtk/gtkcmclist.h | 13 ---
src/gtk/gtkcmctree.c | 14 ---
src/gtk/gtkshruler.c | 68 ------------
src/gtk/gtkutils.c | 6 --
src/gtk/logwindow.c | 4 -
src/gtk/menu.c | 4 -
src/gtk/menu.h | 4 -
src/gtk/quicksearch.c | 12 ---
src/gtk/spell_entry.c | 30 ------
src/gtk/sslcertwindow.c | 17 ++-
src/inc.c | 8 +-
src/inc.h | 2 +
src/main.c | 13 +--
src/mainwindow.c | 4 -
src/plugins/dillo/dillo_viewer.c | 7 --
src/plugins/litehtml_viewer/TODO | 2 -
src/plugins/litehtml_viewer/lh_viewer.c | 4 +-
src/plugins/litehtml_viewer/lh_widget.cpp | 105 ++++++++++++++++++-
src/plugins/litehtml_viewer/lh_widget.h | 6 +-
src/prefs_account.c | 32 ------
src/prefs_filtering_action.c | 26 -----
src/prefs_folder_item.c | 8 --
src/prefs_matcher.c | 32 ------
src/prefs_summaries.c | 4 +-
src/printing.c | 23 ----
src/ssl_manager.c | 89 +++++++++++++---
src/statusbar.c | 2 -
src/stock_pixmap.c | 16 ---
src/summary_search.c | 2 -
src/summaryview.c | 2 +-
src/toolbar.c | 2 +-
38 files changed, 208 insertions(+), 581 deletions(-)
- Log -----------------------------------------------------------------
commit 5427888c812e7b2df34a8f8c7a225c1e78ef8c16
Author: Michael Rasmussen <mir at datanom.net>
Date: Fri Nov 9 01:57:34 2018 +0100
Update TODO
Signed-off-by: Michael Rasmussen <mir at datanom.net>
diff --git a/src/plugins/litehtml_viewer/TODO b/src/plugins/litehtml_viewer/TODO
index 56e3846..543238a 100644
--- a/src/plugins/litehtml_viewer/TODO
+++ b/src/plugins/litehtml_viewer/TODO
@@ -1,6 +1,4 @@
-- Add support for displaying images
- Add support for printing
-- Add support for links (open in default browser)
Images:
https://developer.gnome.org/gio/unstable/GMemoryInputStream.html#g-memory-input-stream-new-from-data
commit dcb488bc6404ec20310df8dcf6df7dacdf3bfe8c
Author: Michael Rasmussen <mir at datanom.net>
Date: Fri Nov 9 01:56:29 2018 +0100
Implemented support for links
Signed-off-by: Michael Rasmussen <mir at datanom.net>
diff --git a/src/plugins/litehtml_viewer/lh_viewer.c b/src/plugins/litehtml_viewer/lh_viewer.c
index 0b3cf53..c8912e2 100644
--- a/src/plugins/litehtml_viewer/lh_viewer.c
+++ b/src/plugins/litehtml_viewer/lh_viewer.c
@@ -59,7 +59,7 @@ static gchar *get_utf8_string(const gchar *string) {
if (error) {
debug_print("Charset detection failed");
utf8 = g_strdup(string);
- g_error_free(error);
+ g_clear_error(&error);
}
}
} else {
@@ -90,7 +90,7 @@ static void lh_show_mimepart(MimeViewer *_viewer, const gchar *infole,
if (!g_file_get_contents(msgfile, &contents, &length, &error)) {
g_warning("LiteHTML viewer: couldn't read contents of file '%s': %s",
msgfile, error->message);
- g_error_free(error);
+ g_clear_error(&error);
return;
} else {
utf8 = get_utf8_string(contents);
diff --git a/src/plugins/litehtml_viewer/lh_widget.cpp b/src/plugins/litehtml_viewer/lh_widget.cpp
index ba423a0..f92cd3d 100644
--- a/src/plugins/litehtml_viewer/lh_widget.cpp
+++ b/src/plugins/litehtml_viewer/lh_widget.cpp
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <curl/curl.h>
+#include <gdk/gdk.h>
#include "lh_widget.h"
#include "lh_widget_wrapped.h"
#include "http.h"
@@ -40,6 +41,12 @@ static gboolean expose_event_cb(GtkWidget *widget, GdkEvent *event,
gpointer user_data);
static void size_allocate_cb(GtkWidget *widget, GdkRectangle *allocation,
gpointer user_data);
+static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event,
+ gpointer user_data);
+static gboolean motion_notify_event(GtkWidget *widget, GdkEventButton *event,
+ gpointer user_data);
+static gboolean button_release_event(GtkWidget *widget, GdkEventButton *event,
+ gpointer user_data);
lh_widget::lh_widget()
{
@@ -62,12 +69,24 @@ lh_widget::lh_widget()
gtk_container_add(GTK_CONTAINER(m_viewport), m_drawing_area);
g_signal_connect(m_drawing_area, "expose-event",
G_CALLBACK(expose_event_cb), this);
+ g_signal_connect(m_drawing_area, "motion_notify_event",
+ G_CALLBACK(motion_notify_event), this);
+ g_signal_connect(m_drawing_area, "button_press_event",
+ G_CALLBACK(button_press_event), this);
+ g_signal_connect(m_drawing_area, "button_release_event",
+ G_CALLBACK(button_release_event), this);
gtk_widget_show_all(m_scrolled_window);
m_html = NULL;
m_rendered_width = 0;
m_context.load_master_stylesheet(master_css);
+
+ gtk_widget_set_events(m_drawing_area,
+ GDK_BUTTON_RELEASE_MASK
+ | GDK_BUTTON_PRESS_MASK
+ | GDK_POINTER_MOTION_MASK);
+
}
lh_widget::~lh_widget()
@@ -98,7 +117,9 @@ void lh_widget::set_base_url(const litehtml::tchar_t* base_url)
void lh_widget::on_anchor_click(const litehtml::tchar_t* url, const litehtml::element::ptr& el)
{
- g_log(NULL, G_LOG_LEVEL_MESSAGE, "lh_widget on_anchor_click");
+ g_log(NULL, G_LOG_LEVEL_MESSAGE, "lh_widget on_anchor_click. url -> %s", url);
+ m_clicked_url = url;
+
return;
}
@@ -144,8 +165,11 @@ GdkPixbuf *lh_widget::get_image(const litehtml::tchar_t* url, bool redraw_on_rea
pixbuf = gdk_pixbuf_new_from_stream(image, NULL, &error);
if (error) {
g_log(NULL, G_LOG_LEVEL_ERROR, "lh_widget::get_image: Could not create pixbuf %s", error->message);
+ //g_object_unref(pixbuf);
pixbuf = NULL;
+ g_clear_error(&error);
}
+ g_input_stream_close(image, NULL, NULL);
/* if (redraw_on_ready) {
redraw();
@@ -262,7 +286,6 @@ void lh_widget::clear()
m_rendered_width = 0;
}
-
static gboolean expose_event_cb(GtkWidget *widget, GdkEvent *event,
gpointer user_data)
{
@@ -283,6 +306,84 @@ static void size_allocate_cb(GtkWidget *widget, GdkRectangle *allocation,
w->redraw();
}
+static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event,
+ gpointer user_data)
+{
+ litehtml::position::vector redraw_boxes;
+ lh_widget *w = (lh_widget *)user_data;
+
+ g_log(NULL, G_LOG_LEVEL_MESSAGE, "lh_widget on_button_press_event");
+
+ if(w->m_html)
+ {
+ if(w->m_html->on_lbutton_down((int) event->x, (int) event->y, (int) event->x, (int) event->y, redraw_boxes))
+ {
+ for(auto& pos : redraw_boxes)
+ {
+ gtk_widget_queue_draw_area(widget, pos.x, pos.y, pos.width, pos.height);
+ }
+ }
+ }
+
+ return true;
+}
+
+static gboolean motion_notify_event(GtkWidget *widget, GdkEventButton *event,
+ gpointer user_data)
+{
+ litehtml::position::vector redraw_boxes;
+ lh_widget *w = (lh_widget *)user_data;
+
+ g_log(NULL, G_LOG_LEVEL_MESSAGE, "lh_widget on_motion_notify_event");
+
+ if(w->m_html)
+ {
+ if(w->m_html->on_mouse_over((int) event->x, (int) event->y, (int) event->x, (int) event->y, redraw_boxes))
+ {
+ for (auto& pos : redraw_boxes)
+ {
+ gtk_widget_queue_draw_area(widget, pos.x, pos.y, pos.width, pos.height);
+ }
+ }
+ }
+
+ return true;
+}
+
+static gboolean button_release_event(GtkWidget *widget, GdkEventButton *event,
+ gpointer user_data)
+{
+ litehtml::position::vector redraw_boxes;
+ lh_widget *w = (lh_widget *)user_data;
+ GError* error = NULL;
+
+ g_log(NULL, G_LOG_LEVEL_MESSAGE, "lh_widget on_button_release_event");
+
+ if(w->m_html)
+ {
+ w->m_clicked_url.clear();
+ if(w->m_html->on_lbutton_up((int) event->x, (int) event->y, (int) event->x, (int) event->y, redraw_boxes))
+ {
+ for (auto& pos : redraw_boxes)
+ {
+ gtk_widget_queue_draw_area(widget, pos.x, pos.y, pos.width, pos.height);
+ }
+ }
+
+ if (!w->m_clicked_url.empty())
+ {
+ g_log(NULL, G_LOG_LEVEL_MESSAGE, "Open in browser: %s", w->m_clicked_url.c_str());
+ gtk_show_uri(NULL, w->m_clicked_url.c_str(), GDK_CURRENT_TIME, &error);
+ if (error) {
+ g_log(NULL, G_LOG_LEVEL_ERROR, "Failed opening url(%s): %s", w->m_clicked_url, error->message);
+ g_clear_error(&error);
+ }
+ }
+ }
+
+ return true;
+}
+
///////////////////////////////////////////////////////////
extern "C" {
diff --git a/src/plugins/litehtml_viewer/lh_widget.h b/src/plugins/litehtml_viewer/lh_widget.h
index 0cb97c6..32d751c 100644
--- a/src/plugins/litehtml_viewer/lh_widget.h
+++ b/src/plugins/litehtml_viewer/lh_widget.h
@@ -29,16 +29,18 @@ class lh_widget : public container_linux
void open_html(const gchar *contents);
void clear();
+ litehtml::document::ptr m_html;
+ litehtml::tstring m_clicked_url;
+
private:
void paint_white();
GInputStream *load_url(const gchar *url, GError **error);
- litehtml::document::ptr m_html;
gint m_rendered_width;
GtkWidget *m_drawing_area;
GtkWidget *m_scrolled_window;
GtkWidget *m_viewport;
litehtml::context m_context;
gint m_height;
-
+ litehtml::tstring m_cursor;
};
commit 1be889f4b95868e903943e30be2b8dc5203852dd
Merge: 47e7c62 6eba208
Author: Michael Rasmussen <mir at datanom.net>
Date: Thu Nov 8 21:20:48 2018 +0100
Merge branch 'master' of ssh+git://git.claws-mail.org/home/git/claws into litehtml
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list