Stop using deprecated widget alignment enumerators (#652044)

Step 3 of 3:

Now that all label widgets are created with ALIGN_LEFT and ALIGN_CENTER
alignment remove the x_align and y_align parameters from mk_label() and
always use this alignment.  Also specify this alignment via floats
rather than enumerators, one of which was deprecated.

Bug #652044 - uses deprecated APIs
This commit is contained in:
Mike Fleetwood 2013-10-16 22:44:03 +01:00 committed by Curtis Gedak
parent 18e2eb8618
commit be2689ad25
6 changed files with 39 additions and 53 deletions

View File

@ -155,8 +155,6 @@ public:
static Sector round( double double_value ) ;
static Gtk::Label * mk_label( const Glib::ustring & text,
bool use_markup = true,
Gtk::AlignmentEnum x_align = Gtk::ALIGN_LEFT,
Gtk::AlignmentEnum y_align = Gtk::ALIGN_CENTER,
bool wrap = false,
bool selectable = false,
const Glib::ustring & text_color = "black" ) ;

View File

@ -61,7 +61,7 @@ DialogFeatures::DialogFeatures()
Glib::ustring str_temp(_("This chart shows the actions supported on file systems."));
str_temp += "\n" ;
str_temp += _("Not all actions are available on all file systems, in part due to the nature of file systems and limitations in the required software.");
hbox->pack_start(*Utils::mk_label(str_temp, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true),
hbox->pack_start(*Utils::mk_label(str_temp, true, true),
Gtk::PACK_SHRINK);
hbox2->pack_start(*hbox);

View File

@ -55,7 +55,7 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std
str_temp = _("Default is to create an MS-DOS partition table.");
str_temp += "\n";
vbox->pack_start(*Utils::mk_label(str_temp, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true),
vbox->pack_start(*Utils::mk_label(str_temp, true, true),
Gtk::PACK_SHRINK);
str_temp = "<b>";

View File

@ -65,12 +65,8 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
vbox->set_border_width(5);
for (unsigned int t = 0; t < partition.messages.size(); ++t)
vbox->pack_start(*Utils::mk_label("<i>" + partition .messages[t] + "</i>",
true,
Gtk::ALIGN_LEFT,
Gtk::ALIGN_CENTER,
true),
Gtk::PACK_SHRINK);
vbox->pack_start(*Utils::mk_label("<i>" + partition .messages[t] + "</i>", true, true),
Gtk::PACK_SHRINK);
frame->add(*vbox);
}
@ -186,7 +182,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::get_filesystem_string( partition .filesystem ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Utils::get_filesystem_string( partition .filesystem ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
@ -196,7 +192,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL) ;
table ->attach( * Utils::mk_label( Utils::format_size( ptn_sectors, partition .sector_size ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Utils::format_size( ptn_sectors, partition .sector_size ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
@ -212,7 +208,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_used(), partition .sector_size ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_used(), partition .sector_size ), true, false, true ),
1, 2,
top, bottom,
Gtk::FILL ) ;
@ -226,7 +222,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_unused(), partition .sector_size ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Utils::format_size( partition .get_sectors_unused(), partition .sector_size ), true, false, true ),
1, 2,
top, bottom,
Gtk::FILL ) ;
@ -243,7 +239,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::format_size( sectors_unallocated, partition .sector_size ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Utils::format_size( sectors_unallocated, partition .sector_size ), true, false, true ),
1, 2,
top, bottom,
Gtk::FILL ) ;
@ -265,7 +261,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Glib::build_path( ", ", partition .flags ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Glib::build_path( ", ", partition .flags ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
@ -277,14 +273,11 @@ void Dialog_Partition_Info::Display_Info()
if ( partition .type != GParted::TYPE_UNALLOCATED && partition .status != GParted::STAT_NEW )
{
//path
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Path:") ) + "</b>",
true,
Gtk::ALIGN_LEFT,
Gtk::ALIGN_CENTER ),
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Path:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Glib::build_path( "\n", partition .get_paths() ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Glib::build_path( "\n", partition .get_paths() ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
@ -377,7 +370,7 @@ void Dialog_Partition_Info::Display_Info()
str_temp = _("Not mounted") ;
}
table ->attach( * Utils::mk_label( str_temp, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ), 1, 2, top++, bottom++, Gtk::FILL ) ;
table ->attach( * Utils::mk_label( str_temp, true, false, true ), 1, 2, top++, bottom++, Gtk::FILL ) ;
}
//label
@ -387,7 +380,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL) ;
table ->attach( * Utils::mk_label( partition .get_label(), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( partition .get_label(), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL) ;
@ -400,7 +393,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL) ;
table ->attach( * Utils::mk_label( partition .uuid, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( partition .uuid, true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL) ;
@ -414,7 +407,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::num_to_str( partition .sector_start ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Utils::num_to_str( partition .sector_start ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
@ -424,7 +417,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::num_to_str( partition.sector_end ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Utils::num_to_str( partition.sector_end ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
@ -434,7 +427,7 @@ void Dialog_Partition_Info::Display_Info()
0, 1,
top, bottom,
Gtk::FILL ) ;
table ->attach( * Utils::mk_label( Utils::num_to_str( ptn_sectors ), true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( Utils::num_to_str( ptn_sectors ), true, false, true ),
1, 2,
top++, bottom++,
Gtk::FILL ) ;
@ -454,7 +447,7 @@ void Dialog_Partition_Info::Display_Info()
//Volume Group
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Volume Group:") ) + "</b>"),
0, 1, top, bottom, Gtk::FILL ) ;
table ->attach( * Utils::mk_label( vgname, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( vgname, true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
//Members
@ -469,12 +462,12 @@ void Dialog_Partition_Info::Display_Info()
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
else
{
table ->attach( * Utils::mk_label( members [0], true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( members [0], true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
for ( unsigned int i = 1 ; i < members .size() ; i ++ )
{
table ->attach( * Utils::mk_label( "" ), 0, 1, top, bottom, Gtk::FILL) ;
table ->attach( * Utils::mk_label( members [i], true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( members [i], true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
}
}

View File

@ -45,14 +45,14 @@ Sector Utils::round( double double_value )
Gtk::Label * Utils::mk_label( const Glib::ustring & text,
bool use_markup,
Gtk::AlignmentEnum x_align,
Gtk::AlignmentEnum y_align,
bool wrap,
bool selectable,
const Glib::ustring & text_color )
{
Gtk::Label * label = manage( new Gtk::Label( text, x_align, y_align ) ) ;
//xalign 0.0 == Gtk::ALIGN_LEFT (gtkmm <= 2.22)
// == Gtk::ALIGN_START (gtkmm >= 2.24)
//yalign 0.5 == Gtk::ALIGN_CENTER
Gtk::Label * label = manage( new Gtk::Label( text, 0.0, 0.5 ) ) ;
label ->set_use_markup( use_markup ) ;
label ->set_line_wrap( wrap ) ;

View File

@ -470,7 +470,7 @@ void Win_GParted::init_device_info()
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//size
@ -478,18 +478,15 @@ void Win_GParted::init_device_info()
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//path
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Path:") ) + "</b>",
true,
Gtk::ALIGN_LEFT,
Gtk::ALIGN_CENTER ),
table ->attach( * Utils::mk_label( " <b>" + static_cast<Glib::ustring>( _("Path:") ) + "</b>" ),
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
vbox_info .pack_start( *table, Gtk::PACK_SHRINK );
@ -507,7 +504,7 @@ void Win_GParted::init_device_info()
0, 1,
top, bottom,
Gtk::FILL );
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//heads
@ -515,7 +512,7 @@ void Win_GParted::init_device_info()
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//sectors/track
@ -523,7 +520,7 @@ void Win_GParted::init_device_info()
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL );
//cylinders
@ -531,7 +528,7 @@ void Win_GParted::init_device_info()
0, 1,
top, bottom,
Gtk::FILL ) ;
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//total sectors
@ -539,7 +536,7 @@ void Win_GParted::init_device_info()
0, 1,
top, bottom,
Gtk::FILL );
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
//sector size
@ -547,7 +544,7 @@ void Win_GParted::init_device_info()
0, 1,
top, bottom,
Gtk::FILL );
device_info .push_back( Utils::mk_label( "", true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ) ) ;
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
table ->attach( * device_info .back(), 1, 2, top++, bottom++, Gtk::FILL ) ;
vbox_info .pack_start( *table, Gtk::PACK_SHRINK );
@ -595,9 +592,7 @@ void Win_GParted::refresh_combo_devices()
//devices submenu....
hbox = manage( new Gtk::HBox() ) ;
hbox ->pack_start( * Utils::mk_label( devices[ i ] .get_path() ), Gtk::PACK_EXPAND_WIDGET ) ;
hbox ->pack_start( * Utils::mk_label( " (" + Utils::format_size( devices[ i ] .length, devices[ i ] .sector_size ) + ")",
true,
Gtk::ALIGN_LEFT ),
hbox ->pack_start( * Utils::mk_label( " (" + Utils::format_size( devices[ i ] .length, devices[ i ] .sector_size ) + ")" ),
Gtk::PACK_SHRINK ) ;
menu ->items() .push_back( * manage( new Gtk::RadioMenuItem( radio_group ) ) ) ;
@ -2768,7 +2763,7 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
//Volume Group
table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( vgname_label ) + "</b>" ),
0, 1, top, bottom, Gtk::FILL ) ;
table ->attach( * Utils::mk_label( vgname, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( vgname, true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
//Members
@ -2779,12 +2774,12 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
table ->attach( * Utils::mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ) ;
else
{
table ->attach( * Utils::mk_label( members [0], true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( members [0], true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
for ( unsigned int i = 1 ; i < members .size() ; i ++ )
{
table ->attach( * Utils::mk_label( "" ), 0, 1, top, bottom, Gtk::FILL ) ;
table ->attach( * Utils::mk_label( members [i], true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, false, true ),
table ->attach( * Utils::mk_label( members [i], true, false, true ),
1, 2, top++, bottom++, Gtk::FILL ) ;
}