puppylinux-woof-CE / woof-CE

woof - the Puppy builder
GNU General Public License v2.0
395 stars 284 forks source link

Upgrade Xdialog to GTK+ 3 #2709

Closed dimkr closed 2 years ago

dimkr commented 2 years ago

Xdialog is the last GTK+ 2 (and therefore, X) dependency in woof-code.

I'm not 100% sure what's the best way to do this - port it to GTK+ 3, replace it with some wrapper around yad/gtkdialog, or just rewrite everything. All 3 options are hard.

$ grep -l Xdialog `find woof-code -type f` 2>/dev/null | grep -v -e petbuilds -e release_extras
woof-code/rootfs-skeleton/usr/bin/x11vnc-gui
woof-code/rootfs-skeleton/usr/bin/zoom.sh
woof-code/rootfs-skeleton/usr/bin/pupx
woof-code/rootfs-skeleton/usr/bin/pupdialog
woof-code/rootfs-skeleton/usr/local/petget/downloadpkgs.sh
woof-code/rootfs-skeleton/usr/sbin/set_hwclock_type
woof-code/rootfs-skeleton/usr/sbin/fontmanager
woof-code/rootfs-skeleton/usr/sbin/puppyinstaller
woof-code/rootfs-skeleton/usr/sbin/xgamma-gui
woof-code/rootfs-skeleton/usr/sbin/download_file
woof-code/rootfs-skeleton/usr/sbin/remove_builtin
woof-code/rootfs-skeleton/usr/sbin/bootflash
woof-code/rootfs-skeleton/usr/sbin/connectwizard_exec
woof-code/rootfs-skeleton/usr/sbin/wmstartups
woof-code/rootfs-skeleton/usr/sbin/remasterpup2
woof-code/rootfs-skeleton/usr/sbin/pupcamera
woof-code/rootfs-skeleton/usr/sbin/bootmanager
woof-code/rootfs-skeleton/usr/sbin/alsaequal.sh
woof-code/rootfs-skeleton/usr/sbin/set-time-for-puppy
woof-code/rootfs-skeleton/usr/sbin/xkbconfigmanager
woof-code/rootfs-skeleton/usr/sbin/scannerwizard.sh
woof-code/rootfs-skeleton/usr/sbin/Pudd
woof-code/rootfs-skeleton/usr/sbin/puppypdf
woof-code/rootfs-skeleton/usr/sbin/burniso2cd
woof-code/rootfs-skeleton/usr/sbin/initmodules
woof-code/rootfs-skeleton/usr/sbin/asktosave_session
woof-code/rootfs-skeleton/usr/sbin/cups_shell
woof-code/rootfs-skeleton/usr/sbin/shutdownconfig
woof-code/rootfs-skeleton/usr/sbin/sfs_load
woof-code/rootfs-skeleton/usr/sbin/puppyapps
woof-code/rootfs-skeleton/usr/sbin/savesession-dvd
woof-code/rootfs-skeleton/usr/sbin/input-wizard
woof-code/rootfs-skeleton/usr/sbin/pmirror
woof-code/rootfs-skeleton/usr/sbin/mscw2
woof-code/3builddistro
woof-code/rootfs-packages/simple_network_setup/usr/local/simple_network_setup/sns
woof-code/rootfs-packages/simple_network_setup/pinstall.sh
woof-code/rootfs-packages/pupdial/usr/local/pupdial/modemtest
woof-code/rootfs-packages/pupdial/usr/local/pupdial/modemprobe_erase
woof-code/rootfs-packages/pupdial/usr/local/pupdial/pupdial
woof-code/rootfs-packages/network_wizard/usr/local/network-wizard/ndiswrapperGUI.sh
woof-code/rootfs-packages/network_wizard/usr/local/network-wizard/wag-profiles.sh
woof-code/rootfs-packages/network_wizard/usr/local/network-wizard/net-setup.sh
woof-code/rootfs-packages/network_wizard/usr/share/locale/ja/LC_MESSAGES/net-setup.mo
woof-code/rootfs-packages/frisbee/usr/local/frisbee/frisbee-gprs-connect
woof-code/rootfs-packages/frisbee/usr/local/frisbee/frisbee
woof-code/rootfs-packages/frisbee/usr/local/frisbee/func
woof-code/rootfs-packages/frisbee/usr/local/frisbee/frisbee-main
woof-code/rootfs-packages/frisbee/pinstall.sh
woof-code/rootfs-packages/pgprs/usr/local/pgprs/pgprs
woof-code/rootfs-packages/pgprs/usr/local/pgprs/pgprs-connect
woof-code/rootfs-packages/pgprs/usr/local/pgprs/pgprs-setup
woof-code/rootfs-packages/cups_backend/usr/lib/cups/backend/pdf-writer
woof-code/rootfs-packages/pburn/usr/local/pburn/func
woof-code/rootfs-packages/pburn/usr/local/pburn/func_exec
01micko commented 2 years ago

I think a yad wrapper wouldn't be too hard.

jamesbond3142 commented 2 years ago

Xdialog is the last GTK+ 2 (and therefore, X) dependency in woof-code.

I'm not 100% sure what's the best way to do this - port it to GTK+ 3

You have two choices, both from familiar authors. (1) http://chiselapp.com/user/jamesbond/repository/xdialog/home (2) https://github.com/wdlkmpx/Xdialog

Both compiles with GTK+ 3. (1) strives to keep all existing features. As far as I'm aware, in (1) the only dropped features is the "unavailable" settings for treeview/radiolist/checkbox (only on/off status is supported), while (2) drops that, and a few other less-often used features too.

Feedback/patches welcome, whichever one you want to choose.

PS: Login as anonymous to chiselapp in order to download the tarball.

dimkr commented 2 years ago

@jamesbond3142 This is amazing! I failed to find these forks. 1 sounds like a very good option, especially if Fatdog already uses a GTK+ 2 build (so the risk of breaking legacy Puppies is small).

jamesbond3142 commented 2 years ago

@jamesbond3142 This is amazing!

You're welcome :smile:

especially if Fatdog already uses a GTK+ 2 build (so the risk of breaking legacy Puppies is small).

We are not currently using the pure GTK+ 2 build yet, as I just did the port a couple of days ago (in fact, one of the reason why I started the port, was because I happened to see this very issue here). We are currently testing it, live, in the systems we use everyday (both gtk2 and gtk3 versions), and in the next release of Fatdog we will bite the bullet and replace the older Xdialog with the GTK+ 2 version so that we're ready to move to GTK+ 3 when it's needed.

I forgot to say - one of the major difference between the older Xdialog and the GTK+2/3 version is the font metrics. Xdialog allows to specify the dialog size in characters, which gets converted to pixel size by multiplying with average character width/height. The way to measure "average character width/height" is different because the original Xdialog uses GdkFont, which is deprecated and no longer supported in GTK+ 3. I have to use Pango metrics, and the result is not identical to GdkFont way of measuring. In most of my script this doesn't matter as I set most of dialogs to auto-size, but on scripts with fixed width/height, this may be a problem. (This comment applies for both my port and wdlkmpx's port - we measure it differently but neither of us will match the original).

GTK+2 and GTK+3 however will have identical font metrics.

Any problems beyond that should be considered as bugs to the port, and I'm willing to fix it to make it work the way it worked in the older Xdialog (where possible).

dimkr commented 2 years ago

@jamesbond3142 What do you think about moving this Xdialog fork to puppylinux-woof-CE?

jamesbond3142 commented 2 years ago

@jamesbond3142 What do you think about moving this Xdialog fork to puppylinux-woof-CE?

Sorry @dimkr, what do you mean by "move"? I see you already created a git mirror of the chiselapp repo under puppylinux-woof-CE; if that's what you mean, I'm happy with that. Or is there something else you have in mind?

dimkr commented 2 years ago

@jamesbond3142 I think it will be easier to report issues and open pull requests (at least, for me) if Xdialog becomes a repo under puppylinux-woof-CE, just like gtkdialog and other "Puppy things". But that's up to you - if you prefer Fossil I can find a way to download a tarball of a specific commit ("check-in") and use the Fossil repo directly.

I don't know if "mirror" I set up is any good. I converted the Fossil repo to Git, but I don't know if the commit hashes will be the same if I do the conversion again (to "pull" changes from the Fossil repo).

jamesbond3142 commented 2 years ago

@jamesbond3142 I think it will be easier to report issues and open pull requests (at least, for me) if Xdialog becomes a repo under puppylinux-woof-CE, just like gtkdialog and other "Puppy things". But that's up to you - if you prefer Fossil I can find a way to download a tarball of a specific commit ("check-in") and use the Fossil repo directly.

I'm happy to maintain a parallel repo of Xdialog under Woof-CE if it helps everyone. You already have gtkdialog there, so may as well put Xdialog under the same umbrella.

I will still keep my Fossil repo (I love Fossil) but I'll make parallel commits to both if automatic export/import is not possible, so you don't have to care about the fossil repo; just use the one under Woof-CE.

Do I have enough rights to create a new repo under Woof-CE? (@dimkr I was thinking to use the one you had created, but it seems that you had already removed it, perhaps because it took me too long to reply back).

01micko commented 2 years ago

Do I have enough rights to create a new repo under Woof-CE? (@dimkr I was thinking to use the one you had created, but it seems that you had already removed it, perhaps because it took me too long to reply back).

You do now :)

jamesbond3142 commented 2 years ago

Thanks @01micko. I'll get it up and running soon. Apparently there is a way to do a bi-directional sync, so let me do some tests before publishing the repo.

dimkr commented 2 years ago

Thanks @01micko. I'll get it up and running soon. Apparently there is a way to do a bi-directional sync, so let me do some tests before publishing the repo.

If it's complicated or time-consuming, woof-CE uses the Fossil repo, and we can continue using it. It's the only case where woof-CE clones a Fossil repo, but it doesn't take much time to install Fossil.

01micko commented 2 years ago

If it's complicated or time-consuming, woof-CE uses the Fossil repo, and we can continue using it. It's the only case where woof-CE clones a Fossil repo, but it doesn't take much time to install Fossil.

Slackware has no fossil in repos so this is the petbuild I concocted today:

download() {
    [ -f fossil-src-2.17.tar.gz ] || wget -t 3 -T 60 https://fossil-scm.org/home/tarball/f48180f2ff3169651a725396d4f7d667c99a92873b9c3df7eee2f144be7a0721/fossil-src-2.17.tar.gz  
    if [ ! -f Xdialog-14c5747051bd196c.tar ]; then
        mkdir tmp
        cd tmp
        fossil clone http://chiselapp.com/user/jamesbond/repository/xdialog xdialog.fossil
        fossil open xdialog.fossil 14c5747051
        fossil tarball -R xdialog.fossil 14c5747051bd196c ../Xdialog-14c5747051bd196c.tar
        cd ..
        rm -rf tmp
    fi
}

build() {
    tar -xzf fossil-src-2.17.tar.gz
    cd fossil-src-2.17
    ./configure --prefix=/usr
    make install
    cd ..
    tar -xf Xdialog-14c5747051bd196c.tar
    cd Xdialog_2022-01-03_013714_14c5747051
    if [ $PETBUILD_GTK -eq 3 ]; then
        ./configure --prefix=/usr --mandir=/usr/share/man --with-gtk3
    else
        ./configure --prefix=/usr --mandir=/usr/share/man --with-gtk2    
    fi
    make install
    rm -rf /usr/share/doc
    rm -f /usr/bin/fossil
}

EDIT: faced a chicken/egg problem and that's not what I originally had - Xdialog was probably cached in the petbuild-sources dir when I rewrote. Still, it's possible to just add it as a petbuild and build fossil in download() function.

jamesbond3142 commented 2 years ago

I just re-created https://github.com/puppylinux-woof-CE/Xdialog (I only keep the "trunk" branch because that's what matters anyway). I haven't tested the sync-ing yet, but if I can't do it automatically, I will do it manually.