1

Topic: GParted Gtk3, working experimental branch

Hello, I'd like to contribute on a port to Gtk3.
I already have a working branch that compiles and seems to work just fine

  github.com/lb90/gparted-gtk3

Of course, it is not yet finished because I want to move away from deprecated parts of Gtk3, but It would be great if you can test it out and make a fast review

The strategy has been to first make a port to Gtk3 that just compiles and runs, with minimal code change. That has involved

  • Rework header includes

  • Move away from OptionMenu widget to ComboBox

  • Use Cairo for drawing

  • Not operate on GtkMenuShell using items() method that has been removed in Gtkmm3

Then I want to use modern parts of Gtk3:

  • Move away from GtkTable to GtkGrid

  • Use icon names in place of Stock Items

  • Use GApplication / GtkApplication

  • Use GAction and GMenu/GmenuModel

For that to work we only target Gtk version at least 3.4, which I find very reasonable.

Please, that fork is just experimental to see how to get the work done. It wasn't meant to be merged as it is, let me know how you think is the best away to make a good PR.

Thanks!
Luca Bacci

2

Re: GParted Gtk3, working experimental branch

Thank you Luca for your interest in GParted, and extra effort to migrate to newer libraries.

There is an open bug report related to the migration.

See Bug 652044 - uses deprecated APIs

See also the GParted Development and Developing GParted using Git web pages.

Currently I am busy so unfortunately I will not have much time to look at your work in the near term.

3

Re: GParted Gtk3, working experimental branch

Well I'll write in that Bug Report

Thank you!
Luca

4

Re: GParted Gtk3, working experimental branch

In the not so far future (rather sooner than later!) GParted will have to be split up in a front-end & back-end part (the backend could be 'udisksd' for some operations, but not for all), so that the frontend doesn't have to run as root.

It would be useful if you could somehow keep that in mind when working on this…

5

Re: GParted Gtk3, working experimental branch

Hello Luca,

Thank you for your interest in porting GParted to Gtk3.  Yes targeting Gtk >= 3.4 is good. [1]  I like your overall strategy of porting to Gtk3 first and then incrementing the requirement to 3.4 and then removing use of deprecated APIs.


A successful pull request would meet the following criteria:

  • Each commit makes a small independent change.

  • The commit message explains why the change is necessary.  References to and optional small quotes from porting guides and deprecated classes / methods are encouraged where appropriate.

  • Every commit passes './autogen.sh && make'.  Ideally also passes 'make distcheck'.  This is for git bisectability.

As gedakc mentioned above also see Developing GParted using Git.  For examples see commits authored by myself, Mike Fleetwood.


I had a look at your first commit "change configure.ac to use gtkmm-3.0".  It requires C++11 compilation.  If Gtkmm >= 3.4 *requires* C++11 that is OK, but please provide a reference in the changelog.  If not please don't add it, as it is forcing a requirement which otherwise doesn't exist.  There are distros which meet the Gtkmm >= 3.4 requirement but have slightly older versions of glibmm and libsigc++ which don't required C++11 compilation.  E.g. Debian 8 with glibmm 2.42.0 and libsigc++ 2.4.0.


I also have a question for you about running GParted as root under Wayland.  I thought that Gtk3 used native Wayland display API when available and that Wayland only allows processes run by the logged in user to communicate with the Wayland display process.  As such I expected GParted run as root under Wayland to fail to work.  However when I tested it it did work.  GParted/Gtk3 made use of the X11 display API and worked.  Do you know why?  It is important to make sure GParted runs on GNOME and Xfce desktops using Wayland and X11 display.
References to how we had to work around this for Gtk2 making X11 display calls on Wayland display.
* GParted Forum Thread: [SOLVED] How to run GParted on a GNOME Wayland desktop
* GParted Bug 776437 - Interim fix for GParted fails to run as root under Wayland


Happy to help and review more when you're ready.


Thanks,
Mike
--

[1] Targeting Gtk >= 3.4 consideration:

  • We try to keep GParted HEAD compiling on all still supported versions of distros.  RHEL/CentOS 6, and I think SLES 11, are the only/major old still supported distros which are Gtk 2 only.  As they are very old and newer releases exist, RHEL/CentOS 7 and SLES 12, which do support Gtk 3 then we are OK do drop support for them.

  • I've looked at the version of Gtkmm 3.0 in the major distros and the oldest is 3.4 in Debian 7.  Debian 7 is due to end support this month, May 2018.  After that the oldest version of Gtkmm is 3.10.1.

  Distro             EOL        Gtkmm 3.0
- RHEL / CentOS 6    2020-Nov   None
- RHEL / CentOS 7    2024-Jun   3.22.0
- Ubuntu 14.04 LTS   2019-Apr   3.10.1
- Ubuntu 16.04 LTS   2021-Apr   3.18.0
- Ubuntu 18.04 LTS   2023-Apr   3.22.2
- Debian 7           2018-May   3.4.2
- Debian 8           2020-Jun   3.14.0
- Debian 9           2020-Jun   3.22.0
- SLES 11            2022-Mar   None
- SLES 12            2027-Oct   3.10.1