Bug#790196: rasmol: Port to GTK+ 3 / VTE 2.91

2018-10-08 Thread Teemu Ikonen
Hi all,

Rasmol upstream is not dead, it's just resting :)

The current sources live at
https://github.com/rasmol/rasmol/tree/rasmol-2.7.6 and contain a
gtk3 port which I made in the spring. Unfortunately I got
distracted by other projects before I could finish the Debian
packaging. There are also library dependencies which I would like
to upgrade before rasmol itself.

I see that there has been some (possibly duplicate) effort here
to get this bug fixed and I'm sorry that I did not communicate
about the development that has been made elsewhere.

I will integrate the new upstream code to the salsa repo soon.

Best,
Teemu

Bug#790196: rasmol: Port to GTK+ 3 / VTE 2.91

2018-09-06 Thread Yavor Doganov
tags 790196 + patch
thanks

Attached is a patch which should fix this bug.

I used molecule files from src:avogadro to test.  (I think) I tried
all actions and couldn't spot any problems.  One known regression is
that the accelerators don't work when the menubar is hidden.  (I've
made only F9 to work so that the menubar can be brought back.)  There
might be other regressions as I'm not familiar with GTK+ API and I'm
not a proper programmer either.  One minor improvement is that the
tooltips work.

The second patch is only remotely related, it fixes the build system
so that LDFLAGS get inherited from the environment.  This is necessary
because traditionally GNOME/GTK+ libraries expose their dependencies
which results in overlinking causing unnecessary dependencies.

The third patch should fix the FTBFS on GNU/Hurd (untested).

I just subsribed to this package and will do my best to fix any issues
that arise as a result of my porting attempt.
>From 0545dcee54c57128d82872e2a016f8c43978530a Mon Sep 17 00:00:00 2001
From: Yavor Doganov 
Date: Thu, 6 Sep 2018 13:53:09 +0300
Subject: [PATCH 1/3] Port to GTK+ 3 / VTE 2.91

---
 debian/control|3 +-
 debian/patches/14_gtk3-port.patch | 1979 +
 debian/patches/series |1 +
 3 files changed, 1981 insertions(+), 2 deletions(-)
 create mode 100644 debian/patches/14_gtk3-port.patch

diff --git a/debian/control b/debian/control
index 4bdd239..b7a9bd4 100644
--- a/debian/control
+++ b/debian/control
@@ -10,8 +10,7 @@ Build-Depends: debhelper (>= 11~),
libxext-dev,
libxi-dev,
x11proto-core-dev,
-   libvte-dev,
-   libgtk2.0-dev,
+   libvte-2.91-dev,
libcbf-dev,
libcvector2-dev,
libcqrlib2-dev,
diff --git a/debian/patches/14_gtk3-port.patch 
b/debian/patches/14_gtk3-port.patch
new file mode 100644
index 000..afd8bbe
--- /dev/null
+++ b/debian/patches/14_gtk3-port.patch
@@ -0,0 +1,1979 @@
+Description: Port to GTK+ 3 and VTE 2.91.
+ The real changes required are minimalistic; this patch is largish
+ because I wanted to avoid the deprecated API which will be removed in
+ GTK+ 4 (GtkUIManager, GtkAction and friends) and would require yet
+ another porting effort.  I deliberately chose to use the basic API
+ (rather than GtkBuilder, GtkApplication and GAction) because the GTK+
+ folks have a tendency to deprecate these high level APIs fairly
+ quickly.  Another reason for this choice is that I wanted to avoid
+ XML stuff; I find it extremely unpleasant to deal with.
+ .
+ However, this approach made the patch convoluted as I realized way
+ too late that there is a fully-fledged popup menu with nearly all
+ actions exposed.  These have to be kept in sync programmatically,
+ which is done in a clumsy/inefficient way.
+Debian-Bug: https://bugs.debian.org/790196
+Author: Yavor Doganov 
+Forwarded: no
+Last-Update: 2018-09-06
+---
+
+--- rasmol.orig/src/Imakefile
 rasmol/src/Imakefile
+@@ -131,9 +131,8 @@
+ #endif
+ 
+ #ifdef GTKWIN
+-#GTKLIBS = $(shell pkg-config --libs vte gtk+-2.0)
+-GTKLIBS = -lvte -lgtk-x11-2.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 
-lglib-2.0 -lcairo -lX11
+-GTKCFLAGS = $(shell pkg-config --cflags vte gtk+-2.0)
++GTKLIBS = $(shell pkg-config --libs vte-2.91)
++GTKCFLAGS = $(shell pkg-config --cflags vte-2.91)
+ GUISRC = gtkwin.c eggfileformatchooser.c 
+ GUIOBJ = gtkwin.o eggfileformatchooser.o
+ GUIDEF = -DGTKWIN
+@@ -437,13 +436,9 @@
+ 
+ gtkwin.c: gtkui.h
+ 
+-gtkui.h: sizechooser.glade printing-resolution.glade actionmenu.gtk
++gtkui.h: sizechooser.glade printing-resolution.glade
+echo "/* Automatically generated GTK ui definitions, do not edit! */" 
> gtkui.h
+echo >> gtkui.h
+-   echo "const gchar *actionmenu_str = \"\\" >> gtkui.h
+-   cat actionmenu.gtk | sed "s/$$/\\\/" | sed 's/"/\\\"/g' >> gtkui.h
+-   echo "\";" >> gtkui.h
+-   echo >> gtkui.h
+echo "const gchar *sizechooser_str = \"\\" >> gtkui.h
+gtk-builder-convert -w sizechooser.glade - | sed "s/$$/\\\/" | sed 
's/"/\\\"/g' >> gtkui.h
+echo "\";" >> gtkui.h
+@@ -452,4 +447,3 @@
+gtk-builder-convert -w printing-resolution.glade - | sed "s/$$/\\\/" | 
sed 's/"/\\\"/g' >> gtkui.h
+echo "\";" >> gtkui.h
+echo >> gtkui.h
+-   gdk-pixbuf-csource --name=rasmol_icon --struct rasmol_48x48.xpm  >> 
gtkui.h
+--- rasmol.orig/src/eggfileformatchooser.h
 rasmol/src/eggfileformatchooser.h
+@@ -19,7 +19,7 @@
+ #ifndef __EGG_FILE_FORMAT_CHOOSER_H__
+ #define __EGG_FILE_FORMAT_CHOOSER_H__
+ 
+-#include 
++#include 
+ 
+ G_BEGIN_DECLS
+ 
+--- rasmol.orig/src/gtkwin.c
 rasmol/src/gtkwin.c
+@@ -106,6 +106,7 @@
+ #include "gtkwin.h"
+ #include "gtkui.h"
+ #include "eggfileformatchooser.h"
++#include "rasmol_48x48.xpm"
+ 
+ 
+ #define RASGTK_MINWIDTH  300
+@@ -127,6 +128,9 @@
+ GtkWidget *mainwin;
+ GtkWidget