Author: rpmcruz Date: Fri Jun 27 05:06:45 2008 New Revision: 48567 URL: http://svn.opensuse.org/viewcvs/yast?rev=48567&view=rev Log: * src/YGPackageSelector.cc: bug fix 404382: was using always the label "upgrade" whether the changes were re-installs or downgrades. * src/YGPackageSelector.cc: reporter 399256 asked for some keyboard mnemonics: added a couple for the install / remove buttons * src/yzyppwrapper.cc: bug fix: consider a pattern or a patch installed or not using isSatisfied() like yast2-qt. Also made initial patterns loading faster. And removed some checks on patches that were causing them not to be displayed (bug 402855). Modified: trunk/gtk/ChangeLog trunk/gtk/src/YGPackageSelector.cc trunk/gtk/src/yzyppwrapper.cc Modified: trunk/gtk/ChangeLog URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=48567&r1=48566&r2=48567&view=diff ============================================================================== --- trunk/gtk/ChangeLog (original) +++ trunk/gtk/ChangeLog Fri Jun 27 05:06:45 2008 @@ -1,3 +1,16 @@ +2008-06-27 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> + + * src/YGPackageSelector.cc: bug fix 404382: was using always the label + "upgrade" whether the changes were re-installs or downgrades. + + * src/YGPackageSelector.cc: reporter 399256 asked for some keyboard + mnemonics: added a couple for the install / remove buttons + + * src/yzyppwrapper.cc: bug fix: consider a pattern or a patch installed + or not using isSatisfied() like yast2-qt. Also made initial patterns + loading faster. And removed some checks on patches that were causing them + not to be displayed (bug 402855). + 2008-06-25 Ricardo Cruz <rpmcruz@alunos.dcc.fc.up.pt> * src/ygtkhtmlwrap.h/c: got rid of set_background and fixed a crash Modified: trunk/gtk/src/YGPackageSelector.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=48567&r1=48566&r2=48567&view=diff ============================================================================== --- trunk/gtk/src/YGPackageSelector.cc (original) +++ trunk/gtk/src/YGPackageSelector.cc Fri Jun 27 05:06:45 2008 @@ -738,8 +738,14 @@ const Ypp::Package::Version *version = 0; std::string text; if (package->toInstall (&version)) { - if (package->isInstalled()) - text = _("upgrade"); + if (package->isInstalled()) { + if (version->cmp > 0) + text = _("upgrade"); + else if (version->cmp < 0) + text = _("downgrade"); + else + text = _("re-install"); + } else if (package->type() == Ypp::Package::PATCH_TYPE) text = _("patch"); else @@ -777,7 +783,7 @@ } static void box_style_set_cb (GtkWidget *widget, GtkStyle *prev_style) { - int width = YGUtils::getCharsWidth (widget, 22); + int width = YGUtils::getCharsWidth (widget, 25); gtk_widget_set_size_request (widget, width, -1); } }; @@ -1526,6 +1532,7 @@ { // installed m_remove_button = createButton (_("_Remove"), GTK_STOCK_DELETE); + gtk_button_set_focus_on_click (GTK_BUTTON (m_remove_button), FALSE); g_signal_connect (G_OBJECT (m_remove_button), "clicked", G_CALLBACK (remove_clicked_cb), this); @@ -1541,6 +1548,7 @@ // available m_install_button = createButton ("", GTK_STOCK_SAVE); + gtk_button_set_focus_on_click (GTK_BUTTON (m_install_button), FALSE); g_signal_connect (G_OBJECT (m_install_button), "clicked", G_CALLBACK (install_clicked_cb), this); @@ -1654,12 +1662,10 @@ if (packages.upgradable()) { gtk_combo_box_append_text (GTK_COMBO_BOX (m_available_versions), "(upgrades)"); gtk_combo_box_set_active (GTK_COMBO_BOX (m_available_versions), 0); - gtk_button_set_label (GTK_BUTTON (m_install_button), _("Upgrade")); } else if (packages.notInstalled()) { gtk_combo_box_append_text (GTK_COMBO_BOX (m_available_versions), "(several)"); gtk_combo_box_set_active (GTK_COMBO_BOX (m_available_versions), 0); - gtk_button_set_label (GTK_BUTTON (m_install_button), _("Install")); } else gtk_widget_hide (m_available_box); @@ -1746,14 +1752,14 @@ version = package->getAvailableVersion (nb); assert (version != NULL); - const char *installLabel = _("Install"); + const char *installLabel = _("_Install"); if (package->isInstalled()) { if (version->cmp > 0) - installLabel = _("Upgrade"); + installLabel = _("_Upgrade"); else if (version->cmp == 0) - installLabel = _("Re-install"); + installLabel = _("_Re-install"); else //if (version->cmp < 0) - installLabel = _("Downgrade"); + installLabel = _("_Downgrade"); } gtk_button_set_label (GTK_BUTTON (pThis->m_install_button), installLabel); } Modified: trunk/gtk/src/yzyppwrapper.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.cc?rev=48567&r1=48566&r2=48567&view=diff ============================================================================== --- trunk/gtk/src/yzyppwrapper.cc (original) +++ trunk/gtk/src/yzyppwrapper.cc Fri Jun 27 05:06:45 2008 @@ -187,7 +187,7 @@ { Impl (Type type, ZyppSelectable sel, Node *category, Node *category2) : type (type), zyppSel (sel), category (category), category2 (category2), - availableVersions (NULL), installedVersion (NULL) + availableVersions (NULL), installedVersion (NULL), packagesCache (NULL) { // don't use getAvailableVersion(0) for hasUpgrade() has its inneficient. // let's just cache candidate() at start, which should point to the newest version. @@ -197,20 +197,6 @@ if (!!candidate && !!installed) hasUpgrade = zypp::Edition::compare (candidate->edition(), installed->edition()) > 0; - packagesCache = NULL; - if (type == PATTERN_TYPE) { - isPatternInstalled = true; - ZyppObject object = sel->theObj(); - ZyppPattern pattern = tryCastToZyppPattern (object); - zypp::Pattern::Contents contents (pattern->contents()); - for (zypp::Pattern::Contents::Selectable_iterator it = - contents.selectableBegin(); it != contents.selectableEnd(); it++) { - packagesCache = g_slist_append (packagesCache, get_pointer (*it)); - if ((*it)->installedEmpty()) - isPatternInstalled = false; - } - } - setUnmodified(); } @@ -228,6 +214,22 @@ inline void setUnmodified() { curStatus = zyppSel->status(); } + GSList *getContainedPackages() + { + if (!packagesCache) { + if (type == PATTERN_TYPE) { + ZyppObject object = zyppSel->theObj(); + ZyppPattern pattern = tryCastToZyppPattern (object); + zypp::Pattern::Contents contents (pattern->contents()); + for (zypp::Pattern::Contents::Selectable_iterator it = + contents.selectableBegin(); it != contents.selectableEnd(); it++) { + packagesCache = g_slist_append (packagesCache, get_pointer (*it)); + } + } + } + return packagesCache; + } + std::string name, summary; Type type; ZyppSelectable zyppSel; @@ -237,7 +239,6 @@ bool hasUpgrade; zypp::ui::Status curStatus; // so we know if resolver touched it // for patterns only: - bool isPatternInstalled; GSList *packagesCache; }; @@ -276,10 +277,8 @@ const std::string &Ypp::Package::summary() { std::string &ret = impl->summary; - if (ret.empty()) { - if (impl->type == PACKAGE_TYPE || impl->type == PATCH_TYPE) - ret = impl->zyppSel->theObj()->summary(); - } + if (ret.empty()) + ret = impl->zyppSel->theObj()->summary(); return ret; } @@ -333,7 +332,7 @@ case PATTERN_TYPE: { int installed = 0, total = 0; - for (GSList *i = impl->packagesCache; i; i = i->next) { + for (GSList *i = impl->getContainedPackages(); i; i = i->next) { ZyppSelectablePtr sel = (ZyppSelectablePtr) i->data; if (!sel->installedEmpty()) installed++; @@ -526,7 +525,7 @@ switch (collection->type()) { case Ypp::Package::PATTERN_TYPE: { - for (GSList *i = collection->impl->packagesCache; i; i = i->next) { + for (GSList *i = collection->impl->getContainedPackages(); i; i = i->next) { if (this->impl->zyppSel == i->data) return true; } @@ -556,20 +555,12 @@ bool Ypp::Package::isInstalled() { - switch (impl->type) { - case Ypp::Package::PATCH_TYPE: - if (!impl->zyppSel->installedEmpty()) { - // broken? show as available - if (impl->zyppSel->installedObj().isBroken()) - return false; - } - break; - case Ypp::Package::PATTERN_TYPE: - return impl->isPatternInstalled; - default: - break; + if (!impl->zyppSel->installedEmpty()) { + if (impl->zyppSel->installedObj().isBroken()) + return false; + return true; } - return !impl->zyppSel->installedEmpty(); + return impl->zyppSel->candidateObj().isSatisfied(); } bool Ypp::Package::hasUpgrade() @@ -1776,9 +1767,6 @@ ZyppPatch patch = tryCastToZyppPatch (object); if (!patch) continue; - if ((*it)->installedEmpty()) - if (!(*it)->hasCandidateObj() || !(*it)->candidateObj().isBroken()) - continue; category = addCategory (type, patch->category()); break; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org