Author: rpmcruz Date: Tue Sep 14 15:14:28 2010 New Revision: 62487
URL: http://svn.opensuse.org/viewcvs/yast?rev=62487&view=rev Log: * src/pkg/YGPackageSelector.cc: fix bug 637761: run solver one final time at apply.
* src/pkg/yzyppwrapper.h/cc: added supporting methods.
* CMakeLists.txt: remove included FindGTK2.cmake module.
Removed: trunk/gtk/modules/ Modified: trunk/gtk/CMakeLists.txt trunk/gtk/ChangeLog trunk/gtk/src/pkg/YGPackageSelector.cc trunk/gtk/src/pkg/yzyppwrapper.cc trunk/gtk/src/pkg/yzyppwrapper.h
Modified: trunk/gtk/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/CMakeLists.txt?rev=62487&... ============================================================================== --- trunk/gtk/CMakeLists.txt (original) +++ trunk/gtk/CMakeLists.txt Tue Sep 14 15:14:28 2010 @@ -5,9 +5,6 @@
## configure
-# we bundle our own FindGTK2.cmake while it isn't shipped with cmake -set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/modules") - find_package (GTK2 REQUIRED gtk) find_package (Libyui REQUIRED) find_package (Zypp REQUIRED)
Modified: trunk/gtk/ChangeLog URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=62487&r1=62... ============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Tue Sep 14 15:14:28 2010 @@ -1,3 +1,12 @@ +2010-09-14 Ricardo Cruz rpmcruz@alunos.dcc.fc.up.pt + + * src/pkg/YGPackageSelector.cc: fix bug 637761: run + solver one final time at apply. + + * src/pkg/yzyppwrapper.h/cc: added supporting methods. + + * CMakeLists.txt: remove included FindGTK2.cmake module. + 2010-08-29 Ricardo Cruz rpmcruz@alunos.dcc.fc.up.pt
* yast2-gtk.spec.in: add gdk-pixbuf-devel to
Modified: trunk/gtk/src/pkg/YGPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/YGPackageSelector.cc?... ============================================================================== --- trunk/gtk/src/pkg/YGPackageSelector.cc (original) +++ trunk/gtk/src/pkg/YGPackageSelector.cc Tue Sep 14 15:14:28 2010 @@ -266,13 +266,13 @@ return confirmed; }
- virtual bool acceptLicense (Ypp::Selectable &sel, const std::string &license) + virtual bool showLicense (Ypp::Selectable &sel, const std::string &license) { return acceptText (sel, _("License Agreement"), _("Do you accept the terms of this license?"), license); }
- virtual bool displayMessage (Ypp::Selectable &sel, const std::string &message) + virtual bool showMessage (Ypp::Selectable &sel, const std::string &message) { return acceptText (sel, _("Warning Message"), _("Install anyway"), message); }
virtual bool resolveProblems (const std::list <Ypp::Problem *> &problems) @@ -699,6 +699,7 @@ dialog->setTitle (title);
Ypp::setInterface (impl); + Ypp::runSolver(); // check dependencies at start impl->refreshQuery();
if (summaryMode()) popupChanges(); @@ -720,6 +721,11 @@
void YGPackageSelector::apply() { + if (!Ypp::runSolver()) return; // final dependencies check + if (onlineUpdateMode()) + if (!Ypp::showPendingLicenses (Ypp::Selectable::PATCH)) return; + if (!Ypp::showPendingLicenses (Ypp::Selectable::PACKAGE)) return; + if (Ypp::isModified()) { // confirm if (!onlineUpdateMode() && confirmUnsupported()) { if (!impl->confirmUnsupported())
Modified: trunk/gtk/src/pkg/yzyppwrapper.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.cc?rev=6... ============================================================================== --- trunk/gtk/src/pkg/yzyppwrapper.cc (original) +++ trunk/gtk/src/pkg/yzyppwrapper.cc Tue Sep 14 15:14:28 2010 @@ -17,6 +17,7 @@ #include <algorithm>
static Ypp::Interface *g_interface = 0; +static bool g_autoSolver = true;
// Repository
@@ -322,14 +323,14 @@ default: { if (!m_sel->hasLicenceConfirmed()) { ZyppResObject obj = m_sel->candidateObj(); - if (obj) { + if (obj && g_interface && g_autoSolver) { const std::string &license = obj->licenseToConfirm(); - if (!license.empty() && g_interface) - if (!g_interface->acceptLicense (*this, license)) + if (!license.empty()) + if (!g_interface->showLicense (*this, license)) return; const std::string &msg = obj->insnotify(); - if (!msg.empty() && g_interface) - if (!g_interface->displayMessage (*this, msg)) + if (!msg.empty()) + if (!g_interface->showMessage (*this, msg)) return; } m_sel->setLicenceConfirmed(); @@ -379,11 +380,11 @@ _zyppPool().eraseRequestedLocale (m_locale); break; default: { - if (m_sel->hasCandidateObj()) { + if (m_sel->hasCandidateObj() && g_interface && g_autoSolver) { ZyppResObject obj = m_sel->candidateObj(); const std::string &msg = obj->delnotify(); - if (!msg.empty() && g_interface) - if (!g_interface->displayMessage (*this, msg)) + if (!msg.empty()) + if (!g_interface->showMessage (*this, msg)) return; }
@@ -832,7 +833,7 @@ // Interface
std::list <Ypp::SelListener *> g_sel_listeners; -static bool g_transacting = false, g_autoSolver = true; +static bool g_transacting = false;
void Ypp::addSelListener (Ypp::SelListener *listener) { g_sel_listeners.push_back (listener); } @@ -850,7 +851,6 @@ void Ypp::setInterface (Ypp::Interface *interface) { g_interface = interface; - runSolver(); // check problems at start }
Ypp::Interface *Ypp::getInterface() { return g_interface; } @@ -938,6 +938,30 @@ bool Ypp::isSolverEnabled() { return g_autoSolver; }
+bool Ypp::showPendingLicenses (Ypp::Selectable::Type type) +{ + const zypp::ResKind &kind = Selectable::asKind (type); + for (ZyppPool::const_iterator it = zyppPool().byKindBegin(kind); + it != zyppPool().byKindEnd(kind); it++) { + ZyppSelectable zsel = (*it); + switch (zsel->status()) { + case zypp::ui::S_Install: case zypp::ui::S_AutoInstall: + case zypp::ui::S_Update: case zypp::ui::S_AutoUpdate: + if (zsel->candidateObj()) { + std::string license = zsel->candidateObj()->licenseToConfirm(); + if (!license.empty()) + if (!zsel->hasLicenceConfirmed()) { + Selectable sel (zsel); + if (!g_interface->showLicense (sel, license)) + return false; + } + } + default: break; + } + } + return true; +} + void Ypp::startTransactions() { g_transacting = true; }
Modified: trunk/gtk/src/pkg/yzyppwrapper.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.h?rev=62... ============================================================================== --- trunk/gtk/src/pkg/yzyppwrapper.h (original) +++ trunk/gtk/src/pkg/yzyppwrapper.h Tue Sep 14 15:14:28 2010 @@ -266,6 +266,7 @@ bool runSolver (bool force = false); // returns whether succesful void setEnableSolver (bool enabled); // true by default bool isSolverEnabled(); + bool showPendingLicenses (Ypp::Selectable::Type type);
// temporarily suspends run-solver while installing/removing a few packages at a time // -- used by Ypp::List @@ -273,8 +274,8 @@ bool finishTransactions(); // returns return of runSolver()
struct Interface { - virtual bool acceptLicense (Selectable &sel, const std::string &license) = 0; - virtual bool displayMessage (Selectable &sel, const std::string &message) = 0; + virtual bool showLicense (Selectable &sel, const std::string &license) = 0; + virtual bool showMessage (Selectable &sel, const std::string &message) = 0; // resolveProblems = false to cancel the action that had that effect virtual bool resolveProblems (const std::list <Problem *> &problems) = 0; };