Mailinglist Archive: yast-commit (683 mails)
| < Previous | Next > |
[yast-commit] r42684 - /trunk/pkg-bindings/src/Source.cc
- From: lslezak@xxxxxxxxxxxxxxxx
- Date: Wed, 05 Dec 2007 07:15:53 -0000
- Message-id: <20071205071553.9A9EB2F5CE@xxxxxxxxxxxxxxxx>
Author: lslezak
Date: Wed Dec 5 08:15:53 2007
New Revision: 42684
URL: http://svn.opensuse.org/viewcvs/yast?rev=42684&view=rev
Log:
- ugly global pointer replaced by using boost::bind
Modified:
trunk/pkg-bindings/src/Source.cc
Modified: trunk/pkg-bindings/src/Source.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Source.cc?rev=42684&r1=42683&r2=42684&view=diff
==============================================================================
--- trunk/pkg-bindings/src/Source.cc (original)
+++ trunk/pkg-bindings/src/Source.cc Wed Dec 5 08:15:53 2007
@@ -51,6 +51,7 @@
#include <sstream> // ostringstream
+#include <boost/bind.hpp>
/*
Textdomain "pkg-bindings"
@@ -403,18 +404,6 @@
return true;
}
-PkgModuleFunctions *ptr = NULL;
-
-bool source_receiver(const zypp::ProgressData &progress)
-{
- if (ptr != NULL)
- {
- return ptr->SourceLoadReceiver(progress);
- }
-
- return true;
-}
-
/****************************************************************************************
* @builtin SourceLoad
*
@@ -437,14 +426,11 @@
// mark refreshing as in progress now
ProcessNextStage();
- ptr = this;
-
- YCPValue ret = SourceLoadImpl(source_receiver);
+ // boost::bind(&PkgModuleFunctions::SourceLoadReceiver, this, _1);
+ YCPValue ret =
SourceLoadImpl(boost::bind(&PkgModuleFunctions::SourceLoadReceiver, this, _1));
ProcessDone();
- ptr = NULL;
-
return ret;
}
@@ -472,7 +458,7 @@
}
}
- // set max. value (3 steps per repository)
+ // set max. value (3 steps per repository - refresh, rebuild, load)
zypp::ProgressData prog_total(repos_to_load * 3);
prog_total.sendTo(progress);
@@ -592,8 +578,6 @@
}
}
- ProcessNextStage();
-
// report 100%
prog_total.toMax();
@@ -628,16 +612,13 @@
// mark refreshing as in progress now
ProcessNextStage();
-
- ptr = this;
}
- YCPValue ret = SourceStartManagerImpl(enable, source_receiver);
+ YCPValue ret = SourceStartManagerImpl(enable,
boost::bind(&PkgModuleFunctions::SourceLoadReceiver, this, _1));
if (enable->value())
{
ProcessDone();
- ptr = NULL;
}
return ret;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Wed Dec 5 08:15:53 2007
New Revision: 42684
URL: http://svn.opensuse.org/viewcvs/yast?rev=42684&view=rev
Log:
- ugly global pointer replaced by using boost::bind
Modified:
trunk/pkg-bindings/src/Source.cc
Modified: trunk/pkg-bindings/src/Source.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Source.cc?rev=42684&r1=42683&r2=42684&view=diff
==============================================================================
--- trunk/pkg-bindings/src/Source.cc (original)
+++ trunk/pkg-bindings/src/Source.cc Wed Dec 5 08:15:53 2007
@@ -51,6 +51,7 @@
#include <sstream> // ostringstream
+#include <boost/bind.hpp>
/*
Textdomain "pkg-bindings"
@@ -403,18 +404,6 @@
return true;
}
-PkgModuleFunctions *ptr = NULL;
-
-bool source_receiver(const zypp::ProgressData &progress)
-{
- if (ptr != NULL)
- {
- return ptr->SourceLoadReceiver(progress);
- }
-
- return true;
-}
-
/****************************************************************************************
* @builtin SourceLoad
*
@@ -437,14 +426,11 @@
// mark refreshing as in progress now
ProcessNextStage();
- ptr = this;
-
- YCPValue ret = SourceLoadImpl(source_receiver);
+ // boost::bind(&PkgModuleFunctions::SourceLoadReceiver, this, _1);
+ YCPValue ret =
SourceLoadImpl(boost::bind(&PkgModuleFunctions::SourceLoadReceiver, this, _1));
ProcessDone();
- ptr = NULL;
-
return ret;
}
@@ -472,7 +458,7 @@
}
}
- // set max. value (3 steps per repository)
+ // set max. value (3 steps per repository - refresh, rebuild, load)
zypp::ProgressData prog_total(repos_to_load * 3);
prog_total.sendTo(progress);
@@ -592,8 +578,6 @@
}
}
- ProcessNextStage();
-
// report 100%
prog_total.toMax();
@@ -628,16 +612,13 @@
// mark refreshing as in progress now
ProcessNextStage();
-
- ptr = this;
}
- YCPValue ret = SourceStartManagerImpl(enable, source_receiver);
+ YCPValue ret = SourceStartManagerImpl(enable,
boost::bind(&PkgModuleFunctions::SourceLoadReceiver, this, _1));
if (enable->value())
{
ProcessDone();
- ptr = NULL;
}
return ret;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |