[gparted] Stop returning vector of partitions from Dialog_Rescue_Data class (#759726)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Stop returning vector of partitions from Dialog_Rescue_Data class (#759726)
- Date: Sat, 30 Jan 2016 17:39:23 +0000 (UTC)
commit 81337141d70536a0f7a6b4b244b06f4a47163d87
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sun Nov 22 15:33:24 2015 +0000
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
include/Dialog_Rescue_Data.h | 2 +-
src/Dialog_Rescue_Data.cc | 4 ++--
src/Win_GParted.cc | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/include/Dialog_Rescue_Data.h b/include/Dialog_Rescue_Data.h
index 0dd1245..0b3e54c 100644
--- a/include/Dialog_Rescue_Data.h
+++ b/include/Dialog_Rescue_Data.h
@@ -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();
diff --git a/src/Dialog_Rescue_Data.cc b/src/Dialog_Rescue_Data.cc
index 956fe95..0b0e346 100644
--- a/src/Dialog_Rescue_Data.cc
+++ b/src/Dialog_Rescue_Data.cc
@@ -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
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index f001e61..8e8e801 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]