Commit 9e96159b authored by Rogier Goossens's avatar Rogier Goossens Committed by Curtis Gedak
Browse files

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
parent c9c045ed
......@@ -1116,6 +1116,32 @@
</para>
</sect3>
<!-- ============= To Change a Partition's UUID ========================== -->
<sect3 id="gparted-changing-partition-uuid">
<title>Changing a Partition UUID</title>
<para>
To change the UUID of a partition:
<orderedlist>
<listitem>
<para>
Select an unmounted partition.
See <xref linkend="gparted-select-partition"/>.
</para>
</listitem>
<listitem>
<para>
Choose:
<menuchoice><guimenu>Partition</guimenu>
<guimenuitem>New UUID</guimenuitem></menuchoice>.
The application displays the set a new random UUID
operation in the <guilabel>Operations Pending</guilabel>
pane.
</para>
</listitem>
</orderedlist>
</para>
</sect3>
<!-- ============= Specifying Partition Details ====================== -->
<sect3 id="gparted-specify-partition-details">
<title>Specifying Partition Details</title>
......@@ -1650,8 +1676,12 @@
<listitem>
<para>
Change the UUID of the partition.
See <xref linkend="gparted-changing-partition-uuid"/>.
</para>
<para>
If the partition label is not blank, change the label
of the partition.
See <xref linkend="gparted-setting-partition-label"/>.
</para>
</listitem>
<listitem>
......
......@@ -56,6 +56,7 @@ private:
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > copy ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > check ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > label ;
Gtk::TreeModelColumn< Glib::RefPtr<Gdk::Pixbuf> > uuid ;
Gtk::TreeModelColumn<Glib::ustring> software ;
treeview_filesystems_Columns()
......@@ -68,6 +69,7 @@ private:
add( copy ) ;
add( check ) ;
add( label ) ;
add( uuid ) ;
add( software ) ;
}
};
......
......@@ -38,6 +38,8 @@ public:
virtual void set_used_sectors( Partition & partition ) = 0 ;
virtual void read_label( Partition & partition ) = 0 ;
virtual bool write_label( const Partition & partition, OperationDetail & operationdetail ) = 0 ;
virtual void read_uuid( Partition & partition ) = 0 ;
virtual bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) = 0 ;
virtual bool create( const Partition & new_partition, OperationDetail & operationdetail ) = 0 ;
virtual bool resize( const Partition & partition_new,
OperationDetail & operationdetail,
......
......@@ -71,6 +71,7 @@ private:
void set_device_partitions( Device & device ) ;
GParted::FILESYSTEM get_filesystem() ;
void read_label( Partition & partition ) ;
void read_uuid( Partition & partition ) ;
void insert_unallocated( const Glib::ustring & device_path,
std::vector<Partition> & partitions,
Sector start,
......@@ -95,6 +96,8 @@ private:
bool label_partition( const Partition & partition, OperationDetail & operation_detail ) ;
bool change_uuid( const Partition & partition, OperationDetail & operation_detail ) ;
bool resize_move( const Device & device,
const Partition & partition_old,
Partition & partition_new,
......
......@@ -29,6 +29,7 @@ EXTRA_DIST = \
OperationDetail.h \
OperationFormat.h \
OperationResizeMove.h \
OperationChangeUUID.h \
OperationLabelPartition.h \
Partition.h \
Proc_Partitions_Info.h \
......
......@@ -32,7 +32,8 @@ enum OperationType {
OPERATION_RESIZE_MOVE = 3,
OPERATION_FORMAT = 4,
OPERATION_COPY = 5,
OPERATION_LABEL_PARTITION = 6
OPERATION_LABEL_PARTITION = 6,
OPERATION_CHANGE_UUID = 7
};
class Operation
......
/* Copyright (C) 2012 Rogier Goossens
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef OPERATIONCHANGEUUID_H_
#define OPERATIONCHANGEUUID_H_
#include "../include/Operation.h"
namespace GParted
{
class OperationChangeUUID : public Operation
{
public:
OperationChangeUUID( const Device & device
, const Partition & partition_orig
, const Partition & partition_new
) ;
void apply_to_visual( std::vector<Partition> & partitions ) ;
private:
void create_description() ;
} ;
} //GParted
#endif //OPERATIONCHANGEUUID_H_
......@@ -34,6 +34,8 @@
#include <ctime>
#include <vector>
#define UUID_STRING_LENGTH 36
namespace GParted
{
......@@ -106,6 +108,8 @@ struct FS
Support read ; //can we get the amount of used sectors?
Support read_label ;
Support write_label ;
Support read_uuid ;
Support write_uuid ;
Support create ;
Support grow ;
Support shrink ;
......@@ -118,7 +122,7 @@ struct FS
FS()
{
read = read_label = write_label = create = grow = shrink = move = check = copy = NONE;
read = read_label = write_label = read_uuid = write_uuid = create = grow = shrink = move = check = copy = NONE;
MIN = MAX = 0 ;
}
} ;
......@@ -163,6 +167,7 @@ public:
std::vector<Glib::ustring>& tokens,
const Glib::ustring& delimiters ) ;
static int convert_to_int(const Glib::ustring & src);
static Glib::ustring generate_uuid(void);
};
......
......@@ -105,6 +105,9 @@ private:
void allow_label_partition( bool state ) {
toggle_item( state, MENU_LABEL_PARTITION ) ; }
void allow_change_uuid( bool state ) {
toggle_item( state, MENU_CHANGE_UUID ) ; }
void allow_info( bool state ) {
toggle_item( state, MENU_INFO ) ; }
......@@ -167,6 +170,7 @@ private:
void activate_attempt_rescue_data();
void activate_manage_flags() ;
void activate_check() ;
void activate_change_uuid() ;
void activate_label_partition() ;
void activate_undo();
......@@ -235,7 +239,8 @@ private:
MENU_MOUNT,
MENU_FLAGS,
MENU_CHECK,
MENU_LABEL_PARTITION,
MENU_LABEL_PARTITION,
MENU_CHANGE_UUID,
MENU_INFO,
TOOLBAR_UNDO,
TOOLBAR_APPLY ;
......
......@@ -31,6 +31,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
......@@ -31,6 +31,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new
, OperationDetail & operationdetail
......
......@@ -32,6 +32,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
......@@ -32,6 +32,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
......@@ -31,6 +31,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
......@@ -32,6 +32,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
......@@ -32,6 +32,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
......@@ -32,6 +32,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
......@@ -32,6 +32,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
......@@ -32,6 +32,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
......@@ -32,6 +32,8 @@ public:
void set_used_sectors( Partition & partition ) ;
void read_label( Partition & partition ) ;
bool write_label( const Partition & partition, OperationDetail & operationdetail ) ;
void read_uuid( Partition & partition ) ;
bool write_uuid( const Partition & partition, OperationDetail & operationdetail ) ;
bool create( const Partition & new_partition, OperationDetail & operationdetail ) ;
bool resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition = false ) ;
bool move( const Partition & partition_new
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment