r3177 - software/ui/src
Miriam Ruiz
baby-guest at alioth.debian.org
Mon Jul 2 08:37:42 UTC 2007
Author: baby-guest
Date: 2007-07-02 08:37:41 +0000 (Mon, 02 Jul 2007)
New Revision: 3177
Modified:
software/ui/src/games.cpp
Log:
Do not show POPCON column if data are not available
Modified: software/ui/src/games.cpp
===================================================================
--- software/ui/src/games.cpp 2007-07-02 08:25:33 UTC (rev 3176)
+++ software/ui/src/games.cpp 2007-07-02 08:37:41 UTC (rev 3177)
@@ -154,11 +154,21 @@
ui.InterfaceSelection->clear();
ui.InterfaceSelection->add(_("Any interface"), 0, NULL, VoidString, FL_NORMAL_LABEL);
- static int widths[] = { 100, 300, 0 }; // widths for each column
+ static int widths_with_popcon[] = { 100, 300, 0 }; // widths for each column
+ static int widths_without_popcon[] = { 100, 0 };
ui.ResultsBrowser->clear();
- ui.ResultsBrowser->column_widths(widths);
- // tab delimited columns with colors
- ui.ResultsBrowser->add("@B12 at C7@b at .PACKAGE\t at B12@C7 at b@.DESCRIPTION\t at B12@C7 at b@.POPCON");
+ if (engine.popcon().hasData())
+ {
+ ui.ResultsBrowser->column_widths(widths_with_popcon);
+ // tab delimited columns with colors
+ ui.ResultsBrowser->add("@B12 at C7@b at .PACKAGE\t at B12@C7 at b@.DESCRIPTION\t at B12@C7 at b@.POPCON");
+ }
+ else
+ {
+ ui.ResultsBrowser->column_widths(widths_without_popcon);
+ // tab delimited columns with colors
+ ui.ResultsBrowser->add("@B12 at C7@b at .PACKAGE\t at B12@C7 at b@.DESCRIPTION");
+ }
// FIXME: there are better ways to remember the previous item
@@ -192,11 +202,15 @@
{
PackageRecord rec(engine.apt().rawRecord(i->name));
char* userData = pkgString(rec.package());
- string desc = rec.package() + "\t" + rec.shortDescription() + "\t*";
- int stars = (int)rintf(i->popcon * 4 / engine.popconLocalMax());
- for (int j = 0; j < stars; ++j)
- desc += '*';
- printf ("%s (%s): POPCON=%f\n", rec.package().c_str(), rec.shortDescription().c_str(), i->popcon);
+ string desc = rec.package() + "\t" + rec.shortDescription();
+ if (engine.popcon().hasData())
+ {
+ desc += "\t*";
+ int stars = (int)rintf(i->popcon * 4 / engine.popconLocalMax());
+ for (int j = 0; j < stars; ++j)
+ desc += '*';
+ printf ("%s (%s): POPCON=%f\n", rec.package().c_str(), rec.shortDescription().c_str(), i->popcon);
+ }
ui.ResultsBrowser->add(desc.c_str(), userData);
// Relevance is 0 to 100
More information about the Pkg-games-commits
mailing list