From 1e7521defbbda2c2691529a87fc06f8f1d328c14 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 10 Dec 2021 13:52:53 -0500 Subject: [PATCH] development/bless: Various fixes. Signed-off-by: B. Watson Signed-off-by: Willy Sudiarto Raharjo --- development/bless/bless.SlackBuild | 42 ++++++++++++++----- development/bless/doinst.sh | 6 +++ development/bless/help_script.sh | 39 ++--------------- .../bless/patches/fix_save_behaviour.patch | 36 ++++++++++++++++ 4 files changed, 78 insertions(+), 45 deletions(-) create mode 100644 development/bless/patches/fix_save_behaviour.patch diff --git a/development/bless/bless.SlackBuild b/development/bless/bless.SlackBuild index c107d460a6..ea1816600d 100644 --- a/development/bless/bless.SlackBuild +++ b/development/bless/bless.SlackBuild @@ -6,14 +6,19 @@ # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details. -# 20210829 bkw: note: I can't test this on -current because I can't get -# gtk-sharp to build. +# 20211210 bkw: BUILD=2 +# - add patch from Debian's 0.6.0-7 to fix saving preferences. +# - don't include useless skeleton of bless-manual.omf in package. +# - don't use gconf from help_script.sh, it broke. just open the +# HTML help with xdg-open. +# - fix the 'select layout' dialog, now you can see & load system layouts. +# - new-style icon (singular, 48x48). cd $(dirname $0) ; CWD=$(pwd) PRGNAM=bless VERSION=${VERSION:-0.6.0} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -58,18 +63,18 @@ find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \ # the file, which a hex editor shouldn't do in its default mode. # - It ships with 3 .layout files that get installed in /usr/share, but # the layout dialog is broken: you can't choose between the -# "system" layouts, though you can load them if you copy them to -# ~/.config/bless/layouts. (But, they don't appear to *do* anything...) +# "system" layouts... now I've fixed this, at least. # - Finally, and maybe this is just my own personal bias, I don't see an # obvious way to change the white background to black (if the .layout # files are capable of it, great, but I tried really hard to get them # to work and they don't seem to behave the way the docs say they do). # This means I won't be using this application very much, as it hurts # my eyes to look at it for more than a few minutes. -# If it's so awful, why am I writing a SlackBuild for it? Because it's -# a GUI hex editor that (a) uses GTK, and (b) doesn't require KDE and -# its horde of daemons. Someone is going to be glad it's here. People -# who grew up using GUIs are going to prefer this to a textmode app. +# If it's so awful, why am I writing a SlackBuild for it? Because +# it's a GUI hex editor that (a) uses GTK, (b) doesn't suck quite +# as hard as ghex, and (c) doesn't require KDE and its horde of +# daemons. Someone is going to be glad it's here. People who grew up +# using GUIs are going to prefer this to a textmode app. # Here endeth the rant. # Patch from Debian. Might not be needed with newer versions of mono, @@ -81,6 +86,9 @@ patch -p1 < $CWD/patches/force_gtk_action_namespace.patch # Fixes "not enough space" error when trying to save. patch -p1 < $CWD/patches/fix_save.patch +# Similar-named patch from Debian. This one fixes saving preferences. +patch -p1 < $CWD/patches/fix_save_behaviour.patch + # Patch from: https://bugs.launchpad.net/ubuntu/+source/bless/+bug/1622951 # Fixes broken preferences saving. patch -p1 < $CWD/patches/fixxmltextwriter.patch @@ -94,6 +102,10 @@ patch -p1 < $CWD/patches/default_overwrite.patch patch -p1 < $CWD/patches/disambiguate-system.range-and-gtk.range.patch +# 20211210 bkw: make it look in the right place for its own layout files. +sed -i '/FileResourcePath\.GetDataPath("data")/s,"data",".",' \ + src/gui/dialogs/LayoutSelectionDialog.cs + # Grr. The configure script doesn't allow setting CS or MCS or CSC or # anything to override the compiler (like normal stuff does with CC). # FFS, it's even hardcoded in C# code... @@ -121,7 +133,7 @@ make install DESTDIR=$PKG # --docdir is ignored. mkdir -p $PKG/usr/doc/ mv $PKG/usr/share/doc/$PRGNAM $PKG/usr/doc/$PRGNAM-$VERSION -rm -rf $PKG/usr/share/doc +rm -rf $PKG/usr/share/doc $PKG/usr/share/omf # The help script needed help. PKGHELP=$PKG/usr/share/$PRGNAM/help_script.sh @@ -132,6 +144,16 @@ chmod 755 $PKGHELP mkdir -p $PKG/usr/man/man1 gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz +HICOLOR=$PKG/usr/share/icons/hicolor/48x48/apps +PIXMAPS=$PKG/usr/share/pixmaps +rm -f $PIXMAPS/* +mkdir -p $HICOLOR +mv $PKG/usr/share/$PRGNAM/bless-48x48.png $HICOLOR/$PRGNAM.png +ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/$PRGNAM/bless-48x48.png +ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PIXMAPS/$PRGNAM.png + +sed -i '/Icon=/s,=.*,=bless,' $PKG/usr/share/applications/$PRGNAM.desktop + cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/development/bless/doinst.sh b/development/bless/doinst.sh index 5fb28930db..3e5691a052 100644 --- a/development/bless/doinst.sh +++ b/development/bless/doinst.sh @@ -1,3 +1,9 @@ if [ -x /usr/bin/update-desktop-database ]; then /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 fi + +if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then + if [ -x /usr/bin/gtk-update-icon-cache ]; then + /usr/bin/gtk-update-icon-cache usr/share/icons/hicolor >/dev/null 2>&1 + fi +fi diff --git a/development/bless/help_script.sh b/development/bless/help_script.sh index f841e96e7d..f532f8aaf6 100644 --- a/development/bless/help_script.sh +++ b/development/bless/help_script.sh @@ -1,39 +1,8 @@ #!/bin/sh # Script that loads help for Bless. Modified by B. Watson for -# slackbuilds.org. No idea if the gnome-help or yelp stuff really works, -# I haven't got either one installed. At least the user manual opens -# in an actual browser with this version of the script. +# slackbuilds.org. Ditched all the gconf, yelp, gnome-help stuff +# and just use xdg-open for the HTML help in the user's default +# browser. -xml_help="/usr/doc/bless-@VERSION@/user/bless-manual.xml" -html_help="/usr/doc/bless-@VERSION@/user/index.html" - -# try to get default browsers from GConf -GCONFTOOL=`which gconftool-2 2> /dev/null` - -if [[ -n $GCONFTOOL ]]; -then - help_browser=`$GCONFTOOL --get "/desktop/gnome/url-handlers/ghelp/command"` - if [[ -n "$help_browser" ]]; - then - help_browser=`echo "$help_browser" | cut -d' ' -f1` - fi - - http_browser=`$GCONFTOOL --get "/desktop/gnome/url-handlers/http/command"` - - if [[ -n "$http_browser" ]]; - then - http_browser=`echo "$http_browser" | cut -d' ' -f1` - fi -fi - -# some other browsers -yelp_browser=`which yelp 2> /dev/null` -firefox_browser=`which firefox 2> /dev/null` -mozilla_browser=`which mozilla 2> /dev/null` - -([[ -n $help_browser ]] && $help_browser $xml_help) || -([[ -n $yelp_browser ]] && $yelp_browser $xml_help) || -([[ -n $http_browser ]] && $http_browser $html_help) || -([[ -n $firefox_browser ]] && $firefox_browser $html_help) || -([[ -n $mozilla_browser ]] && $mozilla_browser $html_help) +exec xdg-open /usr/doc/bless-@VERSION@/user/index.html diff --git a/development/bless/patches/fix_save_behaviour.patch b/development/bless/patches/fix_save_behaviour.patch new file mode 100644 index 0000000000..00f3fcaa0b --- /dev/null +++ b/development/bless/patches/fix_save_behaviour.patch @@ -0,0 +1,36 @@ +diff -Naurd bless-0.6.0.orig/src/tools/Preferences.cs bless-0.6.0/src/tools/Preferences.cs +--- bless-0.6.0.orig/src/tools/Preferences.cs 2008-06-07 14:18:14.000000000 +0200 ++++ bless-0.6.0/src/tools/Preferences.cs 2016-10-28 22:47:50.000000000 +0200 +@@ -127,10 +127,10 @@ + /// + public void Save(string path) + { +- XmlTextWriter xml = new XmlTextWriter(path, null); +- xml.Formatting = Formatting.Indented; +- xml.Indentation = 1; +- xml.IndentChar = '\t'; ++ XmlWriterSettings settings = new XmlWriterSettings(); ++ settings.Indent = true; ++ settings.IndentChars = ("\t"); ++ XmlWriter xml = XmlWriter.Create(path, settings); + + xml.WriteStartElement(null, "preferences", null); + +diff -Naurd bless-0.6.0.orig/src/tools/Session.cs bless-0.6.0/src/tools/Session.cs +--- bless-0.6.0.orig/src/tools/Session.cs 2008-06-07 14:18:14.000000000 +0200 ++++ bless-0.6.0/src/tools/Session.cs 2017-01-08 15:21:29.000000000 +0100 +@@ -72,10 +72,10 @@ + + public void Save(string path) + { +- XmlTextWriter xml = new XmlTextWriter(path, null); +- xml.Formatting = Formatting.Indented; +- xml.Indentation = 1; +- xml.IndentChar = '\t'; ++ XmlWriterSettings settings = new XmlWriterSettings(); ++ settings.Indent = true; ++ settings.IndentChars = ("\t"); ++ XmlWriter xml = XmlWriter.Create(path, settings); + + xml.WriteStartElement(null, "session", null); +