several small thingies, mostly i18n related

This commit is contained in:
Bart Hakvoort 2004-09-28 21:12:20 +00:00
parent 1e2e9b52be
commit 57e7ca3160
5 changed files with 84 additions and 49 deletions

View File

@ -1,3 +1,10 @@
2004-09-28 Bart Hakvoort <gparted@users.sf.net>
* 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 <mvd@mylinux.com.ua> 2004-09-28 Maxim Dziumanenko <mvd@mylinux.com.ua>
* configure.in: Added uk to ALL_LINGUAS. * configure.in: Added uk to ALL_LINGUAS.

View File

@ -48,6 +48,7 @@ private:
void init_drawingarea() ; void init_drawingarea() ;
void Display_Info(); void Display_Info();
void Find_Status() ; void Find_Status() ;
Gtk::Label * mk_label( const Glib::ustring & text ) ;
//signalhandlers //signalhandlers
void drawingarea_on_realize( ); void drawingarea_on_realize( );

View File

@ -67,6 +67,7 @@ void Dialog_About::Show_Credits()
//written by //written by
vbox_written .set_border_width( 5 ) ; vbox_written .set_border_width( 5 ) ;
label_writers .set_text( "Bart Hakvoort <gparted@users.sf.net>"); label_writers .set_text( "Bart Hakvoort <gparted@users.sf.net>");
label_writers .set_selectable( true );
label_writers .set_alignment( Gtk::ALIGN_LEFT ) ; label_writers .set_alignment( Gtk::ALIGN_LEFT ) ;
vbox_written .pack_start( label_writers, Gtk::PACK_SHRINK ) ; vbox_written .pack_start( label_writers, Gtk::PACK_SHRINK ) ;
notebook_credits .set_size_request( -1, 200 ) ; notebook_credits .set_size_request( -1, 200 ) ;
@ -80,7 +81,7 @@ void Dialog_About::Show_Credits()
//translated by //translated by
/*TO TRANSLATORS: your name(s) here please, if there are more translators put newlines (\n) between the names */ /*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_text( _( "translator_credits") ) ;
label_translators .set_selectable( true );
if ( label_translators .get_text() != "translator_credits" ) if ( label_translators .get_text() != "translator_credits" )
{ {
label_translators .set_alignment( Gtk::ALIGN_LEFT ) ; label_translators .set_alignment( Gtk::ALIGN_LEFT ) ;

View File

@ -123,100 +123,118 @@ void Dialog_Partition_Info::init_drawingarea()
color_partition = partition.color ; this ->get_colormap() ->alloc_color( color_partition ) ; color_partition = partition.color ; this ->get_colormap() ->alloc_color( color_partition ) ;
//set text of pangolayout //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(""); pango_layout = drawingarea .create_pango_layout ( os.str() ) ;os.str("");
} }
void Dialog_Partition_Info::Display_Info() void Dialog_Partition_Info::Display_Info()
{ {
int top =0, bottom = 1;
table = manage( new Gtk::Table() ) ; table = manage( new Gtk::Table() ) ;
table ->set_border_width( 5 ) ; table ->set_border_width( 5 ) ;
table ->set_col_spacings(10 ) ; table ->set_col_spacings(10 ) ;
this ->get_vbox() ->pack_start( *table , Gtk::PACK_SHRINK ) ; this ->get_vbox() ->pack_start( *table , Gtk::PACK_SHRINK ) ;
label = manage( new Gtk::Label( "<b>" ) ) ; //filesystem
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Filesystem:" ) + "</b>" ) , 0,1,top, bottom ,Gtk::FILL);
label ->set_text( label ->get_text() + (Glib::ustring) _( "Filesystem:" ) + "\n" ) ; os << partition.filesystem << "\n"; table ->attach( * mk_label( partition .filesystem ), 1,2, top++, bottom++, Gtk::FILL);
label ->set_text( label ->get_text() + (Glib::ustring) _( "Size:" ) + "\n" ) ; os << String::ucompose( _("%1 MB"), this -> partition .Get_Length_MB() ) << "\n";
//size
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Size:" ) + "</b>" ), 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 ) if ( partition.sectors_used != -1 )
{ {
label ->set_text( label ->get_text() + (Glib::ustring) _( "Used:" ) + "\n" ) ; //calculate relative diskusage
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";
int percent_used =(int) ( (double) partition.Get_Used_MB() / partition .Get_Length_MB() *100 +0.5 ) ; 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( "<b>" + (Glib::ustring) _( "Used:" ) + "</b>" ), 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( "<b>" + (Glib::ustring) _( "Unused:" ) + "</b>" ), 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( "<b>" + (Glib::ustring) _( "Flags:" ) + "</b>" ), 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 ) 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( "<b>" + (Glib::ustring) _( "Path:" ) + "</b>" ), 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] ; char real_path[4096] ;
realpath( partition.partition.c_str() , real_path ); realpath( partition.partition.c_str() , real_path );
//only show realpath if it's diffent from the short path... //only show realpath if it's diffent from the short path...
if ( partition.partition != real_path ) if ( partition.partition != real_path )
{ {
label ->set_text( label ->get_text() + (Glib::ustring) _("Real Path:" ) + "\n" ) ; table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Real Path:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL);
os << (Glib::ustring) real_path << "\n"; table ->attach( * mk_label( real_path ), 1,2, top++, bottom++,Gtk::FILL);
os_percent << "\n" ;
} }
label ->set_text( label ->get_text() + (Glib::ustring) _("Status:" ) + "\n" ) ; //status
table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Status:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL);
if ( partition.busy ) if ( partition.busy )
Find_Status() ; Find_Status() ;
else if ( partition.type == GParted::EXTENDED ) 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" ) else if ( partition.filesystem == "linux-swap" )
os << (Glib::ustring) _("Not active" ) + "\n"; os << (Glib::ustring) _("Not active" ) ;
else 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"; //first sector
label ->set_text( label ->get_text() + (Glib::ustring) _("Last Sector:" ) + "\n" ) ; os << partition.sector_end << "\n"; table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "First Sector:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL);
label ->set_text( label ->get_text() + (Glib::ustring) _("Total Sectors:" ) + "\n" ) ; os << partition.sector_end - partition.sector_start << "\n"; os << partition.sector_start ;
table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ;
label ->set_text( label ->get_text() + "</b>" ) ; //last sector
label ->set_use_markup( true ) ; table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Last Sector:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL);
table ->attach( *label, 0,1,0,1,Gtk::SHRINK); os << partition.sector_end ;
table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ;
label = manage( new Gtk::Label( ) ) ; //total sectors
label ->set_markup( os.str() ) ; os.str("") ; table ->attach( * mk_label( "<b>" + (Glib::ustring) _( "Total Sectors:" ) + "</b>" ), 0,1, top, bottom,Gtk::FILL);
table ->attach( *label, 1,2,0,1,Gtk::SHRINK); os << partition.sector_end - partition.sector_start ;
table ->attach( * mk_label( os.str() ), 1,2, top++, bottom++,Gtk::FILL); os.str( "") ;
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);
} }
void Dialog_Partition_Info::Find_Status() void Dialog_Partition_Info::Find_Status()
{ {
if ( partition.type == GParted::EXTENDED ) 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 ; return ;
} }
if ( partition.filesystem == "linux-swap" ) if ( partition.filesystem == "linux-swap" )
{ {
os << _("Active") << "\n"; os << _("Active") ;
return ; return ;
} }
@ -238,7 +256,7 @@ void Dialog_Partition_Info::Find_Status()
{ {
mountpoint = line.substr( line.find( ' ' ) +1, line .length() ) ; 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 ; 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 ) //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() ) 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() Dialog_Partition_Info::~Dialog_Partition_Info()

View File

@ -136,7 +136,7 @@ void VBox_VisualDisk::Build_Visual_Disk( int SCREEN_WIDTH )
visual_partitions.back() ->drawingarea ->signal_expose_event().connect( sigc::bind<Visual_Partition *>(sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_expose), visual_partitions.back() )); visual_partitions.back() ->drawingarea ->signal_expose_event().connect( sigc::bind<Visual_Partition *>(sigc::mem_fun(*this, &VBox_VisualDisk::drawingarea_on_expose), visual_partitions.back() ));
//create pangolayout and see if it fits in the visual partition //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 = visual_partitions.back() ->drawingarea ->create_pango_layout ( os.str() ) ;os.str("");
visual_partitions.back() ->pango_layout ->get_pixel_size( x, y ) ; 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 ) if ( partitions[i].type != GParted::UNALLOCATED )
os << partitions[i].filesystem << "\n" ; os << partitions[i].filesystem << "\n" ;
os << partitions[ i ] .Get_Length_MB() ; os << partitions[i].partition + "\n" + String::ucompose( _("%1 MB"), partitions[i] .Get_Length_MB() ) ;
tooltips.set_tip( *(visual_partitions.back() ->drawingarea) ,partitions[i].partition + "\n" + os.str() + " MB" );os.str(""); 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 ) ; 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 ) ;