rewrote quite some stuff to use an enum to indentify filesystems instead
* rewrote quite some stuff to use an enum to indentify filesystems instead of stringcomparisons.
This commit is contained in:
parent
94072f4b3e
commit
7e4efd3c2e
|
@ -1,3 +1,8 @@
|
||||||
|
2005-12-07 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
|
* rewrote quite some stuff to use an enum to indentify filesystems
|
||||||
|
instead of stringcomparisons.
|
||||||
|
|
||||||
2005-11-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
2005-11-29 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
* src/jfs.cc: fixed 'broken pipe' warning
|
* src/jfs.cc: fixed 'broken pipe' warning
|
||||||
* src/fat16.cc,
|
* src/fat16.cc,
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef FILESYSTEM
|
#ifndef DEFINE_FILESYSTEM
|
||||||
#define FILESYSTEM
|
#define DEFINE_FILESYSTEM
|
||||||
|
|
||||||
#include "../include/Partition.h"
|
#include "../include/Partition.h"
|
||||||
|
|
||||||
|
@ -59,4 +59,4 @@ private:
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
||||||
#endif //FILESYSTEM
|
#endif //DEFINE_FILESYSTEM
|
||||||
|
|
|
@ -60,12 +60,12 @@ public:
|
||||||
bool Set_Disklabel( const Glib::ustring & device_path, const Glib::ustring & disklabel ) ;
|
bool Set_Disklabel( const Glib::ustring & device_path, const Glib::ustring & disklabel ) ;
|
||||||
|
|
||||||
const std::vector<FS> & get_filesystems( ) const ;
|
const std::vector<FS> & get_filesystems( ) const ;
|
||||||
const FS & get_fs( const Glib::ustring & filesystem ) const ;
|
const FS & get_fs( GParted::FILESYSTEM filesystem ) const ;
|
||||||
Glib::RefPtr<Gtk::TextBuffer> get_textbuffer( ) ;
|
Glib::RefPtr<Gtk::TextBuffer> get_textbuffer( ) ;
|
||||||
std::vector<Glib::ustring> get_disklabeltypes( ) ;
|
std::vector<Glib::ustring> get_disklabeltypes( ) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Glib::ustring Get_Filesystem( ) ; //temporary function.. asa new checks ripple through in libparted i'll remove it.
|
GParted::FILESYSTEM Get_Filesystem( ) ; //temporary function.. asa new checks ripple through in libparted i'll remove it.
|
||||||
void set_device_partitions( Device & device ) ;
|
void set_device_partitions( Device & device ) ;
|
||||||
void Insert_Unallocated( std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended ) ;
|
void Insert_Unallocated( std::vector<Partition> & partitions, Sector start, Sector end, bool inside_extended ) ;
|
||||||
Glib::ustring get_sym_path( const Glib::ustring & real_path ) ;
|
Glib::ustring get_sym_path( const Glib::ustring & real_path ) ;
|
||||||
|
@ -77,7 +77,7 @@ private:
|
||||||
bool Resize_Normal_Using_Libparted( const Glib::ustring & device_path, const Partition & partition_old, const Partition & partition_new ) ;
|
bool Resize_Normal_Using_Libparted( const Glib::ustring & device_path, const Partition & partition_old, const Partition & partition_new ) ;
|
||||||
|
|
||||||
void Show_Error( Glib::ustring message ) ;
|
void Show_Error( Glib::ustring message ) ;
|
||||||
void set_proper_filesystem( const Glib::ustring & filesystem ) ;
|
void set_proper_filesystem( const FILESYSTEM & filesystem ) ;
|
||||||
bool set_partition_type( const Glib::ustring & device_path, const Partition & partition ) ;
|
bool set_partition_type( const Glib::ustring & device_path, const Partition & partition ) ;
|
||||||
bool wait_for_node( const Glib::ustring & node ) ;
|
bool wait_for_node( const Glib::ustring & node ) ;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#define PARTITION
|
#define PARTITION
|
||||||
|
|
||||||
#include "../include/Utils.h"
|
#include "../include/Utils.h"
|
||||||
#include "../include/i18n.h"
|
|
||||||
|
|
||||||
#include <gdkmm/colormap.h>
|
#include <gdkmm/colormap.h>
|
||||||
|
|
||||||
|
@ -34,11 +33,12 @@
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
enum PartitionType {
|
enum PartitionType {
|
||||||
PRIMARY = 0,
|
TYPE_PRIMARY = 0,
|
||||||
LOGICAL = 1,
|
TYPE_LOGICAL = 1,
|
||||||
EXTENDED = 2,
|
TYPE_EXTENDED = 2,
|
||||||
UNALLOCATED = 3
|
TYPE_UNALLOCATED = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PartitionStatus {
|
enum PartitionStatus {
|
||||||
|
@ -60,7 +60,7 @@ public:
|
||||||
void Set( const Glib::ustring & partition,
|
void Set( const Glib::ustring & partition,
|
||||||
const int partition_number,
|
const int partition_number,
|
||||||
const PartitionType type,
|
const PartitionType type,
|
||||||
const Glib::ustring & filesystem,
|
const FILESYSTEM filesystem,
|
||||||
const Sector & sector_start,
|
const Sector & sector_start,
|
||||||
const Sector & sector_end,
|
const Sector & sector_end,
|
||||||
const bool inside_extended,
|
const bool inside_extended,
|
||||||
|
@ -82,7 +82,7 @@ public:
|
||||||
int partition_number;
|
int partition_number;
|
||||||
PartitionType type;// UNALLOCATED, PRIMARY, LOGICAL, etc...
|
PartitionType type;// UNALLOCATED, PRIMARY, LOGICAL, etc...
|
||||||
PartitionStatus status; //STAT_REAL, STAT_NEW, etc..
|
PartitionStatus status; //STAT_REAL, STAT_NEW, etc..
|
||||||
Glib::ustring filesystem;// ext2, ext3, ntfs, etc....
|
FILESYSTEM filesystem ;
|
||||||
Sector sector_start;
|
Sector sector_start;
|
||||||
Sector sector_end;
|
Sector sector_end;
|
||||||
Sector sectors_used;
|
Sector sectors_used;
|
||||||
|
|
105
include/Utils.h
105
include/Utils.h
|
@ -24,6 +24,8 @@
|
||||||
#ifndef UTILS
|
#ifndef UTILS
|
||||||
#define UTILS
|
#define UTILS
|
||||||
|
|
||||||
|
#include "../include/i18n.h"
|
||||||
|
|
||||||
#include <gtkmm/label.h>
|
#include <gtkmm/label.h>
|
||||||
#include <glibmm/ustring.h>
|
#include <glibmm/ustring.h>
|
||||||
|
|
||||||
|
@ -37,8 +39,28 @@ typedef long long Sector;
|
||||||
|
|
||||||
#define MEGABYTE 2048 //try it: 2048 * 512 / 1024 /1024 == 1 :P
|
#define MEGABYTE 2048 //try it: 2048 * 512 / 1024 /1024 == 1 :P
|
||||||
|
|
||||||
|
enum FILESYSTEM
|
||||||
|
{
|
||||||
|
FS_UNALLOCATED = 0,
|
||||||
|
FS_UNKNOWN = 1,
|
||||||
|
FS_UNFORMATTED = 2,
|
||||||
|
FS_EXTENDED = 3,
|
||||||
|
FS_EXT2 = 4,
|
||||||
|
FS_EXT3 = 5,
|
||||||
|
FS_LINUX_SWAP = 6,
|
||||||
|
FS_FAT16 = 7,
|
||||||
|
FS_FAT32 = 8,
|
||||||
|
FS_NTFS = 9,
|
||||||
|
FS_REISERFS = 10,
|
||||||
|
FS_REISER4 = 11,
|
||||||
|
FS_XFS = 12,
|
||||||
|
FS_JFS = 13,
|
||||||
|
FS_HFS = 14,
|
||||||
|
FS_HFSPLUS = 15,
|
||||||
|
FS_UFS = 16
|
||||||
|
};
|
||||||
|
|
||||||
//struct to store filesystems
|
//struct to store filesysteminformation
|
||||||
struct FS
|
struct FS
|
||||||
{
|
{
|
||||||
enum Support
|
enum Support
|
||||||
|
@ -48,7 +70,7 @@ struct FS
|
||||||
EXTERNAL = 2
|
EXTERNAL = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
Glib::ustring filesystem ;
|
FILESYSTEM filesystem ;
|
||||||
Support read ; //can we get the amount of used sectors?
|
Support read ; //can we get the amount of used sectors?
|
||||||
Support create ;
|
Support create ;
|
||||||
Support grow ;
|
Support grow ;
|
||||||
|
@ -107,42 +129,57 @@ inline Glib::ustring num_to_str( Sector number, bool use_C_locale = false )
|
||||||
}
|
}
|
||||||
|
|
||||||
//use http://developer.gnome.org/projects/gup/hig/2.0/design.html#Palette as a starting point..
|
//use http://developer.gnome.org/projects/gup/hig/2.0/design.html#Palette as a starting point..
|
||||||
inline Glib::ustring Get_Color( const Glib::ustring & filesystem )
|
inline Glib::ustring Get_Color( FILESYSTEM filesystem )
|
||||||
{
|
{
|
||||||
//blue teints
|
switch( filesystem )
|
||||||
if ( filesystem == "ext2" ) return "#9DB8D2" ;
|
{
|
||||||
else if ( filesystem == "ext3" ) return "#7590AE" ;
|
case FS_UNALLOCATED : return "darkgrey" ;
|
||||||
|
case FS_UNKNOWN : return "black" ;
|
||||||
|
case FS_UNFORMATTED : return "black" ;
|
||||||
|
case FS_EXTENDED : return "#7DFCFE" ;
|
||||||
|
case FS_EXT2 : return "#9DB8D2" ;
|
||||||
|
case FS_EXT3 : return "#7590AE" ;
|
||||||
|
case FS_LINUX_SWAP : return "#C1665A" ;
|
||||||
|
case FS_FAT16 : return "green" ;
|
||||||
|
case FS_FAT32 : return "#18D918" ;
|
||||||
|
case FS_NTFS : return "#42E5AC" ;
|
||||||
|
case FS_REISERFS : return "#ADA7C8" ;
|
||||||
|
case FS_REISER4 : return "#887FA3" ;
|
||||||
|
case FS_XFS : return "#EED680" ;
|
||||||
|
case FS_JFS : return "#E0C39E" ;
|
||||||
|
case FS_HFS : return "#E0B6AF" ;
|
||||||
|
case FS_HFSPLUS : return "#C0A39E" ;
|
||||||
|
case FS_UFS : return "#D1940C" ;
|
||||||
|
|
||||||
//redbrown
|
default : return "black" ;
|
||||||
else if ( filesystem == "linux-swap" ) return "#C1665A" ;
|
}
|
||||||
|
|
||||||
//greenisch stuff..
|
|
||||||
else if ( filesystem == "fat16" ) return "green" ;
|
|
||||||
else if ( filesystem == "fat32" ) return "#18D918" ;
|
|
||||||
else if ( filesystem == "ntfs" ) return "#42E5AC" ;
|
|
||||||
|
|
||||||
//purple something..
|
|
||||||
else if ( filesystem == "reiserfs" ) return "#ADA7C8" ;
|
|
||||||
else if ( filesystem == "reiser4" ) return "#887FA3" ;
|
|
||||||
|
|
||||||
//darkyellow
|
|
||||||
else if ( filesystem == "xfs" ) return "#EED680" ;
|
|
||||||
|
|
||||||
else if ( filesystem == "jfs" ) return "#E0C39E" ;
|
|
||||||
|
|
||||||
else if ( filesystem == "hfs" ) return "#E0B6AF" ;
|
|
||||||
else if ( filesystem == "hfs+" ) return "#C0A39E" ;
|
|
||||||
|
|
||||||
else if ( filesystem == "ufs" ) return "#D1940C" ;
|
|
||||||
|
|
||||||
//darkgrey and ligthblue
|
|
||||||
else if ( filesystem == "---" ) return "darkgrey";
|
|
||||||
else if ( filesystem == "extended" ) return "#7DFCFE" ;
|
|
||||||
|
|
||||||
//unknown filesystem ( damaged, unknown or simply no filesystem )
|
|
||||||
else return "black";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Glib::ustring Get_Filesystem_String( FILESYSTEM filesystem )
|
||||||
|
{
|
||||||
|
switch( filesystem )
|
||||||
|
{
|
||||||
|
case FS_UNALLOCATED : return _("unallocated") ;
|
||||||
|
case FS_UNKNOWN : return _("unknown") ;
|
||||||
|
case FS_UNFORMATTED : return _("unformatted") ;
|
||||||
|
case FS_EXTENDED : return "extended" ;
|
||||||
|
case FS_EXT2 : return "ext2" ;
|
||||||
|
case FS_EXT3 : return "ext3" ;
|
||||||
|
case FS_LINUX_SWAP : return "linux-swap" ;
|
||||||
|
case FS_FAT16 : return "fat16" ;
|
||||||
|
case FS_FAT32 : return "fat32" ;
|
||||||
|
case FS_NTFS : return "ntfs" ;
|
||||||
|
case FS_REISERFS : return "reiserfs" ;
|
||||||
|
case FS_REISER4 : return "reiser4" ;
|
||||||
|
case FS_XFS : return "xfs" ;
|
||||||
|
case FS_JFS : return "jfs" ;
|
||||||
|
case FS_HFS : return "hfs" ;
|
||||||
|
case FS_HFSPLUS : return "hfs+" ;
|
||||||
|
case FS_UFS : return "ufs" ;
|
||||||
|
|
||||||
|
default : return "" ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}//GParted
|
}//GParted
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void Build_Visual_Disk( ) ; //i still dream of some fully resizeable visualdisk....
|
void Build_Visual_Disk( ) ; //i still dream of some fully resizeable visualdisk....
|
||||||
void Create_Visual_Partition( const Partition & partition ) ;
|
void Create_Visual_Partition( const Partition & partition ) ;
|
||||||
void Prepare_Legend( std::vector<Glib::ustring> & legend, const std::vector<Partition> & partitions ) ;
|
void Prepare_Legend( std::vector<GParted::FILESYSTEM> & legend, const std::vector<Partition> & partitions ) ;
|
||||||
void Build_Legend( ) ;
|
void Build_Legend( ) ;
|
||||||
|
|
||||||
//signal handlers
|
//signal handlers
|
||||||
|
|
|
@ -141,7 +141,7 @@ private:
|
||||||
void activate_new( );
|
void activate_new( );
|
||||||
void activate_delete( );
|
void activate_delete( );
|
||||||
void activate_info( );
|
void activate_info( );
|
||||||
void activate_convert( const Glib::ustring & new_fs );
|
void activate_convert( GParted::FILESYSTEM new_fs );
|
||||||
void activate_unmount( ) ;
|
void activate_unmount( ) ;
|
||||||
void activate_disklabel( ) ;
|
void activate_disklabel( ) ;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef EXT2
|
#ifndef DEFINE_EXT2
|
||||||
#define EXT2
|
#define DEFINE_EXT2
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef EXT3
|
#ifndef DEFINE_EXT3
|
||||||
#define EXT3
|
#define DEFINE_EXT3
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef FAT16
|
#ifndef DEFINE_FAT16
|
||||||
#define FAT16
|
#define DEFINE_FAT16
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef FAT32
|
#ifndef DEFINE_FAT32
|
||||||
#define FAT32
|
#define DEFINE_FAT32
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef HFS
|
#ifndef DEFINE_HFS
|
||||||
#define HFS
|
#define DEFINE_HFS
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef HFSPLUS
|
#ifndef DEFINE_HFSPLUS
|
||||||
#define HFSPLUS
|
#define DEFINE_HFSPLUS
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef JFS
|
#ifndef DEFINE_JFS
|
||||||
#define JFS
|
#define DEFINE_JFS
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef LINUX_SWAP
|
#ifndef DEFINE_LINUX_SWAP
|
||||||
#define LINUX_SWAP
|
#define DEFINE_LINUX_SWAP
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef NTFS
|
#ifndef DEFINE_NTFS
|
||||||
#define NTFS
|
#define DEFINE_NTFS
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef REISER4
|
#ifndef DEFINE_REISER4
|
||||||
#define REISER4
|
#define DEFINE_REISER4
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef REISERFS
|
#ifndef DEFINE_REISERFS
|
||||||
#define REISERFS
|
#define DEFINE_REISERFS
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
#include <dlfcn.h>
|
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef XFS
|
#ifndef DEFINE_XFS
|
||||||
#define XFS
|
#define DEFINE_XFS
|
||||||
|
|
||||||
#include "../include/FileSystem.h"
|
#include "../include/FileSystem.h"
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ void Dialog_Filesystems::Load_Filesystems( const std::vector< FS > & FILESYSTEMS
|
||||||
void Dialog_Filesystems::Show_Filesystem( const FS & fs )
|
void Dialog_Filesystems::Show_Filesystem( const FS & fs )
|
||||||
{
|
{
|
||||||
treerow = *( liststore_filesystems ->append( ) );
|
treerow = *( liststore_filesystems ->append( ) );
|
||||||
treerow[ treeview_filesystems_columns .filesystem ] = fs .filesystem ;
|
treerow[ treeview_filesystems_columns .filesystem ] = Get_Filesystem_String( fs .filesystem ) ;
|
||||||
|
|
||||||
treerow[ treeview_filesystems_columns .create ] =
|
treerow[ treeview_filesystems_columns .create ] =
|
||||||
render_icon( fs .create ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR);
|
render_icon( fs .create ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_LARGE_TOOLBAR);
|
||||||
|
|
|
@ -53,7 +53,7 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
||||||
|
|
||||||
fs .MAX = ( ! fs .MAX || fs .MAX > TOTAL_MB ) ? TOTAL_MB : fs .MAX -= BUF ;
|
fs .MAX = ( ! fs .MAX || fs .MAX > TOTAL_MB ) ? TOTAL_MB : fs .MAX -= BUF ;
|
||||||
|
|
||||||
if ( fs .filesystem == "xfs" ) //bit hackisch, but most effective, since it's a unique situation
|
if ( fs .filesystem == GParted::FS_XFS ) //bit hackisch, but most effective, since it's a unique situation
|
||||||
fs .MIN = copied_partition .Get_Used_MB( ) + (BUF * 2) ;
|
fs .MIN = copied_partition .Get_Used_MB( ) + (BUF * 2) ;
|
||||||
else
|
else
|
||||||
fs .MIN = COPIED_LENGTH_MB +1 ;
|
fs .MIN = COPIED_LENGTH_MB +1 ;
|
||||||
|
@ -80,7 +80,7 @@ void Dialog_Partition_Copy::Set_Data( const Partition & selected_partition, cons
|
||||||
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
|
//set global selected_partition (see Dialog_Base_Partition::Get_New_Partition )
|
||||||
this ->selected_partition = copied_partition ;
|
this ->selected_partition = copied_partition ;
|
||||||
this ->selected_partition .inside_extended = selected_partition .inside_extended ;
|
this ->selected_partition .inside_extended = selected_partition .inside_extended ;
|
||||||
this ->selected_partition .type = selected_partition .inside_extended ? GParted::LOGICAL : GParted::PRIMARY ;
|
this ->selected_partition .type = selected_partition .inside_extended ? GParted::TYPE_LOGICAL : GParted::TYPE_PRIMARY ;
|
||||||
}
|
}
|
||||||
|
|
||||||
Partition Dialog_Partition_Copy::Get_New_Partition( )
|
Partition Dialog_Partition_Copy::Get_New_Partition( )
|
||||||
|
|
|
@ -67,7 +67,7 @@ void Dialog_Partition_Info::drawingarea_on_realize( )
|
||||||
|
|
||||||
bool Dialog_Partition_Info::drawingarea_on_expose( GdkEventExpose *ev )
|
bool Dialog_Partition_Info::drawingarea_on_expose( GdkEventExpose *ev )
|
||||||
{
|
{
|
||||||
if ( partition .type != GParted::UNALLOCATED )
|
if ( partition .type != GParted::TYPE_UNALLOCATED )
|
||||||
{
|
{
|
||||||
//used
|
//used
|
||||||
gc ->set_foreground( color_used );
|
gc ->set_foreground( color_used );
|
||||||
|
@ -109,7 +109,7 @@ void Dialog_Partition_Info::init_drawingarea( )
|
||||||
//allocate some colors
|
//allocate some colors
|
||||||
color_used.set( "#F8F8BA" ); this ->get_colormap( ) ->alloc_color( color_used ) ;
|
color_used.set( "#F8F8BA" ); this ->get_colormap( ) ->alloc_color( color_used ) ;
|
||||||
|
|
||||||
partition .type == GParted::EXTENDED ? color_unused .set( "darkgrey" ) : color_unused .set( "white" ) ;
|
partition .type == GParted::TYPE_EXTENDED ? color_unused .set( "darkgrey" ) : color_unused .set( "white" ) ;
|
||||||
this ->get_colormap( ) ->alloc_color( color_unused ) ;
|
this ->get_colormap( ) ->alloc_color( color_unused ) ;
|
||||||
|
|
||||||
color_text .set( "black" ); this ->get_colormap( ) ->alloc_color( color_text ) ;
|
color_text .set( "black" ); this ->get_colormap( ) ->alloc_color( color_text ) ;
|
||||||
|
@ -130,7 +130,7 @@ void Dialog_Partition_Info::Display_Info( )
|
||||||
|
|
||||||
//filesystem
|
//filesystem
|
||||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Filesystem:" ) + "</b>" ) , 0, 1, top, bottom, Gtk::FILL );
|
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Filesystem:" ) + "</b>" ) , 0, 1, top, bottom, Gtk::FILL );
|
||||||
table ->attach( * mk_label( partition .filesystem ), 1, 2, top++, bottom++, Gtk::FILL);
|
table ->attach( * mk_label( Get_Filesystem_String( partition .filesystem ) ), 1, 2, top++, bottom++, Gtk::FILL );
|
||||||
|
|
||||||
//size
|
//size
|
||||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Size:" ) + "</b>" ), 0,1,top, bottom,Gtk::FILL);
|
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Size:" ) + "</b>" ), 0,1,top, bottom,Gtk::FILL);
|
||||||
|
@ -153,7 +153,7 @@ void Dialog_Partition_Info::Display_Info( )
|
||||||
}
|
}
|
||||||
|
|
||||||
//flags
|
//flags
|
||||||
if ( partition.type != GParted::UNALLOCATED )
|
if ( partition.type != GParted::TYPE_UNALLOCATED )
|
||||||
{
|
{
|
||||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Flags:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Flags:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||||
table ->attach( * mk_label( partition .flags ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
table ->attach( * mk_label( partition .flags ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||||
|
@ -162,7 +162,7 @@ void Dialog_Partition_Info::Display_Info( )
|
||||||
//one blank line
|
//one blank line
|
||||||
table ->attach( * mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
table ->attach( * mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
|
||||||
|
|
||||||
if ( partition .type != GParted::UNALLOCATED && partition .status != GParted::STAT_NEW )
|
if ( partition .type != GParted::TYPE_UNALLOCATED && partition .status != GParted::STAT_NEW )
|
||||||
{
|
{
|
||||||
//path
|
//path
|
||||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Path:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Path:" ) + "</b>" ), 0, 1, top, bottom, Gtk::FILL ) ;
|
||||||
|
@ -184,9 +184,9 @@ void Dialog_Partition_Info::Display_Info( )
|
||||||
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Status:" ) + "</b>" ), 0,1, top, bottom, Gtk::FILL) ;
|
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Status:" ) + "</b>" ), 0,1, top, bottom, Gtk::FILL) ;
|
||||||
if ( partition.busy )
|
if ( partition.busy )
|
||||||
str_temp = Find_Status( ) ;
|
str_temp = Find_Status( ) ;
|
||||||
else if ( partition.type == GParted::EXTENDED )
|
else if ( partition.type == GParted::TYPE_EXTENDED )
|
||||||
str_temp = _("Not busy (There are no mounted logical partitions)" ) ;
|
str_temp = _("Not busy (There are no mounted logical partitions)" ) ;
|
||||||
else if ( partition.filesystem == "linux-swap" )
|
else if ( partition.filesystem == GParted::FS_LINUX_SWAP )
|
||||||
str_temp = _("Not active" ) ;
|
str_temp = _("Not active" ) ;
|
||||||
else
|
else
|
||||||
str_temp = _("Not mounted" ) ;
|
str_temp = _("Not mounted" ) ;
|
||||||
|
@ -212,9 +212,9 @@ void Dialog_Partition_Info::Display_Info( )
|
||||||
|
|
||||||
Glib::ustring Dialog_Partition_Info::Find_Status( )
|
Glib::ustring Dialog_Partition_Info::Find_Status( )
|
||||||
{
|
{
|
||||||
if ( partition .type == GParted::EXTENDED )
|
if ( partition .type == GParted::TYPE_EXTENDED )
|
||||||
return _("Busy (At least one logical partition is mounted)" ) ;
|
return _("Busy (At least one logical partition is mounted)" ) ;
|
||||||
else if ( partition .filesystem == "linux-swap" )
|
else if ( partition .filesystem == FS_LINUX_SWAP )
|
||||||
return _("Active") ;
|
return _("Active") ;
|
||||||
|
|
||||||
//try to find the mountpoint in /proc/mounts
|
//try to find the mountpoint in /proc/mounts
|
||||||
|
|
|
@ -37,10 +37,11 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
|
||||||
this ->selected_partition = partition;
|
this ->selected_partition = partition;
|
||||||
this ->cylinder_size = cylinder_size ;
|
this ->cylinder_size = cylinder_size ;
|
||||||
this ->FILESYSTEMS = FILESYSTEMS ;
|
this ->FILESYSTEMS = FILESYSTEMS ;
|
||||||
this ->FILESYSTEMS .back( ) .filesystem = _("Unformatted") ;
|
this ->FILESYSTEMS .back( ) .filesystem = GParted::FS_UNFORMATTED ;
|
||||||
this ->FILESYSTEMS .back( ) .create = GParted::FS::LIBPARTED ;
|
this ->FILESYSTEMS .back( ) .create = GParted::FS::LIBPARTED ;
|
||||||
|
|
||||||
FS fs_tmp ; fs_tmp .filesystem = "extended" ;
|
FS fs_tmp ;
|
||||||
|
fs_tmp .filesystem = GParted::FS_EXTENDED ;
|
||||||
this ->FILESYSTEMS .push_back( fs_tmp ) ;
|
this ->FILESYSTEMS .push_back( fs_tmp ) ;
|
||||||
|
|
||||||
//add table with selection menu's...
|
//add table with selection menu's...
|
||||||
|
@ -109,14 +110,16 @@ void Dialog_Partition_New::Set_Data( const Partition & partition, bool any_exten
|
||||||
Partition Dialog_Partition_New::Get_New_Partition()
|
Partition Dialog_Partition_New::Get_New_Partition()
|
||||||
{
|
{
|
||||||
Partition part_temp ;
|
Partition part_temp ;
|
||||||
PartitionType part_type = GParted::UNALLOCATED; //paranoia ;P
|
PartitionType part_type ;
|
||||||
Sector new_start, new_end;
|
Sector new_start, new_end;
|
||||||
|
|
||||||
switch ( optionmenu_type .get_history( ) )
|
switch ( optionmenu_type .get_history( ) )
|
||||||
{
|
{
|
||||||
case 0: part_type = GParted::PRIMARY; break;
|
case 0 : part_type = GParted::TYPE_PRIMARY; break;
|
||||||
case 1: part_type = GParted::LOGICAL; break;
|
case 1 : part_type = GParted::TYPE_LOGICAL; break;
|
||||||
case 2: part_type = GParted::EXTENDED; break;
|
case 2 : part_type = GParted::TYPE_EXTENDED; break;
|
||||||
|
|
||||||
|
default : part_type = GParted::TYPE_UNALLOCATED ;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_start = START + (Sector) (spinbutton_before .get_value( ) * MEGABYTE) ;
|
new_start = START + (Sector) (spinbutton_before .get_value( ) * MEGABYTE) ;
|
||||||
|
@ -142,7 +145,7 @@ Partition Dialog_Partition_New::Get_New_Partition()
|
||||||
part_temp.sector_end = selected_partition.sector_end ;
|
part_temp.sector_end = selected_partition.sector_end ;
|
||||||
|
|
||||||
//if new is extended...
|
//if new is extended...
|
||||||
if ( part_temp .type == GParted::EXTENDED )
|
if ( part_temp .type == GParted::TYPE_EXTENDED )
|
||||||
{
|
{
|
||||||
Partition UNALLOCATED ;
|
Partition UNALLOCATED ;
|
||||||
UNALLOCATED .Set_Unallocated( part_temp .sector_start, part_temp .sector_end, true ) ;
|
UNALLOCATED .Set_Unallocated( part_temp .sector_start, part_temp .sector_end, true ) ;
|
||||||
|
@ -157,13 +160,13 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
|
||||||
//optionmenu_type
|
//optionmenu_type
|
||||||
if ( type )
|
if ( type )
|
||||||
{
|
{
|
||||||
if ( optionmenu_type .get_history( ) == GParted::EXTENDED && menu_filesystem .items( ) .size( ) < FILESYSTEMS .size( ) )
|
if ( optionmenu_type .get_history( ) == GParted::TYPE_EXTENDED && menu_filesystem .items( ) .size( ) < FILESYSTEMS .size( ) )
|
||||||
{
|
{
|
||||||
menu_filesystem .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( "extended" ) ) ;
|
menu_filesystem .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( Get_Filesystem_String( GParted::FS_EXTENDED ) ) ) ;
|
||||||
optionmenu_filesystem .set_history( menu_filesystem .items( ) .size( ) -1 ) ;
|
optionmenu_filesystem .set_history( menu_filesystem .items( ) .size( ) -1 ) ;
|
||||||
optionmenu_filesystem .set_sensitive( false ) ;
|
optionmenu_filesystem .set_sensitive( false ) ;
|
||||||
}
|
}
|
||||||
else if ( optionmenu_type .get_history( ) != GParted::EXTENDED && menu_filesystem .items( ) .size( ) == FILESYSTEMS .size( ) )
|
else if ( optionmenu_type .get_history( ) != GParted::TYPE_EXTENDED && menu_filesystem .items( ) .size( ) == FILESYSTEMS .size( ) )
|
||||||
{
|
{
|
||||||
menu_filesystem .items( ) .remove( menu_filesystem .items( ) .back( ) ) ;
|
menu_filesystem .items( ) .remove( menu_filesystem .items( ) .back( ) ) ;
|
||||||
optionmenu_filesystem .set_sensitive( true ) ;
|
optionmenu_filesystem .set_sensitive( true ) ;
|
||||||
|
@ -211,7 +214,7 @@ void Dialog_Partition_New::Build_Filesystems_Menu( bool only_unformatted )
|
||||||
//fill the filesystem menu with the filesystems (except for extended)
|
//fill the filesystem menu with the filesystems (except for extended)
|
||||||
for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) -1 ; t++ )
|
for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) -1 ; t++ )
|
||||||
{
|
{
|
||||||
menu_filesystem .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( FILESYSTEMS[ t ] .filesystem ) ) ;
|
menu_filesystem .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( Get_Filesystem_String( FILESYSTEMS[ t ] .filesystem ) ) ) ;
|
||||||
menu_filesystem .items( )[ t ] .set_sensitive( ! only_unformatted && FILESYSTEMS[ t ] .create && this ->selected_partition .Get_Length_MB() >= FILESYSTEMS[ t ] .MIN ) ;
|
menu_filesystem .items( )[ t ] .set_sensitive( ! only_unformatted && FILESYSTEMS[ t ] .create && this ->selected_partition .Get_Length_MB() >= FILESYSTEMS[ t ] .MIN ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ void Dialog_Partition_Resize_Move::Set_Data( const Partition & selected_partitio
|
||||||
|
|
||||||
this ->selected_partition = selected_partition ;
|
this ->selected_partition = selected_partition ;
|
||||||
|
|
||||||
if ( selected_partition .type == GParted::EXTENDED )
|
if ( selected_partition .type == GParted::TYPE_EXTENDED )
|
||||||
{
|
{
|
||||||
Set_Resizer( true ) ;
|
Set_Resizer( true ) ;
|
||||||
Resize_Move_Extended( partitions ) ;
|
Resize_Move_Extended( partitions ) ;
|
||||||
|
@ -87,7 +87,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
||||||
Sector previous, next ;
|
Sector previous, next ;
|
||||||
previous = next = 0 ;
|
previous = next = 0 ;
|
||||||
//also check the partitions filesystem ( if this is a 'resize-only' then previous should be 0 )
|
//also check the partitions filesystem ( if this is a 'resize-only' then previous should be 0 )
|
||||||
if ( t >= 1 && partitions[t -1].type == GParted::UNALLOCATED && ! this ->fixed_start )
|
if ( t >= 1 && partitions[t -1].type == GParted::TYPE_UNALLOCATED && ! this ->fixed_start )
|
||||||
{
|
{
|
||||||
previous = partitions[t -1] .sector_end - partitions[t -1] .sector_start ;
|
previous = partitions[t -1] .sector_end - partitions[t -1] .sector_start ;
|
||||||
START = partitions[t -1] .sector_start ;
|
START = partitions[t -1] .sector_start ;
|
||||||
|
@ -95,7 +95,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Normal( const std::vector <Partit
|
||||||
else
|
else
|
||||||
START = selected_partition .sector_start ;
|
START = selected_partition .sector_start ;
|
||||||
|
|
||||||
if ( t +1 < partitions .size() && partitions[t +1] .type == GParted::UNALLOCATED )
|
if ( t +1 < partitions .size() && partitions[t +1] .type == GParted::TYPE_UNALLOCATED )
|
||||||
next = partitions[t +1].sector_end - partitions[t +1].sector_start ;
|
next = partitions[t +1].sector_end - partitions[t +1].sector_start ;
|
||||||
|
|
||||||
total_length = previous + (selected_partition.sector_end - selected_partition.sector_start) + next;
|
total_length = previous + (selected_partition.sector_end - selected_partition.sector_start) + next;
|
||||||
|
@ -152,12 +152,12 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
||||||
//calculate total size in MB's of previous, current and next partition
|
//calculate total size in MB's of previous, current and next partition
|
||||||
//first find index of partition
|
//first find index of partition
|
||||||
unsigned int t = 0;
|
unsigned int t = 0;
|
||||||
while ( t < partitions .size( ) && partitions[ t ] .type != GParted::EXTENDED ) t++ ;
|
while ( t < partitions .size( ) && partitions[ t ] .type != GParted::TYPE_EXTENDED ) t++ ;
|
||||||
|
|
||||||
Sector previous, next ;
|
Sector previous, next ;
|
||||||
previous = next = 0 ;
|
previous = next = 0 ;
|
||||||
//calculate length and start of previous
|
//calculate length and start of previous
|
||||||
if ( t > 0 && partitions[t -1].type == GParted::UNALLOCATED )
|
if ( t > 0 && partitions[t -1].type == GParted::TYPE_UNALLOCATED )
|
||||||
{
|
{
|
||||||
previous = partitions[t -1].sector_end - partitions[t -1].sector_start ;
|
previous = partitions[t -1].sector_end - partitions[t -1].sector_start ;
|
||||||
START = partitions[t -1].sector_start ;
|
START = partitions[t -1].sector_start ;
|
||||||
|
@ -166,7 +166,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
||||||
START = selected_partition .sector_start ;
|
START = selected_partition .sector_start ;
|
||||||
|
|
||||||
//calculate length of next
|
//calculate length of next
|
||||||
if ( t +1 < partitions .size( ) && partitions[ t +1 ] .type == GParted::UNALLOCATED )
|
if ( t +1 < partitions .size( ) && partitions[ t +1 ] .type == GParted::TYPE_UNALLOCATED )
|
||||||
next = partitions[ t +1 ] .sector_end - partitions[ t +1 ] .sector_start ;
|
next = partitions[ t +1 ] .sector_end - partitions[ t +1 ] .sector_start ;
|
||||||
|
|
||||||
//now we have enough data to calculate some important values..
|
//now we have enough data to calculate some important values..
|
||||||
|
@ -182,7 +182,7 @@ void Dialog_Partition_Resize_Move::Resize_Move_Extended( const std::vector <Part
|
||||||
Sector first =0, used =0 ;
|
Sector first =0, used =0 ;
|
||||||
for ( unsigned int i = 0 ; i < partitions[ t ] .logicals .size( ) ; i++ )
|
for ( unsigned int i = 0 ; i < partitions[ t ] .logicals .size( ) ; i++ )
|
||||||
{
|
{
|
||||||
if ( partitions[ t ] .logicals[ i ] .type == GParted::LOGICAL )
|
if ( partitions[ t ] .logicals[ i ] .type == GParted::TYPE_LOGICAL )
|
||||||
{
|
{
|
||||||
if ( first == 0 )
|
if ( first == 0 )
|
||||||
first = partitions[ t ] .logicals[ i ] .sector_start ;
|
first = partitions[ t ] .logicals[ i ] .sector_start ;
|
||||||
|
|
|
@ -65,7 +65,7 @@ void GParted_Core::find_supported_filesystems( )
|
||||||
FILESYSTEMS .push_back( fs_xfs .get_filesystem_support( ) ) ;
|
FILESYSTEMS .push_back( fs_xfs .get_filesystem_support( ) ) ;
|
||||||
|
|
||||||
//unknown filesystem (default when no match is found)
|
//unknown filesystem (default when no match is found)
|
||||||
FS fs ; fs .filesystem = "unknown" ;
|
FS fs ; fs .filesystem = GParted::FS_UNKNOWN ;
|
||||||
FILESYSTEMS .push_back( fs ) ;
|
FILESYSTEMS .push_back( fs ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,11 +141,39 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring GParted_Core::Get_Filesystem( )
|
GParted::FILESYSTEM GParted_Core::Get_Filesystem( )
|
||||||
{
|
{
|
||||||
//standard libparted filesystems..
|
//standard libparted filesystems..
|
||||||
if ( lp_partition ->fs_type )
|
if ( lp_partition && lp_partition ->fs_type )
|
||||||
return lp_partition ->fs_type ->name ;
|
{
|
||||||
|
if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "extended" )
|
||||||
|
return GParted::FS_EXTENDED ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "ext2" )
|
||||||
|
return GParted::FS_EXT2 ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "ext3" )
|
||||||
|
return GParted::FS_EXT3 ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "linux-swap" )
|
||||||
|
return GParted::FS_LINUX_SWAP ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "fat16" )
|
||||||
|
return GParted::FS_FAT16 ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "fat32" )
|
||||||
|
return GParted::FS_FAT32 ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "ntfs" )
|
||||||
|
return GParted::FS_NTFS ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "reiserfs" )
|
||||||
|
return GParted::FS_REISERFS ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "xfs" )
|
||||||
|
return GParted::FS_XFS ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "jfs" )
|
||||||
|
return GParted::FS_JFS ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "hfs" )
|
||||||
|
return GParted::FS_HFS ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "hfs+" )
|
||||||
|
return GParted::FS_HFSPLUS ;
|
||||||
|
else if ( static_cast<Glib::ustring>( lp_partition ->fs_type ->name ) == "ufs" )
|
||||||
|
return GParted::FS_UFS ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//other filesystems libparted couldn't detect (i've send patches for these filesystems to the parted guys)
|
//other filesystems libparted couldn't detect (i've send patches for these filesystems to the parted guys)
|
||||||
char buf[512] ;
|
char buf[512] ;
|
||||||
|
@ -153,11 +181,10 @@ Glib::ustring GParted_Core::Get_Filesystem( )
|
||||||
|
|
||||||
//reiser4
|
//reiser4
|
||||||
ped_geometry_read( & lp_partition ->geom, buf, 128, 1 ) ;
|
ped_geometry_read( & lp_partition ->geom, buf, 128, 1 ) ;
|
||||||
strcpy( buf, strcmp( buf, "ReIsEr4" ) == 0 ? "reiser4" : "" ) ;
|
|
||||||
|
|
||||||
ped_device_close( lp_device );
|
ped_device_close( lp_device );
|
||||||
if ( strlen( buf ) )
|
|
||||||
return buf ;
|
if ( static_cast<Glib::ustring>( buf ) == "ReIsEr4" )
|
||||||
|
return GParted::FS_REISER4 ;
|
||||||
|
|
||||||
//no filesystem found....
|
//no filesystem found....
|
||||||
partition_temp .error = _( "Unable to detect filesystem! Possible reasons are:" ) ;
|
partition_temp .error = _( "Unable to detect filesystem! Possible reasons are:" ) ;
|
||||||
|
@ -168,7 +195,7 @@ Glib::ustring GParted_Core::Get_Filesystem( )
|
||||||
partition_temp .error += "\n-";
|
partition_temp .error += "\n-";
|
||||||
partition_temp .error += _( "There is no filesystem available (unformatted)" ) ;
|
partition_temp .error += _( "There is no filesystem available (unformatted)" ) ;
|
||||||
|
|
||||||
return _("unknown") ;
|
return GParted::FS_UNKNOWN ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GParted_Core::set_device_partitions( Device & device )
|
void GParted_Core::set_device_partitions( Device & device )
|
||||||
|
@ -189,13 +216,13 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
case PED_PARTITION_LOGICAL:
|
case PED_PARTITION_LOGICAL:
|
||||||
partition_temp .Set( device .path + num_to_str( lp_partition ->num ),
|
partition_temp .Set( device .path + num_to_str( lp_partition ->num ),
|
||||||
lp_partition ->num,
|
lp_partition ->num,
|
||||||
lp_partition ->type == 0 ? GParted::PRIMARY : GParted::LOGICAL ,
|
lp_partition ->type == 0 ? GParted::TYPE_PRIMARY : GParted::TYPE_LOGICAL,
|
||||||
Get_Filesystem( ), lp_partition ->geom .start,
|
Get_Filesystem( ), lp_partition ->geom .start,
|
||||||
lp_partition ->geom .end,
|
lp_partition ->geom .end,
|
||||||
lp_partition ->type,
|
lp_partition ->type,
|
||||||
ped_partition_is_busy( lp_partition ) );
|
ped_partition_is_busy( lp_partition ) );
|
||||||
|
|
||||||
if ( partition_temp .filesystem != "linux-swap" )
|
if ( partition_temp .filesystem != GParted::FS_LINUX_SWAP )
|
||||||
{
|
{
|
||||||
Set_Used_Sectors( partition_temp ) ;
|
Set_Used_Sectors( partition_temp ) ;
|
||||||
|
|
||||||
|
@ -218,8 +245,8 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
case PED_PARTITION_EXTENDED:
|
case PED_PARTITION_EXTENDED:
|
||||||
partition_temp.Set( device .path + num_to_str( lp_partition ->num ),
|
partition_temp.Set( device .path + num_to_str( lp_partition ->num ),
|
||||||
lp_partition ->num ,
|
lp_partition ->num ,
|
||||||
GParted::EXTENDED ,
|
GParted::TYPE_EXTENDED ,
|
||||||
"extended" ,
|
GParted::FS_EXTENDED ,
|
||||||
lp_partition ->geom .start ,
|
lp_partition ->geom .start ,
|
||||||
lp_partition ->geom .end ,
|
lp_partition ->geom .end ,
|
||||||
false ,
|
false ,
|
||||||
|
@ -229,7 +256,8 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
EXT_INDEX = device .device_partitions .size ( ) ;
|
EXT_INDEX = device .device_partitions .size ( ) ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if there's an end, there's a partition ;)
|
//if there's an end, there's a partition ;)
|
||||||
|
@ -358,7 +386,7 @@ void GParted_Core::Apply_Operation_To_Disk( Operation & operation )
|
||||||
|
|
||||||
bool GParted_Core::Create( const Device & device, Partition & new_partition )
|
bool GParted_Core::Create( const Device & device, Partition & new_partition )
|
||||||
{
|
{
|
||||||
if ( new_partition .type == GParted::EXTENDED )
|
if ( new_partition .type == GParted::TYPE_EXTENDED )
|
||||||
return Create_Empty_Partition( device .path, new_partition ) ;
|
return Create_Empty_Partition( device .path, new_partition ) ;
|
||||||
|
|
||||||
else if ( Create_Empty_Partition( device .path, new_partition, ( new_partition .Get_Length_MB( ) - device .cylsize ) < get_fs( new_partition .filesystem ) .MIN ) > 0 )
|
else if ( Create_Empty_Partition( device .path, new_partition, ( new_partition .Get_Length_MB( ) - device .cylsize ) < get_fs( new_partition .filesystem ) .MIN ) > 0 )
|
||||||
|
@ -400,7 +428,7 @@ bool GParted_Core::Delete( const Glib::ustring & device_path, const Partition &
|
||||||
|
|
||||||
if ( open_device_and_disk( device_path ) )
|
if ( open_device_and_disk( device_path ) )
|
||||||
{
|
{
|
||||||
if ( partition .type == GParted::EXTENDED )
|
if ( partition .type == GParted::TYPE_EXTENDED )
|
||||||
lp_partition = ped_disk_extended_partition( lp_disk ) ;
|
lp_partition = ped_disk_extended_partition( lp_disk ) ;
|
||||||
else
|
else
|
||||||
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition .sector_end + partition .sector_start) / 2 ) ;
|
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition .sector_end + partition .sector_start) / 2 ) ;
|
||||||
|
@ -415,7 +443,7 @@ bool GParted_Core::Delete( const Glib::ustring & device_path, const Partition &
|
||||||
|
|
||||||
bool GParted_Core::Resize( const Device & device, const Partition & partition_old, const Partition & partition_new )
|
bool GParted_Core::Resize( const Device & device, const Partition & partition_old, const Partition & partition_new )
|
||||||
{
|
{
|
||||||
if ( partition_old .type == GParted::EXTENDED )
|
if ( partition_old .type == GParted::TYPE_EXTENDED )
|
||||||
return Resize_Container_Partition( device .path, partition_old, partition_new, false ) ;
|
return Resize_Container_Partition( device .path, partition_old, partition_new, false ) ;
|
||||||
|
|
||||||
//lazy check (only grow). it's possbile one day this should be separated in checks for grow,shrink,move ..
|
//lazy check (only grow). it's possbile one day this should be separated in checks for grow,shrink,move ..
|
||||||
|
@ -492,7 +520,7 @@ const std::vector<FS> & GParted_Core::get_filesystems( ) const
|
||||||
return FILESYSTEMS ;
|
return FILESYSTEMS ;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FS & GParted_Core::get_fs( const Glib::ustring & filesystem ) const
|
const FS & GParted_Core::get_fs( GParted::FILESYSTEM filesystem ) const
|
||||||
{
|
{
|
||||||
for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) ; t++ )
|
for ( unsigned int t = 0 ; t < FILESYSTEMS .size( ) ; t++ )
|
||||||
if ( FILESYSTEMS[ t ] .filesystem == filesystem )
|
if ( FILESYSTEMS[ t ] .filesystem == filesystem )
|
||||||
|
@ -554,7 +582,7 @@ Glib::ustring GParted_Core::get_sym_path( const Glib::ustring & real_path )
|
||||||
void GParted_Core::Set_Used_Sectors( Partition & partition )
|
void GParted_Core::Set_Used_Sectors( Partition & partition )
|
||||||
{
|
{
|
||||||
//because 'unknown' is translated we need to call get_fs instead of using partition .filesystem directly
|
//because 'unknown' is translated we need to call get_fs instead of using partition .filesystem directly
|
||||||
if ( get_fs( partition .filesystem ) .filesystem == "unknown" )
|
if ( get_fs( partition .filesystem ) .filesystem == GParted::FS_UNKNOWN )
|
||||||
partition .Set_Unused( -1 ) ;
|
partition .Set_Unused( -1 ) ;
|
||||||
|
|
||||||
else if ( partition .busy )
|
else if ( partition .busy )
|
||||||
|
@ -573,12 +601,16 @@ void GParted_Core::Set_Used_Sectors( Partition & partition )
|
||||||
else
|
else
|
||||||
switch( get_fs( partition .filesystem ) .read )
|
switch( get_fs( partition .filesystem ) .read )
|
||||||
{
|
{
|
||||||
case GParted::FS::EXTERNAL : set_proper_filesystem( partition .filesystem ) ;
|
case GParted::FS::EXTERNAL :
|
||||||
|
set_proper_filesystem( partition .filesystem ) ;
|
||||||
p_filesystem ->Set_Used_Sectors( partition ) ;
|
p_filesystem ->Set_Used_Sectors( partition ) ;
|
||||||
break ;
|
break ;
|
||||||
case GParted::FS::LIBPARTED : LP_Set_Used_Sectors( partition ) ;
|
case GParted::FS::LIBPARTED :
|
||||||
|
LP_Set_Used_Sectors( partition ) ;
|
||||||
break ;
|
break ;
|
||||||
case GParted::FS::NONE : break ;
|
|
||||||
|
default:
|
||||||
|
partition .Set_Unused( -1 ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,10 +654,18 @@ int GParted_Core::Create_Empty_Partition( const Glib::ustring & device_path, Par
|
||||||
//create new partition
|
//create new partition
|
||||||
switch ( new_partition .type )
|
switch ( new_partition .type )
|
||||||
{
|
{
|
||||||
case 0 : type = PED_PARTITION_NORMAL; break ;
|
case GParted::TYPE_PRIMARY:
|
||||||
case 1 : type = PED_PARTITION_LOGICAL; break ;
|
type = PED_PARTITION_NORMAL ;
|
||||||
case 2 : type = PED_PARTITION_EXTENDED; break ;
|
break ;
|
||||||
default : type = PED_PARTITION_FREESPACE; break ; //will never happen ;)
|
case GParted::TYPE_LOGICAL:
|
||||||
|
type = PED_PARTITION_LOGICAL ;
|
||||||
|
break ;
|
||||||
|
case GParted::TYPE_EXTENDED:
|
||||||
|
type = PED_PARTITION_EXTENDED ;
|
||||||
|
break ;
|
||||||
|
|
||||||
|
default :
|
||||||
|
type = PED_PARTITION_FREESPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
c_part = ped_partition_new( lp_disk, type, NULL, new_partition .sector_start, new_partition .sector_end ) ;
|
c_part = ped_partition_new( lp_disk, type, NULL, new_partition .sector_start, new_partition .sector_end ) ;
|
||||||
|
@ -670,7 +710,7 @@ bool GParted_Core::Resize_Container_Partition( const Glib::ustring & device_path
|
||||||
|
|
||||||
if ( open_device_and_disk( device_path ) )
|
if ( open_device_and_disk( device_path ) )
|
||||||
{
|
{
|
||||||
if ( partition_old .type == GParted::EXTENDED )
|
if ( partition_old .type == GParted::TYPE_EXTENDED )
|
||||||
lp_partition = ped_disk_extended_partition( lp_disk ) ;
|
lp_partition = ped_disk_extended_partition( lp_disk ) ;
|
||||||
else
|
else
|
||||||
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition_old .sector_end + partition_old .sector_start) / 2 ) ;
|
lp_partition = ped_disk_get_partition_by_sector( lp_disk, (partition_old .sector_end + partition_old .sector_start) / 2 ) ;
|
||||||
|
@ -763,39 +803,28 @@ void GParted_Core::Show_Error( Glib::ustring message )
|
||||||
gdk_threads_leave( );
|
gdk_threads_leave( );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GParted_Core::set_proper_filesystem( const Glib::ustring & filesystem )
|
void GParted_Core::set_proper_filesystem( const FILESYSTEM & filesystem )
|
||||||
{
|
{
|
||||||
//ugly, stupid, *aaargh* :-)
|
|
||||||
|
|
||||||
if ( ! p_filesystem )
|
if ( ! p_filesystem )
|
||||||
delete p_filesystem ;
|
delete p_filesystem ;
|
||||||
|
|
||||||
if ( filesystem == "ext2" )
|
switch( filesystem )
|
||||||
p_filesystem = new ext2( ) ;
|
{
|
||||||
else if ( filesystem == "ext3" )
|
case FS_EXT2 : p_filesystem = new ext2() ; break ;
|
||||||
p_filesystem = new ext3( ) ;
|
case FS_EXT3 : p_filesystem = new ext3() ; break ;
|
||||||
else if ( filesystem == "fat16" )
|
case FS_LINUX_SWAP : p_filesystem = new linux_swap() ; break ;
|
||||||
p_filesystem = new fat16( ) ;
|
case FS_FAT16 : p_filesystem = new fat16() ; break ;
|
||||||
else if ( filesystem == "fat32" )
|
case FS_FAT32 : p_filesystem = new fat32() ; break ;
|
||||||
p_filesystem = new fat32( ) ;
|
case FS_NTFS : p_filesystem = new ntfs() ; break ;
|
||||||
else if ( filesystem == "hfs" )
|
case FS_REISERFS : p_filesystem = new reiserfs() ; break ;
|
||||||
p_filesystem = new hfs( ) ;
|
case FS_REISER4 : p_filesystem = new reiser4() ; break ;
|
||||||
else if ( filesystem == "hfs+" )
|
case FS_XFS : p_filesystem = new xfs() ; break ;
|
||||||
p_filesystem = new hfsplus( ) ;
|
case FS_JFS : p_filesystem = new jfs() ; break ;
|
||||||
else if ( filesystem == "jfs" )
|
case FS_HFS : p_filesystem = new hfs() ; break ;
|
||||||
p_filesystem = new jfs( ) ;
|
case FS_HFSPLUS : p_filesystem = new hfsplus() ; break ;
|
||||||
else if ( filesystem == "linux-swap" )
|
|
||||||
p_filesystem = new linux_swap( ) ;
|
default : p_filesystem = NULL ;
|
||||||
else if ( filesystem == "reiser4" )
|
}
|
||||||
p_filesystem = new reiser4( ) ;
|
|
||||||
else if ( filesystem == "reiserfs" )
|
|
||||||
p_filesystem = new reiserfs( ) ;
|
|
||||||
else if ( filesystem == "ntfs" )
|
|
||||||
p_filesystem = new ntfs( ) ;
|
|
||||||
else if ( filesystem == "xfs" )
|
|
||||||
p_filesystem = new xfs( ) ;
|
|
||||||
else
|
|
||||||
p_filesystem = NULL ;
|
|
||||||
|
|
||||||
if ( p_filesystem )
|
if ( p_filesystem )
|
||||||
p_filesystem ->textbuffer = textbuffer ;
|
p_filesystem ->textbuffer = textbuffer ;
|
||||||
|
@ -808,7 +837,7 @@ bool GParted_Core::set_partition_type( const Glib::ustring & device_path, const
|
||||||
|
|
||||||
if ( open_device_and_disk( device_path ) )
|
if ( open_device_and_disk( device_path ) )
|
||||||
{
|
{
|
||||||
PedFileSystemType * fs_type = ped_file_system_type_get( partition .filesystem .c_str() ) ;
|
PedFileSystemType * fs_type = ped_file_system_type_get( Get_Filesystem_String( partition .filesystem ) .c_str() ) ;
|
||||||
|
|
||||||
//default is Linux (83)
|
//default is Linux (83)
|
||||||
if ( ! fs_type )
|
if ( ! fs_type )
|
||||||
|
|
|
@ -42,7 +42,8 @@ Glib::ustring Operation::Get_String( )
|
||||||
|
|
||||||
switch ( operationtype )
|
switch ( operationtype )
|
||||||
{
|
{
|
||||||
case DELETE : if (partition_original.type == GParted::LOGICAL)
|
case DELETE :
|
||||||
|
if (partition_original.type == GParted::TYPE_LOGICAL)
|
||||||
temp = _("Logical Partition") ;
|
temp = _("Logical Partition") ;
|
||||||
else
|
else
|
||||||
temp = partition_original .partition ;
|
temp = partition_original .partition ;
|
||||||
|
@ -50,16 +51,20 @@ Glib::ustring Operation::Get_String( )
|
||||||
/*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */
|
/*TO TRANSLATORS: looks like Delete /dev/hda2 (ntfs, 2345 MB) from /dev/hda */
|
||||||
return String::ucompose( _("Delete %1 (%2, %3 MB) from %4"), temp, partition_original .filesystem, partition_original .Get_Length_MB( ), device .path ) ;
|
return String::ucompose( _("Delete %1 (%2, %3 MB) from %4"), temp, partition_original .filesystem, partition_original .Get_Length_MB( ), device .path ) ;
|
||||||
|
|
||||||
case CREATE : switch( partition_new.type )
|
case CREATE :
|
||||||
|
switch( partition_new.type )
|
||||||
{
|
{
|
||||||
case GParted::PRIMARY : temp = _("Primary Partition"); break;
|
case GParted::TYPE_PRIMARY : temp = _("Primary Partition"); break;
|
||||||
case GParted::LOGICAL : temp = _("Logical Partition") ; break;
|
case GParted::TYPE_LOGICAL : temp = _("Logical Partition") ; break;
|
||||||
case GParted::EXTENDED : temp = _("Extended Partition"); break;
|
case GParted::TYPE_EXTENDED : temp = _("Extended Partition"); break;
|
||||||
|
|
||||||
default : break;
|
default : break;
|
||||||
}
|
}
|
||||||
/*TO TRANSLATORS: looks like Create Logical Partition #1 (ntfs, 2345 MB) on /dev/hda */
|
/*TO TRANSLATORS: looks like Create Logical Partition #1 (ntfs, 2345 MB) on /dev/hda */
|
||||||
return String::ucompose( _("Create %1 #%2 (%3, %4 MB) on %5"), temp, partition_new.partition_number, partition_new.filesystem , partition_new .Get_Length_MB( ), device .path ) ;
|
return String::ucompose( _("Create %1 #%2 (%3, %4 MB) on %5"), temp, partition_new.partition_number, partition_new.filesystem , partition_new .Get_Length_MB( ), device .path ) ;
|
||||||
case RESIZE_MOVE: //if startsector has changed >= 1 MB we consider it a move
|
|
||||||
|
case RESIZE_MOVE:
|
||||||
|
//if startsector has changed >= 1 MB we consider it a move
|
||||||
diff = std::abs( partition_new .sector_start - partition_original .sector_start ) ;
|
diff = std::abs( partition_new .sector_start - partition_original .sector_start ) ;
|
||||||
if ( diff >= MEGABYTE )
|
if ( diff >= MEGABYTE )
|
||||||
{
|
{
|
||||||
|
@ -79,15 +84,22 @@ Glib::ustring Operation::Get_String( )
|
||||||
else
|
else
|
||||||
temp += " " + String::ucompose( _("and Resize %1 from %2 MB to %3 MB"), partition_new.partition, partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ;
|
temp += " " + String::ucompose( _("and Resize %1 from %2 MB to %3 MB"), partition_new.partition, partition_original .Get_Length_MB(), partition_new .Get_Length_MB() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( temp .empty( ) )
|
if ( temp .empty( ) )
|
||||||
temp = _("Sorry, changes are too small to make sense");
|
temp = _("Sorry, changes are too small to make sense");
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
case CONVERT : /*TO TRANSLATORS: looks like Convert /dev/hda4 from ntfs to linux-swap */
|
|
||||||
|
case CONVERT :
|
||||||
|
/*TO TRANSLATORS: looks like Convert /dev/hda4 from ntfs to linux-swap */
|
||||||
return String::ucompose( _( "Convert %1 from %2 to %3"), partition_original .partition, partition_original .filesystem, partition_new .filesystem ) ;
|
return String::ucompose( _( "Convert %1 from %2 to %3"), partition_original .partition, partition_original .filesystem, partition_new .filesystem ) ;
|
||||||
case COPY : /*TO TRANSLATORS: looks like Copy /dev/hda4 to /dev/hdd (start at 2500 MB) */
|
|
||||||
|
case COPY :
|
||||||
|
/*TO TRANSLATORS: looks like Copy /dev/hda4 to /dev/hdd (start at 2500 MB) */
|
||||||
return String::ucompose( _("Copy %1 to %2 (start at %3 MB)"), partition_new .partition, device .path, Sector_To_MB( partition_new .sector_start ) ) ;
|
return String::ucompose( _("Copy %1 to %2 (start at %3 MB)"), partition_new .partition, device .path, Sector_To_MB( partition_new .sector_start ) ) ;
|
||||||
default : return "";
|
|
||||||
|
default :
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -155,11 +167,11 @@ int Operation::Get_Index_Original( std::vector<Partition> & partitions )
|
||||||
if ( partition_original .sector_start >= partitions[ t ] .sector_start && partition_original .sector_end <= partitions[ t ] .sector_end )
|
if ( partition_original .sector_start >= partitions[ t ] .sector_start && partition_original .sector_end <= partitions[ t ] .sector_end )
|
||||||
{
|
{
|
||||||
//remove unallocated space preceding the original partition
|
//remove unallocated space preceding the original partition
|
||||||
if ( t -1 >= 0 && partitions[ t -1 ] .type == GParted::UNALLOCATED )
|
if ( t -1 >= 0 && partitions[ t -1 ] .type == GParted::TYPE_UNALLOCATED )
|
||||||
partitions .erase( partitions .begin( ) + --t );
|
partitions .erase( partitions .begin( ) + --t );
|
||||||
|
|
||||||
//remove unallocated space following the original partition
|
//remove unallocated space following the original partition
|
||||||
if ( t +1 < static_cast<int> ( partitions .size( ) ) && partitions[ t +1 ] .type == GParted::UNALLOCATED )
|
if ( t +1 < static_cast<int>( partitions .size( ) ) && partitions[ t +1 ] .type == GParted::TYPE_UNALLOCATED )
|
||||||
partitions .erase( partitions .begin( ) + t +1 );
|
partitions .erase( partitions .begin( ) + t +1 );
|
||||||
|
|
||||||
return t ;
|
return t ;
|
||||||
|
@ -179,7 +191,7 @@ void Operation::Apply_Delete_To_Visual( std::vector<Partition> & partitions )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int ext = 0 ;
|
unsigned int ext = 0 ;
|
||||||
while ( ext < partitions .size( ) && partitions[ ext ] .type != GParted::EXTENDED ) ext++ ;
|
while ( ext < partitions .size( ) && partitions[ ext ] .type != GParted::TYPE_EXTENDED ) ext++ ;
|
||||||
partitions[ ext ] .logicals .erase( partitions[ ext ] .logicals .begin( ) + Get_Index_Original( partitions[ ext ] .logicals ) );
|
partitions[ ext ] .logicals .erase( partitions[ ext ] .logicals .begin( ) + Get_Index_Original( partitions[ ext ] .logicals ) );
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,7 +217,7 @@ void Operation::Apply_Create_To_Visual( std::vector<Partition> & partitions )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int ext = 0 ;
|
unsigned int ext = 0 ;
|
||||||
while ( ext < partitions .size( ) && partitions[ ext ] .type != GParted::EXTENDED ) ext++ ;
|
while ( ext < partitions .size( ) && partitions[ ext ] .type != GParted::TYPE_EXTENDED ) ext++ ;
|
||||||
partitions[ ext ] .logicals[ Get_Index_Original( partitions[ ext ] .logicals ) ] = partition_new ;
|
partitions[ ext ] .logicals[ Get_Index_Original( partitions[ ext ] .logicals ) ] = partition_new ;
|
||||||
|
|
||||||
Insert_Unallocated( partitions[ ext ] .logicals, partitions[ ext ] .sector_start, partitions[ ext ] .sector_end, true ) ;
|
Insert_Unallocated( partitions[ ext ] .logicals, partitions[ ext ] .sector_start, partitions[ ext ] .sector_end, true ) ;
|
||||||
|
@ -214,7 +226,7 @@ void Operation::Apply_Create_To_Visual( std::vector<Partition> & partitions )
|
||||||
|
|
||||||
void Operation::Apply_Resize_Move_To_Visual( std::vector<Partition> & partitions)
|
void Operation::Apply_Resize_Move_To_Visual( std::vector<Partition> & partitions)
|
||||||
{
|
{
|
||||||
if ( partition_original .type == GParted::EXTENDED )
|
if ( partition_original .type == GParted::TYPE_EXTENDED )
|
||||||
Apply_Resize_Move_Extended_To_Visual( partitions ) ;
|
Apply_Resize_Move_Extended_To_Visual( partitions ) ;
|
||||||
else
|
else
|
||||||
Apply_Create_To_Visual( partitions ) ;
|
Apply_Create_To_Visual( partitions ) ;
|
||||||
|
@ -231,12 +243,12 @@ void Operation::Apply_Resize_Move_Extended_To_Visual( std::vector<Partition> & p
|
||||||
|
|
||||||
//stuff INSIDE extended partition
|
//stuff INSIDE extended partition
|
||||||
ext = 0 ;
|
ext = 0 ;
|
||||||
while ( ext < partitions .size( ) && partitions[ ext ] .type != GParted::EXTENDED ) ext++ ;
|
while ( ext < partitions .size( ) && partitions[ ext ] .type != GParted::TYPE_EXTENDED ) ext++ ;
|
||||||
|
|
||||||
if ( partitions[ ext ] .logicals .size( ) && partitions[ ext ] .logicals .front( ) .type == GParted::UNALLOCATED )
|
if ( partitions[ ext ] .logicals .size( ) && partitions[ ext ] .logicals .front( ) .type == GParted::TYPE_UNALLOCATED )
|
||||||
partitions[ ext ] .logicals .erase( partitions[ ext ] .logicals .begin( ) ) ;
|
partitions[ ext ] .logicals .erase( partitions[ ext ] .logicals .begin( ) ) ;
|
||||||
|
|
||||||
if ( partitions[ ext ] .logicals .size( ) && partitions[ ext ] .logicals .back( ) .type == GParted::UNALLOCATED )
|
if ( partitions[ ext ] .logicals .size( ) && partitions[ ext ] .logicals .back( ) .type == GParted::TYPE_UNALLOCATED )
|
||||||
partitions[ ext ] .logicals .erase( partitions[ ext ] .logicals .end( ) -1 ) ;
|
partitions[ ext ] .logicals .erase( partitions[ ext ] .logicals .end( ) -1 ) ;
|
||||||
|
|
||||||
Insert_Unallocated( partitions[ ext ] .logicals, partitions[ ext ] .sector_start, partitions[ ext ] .sector_end, true ) ;
|
Insert_Unallocated( partitions[ ext ] .logicals, partitions[ ext ] .sector_start, partitions[ ext ] .sector_end, true ) ;
|
||||||
|
|
|
@ -27,9 +27,10 @@ Partition::Partition( )
|
||||||
|
|
||||||
void Partition::Reset( )
|
void Partition::Reset( )
|
||||||
{
|
{
|
||||||
partition = filesystem = error = flags = "" ;
|
partition = error = flags = "" ;
|
||||||
status = GParted::STAT_REAL ;
|
status = GParted::STAT_REAL ;
|
||||||
type = GParted::UNALLOCATED ;
|
type = GParted::TYPE_UNALLOCATED ;
|
||||||
|
filesystem = GParted::FS_UNALLOCATED ;
|
||||||
partition_number = sector_start = sector_end = sectors_used = sectors_unused = -1;
|
partition_number = sector_start = sector_end = sectors_used = sectors_unused = -1;
|
||||||
color .set( "black" ) ;
|
color .set( "black" ) ;
|
||||||
inside_extended = busy = false ;
|
inside_extended = busy = false ;
|
||||||
|
@ -39,7 +40,7 @@ void Partition::Reset( )
|
||||||
void Partition::Set( const Glib::ustring & partition,
|
void Partition::Set( const Glib::ustring & partition,
|
||||||
const int partition_number,
|
const int partition_number,
|
||||||
const PartitionType type,
|
const PartitionType type,
|
||||||
const Glib::ustring & filesystem,
|
const FILESYSTEM filesystem,
|
||||||
const Sector & sector_start,
|
const Sector & sector_start,
|
||||||
const Sector & sector_end,
|
const Sector & sector_end,
|
||||||
const bool inside_extended,
|
const bool inside_extended,
|
||||||
|
@ -67,7 +68,7 @@ void Partition::Set_Unused( Sector sectors_unused )
|
||||||
|
|
||||||
void Partition::Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended )
|
void Partition::Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended )
|
||||||
{
|
{
|
||||||
this ->Set( _("Unallocated"), -1, GParted::UNALLOCATED, "---", sector_start, sector_end , inside_extended, false );
|
this ->Set( Get_Filesystem_String( GParted::FS_UNALLOCATED ), -1, GParted::TYPE_UNALLOCATED, GParted::FS_UNALLOCATED, sector_start, sector_end, inside_extended, false );
|
||||||
this ->error = this ->flags = "" ;
|
this ->error = this ->flags = "" ;
|
||||||
this ->status = GParted::STAT_REAL ;
|
this ->status = GParted::STAT_REAL ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ void TreeView_Detail::Load_Partitions( const std::vector<Partition> & partitions
|
||||||
row = *( treestore_detail ->append( ) );
|
row = *( treestore_detail ->append( ) );
|
||||||
Create_Row( row, partitions[ i ] );
|
Create_Row( row, partitions[ i ] );
|
||||||
|
|
||||||
if ( partitions[ i ] .type == GParted::EXTENDED )
|
if ( partitions[ i ] .type == GParted::TYPE_EXTENDED )
|
||||||
{
|
{
|
||||||
for ( unsigned int t = 0 ; t < partitions[ i ] .logicals .size( ) ; t++ )
|
for ( unsigned int t = 0 ; t < partitions[ i ] .logicals .size( ) ; t++ )
|
||||||
{
|
{
|
||||||
|
@ -146,8 +146,8 @@ void TreeView_Detail::Create_Row( const Gtk::TreeRow & treerow, const Partition
|
||||||
treerow[ treeview_detail_columns .partition ] = partition .partition;
|
treerow[ treeview_detail_columns .partition ] = partition .partition;
|
||||||
treerow[ treeview_detail_columns .color ] = Get_Color( partition .filesystem ) ;
|
treerow[ treeview_detail_columns .color ] = Get_Color( partition .filesystem ) ;
|
||||||
|
|
||||||
treerow[ treeview_detail_columns .text_color ] = ( partition .type == GParted::UNALLOCATED ) ? "darkgrey" : "black" ;
|
treerow[ treeview_detail_columns .text_color ] = ( partition .type == GParted::TYPE_UNALLOCATED ) ? "darkgrey" : "black" ;
|
||||||
treerow[ treeview_detail_columns .type ] = partition .filesystem ;
|
treerow[ treeview_detail_columns .type ] = Get_Filesystem_String( partition .filesystem ) ;
|
||||||
treerow[ treeview_detail_columns .type_square ] = "██" ;
|
treerow[ treeview_detail_columns .type_square ] = "██" ;
|
||||||
|
|
||||||
//size
|
//size
|
||||||
|
|
|
@ -54,9 +54,9 @@ VBox_VisualDisk::VBox_VisualDisk( const std::vector<Partition> & partitions, con
|
||||||
{
|
{
|
||||||
double width = static_cast<double> (partitions[ t ] .sector_end - partitions[ t ] .sector_start) / sectors_per_pixel ;
|
double width = static_cast<double> (partitions[ t ] .sector_end - partitions[ t ] .sector_start) / sectors_per_pixel ;
|
||||||
|
|
||||||
if ( (partitions[ t ] .type == GParted::PRIMARY || partitions[ t ] .type == GParted::LOGICAL) && width < 20 )
|
if ( (partitions[ t ] .type == GParted::TYPE_PRIMARY || partitions[ t ] .type == GParted::TYPE_LOGICAL) && width < 20 )
|
||||||
extra_pixels += (20 - width) ;
|
extra_pixels += (20 - width) ;
|
||||||
else if ( partitions[ t ] .type == GParted::UNALLOCATED && width < 15 )
|
else if ( partitions[ t ] .type == GParted::TYPE_UNALLOCATED && width < 15 )
|
||||||
extra_pixels += (15 - width) ;
|
extra_pixels += (15 - width) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void VBox_VisualDisk::Build_Visual_Disk( )
|
||||||
{
|
{
|
||||||
Create_Visual_Partition( partitions[ i ] ) ;
|
Create_Visual_Partition( partitions[ i ] ) ;
|
||||||
|
|
||||||
if ( partitions[ i ].type != GParted::EXTENDED )
|
if ( partitions[ i ].type != GParted::TYPE_EXTENDED )
|
||||||
hbox_disk ->pack_start( *( visual_partitions .back( ) ->drawingarea ), Gtk::PACK_SHRINK ) ;
|
hbox_disk ->pack_start( *( visual_partitions .back( ) ->drawingarea ), Gtk::PACK_SHRINK ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ void VBox_VisualDisk::Create_Visual_Partition( const Partition & partition )
|
||||||
visual_partitions .back( ) ->index = visual_partitions .size( ) -1 ; // <---- BELACHELIJK!! DOE DAAR IETS AAN!!!
|
visual_partitions .back( ) ->index = visual_partitions .size( ) -1 ; // <---- BELACHELIJK!! DOE DAAR IETS AAN!!!
|
||||||
visual_partitions .back( ) ->sector_start = partition .sector_start ;
|
visual_partitions .back( ) ->sector_start = partition .sector_start ;
|
||||||
|
|
||||||
if ( partition .type == GParted::EXTENDED )
|
if ( partition .type == GParted::TYPE_EXTENDED )
|
||||||
{
|
{
|
||||||
visual_partitions.back( ) ->drawingarea = NULL ;//it's just a dummy ;-) ( see Set_Selected() )
|
visual_partitions.back( ) ->drawingarea = NULL ;//it's just a dummy ;-) ( see Set_Selected() )
|
||||||
visual_partitions.back( ) ->length = 0 ; //keeps total_length clean
|
visual_partitions.back( ) ->length = 0 ; //keeps total_length clean
|
||||||
|
@ -126,7 +126,7 @@ void VBox_VisualDisk::Create_Visual_Partition( const Partition & partition )
|
||||||
|
|
||||||
visual_partitions .back( ) ->length = static_cast<int> ( SCREEN_WIDTH / ( device_length / static_cast<double>(partition .sector_end - partition .sector_start) ) );
|
visual_partitions .back( ) ->length = static_cast<int> ( SCREEN_WIDTH / ( device_length / static_cast<double>(partition .sector_end - partition .sector_start) ) );
|
||||||
if ( visual_partitions .back( ) ->length < 20 )//we need a min. size. Otherwise some small partitions wouldn't be visible
|
if ( visual_partitions .back( ) ->length < 20 )//we need a min. size. Otherwise some small partitions wouldn't be visible
|
||||||
visual_partitions .back( ) ->length = ( partition .type == GParted::UNALLOCATED ) ? 15 : 20 ;
|
visual_partitions .back( ) ->length = ( partition .type == GParted::TYPE_UNALLOCATED ) ? 15 : 20 ;
|
||||||
|
|
||||||
if ( partition .inside_extended )
|
if ( partition .inside_extended )
|
||||||
{
|
{
|
||||||
|
@ -139,7 +139,7 @@ void VBox_VisualDisk::Create_Visual_Partition( const Partition & partition )
|
||||||
visual_partitions .back( ) ->text_y = 15 ;
|
visual_partitions .back( ) ->text_y = 15 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( partition .type == GParted::UNALLOCATED )
|
if ( partition .type == GParted::TYPE_UNALLOCATED )
|
||||||
visual_partitions .back( ) ->used = -1;
|
visual_partitions .back( ) ->used = -1;
|
||||||
else
|
else
|
||||||
visual_partitions .back( ) ->used = static_cast<int>( (visual_partitions .back( ) ->length - (BORDER *2)) / ( static_cast<double>(partition .sector_end - partition .sector_start) / partition .sectors_used ) );
|
visual_partitions .back( ) ->used = static_cast<int>( (visual_partitions .back( ) ->length - (BORDER *2)) / ( static_cast<double>(partition .sector_end - partition .sector_start) / partition .sectors_used ) );
|
||||||
|
@ -166,21 +166,21 @@ void VBox_VisualDisk::Create_Visual_Partition( const Partition & partition )
|
||||||
|
|
||||||
//tooltip
|
//tooltip
|
||||||
str_temp = "" ;
|
str_temp = "" ;
|
||||||
if ( partition .type != GParted::UNALLOCATED )
|
if ( partition .type != GParted::TYPE_UNALLOCATED )
|
||||||
str_temp = partition .filesystem + "\n" ;
|
str_temp = Get_Filesystem_String( partition .filesystem ) + "\n" ;
|
||||||
|
|
||||||
str_temp += partition .partition + "\n" + String::ucompose( _("%1 MB"), partition .Get_Length_MB( ) ) ;
|
str_temp += partition .partition + "\n" + String::ucompose( _("%1 MB"), partition .Get_Length_MB( ) ) ;
|
||||||
tooltips .set_tip( *( visual_partitions.back( ) ->drawingarea ), str_temp ) ;
|
tooltips .set_tip( *( visual_partitions.back( ) ->drawingarea ), str_temp ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VBox_VisualDisk::Prepare_Legend( std::vector<Glib::ustring> & legend, const std::vector<Partition> & partitions )
|
void VBox_VisualDisk::Prepare_Legend( std::vector<GParted::FILESYSTEM> & legend, const std::vector<Partition> & partitions )
|
||||||
{
|
{
|
||||||
for ( unsigned int t = 0 ; t < partitions .size( ) ; t++ )
|
for ( unsigned int t = 0 ; t < partitions .size( ) ; t++ )
|
||||||
{
|
{
|
||||||
if ( std::find( legend .begin( ), legend .end( ), partitions[ t ] .filesystem ) == legend .end( ) )
|
if ( std::find( legend .begin( ), legend .end( ), partitions[ t ] .filesystem ) == legend .end( ) )
|
||||||
legend .push_back( partitions[ t ] .filesystem );
|
legend .push_back( partitions[ t ] .filesystem );
|
||||||
|
|
||||||
if ( partitions[ t ] .type == GParted::EXTENDED )
|
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
|
||||||
Prepare_Legend( legend, partitions[ t ] .logicals ) ;
|
Prepare_Legend( legend, partitions[ t ] .logicals ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,13 +196,13 @@ void VBox_VisualDisk::Build_Legend( )
|
||||||
frame_disk_legend ->add( *hbox_legend ) ;
|
frame_disk_legend ->add( *hbox_legend ) ;
|
||||||
this ->pack_start( hbox_legend_main );
|
this ->pack_start( hbox_legend_main );
|
||||||
|
|
||||||
std::vector<Glib::ustring> legend ;
|
std::vector<GParted::FILESYSTEM> legend ;
|
||||||
Prepare_Legend( legend, partitions ) ;
|
Prepare_Legend( legend, partitions ) ;
|
||||||
|
|
||||||
bool hide_used_unused = true;
|
bool hide_used_unused = true;
|
||||||
for ( unsigned int t = 0 ; t < legend .size( ) ; t++ )
|
for ( unsigned int t = 0 ; t < legend .size( ) ; t++ )
|
||||||
{
|
{
|
||||||
if ( legend[ t ] != "---" && legend[ t ] != "extended" && legend[ t ] != "linux-swap" )
|
if ( legend[ t ] != GParted::FS_UNALLOCATED && legend[ t ] != GParted::FS_EXTENDED && legend[ t ] != GParted::FS_LINUX_SWAP )
|
||||||
hide_used_unused = false ;
|
hide_used_unused = false ;
|
||||||
|
|
||||||
if ( t )
|
if ( t )
|
||||||
|
@ -212,13 +212,13 @@ void VBox_VisualDisk::Build_Legend( )
|
||||||
|
|
||||||
hbox_legend ->pack_start( * mk_label( "██ ", false, false, false, Get_Color( legend[ t ] ) ), Gtk::PACK_SHRINK );
|
hbox_legend ->pack_start( * mk_label( "██ ", false, false, false, Get_Color( legend[ t ] ) ), Gtk::PACK_SHRINK );
|
||||||
|
|
||||||
if ( legend[ t ] == "---" )
|
if ( legend[ t ] == GParted::FS_UNALLOCATED )
|
||||||
{
|
{
|
||||||
str_temp = _("unallocated") ;
|
str_temp = Get_Filesystem_String( GParted::FS_UNALLOCATED ) ;//_("unallocated") ;
|
||||||
hbox_legend ->pack_start( * mk_label( str_temp + " " ), Gtk::PACK_SHRINK );
|
hbox_legend ->pack_start( * mk_label( str_temp + " " ), Gtk::PACK_SHRINK );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
hbox_legend ->pack_start( * mk_label( legend[ t ] + " " ), Gtk::PACK_SHRINK );
|
hbox_legend ->pack_start( * mk_label( Get_Filesystem_String( legend[ t ] ) + " " ), Gtk::PACK_SHRINK );
|
||||||
}
|
}
|
||||||
|
|
||||||
//if there are any partitions add used/unused
|
//if there are any partitions add used/unused
|
||||||
|
@ -248,7 +248,7 @@ void VBox_VisualDisk::Set_Selected( const Partition & partition )
|
||||||
if ( temp >= 0 ) //prevent segfault at firsttime selection
|
if ( temp >= 0 ) //prevent segfault at firsttime selection
|
||||||
drawingarea_on_expose( NULL, visual_partitions[ temp ] ) ;
|
drawingarea_on_expose( NULL, visual_partitions[ temp ] ) ;
|
||||||
|
|
||||||
if ( partition.type == GParted::EXTENDED )
|
if ( partition.type == GParted::TYPE_EXTENDED )
|
||||||
return; //extended can not be selected in visualdisk (yet )
|
return; //extended can not be selected in visualdisk (yet )
|
||||||
|
|
||||||
//now set new selected one
|
//now set new selected one
|
||||||
|
@ -271,7 +271,6 @@ void VBox_VisualDisk::drawingarea_on_realize( Visual_Partition* vp )
|
||||||
//eventmasks necessary for tooltips
|
//eventmasks necessary for tooltips
|
||||||
vp ->drawingarea ->add_events( Gdk::ENTER_NOTIFY_MASK );
|
vp ->drawingarea ->add_events( Gdk::ENTER_NOTIFY_MASK );
|
||||||
vp ->drawingarea ->add_events( Gdk::LEAVE_NOTIFY_MASK );
|
vp ->drawingarea ->add_events( Gdk::LEAVE_NOTIFY_MASK );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VBox_VisualDisk::drawingarea_on_expose( GdkEventExpose * ev, Visual_Partition* vp )
|
bool VBox_VisualDisk::drawingarea_on_expose( GdkEventExpose * ev, Visual_Partition* vp )
|
||||||
|
|
|
@ -208,11 +208,11 @@ void Win_GParted::init_convert_menu()
|
||||||
hbox ->pack_start( *entry, Gtk::PACK_SHRINK );
|
hbox ->pack_start( *entry, Gtk::PACK_SHRINK );
|
||||||
|
|
||||||
//the label...
|
//the label...
|
||||||
hbox ->pack_start( * mk_label( " " + gparted_core .get_filesystems( )[ t ] .filesystem ), Gtk::PACK_SHRINK );
|
hbox ->pack_start( * mk_label( " " + Get_Filesystem_String( gparted_core .get_filesystems( )[ t ] .filesystem ) ), Gtk::PACK_SHRINK );
|
||||||
|
|
||||||
menu_item = manage( new Gtk::MenuItem( *hbox ) ) ;
|
menu_item = manage( new Gtk::MenuItem( *hbox ) ) ;
|
||||||
menu_convert.items( ) .push_back( *menu_item );
|
menu_convert.items( ) .push_back( *menu_item );
|
||||||
menu_convert.items( ) .back( ) .signal_activate( ) .connect( sigc::bind<Glib::ustring>(sigc::mem_fun(*this, &Win_GParted::activate_convert), gparted_core .get_filesystems( )[ t ] .filesystem ) ) ;
|
menu_convert.items( ) .back( ) .signal_activate( ) .connect( sigc::bind<GParted::FILESYSTEM>(sigc::mem_fun(*this, &Win_GParted::activate_convert), gparted_core .get_filesystems( )[ t ] .filesystem ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_convert.show_all_children() ;
|
menu_convert.show_all_children() ;
|
||||||
|
@ -513,13 +513,18 @@ void Win_GParted::Refresh_Visual( )
|
||||||
|
|
||||||
switch ( partitions[ t ] .type )
|
switch ( partitions[ t ] .type )
|
||||||
{
|
{
|
||||||
case GParted::PRIMARY : primary_count++;
|
case GParted::TYPE_PRIMARY :
|
||||||
|
primary_count++;
|
||||||
break;
|
break;
|
||||||
case GParted::EXTENDED : any_extended = true;
|
|
||||||
|
case GParted::TYPE_EXTENDED :
|
||||||
|
any_extended = true;
|
||||||
primary_count++;
|
primary_count++;
|
||||||
any_logic = partitions[ t ] .logicals .size( ) -1 ;
|
any_logic = partitions[ t ] .logicals .size( ) -1 ;
|
||||||
break;
|
break;
|
||||||
default : break;
|
|
||||||
|
default :
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -580,14 +585,14 @@ void Win_GParted::Set_Valid_Operations( )
|
||||||
//only unmount is allowed
|
//only unmount is allowed
|
||||||
if ( selected_partition .busy )
|
if ( selected_partition .busy )
|
||||||
{
|
{
|
||||||
if ( selected_partition .filesystem != "linux-swap" && selected_partition .type != GParted::EXTENDED )
|
if ( selected_partition .filesystem != GParted::FS_LINUX_SWAP && selected_partition .type != GParted::TYPE_EXTENDED )
|
||||||
allow_unmount( true ) ;
|
allow_unmount( true ) ;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//UNALLOCATED
|
//UNALLOCATED
|
||||||
if ( selected_partition .type == GParted::UNALLOCATED )
|
if ( selected_partition .type == GParted::TYPE_UNALLOCATED )
|
||||||
{
|
{
|
||||||
allow_new( true );
|
allow_new( true );
|
||||||
|
|
||||||
|
@ -595,7 +600,7 @@ void Win_GParted::Set_Valid_Operations( )
|
||||||
if ( ! copied_partition .partition .empty( ) && ! devices[ current_device ] .readonly )
|
if ( ! copied_partition .partition .empty( ) && ! devices[ current_device ] .readonly )
|
||||||
{
|
{
|
||||||
if ( (copied_partition .Get_Length_MB( ) + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB( ) ||
|
if ( (copied_partition .Get_Length_MB( ) + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB( ) ||
|
||||||
(copied_partition .filesystem == "xfs" && (copied_partition .Get_Used_MB( ) + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB( ) )
|
(copied_partition .filesystem == GParted::FS_XFS && (copied_partition .Get_Used_MB( ) + devices[ current_device ] .cylsize) < selected_partition .Get_Length_MB( ) )
|
||||||
)
|
)
|
||||||
allow_paste( true ) ;
|
allow_paste( true ) ;
|
||||||
}
|
}
|
||||||
|
@ -604,7 +609,7 @@ void Win_GParted::Set_Valid_Operations( )
|
||||||
}
|
}
|
||||||
|
|
||||||
//EXTENDED
|
//EXTENDED
|
||||||
if ( selected_partition .type == GParted::EXTENDED )
|
if ( selected_partition .type == GParted::TYPE_EXTENDED )
|
||||||
{
|
{
|
||||||
if ( ! any_logic ) //deletion is only allowed when there are no logical partitions inside.
|
if ( ! any_logic ) //deletion is only allowed when there are no logical partitions inside.
|
||||||
allow_delete( true ) ;
|
allow_delete( true ) ;
|
||||||
|
@ -616,7 +621,7 @@ void Win_GParted::Set_Valid_Operations( )
|
||||||
}
|
}
|
||||||
|
|
||||||
//PRIMARY and LOGICAL
|
//PRIMARY and LOGICAL
|
||||||
if ( selected_partition .type == GParted::PRIMARY || selected_partition .type == GParted::LOGICAL )
|
if ( selected_partition .type == GParted::TYPE_PRIMARY || selected_partition .type == GParted::TYPE_LOGICAL )
|
||||||
{
|
{
|
||||||
fs = gparted_core .get_fs( selected_partition .filesystem ) ;
|
fs = gparted_core .get_fs( selected_partition .filesystem ) ;
|
||||||
|
|
||||||
|
@ -892,7 +897,7 @@ void Win_GParted::mouse_click( GdkEventButton *event, const Partition & partitio
|
||||||
else if ( event ->button == 3 ) //right-click
|
else if ( event ->button == 3 ) //right-click
|
||||||
{
|
{
|
||||||
//prepare convert menu
|
//prepare convert menu
|
||||||
if ( selected_partition .type != GParted::UNALLOCATED )
|
if ( selected_partition .type != GParted::TYPE_UNALLOCATED )
|
||||||
Set_Valid_Convert_Filesystems( ) ;
|
Set_Valid_Convert_Filesystems( ) ;
|
||||||
|
|
||||||
menu_partition .popup( event ->button, event ->time );
|
menu_partition .popup( event ->button, event ->time );
|
||||||
|
@ -920,7 +925,7 @@ bool Win_GParted::max_amount_prim_reached( )
|
||||||
void Win_GParted::activate_resize( )
|
void Win_GParted::activate_resize( )
|
||||||
{
|
{
|
||||||
//show warning when one tries to resize a fat16 filesystem
|
//show warning when one tries to resize a fat16 filesystem
|
||||||
if ( selected_partition .filesystem == "fat16" )
|
if ( selected_partition .filesystem == GParted::FS_FAT16 )
|
||||||
{
|
{
|
||||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||||
str_temp += _( "Are you sure you want to resize/move this partition?" ) ;
|
str_temp += _( "Are you sure you want to resize/move this partition?" ) ;
|
||||||
|
@ -954,10 +959,10 @@ void Win_GParted::activate_resize( )
|
||||||
|
|
||||||
Dialog_Partition_Resize_Move dialog( gparted_core .get_fs( selected_partition .filesystem ), devices[ current_device ] .cylsize ) ;
|
Dialog_Partition_Resize_Move dialog( gparted_core .get_fs( selected_partition .filesystem ), devices[ current_device ] .cylsize ) ;
|
||||||
|
|
||||||
if ( selected_partition .type == GParted::LOGICAL )
|
if ( selected_partition .type == GParted::TYPE_LOGICAL )
|
||||||
{
|
{
|
||||||
unsigned int ext = 0 ;
|
unsigned int ext = 0 ;
|
||||||
while ( ext < partitions .size( ) && partitions[ ext ] .type != GParted::EXTENDED ) ext++ ;
|
while ( ext < partitions .size( ) && partitions[ ext ] .type != GParted::TYPE_EXTENDED ) ext++ ;
|
||||||
dialog .Set_Data( selected_partition, partitions[ ext ] .logicals );
|
dialog .Set_Data( selected_partition, partitions[ ext ] .logicals );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -970,7 +975,7 @@ void Win_GParted::activate_resize( )
|
||||||
dialog .hide( ) ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation)
|
dialog .hide( ) ;//i want to be sure the dialog is gone _before_ operationslist shows up (only matters if first operation)
|
||||||
|
|
||||||
//if selected_partition is NEW we simply remove the NEW operation from the list and add it again with the new size and position ( unless it's an EXTENDED )
|
//if selected_partition is NEW we simply remove the NEW operation from the list and add it again with the new size and position ( unless it's an EXTENDED )
|
||||||
if ( selected_partition .status == GParted::STAT_NEW && selected_partition.type != GParted::EXTENDED )
|
if ( selected_partition .status == GParted::STAT_NEW && selected_partition.type != GParted::TYPE_EXTENDED )
|
||||||
{
|
{
|
||||||
//remove operation which creates this partition
|
//remove operation which creates this partition
|
||||||
for ( unsigned int t = 0 ; t < operations .size( ) ; t++ )
|
for ( unsigned int t = 0 ; t < operations .size( ) ; t++ )
|
||||||
|
@ -1041,7 +1046,7 @@ void Win_GParted::activate_delete( )
|
||||||
//e.g. consider /dev/hda5 /dev/hda6 /dev/hda7. Now after removal of /dev/hda6, /dev/hda7 is renumbered to /dev/hda6
|
//e.g. consider /dev/hda5 /dev/hda6 /dev/hda7. Now after removal of /dev/hda6, /dev/hda7 is renumbered to /dev/hda6
|
||||||
//the new situation is now /dev/hda5 /dev/hda6. If /dev/hda7 was mounted the OS cannot find /dev/hda7 anymore and the results aren't that pretty
|
//the new situation is now /dev/hda5 /dev/hda6. If /dev/hda7 was mounted the OS cannot find /dev/hda7 anymore and the results aren't that pretty
|
||||||
//it seems best to check for this and prohibit deletion with some explanation to the user.
|
//it seems best to check for this and prohibit deletion with some explanation to the user.
|
||||||
if ( selected_partition .type == GParted::LOGICAL &&
|
if ( selected_partition .type == GParted::TYPE_LOGICAL &&
|
||||||
selected_partition .status != GParted::STAT_NEW &&
|
selected_partition .status != GParted::STAT_NEW &&
|
||||||
selected_partition .partition_number < devices [ current_device ] .highest_busy )
|
selected_partition .partition_number < devices [ current_device ] .highest_busy )
|
||||||
{
|
{
|
||||||
|
@ -1111,11 +1116,11 @@ void Win_GParted::activate_info( )
|
||||||
dialog .run( );
|
dialog .run( );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::activate_convert( const Glib::ustring & new_fs )
|
void Win_GParted::activate_convert( GParted::FILESYSTEM new_fs )
|
||||||
{
|
{
|
||||||
//standard warning..
|
//standard warning..
|
||||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||||
str_temp += String::ucompose( _("Are you sure you want to convert this filesystem to %1?"), new_fs ) + "</span>\n\n" ;
|
str_temp += String::ucompose( _("Are you sure you want to convert this filesystem to %1?"), Get_Filesystem_String( new_fs ) ) + "</span>\n\n" ;
|
||||||
str_temp += String::ucompose( _("This operation will destroy all data on %1"), selected_partition .partition ) ;
|
str_temp += String::ucompose( _("This operation will destroy all data on %1"), selected_partition .partition ) ;
|
||||||
|
|
||||||
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_CANCEL, true );
|
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_CANCEL, true );
|
||||||
|
@ -1134,13 +1139,13 @@ void Win_GParted::activate_convert( const Glib::ustring & new_fs )
|
||||||
if ( selected_partition .Get_Length_MB( ) < fs .MIN || ( fs .MAX && selected_partition .Get_Length_MB( ) > fs .MAX ) )
|
if ( selected_partition .Get_Length_MB( ) < fs .MIN || ( fs .MAX && selected_partition .Get_Length_MB( ) > fs .MAX ) )
|
||||||
{
|
{
|
||||||
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
str_temp = "<span weight=\"bold\" size=\"larger\">" ;
|
||||||
str_temp += String::ucompose( _("Can not convert this filesystem to %1."), new_fs ) ;
|
str_temp += String::ucompose( _("Can not convert this filesystem to %1."), Get_Filesystem_String( new_fs ) ) ;
|
||||||
str_temp += "</span>\n\n" ;
|
str_temp += "</span>\n\n" ;
|
||||||
|
|
||||||
if ( selected_partition .Get_Length_MB( ) < fs .MIN )
|
if ( selected_partition .Get_Length_MB( ) < fs .MIN )
|
||||||
str_temp += String::ucompose( _( "A %1 filesystem requires a partition of at least %2 MB."), new_fs, fs .MIN ) ;
|
str_temp += String::ucompose( _( "A %1 filesystem requires a partition of at least %2 MB."), Get_Filesystem_String( new_fs ), fs .MIN ) ;
|
||||||
else
|
else
|
||||||
str_temp += String::ucompose( _( "A partition with a %1 filesystem has a maximum size of %2 MB."), new_fs, fs .MAX ) ;
|
str_temp += String::ucompose( _( "A partition with a %1 filesystem has a maximum size of %2 MB."), Get_Filesystem_String( new_fs ), fs .MAX ) ;
|
||||||
|
|
||||||
|
|
||||||
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true );
|
Gtk::MessageDialog dialog( *this, str_temp, true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true );
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS ext2::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "ext2" ;
|
fs .filesystem = GParted::FS_EXT2 ;
|
||||||
if ( ! system( "which dumpe2fs 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which dumpe2fs 1>/dev/null 2>/dev/null" ) )
|
||||||
fs .read = GParted::FS::EXTERNAL ;
|
fs .read = GParted::FS::EXTERNAL ;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS ext3::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "ext3" ;
|
fs .filesystem = GParted::FS_EXT3 ;
|
||||||
if ( ! system( "which dumpe2fs 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which dumpe2fs 1>/dev/null 2>/dev/null" ) )
|
||||||
fs .read = GParted::FS::EXTERNAL ;
|
fs .read = GParted::FS::EXTERNAL ;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS fat16::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "fat16" ;
|
fs .filesystem = GParted::FS_FAT16 ;
|
||||||
|
|
||||||
//find out if we can create fat16 filesystems
|
//find out if we can create fat16 filesystems
|
||||||
if ( ! system( "which mkdosfs 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which mkdosfs 1>/dev/null 2>/dev/null" ) )
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS fat32::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "fat32" ;
|
fs .filesystem = GParted::FS_FAT32 ;
|
||||||
|
|
||||||
//find out if we can create fat32 filesystems
|
//find out if we can create fat32 filesystems
|
||||||
if ( ! system( "which mkdosfs 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which mkdosfs 1>/dev/null 2>/dev/null" ) )
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS hfs::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "hfs" ;
|
fs .filesystem = GParted::FS_HFS ;
|
||||||
|
|
||||||
fs .read = GParted::FS::LIBPARTED; //provided by libparted
|
fs .read = GParted::FS::LIBPARTED; //provided by libparted
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS hfsplus::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "hfs+" ;
|
fs .filesystem = GParted::FS_HFSPLUS ;
|
||||||
|
|
||||||
fs .read = GParted::FS::LIBPARTED ; //provided by libparted
|
fs .read = GParted::FS::LIBPARTED ; //provided by libparted
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS jfs::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "jfs" ;
|
fs .filesystem = GParted::FS_JFS ;
|
||||||
|
|
||||||
if ( ! system( "which jfs_debugfs 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which jfs_debugfs 1>/dev/null 2>/dev/null" ) )
|
||||||
fs .read = GParted::FS::EXTERNAL ;
|
fs .read = GParted::FS::EXTERNAL ;
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS linux_swap::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "linux-swap" ;
|
fs .filesystem = GParted::FS_LINUX_SWAP ;
|
||||||
|
|
||||||
if ( ! system( "which mkswap 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which mkswap 1>/dev/null 2>/dev/null" ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS ntfs::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "ntfs" ;
|
fs .filesystem = GParted::FS_NTFS ;
|
||||||
if ( ! system( "which ntfscluster 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which ntfscluster 1>/dev/null 2>/dev/null" ) )
|
||||||
fs .read = GParted::FS::EXTERNAL ;
|
fs .read = GParted::FS::EXTERNAL ;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS reiser4::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "reiser4" ;
|
fs .filesystem = GParted::FS_REISER4 ;
|
||||||
|
|
||||||
if ( ! system( "which debugfs.reiser4 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which debugfs.reiser4 1>/dev/null 2>/dev/null" ) )
|
||||||
fs .read = GParted::FS::EXTERNAL ;
|
fs .read = GParted::FS::EXTERNAL ;
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS reiserfs::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "reiserfs" ;
|
fs .filesystem = GParted::FS_REISERFS ;
|
||||||
|
|
||||||
if ( ! system( "which debugreiserfs 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which debugreiserfs 1>/dev/null 2>/dev/null" ) )
|
||||||
fs .read = GParted::FS::EXTERNAL ;
|
fs .read = GParted::FS::EXTERNAL ;
|
||||||
|
|
|
@ -25,7 +25,7 @@ FS xfs::get_filesystem_support( )
|
||||||
{
|
{
|
||||||
FS fs ;
|
FS fs ;
|
||||||
|
|
||||||
fs .filesystem = "xfs" ;
|
fs .filesystem = GParted::FS_XFS ;
|
||||||
|
|
||||||
if ( ! system( "which xfs_db 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which xfs_db 1>/dev/null 2>/dev/null" ) )
|
||||||
fs .read = GParted::FS::EXTERNAL ;
|
fs .read = GParted::FS::EXTERNAL ;
|
||||||
|
|
Loading…
Reference in New Issue