Rename some Win_GParted members to *toggle_fs_busy* (#795617)
In preparation for adding the ability to toggle the encryption busy state (open/close the encryption volume), rename existing members to reflect that they are related to changing the file system state. (Swap and LVM2 Physical Volumes are handled as file systems by GParted). class Win_GParted renaming: MENU_TOGGLE_BUSY -> MENU_TOGGLE_FS_BUSY allow_toggle_busy_state() -> allow_toggle_fs_busy_state() toggle_busy_state() -> toggle_fs_busy_state() check_toggle_busy_allowed() -> check_toggle_fs_busy_allowed() Bug 795617 - Implement opening and closing of LUKS mappings
This commit is contained in:
parent
4d7e66eda0
commit
f898910e90
|
@ -107,8 +107,8 @@ private:
|
||||||
void allow_format( bool state ) {
|
void allow_format( bool state ) {
|
||||||
toggle_item( state, MENU_FORMAT ) ; }
|
toggle_item( state, MENU_FORMAT ) ; }
|
||||||
|
|
||||||
void allow_toggle_busy_state( bool state ) {
|
void allow_toggle_fs_busy_state( bool state ) {
|
||||||
toggle_item( state, MENU_TOGGLE_BUSY ) ; }
|
toggle_item( state, MENU_TOGGLE_FS_BUSY ); }
|
||||||
|
|
||||||
void allow_manage_flags( bool state ) {
|
void allow_manage_flags( bool state ) {
|
||||||
toggle_item( state, MENU_FLAGS ) ; }
|
toggle_item( state, MENU_FLAGS ) ; }
|
||||||
|
@ -180,7 +180,7 @@ private:
|
||||||
bool check_toggle_busy_allowed( const Glib::ustring & disallowed_msg );
|
bool check_toggle_busy_allowed( const Glib::ustring & disallowed_msg );
|
||||||
void show_toggle_failure_dialog( const Glib::ustring & failure_summary,
|
void show_toggle_failure_dialog( const Glib::ustring & failure_summary,
|
||||||
const Glib::ustring & marked_up_error );
|
const Glib::ustring & marked_up_error );
|
||||||
void toggle_busy_state() ;
|
void toggle_fs_busy_state();
|
||||||
void activate_mount_partition( unsigned int index ) ;
|
void activate_mount_partition( unsigned int index ) ;
|
||||||
void activate_disklabel() ;
|
void activate_disklabel() ;
|
||||||
void activate_attempt_rescue_data();
|
void activate_attempt_rescue_data();
|
||||||
|
@ -258,7 +258,7 @@ private:
|
||||||
MENU_COPY, TOOLBAR_COPY,
|
MENU_COPY, TOOLBAR_COPY,
|
||||||
MENU_PASTE, TOOLBAR_PASTE,
|
MENU_PASTE, TOOLBAR_PASTE,
|
||||||
MENU_FORMAT,
|
MENU_FORMAT,
|
||||||
MENU_TOGGLE_BUSY,
|
MENU_TOGGLE_FS_BUSY,
|
||||||
MENU_MOUNT,
|
MENU_MOUNT,
|
||||||
MENU_NAME_PARTITION,
|
MENU_NAME_PARTITION,
|
||||||
MENU_FLAGS,
|
MENU_FLAGS,
|
||||||
|
|
|
@ -69,7 +69,7 @@ Win_GParted::Win_GParted( const std::vector<Glib::ustring> & user_devices )
|
||||||
MENU_COPY = TOOLBAR_COPY =
|
MENU_COPY = TOOLBAR_COPY =
|
||||||
MENU_PASTE = TOOLBAR_PASTE =
|
MENU_PASTE = TOOLBAR_PASTE =
|
||||||
MENU_FORMAT =
|
MENU_FORMAT =
|
||||||
MENU_TOGGLE_BUSY =
|
MENU_TOGGLE_FS_BUSY =
|
||||||
MENU_MOUNT =
|
MENU_MOUNT =
|
||||||
MENU_NAME_PARTITION =
|
MENU_NAME_PARTITION =
|
||||||
MENU_FLAGS =
|
MENU_FLAGS =
|
||||||
|
@ -375,10 +375,10 @@ void Win_GParted::init_partition_menu()
|
||||||
index++ ;
|
index++ ;
|
||||||
|
|
||||||
menu_partition .items() .push_back(
|
menu_partition .items() .push_back(
|
||||||
//This is a placeholder text. It will be replaced with some other text before it is used
|
// Placeholder text, replaced in set_valid_operations() before the menu is shown
|
||||||
Gtk::Menu_Helpers::MenuElem( "--placeholder--",
|
Gtk::Menu_Helpers::MenuElem( "--toggle fs busy--",
|
||||||
sigc::mem_fun( *this, &Win_GParted::toggle_busy_state ) ) );
|
sigc::mem_fun( *this, &Win_GParted::toggle_fs_busy_state ) ) );
|
||||||
MENU_TOGGLE_BUSY = index++ ;
|
MENU_TOGGLE_FS_BUSY = index++;
|
||||||
|
|
||||||
menu_partition .items() .push_back(
|
menu_partition .items() .push_back(
|
||||||
/*TO TRANSLATORS: menuitem which holds a submenu with mount points.. */
|
/*TO TRANSLATORS: menuitem which holds a submenu with mount points.. */
|
||||||
|
@ -1050,14 +1050,15 @@ bool Win_GParted::Quit_Check_Operations()
|
||||||
void Win_GParted::set_valid_operations()
|
void Win_GParted::set_valid_operations()
|
||||||
{
|
{
|
||||||
allow_new( false ); allow_delete( false ); allow_resize( false ); allow_copy( false );
|
allow_new( false ); allow_delete( false ); allow_resize( false ); allow_copy( false );
|
||||||
allow_paste( false ); allow_format( false ); allow_toggle_busy_state( false ) ;
|
allow_paste( false ); allow_format( false ); allow_toggle_fs_busy_state( false );
|
||||||
allow_name_partition( false ); allow_manage_flags( false ); allow_check( false );
|
allow_name_partition( false ); allow_manage_flags( false ); allow_check( false );
|
||||||
allow_label_filesystem( false ); allow_change_uuid( false ); allow_info( false );
|
allow_label_filesystem( false ); allow_change_uuid( false ); allow_info( false );
|
||||||
|
|
||||||
dynamic_cast<Gtk::Label*>( menu_partition .items()[ MENU_TOGGLE_BUSY ] .get_child() )
|
// Set default name for the file system active/deactivate menu item.
|
||||||
|
dynamic_cast<Gtk::Label*>( menu_partition.items()[MENU_TOGGLE_FS_BUSY].get_child() )
|
||||||
->set_label( FileSystem::get_generic_text ( CTEXT_DEACTIVATE_FILESYSTEM ) ) ;
|
->set_label( FileSystem::get_generic_text ( CTEXT_DEACTIVATE_FILESYSTEM ) ) ;
|
||||||
|
|
||||||
menu_partition .items()[ MENU_TOGGLE_BUSY ] .show() ;
|
menu_partition.items()[MENU_TOGGLE_FS_BUSY].show();
|
||||||
menu_partition .items()[ MENU_MOUNT ] .hide() ;
|
menu_partition .items()[ MENU_MOUNT ] .hide() ;
|
||||||
|
|
||||||
// No partition selected ...
|
// No partition selected ...
|
||||||
|
@ -1078,12 +1079,12 @@ void Win_GParted::set_valid_operations()
|
||||||
// Set an appropriate name for the activate/deactivate menu item.
|
// Set an appropriate name for the activate/deactivate menu item.
|
||||||
const FileSystem * filesystem_object = gparted_core.get_filesystem_object( selected_filesystem.filesystem );
|
const FileSystem * filesystem_object = gparted_core.get_filesystem_object( selected_filesystem.filesystem );
|
||||||
if ( filesystem_object )
|
if ( filesystem_object )
|
||||||
dynamic_cast<Gtk::Label*>( menu_partition .items()[ MENU_TOGGLE_BUSY ] .get_child() )
|
dynamic_cast<Gtk::Label*>( menu_partition.items()[MENU_TOGGLE_FS_BUSY].get_child() )
|
||||||
->set_label( filesystem_object->get_custom_text( selected_filesystem.busy
|
->set_label( filesystem_object->get_custom_text( selected_filesystem.busy
|
||||||
? CTEXT_DEACTIVATE_FILESYSTEM
|
? CTEXT_DEACTIVATE_FILESYSTEM
|
||||||
: CTEXT_ACTIVATE_FILESYSTEM ) );
|
: CTEXT_ACTIVATE_FILESYSTEM ) );
|
||||||
else
|
else
|
||||||
dynamic_cast<Gtk::Label*>( menu_partition .items()[ MENU_TOGGLE_BUSY ] .get_child() )
|
dynamic_cast<Gtk::Label*>( menu_partition.items()[MENU_TOGGLE_FS_BUSY].get_child() )
|
||||||
->set_label( FileSystem::get_generic_text ( selected_filesystem.busy
|
->set_label( FileSystem::get_generic_text ( selected_filesystem.busy
|
||||||
? CTEXT_DEACTIVATE_FILESYSTEM
|
? CTEXT_DEACTIVATE_FILESYSTEM
|
||||||
: CTEXT_ACTIVATE_FILESYSTEM )
|
: CTEXT_ACTIVATE_FILESYSTEM )
|
||||||
|
@ -1100,7 +1101,7 @@ void Win_GParted::set_valid_operations()
|
||||||
|| selected_filesystem.filesystem == FS_LINUX_SWAP
|
|| selected_filesystem.filesystem == FS_LINUX_SWAP
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
allow_toggle_busy_state( true ) ;
|
allow_toggle_fs_busy_state( true );
|
||||||
|
|
||||||
// Only permit LVM VG activate/deactivate if the PV is busy or a member of a VG.
|
// Only permit LVM VG activate/deactivate if the PV is busy or a member of a VG.
|
||||||
// For now specifically allow activation of an exported VG, which LVM will fail
|
// For now specifically allow activation of an exported VG, which LVM will fail
|
||||||
|
@ -1110,7 +1111,7 @@ void Win_GParted::set_valid_operations()
|
||||||
&& selected_filesystem.filesystem == FS_LVM2_PV // Active VGNAME from mount point
|
&& selected_filesystem.filesystem == FS_LVM2_PV // Active VGNAME from mount point
|
||||||
&& ( selected_filesystem.busy || selected_filesystem.get_mountpoints().size() > 0 )
|
&& ( selected_filesystem.busy || selected_filesystem.get_mountpoints().size() > 0 )
|
||||||
)
|
)
|
||||||
allow_toggle_busy_state( true ) ;
|
allow_toggle_fs_busy_state( true );
|
||||||
|
|
||||||
// Allow partition naming on devices that support it
|
// Allow partition naming on devices that support it
|
||||||
if ( selected_partition_ptr->status == STAT_REAL &&
|
if ( selected_partition_ptr->status == STAT_REAL &&
|
||||||
|
@ -1303,7 +1304,7 @@ void Win_GParted::set_valid_operations()
|
||||||
dynamic_cast<Gtk::Label*>( menu ->items() .back() .get_child() ) ->set_use_underline( false ) ;
|
dynamic_cast<Gtk::Label*>( menu ->items() .back() .get_child() ) ->set_use_underline( false ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_partition .items()[ MENU_TOGGLE_BUSY ] .hide() ;
|
menu_partition.items()[MENU_TOGGLE_FS_BUSY].hide();
|
||||||
menu_partition .items()[ MENU_MOUNT ] .show() ;
|
menu_partition .items()[ MENU_MOUNT ] .show() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2471,7 +2472,7 @@ void Win_GParted::show_toggle_failure_dialog( const Glib::ustring & failure_summ
|
||||||
dialog.run();
|
dialog.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Win_GParted::toggle_busy_state()
|
void Win_GParted::toggle_fs_busy_state()
|
||||||
{
|
{
|
||||||
g_assert( selected_partition_ptr != NULL ); // Bug: Partition callback without a selected partition
|
g_assert( selected_partition_ptr != NULL ); // Bug: Partition callback without a selected partition
|
||||||
g_assert( valid_display_partition_ptr( selected_partition_ptr ) ); // Bug: Not pointing at a valid display partition object
|
g_assert( valid_display_partition_ptr( selected_partition_ptr ) ); // Bug: Not pointing at a valid display partition object
|
||||||
|
|
Loading…
Reference in New Issue