From 2b47fea3de939bf0d90843f62f526e23ccd04fe7 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Tue, 13 Sep 2005 17:09:20 +0000 Subject: [PATCH] fixed a11y thingy (#316108) get labeltypes from libparted instead of * src/Dialog_Filesystems.cc: fixed a11y thingy (#316108) * include/GParted_Core.h, src/GParted_Core.cc, include/Dialog_Disklabel.h, src/Dialog_Disklabel.cc, src/Win_GParted.cc : get labeltypes from libparted instead of hardcoding them, also changed some text (#315979) --- ChangeLog | 9 +++++++++ include/Dialog_Disklabel.h | 2 +- include/GParted_Core.h | 1 + src/Dialog_Disklabel.cc | 14 ++++---------- src/Dialog_Filesystems.cc | 10 +++++----- src/GParted_Core.cc | 15 +++++++++++++++ src/Win_GParted.cc | 4 ++-- 7 files changed, 37 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43cbd8f8..256c7a29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-09-13 Bart Hakvoort + * src/Dialog_Filesystems.cc: fixed a11y thingy (#316108) + * include/GParted_Core.h, + src/GParted_Core.cc, + include/Dialog_Disklabel.h, + src/Dialog_Disklabel.cc, + src/Win_GParted.cc : get labeltypes from libparted instead of hardcoding them, + also changed some text (#315979) + 2005-09-13 Bart Hakvoort * lots of stuff and cleanups, including fixing getting used/unused space of hfs/hfs+/fat16/fat32 * also fixes bug #161362 diff --git a/include/Dialog_Disklabel.h b/include/Dialog_Disklabel.h index d7f8bda7..49d587ec 100644 --- a/include/Dialog_Disklabel.h +++ b/include/Dialog_Disklabel.h @@ -36,7 +36,7 @@ namespace GParted class Dialog_Disklabel : public Gtk::Dialog { public: - Dialog_Disklabel( const Glib::ustring & device_path ) ; + Dialog_Disklabel( const Glib::ustring & device_path, const std::vector & disklabeltypes ) ; Glib::ustring Get_Disklabel( ) ; diff --git a/include/GParted_Core.h b/include/GParted_Core.h index 34e6272a..d553eba9 100644 --- a/include/GParted_Core.h +++ b/include/GParted_Core.h @@ -62,6 +62,7 @@ public: const std::vector & get_filesystems( ) const ; const FS & get_fs( const Glib::ustring & filesystem ) const ; Glib::RefPtr get_textbuffer( ) ; + std::vector get_disklabeltypes( ) ; private: Glib::ustring Get_Filesystem( ) ; //temporary function.. asa new checks ripple through in libparted i'll remove it. diff --git a/src/Dialog_Disklabel.cc b/src/Dialog_Disklabel.cc index c70a9050..ee1723f2 100644 --- a/src/Dialog_Disklabel.cc +++ b/src/Dialog_Disklabel.cc @@ -20,7 +20,7 @@ namespace GParted { -Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path ) +Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std::vector & disklabeltypes ) { this ->set_title( String::ucompose( _("Set Disklabel on %1"), device_path ) ); this ->set_has_separator( false ) ; @@ -45,7 +45,7 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path ) str_temp += "\n" ; vbox ->pack_start( * mk_label( str_temp ), Gtk::PACK_SHRINK ); - str_temp = _("A disklabel is a file at the beginning of the disk that indicates where each partition begins and how many sectors it occupies.") ; + str_temp = _("A disklabel is a piece of data stored at a well known place on the disk, that indicates where each partition begins and how many sectors it occupies.") ; str_temp += "\n" ; str_temp += _("You need a disklabel if you want to create partitions on this disk.") ; str_temp += "\n\n" ; @@ -69,14 +69,8 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path ) expander_advanced .add( *hbox ) ; //create and add optionmenu - labeltypes .push_back( "msdos" ) ; - labeltypes .push_back( "bsd" ) ; - labeltypes .push_back( "loop" ) ; - labeltypes .push_back( "gpt" ) ; - labeltypes .push_back( "mac" ) ; - labeltypes .push_back( "pc98" ) ; - labeltypes .push_back( "sun" ) ; - + this ->labeltypes = disklabeltypes ; + for ( unsigned int t = 0 ; t < labeltypes .size( ) ; t++ ) menu_labeltypes .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( labeltypes[ t ] + "\t" ) ) ; diff --git a/src/Dialog_Filesystems.cc b/src/Dialog_Filesystems.cc index 3cc3a5ac..fcf89d83 100644 --- a/src/Dialog_Filesystems.cc +++ b/src/Dialog_Filesystems.cc @@ -55,11 +55,11 @@ void Dialog_Filesystems::Show_Filesystem( const FS & fs ) { treerow = *( liststore_filesystems ->append( ) ); treerow[ treeview_filesystems_columns .filesystem ] = fs .filesystem ; - treerow[ treeview_filesystems_columns .create ] = render_icon( fs .create ? Gtk::Stock::YES : Gtk::Stock::NO, Gtk::ICON_SIZE_MENU ); - treerow[ treeview_filesystems_columns .grow ] = render_icon( fs .grow ? Gtk::Stock::YES : Gtk::Stock::NO, Gtk::ICON_SIZE_MENU ); - treerow[ treeview_filesystems_columns .shrink ] = render_icon( fs .shrink ? Gtk::Stock::YES : Gtk::Stock::NO, Gtk::ICON_SIZE_MENU ); - treerow[ treeview_filesystems_columns .move ] = render_icon( fs .move ? Gtk::Stock::YES : Gtk::Stock::NO, Gtk::ICON_SIZE_MENU ); - treerow[ treeview_filesystems_columns .copy ] = render_icon( fs .copy ? Gtk::Stock::YES : Gtk::Stock::NO, Gtk::ICON_SIZE_MENU ); + treerow[ treeview_filesystems_columns .create ] = render_icon( fs .create ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); + treerow[ treeview_filesystems_columns .grow ] = render_icon( fs .grow ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); + treerow[ treeview_filesystems_columns .shrink ] = render_icon( fs .shrink ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); + treerow[ treeview_filesystems_columns .move ] = render_icon( fs .move ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); + treerow[ treeview_filesystems_columns .copy ] = render_icon( fs .copy ? Gtk::Stock::APPLY : Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU ); } Dialog_Filesystems::~Dialog_Filesystems( ) diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc index a8b021af..1bfd7380 100644 --- a/src/GParted_Core.cc +++ b/src/GParted_Core.cc @@ -508,6 +508,21 @@ Glib::RefPtr GParted_Core::get_textbuffer( ) return textbuffer ; } +std::vector GParted_Core::get_disklabeltypes( ) +{ + std::vector disklabeltypes ; + + //msdos should be first in the list + disklabeltypes .push_back( "msdos" ) ; + + PedDiskType *disk_type ; + for ( disk_type = ped_disk_type_get_next( NULL ) ; disk_type ; disk_type = ped_disk_type_get_next( disk_type ) ) + if ( static_cast( disk_type->name ) != "msdos" ) + disklabeltypes .push_back( disk_type->name ) ; + + return disklabeltypes ; +} + Glib::ustring GParted_Core::get_sym_path( const Glib::ustring & real_path ) { int major, minor, size; diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 5d7b0b9c..f633a09a 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -249,7 +249,7 @@ void Win_GParted::init_device_info() table ->attach( * mk_label( "" ), 1, 2, top++, bottom++, Gtk::FILL ); //disktype - table ->attach( * mk_label( " " + (Glib::ustring) _( "DiskType:" ) + "" ), 0, 1, top, bottom, Gtk::FILL ); + table ->attach( * mk_label( " " + (Glib::ustring) _( "DiskLabelType:" ) + "" ), 0, 1, top, bottom, Gtk::FILL ); device_info .push_back( mk_label( "" ) ) ; table ->attach( * device_info .back( ), 1, 2, top++, bottom++, Gtk::FILL ); @@ -1162,7 +1162,7 @@ void Win_GParted::activate_unmount( ) void Win_GParted::activate_disklabel( ) { - Dialog_Disklabel dialog( devices[ current_device ] .path ) ; + Dialog_Disklabel dialog( devices[ current_device ] .path, gparted_core .get_disklabeltypes( ) ) ; dialog .set_transient_for( *this ); if ( dialog .run( ) == Gtk::RESPONSE_OK )