Author: rpmcruz
Date: Sun Feb 21 16:59:50 2010
New Revision: 60920
URL: http://svn.opensuse.org/viewcvs/yast?rev=60920&view=rev
Log:
* src/pkg/yzyppwrapper.h/cc: if user cancels dependency
solver window, then revert the changes he performed that
triggered it.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/Makefile.cvs
trunk/gtk/src/pkg/ygtkpkgdetailview.cc
trunk/gtk/src/pkg/ygtkpkgmenubar.cc
trunk/gtk/src/pkg/yzyppwrapper.cc
trunk/gtk/src/pkg/yzyppwrapper.h
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=60920&r1=60919&r2=60920&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Sun Feb 21 16:59:50 2010
@@ -1,5 +1,11 @@
2010-02-21 Ricardo Cruz
+ * src/pkg/yzyppwrapper.h/cc: if user cancels dependency
+ solver window, then revert the changes he performed that
+ triggered it.
+
+2010-02-21 Ricardo Cruz
+
* src/pkg/ygtkpkgdetailview.cc: added (void) before
system() call to quiet warning.
Modified: trunk/gtk/Makefile.cvs
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/Makefile.cvs?rev=60920&r1=60919&r2=60920&view=diff
==============================================================================
--- trunk/gtk/Makefile.cvs (original)
+++ trunk/gtk/Makefile.cvs Sun Feb 21 16:59:50 2010
@@ -9,7 +9,7 @@
configure:
mkdir build ;\
cd build ;\
- cmake -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DLIB=$(LIB) .. && VERBOSE=1 make
+ cmake -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DLIB=$(LIB) .. && make
# use "VERBOSE=1 make" to read full gcc argument
Modified: trunk/gtk/src/pkg/ygtkpkgdetailview.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgdetailview.cc?rev=60920&r1=60919&r2=60920&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgdetailview.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgdetailview.cc Sun Feb 21 16:59:50 2010
@@ -580,7 +580,7 @@
{ pThis->list.undo(); }
static gboolean sel_modified_idle_cb (gpointer data)
- { Ypp::notifySelModified(); return FALSE; }
+ { Ypp::runSolver(); return FALSE; }
static void version_toggled_cb (GtkToggleButton *button, VersionExpander *pThis)
{
Modified: trunk/gtk/src/pkg/ygtkpkgmenubar.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/ygtkpkgmenubar.cc?rev=60920&r1=60919&r2=60920&view=diff
==============================================================================
--- trunk/gtk/src/pkg/ygtkpkgmenubar.cc (original)
+++ trunk/gtk/src/pkg/ygtkpkgmenubar.cc Sun Feb 21 16:59:50 2010
@@ -407,10 +407,10 @@
}
static void manualResolvePackageDependencies()
-{ Ypp::runSolver(); }
+{ Ypp::runSolver (true); }
static void auto_check_cb (GtkCheckMenuItem *item)
-{ Ypp::setAutoSolver (gtk_check_menu_item_get_active (item)); }
+{ Ypp::setEnableSolver (gtk_check_menu_item_get_active (item)); }
static void show_devel_pkgs_cb (GtkCheckMenuItem *item)
{
@@ -570,7 +570,7 @@
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), (submenu = gtk_menu_new()));
append_menu_item (submenu, _("Check Now"), NULL,
G_CALLBACK (manualResolvePackageDependencies), this);
- append_check_menu_item (submenu, _("Autocheck"), Ypp::isAutoSolver(),
+ append_check_menu_item (submenu, _("Autocheck"), Ypp::isSolverEnabled(),
G_CALLBACK (auto_check_cb), this);
item = append_menu_item (menu_bar, _("Options"), NULL, NULL, NULL);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), (submenu = gtk_menu_new()));
Modified: trunk/gtk/src/pkg/yzyppwrapper.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.cc?rev=60920&r1=60919&r2=60920&view=diff
==============================================================================
--- trunk/gtk/src/pkg/yzyppwrapper.cc (original)
+++ trunk/gtk/src/pkg/yzyppwrapper.cc Sun Feb 21 16:59:50 2010
@@ -339,7 +339,8 @@
break;
}
}
- notifySelModified();
+
+ if (!runSolver()) undo();
}
void Ypp::Selectable::remove()
@@ -387,7 +388,8 @@
break;
}
}
- notifySelModified();
+
+ if (!runSolver()) undo();
}
void Ypp::Selectable::undo()
@@ -407,7 +409,8 @@
else
status = isInstalled() ? zypp::ui::S_KeepInstalled : zypp::ui::S_NoInst;
m_sel->setStatus (status);
- notifySelModified();
+
+ if (!runSolver()) undo();
}
bool Ypp::Selectable::canRemove()
@@ -447,7 +450,7 @@
void Ypp::Selectable::setCandidate (Ypp::Version &version)
{
m_sel->setCandidate (version.zyppObj());
- notifySelModified();
+ runSolver();
}
int Ypp::Selectable::availableSize()
@@ -739,23 +742,13 @@
void Ypp::removeSelListener (Ypp::SelListener *listener)
{ g_sel_listeners.remove (listener); }
-static void fireSelModified()
+void Ypp::notifySelModified()
{
for (std::list ::iterator it = g_sel_listeners.begin();
it != g_sel_listeners.end(); it++)
(*it)->selectableModified();
}
-void Ypp::notifySelModified()
-{
- if (!g_transacting) {
- if (g_autoSolver)
- Ypp::runSolver();
- else
- fireSelModified();
- }
-}
-
void Ypp::setInterface (Ypp::Interface *interface)
{
g_interface = interface;
@@ -765,8 +758,14 @@
Ypp::Problem::Solution *Ypp::Problem::getSolution (int nb)
{ return (Solution *) g_slist_nth_data ((GSList *) impl, nb); }
-bool Ypp::runSolver()
+bool Ypp::runSolver (bool force)
{
+ if (g_transacting) return true;
+ if (!g_autoSolver && !force) {
+ notifySelModified();
+ return true;
+ }
+
if (g_busy_listener)
g_busy_listener->loading (0);
@@ -824,27 +823,26 @@
if (!resolved)
zResolver->undo();
- fireSelModified();
+ notifySelModified();
if (g_busy_listener)
g_busy_listener->loading (1);
return resolved;
}
-void Ypp::setAutoSolver (bool enabled)
+void Ypp::setEnableSolver (bool enabled)
{
g_autoSolver = enabled;
- if (enabled)
- runSolver();
+ if (enabled) runSolver();
}
-bool Ypp::isAutoSolver()
+bool Ypp::isSolverEnabled()
{ return g_autoSolver; }
void Ypp::startTransactions()
{ g_transacting = true; }
-void Ypp::finishTransactions()
-{ g_transacting = false; notifySelModified(); }
+bool Ypp::finishTransactions()
+{ g_transacting = false; return runSolver(); }
// Query
Modified: trunk/gtk/src/pkg/yzyppwrapper.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/pkg/yzyppwrapper.h?rev=60920&r1=60919&r2=60920&view=diff
==============================================================================
--- trunk/gtk/src/pkg/yzyppwrapper.h (original)
+++ trunk/gtk/src/pkg/yzyppwrapper.h Sun Feb 21 16:59:50 2010
@@ -233,6 +233,8 @@
void addSelListener (SelListener *listener);
void removeSelListener (SelListener *listener);
+ // you shouldn't need to call notifySelModified() directly, but instead call
+ // e.g. runSolver()
void notifySelModified();
struct Problem {
@@ -246,13 +248,16 @@
void *impl;
};
- bool runSolver(); // manual run -- if resolved (or user canceled)
- void setAutoSolver (bool enabled); // enabled by default
- bool isAutoSolver();
+ // runSolver() gets called automatically when you install/remove/... a
+ // a package using the Ypp::Selectable API
+ bool runSolver (bool force = false); // returns whether succesful
+ void setEnableSolver (bool enabled); // true by default
+ bool isSolverEnabled();
- // suspends solver while installing/removing a few packages at a time
+ // temporarily suspends run-solver while installing/removing a few packages at a time
+ // -- used by Ypp::List
void startTransactions();
- void finishTransactions();
+ bool finishTransactions(); // returns return of runSolver()
struct Interface {
virtual bool acceptLicense (Selectable &sel, const std::string &license) = 0;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org