Clear previous LUKS unlock failure error before next attempt (#795617)

After a failed LUKS unlock attempt the password entry dialog shows the
error "Failed to open LUKS encryption".  Improve the user experience by
clearing that error message at the start of the next attempt to avoid
contradictory information with the main windows status of "Opening
encryption on $PARTITION" whilst performing the next unlock attempt.

Bug 795617 - Implement opening and closing of LUKS mappings
This commit is contained in:
Mike Fleetwood 2018-05-26 08:53:50 +01:00 committed by Curtis Gedak
parent 1be7b8bc2e
commit a2af9d4a34
2 changed files with 13 additions and 1 deletions

View File

@ -36,6 +36,8 @@ public:
void set_error_message( const Glib::ustring & message );
private:
void on_button_unlock();
Gtk::Entry *entry;
Gtk::Label *error_message;
};

View File

@ -20,6 +20,7 @@
#include <glibmm/ustring.h>
#include <gtkmm/box.h>
#include <gtkmm/stock.h>
#include <gtkmm/button.h>
#include <gtk/gtkentry.h>
namespace GParted
@ -65,7 +66,8 @@ DialogPasswordEntry::DialogPasswordEntry( const Partition & partition )
vbox->pack_start( *error_message );
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
this->add_button( _("Unlock"), Gtk::RESPONSE_OK );
Gtk::Button *unlock_button = this->add_button( _("Unlock"), Gtk::RESPONSE_OK );
unlock_button->signal_clicked().connect( sigc::mem_fun( *this, &DialogPasswordEntry::on_button_unlock ) );
this->set_default_response( Gtk::RESPONSE_OK );
this->show_all_children();
}
@ -91,4 +93,12 @@ void DialogPasswordEntry::set_error_message( const Glib::ustring & message )
entry->grab_focus();
}
// Private methods
void DialogPasswordEntry::on_button_unlock()
{
// Clear any previous unlock failure message before starting new attempt.
error_message->set_label( "" );
}
} //GParted