Stop returning vector of partitions from Dialog_Rescue_Data class (#759726)

get_partitions() method was returning a vector of partitions.  However
the calling code only needed to know whether any partitions were found
or not.  Replace with found_partitions() method reporting the needed
boolean.

Now use of std::vector<Partition> partitions is hidden within the
Dialog_Rescue_Data class implementation.

Bug 759726 - Implement Partition object polymorphism
This commit is contained in:
Mike Fleetwood 2015-11-22 15:33:24 +00:00 committed by Curtis Gedak
parent fa98273445
commit 81337141d7
3 changed files with 4 additions and 4 deletions

View File

@ -39,7 +39,7 @@ public:
void init_partitions(Device *parentDevice, const Glib::ustring &buff);
std::vector<Partition> get_partitions();
bool found_partitions();
private:
void draw_dialog();

View File

@ -38,9 +38,9 @@ Dialog_Rescue_Data::Dialog_Rescue_Data()
}
//getters
std::vector<Partition> Dialog_Rescue_Data::get_partitions()
bool Dialog_Rescue_Data::found_partitions()
{
return this->partitions;
return this->partitions.size() > 0;
}
// Draws the dialog

View File

@ -2551,7 +2551,7 @@ void Win_GParted::activate_attempt_rescue_data()
//Reads the output of gpart
dialog.init_partitions(&devices[ current_device ], this->gpart_output);
if(dialog.get_partitions().size()==0) //No partitions found
if ( ! dialog.found_partitions() )
{
//Dialog information
Gtk::MessageDialog errorDialog(*this, "", true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);