diff --git a/ChangeLog b/ChangeLog index 13fab28b..5e6516c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-09-28 Bart Hakvoort + + * src/VBox_VisualDisk.cc: marked 2 minor strings for translation (is a duplicate of an existing string in POT file) + * src/Dialog_About.cc: made names (author/translators) selectable + * include/Dialog_Partition_Info.h, + src/Dialog_Partition_Info.cc: solved some alignmentproblems which showed up in certain locales. + 2004-09-28 Maxim Dziumanenko * configure.in: Added uk to ALL_LINGUAS. diff --git a/include/Dialog_Partition_Info.h b/include/Dialog_Partition_Info.h index a01fd325..62da510d 100644 --- a/include/Dialog_Partition_Info.h +++ b/include/Dialog_Partition_Info.h @@ -48,6 +48,7 @@ private: void init_drawingarea() ; void Display_Info(); void Find_Status() ; + Gtk::Label * mk_label( const Glib::ustring & text ) ; //signalhandlers void drawingarea_on_realize( ); diff --git a/src/Dialog_About.cc b/src/Dialog_About.cc index 202f58de..49165f6f 100644 --- a/src/Dialog_About.cc +++ b/src/Dialog_About.cc @@ -67,6 +67,7 @@ void Dialog_About::Show_Credits() //written by vbox_written .set_border_width( 5 ) ; label_writers .set_text( "Bart Hakvoort "); + label_writers .set_selectable( true ); label_writers .set_alignment( Gtk::ALIGN_LEFT ) ; vbox_written .pack_start( label_writers, Gtk::PACK_SHRINK ) ; notebook_credits .set_size_request( -1, 200 ) ; @@ -80,7 +81,7 @@ void Dialog_About::Show_Credits() //translated by /*TO TRANSLATORS: your name(s) here please, if there are more translators put newlines (\n) between the names */ label_translators .set_text( _( "translator_credits") ) ; - + label_translators .set_selectable( true ); if ( label_translators .get_text() != "translator_credits" ) { label_translators .set_alignment( Gtk::ALIGN_LEFT ) ; diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc index 280d3299..10885008 100644 --- a/src/Dialog_Partition_Info.cc +++ b/src/Dialog_Partition_Info.cc @@ -123,100 +123,118 @@ void Dialog_Partition_Info::init_drawingarea() color_partition = partition.color ; this ->get_colormap() ->alloc_color( color_partition ) ; //set text of pangolayout - os << partition .partition << "\n" << this -> partition .Get_Length_MB() << " MB"; + os << partition .partition <<"\n" << String::ucompose( _("%1 MB"), partition .Get_Length_MB() ) ; pango_layout = drawingarea .create_pango_layout ( os.str() ) ;os.str(""); } void Dialog_Partition_Info::Display_Info() { + int top =0, bottom = 1; + table = manage( new Gtk::Table() ) ; table ->set_border_width( 5 ) ; table ->set_col_spacings(10 ) ; this ->get_vbox() ->pack_start( *table , Gtk::PACK_SHRINK ) ; - label = manage( new Gtk::Label( "" ) ) ; - - label ->set_text( label ->get_text() + (Glib::ustring) _( "Filesystem:" ) + "\n" ) ; os << partition.filesystem << "\n"; - label ->set_text( label ->get_text() + (Glib::ustring) _( "Size:" ) + "\n" ) ; os << String::ucompose( _("%1 MB"), this -> partition .Get_Length_MB() ) << "\n"; + //filesystem + table ->attach( * mk_label( "" + (Glib::ustring) _( "Filesystem:" ) + "" ) , 0,1,top, bottom ,Gtk::FILL); + table ->attach( * mk_label( partition .filesystem ), 1,2, top++, bottom++, Gtk::FILL); + //size + table ->attach( * mk_label( "" + (Glib::ustring) _( "Size:" ) + "" ), 0,1,top, bottom,Gtk::FILL); + table ->attach( * mk_label( String::ucompose( _("%1 MB"), this ->partition .Get_Length_MB() ) ) , 1,2, top++, bottom++,Gtk::FILL); if ( partition.sectors_used != -1 ) - { - label ->set_text( label ->get_text() + (Glib::ustring) _( "Used:" ) + "\n" ) ; - label ->set_text( label ->get_text() + (Glib::ustring) _( "Unused:" ) + "\n" ) ; - - os << String::ucompose( _("%1 MB"), this -> partition .Get_Used_MB() ) << "\n"; - os << String::ucompose( _("%1 MB"), this -> partition .Get_Unused_MB() ) << "\n"; - + { + //calculate relative diskusage int percent_used =(int) ( (double) partition.Get_Used_MB() / partition .Get_Length_MB() *100 +0.5 ) ; - os_percent << "\n\n( " << percent_used << "% )\n( " << 100 - percent_used << "% )\n\n\n"; + + //used + table ->attach( * mk_label( "" + (Glib::ustring) _( "Used:" ) + "" ), 0,1, top, bottom,Gtk::FILL); + table ->attach( * mk_label( String::ucompose( _("%1 MB"), this ->partition .Get_Used_MB() ) ) , 1,2, top, bottom,Gtk::FILL); + os << percent_used ; + table ->attach( * mk_label( "\t\t\t( " + os.str() + "% )"), 1,2, top++, bottom++,Gtk::FILL); os.str("") ; + + //unused + table ->attach( * mk_label( "" + (Glib::ustring) _( "Unused:" ) + "" ), 0,1, top, bottom,Gtk::FILL); + table ->attach( * mk_label( String::ucompose( _("%1 MB"), this ->partition .Get_Unused_MB() ) ) , 1,2, top, bottom,Gtk::FILL); + os << 100 - percent_used ; + table ->attach( * mk_label( "\t\t\t( " + os.str() + "% )"), 1,2, top++, bottom++,Gtk::FILL); os.str("") ; } - label ->set_text( label ->get_text() + (Glib::ustring) _( "Flags:" ) + "\n\n" ) ; os << partition .flags << "\n\n"; + //flags + if ( partition.type != GParted::UNALLOCATED ) + { + table ->attach( * mk_label( "" + (Glib::ustring) _( "Flags:" ) + "" ), 0,1, top, bottom,Gtk::FILL); + table ->attach( * mk_label( partition .flags ), 1,2, top++, bottom++,Gtk::FILL); + } + + //one blank line + table ->attach( * mk_label( "" ), 1,2, top++, bottom++,Gtk::FILL); if ( partition.type != GParted::UNALLOCATED && partition .status != GParted::STAT_NEW ) { - label ->set_text( label ->get_text() + (Glib::ustring) _("Path:" ) + "\n" ) ; os << partition.partition << "\n"; + //path + table ->attach( * mk_label( "" + (Glib::ustring) _( "Path:" ) + "" ), 0,1, top, bottom,Gtk::FILL); + table ->attach( * mk_label( partition .partition ), 1,2, top++, bottom++,Gtk::FILL); - //get realpath (this sucks) + //realpath (this sucks) char real_path[4096] ; realpath( partition.partition.c_str() , real_path ); //only show realpath if it's diffent from the short path... if ( partition.partition != real_path ) { - label ->set_text( label ->get_text() + (Glib::ustring) _("Real Path:" ) + "\n" ) ; - os << (Glib::ustring) real_path << "\n"; - os_percent << "\n" ; + table ->attach( * mk_label( "" + (Glib::ustring) _( "Real Path:" ) + "" ), 0,1, top, bottom,Gtk::FILL); + table ->attach( * mk_label( real_path ), 1,2, top++, bottom++,Gtk::FILL); } - label ->set_text( label ->get_text() + (Glib::ustring) _("Status:" ) + "\n" ) ; + //status + table ->attach( * mk_label( "" + (Glib::ustring) _( "Status:" ) + "" ), 0,1, top, bottom,Gtk::FILL); if ( partition.busy ) Find_Status() ; else if ( partition.type == GParted::EXTENDED ) - os << (Glib::ustring) _("Not busy (There are no mounted logical partitions)" ) + "\n"; + os << (Glib::ustring) _("Not busy (There are no mounted logical partitions)" ) ; else if ( partition.filesystem == "linux-swap" ) - os << (Glib::ustring) _("Not active" ) + "\n"; + os << (Glib::ustring) _("Not active" ) ; else - os << (Glib::ustring) _("Not mounted" ) + "\n"; + os << (Glib::ustring) _("Not mounted" ) ; - os_percent << "\n\n" ; - - } + table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ; + } - label ->set_text( label ->get_text() + "\n" ) ; os << "\t\t\t\t\n"; //splitter and gives the second column a min. width (needed for %) + //one blank line + table ->attach( * mk_label( "" ), 1,2, top++, bottom++,Gtk::FILL); - label ->set_text( label ->get_text() + (Glib::ustring) _("First Sector:" ) + "\n" ) ; os << partition.sector_start << "\n"; - label ->set_text( label ->get_text() + (Glib::ustring) _("Last Sector:" ) + "\n" ) ; os << partition.sector_end << "\n"; - label ->set_text( label ->get_text() + (Glib::ustring) _("Total Sectors:" ) + "\n" ) ; os << partition.sector_end - partition.sector_start << "\n"; + //first sector + table ->attach( * mk_label( "" + (Glib::ustring) _( "First Sector:" ) + "" ), 0,1, top, bottom,Gtk::FILL); + os << partition.sector_start ; + table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ; - label ->set_text( label ->get_text() + "" ) ; - label ->set_use_markup( true ) ; - table ->attach( *label, 0,1,0,1,Gtk::SHRINK); + //last sector + table ->attach( * mk_label( "" + (Glib::ustring) _( "Last Sector:" ) + "" ), 0,1, top, bottom,Gtk::FILL); + os << partition.sector_end ; + table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ; - label = manage( new Gtk::Label( ) ) ; - label ->set_markup( os.str() ) ; os.str("") ; - table ->attach( *label, 1,2,0,1,Gtk::SHRINK); - - label = manage( new Gtk::Label( ) ) ; - label ->set_alignment( Gtk::ALIGN_RIGHT ) ; - label ->set_markup( os_percent.str() + "\n\n\n\n" ) ; os_percent.str("") ; - table ->attach( *label, 1,2,0,1,Gtk::FILL); + //total sectors + table ->attach( * mk_label( "" + (Glib::ustring) _( "Total Sectors:" ) + "" ), 0,1, top, bottom,Gtk::FILL); + os << partition.sector_end - partition.sector_start ; + table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ; } void Dialog_Partition_Info::Find_Status() { if ( partition.type == GParted::EXTENDED ) { - os << _("Busy (At least one logical partition is mounted)" ) << "\n"; + os << _("Busy (At least one logical partition is mounted)" ) ; return ; } if ( partition.filesystem == "linux-swap" ) { - os << _("Active") << "\n"; + os << _("Active") ; return ; } @@ -238,7 +256,7 @@ void Dialog_Partition_Info::Find_Status() { mountpoint = line.substr( line.find( ' ' ) +1, line .length() ) ; - os << String::ucompose( _("Mounted on %1"), mountpoint .substr( 0, mountpoint .find( ' ' ) ) ) << "\n"; + os << String::ucompose( _("Mounted on %1"), mountpoint .substr( 0, mountpoint .find( ' ' ) ) ) ; break ; } @@ -249,7 +267,15 @@ void Dialog_Partition_Info::Find_Status() //sometimes rootdevices are not listed as paths. I'll take a guess and just enter / here...( we'll look into this when complaints start coming in :P ) if ( mountpoint.empty() ) - os << String::ucompose( _("Mounted on %1"), "/") << "\n"; + os << String::ucompose( _("Mounted on %1"), "/") ; +} + +Gtk::Label * Dialog_Partition_Info::mk_label( const Glib::ustring & text ) +{ + label = manage( new Gtk::Label() ) ; + label ->set_markup( text ) ; + label ->set_alignment( Gtk::ALIGN_LEFT ) ; + return label ; } Dialog_Partition_Info::~Dialog_Partition_Info() diff --git a/src/VBox_VisualDisk.cc b/src/VBox_VisualDisk.cc index 56a7a60e..b9428e56 100644 --- a/src/VBox_VisualDisk.cc +++ b/src/VBox_VisualDisk.cc @@ -136,7 +136,7 @@ void VBox_VisualDisk::Build_Visual_Disk( int SCREEN_WIDTH ) visual_partitions.back() ->drawingarea ->signal_expose_event().connect( sigc::bind(sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_expose), visual_partitions.back() )); //create pangolayout and see if it fits in the visual partition - os << partitions[i].partition << "\n" << partitions[ i ] .Get_Length_MB() << " MB"; + os << partitions[i].partition << "\n" << String::ucompose( _("%1 MB"), partitions[i] .Get_Length_MB() ) ; visual_partitions.back() ->pango_layout = visual_partitions.back() ->drawingarea ->create_pango_layout ( os.str() ) ;os.str(""); visual_partitions.back() ->pango_layout ->get_pixel_size( x, y ) ; @@ -147,8 +147,8 @@ void VBox_VisualDisk::Build_Visual_Disk( int SCREEN_WIDTH ) if ( partitions[i].type != GParted::UNALLOCATED ) os << partitions[i].filesystem << "\n" ; - os << partitions[ i ] .Get_Length_MB() ; - tooltips.set_tip( *(visual_partitions.back() ->drawingarea) ,partitions[i].partition + "\n" + os.str() + " MB" );os.str(""); + os << partitions[i].partition + "\n" + String::ucompose( _("%1 MB"), partitions[i] .Get_Length_MB() ) ; + tooltips.set_tip( *(visual_partitions.back() ->drawingarea) ,os.str() ) ; os.str(""); partitions[i].inside_extended ? hbox_extended ->pack_start( *(visual_partitions.back() ->drawingarea) , Gtk::PACK_SHRINK ) : hbox_disk ->pack_start( *(visual_partitions.back() ->drawingarea) , Gtk::PACK_SHRINK ) ;