From dd1f3d8b423be696e93b183b72fc7d472afc40e3 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Sat, 30 Oct 2004 22:17:20 +0000 Subject: [PATCH] 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. --- ChangeLog | 10 ++++++++++ configure.in | 5 ++++- include/Partition.h | 3 +-- include/Utils.h | 31 +++++++++++++++++++++++++++++++ src/Device.cc | 3 ++- src/Dialog_Partition_New.cc | 4 ++-- src/Partition.cc | 31 ------------------------------- src/Win_GParted.cc | 2 +- 8 files changed, 51 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3197d81a..e1e398d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-10-30 Bart Hakvoort + + * 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 * debian/*: Added a debian subdir. This dir contains buildscripts diff --git a/configure.in b/configure.in index 8583b996..fbe768ba 100644 --- a/configure.in +++ b/configure.in @@ -29,8 +29,11 @@ AC_PROG_INTLTOOL dnl====================== dnl checks for libs 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) -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 AC_MSG_ERROR([*** libparted >= 1.6.13 not installed - get it from http://www.gnu.org/software/parted/ ***]) fi diff --git a/include/Partition.h b/include/Partition.h index 72eb28c2..1dfddf35 100644 --- a/include/Partition.h +++ b/include/Partition.h @@ -72,8 +72,7 @@ public: void Set_Unallocated( Sector sector_start, Sector sector_end, bool inside_extended ); //get color associated with filesystem - Glib::ustring Get_Color( const Glib::ustring & filesystem ); - + //update partition number (used when a logical partition is deleted) void Update_Number( int new_number ); diff --git a/include/Utils.h b/include/Utils.h index cb7c5d3a..9718de06 100644 --- a/include/Utils.h +++ b/include/Utils.h @@ -100,6 +100,37 @@ inline bool Supported( const Glib::ustring & filesystem, std::vector *FILESY 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 diff --git a/src/Device.cc b/src/Device.cc index f50bb842..9d83b9f5 100644 --- a/src/Device.cc +++ b/src/Device.cc @@ -56,7 +56,8 @@ Glib::ustring get_sym_path( const Glib::ustring & real_path ) Glib::ustring error_message; PedExceptionOption PedException_Handler (PedException* ex) { - error_message = ex ->message ; + error_message = Glib::locale_to_utf8( ex ->message ) ; + std::cout << error_message << "\n---------------------------\n" ; return PED_EXCEPTION_UNHANDLED ; diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc index 193febb1..e89cfa6e 100644 --- a/src/Dialog_Partition_New.cc +++ b/src/Dialog_Partition_New.cc @@ -28,7 +28,7 @@ Dialog_Partition_New::Dialog_Partition_New( ) Set_Confirm_Button( NEW ) ; //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 ) ; //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 ); //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 ->Draw_Partition() ; diff --git a/src/Partition.cc b/src/Partition.cc index bb84c44e..2786c457 100644 --- a/src/Partition.cc +++ b/src/Partition.cc @@ -69,37 +69,6 @@ void Partition::Set_Unallocated( Sector sector_start, Sector sector_end, bool in 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 ) { //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 ) ; diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index d7a8fbb0..de0d7fb0 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -184,7 +184,7 @@ void Win_GParted::init_convert_menu() { 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() ); //the colored square