Mailinglist Archive: yast-commit (1095 mails)

< Previous Next >
[yast-commit] r52309 - in /trunk/gtk: ChangeLog src/YGPackageSelector.cc src/yzyppwrapper.cc src/yzyppwrapper.h
  • From: rpmcruz@xxxxxxxxxxxxxxxx
  • Date: Thu, 16 Oct 2008 16:29:03 -0000
  • Message-id: <20081016162904.0D1192F02D@xxxxxxxxxxxxxxxx>
Author: rpmcruz
Date: Thu Oct 16 18:29:03 2008
New Revision: 52309

URL: http://svn.opensuse.org/viewcvs/yast?rev=52309&view=rev
Log:
* src/YGPackageSelector.cc (PackagesView): support non-edit mode.

* src/yzyppwrapper.h/.c: added support for unsupported property in
packages and query-pool.

* src/YGPackageSelector.cc: support for the confirmUnsupported() flag:
alert the user about unsupported software.

Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGPackageSelector.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=52309&r1=52308&r2=52309&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Thu Oct 16 18:29:03 2008
@@ -1,3 +1,13 @@
+2008-10-16 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>
+
+ * src/YGPackageSelector.cc (PackagesView): support non-edit mode.
+
+ * src/yzyppwrapper.h/.c: added support for unsupported property in
+ packages and query-pool.
+
+ * src/YGPackageSelector.cc: support for the confirmUnsupported() flag:
+ alert the user about unsupported software.
+
2008-10-15 Ricardo Cruz <rpmcruz@xxxxxxxxxxxxxxxxxxx>

* src/ygtkrichtext.c: ygtkrichtext popup menu treatment this time.

Modified: trunk/gtk/src/YGPackageSelector.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGPackageSelector.cc?rev=52309&r1=52308&r2=52309&view=diff
==============================================================================
--- trunk/gtk/src/YGPackageSelector.cc (original)
+++ trunk/gtk/src/YGPackageSelector.cc Thu Oct 16 18:29:03 2008
@@ -407,7 +407,7 @@
struct ListView : public View
{
bool m_isTree;
- ListView (bool isTree, bool showTooltips, PackagesView *parent)
+ ListView (bool isTree, bool showTooltips, bool editable,
PackagesView *parent)
: View (parent), m_isTree (isTree)
{
GtkTreeView *view = GTK_TREE_VIEW (m_widget =
gtk_tree_view_new());
@@ -441,10 +441,12 @@
this, NULL);
gtk_widget_show (m_widget);

- g_signal_connect (G_OBJECT (m_widget), "popup-menu",
- G_CALLBACK (popup_key_cb), this);
- g_signal_connect (G_OBJECT (m_widget),
"button-press-event",
- G_CALLBACK (popup_button_cb), this);
+ if (editable) {
+ g_signal_connect (G_OBJECT (m_widget),
"popup-menu",
+ G_CALLBACK
(popup_key_cb), this);
+ g_signal_connect (G_OBJECT (m_widget),
"button-press-event",
+ G_CALLBACK
(popup_button_cb), this);
+ }
g_signal_connect_after (G_OBJECT (m_widget),
"size-allocate",
G_CALLBACK (size_allocated_cb),
this);
if (showTooltips) {
@@ -549,7 +551,7 @@
};
struct IconView : public View
{
- IconView (PackagesView *parent)
+ IconView (bool editable, PackagesView *parent)
: View (parent)
{
GtkIconView *view = GTK_ICON_VIEW (m_widget =
gtk_icon_view_new());
@@ -560,10 +562,12 @@
G_CALLBACK
(packages_selected_cb), this);
gtk_widget_show (m_widget);

- g_signal_connect (G_OBJECT (m_widget), "popup-menu",
- G_CALLBACK (popup_key_cb), this);
- g_signal_connect_after (G_OBJECT (m_widget),
"button-press-event",
- G_CALLBACK
(popup_button_after_cb), this);
+ if (editable) {
+ g_signal_connect (G_OBJECT (m_widget),
"popup-menu",
+ G_CALLBACK
(popup_key_cb), this);
+ g_signal_connect_after (G_OBJECT (m_widget),
"button-press-event",
+ G_CALLBACK
(popup_button_after_cb), this);
+ }
g_signal_connect_after (G_OBJECT (m_widget),
"size-allocate",
G_CALLBACK (size_allocated_cb),
this);
}
@@ -620,7 +624,7 @@
GtkWidget *getWidget()
{ return m_bin; }

- PackagesView (bool isTree)
+ PackagesView (bool isTree, bool editable)
: m_listener (NULL), m_model (NULL), m_view (NULL), m_isTree (isTree)
{
m_bin = ygtk_scrolled_window_new();
@@ -636,7 +640,7 @@
ygtk_scrolled_window_set_corner_widget
(YGTK_SCROLLED_WINDOW (m_bin), buttons);
}

- setMode (LIST_MODE);
+ setMode (LIST_MODE, editable);
}

~PackagesView()
@@ -649,7 +653,7 @@
enum ViewMode {
LIST_MODE, ICON_MODE
};
- void setMode (ViewMode mode)
+ void setMode (ViewMode mode, bool editable)
{
if (inited())
busyCursor();
@@ -658,15 +662,16 @@
gtk_container_remove (GTK_CONTAINER (m_bin),
m_view->m_widget);
delete m_view;
if (mode == LIST_MODE)
- m_view = new ListView (m_isTree, m_isTree, this);
+ m_view = new ListView (m_isTree, m_isTree, editable,
this);
else
- m_view = new IconView (this);
+ m_view = new IconView (editable, this);
gtk_container_add (GTK_CONTAINER (m_bin), m_view->m_widget);
if (m_model)
m_view->setModel (m_model);

packagesSelected (PkgList());
normalCursor();
+ gtk_widget_show_all (m_bin);
}

void setPool (Ypp::Pool *pool)
@@ -728,7 +733,7 @@
static void mode_toggled_cb (GtkToggleButton *toggle, gint nb,
PackagesView *pThis)
{
ViewMode mode = (nb == 0) ? LIST_MODE : ICON_MODE;
- pThis->setMode (mode);
+ pThis->setMode (mode, true);
}
};

@@ -1249,7 +1254,7 @@
Pool (Collections::Listener *listener, Ypp::Package::Type type)
: View (listener)
{
- m_view = new PackagesView (true);
+ m_view = new PackagesView (true, true);
m_view->setPool (new Ypp::TreePool (type));
m_view->setListener (this);

@@ -2377,7 +2382,7 @@
PackageSelector (YGtkWizard *wizard, bool updateMode, bool
enableRepoMgr,
bool summaryMode)
{
- m_packages = new PackagesView (false);
+ m_packages = new PackagesView (false, true);
m_filters = new Filters (updateMode, enableRepoMgr);
m_control = new PackageControl (m_filters);
m_details = new PackageDetails (updateMode);
@@ -2532,6 +2537,38 @@

if (!strcmp (action, "accept")) {
yuiMilestone() << "Closing PackageSelector with
'accept'" << endl;
+ if (pThis->confirmUnsupported()) {
+ Ypp::QueryPool::Query *query = new
Ypp::QueryPool::Query();
+ query->addType (Ypp::Package::PACKAGE_TYPE);
+ query->setIsInstalled (false);
+ query->setToModify (true);
+ query->setIsUnsupported (true);
+
+ Ypp::QueryPool *pool = new Ypp::QueryPool
(query);
+ if (!pool->empty()) {
+ // show which packages are unsupported
+ GtkWidget *dialog;
+ dialog = gtk_message_dialog_new
+ (YGDialog::currentWindow(),
+
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE, "%s",
_("Unsupported Packages"));
+
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s",
+ _("Please realize that the
following software is either unsupported or "
+ "requires an additional
customer contract for support."));
+ gtk_dialog_add_buttons (GTK_DIALOG
(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
+
GTK_STOCK_OK, GTK_RESPONSE_YES, NULL);
+
+ PackagesView *view = new PackagesView
(false, false);
+ view->setPool (pool);
+ gtk_container_add (GTK_CONTAINER
(GTK_DIALOG (dialog)->vbox), view->getWidget());
+
+ bool ok = gtk_dialog_run (GTK_DIALOG
(dialog)) == GTK_RESPONSE_YES;
+ gtk_widget_destroy (dialog);
+ if (!ok) return;
+ }
+ else
+ delete pool;
+ }
YGUI::ui()->sendEvent (new YMenuEvent ("accept"));
}
else if (!strcmp (action, "cancel")) {

Modified: trunk/gtk/src/yzyppwrapper.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.cc?rev=52309&r1=52308&r2=52309&view=diff
==============================================================================
--- trunk/gtk/src/yzyppwrapper.cc (original)
+++ trunk/gtk/src/yzyppwrapper.cc Thu Oct 16 18:29:03 2008
@@ -211,8 +211,9 @@
virtual std::string changelog() { return ""; }
virtual std::string authors (bool rich) { return ""; }
virtual std::string icon() { return ""; }
- virtual bool isRecommended() const { return false; }
- virtual bool isSuggested() const { return false; }
+ virtual bool isRecommended() const { return false; }
+ virtual bool isSuggested() const { return false; }
+ virtual bool isUnsupported() const { return false; }

virtual std::string provides (bool rich) const { return ""; }
virtual std::string requires (bool rich) const { return ""; }
@@ -267,6 +268,7 @@
std::string Ypp::Package::icon() { return impl->icon(); }
bool Ypp::Package::isRecommended() const { return
impl->isRecommended(); }
bool Ypp::Package::isSuggested() const { return
impl->isSuggested(); }
+bool Ypp::Package::isUnsupported() const { return
impl->isUnsupported(); }

std::string Ypp::Package::provides (bool rich) const { return
impl->provides (rich); }
std::string Ypp::Package::requires (bool rich) const { return
impl->requires (rich); }
@@ -435,6 +437,12 @@
#else
text += br + "<b>" + _("Size:") + "</b> " +
object->installsize().asString();
#endif
+ if (!isInstalled()) {
+ if (isRecommended() || isSuggested())
+ text += br + "<b><font
color=\"orange\">" + (isRecommended() ? _("Recommended") : _("Suggested")) + "
" + _("for install") + "</font></b>";
+ }
+ if (isUnsupported())
+ text += br + "<b><font color=\"red\">"
+ _("Not covered by the default support contract.") + "</font></b>";
break;
}
case Ypp::Package::PATCH_TYPE:
@@ -643,6 +651,19 @@
return zypp::PoolItem (m_sel->theObj()).status().isSuggested();
}

+ virtual bool isUnsupported() const
+ {
+#if ZYPP_VERSION >= 5013001
+ if (type != Ypp::Package::PACKAGE_TYPE)
+ return false;
+ ZyppObject object = m_sel->theObj();
+ ZyppPackage package = tryCastToZyppPkg (object);
+ return package->maybeUnsupported();
+#else
+ return false;
+#endif
+ }
+
virtual std::string provides (bool rich) const
{
std::string text;
@@ -1190,6 +1211,7 @@
Key <bool> toModify;
Key <bool> isRecommended;
Key <bool> isSuggested;
+ Key <bool> isUnsupported;
Ypp::Package *highlight;

Impl()
@@ -1238,6 +1260,8 @@
match = isRecommended.is (package->isRecommended());
if (match && isSuggested.defined)
match = isSuggested.is (package->isSuggested());
+ if (match && isUnsupported.defined)
+ match = isUnsupported.is (package->isUnsupported());
if (match && names.defined) {
const std::list <std::string> &values = names.values;
std::list <std::string>::const_iterator it;
@@ -1371,6 +1395,8 @@
{ impl->isRecommended.set (value); }
void Ypp::QueryPool::Query::setIsSuggested (bool value)
{ impl->isSuggested.set (value); }
+void Ypp::QueryPool::Query::setIsUnsupported (bool value)
+{ impl->isUnsupported.set (value); }

//** Pool


Modified: trunk/gtk/src/yzyppwrapper.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/yzyppwrapper.h?rev=52309&r1=52308&r2=52309&view=diff
==============================================================================
--- trunk/gtk/src/yzyppwrapper.h (original)
+++ trunk/gtk/src/yzyppwrapper.h Thu Oct 16 18:29:03 2008
@@ -60,6 +60,7 @@
std::string icon();
bool isRecommended() const;
bool isSuggested() const;
+ bool isUnsupported() const;

std::string provides (bool rich) const;
std::string requires (bool rich) const;
@@ -153,6 +154,7 @@
void setToModify (bool modify);
void setIsRecommended (bool recommended);
void setIsSuggested (bool suggested);
+ void setIsUnsupported (bool unsupported);

~Query();
struct Impl;

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

< Previous Next >
This Thread
  • No further messages