Commit Graph

3638 Commits

Author SHA1 Message Date
Mike Fleetwood c626b4cea6 Display more version and configuration info to stdout when starting (!34)
So that we might get more information from users when helping them.
Starting GParted from the command line now looks like this:
    # ./gpartedbin
    GParted 0.33.0-git
    configuration --enable-online-resize
    libparted 3.2

Closes !34 - Display more version and configuration information
2019-04-03 20:45:31 +00:00
Mike Fleetwood a476b8cc2c Rename local variable to meaningful benchmark_copysize 2019-04-01 09:12:10 -06:00
Mike Fleetwood fc5cc1d3b4 Stop trying to access device '/dev/mapper/No RAID disks' (#786031)
Running GParted on AltLinux with dmraid installed but with no configured
RAID arrays produces this error:
    # gparted
    ...
    Could not stat device /dev/mapper/No RAID disks - No such file or directory.

Most distributions use dmraid 1.0.0.rc16 which reports no raid disks
like this:
    # dmraid -sa -c
    no raid disks
    # echo $?
    1

However AltLinux had the slightly older version, dmraid 1.0.0.rc14,
which reported no raid disks like this:
    # dmraid -sa -c
    No RAID disks
    # echo $?
    0

So because dmraid 1.0.0.rc14 reported success, exit status 0, and the
"No RAID disks" message was not in lower case, that text was considered
a disk device in a DMRaid array.  Fix by checking for "no raid disks" in
any case.

Bug 786031 - Could not stat device /dev/mapper/No RAID disks - No such
             file or directory
2019-04-01 09:12:10 -06:00
Mike Fleetwood 97ce96da03 Pass constant parameter by reference to load_operations() (#788814)
It is common C++ practice to pass a constant object by reference to
avoid constructing a duplicate object for pass by value [1].

[1] How to pass objects to functions in C++?
    https://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c/2139254#2139254

Bug 788814 - gparted-0.30.0/include/HBoxOperations.h:37]: performance
             problem
2019-03-31 09:29:05 -06:00
Luca Bacci 56d8533add Always show menu images (!32)
There is a GtkSetting [1] that controls whether images in menus are
shown or not.  On some distributions / desktops it is enabled by default
and on others it is disabled by default.  To force show images in menus
set the 'always-show-image' property to true in Gtk::ImageMenuItems [2].

References:

[1] Gtk3 Reference Documentation - Settings/gtk-menu-images
    https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-menu-images

[2] Gtk3 Reference Documentation - GtkImageMenuItem
    https://developer.gnome.org/gtk3/stable/GtkImageMenuItem.html#gtk-image-menu-item-set-always-show-image

Closes !32 - Always show menu images
2019-03-28 12:01:41 +00:00
Mike Fleetwood d1441ce6a9 Drop compose subdir (#46)
It's no longer used so drop it.

Closes #46 - Drop compose subdir
2019-03-27 16:45:22 +00:00
Mike Fleetwood e55b3c8544 Replace String::ucompose() with Glibmm equivalent (#46)
Glibmm has implemented a ustring::compose() set of methods [1] since
Glibmm 2.16, circa 2008.  So replace String::ucompose().  Note that
GParted already requires glibmm >= 2.32 as set in configure.ac.

This commit just replaces all the method calls.  Edit created by:
    sed -i 's|String::ucompose *|Glib::ustring::compose|' src/*.cc

[1] Glibmm Reference Manual, Glib::ustring Class, compose() method
    https://developer.gnome.org/glibmm/2.32/classGlib_1_1ustring.html#a64ff7ac3d9e9899c2910f1d831f8d500

Closes #46 - Drop compose subdir
2019-03-27 16:45:22 +00:00
Mike Fleetwood 415f502036 Recognise contribution by Antoine Viallon 2019-03-26 08:08:10 +00:00
Mike Fleetwood c9f47403b8 Raise the maximum F2FS label size to 127 characters (!29)
Fix to make mkfs.f2fs properly handle labels longer than 16 characters
was included in f2fs-tools 1.2.0 [1].  The oldest supported
distributions now include this release:
  Distro             EOL        f2fs-tools
- Debian 8           2020-Jun   1.4.0
- RHEL / CentOS 7    2024-Jun   1.4.1
- SLES 12            2027-Oct   Unknown
- Ubuntu 14.04 LTS   2019-Apr   1.2.0

Note that on Ubuntu 14.04 LTS blkid from util-linux 2.20.1 is too old to
recognise F2FS file systems, as 2.23 is required for F2FS support [2].

mkfs.f2fs claims the maximum label length is less than 512 characters,
but actually accepts 512 characters.

    # label=`head -c 1024 < /dev/zero | tr '\0' 'A'`
    # mkfs.f2fs -l `echo -n "$label" | cut -c1-513` /dev/sdb10

            F2FS-tools: mkfs.f2fs Ver: 1.4.0 (2014-09-18)

    Error: Volume Label should be less than      512 characters

    Usage: mkfs.f2fs [options] device [sectors]
    [options]:
      -a heap-based allocation [default:1]
      -d debug level [default:0]
      -e [extension list] e.g. "mp3,gif,mov"
      -l label
      -o overprovision ratio [default:5]
      -s # of segments per section [default:1]
      -z # of sections per zone [default:1]
      -t 0: nodiscard, 1: discard [default:1]
    sectors: number of sectors. [default: determined by device size]
    # echo $?
    1

    # mkfs.f2fs -l `echo -n "$label" | cut -c1-512` /dev/sdb10

            F2FS-tools: mkfs.f2fs Ver: 1.4.0 (2014-09-18)

    Info: Label = AAAAAAAAAAAA...[trimmed from 512 "A"s]...AAAAAAAAAAAA
    Info: sector size = 512
    Info: total sectors = 1048576 (in 512bytes)
    Info: zone aligned segment0 blkaddr: 256
    Info: Discarding device
    Info: This device doesn't support TRIM
    Info: format successful
    # echo $?
    0

    # blkid -V
    blkid from util-linux 2.25.2  (libblkid 2.25.0, 24-Oct-2014)
    # blkid /dev/sdb
    /dev/sdb10: LABEL="AAAAAAAAAAAA...[only 127 "A"s]...AAAAAAAAAAAA"
    UUID="f47f3fdc-dd91-4616-bb6d-0d643a884265" TYPE="f2fs"
    PARTUUID="3bb4bef8-9494-4e82-8dda-5d8edd9c60d9"

As blkid only reports the first 127 characters and is the only command
used for reading the label of an F2FS file system, use this as the new
increased limit.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=9799d6364dc93e1fd259d812d4a50ed984a6456b
    mkfs: handle labels longer than 16 characters

[2] https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.23/v2.23-ReleaseNotes
    "add Flash-Friendly File System (f2fs) support  [Alejandro Martinez
    Ruiz]"

Closes !29 - Enhance F2FS support
2019-03-26 08:08:10 +00:00
Mike Fleetwood afbf56c1c2 Drop fsck.f2fs -y option not available before f2fs-tools 1.10.0 (!29)
On CentOS 7 with f2fs-tools 1.4.1, checking an F2FS file system fails
like this:
    # fsck.f2fs -f -y -a /dev/sdb3
    Info: Force to fix corruption
    fsck.f2fs: invalid option -- 'y'
            Error: Unknown option ?

    Usage: fsck.f2fs [options] device
    [options]:
      -a check/fix potential corruption, reported by f2fs
      -d debug level default:0]
      -f check/fix entire partition
      -t show directory tree [-d -1]
    # echo $?
    1

Turns out that the '-y' option was not available until f2fs-tools 1.10.0
and is identical to the existing '-f' option anyway [1], which GParted
already uses.  Just remove the '-y' option passed to fsck.f2fs.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=55ee9e7202f84168f868d863da8ed1c4995a0e6d
    fsck.f2fs: add -y for generic fsck

Closes !29 - Enhance F2FS support
2019-03-26 08:08:10 +00:00
Mike Fleetwood 66a20ae9fa Handle missing FS size information before f2fs-tools 1.5.0 (!29)
Before this commit [1] first included in f2fs-tools 1.5.0, dump.f2fs
didn't report the total space used by the file system.  This causes F2FS
file system usage not be reported on older distributions, including
RHEL/CentOS 7 and Debian 8.

On CentOS 7:
    # rpm -q f2fs-tools
    f2fs-tools-1.4.1-2.el7.nux.x86_64
    # dump.f2fs -d 1 /dev/sdb3 | egrep 'sector size =|total.*sectors ='
    Info: sector size = 512
    Info: total sectors = 2097152 (in 512 bytes)

On Fedora 28:
    # rpm -q f2fs-tools
    f2f2-tools-1.10.0-1.fc28.x86_64
    # dump.f2fs -d 1 /dev/sdb2 | egrep -a 'sector size =|total.*sectors ='
    Info: sector size = 512
    Info: total sectors = 3145728 (1536 MB)
    Info: total FS sectors = 2621440 (1280 MB)

"total sectors" reports the size of the partition.
"total FS sectors" reports the size of the file system.

Cope with the file system size being missing.  Pass -1 as the file
system size to partition.set_sector_usage() in this case.  Note that
this means GParted won't be able to detect and report unallocated space
within the partition when using f2fs-tools < 1.5.0.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=fea6162a6db9af527648262d9fbb0335a0cc5460
    fsck.f2fs: show total sectors consumed by filesystem

Closes !29 - Enhance F2FS support
2019-03-26 08:08:10 +00:00
Mike Fleetwood c74ad52046 Make F2FS usage parsing handle NULs in dump.f2fs output (!29)
On Fedora 28 with f2fs-tools 1.10.0, dump.f2fs is producing NUL
characters in it's output and this completely breaks the parsing code in
f2fs::set_used_sectors().  Glib::Regex, as used by
Utils::regexp_label(), just doesn't match any text after the first NUL
character from the output.

    # dump.f2fs -d 1 /dev/sdb1
    Info: Debug level = 1
    Info: [/dev/sdb1] Disk Model: VBOX HARDDISK   1.0 ^@^@^@^@^@^@^@^...
    Info: Segments per section = 1
    Info: Sections per zone = 1
    Info: sector size = 512
    Info: total sectors = 2097152 (1024 MB)
    ...

Grep thinks the output is binary too:

    # dump.f2fs -d 1 /dev/sdb1 | \
    > egrep 'valid_block_count|user_block_count|log_blocksize|sector size =|total FS sectors ='
    Binary file (standard input) matches

    # dump.f2fs -d 1 /dev/sdb1 | \
    > egrep --text 'valid_block_count|user_block_count|log_blocksize|sector size =|total FS sectors ='
    Info: sector size = 512
    log_blocksize                           [0x       c : 12]
    Info: total FS sectors = 2097152 (1024 MB)
    user_block_count                        [0x   36400 : 222208]
    valid_block_count                       [0x       2 : 2]

Re-write set_used_sectors() using string find() and sscanf() to be
similar to how a number of the other set_used_sectors() are written for
other file systems.

Closes !29 - Enhance F2FS support
2019-03-26 08:08:10 +00:00
Antoine Viallon e550509781 Enhance F2FS support (!29)
- Adds reading of file system usage
- Adds resize (grow) support
- Adds verify support

Closes !29 - Enhance F2FS support
2019-03-26 08:08:10 +00:00
Mike Fleetwood 45fd146fd0 Go back to symbolic label widget alignment constants
Now that GParted requires Gtk3 there is no need to use floating point
numbers for compatibility with Gtk <= 2.22.  Replace with symbolic
alignment constants.

Relevant commit history:

*   6efa623401
    Add optional yalign argument to Utils::mk_label() method

*   be2689ad25
    Stop using deprecated widget alignment enumerators (#652044)
2019-03-23 11:13:30 -06:00
Mike Fleetwood 454ac64d19 Pass message parameters by reference to 2 Partition methods (#788813)
Note that this almost certainly has no performance benefit what so ever
because the methods are implicitly defined as inline [1][2] and the
compiler will have simply inlined the method bodies thus avoiding having
to construct copies of the passed parameters.

Do this anyway as constant objects are typically passed by reference
[3].  Also C++'s std::vector::push_back() [4] takes a const reference
parameter so update the kind of equivalent push_back_message() to take
a const reference parameter too.

[1] C++ reference / inline specifier
    https://en.cppreference.com/w/cpp/language/inline

        A function defined entirely inside a class/struct/union
        definition, whether it's a member function or a non-member
        friend function, is implicitly an inline function.

[2] When should I write the keyword 'inline' for a function/method?
    https://stackoverflow.com/questions/1759300/when-should-i-write-the-keyword-inline-for-a-function-method/1759575#1759575

[3] How to pass objects to functions in C++?
    https://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c/2139254#2139254

[4] C++ reference / std::vector::push
    https://en.cppreference.com/w/cpp/container/vector/push_back

        void push_back(const T& value);

Bug 788813 - gparted-0.30.0/include/Partition.h:137]: performance
             problem
2019-03-23 11:13:30 -06:00
Mike Fleetwood 0b5cfd3496 Stop checking for 'btrfs filesystem label' support (!26)
btrfs-progs 3.12 includes 'btrfs filesystem label /dev/PTN NEWLABEL'
functionality so stop checking for this before enabling setting the
label.

    $ btrfs version
    Btrfs v3.12
    $ btrfs filesystem label --help
    usage: btrfs filesystem label [<device>|<mount_point>] [<newlabel>]

        Get or change the label of a filesystem

        With one argument, get the label of filesystem on <device>.
        If <newlabel> is passed, set the filesystem label on <newlabel>.

    $ echo $?
    0

Worst case scenario is that some how an old version of the btrfs command
is used which doesn't support the labelling functionality.  Then this
commit would change GParted from disallowing labelling of a btrfs, to
allowing it, but presumably it would fail with an error from the btrfs
command reporting so.  Arguably better from a support point of view.

Closes !26 - Remove support for btrfs-progs < 3.12
2019-03-15 16:01:50 +00:00
Mike Fleetwood 05d9919afa Replace use of deprecated btrfsck (!26)
In btrfs-progs 3.12, btrfsck is a hard link to the multi-tool btrfs
executable.  When run as 'btrfsck' it just implements 'btrfs check'
[1][2][3][4].

In btrfs-progs 3.14.2 the btrfsck man page is re-added as a symlink to
the btrfs-check man page and reports that btrfsck is deprecated [5].

Therefore replace use of 'btrfsck' with 'btrfs check'.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=fac45410e9a783c187ae83d993d3bf3350d05149
    Btrfs-progs: Rename btrfsck.c -> cmds-check.c

[2] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=5956f752c66d5259bbb17a2dd47ee8c8cc0e5f4f
    Btrfs-progs: add btrfsck functionality to btrfs

[3] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=d5d2046ae3b216af22a8a37c940f2412ba519b6e
    Btrfs-progs: add btrfsck name detection to btrfs

[4] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=e31f6172aa1d6ec5d562f56086819a0f4bc8a914
    btrfs-progs: build btrsfck to keep compatibility

[5] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=fddeecb7d424d5bb1a93a19a5e537057a4a7f597
    btrfs-progs: doc: link btrfsck to btrfs-check

Closes !26 - Remove support for btrfs-progs < 3.12
2019-03-15 16:01:50 +00:00
Mike Fleetwood f697d1e7ce Stop using removed btrfsctl (!26)
That commit [1] also removed btrfsctl from btrfs-progs 3.12 so also stop
using it as a fallback.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=f243fcd1b2aa55ffadfbcc032c66dedbee56e79e
    Removing btrfsctl, btrfs-vol, btrfs-show

Closes !26 - Remove support for btrfs-progs < 3.12
2019-03-15 16:01:50 +00:00
Mike Fleetwood 3607ede307 Finish removal of btrfs-show (!26)
Remove use of btrfs-show from everywhere else in the btrfs module.

Closes !26 - Remove support for btrfs-progs < 3.12
2019-03-15 16:01:50 +00:00
Mike Fleetwood 9c40b7fff0 Stop using removed btrfs-show to read the label (!26)
This commit [1] from btrfs-progs 3.12 removed the previously deprecated
programs btrfsctl and btrfs-show.  As btrfs-progs 3.12 is now the
minimum requirement, remove support for those removed programs.

This commit is just removing the use of btrfs-show as a fallback to read
the label.

Note that 'btrfs-show /dev/PTN' didn't distinguish between a label of
"none" and no label.  Hence the logic in btrfs::read_label() to do with
matching the label "none", or matching the label with or without single
quotes.  Unfortunately as identified in this commit [2]
'btrfs filesystem show /dev/PTN' is subject to the same issue, but only
when the file system is mounted and only for btrfs-progs 3.12.  This was
fixed by this commit [3] from btrfs-progs 3.14.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=f243fcd1b2aa55ffadfbcc032c66dedbee56e79e
    Removing btrfsctl, btrfs-vol, btrfs-show

[2] eca732fb0c
    Update parsing of btrfs filesystem show for the label (#733601)

[3] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=a156b967ed9bd606afa8dc402451abcf07226c17
    btrfs-progs: make filesystem show by label work

Closes !26 - Remove support for btrfs-progs < 3.12
2019-03-15 16:01:50 +00:00
Mike Fleetwood d7dbbe4979 Remove old workaround for btrfs resizing on Linux < 3.2 (!26)
PATCHSET OVERVIEW

The oldest supported distributions have these versions of the Linux
kernel and btrfs-progs:
  Distro             EOL        kernel    btrfs-progs
- RHEL / CentOS 7    2024-Jun   3.10.0    4.9.1
- Ubuntu 14.04 LTS   2019-Apr   4.4.0     3.12
- Debian 8           2020-Jun   3.16.0    3.17
- SLES 12            2027-Oct   3.12.28   3.16

Making the oldest supported packages be kernel 3.10 and btrfs-progs 3.12
allows the btrfs support code to be simplified by removing backward
compatibility.

THIS CHANGE

Remove old workaround for ignoring the error when resizing a btrfs to
the same size on Linux kernel < 3.2.

Also now that only exit status 0 is considered successful from btrfs
resize, the EXEC_CHECK_STATUS flag to execute_command() can be used,
rather than having to separately call set_status() afterwards.

Relevant commit history:
*   11d044dba0
    Don't ignore any errors resizing btrfs on Linux >= 3.2 (#669389)
*   a580abbc30
    Use newer btrfs multi-tool control command first

Closes !26 - Remove support for btrfs-progs < 3.12
2019-03-15 16:01:50 +00:00
Mike Fleetwood 2aae7b0688 Set title of Resize/Move dialog for an extended partition (#44)
The title has never been set in this case, and defaulted to the name of
the executable 'gpartedbin'.  Fix this.

Closes #44 - Title not set in Resize/Move dialog for extended partitions
2019-03-14 17:08:50 +00:00
Trần Ngọc Quân e6e3f75d7d Updated Vietnamese translation
Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
2019-03-03 14:51:51 +07:00
Mike Fleetwood 8effaf4f22 Initialise local POD 'launched' variable in show_help()
'launched' local POD (Plain Old Data) variable was left uninitialised,
but was set in both the try and catch clauses.  Best practice is to
initialise when defined, so do that instead.  Cosmetic change.
2019-03-01 16:46:56 +00:00
Mike Fleetwood f5e870d6c4 Rename Win_GParted method to show_help()
It is not creating a dialog (a pop-up window managed by GParted code
itself).  It is launching independent yelp program to display the help,
so remove the "_dialog" from the name to avoid any possible confusion.
2019-03-01 16:46:56 +00:00
Mike Fleetwood e3ae8a6f26 Restore specific error message on failure to launch yelp
Originally, if the yelp command was not installed, attempting to display
help produced an error dialog with this message:
    Failed to execute child process "yelp" (No such file or directory)

However since this commit during the Gtk 3 port [1] the error message
became this less useful one:
    Operation not supported

Two attempts are made to display the GParted Manual, first using
gtk_show_uri() and second by executing the yelp command directly.  Prior
to the aforementioned commit [1] both methods returned the failure
reason using the same 'error' variable.  Hence reported the message
"Failed to execute child process "yelp" ..." from the second attempt.
However that commit had to re-code the second method as part of the Gtk
3 port and use a different error returning mechanism, thus the use of
different variable 'e'.  But the dialog was left reporting the message
from the original 'error' variable, thus reporting "Operation not
supported" message from the first attempt using gtk_show_uri().

Fix by again displaying the message from the second failure into the
error dialog.  Also make it very clear there are two error returning
variables by naming them 'error1' and 'error2_msg'.

[1] 2953778a4c
    port-to-gtk3: Use Gdk::AppLaunchContext to launch yelp (#7)
2019-03-01 16:46:56 +00:00
Mike Fleetwood 3ce3683df5 Remove deprecated PKG_NAME from autogen.sh
Use of PKG_NAME is deprecated in GNOME 3 and produced this warning:

    $ ./autogen.sh
    /usr/bin/gnome-autogen.sh
    /usr/bin/yelp-build
    ***Warning*** PKG_NAME is deprecated, you may remove it from autogen.sh
    ...

Now that GParted is a GNOME 3 application with GNOME 3 yelp-tools
managed documentation this is redundant and can be removed.  Previous
further analysis:

    GNOME Bugzilla, Bug 743318, comment 18
    https://bugzilla.gnome.org/show_bug.cgi?id=743318#c18
    "
    PKG_NAME is still used in GNOME 2.28's gnome-autogen.sh in error
    messages.  (GNOME 3's gnome-autogen.sh queries it from configure.ac
    instead of requiring it to be set).
    "

Also confirmed that it makes no difference by running ./autogen.sh with
and without PKG_NAME being set.  The produced GParted build trees were
the same.  Therefore the release and executable can't be affected.
2019-03-01 16:46:56 +00:00
Mike Fleetwood 83777932c6 Drop now unnecessary editing of xmllint command line in CI tests (!24)
GNOME 3's yelp doesn't use scrollkeeper or the OMF catalog, so the
constructed Makefile doesn't use xmllint to validate the scrollkeeper
DTD file.  Therefore remove attempted sed edit of that line which no
longer exists in the Makefile.

Note that help/Makefile.am's @YELP_HELP_RULES@ automake macro expansion
comes from /usr/share/aclocal/yelp.m4 [1].

Commit which previously needed to add the sed edit:
    cbb25a2511
    Stop xmllint scrollkeeper-omf.dtd fetch failure breaking CI tests (#9)

[1] Yelp > Yelp Tools > yelp.m4
    http://yelp.io/tools/yelp.m4.html

Closes !24 - Port to GNOME 3 yelp-tools documentation infrastructure
2019-03-01 16:46:56 +00:00
Mike Fleetwood 5aca85e4ad Launch help from GParted using the new GNOME 3 help: prefix (!24)
Update GParted to specify the GParted Manual using the new GNOME 3 way
with the 'help:' prefix to avoid yelp reporting this error:
    Document Not Found
    The URI 'ghelp:gparted' does not point to a valid page.

Closes !24 - Port to GNOME 3 yelp-tools documentation infrastructure
2019-03-01 16:46:56 +00:00
Mike Fleetwood 4ef3ef3312 Allow GNOME 3 yelp to display the GParted Manual (!24)
Now with GNOME 3 style help installed, running 'yelp help:gparted'
results in this error being displayed in yelp:
    Page Not Found
    The requested page was not found in the document 'help:gparted'.

Where as running 'yelp help:gparted/gparted' correctly displays the
GParted Manual.

Fix by renaming the article tag to the default 'index' that yelp is
expecting when using the new GNOME 3 'help:' prefix.

Closes !24 - Port to GNOME 3 yelp-tools documentation infrastructure
2019-03-01 16:46:56 +00:00
Mike Fleetwood a725921a22 Add use of new GNOME 3 yelp-tools documentation infrastructure (!24)
Second part is to use yelp-tools to build and install the documentation.
Have to rename the help Manual from help/C/gparted.xml to
help/C/index.docbook in accordance with this note from the GNOME Goal:
Port to New Documentation Infrastructure [1]:
    IMPORTANT: If this is for a DocBook document, the top-level DocBook
    file MUST be renamed to index.docbook.  Do a "git mv" and include
    index.docbook in HELP_FILES.

Commits from gucharmap [4] and totem [5], projects which have DocBook
documentation, making this same change are also useful references.

[1] GNOME Goal: Port To New Documentation Infrastructure
    https://wiki.gnome.org/Initiatives/GnomeGoals/NewDocumentationInfrastructure

[2] Yelp > Yelp Tools > yelp.m4
    http://yelp.io/tools/yelp.m4.html

[3] GNOME application developement overview / User help / Set up your
    build system
    https://developer.gnome.org/platform-overview/stable/dev-help-build.html.en

[4] gucharmap commit "Port to new documentation infrastructure"
    3e1526c056

[5] totem commit "Use new documentation infrastructure"
    59a6bd6064

Closes !24 - Port to GNOME 3 yelp-tools documentation infrastructure
2019-03-01 16:46:56 +00:00
Mike Fleetwood e62b352eed Remove use of GNOME 2 gnome-doc-utils documentation infrastructure (!24)
Details of old GNOME 2 gnome-doc-utils:
    Migrating your documentation to gnome-doc-utils
    https://wiki.gnome.org/Projects/GnomeDocUtils/MigrationHowTo

First part is to stop using gnome-doc-utils to build and install the
documentation.  Also since updating the OMF catalog was only needed for
GNOME 2 yelp, use of scrollkeeper is completely removed too.

Closes !24 - Port to GNOME 3 yelp-tools documentation infrastructure
2019-03-01 16:46:56 +00:00
Jeremy Bicha 12adade3ab Fix FDL help link for gnome-desktop 3.5+ (!24)
I generated this by running:
    find ./ -type f -exec sed -i 's/ghelp:fdl/help:fdl/g' {} \;

By updating the translations at the same time, it should be easier on
the translators as there's no reason to invalidate these strings.

https://bugzilla.gnome.org/show_bug.cgi?id=704634#c8

[Mike Fleetwood: Explain the underlying cause and distro versions.]
This gnome-desktop commit, first included in version 3.5.5, switched the
package from using gnome-doc-utils to yelp-tools so changed the
installed location of the GNU FDL license file from
/usr/share/gnome/help/fdl/C/fdl.xml to
/usr/share/help/C/fdl/index.docbook, thus changing the yelp URI from
'ghelp:fdl' to 'help:fdl':
    8b7e059e2c
    Port to new documentation infrastructure

The oldest supported distributions with Gtk/GNOME 3 all have at least
3.10, therefore use this fix unconditionally.

    Distribution        EOL         Gtk/GNOME 3
    RHEL / CentOS 7     2024-Jun    3.22
    Ubuntu 14.04 LTS    2019-Apr    3.10
    Ubuntu 16.04 LTS    2021-Apr    3.18
    Debian 8            2023-Apr    3.14
    SLES 12             2027-Oct    3.10

Closes !24 - Port to GNOME 3 yelp-tools documentation infrastructure
2019-03-01 16:46:56 +00:00
Mike Fleetwood 8412dcfe72 Remove redundant file help/C/Makefile.am (!24)
The file has been redundant since it was first added [1].  It was never
listed in configure.ac (or configure.in) in AC_CONFIG_FILES.  Therefore
autoconf has never produced help/C/Makefile.in and ./configure has never
produced help/C/Makefile.  Therefore it isn't used during the build and
install of GParted.  Remove it.

[1] 46ca7c74dc
    Added code hooks to prepare for GParted Manual

Closes !24 - Port to GNOME 3 yelp-tools documentation infrastructure
2019-03-01 16:46:55 +00:00
Kukuh Syafaat 2c3c897fed Update Indonesian translation 2019-02-28 07:15:44 +00:00
Nathan Follens 8b112a35e4 Update Dutch translation 2019-02-26 12:09:37 +00:00
Mike Fleetwood 4fcd182992 Remove left behind configuration summary lines (!22)
These lines in the final configuration report from ./configure were left
behind [1] when determination of the underlying definitions were remove.
So they no longer report 'yes' or 'no' like the other lines in the file
configuration report.

       Need partition table re-read workaround?  :
     Supports large sector sizes (> 512 bytes)?  :

Remove them now.

[1] 8df975c7d1
    Increase minimum required libparted to 2.2 (!22)

Closes !22 - Increase minimums to libparted 2.2 and glibmm 2.32
2019-02-20 16:15:17 +00:00
Mike Fleetwood d0281a3264 Remove left behind commented #includes from fat16.cc
According to the GIT history the lines were added by this commit:
    8d808c0b62
    gparted-0.3.6 - code recreation from Source Forge

Looking at the SVN history this commit actually fleshed out the
implementations of fat16::get_label() and fat32::get_label() and added
the commented #includes:
    https://sourceforge.net/p/gparted/svn/118
    Added read label support for fat16 and fat32 using mtools mlabel command
    2008-02-12

Then this SVN commit moved the mtools temporary file handling code into
Utils.cc, leaving behind the commented #includes:
    https://sourceforge.net/p/gparted/svn/124
    Added MTools temporary file handling functions
    2008-02-19

Finally this commit removed fat32.cc by merging the code with fat16.cc:
    519af1a7c0
    Combine duplicate code for fat16/32

So remove the left behind commented #includes from fat16.cc.
2019-02-20 16:15:17 +00:00
Mike Fleetwood 24d9599f66 Enable online resizing of extended partitions (!23)
A forum user had a case where they wanted to grow their in use root,
ext4 file system.  GParted supports this, but the partition was a
logical partition inside an extended partition and GParted doesn't
support resizing an extended partition while any contained logical
partitions are busy.

Example layout:

    Partition              File System   Mount Point
    /dev/sdb1              ntfs
    /dev/sdb2     [busy]
        /dev/sdb5 [busy]   ext4          /
    unallocated            unallocated

So just allow extended partitions to be resized online when online
partition resizing is available via libparted.

NOTE:
The block device that the Linux kernel provides for an extended
partition just maps to the first 1 KiB of the extended partition where
the Extended Boot Record is stored, and does not include any of the
contained logical partitions.  Therefore no application can care that
the extended partition is resized while a logical partition is in use
because it can't use the extended partition block device to access any
data.

The on disk layout looks like this:

    # fdisk -l /dev/sdb

    Disk /dev/sdb: 8589 MB, 8589934592 bytes, 16777216 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk label type: dos
    Disk identifier: 0x0007650e

       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048     1050623      524288    7  HPFS/NTFS/exFAT
    /dev/sdb2         1050624     2101247      525312    5  Extended
    /dev/sdb5         1052672     2101247      524288   83  Linux

    # parted /dev/sdb unit s print free
    Model: ATA VBOX HARDDISK (scsi)
    Disk /dev/sdb: 16777216s
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Disk Flags:

    Number  Start     End        Size       Type      File system  Flags
            63s       2047s      1985s                Free Space
     1      2048s     1050623s   1048576s   primary   ntfs
     2      1050624s  2101247s   1050624s   extended
     5      1052672s  2101247s   1048576s   logical   ext4
            2101248s  16777215s  14675968s            Free Space

The kernel's partition sizes from /sys/block/sdb/sdb${N}/{start,size}
shows extended partition 2 has a size of only 2 sectors:

    # for N in 1 2 5
    > do
    > echo -e "/dev/sdb${N}\tstart=`cat /sys/block/sdb/sdb${N}/start`\tsize=`cat /sys/block/sdb/sdb${N}/size`"
    > done
    /dev/sdb1       start=2048      size=1048576
    /dev/sdb2       start=1050624   size=2
    /dev/sdb5       start=1052672   size=1048576

The EBR read from the whole of extended partition 2 block device:

    # hexdump -C /dev/sdb2
    00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000001b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 86  |................|
    000001c0  06 41 83 cb 09 82 00 08  00 00 00 00 10 00 00 00  |.A..............|
    000001d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
    00000200  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    *
    00000400

Closes !23 - Enable online resizing of extended partitions
2019-02-20 16:15:17 +00:00
Mike Fleetwood 1ed30495f1 Recognise contribution by Luca Bacci 2019-02-11 09:21:01 +00:00
Luca Bacci c091c9f458 Prevent the legend text making the features dialog too wide (#7)
With the Gtk3 port the File System Support dialog has become too wide
because the legend text is no longer wrapped.  Set the max-width-chars
property to specify the natural size of the widget in terms of
characters [1].  It is converted to pixels using the average character
width in the current font.

Also use PACK_EXPAND_WIDGET when adding the label to the box so that if
the dialog is resized extra space is used to increase the size of this
child widget [2].

[1] GNOME HowDoI / Labels
    https://wiki.gnome.org/HowDoI/Labels

[2] Gtkmm 3.0 Enums and Flags, enum Gtk::PackOptions
    "PACK_EXPAND_WIDGET  Space is expanded, with extra space filled by
    increasing the child widget size."
    https://developer.gnome.org/gtkmm/3.0/group__gtkmmEnums.html#ga83727a1b6fed51566dfd5c8e58890dba

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci bf39c221b8 Enable display of progress bar text when applying operations (#7)
In Gtk2 progress bars show optional text superimposed over the bar.  In
Gtk3 the text is not displayed by default, so set the show-text property
to re-enable this [1].

Also note that since Gtk 3.14.0 the optional text is not superimposed
over the progress bar, but instead displayed just above it [2][3][4].

References:

[1] Gtkmm 3.0 Gtk::ProgressBar Class Reference, set_show_text()
    "Sets whether the progressbar will show text superimposed over the
    bar."
    https://developer.gnome.org/gtkmm/3.0/classGtk_1_1ProgressBar.html#a0bfa6042f5d4b3509967abc2d8af57fe

[2] Commit - Update the design for progress bars
    74405cc964

[3] Bug 748784 - GtkProgressBar text cannot be superimposed on the
    progress bar
    https://bugzilla.gnome.org/show_bug.cgi?id=748784

[4] Gtkmm 3.18 Gtk:ProgressBar Class Reference, set_show_text()
    "Set whether the progress bar will show text next to the bar."
    https://developer.gnome.org/gtkmm/3.18/classGtk_1_1ProgressBar.html#a0bfa6042f5d4b3509967abc2d8af57fe

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci d626a636d3 Ensure SpinButtons have space to display 7 digits (#7)
In Gtk2 the up and down buttons in a SpinButton were smaller leaving
space for 7 digits before scrolling the entry.  In Gtk3 the up and down
buttons are much larger leaving only space for 4 digits.  This occurs in
the SpinButtons in the Dialog_Base_Partition class as displayed in the
New Partition, Paste and Resize/Move dialogs.

Set width-chars property of all Gtk::SpinButtons to ensure 7 digits can
be displayed before scrolling the entry.

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 6aba93d8c0 Change Gtk::ProgressBar appearance by providing custom CSS (#7)
In Gtk3 the progress bar height is fixed and defined by the CSS theme in
use.  Changing the widget allocation size does nothing, it is always
rendered the same way.

In many themes, including Adwaita, the progressbar is very, very thin.
Provide custom CSS to specify a height of 8 pixels.

The CSS source string has to be differentiated for Gtk pre and post
3.20, because Gtk 3.20 introduced some breaking changes in the way CSS
is handled.

References:

[1] Migrating from GTK+ 2.x to GTK+ 3 - Parsing of custom resources
    https://developer.gnome.org/gtk3/stable/gtk-migrating-GtkStyleContext-parsing.html

[2] Gtk3 Reference Documentation - Changes in GTK+ 3.20
    https://developer.gnome.org/gtk3/stable/ch32s10.html

[3] Gnome/HowDoI - Custom Style
    https://wiki.gnome.org/HowDoI/CustomStyle

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 6c47561bf6 Change packing of pulsebar in statusbar (#7)
The pulsebar looks very small and needs to be widened.  The pulsebar is
packed inside the statusbar so that it displays activity text on the
left side and the pulsebar on the right side.  Ideally we want the space
to be evenly divided for the textual messages and for the pulsebar
activity indicator.

For this we just have to set the 'homogeneous' property to TRUE for the
statusbar (note that GtkStatusBar inherits from GtkBox).

Also vertically align the pulsebar to the center of the statusbar.  This
is achieved setting the 'valign' property to Gtk::ALIGN_CENTER for the
pulsebar widget.

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 892f5542a4 Work around Gtk3 Gtk-CRITICAL messages when closing some dialogs (#7)
There is a bug affecting Gtk+ 3.22.8 to 3.22.30 in which destroying a
GtkComboBox when it is not hidden results in this message:

    Gtk-CRITICAL **: gtk_widget_is_drawable: assertion 'GTK_IS_WIDGET (widget)' failed

This happens in GParted when some dialogs are closed, for example the
Create New Partition and Create Partition Table dialogs.  To work around
the issue we call Gtk::Dialog::hide() in the destructors of our dialog
classes.

The issue was fixed in Gtk 3.24.0.

 * Gtk 3.22.8 was released in February 2017.
 * Gtk 3.24.0 was released in September 2018.

References:

[1] Gtk Issue - GtkComboBox::private::popup_window can be NULL
    https://gitlab.gnome.org/GNOME/gtk/issues/125

[2] Gtk commit - combobox: popdown() the menu during unmap()
    7401794de6

[3] Gtk commit - Check for NULL priv->popup_window in
    gtk_combo_box_popdown()
    aa5d926c84

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 392bbba534 Work around Gtkmm3 issue where menu accelerators are not shown (#7)
There is a bug in Gtkmm3 when setting accelerator keys on a
Gtk::MenuItem, the accelerator keys work but are not displayed when the
menu is drawn.  This happens for Gtk::MenuItems, including derived
objects, that are constructed with a non-default constructor.

All non-default constructors of Gtk::MenuItem, and subclasses, work by
creating themselves a Gtk::AccelLabel and packing it inside the menu
item.  But in Gtk3 GtkMenuItem are created with a GtkAccelLabel already
packed in as a child and that accel label should be used instead.

To workaround the issue we only use the default constructor for
Gtk::MenuItem and subclasses.  This is easy to do because we only have
to change the wrappers in MenuHelpers.cc.

This bug affects Gtkmm version 3.0.0 to 3.22.2 and was fixed in
Gtkmm 3.22.3.

 * Gtkmm 3.0.0 was released in April 2011
 * Gtkmm 3.22.3 was released in November 2018

References:

[1] Bug Report on the Gtkmm mailing list
    https://mail.gnome.org/archives/gtkmm-list/2018-February/msg00006.html

[2] Commit - Gtk::MenuItem: Fix add_accel_label()
    e5c8c2df67

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 244f4bcd22 Simplify code using Gtk::Container::get_children() (#7)
GParted uses Gtk::Container::get_children().  In Gtkmm2
Gtk::Container::get_children() returns a Glibmm intermediate container
[1].  Gtkmm3 dropped the use of Glibmm intermediate containers in favour
of STL containers [2][3].

Now that Gtk::Container::get_children() directly returns a std::vector<>
simplify the code.

References:

[1] Gtkmm 2.24 Gtk::Container Class Reference
    "Glib::ListHandle<Widget*> Gtk::Container::get_children()"
    https://developer.gnome.org/gtkmm/2.24/classGtk_1_1Container.html#acd2f9b9ac16ba96178d3f5169b07f4d0

[2] Gtkmm 3.0 Gtk::Container Class Reference
    "std::vector<Widget*> Gtk::Container::get_children()"
    https://developer.gnome.org/gtkmm/3.0/classGtk_1_1Container.html#a3a2111e255cb5b72bd91a3be087cff27

[1] Programming with gtkmm3 / Changes in gtkmm3
    "11. We now use std::vector in several methods instead of the
    intermediate *Handle types to make the API clearer."
    https://developer.gnome.org/gtkmm-tutorial/3.0/changes-gtkmm3.html.en

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 0078cf01cc port-to-gtk3: Block Gtk::TreeSelection changed handler on tree model clear (#7)
Now GParted compiles with Gtkmm3, but we get a failed assertion doing
the following:
 * Select a device with more than 1 partition
 * Select a partition
 * Activate 'Refresh Devices' (or do any operation that causes it, like
   mount/unmount etc.)

This is the failed assertion:
    **
    ERROR:Win_GParted.cc:1152:void GParted::Win_GParted::set_valid_operations(): assertion failed: (valid_display_partition_ptr( selected_partition_ptr ))
    Aborted (core dumped)

Where is the problem?

Win_GParted::Refresh_Visual() calls TreeView_Detail::load_partitions()
to clear and refill the treeview.

The problem is in GParted::TreeView_Detail::load_partitions() at
TreeView_Detail.cc:91:
    treestore_detail->clear();

This activates TreeView_Detail::on_selection_changed() which in turn
activates Win_GParted::on_partition_selected() passing an old, stale
pointer as an argument.  This triggers the failed assertion.

Why does this happen with Gtk3 and not with Gtk2?

First a bit of background of GtkTreeView:

What happens to the selection in a GtkTreeView when the selected row
is removed?

With Gtk2 the selection simply becomes empty, so nothing is selected
afterwards.  With Gtk3 this was changed [1] and selection moves to an
adjacent row.

gtk_tree_store_clear() removes rows one by one.  While removing rows the
selection changed signal is emitted.  With Gtk2 it is emitted only one
time, to indicate that selection has become empty.  With Gtk3 it is
instead emitted several times, each time indicating that selection has
moved to the adjacent row.

The handler TreeView_Detail::on_selection_changed() only takes action
when the selection is not empty.  So with Gtk3 it really takes action
and activates Win_GParted::on_partition_selected() with a pointer to old
data.

What's the purpose of TreeView_Detail::on_selection_changed()?

Its task is to update the selection in the drawing area above the
TreeViewDetail, the DrawingAreaVisualDisk, so that the selected
partition stays in sync on the two widgets.

Fix by blocking the signal handler during the treeview clear.

Reference:
[1] Commit - treeview: Handle the case where the cursor row gets deleted
    1a2932ba29

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 2953778a4c port-to-gtk3: Use Gdk::AppLaunchContext to launch yelp (#7)
gdk_spawn_command_line_on_screen() is not present in Gtk3.  The
documentation from Gtkmm 2.24 states [1]:

    gdk_spawn_command_line_on_screen has been deprecated since version
    2.24 and should not be used in newly-written code.  This function is
    being removed in 3.0.  Use either g_spawn_command_line_sync(),
    g_spawn_command_line_async() or GdkAppLaunchContext instead.

g_spawn_command_line_sync() and g_spawn_command_line_async() are screen
/ display agnostic, as such we would loose functionality.  There is a
workaround, which involves setting the DISPLAY environment variable [2],
but it's a weak solution (and I don't know if it works on backends
other than X11).

GdkAppLaunchContext is an implementation of GIO's GAppLaunchContext that
handles launching an application in a graphical context [3].  Therefore
use GdkAppLaunchContext and GIO's GAppInfo.

GdkAppLaunchContext was introduced in Gtk2 version 2.14.  The C++
wrapper Gdk::AppLaunchContext was introduced only in Gtkmm3 version 3.4
[4].  Bump the minimum required version of Gtkmm to 3.4.0 for this
requirement.

GAppInfo was introduced in GLib version 2.16.  The C++ wrapper
Gio::AppInfo was introduced in Giomm version 2.16.  Note that the
minimum required version for glibmm is already 2.32.

[1] GDK 2 Reference Manual, GdkScreen, gdk_spawn_on_screen()
    https://developer.gnome.org/gdk2/2.24/GdkScreen.html#gdk-spawn-on-screen

[2] Migrating from GTK+ 2.x to GTK+ 3 - "Use GIO for launching applications"
    https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html#id-1.6.3.3.7

[3] GDK 3 Reference Manual - "Application launching"
    https://developer.gnome.org/gdk3/stable/gdk3-Application-launching.html

[4] Gtkmm 3.4 Gdk::AppLaunchContext Class Reference, Detailed Description
    https://developer.gnome.org/gtkmm/3.4/classGdk_1_1AppLaunchContext.html#details

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00