Commit Graph

3818 Commits

Author SHA1 Message Date
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
Luca Bacci 202e6e9034 port-to-gtk3: Use Gtk::CellLayout::get_cells() (#7)
GParted uses Gtk::TreeViewColumn::get_cell_renderers().  This is not
present in Gtkmm3.  Now Gtk::TreeViewColumn inherits from
Gtk::CellLayout and we have to use Gtk::CellLayout::get_cells() instead.

GtkCellLayout was introduced in Gtk2 version 2.18 as the common
interface for containers of cell renderers.

The C++ wrapper Gtk::CellLayout was introduced in Gtkmm2 version 2.18,
but Gtk::TreeViewColumn was never made to inherit from Gtk::CellLayout
to avoid breaking the API / ABI.  That change was made for Gtkmm3.

This is an excerpt from gtkmm/treeviewcolumn.h header in Gtkmm2:
  // TODO: Should be deprecated, but we cannot derive from CellLayout
  // without breaking API and ABI.

  /** Returns a list of all the cell renderers in the column,
   * in no particular order.
   *
   * @return A list of Gtk::CellRenderers.
   */
  Glib::ListHandle<CellRenderer*> get_cell_renderers();

Replace Gtk::TreeViewColumn::get_cell_renderers() with base class
method Gtk::CellLayout::get_cells().

Reference:

[1] Commit - "Deprecate get_cell_renderers implementations"
    6abc52a29d

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 21d8ad218e port-to-gtk3: Use draw signal in the partition resizer (#7)
In Gtk2 widgets draw themselves in response to the expose event signal.
In Gtk3 widgets draw themselves in response to the GtkWidget::draw
signal, and the signal handler gets a Cairo context as an argument.

Convert Gtk::DrawingArea rendering code to respond to the
GtkWidget::draw signal.

This commit is specific to the drawing area in the Create new Partition
dialog and the Resize/Move dialog.

Reference:

[1] Migrating from GTK+ 2.x to GTK+ 3 - "The GtkWidget::draw signal":
    https://developer.gnome.org/gtk3/stable/ch26s02.html#id-1.6.3.4.11

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 93b1425549 port-to-gtk3: Use draw signal in the partition visualizer (#7)
In Gtk2 widgets draw themselves in response to the expose event signal.
In Gtk3 widgets draw themselves in response to the GtkWidget::draw
signal, and the signal handler gets a Cairo context as an argument.

Convert Gtk::DrawingArea rendering code to respond to the
GtkWidget::draw signal.

This commit is specific to the drawing area contained in the main
application window (also called the DrawingAreaVisualDisk).

Reference:

[1] Migrating from GTK+ 2.x to GTK+ 3 - "The GtkWidget::draw signal":
    https://developer.gnome.org/gtk3/stable/ch26s02.html#id-1.6.3.4.11

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 4c1fe3bf7a port-to-gtk3: Use draw signal in the partition info dialog (#7)
In Gtk2 widgets draw themselves in response to the expose event signal.
In Gtk3 widgets draw themselves in response to the GtkWidget::draw
signal, and the signal handler gets a Cairo context as an argument.

Convert Gtk::DrawingArea rendering code to respond to the
GtkWidget::draw signal.

This commit is specific to the drawing area in the Partition Info
dialog.

Reference:

[1] Migrating from GTK+ 2.x to GTK+ 3 - "The GtkWidget::draw signal":
    https://developer.gnome.org/gtk3/stable/ch26s02.html#id-1.6.3.4.11

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci e3f77966c9 port-to-gtk3: Use Gtk::Widget::render_icon_pixbuf() (#7)
In Gtk3/C, gtk_widget_render_icon() was deprecated in Gtk 3.0 [1].  In
Gtkmm3/C++, Gtk::Widget::render_icon() was abruptly removed from Gtkmm
3.0 and replaced with Gtk::Widget::render_icon_pixbuf() [2].

Gtk::Widget::render_icon() [3] had an optional 3rd parameter which
GParted never used.  Replace with Gtk::Widget::render_icon_pixbuf() [4].

References:

[1] GTK+ 3 Reference Manual, GtkWidget
    https://developer.gnome.org/gtk3/stable/GtkWidget.html#gtk-widget-render-icon
    "gtk_widget_render_icon has been deprecated since version 3.0 and
    should not be used in newly-written code."

[2] Gtkmm 3.0.0 NEWS file
    "... Removed render_icon(), adding render_icon_pixbuf()."
    https://gitlab.gnome.org/GNOME/gtkmm/blob/3.0.0/NEWS#L187

[3] Gtkmm 2.24 Gtk::Widget Class Reference, render_icon()
    https://developer.gnome.org/gtkmm/2.24/classGtk_1_1Widget.html#a91efd1b5aed7c184506ddd5721710584

[4] Gtkmm 3.0 Gtk::Widget Class Reference, render_icon_pixbuf()
    https://developer.gnome.org/gtkmm/3.0/classGtk_1_1Widget.html#a28bbbd0c1717e58343df56f7f422b106

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 5fb58f8877 port-to-gtk3: Use Gdk::Cursor via Glib::RefPtr<> (#7)
Starting from Gtkmm3 Gdk::Cursor objects cannot be constructed directly,
but instead you have to get a smart pointer to an instance by calling
the static member function Gdk::Cursor::create().

Gdk::Cursor::create() returns a Glib::RefPtr<Gdk::Cursor> object.

Gtkmm3 always uses Glib::RefPtr<Gdk::Cursor> in its interface and never
plain Gdk::Cursor.

Reference:

[1] Programming with gtkmm3, Changes in gtkmm3:
    https://developer.gnome.org/gtkmm-tutorial/3.24/changes-gtkmm3.html.en
    "... Gdk::Cursor are now used via Glib::RefPtr."

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 29a21a5a4c port-to-gtk3: Rework Gtk header includes (#7)
In Gtk3 individual headers cannot be included directly in application
code, only the header <gtk/gtk.h> can be included (with a few exceptions
for some platform specific headers).

This has always been considered good practice even for Gtk2, though was
not a hard requirement.

In Gtk3 this is enforced by preprocessor checks.  Failure to do so
yields a preprocessor error and compilation fails:

  "error: Only <gtk/gtk.h> can be included directly."

Change specific Gtk header includes to:

  #include <gtk/gtk.h>

References:

[1] Migrating from GTK+ 2.x to GTK+ 3 - "Do not include individual headers"
    https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html#id-1.6.3.3.3

[2] Commit - "Remove all traces of GDK_PIXBUF/GTK_DISABLE_SINGLE_INCLUDES"
    5e29973773

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 05da10775c port-to-gtk3: Rework Gtkmm header includes (#7)
Now that we are compiling against Gtkmm3 there are missing declarations
of Gtkmm identifiers due to changes in Gtkmm internal header structure.

All we have to do is bring back the declarations by including the
appropriate headers where needed.

Add necessary Gtkmm header includes.

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 4b87839502 port-to-gtk3: Rework Glibmm header includes (#7)
Now that we are compiling against Gtkmm3 there are missing declarations
of Glibmm identifiers due to changes in Gtkmm internal header structure.

All we have to do is bring back the declarations by including the
appropriate headers where needed.

Add necessary Glibmm header includes.

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci cc0740148e port-to-gtk3: Switch to Gtkmm3 (#7)
Switch to Gtkmm3 in configure.ac.  Require version 3.0.0.

Also update the build instructions in README and the package list in
.gitlab-ci.yml.

Starting from version 3.18.0 Gtkmm requires C++11 compilation [1][2][3].
Add a check for Gtkmm >= 3.18.0 in configure.ac and enable C++11
compilation accordingly.

References:

[1] Gtkmm 3.18.1 NEWS
    "Changes in 3.18 ... Use, and require C++11, ..."
    https://gitlab.gnome.org/GNOME/gtkmm/blob/3.18.1/NEWS#L35

[2] Murray's Blog - "gtkmm now uses C++11"
    https://www.murrayc.com/permalink/2015/07/31/gtkmm-now-uses-c11

[3] Murray's Blog - "gtkmm 3.18 and glibmm 2.46"
    https://www.murrayc.com/permalink/2015/09/25/gtkmm-3-18-and-glibmm-2-46

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 5379352766 prepare-for-gtk3: Prepare for removal of Gtk::Widget::modify_fg() (#7)
The Gtk::Widget::modify_fs() API was removed in Gtkmm3 [1] and also
there is no direct replacement.  GParted uses this in one place.  So
instead use the C gtk_widget_modify_fg() version that is still present
in Gtk3.

This is just a temporary change to port GParted to Gtk3.  In future this
will be replaced as part of the switch from Gdk::Color to Gtk::RGBA,
since Gdk::Color was deprecated in Gtkmm 3.10 [2].

Reference:

[1] ee432e2190
    commit message "... Remove the modify_*() methods, ..."

[2] Gtkmm 3.10 Gdk::Color Class Reference
    https://developer.gnome.org/gtkmm/3.10/classGdk_1_1Color.html#details
        Deprecated:
        Use Gdk::RGBA instead.

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 0d73ff83d9 prepare-for-gtk3: Prepare for removal of Gtk::Menu_Helpers::MenuList (#7)
GParted uses Gtk::Menu_Helpers::MenuList helper class to access
individual menu items.  This helper class made it easy to navigate menu
items by index.

Gtk::Menu_Helpers::MenuList was removed in the switch from Gtkmm2 to
Gtkmm3 [1].  Instead, use a separate std::map<Gtk::MenuItem*> to keep
track of individual Gtk::MenuItem objects.

Reference:
[1] Gtkmm 3 commit "MenuShell: Remove items()." removed the code
    c8e47b0db5

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci eb30c959a6 prepare-for-gtk3: Prepare for removal of Gtk::Menu_Helpers::Element (#7)
Gtk::Menu_Helpers::Element class and subclasses help in Gtk::MenuItem
widgets and also automate tasks like registering keyboard accelerators
when parented to a top-level window [1][2].

Gtk::Menu_Helpers::Element class and subclasses were removed in Gtkmm3
[3].  Provide compatible implementations under the namespace
GParted::Menu_Helpers.

References:

[1] gtkmm: Gtk::Menu_Helpers Namespace Reference
    https://developer.gnome.org/gtkmm/2.24/namespaceGtk_1_1Menu__Helpers.html

[2] gtkmm: Gtk::Menu_Helpers::Element Class Reference
    https://developer.gnome.org/gtkmm/2.24/classGtk_1_1Menu__Helpers_1_1Element.html

[3] Gtkmm 3 commit "MenuShell: Remove items()." removed the code
    c8e47b0db5

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci a44d548a3a prepare-for-gtk3: Replace deprecated GDK_<KeyName> constants (#7)
During the switch from Gtk2 to Gtk3 keyname constants were renamed from
GDK_<KeyName> to GDK_KEY_<KeyName> [1].  This was done to avoid name
clashes in gobject-introspection and language bindings.  The new
constant names were also backported to Gtk 2.22 [2].

Make use of the new constant names.

References:
[1] Migrating from GTK+ 2.x to GTK+ 3 - "Replace GDK_<keyname> with GDK_KEY_<keyname>"
    https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html#id-1.6.3.3.6

[2] Commit - "gdk: Prefix keys with _KEY by default"
    750c81f43d

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Luca Bacci 38d9d92013 prepare-for-gtk3: Remove calls to Gtk::Dialog::set_has_separator() (#7)
Originally in Gtk2, by default, dialogs showed a horizontal separator
between the content area and the action area (buttons).  GParted
explicitly called Gtk::Dialog::set_has_separator(false) for all it's
dialogs to remove the separator.

In Gtk2/Gtkmm2 2.22, separators were deprecated [1].  In Gtk3/Gtkmm3
separators in dialogs were removed altogether, including all the related
APIs [2][3][4].  Therefore remove all calls.

References:
[1] Commit - "Document separator-related api in GtkDialog as deprecated"
    6f6650e6cf

[2] Commit - "Remove separators from dialogs"
    d433a60611

[3] GTK+ 3.0.0 NEWS file
    https://gitlab.gnome.org/GNOME/gtk/blob/3.0.0/NEWS#L779
    "
    Overview of Changed from GTK+ 2.90.6 to 2.90.7
    ==============================================

    * Various deprecated APIs have been removed:
    ...
    - GtkDialog separators, including the GtkDialog::has-separator
      property, including setter/getter, the GTK_DIALOG_NO_SEPARATOR
      flag and the GtkMessageDialog::use-separator style property
    "

[4] Gtkmm 3.0.0 NEWS file
    https://gitlab.gnome.org/GNOME/gtkmm/blob/3.0.0/NEWS#406
    "
    * Dialog:
    - Remove get/set_has_separator() and property.
    - Constructors: Remove use_separator parameters.
    "

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Balázs Úr f86d7548cd Update Hungarian translation 2019-01-28 23:44:40 +00:00
Mike Fleetwood 2b222978f5 Update to Google Test 1.8.1
Update to Google Test C++ test framework from release 1.8.0 to 1.8.1.
Replace the following files and directories from Google Test 1.8.1:
    LICENSE
    README.md
    include/
    src/
Note the LICENSE file is identical, where as the other files changed.

Also see commit which initially added Google Test:
    87f7170a55
    Add Google Test 1.8.0 files (#781978)
2019-01-21 16:41:31 +00:00
Mike Fleetwood c8a6866716 Remove custom main() from test_PipeCapture (!22)
After removing Glib::thread_init() from test_PipeCapture's main() all it
does is exactly what the built in Google Test main() does [1][2].  So
use that instead like the other unit test programs do.

[1] Google Test, Primer, Writing the main() Function
    https://github.com/google/googletest/blob/master/googletest/docs/primer.md#writing-the-main-function

[2] Google Test 1.8.0, gtest_main.cc::main()
    file: lib/gtest/src/gtest_main.cc
    https://github.com/google/googletest/blob/release-1.8.0/googletest/src/gtest_main.cc#L34

Closes !22 - Increase minimums to libparted 2.2 and glibmm 2.32
2019-01-21 16:41:31 +00:00
Mike Fleetwood 80d6394684 Remove deprecated Glib::thread_init() (!22)
Use of Glib::thread_init() was deprecated in glibmm 2.32 [1].  The
oldest supported distributions have these versions:
    Debian 8           glibmm 2.42.0
    RHEL / CentOS 7    glibmm 2.56.0
    SLES 12            glibmm 2.38.1
    Ubuntu 14.04 LTS   glibmm 2.39.93

Checking further the glibmm 2.32 reference manual says this about
Glib::thread_init() [2]:
    Initializes the GLib thread system.

    Deprecated:
    Calling thread_init() is no longer necessary and no longer has any
    effect.

However only some of the glibmm example programs had Glib::thread_init()
removed, others had it replaced by Glib::init() [3].  Again the glibmm
2.32 reference manual says this about Glib::init() [4]:
    Initialize glibmm.

    You may call this more than once.  You do not need to call this if
    you are using Glib::MainLoop or Gtk::Main, because they call it for
    you.

GParted does call Gtk::Main and test_PipeCapture does call
Glib::MainLoop.  Therefore just raise the minimum version to glibmm 2.32
and remove both calls to Glib::thread_init().

[1] Glibmm 2.32 NEWS file
    https://gitlab.gnome.org/GNOME/glibmm/blob/2.32.0/NEWS#L207

[2] glibmm 2.32, glibmm: Glib Namespace Reference, Glib::thread_init()
    https://developer.gnome.org/glibmm/2.32/namespaceGlib.html#ab26d01c776801f1fff00753e97af4fc7

[3] glibmm commit "Avoid use of deprecates API in tests and examples."
    3e0fbb22c0

[4] glibmm 2.32, glibmm: Glib Namespace Reference, Glib::init()
    https://developer.gnome.org/glibmm/2.32/namespaceGlib.html#ac90aee10d0b90e3d8a96a86b5394f87b

Closes !22 - Increase minimums to libparted 2.2 and glibmm 2.32
2019-01-21 16:41:31 +00:00
Mike Fleetwood 8df975c7d1 Increase minimum required libparted to 2.2 (!22)
Raise the minimum required version of GNU Parted from 1.7.1 to 2.2,
released 2010-02-16 [1][2].  The oldest supported distributions, also
with gtkmm >= 2.24, since commit [3], are:
    Debian 8           parted 3.2
    RHEL / CentOS 7    parted 3.1
    SLES 12            parted 3.1
    Ubuntu 14.04 LTS   parted 2.3

Raising the minimum required version allows removal of optional code
associated with these definitions:
*   USE_LIBPARTED_LARGE_SECTOR_SUPPORT
    Fallback code reporting ignored device with logical sector size
    other than 512 bytes.
*   ENABLE_PT_REREAD_WORKAROUND
    Fallback code re-attempting to inform the kernel of partition
    changes.

[1] GNU Parted 2.2 release announcement
    http://lists.gnu.org/archive/html/info-gnu/2010-02/msg00016.html

[2] NEWS file from GNU Parted 2.2
    http://git.savannah.gnu.org/cgit/parted.git/tree/NEWS?h=v2.2

[3] 8b42bab1ee
    modern-gtk2: Require Gtkmm version 2.24 (!17)

Closes !22 - Increase minimums to libparted 2.2 and glibmm 2.32
2019-01-21 16:41:31 +00:00