Refactoring private function of TzipInterface::Pimpl
[platform/core/appfw/app-installers.git] / src / common / tzip_interface.cc
index 26fabf2..0ce658e 100644 (file)
@@ -117,8 +117,8 @@ class TzipInterface::Pimpl {
     }
     g_variant_unref(r);
 
-    return WaitForCondition([=](bool *success)->bool {
-      return IsMounted(success);
+    return WaitForCondition([=]()->bool {
+      return IsMounted();
     });
   }
 
@@ -133,40 +133,36 @@ class TzipInterface::Pimpl {
     }
     g_variant_unref(r);
 
-    return WaitForCondition([=](bool *success)->bool {
-      return IsUnmounted(success);
+    return WaitForCondition([=]()->bool {
+      return IsUnmounted();
     });
   }
 
  private:
-  bool IsMounted(bool *success) {
+  bool IsMounted() {
     const char* mount_path_str = mount_path_.string().c_str();
     GVariant* r = dbus_proxy_->ProxyCallSync(kTzipIsMountedMethod,
         g_variant_new("(s)", mount_path_str));
-    if (!r) {
-      *success = false;
+    if (!r)
       return false;
-    }
 
     gint ret;
     g_variant_get(r, "(i)", &ret);
     g_variant_unref(r);
-    *success = true;
     return ret != 0;
   }
 
-  bool IsUnmounted(bool *success) {
-    return !IsMounted(success);
+  bool IsUnmounted() {
+    return !IsMounted();
   }
 
-  bool WaitForCondition(std::function<bool(bool*)> condition) {
+  bool WaitForCondition(std::function<bool()> condition) {
     if (!mount_path_.empty()) {
       bool rv = false;
       int cnt = 0;
       while (cnt < kTzipMountMaximumRetryCount) {
-        bool success;
-        rv = condition(&success);
-        if (rv && success)
+        rv = condition();
+        if (rv)
           break;
         sleep(1);
         cnt++;