Commit Graph

264 Commits

Author SHA1 Message Date
Mike Fleetwood 5b53c12f6e Select largest unallocated partition by default (#667365)
After a refresh, instead of having no partition selected, default to the
largest unallocated partition.  This allows immediate creation of a new
partition in the unallocated space.

Bug 667365 - Free space should be selected by default
2013-03-17 11:06:10 -06:00
Mike Fleetwood 92f4947618 Revert "Select unallocated partition by default (#667365)"
This reverts commit 3dd769d955.

It didn't consider unallocated partitions within extended partitions
when looking for the largest one to select.
2013-03-17 11:06:10 -06:00
Phillip Susi 2a2d21c231 Bind ctrl-enter to apply-operations
Bind the keyboard accelerator key ctrl-enter to apply operations.
2013-03-11 18:40:31 -06:00
Phillip Susi 3dd769d955 Select unallocated partition by default (#667365)
After a refresh, instead of having no partition selected, default to the
largest unallocated partition.  This allows immediate creation of a new
partition in the unallocated space.

Closes Bug 667365 - Free space should be selected by default
2013-03-11 18:40:31 -06:00
Phillip Susi 9ad53d94a0 Bind Insert key to new partition
Add an accelerator key for Insert to trigger the new partition menu item.
2013-03-11 18:40:31 -06:00
Phillip Susi 52a2a9b00a Reduce threading (#685740)
Win_Gparted and Dialog_Progress were creating threads to perform most
functions in the background.  Most of the time, the only reason the
threads blocked was to execute an external command.  The external command
execution has been changed to spawn the command asynchronously and wait
for completion with a nested main loop.  While waiting for completion,
the pipe output is captured via events.  In the future, this will allow
for it to be parsed in real time to obtain progress information.

Those tasks in GParted_Core that still block now spawn a background thread
and wait for it to complete with a nested main loop to avoid hanging the
gui.

Part of Bug #685740 - Refactor to use asynchronous command execution
2013-03-11 18:40:31 -06:00
Phillip Susi 124342e979 Use a full fledged nested main loop while waiting and pulsing progress bars (#685740)
Win_Gparted and Dialog_Progress were looping on Gtk::Main::events_pending()
and iteration() with usleeps in between.  Use a full mainloop instead and
a proper timeout to trigger pulsebar updates instead of usleeps.

Part of Bug 685740 - Refactor to use asynchronous command execution
2013-03-11 18:40:31 -06:00
Phillip Susi f5a5c9cdb9 Remove gdk_threads_enter/exit (#685740)
Use of these functions is depreciated and making gtk calls in a background
thread still sometimes causes deadlocks or crashes.  Change ped exception
handler to instead use an idle function to force the main thread to display
the dialog box.

Part of Bug 685740 - Refactor to use asynchronous command execution
2013-03-11 18:40:31 -06:00
Curtis Gedak a0e0f1c5d9 Update copyright year 2013-02-21 10:43:14 -07:00
Curtis Gedak 81682eaf29 Provide credit in About dialog for contributions
Recognize contributions by Sinlu Bes.
2013-01-02 11:53:50 -07:00
Curtis Gedak c17959e200 Provide credit in About dialog for contributions
Recognize contributions by Matthias Gehre.
2012-11-30 13:32:31 -07:00
Mike Fleetwood 686ec8f713 Make GParted recognise reading blank file system labels (#685656)
GParted doesn't notice when a file system label is changed to blank.
GParted first calls the file system specific read_label() method.  When
the label is blank read_label() correctly sets partition.label to the
zero length string.  Second GParted_Core::set_device_partitions() treats
the zero length string to mean that the label is unset and calls
FS_Info::get_label() to retrieve it from the cache of blkid output.
Blkid also doesn't notice when the file system label has been changed to
blank so reports the previous label.  Hence GParted displays the
previous file system label.

Fix by making label a private member variable of the class Partition and
providing access methods set_label(), get_label() and label_known()
which track whether the label has been set or not.  This only fixes the
fault for file systems which use file system specific commands to read
the label and when these tools are installed.  Otherwise GParted uses,
or has to fall back on using, the buggy blkid command to read the file
system label.

NOTE:
Many of the file system specific read_label() methods use a tool which
outputs more than just the label and use Utils::regexp_label() to match
leading text and the label itself.  If the surrounding text changes or
disappears altogether to indicated a blank label, regexp_label() doesn't
match anything and returns the zero length string.  This  is exactly
what is required and is passed to set_label() to set the label to blank.

Bug 685656 - GParted doesn't notice when file system label is changed to
             blank
2012-11-04 12:26:09 +00:00
Mike Fleetwood fbc4e9e941 Remove full stops from the end of primary text in dialogs
The GNOME HIG, 3.4.1 "Alert Text" states:

    ...  The primary text is punctuated in 'newspaper headline' style,
    that is, it has no terminating period, but it may have a terminating
    question mark.

http://developer.gnome.org/hig-book/3.0/windows-alert.html.en#alert-text
2012-08-30 13:47:46 -06:00
Mike Fleetwood 85e9ce3428 Remove outdated FIXME comment from active_partitions_on_device_count()
Active LVM2 PVs have the partition class busy member set in
GParted_Core::set_device_partitions() just as mounted file systems do.
This is a basic requirement for GParted so that it only manipulates
partitions and contained file systems when they are not in use.
2012-08-30 13:47:46 -06:00
Mike Fleetwood ca3d40d9c7 Rename *toggle_swap_mount* -> *toggle_busy*
Rename functions and a variable to use a generic term for the menu item
which changes the busy state of partitions now that it also activates
and deactivates LVM2 Physical Volumes as well as mounting and unmounting
file systems and enables and disables swap partitions.
2012-08-30 13:47:45 -06:00
Mike Fleetwood 590f1377f9 Add fallback implementation to new delete LVM2 PV warning dialog (#670171)
The new delete non-empty LVM2 Physical Volume warning dialog uses
Gtk::MessageDialog::get_message_area() in the display of Volume Group
members.  This function was new in gtkmm 2.22, released September 2010,
which is not available in a number of current distributions including:
Unbuntu 10.04 LTS, RHEL 6.3, SLES 11-SP2, Debian 6.0.

Implement fallback method to display the VG name and member PVs in the
warning dialog for when get_message_area() is not available.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 69c8acce75 Add warning dialog when deleting non-empty LVM2 PVs (#670171)
When attempting to delete a non-empty LVM2 Physical Volume (one which is
still a member of a Volume Group) display a warning dialog which
includes the VG name and a list of the PV members to allow the user to
make an informed choice whether to go ahead and perform the deletion or
cancel to the operation.  This dialog is displayed when a partition
containing a PV is being deleted or being overwritten by being
reformatted or pasted into.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 619bda5d8b Enable LVM2 VG activation / deactivation (#670171)
In the Partition menu enable activation / deactivation of the LVM2
Volume Group of which the Physical Volume is a member.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood c3ab62591b Add creation of LVM2 PVs (#670171)
Add creation of Physical Volumes specifying LVM2 metatdata format:
    lvm pvcreate -M 2 /dev/DEVICE

Also set the partition type to identify its contents as LVM.  Note that
libparted treats every partition type as a file system except LVM which
it treats as a flag, hence GParted displaying "lvm" in the Manage Flags
dialog.  Never the less libparted set the partition types correctly.
For MBR partitioning the type is 8e "Linux LVM" and for GPT partitioning
the type is E6D6D379-F507-44C2-A23C-238F2A3DF928.  Setting the partition
type as LVM is not strictly required as LVM2 scans the contents of all
partitions looking for PVs, but it is best practice.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Curtis Gedak 9591b2de08 Provide credit in About dialog for significant contributions (#678486)
Closes Bug #678486 - Provide Credit in About Dialog for Significant
                     Contributions
2012-06-30 11:27:25 -06:00
Curtis Gedak d631c93607 Update credits in about dialog for artwork
Provide credit for the Tango themed icons designed by Sebastian Kraft.
2012-06-21 14:52:04 -06:00
Mike Fleetwood 7ebedc4bb3 Don't show intrinsic unallocated space (#499202)
Most file systems report intrinsic unallocated space using the statvfs()
system call when mounted, but not using their own tools.  They are:
ext2/3/4, fat16/32, hfs, nilfs2, reiserfs and xfs.  Showing either a
little or no unallocated space, depending on whether a file system is
mounted or not, could be confusing to the user.

When all file systems are created filling their partitions the unused
figure reported by statvfs() and their own tools are the same or very
close.  Also the used plus unallocated figure from statvfs() agrees with
the used figure from their own tools.

For all file systems don't display intrinsic unallocated space (that
below the threshold of 2 to 5%), instead include it as used space.  As
soon as the amount of unallocated space becomes significant display it
everywhere and also trigger the warning.

For display purposes always use the new Partition methods:
get_sectors_used(), get_sectors_unused(), and get_sectors_unallocated().
When calculating new usage figures during Paste and Resize/Move
operations directly access sectors_used, sectors_unused and
sectors_unallocated members.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 12:41:59 -06:00
Mike Fleetwood 04f5250644 Set unallocated space when performing simple operations (#499202)
When pasting a copied partition into an existing partition set its space
utilisation so that any unallocated space is displayed correctly before
the operation is applied.  If the destination partition is larger the
file system will be grown to fill the partition.

NOTE:
GParted will attempt to grow the the file system in this situation
regardless of whether the file system supports it or not.  These file
systems: exfat, hfs, hfs+, reiser4 and ufs can't be grown and will fail
with "growing is not available for this file system".  The preview will
also be wrong in this case for the same reason.  Everything will be
depicted correctly after the refresh.

When formatting an existing partition default its space utilisation to
unknown for display before the operation is applied.

Bug 499202 - gparted does not see the difference if partition size
             differs from filesystem size
2012-06-18 10:24:28 -06:00
Rogier Goossens a5242a28f4 Fix for FS flags becoming unknown after change label
AFAICS, there is no reason to manually copy all partition fields,
or to manually initialize the copy of the new partition object.
So now the partition object is simply copied using assignment.
2012-04-02 10:21:12 -06:00
Rogier Goossens ea26fcb4fa Fix for FS size & flags becoming unknown after change UUID
AFAICS, there is no reason to manually copy all partition fields,
or to manually initialize the copy of the new partition object.
So now the partition object is simply copied using assignment.
2012-04-02 10:21:12 -06:00
Mike Fleetwood ea4b77eb01 Fix uninitialised read when pasting into an existing partition
GParted_Core::set_device_partitions() creates and initialises the
partition objects based on the partitions on the disk using
partition.Reset() and partition.Set().  These methods never set the
alignment attribute.

Copy and pasting into an existing partition calls GParted_Core::
snap_to_alignment() to adjust the start and end of the newly created
in memory partition object.  When pasting into unallocated space the
user has selected the required alignment and this is exactly what is
needed.  However when pasting into an existing partition the in memory
partition object should always match the actual partition boundaries on
disk.  Unfortunately the partition boundaries are adjusted based on
reading the uninitialised alignment attribute.

Initialise the alignment attribute of newly created partition objects to
ALIGN_STRICT.  Also, when pasting into an existing partition set the
alignment of that partition object to ALIGN_STRICT so that no boundary
adjustment is performed.

valgrind:
==6845== Conditional jump or move depends on uninitialised value(s)
==6845==    at 0x80C779A: GParted::GParted_Core::snap_to_alignment(...) (GParted_Core.cc:566)
==6845==    by 0x810C115: GParted::Win_GParted::Add_Operation(...) (Win_GParted.cc:692)
==6845==    by 0x8110499: GParted::Win_GParted::activate_paste() (Win_GParted.cc:1649)
...
==6845== Conditional jump or move depends on uninitialised value(s)
==6845==    at 0x80C77A8: GParted::GParted_Core::snap_to_alignment(...) (GParted_Core.cc:568)
==6845==    by 0x810C115: GParted::Win_GParted::Add_Operation(...) (Win_GParted.cc:692)
==6845==    by 0x8110499: GParted::Win_GParted::activate_paste() (Win_GParted.cc:1649)

GParted_Core.cc:
   562  bool GParted_Core::snap_to_alignment( const Device & device, Partition & partition, Glib::ustring & error )
   563  {
   564          bool rc = true ;
   565
>> 566          if ( partition .alignment == ALIGN_CYLINDER )
   567                  rc = snap_to_cylinder( device, partition, error ) ;
>> 568          else if ( partition .alignment == ALIGN_MEBIBYTE )
   569                  rc = snap_to_mebibyte( device, partition, error ) ;
   570

Closes Bug #672654 - Pasting into an existing partition may shrink
                     GParted's representation of it
2012-03-24 10:53:00 -06:00
Curtis Gedak 57762cb610 Make all move warning strings translatable 2012-03-19 10:58:39 -06:00
Rogier Goossens 4108daf15f Implement changing UUID for NTFS (#667278)
Part 4 of 4 to provide new UUID support for NTFS.

Closes Bug #667278 - Add support for setting UUID
2012-02-10 10:33:13 -07:00
Rogier Goossens 170a79b3a0 Use custom text functions for mount/unmount and swapon/swapoff texts
Part 3 of 4 to provide new UUID support for NTFS.

See Bug #667278 - Add support for setting UUID
2012-02-10 10:33:12 -07:00
Mike Fleetwood aa085a3caa Display busy status of LVM2 PVs (#160787)
A Volume Group is active when any of its Logical Volume mappings are
loaded (and enabled) in the Kernel's device-mapper driver.  Therefore
all the Physical Volumes in the VG (must be considered) active too.
This is exactly equivalent to a mounted file system, as the kernel is
actively using the partition.  Mark active LVM2 PVs as busy in GParted.

Don't use statvfs() for determining sector usage of busy LVM2 PVs as it
will fail with "statvfs(VGNAME): No such file or directory".  Instead
always use the LVM2 PV specific method.

Display the status of the LVM2 PV in the Information dialog using one of
the following relevant messages:
    Not active (Not part of any volume group)
    VGNAME not active
    VGNAME active
(The code uses the VGNAME stored in the partition's first mount point,
as displayed in the "Mount Point" column, rather than going back to the
primary source of the information in the LVM2_PV_Info class).

Temporarily prevent GParted from offering to unmount LVM2 PVs until
activating and deactivating Volume Groups is implemented later.

Bug #160787 - lvm support
2012-02-02 10:24:31 -07:00
Mike Fleetwood 8083f11d84 Display LVM2 VGNAME as the PV's mount point (#160787)
As the Mount Point column is being borrowed to display the PV's VGNAME,
also suppress generation of the "Mount on" submenu for LVM2 PVs.

Bug #160787 - lvm support
2012-02-02 10:24:31 -07:00
Mike Fleetwood 391e5e12f9 Rename FS_LVM2 -> FS_LVM2_PV (#160787)
This is the first step of adding support for just LVM2 Phyiscal Volumes,
a subset of full LVM2 support.

Make it clear that it is only LVM2 PVs being treated like a file system.

Bug #160787 - lvm support
2012-01-31 10:26:51 -07:00
Curtis Gedak 9c2b57cb50 Update copyright year 2012-01-25 16:55:51 -07:00
Curtis Gedak c814b25a3a Avoid warning display when moving start of extended partition
Moving the start sector of an extended partition should not adversely
affect booting an operating system because an extended partition is
only a container for logical partitions.
2012-01-24 11:23:05 -07:00
Rogier Goossens 9e96159bb2 Add support for setting UUID (#667278)
Add the ability to set a new random UUID on file systems that provide
the appropriate tools to perform this action.

Update the help manual to include this new functionality.  Also add
reference links to "setting a partition label" and "changing a
partition UUID" in the "copying and pasting a partition" section.

This patch does not include setting the UUID on an NTFS file system.

Bug #667278 - Add support for setting UUID

Bug #608308 - fix documentation - Copying and Pasting a Partition
2012-01-23 12:32:27 -07:00
Curtis Gedak 7c5b5edaef Reduce graphic processing requirement for pulse bar
Increase sleep time to decrease pulse bar update frequency.

Debian Bug 499193 - gparted: 100% cpu usage

Debian Bug 519764 - gparted: Lots of animation makes use over SSH
                    X-tunnel slow
2012-01-11 13:13:43 -07:00
Phillip Susi a1f843e74a Display pop up dialog on libparted exceptions
We used to just log libparted exceptions without handling them.  This patch
changes the exception handler to display a modal dialog box and return the
chosen action to libparted.
2012-01-08 13:03:20 -07:00
Jérôme Dumesnil 03cdaed946 Improve Merge_Operations method parameters and checks 2011-10-13 11:26:16 -06:00
Jérôme Dumesnil b10349ae37 Merge overlapping operations (#438573)
When a new operation is added to operations list, check if a merge
is possible depending on the operation type:

    OPERATION_RESIZE_MOVE:  2 consecutive "resize" operations on the
                            same  partition
OPERATION_LABEL_PARTITION:  2 "label change" operations (need not be
                            consecutive) on the same partition
          OPERATION_CHECK:  2 "check" operations (need not be
                            consecutive) on the same partition
         OPERATION_FORMAT:  2 consecutive "format" operations on the
                            same partition

Closes Bug #438573 - Cancel out overlapping actions

Also fix a bug when copying partition using the Partition::Set(...)
method.  This method did not initialize "sectors_used" and
"sectors_unused" members.
2011-10-05 15:08:44 -06:00
Curtis Gedak 55b71a77bc Fix unused parameter compiler warning
Removed unused parameter.  Prior to this change the compiler would
complain with the following message:

error: unused parameter ‘cylinder_size’
2011-07-18 13:31:54 -06:00
Joan Lledó ef37bdb7de Added support to lost data recovery using gpart 2011-01-29 14:58:02 -07:00
Curtis Gedak ec876448b4 Prevent visual disk display area from disappearing
Added a display refresh to the event queue to address this
problem.

Previously, the display area of the visual disk seemed to
disappear when enough operations had been added to the queue so
that a scrollbar was required (about 4 operations).

If the three lines in HBoxOperations::load_operations method for
"//make scrollwindow focus on the last operation in the list"
were commented out then this also prevented the problem from
occurring.

Interestingly, if I changed the "set_cursor" method to
a "scroll_to_row" method, then this problem does not occur for an
additional 2 operations (about 6 operations total).

Ubuntu launchpad bug 583746 - Partition graph disappears after a
                              swap partition has been deleted
https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/583746
2011-01-19 15:34:00 -07:00
Curtis Gedak 6395970e6b Increase robustness of help manual launch
Add direct invocation of yelp if normal open help manual methods
fail.
2011-01-17 09:28:09 -07:00
Curtis Gedak 340d506c04 Update copyright year 2011-01-16 10:45:25 -07:00
Curtis Gedak b0e36132b0 Make btrfs support a normal part of gparted
Remove need to configure with the --enable-btrfs option in order
to include btrfs support in gparted.
2010-10-18 15:28:40 -06:00
Curtis Gedak 1cdb40e70d Rearrange text for warning when moving a partition 2010-10-13 09:07:53 -06:00
Curtis Gedak d7e1f295a9 Update to support plural forms for string for translators
Closes bug #631684 - Needed Translator Comments
2010-10-13 09:07:53 -06:00
Curtis Gedak 08c78ba19d Add translator comments requested in bug #631684 2010-10-12 18:14:30 -06:00
Curtis Gedak c165544506 Update URLs to new official web site gparted.org 2010-10-12 11:35:26 -06:00
Luca Bruno 5765eb870c Use Btrfs handlers, if enabled at configure time
GParted already has basic support only to recognize Btrfs volumes; if
configured, use our newer methods to handle them.
Also, put in place interface controls for all supported generic actions.
2010-10-03 17:00:53 +02:00