[glom/glom-1-28] ImageGlom: Put EvView in ScrolledWindow to avoid crash.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom/glom-1-28] ImageGlom: Put EvView in ScrolledWindow to avoid crash.
- Date: Thu, 25 Feb 2016 19:15:42 +0000 (UTC)
commit fb1f1472973f24699c49223f29d9435a4a22b815
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Feb 25 09:04:51 2016 +0100
ImageGlom: Put EvView in ScrolledWindow to avoid crash.
Because recent versions of libevince-view have an assert that crashes
the application:
https://bugzilla.gnome.org/show_bug.cgi?id=761396#c12
glom/utility_widgets/imageglom.cc | 17 +++++++++++++++--
glom/utility_widgets/imageglom.h | 2 ++
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index 058b156..ff7d2d8 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -47,7 +47,8 @@ ImageGlom::type_vec_ustrings ImageGlom::m_evince_supported_mime_types;
ImageGlom::type_vec_ustrings ImageGlom::m_gdkpixbuf_supported_mime_types;
ImageGlom::ImageGlom()
-: m_ev_view(0),
+: m_ev_scrolled_window(0),
+ m_ev_view(0),
m_ev_document_model(0),
m_pMenuPopup_UserMode(0)
{
@@ -56,6 +57,7 @@ ImageGlom::ImageGlom()
ImageGlom::ImageGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& /* builder */)
: Gtk::EventBox(cobject),
+ m_ev_scrolled_window(0),
m_ev_view(0),
m_ev_document_model(0),
m_pMenuPopup_UserMode(0)
@@ -65,7 +67,9 @@ ImageGlom::ImageGlom(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>&
void ImageGlom::init()
{
+ //TODO: Don't instantiate this unnecessarily.
m_ev_view = EV_VIEW(ev_view_new());
+
//gtk_widget_add_events(GTK_WIDGET(m_ev_view), GDK_BUTTON_PRESS_MASK);
//Connect the the EvView's button-press-event signal,
@@ -359,7 +363,16 @@ void ImageGlom::show_image_data()
m_image.hide();
gtk_widget_show(GTK_WIDGET(m_ev_view));
- gtk_container_add(GTK_CONTAINER(m_frame.gobj()), GTK_WIDGET(m_ev_view));
+
+ if (!m_ev_scrolled_window)
+ {
+ m_ev_scrolled_window = Gtk::manage(new Gtk::ScrolledWindow());
+ m_ev_scrolled_window->show();
+ gtk_container_add(GTK_CONTAINER(m_ev_scrolled_window->gobj()), GTK_WIDGET(m_ev_view));
+ }
+
+ m_frame.add(*m_ev_scrolled_window);
+
// Try loading from data in memory:
// TODO: Uncomment this if this API is added: https://bugzilla.gnome.org/show_bug.cgi?id=654832
diff --git a/glom/utility_widgets/imageglom.h b/glom/utility_widgets/imageglom.h
index 52d11d0..b0e2535 100644
--- a/glom/utility_widgets/imageglom.h
+++ b/glom/utility_widgets/imageglom.h
@@ -28,6 +28,7 @@
#include "layoutwidgetfield.h"
#include <gtkmm/frame.h>
#include <gtkmm/builder.h>
+#include <gtkmm/scrolledwindow.h>
#include <giomm/appinfo.h>
#include <giomm/simpleactiongroup.h>
#include <evince-view.h>
@@ -108,6 +109,7 @@ private:
Gtk::Frame m_frame;
//For anything supported by Evince:
+ Gtk::ScrolledWindow* m_ev_scrolled_window;
EvView* m_ev_view;
EvDocumentModel* m_ev_document_model;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]