added checks for libuuid and libdl. Also refined libparted check a bit.

* configure.in: added checks for libuuid and libdl. Also refined libparted check a bit.
* include/Partition.h,
  src/Partition.cc: removed Get_Color()
* include/Utils.h: added inline Glib::ustring Get_Color( const Glib::ustring & filesystem )
* src/Dialog_Partition_New.cc,
  src/Win_GParted.cc: make use of Get_Color from Utils.h
* src/Device.cc: fixed a crasher with (at least) pl_PL locale.
This commit is contained in:
Bart Hakvoort 2004-10-30 22:17:20 +00:00
parent 7a77504f57
commit dd1f3d8b42
8 changed files with 51 additions and 38 deletions

View File

@ -1,3 +1,13 @@
2004-10-30 Bart Hakvoort <gparted@users.sf.net>
* configure.in: added checks for libuuid and libdl. Also refined libparted check a bit.
* include/Partition.h,
src/Partition.cc: removed Get_Color()
* include/Utils.h: added inline Glib::ustring Get_Color( const Glib::ustring & filesystem )
* src/Dialog_Partition_New.cc,
src/Win_GParted.cc: make use of Get_Color from Utils.h
* src/Device.cc: fixed a crasher with (at least) pl_PL locale.
2004-10-25 Vincent van Adrighem <adrighem@gnome.org> 2004-10-25 Vincent van Adrighem <adrighem@gnome.org>
* debian/*: Added a debian subdir. This dir contains buildscripts * debian/*: Added a debian subdir. This dir contains buildscripts

View File

@ -29,8 +29,11 @@ AC_PROG_INTLTOOL
dnl====================== dnl======================
dnl checks for libs dnl checks for libs
dnl====================== dnl======================
AC_CHECK_LIB(uuid, uuid_generate, [], AC_MSG_ERROR([*** uuid library (libuuid) not found]))
AC_CHECK_LIB(dl, dlopen, [], AC_MSG_ERROR([*** dl library (libdl) not found]))
AC_PATH_PROG(PARTED_PATH, parted, [], /sbin /usr/sbin /usr/local/sbin) AC_PATH_PROG(PARTED_PATH, parted, [], /sbin /usr/sbin /usr/local/sbin)
if ! (( ($( $PARTED_PATH --version | cut -d. -f3 )) > 12 )) 2>/dev/null if ! (( ($( $PARTED_PATH --version | cut -d. -f3 | cut -d' ' -f1 )) > 12 )) 2>/dev/null
then then
AC_MSG_ERROR([*** libparted >= 1.6.13 not installed - get it from http://www.gnu.org/software/parted/ ***]) AC_MSG_ERROR([*** libparted >= 1.6.13 not installed - get it from http://www.gnu.org/software/parted/ ***])
fi fi

View File

@ -72,8 +72,7 @@ public:
void Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended ); void Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended );
//get color associated with filesystem //get color associated with filesystem
Glib::ustring Get_Color( const Glib::ustring & filesystem );
//update partition number (used when a logical partition is deleted) //update partition number (used when a logical partition is deleted)
void Update_Number( int new_number ); void Update_Number( int new_number );

View File

@ -100,6 +100,37 @@ inline bool Supported( const Glib::ustring & filesystem, std::vector<FS> *FILESY
return false ; return false ;
} }
inline Glib::ustring Get_Color( const Glib::ustring & filesystem )
{
//blue teints
if ( filesystem == "ext2" ) return "#9DB8D2" ;
else if ( filesystem == "ext3" ) return "#7590AE" ;
//redbrown
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" ;
//libparted can only detect these, i decided to "yellow them" :^)
else if ( filesystem == "HFS" ) return "yellow" ;
else if ( filesystem == "JFS" ) return "yellow" ;
else if ( filesystem == "UFS" ) return "yellow" ;
else if ( filesystem == "XFS" ) return "yellow" ;
//darkgrey and ligthblue
else if ( filesystem == "unallocated" ) return "darkgrey";
else if ( filesystem == "extended" ) return "#7DFCFE" ;
//unknown filesystem ( damaged, unknown or simply no filesystem )
else return "black";
}
}//GParted }//GParted

View File

@ -56,7 +56,8 @@ Glib::ustring get_sym_path( const Glib::ustring & real_path )
Glib::ustring error_message; Glib::ustring error_message;
PedExceptionOption PedException_Handler (PedException* ex) PedExceptionOption PedException_Handler (PedException* ex)
{ {
error_message = ex ->message ; error_message = Glib::locale_to_utf8( ex ->message ) ;
std::cout << error_message << "\n---------------------------\n" ; std::cout << error_message << "\n---------------------------\n" ;
return PED_EXCEPTION_UNHANDLED ; return PED_EXCEPTION_UNHANDLED ;

View File

@ -28,7 +28,7 @@ Dialog_Partition_New::Dialog_Partition_New( )
Set_Confirm_Button( NEW ) ; Set_Confirm_Button( NEW ) ;
//set partition color //set partition color
color_temp .set( selected_partition .Get_Color( "ext2" ) ) ; color_temp .set( Get_Color( "ext2" ) ) ;
frame_resizer_base ->set_rgb_partition_color( color_temp ) ; frame_resizer_base ->set_rgb_partition_color( color_temp ) ;
//set the resizer.. //set the resizer..
@ -209,7 +209,7 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
frame_resizer_base ->override_default_rgb_unused_color( color_temp ); frame_resizer_base ->override_default_rgb_unused_color( color_temp );
//partitioncolor.. //partitioncolor..
color_temp .set( selected_partition .Get_Color( FILESYSTEMS[ optionmenu_filesystem.get_history() ] .filesystem ) ) ; color_temp .set( Get_Color( FILESYSTEMS[ optionmenu_filesystem.get_history() ] .filesystem ) ) ;
frame_resizer_base ->set_rgb_partition_color( color_temp ) ; frame_resizer_base ->set_rgb_partition_color( color_temp ) ;
frame_resizer_base ->Draw_Partition() ; frame_resizer_base ->Draw_Partition() ;

View File

@ -69,37 +69,6 @@ void Partition::Set_Unallocated( Sector sector_start, Sector sector_end, bool in
this ->status = GParted::STAT_REAL ; this ->status = GParted::STAT_REAL ;
} }
Glib::ustring Partition::Get_Color( const Glib::ustring & filesystem )
{ // very ugly, but somehow i can't figure out a more efficient way. must be lack of sleep or so... :-)
//blue teints
if ( filesystem == "ext2" ) return "#9DB8D2" ;
else if ( filesystem == "ext3" ) return "#7590AE" ;
//redbrown
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" ;
//libparted can only detect these, i decided to "yellow them" :^)
else if ( filesystem == "HFS" ) return "yellow" ;
else if ( filesystem == "JFS" ) return "yellow" ;
else if ( filesystem == "UFS" ) return "yellow" ;
else if ( filesystem == "XFS" ) return "yellow" ;
//darkgrey and ligthblue
else if ( filesystem == "unallocated" ) return "darkgrey";
else if ( filesystem == "extended" ) return "#7DFCFE" ;
//unknown filesystem ( damaged, unknown or simply no filesystem )
else return "black";
}
void Partition::Update_Number( int new_number ) void Partition::Update_Number( int new_number )
{ //of course this fails when we have devicenames with numbers over 99 { //of course this fails when we have devicenames with numbers over 99
partition_number >= 10 ? partition = partition.substr( 0, partition.length() -2 ) : partition = partition.substr( 0, partition.length() -1 ) ; partition_number >= 10 ? partition = partition.substr( 0, partition.length() -2 ) : partition = partition.substr( 0, partition.length() -1 ) ;

View File

@ -184,7 +184,7 @@ void Win_GParted::init_convert_menu()
{ {
for ( unsigned int t=0; t < FILESYSTEMS .size() ; t++ ) for ( unsigned int t=0; t < FILESYSTEMS .size() ; t++ )
{ {
color .set( selected_partition .Get_Color( FILESYSTEMS[ t ] .filesystem ) ); color .set( Get_Color( FILESYSTEMS[ t ] .filesystem ) );
hbox = manage( new Gtk::HBox() ); hbox = manage( new Gtk::HBox() );
//the colored square //the colored square