Mailinglist Archive: yast-commit (723 mails)

< Previous Next >
[yast-commit] r47371 - in /trunk/gtk: ChangeLog src/YGPackageSelector.cc src/YGUtils.cc src/YGUtils.h src/ygtkzyppwrapper.cc src/yzyppwrapper.cc src/yzyppwrapper.h
  • From: rpmcruz@xxxxxxxxxxxxxxxx
  • Date: Thu, 08 May 2008 01:40:44 -0000
  • Message-id: <20080508014044.6A24C2DD18@xxxxxxxxxxxxxxxx>
Author: rpmcruz
Date: Thu May 8 03:40:43 2008
New Revision: 47371

URL: http://svn.opensuse.org/viewcvs/yast?rev=47371&view=rev
Log:
* src/YGPackageSelector.cc: fixed bug 386536: be more strict in the
enforcement of a repository filter:
1st: was showing upgrades for other repositories if the filtered
repository had any version for it, even if an older one.
2nd: make sure context menu and collective installs, use the filtered
repository.
3rd: popup a dialog to confirm the installation of dependencies needed
from other repositories than the filtered one.
* src/yzyppwrapper.h/cc: added a setFavoriteRepository() method and a
callback for the interface to confirm a package from a repository
different than that.
Also replaced the usage of integers for Repositories and Versions for
an actual pointer.

Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGPackageSelector.cc
trunk/gtk/src/YGUtils.cc
trunk/gtk/src/YGUtils.h
trunk/gtk/src/ygtkzyppwrapper.cc
trunk/gtk/src/yzyppwrapper.cc
trunk/gtk/src/yzyppwrapper.h

Modified: trunk/gtk/ChangeLog
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=47371&r1=47370&r2=47371&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Thu May 8 03:40:43 2008
@@ -1,3 +1,19 @@
+2008-05-08 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>
+
+ * src/YGPackageSelector.cc: fixed bug 386536: be more strict in the
+ enforcement of a repository filter:
+ 1st: was showing upgrades for other repositories if the filtered
+ repository had any version for it, even if an older one.
+ 2nd: make sure context menu and collective installs, use the filtered
+ repository.
+ 3rd: popup a dialog to confirm the installation of dependencies needed
+ from other repositories than the filtered one.
+ * src/yzyppwrapper.h/cc: added a setFavoriteRepository() method and a
+ callback for the interface to confirm a package from a repository
+ different than that.
+ Also replaced the usage of integers for Repositories and Versions for
+ an actual pointer.
+
2008-05-07 Michael Meeks <michael.meeks@xxxxxxxxxx>

* src/YGDialog.cc (class YGWindow): only set 'fullscreen' on the main

Modified: trunk/gtk/src/YGPackageSelector.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=47371&r1=47370&r2=47371&view=diff
==============================================================================
--- trunk/gtk/src/YGPackageSelector.cc (original)
+++ trunk/gtk/src/YGPackageSelector.cc Thu May 8 03:40:43 2008
@@ -712,8 +712,9 @@

void modified (Ypp::Package *package)
{
+ const Ypp::Package::Version *version = 0;
std::string text;
- if (package->toInstall()) {
+ if (package->toInstall (&version)) {
if (package->isInstalled())
text = "upgrade";
else {
@@ -733,7 +734,10 @@
else
gtk_widget_show (m_button);
gtk_label_set_text (GTK_LABEL (m_label), text.c_str());
- gtk_widget_set_tooltip_text (m_label,
package->summary().c_str());
+ std::string tooltip = package->summary();
+ if (version)
+ tooltip += "\nfrom <i>" + version->repo->name +
"</i>";
+ gtk_widget_set_tooltip_markup (m_label,
tooltip.c_str());
}

static void undo_clicked_cb (GtkButton *button, Ypp::Package
*package)
@@ -1353,7 +1357,7 @@
}

public:
- int selectedRepo()
+ const Ypp::Repository *selectedRepo()
{
GtkComboBox *combo = GTK_COMBO_BOX (m_repos);
int repo = gtk_combo_box_get_active (combo);
@@ -1367,7 +1371,11 @@
}
}

- return repo-1;
+ const Ypp::Repository *ret = 0;
+ if (repo > 0)
+ ret = Ypp::get()->getRepository (repo-1);
+ Ypp::get()->setFavoriteRepository (ret);
+ return ret;
}

private:
@@ -1426,7 +1434,7 @@

m_collection->writeQuery (query);

- if (selectedRepo() >= 0)
+ if (selectedRepo())
query->addRepository (selectedRepo());

m_listener->doQuery (query);
@@ -1594,20 +1602,23 @@
if (single_package->getAvailableVersion (0)) {
gtk_widget_set_sensitive (m_available_versions,
TRUE);
gtk_widget_show (m_available_box);
- int selectedRepo = m_filters->selectedRepo();
+ const Ypp::Repository *selectedRepo =
m_filters->selectedRepo();
for (int i = 0;
single_package->getAvailableVersion (i); i++) {
const Ypp::Package::Version *version =
single_package->getAvailableVersion (i);
- if (selectedRepo >= 0 && version->repo
!= selectedRepo)
- continue;
string text = version->number + "\n";
- string repo (Ypp::get()->getRepository
(version->repo)->name);
- repo = YGUtils::truncate (repo, 25);
+ string repo = YGUtils::truncate
(version->repo->name,
+ MAX (20,
version->number.length()), 0);
text += "<i>" + repo + "</i>";
GtkTreeIter iter;
gtk_list_store_append (GTK_LIST_STORE
(model), &iter);
gtk_list_store_set (GTK_LIST_STORE
(model), &iter, 0, text.c_str(), -1);
+ if (selectedRepo && version->repo ==
selectedRepo) {
+ gtk_combo_box_set_active
(GTK_COMBO_BOX (m_available_versions), i);
+ gtk_widget_set_sensitive
(m_available_versions, FALSE);
+ }
+ else if (i == 0)
+ gtk_combo_box_set_active
(GTK_COMBO_BOX (m_available_versions), 0);
}
- gtk_combo_box_set_active (GTK_COMBO_BOX
(m_available_versions), 0);
}
else
gtk_widget_hide (m_available_box);
@@ -1672,7 +1683,7 @@
Ypp::Package *package = pThis->m_packages.front();
int version = gtk_combo_box_get_active (GTK_COMBO_BOX (
pThis->m_available_versions));
- package->install (version);
+ package->install (package->getAvailableVersion
(version));
normalCursor();
}
else
@@ -2396,7 +2407,7 @@
return confirmed;
}

- virtual bool resolveProblems (std::list <Ypp::Problem *> problems)
+ virtual bool resolveProblems (const std::list <Ypp::Problem *>
&problems)
{
// we can't use ordinary radio buttons, as gtk+ enforces that
in a group
// one must be selected...
@@ -2450,7 +2461,7 @@
// model
GtkTreeStore *store = gtk_tree_store_new (8, G_TYPE_BOOLEAN,
G_TYPE_BOOLEAN,
G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_POINTER);
- for (std::list <Ypp::Problem *>::iterator it = problems.begin();
+ for (std::list <Ypp::Problem *>::const_iterator it =
problems.begin();
it != problems.end(); it++) {
GtkTreeIter problem_iter;
gtk_tree_store_append (store, &problem_iter, NULL);
@@ -2530,6 +2541,50 @@
return apply;
}

+ virtual bool allowRestrictedRepo (const std::list <std::pair <const
Ypp::Package *, const Ypp::Repository *> > &pkgs)
+ {
+ std::string text;
+ std::list < std::pair <const Ypp::Package *, const
Ypp::Repository *> >::const_iterator it;
+ for (it = pkgs.begin(); it != pkgs.end(); it++) {
+ const Ypp::Package *pkg = it->first;
+ const Ypp::Repository *repo = it->second;
+ if (!text.empty())
+ text += "\n\n";
+ text += pkg->name() + "\n<i>" + repo->name + "</i>";
+ }
+
+ // interface
+ GtkWidget *dialog = gtk_message_dialog_new
(YGDialog::currentWindow(),
+ GtkDialogFlags (0), GTK_MESSAGE_WARNING,
GTK_BUTTONS_NONE, "%s",
+ _("Dependencies from Filtered Repositories"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG
(dialog), "%s",
+ _("The following packages are necessary dependencies
that are not provided "
+ "by the filtered repository. Install them?"));
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ GTK_STOCK_NO, GTK_RESPONSE_NO,
+ GTK_STOCK_YES, GTK_RESPONSE_YES, NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog),
GTK_RESPONSE_YES);
+
+ GtkWidget *label = gtk_label_new (text.c_str());
+ gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
+ gtk_label_set_selectable (GTK_LABEL (label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (label), 0, 0);
+
+ GtkWidget *scroll = gtk_viewport_new (NULL, NULL);
+ gtk_viewport_set_shadow_type (GTK_VIEWPORT (scroll),
GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (scroll), label);
+
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox),
scroll);
+
+ gtk_window_set_resizable (GTK_WINDOW (dialog), TRUE);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), -1, 480);
+ gtk_widget_show_all (dialog);
+
+ bool confirm = (gtk_dialog_run (GTK_DIALOG (dialog)) ==
GTK_RESPONSE_YES);
+ gtk_widget_destroy (dialog);
+ return confirm;
+ }
+
virtual void packageModified (Ypp::Package *package)
{
// FIXME: this is mostly a hack; the thing is that
GtkTreeSelection doesn't

Modified: trunk/gtk/src/YGUtils.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.cc?rev=47371&r1=47370&r2=47371&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.cc (original)
+++ trunk/gtk/src/YGUtils.cc Thu May 8 03:40:43 2008
@@ -79,12 +79,23 @@
}
}

-std::string YGUtils::truncate (const std::string &str, unsigned int length)
+std::string YGUtils::truncate (const std::string &str, unsigned int length,
int pos)
{
std::string ret (str);
if (ret.size() > length) {
- ret.erase (length-3);
- ret += "...";
+ if (pos > 0) {
+ ret.erase (length-3);
+ ret.append ("...");
+ }
+ else if (pos < 0) {
+ ret.erase (0, ret.size()-(length-3));
+ ret.insert (0, "...");
+ }
+ else /* (pos == 0) */ {
+ int delta = ret.size()-(length-3);
+ ret.erase ((ret.size()/2)-(delta/2), delta);
+ ret.insert (ret.size()/2, "...");
+ }
}
return ret;
}
@@ -108,6 +119,7 @@
else
mark = gtk_text_buffer_create_mark (buffer, "scroll", &iter,
FALSE);
gtk_text_view_scroll_mark_onscreen (view, mark);
+// gtk_widget_redraw .... // FIXME: package selector change bug
}

void ygutils_scrollAdj (GtkAdjustment *vadj, gboolean top)

Modified: trunk/gtk/src/YGUtils.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGUtils.h?rev=47371&r1=47370&r2=47371&view=diff
==============================================================================
--- trunk/gtk/src/YGUtils.h (original)
+++ trunk/gtk/src/YGUtils.h Thu May 8 03:40:43 2008
@@ -9,14 +9,6 @@
#include <list>
#include <gtk/gtktextview.h>
#include <gtk/gtkentry.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreemodel.h>
-#include <gtk/gtkcellrenderertoggle.h>
-
-// TODO: do a cleanup here. We should probably split string, gtk and stuff
-// Some GtkTreeView should probably go to their own files
-// Let's avoid GTK+ stuff, better to replicate that, if needed, than leave in
-// this general purpose utils.

/* YGUtils.h/cc have some functionality that is shared between different parts
of the code. */
@@ -32,8 +24,9 @@
/* Replaces every 'mouth' by 'food' in 'str'. */
void replace (std::string &str, const char *mouth, int mouth_len, const
char *food);

- /* Truncates the text with "..." past the given length. */
- std::string truncate (const std::string &str, unsigned int length);
+ /* Truncates the text with "..." past the given length.
+ pos: -1 = start, 0 = middle, 1 = end */
+ std::string truncate (const std::string &str, unsigned int length, int
pos);

/* Escapes markup text (eg. changes '<' by '\<'). */
void escapeMarkup (std::string &str);

Modified: trunk/gtk/src/ygtkzyppwrapper.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtkzyppwrapper.cc?rev=47371&r1=47370&r2=47371&view=diff
==============================================================================
--- trunk/gtk/src/ygtkzyppwrapper.cc (original)
+++ trunk/gtk/src/ygtkzyppwrapper.cc Thu May 8 03:40:43 2008
@@ -302,7 +302,7 @@
}
case YGtkZyppModel::NAME_COLUMN:
{
- std::string name = YGUtils::truncate (package->name(),
15);
+ std::string name = YGUtils::truncate (package->name(),
15, 1);
g_value_set_string (value, g_strdup (name.c_str()));
break;
}

Modified: trunk/gtk/src/yzyppwrapper.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.cc?rev=47371&r1=47370&r2=47371&view=diff
==============================================================================
--- trunk/gtk/src/yzyppwrapper.cc (original)
+++ trunk/gtk/src/yzyppwrapper.cc Thu May 8 03:40:43 2008
@@ -142,7 +142,7 @@
~Impl();

const Repository *getRepository (int nb);
- int getRepository (const std::string &zyppId);
+ const Repository *getRepository (const std::string &zyppId);
Disk *getDisk();

// for Packages
@@ -164,6 +164,7 @@
GSList *packages [Package::TOTAL_TYPES]; // primitive pools
StringTree *categories [Package::TOTAL_TYPES];
GSList *repos;
+ const Repository *favoriteRepo;
Disk *disk;
Interface *interface;
GSList *pkg_listeners;
@@ -237,12 +238,12 @@
Ypp::Package::~Package()
{ delete impl; }

-Ypp::Package::Type Ypp::Package::type()
+Ypp::Package::Type Ypp::Package::type() const
{ return impl->type; }

-const std::string &Ypp::Package::name()
+const std::string &Ypp::Package::name() const
{
- std::string &ret = impl->name;
+ std::string &ret = const_cast <Package *> (this)->impl->name;
if (ret.empty()) {
ZyppSelectable sel = impl->zyppSel;
ZyppObject obj = sel->theObj();
@@ -500,37 +501,16 @@
return impl->category;
}

-bool Ypp::Package::fromCollection (Ypp::Package *collection)
+bool Ypp::Package::fromCollection (const Ypp::Package *collection) const
{
switch (collection->type()) {
case Ypp::Package::PATTERN_TYPE:
{
-//fprintf (stderr, "check if package %s is from collection %s\n",
name().c_str(), collection->name().c_str());
-#if 0
- ZyppSelectable selectable = collection->impl->zyppSel;
- ZyppObject object = selectable->theObj();
- ZyppPattern pattern = tryCastToZyppPattern (object);
-
- zypp::Pattern::Contents contents (pattern->contents());
- for (zypp::Pattern::Contents::Selectable_iterator it =
- contents.selectableBegin(); it !=
contents.selectableEnd(); it++) {
-// ZyppPackage pkg = tryCastToZyppPkg
((*it)->theObj());
-// if (this->impl->zyppSel->name() == pkg->name())
{
-if (this->impl->zyppSel == *it) {
-//fprintf (stderr, "return true\n");
- return true;
- }
- }
-#endif
-
for (GSList *i = collection->impl->packagesCache; i; i
= i->next) {
if (this->impl->zyppSel == i->data)
return true;
}
return false;
-
-//fprintf (stderr, "return false\n");
- break;
}
#if 0
case Ypp::Package::LANGUAGE_TYPE:
@@ -583,15 +563,15 @@
return status == zypp::ui::S_Taboo || status == zypp::ui::S_Protected;
}

-bool Ypp::Package::toInstall (int *nb)
+bool Ypp::Package::toInstall (const Version **version)
{
- if (nb) {
+ if (version) {
ZyppObject candidate = impl->zyppSel->candidateObj();
for (int i = 0; getAvailableVersion (i); i++) {
- const Version *version = getAvailableVersion (i);
- ZyppObject i_obj = (ZyppObjectPtr) version->impl;
- if (i_obj == candidate) {
- *nb = i;
+ const Version *v = getAvailableVersion (i);
+ ZyppObject obj = (ZyppObjectPtr) v->impl;
+ if (obj == candidate) {
+ *version = v;
break;
}
}
@@ -616,7 +596,7 @@
status == zypp::ui::S_AutoDel;
}

-void Ypp::Package::install (int nb)
+void Ypp::Package::install (const Ypp::Package::Version *version)
{
if (isLocked())
return;
@@ -657,7 +637,12 @@

impl->zyppSel->setStatus (status);
if (toInstall()) {
- const Version *version = getAvailableVersion (nb);
+ if (!version) {
+ version = getAvailableVersion (0);
+ const Repository *repo = ypp->favoriteRepository();
+ if (repo && fromRepository (repo))
+ version = fromRepository (repo);
+ }
ZyppObject candidate = (ZyppObjectPtr) version->impl;
if (!impl->zyppSel->setCandidate (candidate)) {
yuiWarning () << "Error: Could not set package '" <<
name() << "' candidate to '" << version->number << "'\n";
@@ -815,14 +800,12 @@
return (Version *) g_slist_nth_data (impl->availableVersions, nb);
}

-bool Ypp::Package::isOnRepository (int repo_nb)
+const Ypp::Package::Version *Ypp::Package::fromRepository (const
Ypp::Repository *repo)
{
- int i;
- for (i = 0; getAvailableVersion (i); i++)
- if (getAvailableVersion (i)->repo == repo_nb)
- return true;
- // if there are no availables, answer yes to all repos
- return i == 0;
+ for (int i = 0; getAvailableVersion (i); i++)
+ if (getAvailableVersion (i)->repo == repo)
+ return getAvailableVersion (i);
+ return NULL;
}

//** Query
@@ -871,9 +854,9 @@

Keys <Ypp::Package::Type> types;
Keys <std::string> names;
- Keys <Ypp::Node *> categories;
- Keys <Ypp::Package *> collections;
- Keys <int> repositories;
+ Keys <Node *> categories;
+ Keys <const Package *> collections;
+ Keys <const Repository *> repositories;
Key <bool> isInstalled;
Key <bool> hasUpgrade;
Key <bool> isModified;
@@ -937,16 +920,28 @@
match = it != values.end();
}
if (match && repositories.defined) {
- const std::list <int> &values = repositories.values;
- std::list <int>::const_iterator it;
- for (it = values.begin(); it != values.end(); it++)
- if (package->isOnRepository (*it))
+ const std::list <const Repository *> &values =
repositories.values;
+ std::list <const Repository *>::const_iterator it;
+ for (it = values.begin(); it != values.end(); it++) {
+ bool match = false;
+ for (int i = 0; package->getAvailableVersion
(i); i++) {
+ const Ypp::Package::Version *version =
package->getAvailableVersion (i);
+ if (version->repo == *it) {
+ // filter if available isn't
upgrade
+ if (package->isInstalled() &&
hasUpgrade.defined && hasUpgrade.value)
+ if (version->cmp > 0)
+ match = true;
+ break;
+ }
+ }
+ if (match)
break;
+ }
match = it != values.end();
}
if (match && collections.defined) {
- const std::list <Ypp::Package *> &values =
collections.values;
- std::list <Ypp::Package *>::const_iterator it;
+ const std::list <const Ypp::Package *> &values =
collections.values;
+ std::list <const Ypp::Package *>::const_iterator it;
for (it = values.begin(); it != values.end(); it++)
if (package->fromCollection (*it))
break;
@@ -976,9 +971,9 @@
}
void Ypp::QueryPool::Query::addCategory (Ypp::Node *value)
{ impl->categories.add (value); }
-void Ypp::QueryPool::Query::addCollection (Ypp::Package *value)
+void Ypp::QueryPool::Query::addCollection (const Ypp::Package *value)
{ impl->collections.add (value); }
-void Ypp::QueryPool::Query::addRepository (int value)
+void Ypp::QueryPool::Query::addRepository (const Repository *value)
{ impl->repositories.add (value); }
void Ypp::QueryPool::Query::setIsInstalled (bool value)
{ impl->isInstalled.set (value); }
@@ -1381,8 +1376,8 @@
//** Ypp top methods & internal connections

Ypp::Impl::Impl()
-: repos (NULL), disk (NULL), interface (NULL), pkg_listeners (NULL),
- inTransaction (false), transactions (NULL)
+: repos (NULL), favoriteRepo (NULL), disk (NULL), interface (NULL),
+ pkg_listeners (NULL), inTransaction (false), transactions (NULL)
{
for (int i = 0; i < Package::TOTAL_TYPES; i++) {
packages[i] = NULL;
@@ -1431,12 +1426,12 @@
return (Repository *) g_slist_nth_data (repos, nb);
}

-int Ypp::Impl::getRepository (const std::string &alias)
+const Ypp::Repository *Ypp::Impl::getRepository (const std::string &alias)
{
for (int i = 0; getRepository (i); i++)
if (getRepository (i)->alias == alias)
- return i;
- return -1; /*error*/
+ return getRepository (i);
+ return NULL; /*error*/
}

Ypp::Disk *Ypp::Impl::getDisk()
@@ -1541,23 +1536,44 @@
void Ypp::Impl::finishTransactions()
{
inTransaction = true;
- bool resolved = resolveProblems();
- if (resolved) {
- // resolver won't tell us what changed -- tell pools about Auto
packages
+ bool cancel = (resolveProblems() == false);
+
+ // check if any package was modified from a restricted repo
+ if (!cancel && ypp->favoriteRepository()) {
+ const Repository *repo = ypp->favoriteRepository();
+ std::list <std::pair <const Package *, const Repository *> >
confirmPkgs;
for (GSList *p = packages [Ypp::Package::PACKAGE_TYPE]; p; p =
p->next) {
Ypp::Package *pkg = (Ypp::Package *) p->data;
if (pkg->impl->isModified()) {
- for (GSList *i = pkg_listeners; i; i = i->next)
- ((PkgListener *)
i->data)->packageModified (pkg);
- pkg->impl->setUnmodified();
+ const Ypp::Package::Version *version = 0;
+ if (pkg->toInstall (&version)) {
+ if (version->repo != repo) {
+ std::pair <const Package *,
const Repository *> p (pkg, version->repo);
+ confirmPkgs.push_back (p);
+ }
+ }
}
}
+ if (!confirmPkgs.empty())
+ cancel = (interface->allowRestrictedRepo (confirmPkgs)
== false);
}
- else {
+
+ if (cancel) {
// user canceled resolver -- undo all
for (GSList *i = transactions; i; i = i->next)
((Ypp::Package *) i->data)->undo();
}
+ else {
+ // resolver won't tell us what changed -- tell pools about Auto
packages
+ for (GSList *p = packages [Ypp::Package::PACKAGE_TYPE]; p; p =
p->next) {
+ Ypp::Package *pkg = (Ypp::Package *) p->data;
+ if (pkg->impl->isModified()) {
+ for (GSList *i = pkg_listeners; i; i = i->next)
+ ((PkgListener *)
i->data)->packageModified (pkg);
+ pkg->impl->setUnmodified();
+ }
+ }
+ }
g_slist_free (transactions);
transactions = NULL;
inTransaction = false;
@@ -1671,6 +1687,12 @@
const Ypp::Repository *Ypp::getRepository (int nb)
{ return impl->getRepository (nb); }

+void Ypp::setFavoriteRepository (const Ypp::Repository *repo)
+{ impl->favoriteRepo = repo; }
+
+const Ypp::Repository *Ypp::favoriteRepository()
+{ return impl->favoriteRepo; }
+
Ypp::Disk *Ypp::getDisk()
{ return impl->getDisk(); }


Modified: trunk/gtk/src/yzyppwrapper.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.h?rev=47371&r1=47370&r2=47371&view=diff
==============================================================================
--- trunk/gtk/src/yzyppwrapper.h (original)
+++ trunk/gtk/src/yzyppwrapper.h Thu May 8 03:40:43 2008
@@ -27,6 +27,8 @@

struct Ypp
{
+ struct Repository;
+
// Utilities
struct Node {
std::string name;
@@ -41,11 +43,11 @@
PACKAGE_TYPE, PATTERN_TYPE, PATCH_TYPE, TOTAL_TYPES
};

- Type type();
- const std::string &name();
+ Type type() const;
+ const std::string &name() const;
const std::string &summary();
Node *category();
- bool fromCollection (Ypp::Package *package);
+ bool fromCollection (const Ypp::Package *collection) const;

std::string description();
std::string filelist();
@@ -55,31 +57,32 @@
std::string provides() const;
std::string requires() const;

+ struct Version {
+ std::string number;
+ const Repository *repo;
+ int cmp /* relatively to installed -- ignore if not
installed */;
+ void *impl;
+ };
+ const Version *getInstalledVersion();
+ const Version *getAvailableVersion (int nb);
+ // convinience -- null if not:
+ const Version *fromRepository (const Repository *repo);
+
bool isInstalled();
bool hasUpgrade();
bool isLocked();

- bool toInstall (int *nb = 0);
+ bool toInstall (const Version **repo = 0);
bool toRemove();
bool isModified();
bool isAuto(); /* installing/removing cause of dependency */

- void install (int nb); /* if installed, will replace it by
that version */
+ void install (const Version *repo); // if installed, will
re-install
+ // null for most recent
version
void remove();
void undo();
void lock (bool lock);

- struct Version {
- std::string number;
- int repo, cmp /*relatively to installed*/;
- void *impl;
- };
- const Version *getInstalledVersion();
- const Version *getAvailableVersion (int nb);
-
- // convinience -- true if any available is from the given repo
- bool isOnRepository (int repo);
-
struct Impl;
Impl *impl;
Package (Impl *impl);
@@ -129,8 +132,8 @@
void addType (Package::Type type);
void addNames (std::string name, char separator = 0);
void addCategory (Ypp::Node *category);
- void addCollection (Ypp::Package *package);
- void addRepository (int repositories);
+ void addCollection (const Ypp::Package *package);
+ void addRepository (const Ypp::Repository
*repositories);
void setIsInstalled (bool installed);
void setHasUpgrade (bool upgradable);
void setIsModified (bool modified);
@@ -198,7 +201,8 @@
struct Interface {
virtual bool acceptLicense (Package *package, const std::string
&license) = 0;
// resolveProblems = false to cancel the action that had that
effect
- virtual bool resolveProblems (std::list <Problem *> problems) =
0;
+ virtual bool resolveProblems (const std::list <Problem *>
&problems) = 0;
+ virtual bool allowRestrictedRepo (const std::list <std::pair
<const Package *, const Repository *> > &pkgs) = 0;
};
void setInterface (Interface *interface);

@@ -208,12 +212,15 @@
void addPkgListener (PkgListener *listener);
void removePkgListener (PkgListener *listener);

- // Misc
+ // Repositories
struct Repository {
std::string name, alias /*internal use*/;
};
const Repository *getRepository (int nb);
+ void setFavoriteRepository (const Repository *repo); /* -1 to disable
restrictions */
+ const Repository *favoriteRepository();

+ // Misc
Node *getFirstCategory (Package::Type type);

struct Disk

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages