Skip to content

Commit

Permalink
Expand PkInfoEnum to contain package target states for updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ximion committed Mar 19, 2024
1 parent 00e82be commit 2216e12
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
8 changes: 4 additions & 4 deletions backends/apt/pk-backend-apt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,10 @@ static void backend_get_updates_thread(PkBackendJob *job, GVariant *params, gpoi
updates = apt->getUpdates(blocked, downgrades, installs, removals, obsoleted);

apt->emitUpdates(updates, filters);
apt->emitPackages(installs, filters, PK_INFO_ENUM_INSTALLING);
apt->emitPackages(removals, filters, PK_INFO_ENUM_REMOVING);
apt->emitPackages(obsoleted, filters, PK_INFO_ENUM_OBSOLETING);
apt->emitPackages(downgrades, filters, PK_INFO_ENUM_DOWNGRADING);
apt->emitPackages(installs, filters, PK_INFO_ENUM_INSTALL);
apt->emitPackages(removals, filters, PK_INFO_ENUM_REMOVE);
apt->emitPackages(obsoleted, filters, PK_INFO_ENUM_OBSOLETE);
apt->emitPackages(downgrades, filters, PK_INFO_ENUM_DOWNGRADE);
apt->emitPackages(blocked, filters, PK_INFO_ENUM_BLOCKED);
}

Expand Down
24 changes: 22 additions & 2 deletions lib/packagekit-glib2/pk-enum.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,13 @@ static const PkEnumMatch enum_info[] = {
{PK_INFO_ENUM_DOWNGRADING, "downgrading"},
{PK_INFO_ENUM_PREPARING, "preparing"},
{PK_INFO_ENUM_DECOMPRESSING, "decompressing"},
{PK_INFO_ENUM_UNTRUSTED, "untrusted"},
{PK_INFO_ENUM_TRUSTED, "trusted"},
{PK_INFO_ENUM_UNTRUSTED, "untrusted"},
{PK_INFO_ENUM_TRUSTED, "trusted"},
{PK_INFO_ENUM_CRITICAL, "critical"},
{PK_INFO_ENUM_INSTALL, "install"},
{PK_INFO_ENUM_REMOVE, "remove"},
{PK_INFO_ENUM_OBSOLETE, "obsolete"},
{PK_INFO_ENUM_DOWNGRADE, "downgrade"},
{0, NULL}
};

Expand Down Expand Up @@ -1008,6 +1012,22 @@ pk_info_enum_to_localised_text (PkInfoEnum info)
/* TRANSLATORS: The state of a package, i.e. not installed */
text = dgettext("PackageKit", "Unavailable");
break;
case PK_INFO_ENUM_INSTALL:
/* TRANSLATORS: The state of a package: to be installed with the next action */
text = dgettext("PackageKit", "Install");
break;
case PK_INFO_ENUM_REMOVE:
/* TRANSLATORS: The state of a package: to be removed with the next action */
text = dgettext("PackageKit", "Remove");
break;
case PK_INFO_ENUM_OBSOLETE:
/* TRANSLATORS: The state of a package: package is obsolete */
text = dgettext("PackageKit", "Obsolete");
break;
case PK_INFO_ENUM_DOWNGRADE:
/* TRANSLATORS: The state of a package: package is to be downgraded */
text = dgettext("PackageKit", "Downgrade");
break;
default:
g_warning ("info unrecognised: %s", pk_info_enum_to_string (info));
}
Expand Down
12 changes: 10 additions & 2 deletions lib/packagekit-glib2/pk-enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,11 @@ typedef enum {
* @PK_INFO_ENUM_UNTRUSTED:
* @PK_INFO_ENUM_TRUSTED:
* @PK_INFO_ENUM_UNAVAILABLE: Package is unavailable
* @PK_INFO_ENUM_CRITICAL: Package update severity is critical; Since: 1.2.4
* @PK_INFO_ENUM_CRITICAL: Package update severity is critical. Since: 1.2.4
* @PK_INFO_ENUM_INSTALL: Package is intended for installation. Since 1.3.0
* @PK_INFO_ENUM_REMOVE: Package is intended for removal. Since 1.3.0
* @PK_INFO_ENUM_OBSOLETE: Package is obsoleted. Since 1.3.0
* @PK_INFO_ENUM_DOWNGRADE: Package is intended for downgrade. Since 1.3.0
* @PK_INFO_ENUM_LAST:
*
* The enumerated types used in Package() - these have to refer to a specific
Expand Down Expand Up @@ -677,7 +681,11 @@ typedef enum {
PK_INFO_ENUM_UNTRUSTED,
PK_INFO_ENUM_TRUSTED,
PK_INFO_ENUM_UNAVAILABLE,
PK_INFO_ENUM_CRITICAL, /* Since: 1.2.4 */
PK_INFO_ENUM_CRITICAL,
PK_INFO_ENUM_INSTALL,
PK_INFO_ENUM_REMOVE,
PK_INFO_ENUM_OBSOLETE,
PK_INFO_ENUM_DOWNGRADE,
PK_INFO_ENUM_LAST
} PkInfoEnum;

Expand Down

0 comments on commit 2216e12

Please sign in to comment.