1. 11 Jun, 2019 3 commits
    • Mike Fleetwood's avatar
      Add missing Device.h include into GParted_Core and Win_GParted · 1d8cbd01
      Mike Fleetwood authored
      The files GParted_Core.h, GParted_Core.cc and Win_GParted.cc all use the
      Device type but don't include Device.h for it's definition.  Include it.
    • Mike Fleetwood's avatar
      Pass the current device down to Dialog_Base_Partition class (#48) · 3222c8dd
      Mike Fleetwood authored
      The current device has to be passed to the dialog constructors and then
      on to the Dialog_Base_Constructor.  Note that the Dialog_Partition_New
      constructor is already passed the current device, however it still needs
      to pass it on to Dialog_Base_Constructor.
      This is ready so that snap_to_*() methods can access the current device
      when they are called from within these dialogs.
      * Pass Parameter to Base Class Constructor while creating Derived class
      Closes #48 - Error when moving locked LUKS-encrypted partition
    • Mike Fleetwood's avatar
      Separate partition alignment from validation (#48) · 406beaae
      Mike Fleetwood authored
      A user had 2 adjacent partitions which were aligned to multiples of
      33553920 bytes (32 MiB - 512 bytes), not MiB or cylinders.  As far as
      GParted is concerned this is not aligned.  The second partition
      contained closed LUKS encrypted data.  Recreate this setup with:
          # truncate -s 200G /tmp/disk.img
          # losetup -f --show /tmp/disk.img
          # sfdisk -u S /dev/loop0 << EOF
          65535 2162655 83
          2228190 78904140 83
          # partprobe /dev/loop0
          # echo -n badpassword | cryptsetup luksFormat /dev/loop0p2 -
      When trying to move the second LUKS encrypted partition to the right by
      any amount, with the default MiB alignment, GParted displays this error
      dialog and fails to even queue the operation:
          Could not add this operation to the list
          A partition with used sectors (78907392) greater than its
          length (78905344) is not valid
          [                       OK                               ]
      Overview of the steps involved:
      1. The Resize/Move dialog composed a new partition to start a whole
         multiple of MiB after the end of the previous non-aligned partition.
         The new partition also had it's size increased to a whole multiple of
         MiB, to 78907392 sectors (38529 MiB) which was 1.59 MiB larger than
         before.  Neither the start or end of the new partition are aligned at
         this point.
      2. Win_GParted::activate_resize() applied the change back to the closed
         LUKS partition object, additionally making the used sectors equal to
         the partition size.
         (To match the fact that when opened the LUKS mapping it will
         automatically fill the new larger partition size).
      3. GParted_Core::snap_to_mebibyte() then aligned the partition start and
         end to whole MiB boundaries, reducing the partition size in the
         process to 78905344 (38528 MiB).
      4. GParted_Core::snap_to_alignment() reported the error saying that it
         couldn't add the operation to the list because it was invalid to have
         the file system used sectors larger than the partition size.
      Fix this by having the snap to alignment adjustments applied before the
      dialogs update any associated file system usage.  Specifically the
      Resize/Move, Paste (into new) and Create New dialogs as these are the
      only ones which either create or modify partition boundaries.
      Validation done by snap_to_alignment() will continue to occur at the
      current point when the operation is added to the list.
      snap_to_alignment() is doing two different jobs, it is (1) optionally
      adjusting the new partition boundaries for MiB or Cylinder alignment;
      and (2) checking that the partition boundaries and file system usage are
      Split those into two different functions (1) snap_to_alignment() and
      (2) valid_partition().  For now valid_partition() still calls
      snap_to_alignment() so there is no functional change with this commit.
      Closes #48 - Error when moving locked LUKS-encrypted partition
  2. 29 May, 2019 1 commit
  3. 13 May, 2019 1 commit
    • Luca Bacci's avatar
      Request natural width in Gtk::ScrolledWindows for Gtk >= 3.22 (!39) · eeffd505
      Luca Bacci authored
      Before Gtk 3.22 GtkScrolledWindow propagated natural size to its
      Children and so on to descendants.  In Gtk 3.22 this was changed to
      always request the minimum size.  This was done because it is believed
      to be a safer default (gives a better behaviour) in case of dynamic
      content inside the scrolled window, that is, content that may change
      allocated size. [1][2][3]
      When the scrolled window content is not dynamic the natural size is
      preferable because it gives a better looking layout and without any
      In the case of GParted content which is not dynamic, so request the
      scrolled windows to allocate children at natural sizes for Gtk >= 3.22.
      The benefits of natural size allocation are evident in presence of
      wrapping labels (for example inside the "Partition Info" dialog), that
      with the minimum size request likely end up taking a very small width.
      [1] Gtk commit from 2016-08-31:
          GtkScrolledWindow: Make propagation of natural child sizes optional
          "Making propagation of child natural sizes mandatory (or default,
          even) was evidently a mistake as this causes dynamic content in a
          scrolled window to resize it's parent when the scrolled window is
          competing for space with an adjacent widget."
      [2] Gtk 3.22 Reference Documentation -
      [3] Gtkmm 3.24 Gtk::ScrolledWindow Class Reference,
          set_propagate_natural_width() method
      [4] Gtkmm 3.21.6 NEWS
          "ScrolledWindow: Added get/set_propagate_natural_height/width() and
          the properties."
      Closes !39 - Always request natural size inside Gtk::ScrolledWindow
  4. 27 Apr, 2019 5 commits
    • Luca Bacci's avatar
      Use Gtk::Grid for Win_GParted pt2 (!25) · d57d79b1
      Luca Bacci authored
      Gtk::Table was deprecated in Gtk 3.4.0.  Replace with Gtk::Grid.
      This commit makes the change for Win_GParted / pt2.
      Closes !25 - Modern Gtk3 - part 1
    • Luca Bacci's avatar
      Use Gtk::Grid for Win_GParted pt1 (!25) · 6e07fb05
      Luca Bacci authored
      Gtk::Table was deprecated in Gtk 3.4.0.  Replace with Gtk::Grid.
      This commit makes the change for Win_GParted / pt1.
      Closes !25 - Modern Gtk3 - part 1
    • Luca Bacci's avatar
      Use Gtk::Separator (!25) · 1bee0ddf
      Luca Bacci authored
      Gtk::HSeparator was deprecated in Gtkmm 3.2.  Replace with plain
      Closes !25 - Modern Gtk3 - part 1
    • Luca Bacci's avatar
      Use Gtk::Paned (!25) · 667af24c
      Luca Bacci authored
      Gtk::HPaned and Gtk::VPaned were deprecated in Gtkmm 3.2.  Replace with
      plain Gtk::Paned.
      Closes !25 - Modern Gtk3 - part 1
    • Luca Bacci's avatar
      Use Gtk::Box for Win_GParted (!25) · c02c3ee4
      Luca Bacci authored
      Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2 [1].  Replace with
      plain Gtk::Box.
      This commit makes the change for Win_GParted.{h,cc}.
      [1] Gtkmm 3.2.0 NEWS file (actually first included in gtkmm 3.1.6
              * All H* or V* specialized classes have been deprecated, to
                match the deprecations in the GTK+ C API.  You should now
                set the orientation instead.
                This includes HBox, VBox, HButtonBox, VButtonBox, HPaned,
                VPaned, HScale, VScale, HSeparator, VSeparator, HScrollbar and
      Closes !25 - Modern Gtk3 - part 1
  5. 22 Apr, 2019 2 commits
    • Mike Fleetwood's avatar
      Fix available Partition menu options not being updated on rescan (!38) · 4939b941
      Mike Fleetwood authored
      Select a partition and look at the available actions in the Partition
      menu.  Then add or remove some commands which that particular file
      system uses and rescan to detect those changes.  Open the Partition menu
      again.  It doesn't reflect the changes of supported actions seen in the
      File System Support dialog.  Select a different partition and then
      select the original partition again.  Now the available actions in the
      Partition menu reflect the changes of supported actions.
      Have been testing by adding and removing /sbin/e2label to add and
      remove EXT2/3/4 file system labelling support just because that feature
      has existed for a very long time and EXT2/3/4 are displayed near the top
      of the File System Support dialog.  Tested this minor issue existed as
      far back as GParted 0.3.7.
      Fix by simply also refreshing the valid operations to update the
      Partition menu after updating the found file system specific commands.
      Closes !38 - Fixes for minor issues with File System Support rescanning
    • Mike Fleetwood's avatar
      Fix File System Support dialog not showing changes after rescan (!38) · 7ea91bca
      Mike Fleetwood authored
      Open the File System Support dialog, either add or remove some file
      system specific commands used by GParted and press the
      [Rescan For Supported Actions] button.  The supported actions don't
      change.  However after just closing and reopening the dialog, the
      supported actions do reflect the added or removed file system specific
      Bisected to this commit:
          Display "other" in the File System Support dialog (!13)
      The problem is that commit made a subset copy of the
      GParted_Core::FILESYSTEMS vector, obtained from get_filesystems(), so
      when the rescan ran and the FILESYSTEMS vector was updated with new
      supported actions, the dialog still displayed the original subset copy,
      so didn't reflect the changed supported actions.
      Fix by passing a reference to the GParted_Core::FILESYSTEMS vector,
      obtained from get_filesystems(), and perform the necessary filtering
      inside the dialog, like before the above faulty commit.  Additionally
      finding and adding "other" file system to the end of the list.
      Closes !38 - Fixes for minor issues with File System Support rescanning
  6. 11 Apr, 2019 1 commit
    • Mike Fleetwood's avatar
      Write starting device overview information to saved details (#639176) · edb3afac
      Mike Fleetwood authored
      Writes the starting device overview information of all known devices to
      the top of the saved details HTML.  This is so that hopefully we don't
      need to additionally ask users for their disk layouts via 'fdisk -l',
      'parted print' and 'lsblk' when the saved details file is provided.
      Also moves the equals separators "==================" from below to
      above each operation so the each section is separated.
      Bug 639176 - Save partition layout to gparted_details.htm
  7. 06 Apr, 2019 1 commit
    • Luca Bacci's avatar
      Ensure icon sizes (#39) · f252e677
      Luca Bacci authored
      Some icon themes only provide large icons for stock items.  This can
      cause problems like overly large icons appearing in the GParted UI.
      Found on Kubuntu 16.04 LTS with default breeze icon theme.
      Be compatible with these icon themes by forcing scaling of stock icons
      to the requested size.
      Icons are used either by Gtk::Image widgets, or Gtk::CellRendererPixbuf
      objects for comboboxes/treeviews.  For Gtk::Image widgets we add
      Utils::mk_image() that constructs Gtk::Image widgets and then sets the
      pixel-size property.  For Gtk::CellRendererPixbuf we add
      Utils::mk_pixbuf() that first loads a Gdk::Pixbuf and then scales if
      Closes #39 - After GTK3 port icons are too big on KDE
  8. 03 Apr, 2019 1 commit
  9. 27 Mar, 2019 1 commit
  10. 26 Mar, 2019 1 commit
  11. 23 Mar, 2019 1 commit
    • Mike Fleetwood's avatar
      Go back to symbolic label widget alignment constants · 45fd146f
      Mike Fleetwood authored
      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:
      *   6efa6234
          Add optional yalign argument to Utils::mk_label() method
      *   be2689ad
          Stop using deprecated widget alignment enumerators (#652044)
  12. 01 Mar, 2019 4 commits
    • Mike Fleetwood's avatar
      Initialise local POD 'launched' variable in show_help() · 8effaf4f
      Mike Fleetwood authored
      '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.
    • Mike Fleetwood's avatar
      Rename Win_GParted method to show_help() · f5e870d6
      Mike Fleetwood authored
      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.
    • Mike Fleetwood's avatar
      Restore specific error message on failure to launch yelp · e3ae8a6f
      Mike Fleetwood authored
      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] 2953778a
          port-to-gtk3: Use Gdk::AppLaunchContext to launch yelp (#7)
    • Mike Fleetwood's avatar
      Launch help from GParted using the new GNOME 3 help: prefix (!24) · 5aca85e4
      Mike Fleetwood authored
      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
  13. 20 Feb, 2019 1 commit
    • Mike Fleetwood's avatar
      Enable online resizing of extended partitions (!23) · 24d9599f
      Mike Fleetwood authored
      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.
      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
      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  |................|
      Closes !23 - Enable online resizing of extended partitions
  14. 11 Feb, 2019 11 commits
  15. 12 Nov, 2018 5 commits
  16. 20 Sep, 2018 1 commit
    • Mike Fleetwood's avatar
      Prevent online resizing of file systems mounted read-only (#10) · f8512506
      Mike Fleetwood authored
      Resizing a file system mounted read-only fails.  Example:
          # mkfs.btrfs /dev/sdb1
          # mount -o ro /dev/sdb1 /mnt/1
      In GParted try to resize partition sdb1.  The operation fails like this:
          Grow /dev/sdb1 from 512.00 MiB to 1.00 GiB                 (ERROR)
          * calibrate /dev/sdb1                                      (SUCCESS)
          * grow partition from 512.00 MiB to 1.00 GiB               (SUCCESS)
          * grow filesystem to fill the partition                    (ERROR)
            * btrfs filesystem resize 1:max '/mnt/1'                 (ERROR)
                Resize '/mnt/1' of '1:max'
                ERROR: unable to resize '/mnt/1': Read-only file system
      See GitLab issue for the testing results of attempting to online resize
      all supporting file system while mounted read-only.  No file system
      allows online resizing while mounted read-only, except for reiserfs.
          Issue #10 - Gparted fails to resize btrfs partition that is mounted
      Fix by preventing online resizing of *all* file systems mounted
      read-only, including reiserfs.  Instead of displaying the resize dialog
      in this case, display an information dialog explaining why the partition
      can't be resized.  This is similar to what happens when attempting to
      create a new partition on a disk without a partition table.  The new
      dialog looks like:
          (!) Unable to resize read-only file system /dev/sdb1
              The file system can not be resized while it is mounted read-only.
              Either unmount the file system or remount it read-write.
                                                                         [ OK ]
      Closes #10 - Gparted fails to resize btrfs partition that is mounted