Add accessibility relations (!92)

Accessibility relations are essential for usage with screen readers.  It
enables the screen reader to read the corresponding label along with the
value of a widget when it gains focus, rather than just the value of the
widget itself.

Test by running Orca screen reader and tab around the elements of the UI
and listen to what is read out.  For example before it would be
"500 GiB", where as after it would be "Unused 500 GiB".

Closes !92 - Add accessibility relations
This commit is contained in:
Pascal Engélibert 2021-10-02 15:43:06 +02:00 committed by Mike Fleetwood
parent 55be68da93
commit f31fbb986f
7 changed files with 240 additions and 129 deletions

View File

@ -19,6 +19,8 @@
#include <glibmm/ustring.h>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <atkmm/relation.h>
#include <gtkmm/stock.h>
#include <gtkmm/button.h>
#include <gtk/gtk.h>
@ -47,12 +49,14 @@ DialogPasswordEntry::DialogPasswordEntry(const Partition& partition, const Glib:
// Line 2: "Passphrase: [ ]"
// (Horizontal box holding prompt and entry box)
Gtk::Box *entry_hbox(manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL)));
entry_hbox->pack_start( *Utils::mk_label( "<b>"+ Glib::ustring( _("Passphrase:") ) + "</b>" ) );
Gtk::Label *label_passphrase = Utils::mk_label("<b>" + Glib::ustring(_("Passphrase:")) + "</b>");
entry_hbox->pack_start(*label_passphrase);
entry = manage( new Gtk::Entry() );
entry->set_width_chars( 30 );
entry->set_visibility( false );
entry->set_activates_default( true );
entry->grab_focus();
entry->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_passphrase->get_accessible());
entry_hbox->pack_start( *entry );
vbox->pack_start( *entry_hbox );

View File

@ -21,6 +21,8 @@
#include "Utils.h"
#include <glibmm/ustring.h>
#include <gtkmm/label.h>
#include <atkmm/relation.h>
namespace GParted
@ -61,8 +63,9 @@ Dialog_Base_Partition::Dialog_Base_Partition(const Device& device)
vbox_resize_move.pack_start(hbox_grid, Gtk::PACK_SHRINK);
// Add spinbutton_before
grid_resize.attach(*Utils::mk_label(Glib::ustring(_("Free space preceding (MiB):")) + " \t"),
0, 0, 1, 1);
Gtk::Label *label_before = Utils::mk_label(Glib::ustring(_("Free space preceding (MiB):")) + " \t");
grid_resize.attach(*label_before, 0, 0, 1, 1);
spinbutton_before.get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_before->get_accessible());
spinbutton_before .set_numeric( true );
spinbutton_before .set_increments( 1, 100 );
@ -70,7 +73,9 @@ Dialog_Base_Partition::Dialog_Base_Partition(const Device& device)
grid_resize.attach(spinbutton_before, 1, 0, 1, 1);
// Add spinbutton_size
grid_resize.attach(*Utils::mk_label(_("New size (MiB):")), 0, 1, 1, 1);
Gtk::Label *label_size = Utils::mk_label(_("New size (MiB):"));
grid_resize.attach(*label_size, 0, 1, 1, 1);
spinbutton_size.get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_size->get_accessible());
spinbutton_size .set_numeric( true );
spinbutton_size .set_increments( 1, 100 );
@ -78,7 +83,9 @@ Dialog_Base_Partition::Dialog_Base_Partition(const Device& device)
grid_resize.attach(spinbutton_size, 1, 1, 1, 1);
// Add spinbutton_after
grid_resize.attach(*Utils::mk_label(_("Free space following (MiB):")), 0, 2, 1, 1);
Gtk::Label *label_after = Utils::mk_label(_("Free space following (MiB):"));
grid_resize.attach(*label_after, 0, 2, 1, 1);
spinbutton_after.get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_after->get_accessible());
spinbutton_after .set_numeric( true );
spinbutton_after .set_increments( 1, 100 );
@ -106,7 +113,9 @@ Dialog_Base_Partition::Dialog_Base_Partition(const Device& device)
// Add alignment
/* TO TRANSLATORS: used as label for a list of choices. Align to: <combo box with choices> */
grid_resize.attach(*Utils::mk_label(Glib::ustring(_("Align to:")) + "\t"), 0, 3, 1, 1);
Gtk::Label *label_alignment = Utils::mk_label(Glib::ustring(_("Align to:")) + "\t");
grid_resize.attach(*label_alignment, 0, 3, 1, 1);
combo_alignment.get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_alignment->get_accessible());
// Fill partition alignment combo
/* TO TRANSLATORS: Option for combo box "Align to:" */

View File

@ -19,6 +19,8 @@
#include <glibmm/ustring.h>
#include <gtkmm/box.h>
#include <gtkmm/label.h>
#include <atkmm/relation.h>
#include <gtkmm/stock.h>
#include <gtkmm/entry.h>
@ -40,14 +42,15 @@ Dialog_FileSystem_Label::Dialog_FileSystem_Label( const Partition & partition )
get_content_area()->pack_start(*hbox, Gtk::PACK_SHRINK);
// Only line: "Label: [EXISTINGLABEL ]"
hbox->pack_start( *Utils::mk_label("<b>" + Glib::ustring( _("Label:") ) + "</b>"),
Gtk::PACK_SHRINK );
Gtk::Label *label_label = Utils::mk_label("<b>" + Glib::ustring(_("Label:")) + "</b>");
hbox->pack_start(*label_label, Gtk::PACK_SHRINK);
entry = manage( new Gtk::Entry() );
entry->set_max_length(Utils::get_filesystem_label_maxlength(partition.fstype));
entry->set_width_chars( 30 );
entry->set_activates_default( true );
entry->set_text( partition.get_filesystem_label() );
entry->select_region( 0, entry->get_text_length() );
entry->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_label->get_accessible());
hbox->pack_start( *entry, Gtk::PACK_SHRINK );
this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ) ;

View File

@ -26,8 +26,11 @@
#include <gtkmm/alignment.h>
#include <gtkmm/viewport.h>
#include <gtkmm/grid.h>
#include <gtkmm/label.h>
#include <atkmm/relation.h>
#include <gdkmm/general.h>
namespace GParted
{
@ -256,23 +259,30 @@ void Dialog_Partition_Info::Display_Info()
// Left field & value pair area
// File system
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("File system:")) + "</b>"), 1, top, 1, 1);
Gtk::Label *label_filesystem = Utils::mk_label("<b>" + Glib::ustring(_("File system:")) + "</b>");
grid->attach(*label_filesystem, 1, top, 1, 1);
if ( filesystem_accessible )
{
grid->attach(*Utils::mk_label(Utils::get_filesystem_string(filesystem_ptn.fstype), true, false, true),
2, top, 1, 1);
Gtk::Label *value_filesystem = Utils::mk_label(Utils::get_filesystem_string(filesystem_ptn.fstype),
true, false, true);
grid->attach(*value_filesystem, 2, top, 1, 1);
value_filesystem->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_filesystem->get_accessible());
}
top++;
//label
if (filesystem_ptn.fstype != FS_UNALLOCATED && filesystem_ptn.type != TYPE_EXTENDED)
{
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Label:")) + "</b>"),
1, top, 1, 1);
Gtk::Label *label_label = Utils::mk_label("<b>" + Glib::ustring(_("Label:")) + "</b>");
grid->attach(*label_label, 1, top, 1, 1);
if ( filesystem_accessible )
{
grid->attach(*Utils::mk_label(filesystem_ptn.get_filesystem_label(), true, false, true),
2, top, 1, 1);
Gtk::Label *value_label = Utils::mk_label(filesystem_ptn.get_filesystem_label(),
true, false, true);
grid->attach(*value_label, 2, top, 1, 1);
value_label->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_label->get_accessible());
}
top++;
}
@ -280,12 +290,14 @@ void Dialog_Partition_Info::Display_Info()
// file system uuid
if (filesystem_ptn.fstype != FS_UNALLOCATED && filesystem_ptn.type != TYPE_EXTENDED)
{
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("UUID:")) + "</b>"),
1, top, 1, 1);
Gtk::Label *label_uuid = Utils::mk_label("<b>" + Glib::ustring(_("UUID:")) + "</b>");
grid->attach(*label_uuid, 1, top, 1, 1);
if ( filesystem_accessible )
{
grid->attach(*Utils::mk_label(filesystem_ptn.uuid, true, false, true),
2, top, 1, 1);
Gtk::Label *value_uuid = Utils::mk_label(filesystem_ptn.uuid, true, false, true);
grid->attach(*value_uuid, 2, top, 1, 1);
value_uuid->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_uuid->get_accessible());
}
top++;
}
@ -304,9 +316,9 @@ void Dialog_Partition_Info::Display_Info()
{
//status
Glib::ustring str_temp ;
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Status:")) + "</b>",
true, false, false, Gtk::ALIGN_START),
1, top, 1, 1);
Gtk::Label *label_status = Utils::mk_label("<b>" + Glib::ustring(_("Status:")) + "</b>",
true, false, false, Gtk::ALIGN_START);
grid->attach(*label_status, 1, top, 1, 1);
if ( ! filesystem_accessible )
{
/* TO TRANSLATORS: Not accessible (Encrypted)
@ -407,17 +419,22 @@ void Dialog_Partition_Info::Display_Info()
str_temp = _("Not mounted") ;
}
grid->attach(*Utils::mk_label(str_temp, true, true, true), 2, top++, 1, 1);
Gtk::Label *value_status = Utils::mk_label(str_temp, true, true, true);
grid->attach(*value_status, 2, top++, 1, 1);
value_status->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_status->get_accessible());
}
//Optional, LVM2 Volume Group name
if (filesystem_ptn.fstype == FS_LVM2_PV)
{
// Volume Group
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Volume Group:")) + "</b>"),
1, top, 1, 1);
grid->attach(*Utils::mk_label(vgname, true, false, true),
2, top++, 1, 1);
Gtk::Label *label_volume_group = Utils::mk_label("<b>" + Glib::ustring(_("Volume Group:")) + "</b>");
grid->attach(*label_volume_group, 1, top, 1, 1);
Gtk::Label *value_volume_group = Utils::mk_label(vgname, true, false, true);
grid->attach(*value_volume_group, 2, top++, 1, 1);
value_volume_group->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_volume_group->get_accessible());
}
//Optional, members of multi-device file systems
@ -425,8 +442,9 @@ void Dialog_Partition_Info::Display_Info()
filesystem_ptn.fstype == FS_BTRFS )
{
// Members
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Members:")) + "</b>", true, false, false, Gtk::ALIGN_START),
1, top, 1, 1);
Gtk::Label *label_members = Utils::mk_label("<b>" + Glib::ustring(_("Members:")) + "</b>",
true, false, false, Gtk::ALIGN_START);
grid->attach(*label_members, 1, top, 1, 1);
std::vector<Glib::ustring> members ;
switch (filesystem_ptn.fstype)
@ -442,19 +460,24 @@ void Dialog_Partition_Info::Display_Info()
break ;
}
grid->attach(*Utils::mk_label(Glib::build_path("\n", members), true, false, true),
2, top++, 1, 1);
Gtk::Label *value_members = Utils::mk_label(Glib::build_path("\n", members), true, false, true);
grid->attach(*value_members, 2, top++, 1, 1);
value_members->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_members->get_accessible());
}
if (filesystem_ptn.fstype == FS_LVM2_PV)
{
// Logical Volumes
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Logical Volumes:")) + "</b>", true, false, false, Gtk::ALIGN_START),
1, top, 1, 1);
Gtk::Label *label_logical_volumes = Utils::mk_label("<b>" + Glib::ustring(_("Logical Volumes:")) + "</b>",
true, false, false, Gtk::ALIGN_START);
grid->attach(*label_logical_volumes, 1, top, 1, 1);
std::vector<Glib::ustring> lvs = LVM2_PV_Info::get_vg_lvs( vgname );
grid->attach(*Utils::mk_label(Glib::build_path("\n", lvs), true, false, true),
2, top++, 1, 1);
Gtk::Label *value_logical_volumes = Utils::mk_label(Glib::build_path("\n", lvs), true, false, true);
grid->attach(*value_logical_volumes, 2, top++, 1, 1);
value_logical_volumes->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_logical_volumes->get_accessible());
}
// Initialize grid top attach tracker (right side of the grid)
@ -468,39 +491,49 @@ void Dialog_Partition_Info::Display_Info()
partition .get_usage_triple( 100, percent_used, percent_unused, percent_unallocated ) ;
// Used
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Used:")) + "</b>"),
3, topright, 1, 1);
grid->attach(*Utils::mk_label(Utils::format_size(partition.get_sectors_used(), partition.sector_size), true, false, true),
4, topright, 1, 1);
Gtk::Label *label_used = Utils::mk_label("<b>" + Glib::ustring(_("Used:")) + "</b>");
grid->attach(*label_used, 3, topright, 1, 1);
Gtk::Label *value_used = Utils::mk_label(Utils::format_size(partition.get_sectors_used(), partition.sector_size),
true, false, true);
grid->attach(*value_used, 4, topright, 1, 1);
grid->attach(*Utils::mk_label("( " + Utils::num_to_str(percent_used) + "% )"),
5, topright++, 1, 1);
value_used->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_used->get_accessible());
// Unused
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Unused:")) + "</b>"),
3, topright, 1, 1);
grid->attach(*Utils::mk_label(Utils::format_size(partition.get_sectors_unused(), partition.sector_size), true, false, true),
4, topright, 1, 1);
Gtk::Label *label_unused = Utils::mk_label("<b>" + Glib::ustring(_("Unused:")) + "</b>");
grid->attach(*label_unused, 3, topright, 1, 1);
Gtk::Label *value_unused = Utils::mk_label(Utils::format_size(partition.get_sectors_unused(), partition.sector_size),
true, false, true);
grid->attach(*value_unused, 4, topright, 1, 1);
grid->attach(*Utils::mk_label("( " + Utils::num_to_str(percent_unused) + "% )"),
5, topright++, 1, 1);
value_unused->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_unused->get_accessible());
//unallocated
Sector sectors_unallocated = partition .get_sectors_unallocated() ;
if ( sectors_unallocated > 0 )
{
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Unallocated:")) + "</b>"),
3, topright, 1, 1);
grid->attach(*Utils::mk_label(Utils::format_size(sectors_unallocated, partition.sector_size), true, false, true),
4, topright, 1, 1);
Gtk::Label *label_unallocated = Utils::mk_label("<b>" + Glib::ustring(_("Unallocated:")) + "</b>");
grid->attach(*label_unallocated, 3, topright, 1, 1);
Gtk::Label *value_unallocated = Utils::mk_label(Utils::format_size(sectors_unallocated, partition.sector_size),
true, false, true);
grid->attach(*value_unallocated, 4, topright, 1, 1);
grid->attach(*Utils::mk_label("( " + Utils::num_to_str(percent_unallocated) + "% )"),
5, topright++, 1, 1);
value_unallocated->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_unallocated->get_accessible());
}
}
// Size
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Size:")) + "</b>"),
3, topright, 1, 1);
grid->attach(*Utils::mk_label(Utils::format_size(ptn_sectors, partition.sector_size), true, false, true),
4, topright++, 1, 1);
Gtk::Label *label_size = Utils::mk_label("<b>" + Glib::ustring(_("Size:")) + "</b>");
grid->attach(*label_size, 3, topright, 1, 1);
Gtk::Label *value_size = Utils::mk_label(Utils::format_size(ptn_sectors, partition.sector_size),
true, false, true);
grid->attach(*value_size, 4, topright++, 1, 1);
value_size->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_size->get_accessible());
//ensure left row tracker set to largest side (left/right)
top = std::max( top, topright );
@ -516,34 +549,45 @@ void Dialog_Partition_Info::Display_Info()
0, top++, 6, 1);
// Encryption
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Encryption:")) + "</b>"),
1, top, 1, 1);
grid->attach(*Utils::mk_label(Utils::get_filesystem_string(partition.fstype), true, false, true),
2, top++, 1, 1);
Gtk::Label *label_encryption = Utils::mk_label("<b>" + Glib::ustring(_("Encryption:")) + "</b>");
grid->attach(*label_encryption, 1, top, 1, 1);
Gtk::Label *value_encryption = Utils::mk_label(Utils::get_filesystem_string(partition.fstype),
true, false, true);
grid->attach(*value_encryption, 2, top++, 1, 1);
value_encryption->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_encryption->get_accessible());
// LUKS path
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Path:")) + "</b>"),
1, top, 1, 1);
if ( partition.busy )
grid->attach(*Utils::mk_label(partition.get_mountpoint(), true, false, true),
2, top, 1, 1);
Gtk::Label *label_path = Utils::mk_label("<b>" + Glib::ustring(_("Path:")) + "</b>");
grid->attach(*label_path, 1, top, 1, 1);
if ( partition.busy ) {
Gtk::Label *value_path = Utils::mk_label(partition.get_mountpoint(), true, false, true);
grid->attach(*value_path, 2, top, 1, 1);
value_path->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_path->get_accessible());
}
top++;
// LUKS uuid
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("UUID:")) + "</b>"),
1, top, 1, 1);
grid->attach(*Utils::mk_label(partition.uuid, true, false, true),
2, top++, 1, 1);
Gtk::Label *label_uuid = Utils::mk_label("<b>" + Glib::ustring(_("UUID:")) + "</b>");
grid->attach(*label_uuid, 1, top, 1, 1);
Gtk::Label *value_uuid = Utils::mk_label(partition.uuid, true, false, true);
grid->attach(*value_uuid, 2, top++, 1, 1);
value_uuid->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_uuid->get_accessible());
// LUKS status
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Status:")) + "</b>"),
1, top, 1, 1);
Gtk::Label *label_status = Utils::mk_label("<b>" + Glib::ustring(_("Status:")) + "</b>");
grid->attach(*label_status, 1, top, 1, 1);
Glib::ustring str_temp;
if ( partition.busy )
str_temp = luks_open;
else
str_temp = luks_closed;
grid->attach(*Utils::mk_label(str_temp, true, false, true), 2, top++, 1, 1);
Gtk::Label *value_status = Utils::mk_label(str_temp, true, false, true);
grid->attach(*value_status, 2, top++, 1, 1);
value_status->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_status->get_accessible());
// One blank line
grid->attach(*Utils::mk_label(""), 0, top++, 6, 1);
@ -559,46 +603,57 @@ void Dialog_Partition_Info::Display_Info()
// Left field & value pair area
// Path
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Path:")) + "</b>"),
1, top, 1, 1);
grid->attach(*Utils::mk_label(partition.get_path(), true, false, true),
2, top++, 1, 1);
Gtk::Label *label_path = Utils::mk_label("<b>" + Glib::ustring(_("Path:")) + "</b>");
grid->attach(*label_path, 1, top, 1, 1);
Gtk::Label *value_path = Utils::mk_label(partition.get_path(), true, false, true);
grid->attach(*value_path, 2, top++, 1, 1);
value_path->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_path->get_accessible());
if (partition.fstype != FS_UNALLOCATED && partition.status != STAT_NEW)
{
// Name
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Name:")) + "</b>"),
1, top, 1, 1);
grid->attach(*Utils::mk_label(partition.name, true, false, true),
2, top++, 1, 1);
Gtk::Label *label_name = Utils::mk_label("<b>" + Glib::ustring(_("Name:")) + "</b>");
grid->attach(*label_name, 1, top, 1, 1);
Gtk::Label *value_name = Utils::mk_label(partition.name, true, false, true);
grid->attach(*value_name, 2, top++, 1, 1);
value_name->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_name->get_accessible());
// Flags
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Flags:")) + "</b>"),
1, top, 1, 1);
grid->attach(*Utils::mk_label(Glib::build_path(", ", partition.flags), true, false, true),
2, top++, 1, 1);
Gtk::Label *label_flags = Utils::mk_label("<b>" + Glib::ustring(_("Flags:")) + "</b>");
grid->attach(*label_flags, 1, top, 1, 1);
Gtk::Label *value_flags = Utils::mk_label(Glib::build_path(", ", partition.flags), true, false, true);
grid->attach(*value_flags, 2, top++, 1, 1);
value_flags->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_flags->get_accessible());
}
// Right field & value pair area
// First sector
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("First sector:")) + "</b>"),
3, topright, 1, 1);
grid->attach(*Utils::mk_label(Utils::num_to_str(partition.sector_start), true, false, true),
4, topright++, 1, 1);
Gtk::Label *label_first_sector = Utils::mk_label("<b>" + Glib::ustring(_("First sector:")) + "</b>");
grid->attach(*label_first_sector, 3, topright, 1, 1);
Gtk::Label *value_first_sector = Utils::mk_label(Utils::num_to_str(partition.sector_start), true, false, true);
grid->attach(*value_first_sector, 4, topright++, 1, 1);
value_first_sector->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_first_sector->get_accessible());
// Last sector
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Last sector:")) + "</b>"),
3, topright, 1, 1);
grid->attach(*Utils::mk_label(Utils::num_to_str(partition.sector_end), true, false, true),
4, topright++, 1, 1);
Gtk::Label *label_last_sector = Utils::mk_label("<b>" + Glib::ustring(_("Last sector:")) + "</b>");
grid->attach(*label_last_sector, 3, topright, 1, 1);
Gtk::Label *value_last_sector = Utils::mk_label(Utils::num_to_str(partition.sector_end), true, false, true);
grid->attach(*value_last_sector, 4, topright++, 1, 1);
value_last_sector->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_last_sector->get_accessible());
// Total sectors
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Total sectors:")) + "</b>"),
3, topright, 1, 1);
grid->attach(*Utils::mk_label(Utils::num_to_str(ptn_sectors), true, false, true),
4, topright++, 1, 1);
Gtk::Label *label_total_sectors = Utils::mk_label("<b>" + Glib::ustring(_("Total sectors:")) + "</b>");
grid->attach(*label_total_sectors, 3, topright, 1, 1);
Gtk::Label *value_total_sectors = Utils::mk_label(Utils::num_to_str(ptn_sectors), true, false, true);
grid->attach(*value_total_sectors, 4, topright++, 1, 1);
value_total_sectors->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_total_sectors->get_accessible());
}
Dialog_Partition_Info::~Dialog_Partition_Info()
{
}

View File

@ -21,6 +21,9 @@
#include <gtkmm/box.h>
#include <gtkmm/stock.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
#include <atkmm/relation.h>
namespace GParted
{
@ -40,8 +43,8 @@ Dialog_Partition_Name::Dialog_Partition_Name( const Partition & partition, int m
get_content_area()->pack_start(*hbox, Gtk::PACK_SHRINK);
// Only line: "Name: [EXISTINGNAME ]"
hbox->pack_start( *Utils::mk_label( "<b>" + Glib::ustring(_("Name:")) + "</b>" ),
Gtk::PACK_SHRINK );
Gtk::Label *label_name = Utils::mk_label("<b>" + Glib::ustring(_("Name:")) + "</b>");
hbox->pack_start(*label_name, Gtk::PACK_SHRINK);
entry = manage( new Gtk::Entry() );
// NOTE: This limits the Gtk::Entry size in UTF-8 characters but partition names
@ -54,6 +57,7 @@ Dialog_Partition_Name::Dialog_Partition_Name( const Partition & partition, int m
entry->set_activates_default( true );
entry->set_text( partition.name );
entry->select_region( 0, entry->get_text_length() );
entry->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_name->get_accessible());
hbox->pack_start( *entry, Gtk::PACK_SHRINK );
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );

View File

@ -23,6 +23,8 @@
#include "Utils.h"
#include <glibmm/ustring.h>
#include <gtkmm/label.h>
#include <atkmm/relation.h>
namespace GParted
@ -101,8 +103,9 @@ void Dialog_Partition_New::set_data( const Device & device,
hbox_main.pack_start(grid_create, Gtk::PACK_SHRINK);
/* TO TRANSLATORS: used as label for a list of choices. Create as: <combo box with choices> */
grid_create.attach(*Utils::mk_label(Glib::ustring(_("Create as:")) + "\t"),
0, 0, 1, 1);
Gtk::Label *label_type = Utils::mk_label(Glib::ustring(_("Create as:")) + "\t");
grid_create.attach(*label_type, 0, 0, 1, 1);
combo_type.get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY, label_type->get_accessible());
// Fill partition type combo.
combo_type.items().push_back(_("Primary Partition"));
@ -139,8 +142,10 @@ void Dialog_Partition_New::set_data( const Device & device,
grid_create.attach(combo_type, 1, 0, 1, 1);
// Partition name
grid_create.attach(*Utils::mk_label(Glib::ustring(_("Partition name:")) + "\t"),
0, 1, 1, 1);
Gtk::Label *partition_name_label = Utils::mk_label(Glib::ustring(_("Partition name:")) + "\t");
grid_create.attach(*partition_name_label, 0, 1, 1, 1);
partition_name_entry.get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
partition_name_label->get_accessible());
// Initialise text entry box
partition_name_entry.set_width_chars( 20 );
partition_name_entry.set_sensitive( device.partition_naming_supported() );
@ -149,8 +154,10 @@ void Dialog_Partition_New::set_data( const Device & device,
grid_create.attach(partition_name_entry, 1, 1, 1, 1);
// File systems to choose from
grid_create.attach(*Utils::mk_label(Glib::ustring(_("File system:")) + "\t"),
0, 1, 2, 3);
Gtk::Label *label_filesystem = Utils::mk_label(Glib::ustring(_("File system:")) + "\t");
grid_create.attach(*label_filesystem, 0, 1, 2, 3);
combo_filesystem.get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_filesystem->get_accessible());
build_filesystems_combo(device.readonly);
@ -159,7 +166,10 @@ void Dialog_Partition_New::set_data( const Device & device,
grid_create.attach(combo_filesystem, 1, 2, 1, 1);
// Label
grid_create.attach(*Utils::mk_label(_("Label:")), 0, 3, 1, 1);
Gtk::Label *filesystem_label_label = Utils::mk_label(_("Label:"));
grid_create.attach(*filesystem_label_label, 0, 3, 1, 1);
filesystem_label_entry.get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
filesystem_label_label->get_accessible());
//Create Text entry box
filesystem_label_entry.set_width_chars( 20 );
// Add entry box to table

View File

@ -58,6 +58,8 @@
#include <gtkmm/main.h>
#include <gtkmm/separator.h>
#include <gtkmm/grid.h>
#include <gtkmm/label.h>
#include <atkmm/relation.h>
#include <glibmm/ustring.h>
#include <glibmm/miscutils.h>
#include <glibmm/shell.h>
@ -583,28 +585,36 @@ void Win_GParted::init_device_info()
grid->set_column_spacing(10);
// Model
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Model:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_model = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Model:")) + "</b>");
grid->attach(*label_model, 0, top, 1, 1);
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_model->get_accessible());
// Serial number
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Serial:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_serial = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Serial:")) + "</b>");
grid->attach(*label_serial, 0, top, 1, 1);
device_info.push_back( Utils::mk_label( "", true, false, true ) );
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_serial->get_accessible());
// Size
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Size:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_size = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Size:")) + "</b>");
grid->attach(*label_size, 0, top, 1, 1);
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_size->get_accessible());
// Path
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Path:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_path = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Path:")) + "</b>");
grid->attach(*label_path, 0, top, 1, 1);
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_path->get_accessible());
vbox_info.pack_start(*grid, Gtk::PACK_SHRINK);
@ -617,40 +627,52 @@ void Win_GParted::init_device_info()
grid->attach(*Utils::mk_label(""), 1, top++, 1, 1);
// Disktype
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Partition table:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_disktype = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Partition table:")) + "</b>");
grid->attach(*label_disktype, 0, top, 1, 1);
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_disktype->get_accessible());
// Heads
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Heads:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_heads = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Heads:")) + "</b>");
grid->attach(*label_heads, 0, top, 1, 1);
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_heads->get_accessible());
// Sectors / track
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Sectors/track:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_sectors_track = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Sectors/track:")) + "</b>");
grid->attach(*label_sectors_track, 0, top, 1, 1);
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_sectors_track->get_accessible());
// Cylinders
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Cylinders:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_cylinders = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Cylinders:")) + "</b>");
grid->attach(*label_cylinders, 0, top, 1, 1);
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_cylinders->get_accessible());
// Total sectors
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Total sectors:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_total_sectors = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Total sectors:")) + "</b>");
grid->attach(*label_total_sectors, 0, top, 1, 1);
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_total_sectors->get_accessible());
// Sector size
grid->attach(*Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Sector size:")) + "</b>"),
0, top, 1, 1);
Gtk::Label *label_sector_size = Utils::mk_label(" <b>" + static_cast<Glib::ustring>(_("Sector size:")) + "</b>");
grid->attach(*label_sector_size, 0, top, 1, 1);
device_info .push_back( Utils::mk_label( "", true, false, true ) ) ;
grid->attach(*device_info.back(), 1, top++, 1, 1);
device_info.back()->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_sector_size->get_accessible());
vbox_info.pack_start(*grid, Gtk::PACK_SHRINK);
}
@ -3602,15 +3624,17 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
msg_area->pack_start(*grid);
// Volume Group
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(vgname_label) + "</b>"),
0, 0, 1, 1);
grid->attach(*Utils::mk_label(vgname, true, false, true),
1, 0, 1, 1);
Gtk::Label *label_vgname = Utils::mk_label("<b>" + Glib::ustring(vgname_label) + "</b>");
grid->attach(*label_vgname, 0, 0, 1, 1);
Gtk::Label *value_vgname = Utils::mk_label(vgname, true, false, true);
grid->attach(*value_vgname, 1, 0, 1, 1);
value_vgname->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_vgname->get_accessible());
// Members
grid->attach(*Utils::mk_label("<b>" + Glib::ustring(members_label) + "</b>",
true, false, false, Gtk::ALIGN_START),
0, 1, 1, 1);
Gtk::Label *label_members = Utils::mk_label("<b>" + Glib::ustring(members_label) + "</b>",
true, false, false, Gtk::ALIGN_START);
grid->attach(*label_members, 0, 1, 1, 1);
Glib::ustring members_str = "" ;
if ( ! members .empty() )
@ -3622,8 +3646,10 @@ bool Win_GParted::remove_non_empty_lvm2_pv_dialog( const OperationType optype )
members_str += members[i] ;
}
}
grid->attach(*Utils::mk_label(members_str, true, false, true, Gtk::ALIGN_START),
1, 1, 1, 1);
Gtk::Label *value_members = Utils::mk_label(members_str, true, false, true, Gtk::ALIGN_START);
grid->attach(*value_members, 1, 1, 1, 1);
value_members->get_accessible()->add_relationship(Atk::RELATION_LABELLED_BY,
label_members->get_accessible());
dialog .add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
dialog .add_button( Gtk::Stock::DELETE, Gtk::RESPONSE_OK );