[gnome-software] Remove the confusion of kind and id-kind
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Remove the confusion of kind and id-kind
- Date: Fri, 26 Feb 2016 10:40:31 +0000 (UTC)
commit a93c9c415ebbd86c89f9ba7e552408ecc0b2fb0b
Author: Richard Hughes <richard hughsie com>
Date: Fri Feb 26 08:25:48 2016 +0000
Remove the confusion of kind and id-kind
This makes things a bit simpler, removing a lot of duplicated states and adding
a compulsory boolean to GsApp to avoid overloading the kind.
The missing kind has also been converted to using the UNAVAILABLE state instead.
src/gs-app-addon-row.c | 2 +-
src/gs-app-row.c | 18 ++--
src/gs-app.c | 146 +++++++++---------------
src/gs-app.h | 25 +----
src/gs-cmd.c | 2 +-
src/gs-page.c | 2 +-
src/gs-plugin-loader.c | 135 +++++++++++-----------
src/gs-self-test.c | 7 +-
src/gs-shell-details.c | 43 +++----
src/gs-shell-extras.c | 9 +-
src/gs-shell-installed.c | 30 +----
src/gs-shell-moderate.c | 3 +-
src/gs-shell-search.c | 4 +-
src/gs-sources-dialog.c | 5 +-
src/gs-update-dialog.c | 10 +-
src/gs-update-list.c | 6 +-
src/gs-utils.c | 4 +-
src/plugins/gs-plugin-appstream.c | 24 ++--
src/plugins/gs-plugin-dummy.c | 26 ++--
src/plugins/gs-plugin-epiphany.c | 4 +-
src/plugins/gs-plugin-fedora-distro-upgrades.c | 2 +-
src/plugins/gs-plugin-fwupd.c | 12 +-
src/plugins/gs-plugin-limba.c | 4 +-
src/plugins/gs-plugin-moduleset.c | 4 +-
src/plugins/gs-plugin-packagekit-history.c | 4 +-
src/plugins/gs-plugin-packagekit-offline.c | 2 +-
src/plugins/gs-plugin-packagekit-refine.c | 10 +-
src/plugins/gs-plugin-packagekit-refresh.c | 6 +-
src/plugins/gs-plugin-packagekit.c | 6 +-
src/plugins/gs-plugin-self-test.c | 2 +-
src/plugins/gs-plugin-systemd-updates.c | 2 +-
src/plugins/gs-plugin-xdg-app-reviews.c | 4 +-
src/plugins/gs-plugin-xdg-app.c | 12 +-
src/plugins/packagekit-common.c | 2 +-
34 files changed, 248 insertions(+), 329 deletions(-)
---
diff --git a/src/gs-app-addon-row.c b/src/gs-app-addon-row.c
index 763c11d..c488b41 100644
--- a/src/gs-app-addon-row.c
+++ b/src/gs-app-addon-row.c
@@ -58,7 +58,7 @@ gs_app_addon_row_get_summary (GsAppAddonRow *row)
g_autofree gchar *escaped = NULL;
/* try all these things in order */
- if (gs_app_get_kind (row->app) == GS_APP_KIND_MISSING)
+ if (gs_app_get_state (row->app) == AS_APP_STATE_UNAVAILABLE)
tmp = gs_app_get_summary_missing (row->app);
if (tmp == NULL || (tmp != NULL && tmp[0] == '\0'))
tmp = gs_app_get_summary (row->app);
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 553c1ba..5719693 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -101,7 +101,7 @@ gs_app_row_get_description (GsAppRow *app_row)
}
}
- if (gs_app_get_kind (priv->app) == GS_APP_KIND_MISSING)
+ if (gs_app_get_state (priv->app) == AS_APP_STATE_UNAVAILABLE)
return g_string_new (gs_app_get_summary_missing (priv->app));
/* try all these things in order */
@@ -153,7 +153,7 @@ gs_app_row_refresh (GsAppRow *app_row)
}
/* add warning */
- if (gs_app_get_kind (priv->app) == GS_APP_KIND_FIRMWARE_UPDATE) {
+ if (gs_app_get_kind (priv->app) == AS_APP_KIND_FIRMWARE) {
gtk_label_set_text (GTK_LABEL (priv->label_tag_warning),
/* TRANSLATORS: during the update the device
* will restart into a special update-only mode */
@@ -167,7 +167,7 @@ gs_app_row_refresh (GsAppRow *app_row)
gtk_widget_set_visible (priv->label_tag_nonfree, FALSE);
gtk_widget_set_visible (priv->label_tag_foreign, FALSE);
} else {
- switch (gs_app_get_id_kind (priv->app)) {
+ switch (gs_app_get_kind (priv->app)) {
case AS_APP_KIND_UNKNOWN:
gtk_widget_set_visible (priv->label_tag_webapp, FALSE);
gtk_widget_set_visible (priv->label_tag_nonfree, FALSE);
@@ -199,7 +199,7 @@ gs_app_row_refresh (GsAppRow *app_row)
gs_app_get_update_version_ui (priv->app));
} else {
gtk_widget_hide (priv->version_label);
- if (gs_app_get_kind (priv->app) == GS_APP_KIND_MISSING ||
+ if (gs_app_get_state (priv->app) == AS_APP_STATE_UNAVAILABLE ||
gs_app_get_rating (priv->app) <= 0) {
gtk_widget_hide (priv->star);
} else {
@@ -235,7 +235,7 @@ gs_app_row_refresh (GsAppRow *app_row)
gs_app_get_pixbuf (priv->app));
context = gtk_widget_get_style_context (priv->image);
- if (gs_app_get_kind (priv->app) == GS_APP_KIND_MISSING)
+ if (gs_app_get_state (priv->app) == AS_APP_STATE_UNAVAILABLE)
gtk_style_context_add_class (context, "dimmer-label");
else
gtk_style_context_remove_class (context, "dimmer-label");
@@ -295,7 +295,7 @@ gs_app_row_refresh (GsAppRow *app_row)
break;
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_INSTALLED:
- if (gs_app_get_kind (priv->app) != GS_APP_KIND_SYSTEM)
+ if (!gs_app_get_compulsory (priv->app))
gtk_widget_set_visible (priv->button, TRUE);
/* TRANSLATORS: this is a button next to the search results that
* allows the application to be easily removed */
@@ -335,9 +335,9 @@ gs_app_row_refresh (GsAppRow *app_row)
}
if (priv->selectable) {
- if (gs_app_get_id_kind (priv->app) == AS_APP_KIND_DESKTOP ||
- gs_app_get_id_kind (priv->app) == AS_APP_KIND_RUNTIME ||
- gs_app_get_id_kind (priv->app) == AS_APP_KIND_WEB_APP)
+ if (gs_app_get_kind (priv->app) == AS_APP_KIND_DESKTOP ||
+ gs_app_get_kind (priv->app) == AS_APP_KIND_RUNTIME ||
+ gs_app_get_kind (priv->app) == AS_APP_KIND_WEB_APP)
gtk_widget_set_visible (priv->checkbox, TRUE);
gtk_widget_set_sensitive (priv->button, FALSE);
} else {
diff --git a/src/gs-app.c b/src/gs-app.c
index a13fa1a..0ef48e9 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -26,9 +26,9 @@
*
* This object represents a 1:1 mapping to a .desktop file. The design is such
* so you can't have different GsApp's for different versions or architectures
- * of a package. This rule really only applies to GsApps of kind GS_APP_KIND_NORMAL
- * and GS_APP_KIND_SYSTEM. We allow GsApps of kind GS_APP_KIND_SYSTEM_UPDATE or
- * GS_APP_KIND_PACKAGE, which don't correspond to desktop files, but instead
+ * of a package. This rule really only applies to GsApps of kind AS_APP_KIND_DESKTOP
+ * and AS_APP_KIND_GENERIC. We allow GsApps of kind AS_APP_KIND_OS_UPDATE or
+ * AS_APP_KIND_GENERIC, which don't correspond to desktop files, but instead
* represent a system update and its individual components.
*
* The #GsPluginLoader de-duplicates the GsApp instances that are produced by
@@ -86,8 +86,7 @@ struct _GsApp
GArray *review_ratings;
GPtrArray *reviews; /* of GsReview */
guint64 size;
- GsAppKind kind;
- AsAppKind id_kind;
+ AsAppKind kind;
AsAppState state;
guint progress;
GHashTable *metadata;
@@ -101,6 +100,7 @@ struct _GsApp
guint64 kudos;
gboolean to_be_installed;
gboolean provenance;
+ gboolean compulsory;
gboolean licence_is_free;
GsApp *runtime;
};
@@ -129,35 +129,6 @@ G_DEFINE_TYPE (GsApp, gs_app, G_TYPE_OBJECT)
G_DEFINE_QUARK (gs-app-error-quark, gs_app_error)
/**
- * gs_app_kind_to_string:
- **/
-const gchar *
-gs_app_kind_to_string (GsAppKind kind)
-{
- if (kind == GS_APP_KIND_UNKNOWN)
- return "unknown";
- if (kind == GS_APP_KIND_NORMAL)
- return "normal";
- if (kind == GS_APP_KIND_SYSTEM)
- return "system";
- if (kind == GS_APP_KIND_PACKAGE)
- return "package";
- if (kind == GS_APP_KIND_OS_UPDATE)
- return "os-update";
- if (kind == GS_APP_KIND_MISSING)
- return "missing";
- if (kind == GS_APP_KIND_SOURCE)
- return "source";
- if (kind == GS_APP_KIND_CORE)
- return "core";
- if (kind == GS_APP_KIND_DISTRO_UPGRADE)
- return "distro-upgrade";
- if (kind == GS_APP_KIND_FIRMWARE_UPDATE)
- return "firmware-update";
- return NULL;
-}
-
-/**
* gs_app_to_string:
**/
gchar *
@@ -175,11 +146,9 @@ gs_app_to_string (GsApp *app)
str = g_string_new ("GsApp:\n");
g_string_append_printf (str, "\tkind:\t%s\n",
- gs_app_kind_to_string (app->kind));
- if (app->id_kind != AS_APP_KIND_UNKNOWN) {
- g_string_append_printf (str, "\tid-kind:\t%s\n",
- as_app_kind_to_string (app->id_kind));
- }
+ as_app_kind_to_string (app->kind));
+ g_string_append_printf (str, "\tcompulsory:\t%s\n",
+ app->compulsory ? "True" : "False");
g_string_append_printf (str, "\tstate:\t%s\n",
as_app_state_to_string (app->state));
if (app->progress > 0)
@@ -580,10 +549,10 @@ gs_app_set_state (GsApp *app, AsAppState state)
/**
* gs_app_get_kind:
*/
-GsAppKind
+AsAppKind
gs_app_get_kind (GsApp *app)
{
- g_return_val_if_fail (GS_IS_APP (app), GS_APP_KIND_UNKNOWN);
+ g_return_val_if_fail (GS_IS_APP (app), AS_APP_KIND_UNKNOWN);
return app->kind;
}
@@ -591,14 +560,14 @@ gs_app_get_kind (GsApp *app)
* gs_app_set_kind:
*
* This sets the kind of the application. The following state diagram explains
- * the typical states. All applications start with kind %GS_APP_KIND_UNKNOWN.
+ * the typical states. All applications start with kind %AS_APP_KIND_UNKNOWN.
*
* PACKAGE --> NORMAL
* PACKAGE --> SYSTEM
* NORMAL --> SYSTEM
*/
void
-gs_app_set_kind (GsApp *app, GsAppKind kind)
+gs_app_set_kind (GsApp *app, AsAppKind kind)
{
gboolean state_change_ok = FALSE;
@@ -608,35 +577,29 @@ gs_app_set_kind (GsApp *app, GsAppKind kind)
/* check the state change is allowed */
switch (app->kind) {
- case GS_APP_KIND_UNKNOWN:
+ case AS_APP_KIND_UNKNOWN:
/* unknown can go into any state */
state_change_ok = TRUE;
break;
- case GS_APP_KIND_PACKAGE:
+ case AS_APP_KIND_GENERIC:
/* package can become either normal or a system application */
- if (kind == GS_APP_KIND_NORMAL ||
- kind == GS_APP_KIND_SYSTEM ||
- kind == GS_APP_KIND_CORE ||
- kind == GS_APP_KIND_SOURCE ||
- kind == GS_APP_KIND_UNKNOWN)
+ if (kind == AS_APP_KIND_DESKTOP ||
+ kind == AS_APP_KIND_SOURCE ||
+ kind == AS_APP_KIND_UNKNOWN)
state_change_ok = TRUE;
break;
- case GS_APP_KIND_NORMAL:
+ case AS_APP_KIND_DESKTOP:
/* normal can only be promoted to system */
- if (kind == GS_APP_KIND_SYSTEM ||
- kind == GS_APP_KIND_UNKNOWN)
+ if (kind == AS_APP_KIND_UNKNOWN)
state_change_ok = TRUE;
break;
- case GS_APP_KIND_SYSTEM:
- case GS_APP_KIND_OS_UPDATE:
- case GS_APP_KIND_CORE:
- case GS_APP_KIND_SOURCE:
- case GS_APP_KIND_MISSING:
+ case AS_APP_KIND_OS_UPDATE:
+ case AS_APP_KIND_SOURCE:
/* this can never change state */
break;
default:
g_warning ("kind %s unhandled",
- gs_app_kind_to_string (app->kind));
+ as_app_kind_to_string (app->kind));
g_assert_not_reached ();
}
@@ -644,8 +607,8 @@ gs_app_set_kind (GsApp *app, GsAppKind kind)
if (!state_change_ok) {
g_warning ("Kind change on %s from %s to %s is not OK",
app->id,
- gs_app_kind_to_string (app->kind),
- gs_app_kind_to_string (kind));
+ as_app_kind_to_string (app->kind),
+ as_app_kind_to_string (kind));
return;
}
@@ -654,26 +617,6 @@ gs_app_set_kind (GsApp *app, GsAppKind kind)
}
/**
- * gs_app_get_id_kind:
- */
-AsAppKind
-gs_app_get_id_kind (GsApp *app)
-{
- g_return_val_if_fail (GS_IS_APP (app), GS_APP_KIND_UNKNOWN);
- return app->id_kind;
-}
-
-/**
- * gs_app_set_id_kind:
- */
-void
-gs_app_set_id_kind (GsApp *app, AsAppKind id_kind)
-{
- g_return_if_fail (GS_IS_APP (app));
- app->id_kind = id_kind;
-}
-
-/**
* gs_app_get_name:
*/
const gchar *
@@ -861,11 +804,11 @@ gs_app_set_project_group (GsApp *app, const gchar *project_group)
static gboolean
gs_app_is_addon_id_kind (GsApp *app)
{
- AsAppKind id_kind;
- id_kind = gs_app_get_id_kind (app);
- if (id_kind == AS_APP_KIND_DESKTOP)
+ AsAppKind kind;
+ kind = gs_app_get_kind (app);
+ if (kind == AS_APP_KIND_DESKTOP)
return FALSE;
- if (id_kind == AS_APP_KIND_WEB_APP)
+ if (kind == AS_APP_KIND_WEB_APP)
return FALSE;
return TRUE;
}
@@ -926,7 +869,7 @@ gs_app_get_pixbuf (GsApp *app)
} else if (app->pixbuf == NULL && gs_app_get_state (app) == AS_APP_STATE_AVAILABLE_LOCAL) {
const gchar *icon_name;
- if (gs_app_get_kind (app) == GS_APP_KIND_SOURCE)
+ if (gs_app_get_kind (app) == AS_APP_KIND_SOURCE)
icon_name = "x-package-repository";
else if (gs_app_is_addon_id_kind (app))
icon_name = "application-x-addon";
@@ -938,19 +881,20 @@ gs_app_get_pixbuf (GsApp *app)
GTK_ICON_LOOKUP_FORCE_SIZE,
NULL);
- } else if (app->pixbuf == NULL && gs_app_get_kind (app) == GS_APP_KIND_PACKAGE) {
+ } else if (app->pixbuf == NULL && gs_app_get_kind (app) == AS_APP_KIND_GENERIC) {
app->pixbuf = gtk_icon_theme_load_icon (icon_theme_get (),
"application-x-addon", 64,
GTK_ICON_LOOKUP_USE_BUILTIN |
GTK_ICON_LOOKUP_FORCE_SIZE,
NULL);
- } else if (app->pixbuf == NULL && gs_app_get_kind (app) == GS_APP_KIND_OS_UPDATE) {
+ } else if (app->pixbuf == NULL && gs_app_get_kind (app) == AS_APP_KIND_OS_UPDATE) {
app->pixbuf = gtk_icon_theme_load_icon (icon_theme_get (),
"software-update-available-symbolic", 64,
GTK_ICON_LOOKUP_USE_BUILTIN |
GTK_ICON_LOOKUP_FORCE_SIZE,
NULL);
- } else if (app->pixbuf == NULL && gs_app_get_kind (app) == GS_APP_KIND_MISSING) {
+ } else if (app->pixbuf == NULL &&
+ gs_app_get_state (app) == AS_APP_STATE_UNAVAILABLE) {
app->pixbuf = gtk_icon_theme_load_icon (icon_theme_get (),
"dialog-question-symbolic", 16,
GTK_ICON_LOOKUP_USE_BUILTIN |
@@ -2092,6 +2036,24 @@ gs_app_set_provenance (GsApp *app, gboolean provenance)
}
/**
+ * gs_app_get_compulsory:
+ */
+gboolean
+gs_app_get_compulsory (GsApp *app)
+{
+ return app->compulsory;
+}
+
+/**
+ * gs_app_set_compulsory:
+ */
+void
+gs_app_set_compulsory (GsApp *app, gboolean compulsory)
+{
+ app->compulsory = compulsory;
+}
+
+/**
* gs_app_subsume:
*
* Imports all the useful data from @other into @app.
@@ -2417,9 +2379,9 @@ gs_app_class_init (GsAppClass *klass)
* GsApp:kind:
*/
pspec = g_param_spec_uint ("kind", NULL, NULL,
- GS_APP_KIND_UNKNOWN,
- GS_APP_KIND_LAST,
- GS_APP_KIND_UNKNOWN,
+ AS_APP_KIND_UNKNOWN,
+ AS_APP_KIND_LAST,
+ AS_APP_KIND_UNKNOWN,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_KIND, pspec);
diff --git a/src/gs-app.h b/src/gs-app.h
index c88eb16..e26f3a2 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -40,20 +40,6 @@ typedef enum {
} GsAppError;
typedef enum {
- GS_APP_KIND_UNKNOWN,
- GS_APP_KIND_NORMAL, /* app [ install:1 remove:1 update:1 ] */
- GS_APP_KIND_SYSTEM, /* app [ install:0 remove:0 update:1 ] */
- GS_APP_KIND_PACKAGE, /* pkg [ install:0 remove:0 update:1 ] */
- GS_APP_KIND_OS_UPDATE, /* pkg [ install:0 remove:0 update:1 ] */
- GS_APP_KIND_MISSING, /* meta [ install:0 remove:0 update:0 ] */
- GS_APP_KIND_SOURCE, /* src [ install:1 remove:0 update:0 ] */
- GS_APP_KIND_CORE, /* pkg [ install:0 remove:0 update:1 ] */
- GS_APP_KIND_DISTRO_UPGRADE, /* meta [ install:0 remove:0 update:1 ] */
- GS_APP_KIND_FIRMWARE_UPDATE, /* app [ install:0 remove:0 update:1 ] */
- GS_APP_KIND_LAST
-} GsAppKind;
-
-typedef enum {
GS_APP_KUDO_MY_LANGUAGE = 1 << 0,
GS_APP_KUDO_RECENT_RELEASE = 1 << 1,
GS_APP_KUDO_FEATURED_RECOMMENDED = 1 << 2,
@@ -91,7 +77,6 @@ GQuark gs_app_error_quark (void);
GsApp *gs_app_new (const gchar *id);
gchar *gs_app_to_string (GsApp *app);
-const gchar *gs_app_kind_to_string (GsAppKind kind);
void gs_app_subsume (GsApp *app,
GsApp *other);
@@ -100,12 +85,9 @@ const gchar *gs_app_get_id (GsApp *app);
void gs_app_set_id (GsApp *app,
const gchar *id);
const gchar *gs_app_get_id_no_prefix (GsApp *app);
-GsAppKind gs_app_get_kind (GsApp *app);
+AsAppKind gs_app_get_kind (GsApp *app);
void gs_app_set_kind (GsApp *app,
- GsAppKind kind);
-AsAppKind gs_app_get_id_kind (GsApp *app);
-void gs_app_set_id_kind (GsApp *app,
- AsAppKind id_kind);
+ AsAppKind kind);
AsAppState gs_app_get_state (GsApp *app);
void gs_app_set_state (GsApp *app,
AsAppState state);
@@ -249,6 +231,9 @@ const gchar *gs_app_get_search_sort_key (GsApp *app);
gboolean gs_app_get_provenance (GsApp *app);
void gs_app_set_provenance (GsApp *app,
gboolean provenance);
+gboolean gs_app_get_compulsory (GsApp *app);
+void gs_app_set_compulsory (GsApp *app,
+ gboolean compulsory);
G_END_DECLS
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index 8106d52..c169d33 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -282,7 +282,7 @@ main (int argc, char **argv)
}
} else if (argc == 3 && g_strcmp0 (argv[1], "action-upgrade-download") == 0) {
app = gs_app_new (argv[2]);
- gs_app_set_kind (app, GS_APP_KIND_DISTRO_UPGRADE);
+ gs_app_set_kind (app, AS_APP_KIND_OS_UPGRADE);
ret = gs_plugin_loader_app_action (plugin_loader,
app,
GS_PLUGIN_LOADER_ACTION_UPGRADE_DOWNLOAD,
diff --git a/src/gs-page.c b/src/gs-page.c
index 8a772d1..b7e9646 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -174,7 +174,7 @@ gs_page_update_app (GsPage *page, GsApp *app)
g_autofree gchar *escaped = NULL;
/* non-firmware applications do not have to be prepared */
- if (gs_app_get_id_kind (app) != AS_APP_KIND_FIRMWARE) {
+ if (gs_app_get_kind (app) != AS_APP_KIND_FIRMWARE) {
gs_page_update_app_real (page, app);
return;
}
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 2a8fad1..1ad87fd 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -503,7 +503,7 @@ gs_plugin_loader_app_is_valid (GsApp *app, gpointer user_data)
}
/* don't show unconverted unavailables */
- if (gs_app_get_kind (app) == GS_APP_KIND_UNKNOWN &&
+ if (gs_app_get_kind (app) == AS_APP_KIND_UNKNOWN &&
gs_app_get_state (app) == AS_APP_STATE_UNAVAILABLE) {
g_debug ("app invalid as unconverted unavailable %s",
gs_plugin_loader_get_app_str (app));
@@ -518,14 +518,14 @@ gs_plugin_loader_app_is_valid (GsApp *app, gpointer user_data)
}
/* don't show sources */
- if (gs_app_get_kind (app) == GS_APP_KIND_SOURCE) {
+ if (gs_app_get_kind (app) == AS_APP_KIND_SOURCE) {
g_debug ("app invalid as source %s",
gs_plugin_loader_get_app_str (app));
return FALSE;
}
/* don't show unknown kind */
- if (gs_app_get_kind (app) == GS_APP_KIND_UNKNOWN) {
+ if (gs_app_get_kind (app) == AS_APP_KIND_UNKNOWN) {
g_debug ("app invalid as kind unknown %s",
gs_plugin_loader_get_app_str (app));
return FALSE;
@@ -533,10 +533,9 @@ gs_plugin_loader_app_is_valid (GsApp *app, gpointer user_data)
/* don't show unconverted packages in the application view */
if (((state->flags & GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES) == 0) &&
- (gs_app_get_kind (app) == GS_APP_KIND_PACKAGE ||
- gs_app_get_kind (app) == GS_APP_KIND_CORE)) {
+ (gs_app_get_kind (app) == AS_APP_KIND_GENERIC)) {
// g_debug ("app invalid as only a %s: %s",
-// gs_app_kind_to_string (gs_app_get_kind (app)),
+// as_app_kind_to_string (gs_app_get_kind (app)),
// gs_plugin_loader_get_app_str (app));
return FALSE;
}
@@ -552,7 +551,7 @@ gs_plugin_loader_app_is_valid (GsApp *app, gpointer user_data)
gs_plugin_loader_get_app_str (app));
return FALSE;
}
- if (gs_app_get_kind (app) == GS_APP_KIND_NORMAL &&
+ if (gs_app_get_kind (app) == AS_APP_KIND_DESKTOP &&
gs_app_get_pixbuf (app) == NULL) {
g_debug ("app invalid as no pixbuf %s",
gs_plugin_loader_get_app_str (app));
@@ -597,12 +596,12 @@ gs_plugin_loader_filter_qt_for_gtk (GsApp *app, gpointer user_data)
}
/**
- * gs_plugin_loader_app_is_non_system:
+ * gs_plugin_loader_app_is_non_compulsory:
**/
static gboolean
-gs_plugin_loader_app_is_non_system (GsApp *app, gpointer user_data)
+gs_plugin_loader_app_is_non_compulsory (GsApp *app, gpointer user_data)
{
- return gs_app_get_kind (app) != GS_APP_KIND_SYSTEM;
+ return !gs_app_get_compulsory (app);
}
/**
@@ -745,11 +744,9 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
static gboolean
gs_plugin_loader_merge_into_os_update (GsApp *app)
{
- if (gs_app_get_kind (app) == GS_APP_KIND_PACKAGE)
+ if (gs_app_get_kind (app) == AS_APP_KIND_GENERIC)
return TRUE;
- if (gs_app_get_kind (app) == GS_APP_KIND_CORE)
- return TRUE;
- if (gs_app_get_kind (app) == GS_APP_KIND_SOURCE)
+ if (gs_app_get_kind (app) == AS_APP_KIND_SOURCE)
return TRUE;
return FALSE;
}
@@ -780,7 +777,7 @@ gs_plugin_loader_add_os_update_item (GList *list)
/* create new meta object */
app_os = gs_app_new ("os-update.virtual");
- gs_app_set_kind (app_os, GS_APP_KIND_OS_UPDATE);
+ gs_app_set_kind (app_os, AS_APP_KIND_OS_UPDATE);
gs_app_set_state (app_os, AS_APP_STATE_UPDATABLE);
gs_app_set_name (app_os,
GS_APP_QUALITY_NORMAL,
@@ -862,19 +859,19 @@ gs_plugin_loader_get_updates_thread_cb (GTask *task,
*
* This method calls all plugins that implement the gs_plugin_add_updates()
* function. The plugins can either return #GsApp objects of kind
- * %GS_APP_KIND_NORMAL for bonafide applications, or #GsApp's of kind
- * %GS_APP_KIND_PACKAGE for packages that may or may not be applications.
+ * %AS_APP_KIND_DESKTOP for bonafide applications, or #GsApp's of kind
+ * %AS_APP_KIND_GENERIC for packages that may or may not be applications.
*
* Once the list of updates is refined, some of the #GsApp's of kind
- * %GS_APP_KIND_PACKAGE will have been promoted to a kind of %GS_APP_KIND_NORMAL,
- * or if they are core applications, promoted again to a kind of %GS_APP_KIND_SYSTEM.
+ * %AS_APP_KIND_GENERIC will have been promoted to a kind of %AS_APP_KIND_DESKTOP,
+ * or if they are core applications, set as compulsory.
*
- * Any #GsApp's of kind %GS_APP_KIND_PACKAGE that remain after refining are
- * added to a new virtual #GsApp of kind %GS_APP_KIND_OS_UPDATE and all the
- * %GS_APP_KIND_PACKAGE objects are moved to related packages of this object.
+ * Any #GsApp's of kind %AS_APP_KIND_GENERIC that remain after refining are
+ * added to a new virtual #GsApp of kind %AS_APP_KIND_OS_UPDATE and all the
+ * %AS_APP_KIND_GENERIC objects are moved to related packages of this object.
*
* This means all of the #GsApp's returning from this function are of kind
- * %GS_APP_KIND_NORMAL, %GS_APP_KIND_SYSTEM or %GS_APP_KIND_OS_UPDATE.
+ * %AS_APP_KIND_DESKTOP or %AS_APP_KIND_OS_UPDATE.
*
* The #GsApps may be in state %AS_APP_STATE_INSTALLED or %AS_APP_STATE_AVAILABLE
* and the UI may want to filter the two classes of applications differently.
@@ -960,7 +957,7 @@ gs_plugin_loader_get_distro_upgrades_thread_cb (GTask *task,
* gs_plugin_loader_get_distro_upgrades_async:
*
* This method calls all plugins that implement the gs_plugin_add_distro_upgrades()
- * function. The plugins can returns #GsApp objects of kind %GS_APP_KIND_DISTRO_UPGRADE.
+ * function. The plugins can returns #GsApp objects of kind %AS_APP_KIND_OS_UPGRADE.
**/
void
gs_plugin_loader_get_distro_upgrades_async (GsPluginLoader *plugin_loader,
@@ -1135,7 +1132,7 @@ gs_plugin_loader_get_sources_thread_cb (GTask *task,
* gs_plugin_loader_get_sources_async:
*
* This method calls all plugins that implement the gs_plugin_add_sources()
- * function. The plugins return #GsApp objects of kind %GS_APP_KIND_SOURCE..
+ * function. The plugins return #GsApp objects of kind %AS_APP_KIND_SOURCE..
*
* The *applications* installed from each source can be obtained using
* gs_app_get_related() if this information is available.
@@ -1227,18 +1224,18 @@ gs_plugin_loader_get_installed_thread_cb (GTask *task,
*
* This method calls all plugins that implement the gs_plugin_add_installed()
* function. The plugins can either return #GsApp objects of kind
- * %GS_APP_KIND_NORMAL for bonafide applications, or #GsApp's of kind
- * %GS_APP_KIND_PACKAGE for packages that may or may not be applications.
+ * %AS_APP_KIND_DESKTOP for bonafide applications, or #GsApp's of kind
+ * %AS_APP_KIND_GENERIC for packages that may or may not be applications.
*
* Once the list of updates is refined, some of the #GsApp's of kind
- * %GS_APP_KIND_PACKAGE will have been promoted to a kind of %GS_APP_KIND_NORMAL,
- * or if they are core applications, promoted again to a kind of %GS_APP_KIND_SYSTEM.
+ * %AS_APP_KIND_GENERIC will have been promoted to a kind of %AS_APP_KIND_DESKTOP,
+ * or if they are core applications, set as compulsory.
*
- * Any #GsApp's of kind %GS_APP_KIND_PACKAGE or %GS_APP_KIND_SYSTEM that remain
+ * Any #GsApp's of kind %AS_APP_KIND_GENERIC or %AS_APP_KIND_UNKNOWN that remain
* after refining are automatically removed.
*
* This means all of the #GsApp's returning from this function are of kind
- * %GS_APP_KIND_NORMAL.
+ * %AS_APP_KIND_DESKTOP.
*
* The #GsApps will all initially be in state %AS_APP_STATE_INSTALLED.
**/
@@ -1433,18 +1430,18 @@ gs_plugin_loader_get_featured_thread_cb (GTask *task,
*
* This method calls all plugins that implement the gs_plugin_add_featured()
* function. The plugins can either return #GsApp objects of kind
- * %GS_APP_KIND_NORMAL for bonafide applications, or #GsApp's of kind
- * %GS_APP_KIND_PACKAGE for packages that may or may not be applications.
+ * %AS_APP_KIND_DESKTOP for bonafide applications, or #GsApp's of kind
+ * %AS_APP_KIND_GENERIC for packages that may or may not be applications.
*
* Once the list of updates is refined, some of the #GsApp's of kind
- * %GS_APP_KIND_PACKAGE will have been promoted to a kind of %GS_APP_KIND_NORMAL,
- * or if they are core applications, promoted again to a kind of %GS_APP_KIND_SYSTEM.
+ * %AS_APP_KIND_GENERIC will have been promoted to a kind of %AS_APP_KIND_DESKTOP,
+ * or if they are core applications, set as compulsory.
*
- * Any #GsApp's of kind %GS_APP_KIND_PACKAGE that remain after refining are
+ * Any #GsApp's of kind %AS_APP_KIND_GENERIC that remain after refining are
* automatically removed.
*
* This means all of the #GsApp's returning from this function are of kind
- * %GS_APP_KIND_NORMAL or %GS_APP_KIND_SYSTEM.
+ * %AS_APP_KIND_DESKTOP.
*
* The #GsApps may be in state %AS_APP_STATE_INSTALLED or %AS_APP_STATE_AVAILABLE
* and the UI may want to filter the two classes of applications differently.
@@ -1524,7 +1521,8 @@ gs_plugin_loader_convert_unavailable_app (GsApp *app, const gchar *search)
"for how to get a codec that can play this format "
"can be found on the website."), search);
gs_app_set_summary_missing (app, tmp->str);
- gs_app_set_kind (app, GS_APP_KIND_MISSING);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
+ gs_app_set_state (app, AS_APP_STATE_UNAVAILABLE);
gs_app_set_size (app, GS_APP_SIZE_MISSING);
return TRUE;
}
@@ -1540,12 +1538,11 @@ gs_plugin_loader_convert_unavailable (GList *list, const gchar *search)
for (l = list; l != NULL; l = l->next) {
app = GS_APP (l->data);
- if (gs_app_get_kind (app) != GS_APP_KIND_UNKNOWN &&
- gs_app_get_kind (app) != GS_APP_KIND_MISSING)
+ if (gs_app_get_kind (app) != AS_APP_KIND_GENERIC)
continue;
if (gs_app_get_state (app) != AS_APP_STATE_UNAVAILABLE)
continue;
- if (gs_app_get_id_kind (app) != AS_APP_KIND_CODEC)
+ if (gs_app_get_kind (app) != AS_APP_KIND_CODEC)
continue;
if (gs_app_get_url (app, AS_URL_KIND_MISSING) == NULL)
continue;
@@ -1657,18 +1654,18 @@ gs_plugin_loader_search_thread_cb (GTask *task,
*
* This method calls all plugins that implement the gs_plugin_add_search()
* function. The plugins can either return #GsApp objects of kind
- * %GS_APP_KIND_NORMAL for bonafide applications, or #GsApp's of kind
- * %GS_APP_KIND_PACKAGE for packages that may or may not be applications.
+ * %AS_APP_KIND_DESKTOP for bonafide applications, or #GsApp's of kind
+ * %AS_APP_KIND_GENERIC for packages that may or may not be applications.
*
* Once the list of updates is refined, some of the #GsApp's of kind
- * %GS_APP_KIND_PACKAGE will have been promoted to a kind of %GS_APP_KIND_NORMAL,
- * or if they are core applications, promoted again to a kind of %GS_APP_KIND_SYSTEM.
+ * %AS_APP_KIND_GENERIC will have been promoted to a kind of %AS_APP_KIND_DESKTOP,
+ * or if they are core applications, set as compulsory.
*
- * Any #GsApp's of kind %GS_APP_KIND_PACKAGE or %GS_APP_KIND_SYSTEM that remain
+ * Any #GsApp's of kind %AS_APP_KIND_GENERIC or %AS_APP_KIND_UNKNOWN that remain
* after refining are automatically removed.
*
* This means all of the #GsApp's returning from this function are of kind
- * %GS_APP_KIND_NORMAL.
+ * %AS_APP_KIND_DESKTOP.
*
* The #GsApps may be in state %AS_APP_STATE_INSTALLED or %AS_APP_STATE_AVAILABLE
* and the UI may want to filter the two classes of applications differently.
@@ -1816,18 +1813,18 @@ gs_plugin_loader_search_files_thread_cb (GTask *task,
*
* This method calls all plugins that implement the gs_plugin_add_search_files()
* function. The plugins can either return #GsApp objects of kind
- * %GS_APP_KIND_NORMAL for bonafide applications, or #GsApp's of kind
- * %GS_APP_KIND_PACKAGE for packages that may or may not be applications.
+ * %AS_APP_KIND_DESKTOP for bonafide applications, or #GsApp's of kind
+ * %AS_APP_KIND_GENERIC for packages that may or may not be applications.
*
* Once the list of updates is refined, some of the #GsApp's of kind
- * %GS_APP_KIND_PACKAGE will have been promoted to a kind of %GS_APP_KIND_NORMAL,
- * or if they are core applications, promoted again to a kind of %GS_APP_KIND_SYSTEM.
+ * %AS_APP_KIND_GENERIC will have been promoted to a kind of %AS_APP_KIND_DESKTOP,
+ * or if they are core applications, set as compulsory.
*
- * Any #GsApp's of kind %GS_APP_KIND_PACKAGE or %GS_APP_KIND_SYSTEM that remain
+ * Any #GsApp's of kind %AS_APP_KIND_GENERIC or %AS_APP_KIND_UNKNOWN that remain
* after refining are automatically removed.
*
* This means all of the #GsApp's returning from this function are of kind
- * %GS_APP_KIND_NORMAL.
+ * %AS_APP_KIND_DESKTOP.
*
* The #GsApps may be in state %AS_APP_STATE_INSTALLED or %AS_APP_STATE_AVAILABLE
* and the UI may want to filter the two classes of applications differently.
@@ -1975,18 +1972,18 @@ gs_plugin_loader_search_what_provides_thread_cb (GTask *task,
*
* This method calls all plugins that implement the gs_plugin_add_search_what_provides()
* function. The plugins can either return #GsApp objects of kind
- * %GS_APP_KIND_NORMAL for bonafide applications, or #GsApp's of kind
- * %GS_APP_KIND_PACKAGE for packages that may or may not be applications.
+ * %AS_APP_KIND_DESKTOP for bonafide applications, or #GsApp's of kind
+ * %AS_APP_KIND_GENERIC for packages that may or may not be applications.
*
* Once the list of updates is refined, some of the #GsApp's of kind
- * %GS_APP_KIND_PACKAGE will have been promoted to a kind of %GS_APP_KIND_NORMAL,
- * or if they are core applications, promoted again to a kind of %GS_APP_KIND_SYSTEM.
+ * %AS_APP_KIND_GENERIC will have been promoted to a kind of %AS_APP_KIND_DESKTOP,
+ * or if they are core applications, set as compulsory.
*
- * Any #GsApp's of kind %GS_APP_KIND_PACKAGE or %GS_APP_KIND_SYSTEM that remain
+ * Any #GsApp's of kind %AS_APP_KIND_GENERIC or %AS_APP_KIND_UNKNOWN that remain
* after refining are automatically removed.
*
* This means all of the #GsApp's returning from this function are of kind
- * %GS_APP_KIND_NORMAL.
+ * %AS_APP_KIND_DESKTOP.
*
* The #GsApps may be in state %AS_APP_STATE_INSTALLED or %AS_APP_STATE_AVAILABLE
* and the UI may want to filter the two classes of applications differently.
@@ -2237,7 +2234,7 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
/* filter package list */
gs_plugin_list_filter_duplicates (&state->list);
- gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_non_system, NULL);
+ gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_non_compulsory, NULL);
gs_plugin_list_filter (&state->list, gs_plugin_loader_app_is_valid, state);
gs_plugin_list_filter (&state->list, gs_plugin_loader_filter_qt_for_gtk, NULL);
gs_plugin_list_filter (&state->list, gs_plugin_loader_get_app_is_compatible, plugin_loader);
@@ -2261,18 +2258,18 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
*
* This method calls all plugins that implement the gs_plugin_add_category_apps()
* function. The plugins can either return #GsApp objects of kind
- * %GS_APP_KIND_NORMAL for bonafide applications, or #GsApp's of kind
- * %GS_APP_KIND_PACKAGE for packages that may or may not be applications.
+ * %AS_APP_KIND_DESKTOP for bonafide applications, or #GsApp's of kind
+ * %AS_APP_KIND_GENERIC for packages that may or may not be applications.
*
* Once the list of updates is refined, some of the #GsApp's of kind
- * %GS_APP_KIND_PACKAGE will have been promoted to a kind of %GS_APP_KIND_NORMAL,
- * or if they are core applications, promoted again to a kind of %GS_APP_KIND_SYSTEM.
+ * %AS_APP_KIND_GENERIC will have been promoted to a kind of %AS_APP_KIND_DESKTOP,
+ * or if they are core applications, set as compulsory.
*
- * Any #GsApp's of kind %GS_APP_KIND_PACKAGE or %GS_APP_KIND_SYSTEM that remain
+ * Any #GsApp's of kind %AS_APP_KIND_GENERIC or %AS_APP_KIND_UNKNOWN that remain
* after refining are automatically removed.
*
* This means all of the #GsApp's returning from this function are of kind
- * %GS_APP_KIND_NORMAL.
+ * %AS_APP_KIND_DESKTOP.
*
* The #GsApps may be in state %AS_APP_STATE_INSTALLED or %AS_APP_STATE_AVAILABLE
* and the UI may want to filter the two classes of applications differently.
@@ -3829,11 +3826,11 @@ gs_plugin_loader_filename_to_app_thread_cb (GTask *task,
*
* This method calls all plugins that implement the gs_plugin_add_filename_to_app()
* function. The plugins can either return #GsApp objects of kind
- * %GS_APP_KIND_NORMAL for bonafide applications, or #GsApp's of kind
- * %GS_APP_KIND_PACKAGE for packages that may or may not be applications.
+ * %AS_APP_KIND_DESKTOP for bonafide applications, or #GsApp's of kind
+ * %AS_APP_KIND_GENERIC for packages that may or may not be applications.
*
* Once the list of updates is refined, some of the #GsApp's of kind
- * %GS_APP_KIND_PACKAGE will have been promoted to a kind of %GS_APP_KIND_NORMAL,
+ * %AS_APP_KIND_GENERIC will have been promoted to a kind of %AS_APP_KIND_DESKTOP,
* or if they are core applications.
**/
void
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 1c56dda..e5c7a4b 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -416,13 +416,13 @@ gs_plugin_loader_func (void)
g_assert_cmpstr (gs_app_get_id (app), ==,
"os-update:gnome-boxes-libs;0.0.1;i386;updates-testing,libvirt-glib-devel;0.0.1;noarch;fedora");
g_assert_cmpstr (gs_app_get_name (app), ==, "OS Updates");
// g_assert_cmpstr (gs_app_get_summary (app), ==, "Includes performance, stability and security
improvements for all users\nDo not segfault when using newer versons of libvirt.\nFix several memory leaks.");
- g_assert_cmpint (gs_app_get_kind (app), ==, GS_APP_KIND_OS_UPDATE);
+ g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_OS_UPDATE);
app = g_list_nth_data (list, 1);
g_assert_cmpstr (gs_app_get_id (app), ==, "gnome-boxes");
g_assert_cmpstr (gs_app_get_name (app), ==, "Boxes");
g_assert_cmpstr (gs_app_get_summary (app), ==, "Do not segfault when using newer versons of
libvirt.");
- g_assert_cmpint (gs_app_get_kind (app), ==, GS_APP_KIND_NORMAL);
+ g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_DESKTOP);
gs_plugin_list_free (list);
/* test packagekit */
@@ -449,7 +449,8 @@ gs_plugin_loader_func (void)
g_assert_cmpstr (gs_app_get_name (app), ==, "Screenshot");
g_assert_cmpstr (gs_app_get_summary (app), ==, "Save images of your screen or individual windows");
g_assert_cmpint (gs_app_get_state (app), ==, AS_APP_STATE_INSTALLED);
- g_assert_cmpint (gs_app_get_kind (app), ==, GS_APP_KIND_SYSTEM);
+ g_assert_cmpint (gs_app_get_kind (app), ==, AS_APP_KIND_DESKTOP);
+ g_assert (gs_app_get_compulsory (app));
g_assert (gs_app_get_pixbuf (app) != NULL);
gs_plugin_list_free (list);
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index f172371..eb4907d 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -156,7 +156,6 @@ gs_shell_details_set_state (GsShellDetails *self,
void
gs_shell_details_switch_to (GsShellDetails *self)
{
- GsAppKind kind;
AsAppState state;
GtkWidget *widget;
GtkAdjustment *adj;
@@ -170,7 +169,6 @@ gs_shell_details_switch_to (GsShellDetails *self)
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "application_details_header"));
gtk_widget_show (widget);
- kind = gs_app_get_kind (self->app);
state = gs_app_get_state (self->app);
/* label */
@@ -187,7 +185,7 @@ gs_shell_details_switch_to (GsShellDetails *self)
switch (state) {
case AS_APP_STATE_AVAILABLE:
case AS_APP_STATE_AVAILABLE_LOCAL:
- gtk_widget_set_visible (self->button_install, gs_app_get_kind (self->app) !=
GS_APP_KIND_CORE);
+ gtk_widget_set_visible (self->button_install, TRUE);
gtk_widget_set_sensitive (self->button_install, TRUE);
gtk_style_context_add_class (gtk_widget_get_style_context (self->button_install),
"suggested-action");
/* TRANSLATORS: button text in the header when an application
@@ -235,8 +233,8 @@ gs_shell_details_switch_to (GsShellDetails *self)
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
- if (gs_app_get_id_kind (self->app) == AS_APP_KIND_DESKTOP ||
- gs_app_get_id_kind (self->app) == AS_APP_KIND_WEB_APP) {
+ if (gs_app_get_kind (self->app) == AS_APP_KIND_DESKTOP ||
+ gs_app_get_kind (self->app) == AS_APP_KIND_WEB_APP) {
gtk_widget_set_visible (self->button_details_launch, TRUE);
} else {
gtk_widget_set_visible (self->button_details_launch, FALSE);
@@ -252,7 +250,7 @@ gs_shell_details_switch_to (GsShellDetails *self)
gtk_widget_set_visible (self->button_details_launch, FALSE);
/* remove button */
- if (kind == GS_APP_KIND_SYSTEM) {
+ if (gs_app_get_compulsory (self->app)) {
gtk_widget_set_visible (self->button_remove, FALSE);
} else {
switch (state) {
@@ -307,7 +305,7 @@ gs_shell_details_switch_to (GsShellDetails *self)
}
/* spinner */
- if (kind == GS_APP_KIND_SYSTEM) {
+ if (gs_app_get_compulsory (self->app)) {
gtk_widget_set_visible (self->spinner_install_remove, FALSE);
gtk_spinner_stop (GTK_SPINNER (self->spinner_install_remove));
} else {
@@ -420,7 +418,7 @@ gs_shell_details_refresh_screenshots (GsShellDetails *self)
guint i;
/* treat screenshots differently */
- if (gs_app_get_id_kind (self->app) == AS_APP_KIND_FONT) {
+ if (gs_app_get_kind (self->app) == AS_APP_KIND_FONT) {
gs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_thumbnails));
gs_container_remove_all (GTK_CONTAINER (self->box_details_screenshot_main));
screenshots = gs_app_get_screenshots (self->app);
@@ -726,7 +724,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
gs_app_get_state (self->app) == AS_APP_STATE_AVAILABLE_LOCAL);
/* set the rating */
- switch (gs_app_get_id_kind (self->app)) {
+ switch (gs_app_get_kind (self->app)) {
case AS_APP_KIND_WEB_APP:
gtk_widget_set_visible (self->star, FALSE);
break;
@@ -791,7 +789,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
gs_shell_details_set_sensitive (self->label_details_kudo_integration, ret);
/* set the tags buttons */
- if (gs_app_get_id_kind (self->app) == AS_APP_KIND_WEB_APP) {
+ if (gs_app_get_kind (self->app) == AS_APP_KIND_WEB_APP) {
gtk_widget_set_visible (self->label_details_tag_webapp, TRUE);
gtk_widget_set_visible (self->label_details_tag_nonfree, FALSE);
gtk_widget_set_visible (self->label_details_tag_3rdparty, FALSE);
@@ -847,7 +845,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
/* make history button insensitive if there is none */
history = gs_app_get_history (self->app);
- switch (gs_app_get_id_kind (self->app)) {
+ switch (gs_app_get_kind (self->app)) {
case AS_APP_KIND_WEB_APP:
gtk_widget_set_visible (self->button_history, FALSE);
break;
@@ -863,18 +861,13 @@ gs_shell_details_refresh_all (GsShellDetails *self)
gtk_widget_set_visible (self->button_history, FALSE);
/* are we trying to replace something in the baseos */
- switch (gs_app_get_kind (self->app)) {
- case GS_APP_KIND_CORE:
- gtk_widget_set_visible (self->infobar_details_package_baseos, TRUE);
- break;
- default:
- gtk_widget_set_visible (self->infobar_details_package_baseos, FALSE);
- break;
- }
+ gtk_widget_set_visible (self->infobar_details_package_baseos,
+ gs_app_get_compulsory (self->app) &&
+ gs_app_get_state (self->app) == AS_APP_STATE_AVAILABLE_LOCAL);
/* is this a repo-release */
switch (gs_app_get_kind (self->app)) {
- case GS_APP_KIND_SOURCE:
+ case AS_APP_KIND_SOURCE:
gtk_widget_set_visible (self->infobar_details_repo, gs_app_get_state (self->app) ==
AS_APP_STATE_AVAILABLE_LOCAL);
break;
default:
@@ -885,8 +878,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
/* installing a app with a repo file */
tmp = gs_app_get_metadata_item (self->app, "PackageKit::has-source");
switch (gs_app_get_kind (self->app)) {
- case GS_APP_KIND_NORMAL:
- case GS_APP_KIND_SYSTEM:
+ case AS_APP_KIND_DESKTOP:
gtk_widget_set_visible (self->infobar_details_app_repo, tmp != NULL && gs_app_get_state
(self->app) == AS_APP_STATE_AVAILABLE_LOCAL);
break;
default:
@@ -896,9 +888,8 @@ gs_shell_details_refresh_all (GsShellDetails *self)
/* installing a app without a repo file */
switch (gs_app_get_kind (self->app)) {
- case GS_APP_KIND_NORMAL:
- case GS_APP_KIND_SYSTEM:
- if (gs_app_get_id_kind (self->app) == AS_APP_KIND_FIRMWARE) {
+ case AS_APP_KIND_DESKTOP:
+ if (gs_app_get_kind (self->app) == AS_APP_KIND_FIRMWARE) {
gtk_widget_set_visible (self->infobar_details_app_norepo, FALSE);
} else {
gtk_widget_set_visible (self->infobar_details_app_norepo,
@@ -1096,7 +1087,7 @@ gs_shell_details_app_refine_cb (GObject *source,
error->message);
}
- if (gs_app_get_kind (self->app) == GS_APP_KIND_UNKNOWN ||
+ if (gs_app_get_kind (self->app) == AS_APP_KIND_UNKNOWN ||
gs_app_get_state (self->app) == AS_APP_STATE_UNKNOWN) {
g_autofree gchar *str = NULL;
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index 37fa9eb..44ca9b6 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -421,7 +421,8 @@ create_missing_app (SearchData *search_data)
}
gs_app_set_summary_missing (app, g_string_free (summary_missing, FALSE));
- gs_app_set_kind (app, GS_APP_KIND_MISSING);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
+ gs_app_set_state (app, AS_APP_STATE_UNAVAILABLE);
gs_app_set_size (app, GS_APP_SIZE_MISSING);
gs_app_set_url (app, AS_URL_KIND_MISSING, search_data->url_not_found);
@@ -1043,7 +1044,7 @@ row_activated_cb (GtkListBox *list_box,
app = gs_app_row_get_app (GS_APP_ROW (row));
- if (gs_app_get_kind (app) == GS_APP_KIND_MISSING &&
+ if (gs_app_get_state (app) == AS_APP_STATE_UNAVAILABLE &&
gs_app_get_url (app, AS_URL_KIND_MISSING) != NULL) {
gs_app_show_url (app, AS_URL_KIND_MISSING);
} else {
@@ -1059,8 +1060,8 @@ get_app_sort_key (GsApp *app)
key = g_string_sized_new (64);
/* sort missing applications as last */
- switch (gs_app_get_kind (app)) {
- case GS_APP_KIND_MISSING:
+ switch (gs_app_get_state (app)) {
+ case AS_APP_STATE_UNAVAILABLE:
g_string_append (key, "9:");
break;
default:
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index 0353092..66e4760 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -328,7 +328,7 @@ gs_shell_installed_get_app_sort_key (GsApp *app)
}
/* sort desktop files, then addons */
- switch (gs_app_get_id_kind (app)) {
+ switch (gs_app_get_kind (app)) {
case AS_APP_KIND_DESKTOP:
case AS_APP_KIND_WEB_APP:
g_string_append (key, "1:");
@@ -341,18 +341,11 @@ gs_shell_installed_get_app_sort_key (GsApp *app)
break;
}
- /* sort normal, system, other */
- switch (gs_app_get_kind (app)) {
- case GS_APP_KIND_NORMAL:
+ /* sort normal, compulsory */
+ if (!gs_app_get_compulsory (app))
g_string_append (key, "1:");
- break;
- case GS_APP_KIND_SYSTEM:
+ else
g_string_append (key, "2:");
- break;
- default:
- g_string_append (key, "3:");
- break;
- }
/* finally, sort by short name */
casefolded_name = g_utf8_casefold (gs_app_get_name (app), -1);
@@ -395,7 +388,7 @@ static gboolean
gs_shell_installed_is_addon_id_kind (GsApp *app)
{
AsAppKind id_kind;
- id_kind = gs_app_get_id_kind (app);
+ id_kind = gs_app_get_kind (app);
if (id_kind == AS_APP_KIND_DESKTOP)
return FALSE;
if (id_kind == AS_APP_KIND_WEB_APP)
@@ -403,15 +396,6 @@ gs_shell_installed_is_addon_id_kind (GsApp *app)
return TRUE;
}
-static gboolean
-gs_shell_installed_is_system_application (GsApp *app)
-{
- if (gs_app_get_id_kind (app) == AS_APP_KIND_DESKTOP &&
- gs_app_get_kind (app) == GS_APP_KIND_SYSTEM)
- return TRUE;
- return FALSE;
-}
-
/**
* gs_shell_installed_list_header_func
**/
@@ -428,8 +412,8 @@ gs_shell_installed_list_header_func (GtkListBoxRow *row,
if (before == NULL)
return;
- if (!gs_shell_installed_is_system_application (gs_app_row_get_app (GS_APP_ROW (before))) &&
- gs_shell_installed_is_system_application (gs_app_row_get_app (GS_APP_ROW (row)))) {
+ if (!gs_app_get_compulsory (gs_app_row_get_app (GS_APP_ROW (before))) &&
+ gs_app_get_compulsory (gs_app_row_get_app (GS_APP_ROW (row)))) {
/* TRANSLATORS: This is the header dividing the normal
* applications and the system ones */
header = gtk_label_new (_("System Applications"));
diff --git a/src/gs-shell-moderate.c b/src/gs-shell-moderate.c
index 4925d93..7516a4c 100644
--- a/src/gs-shell-moderate.c
+++ b/src/gs-shell-moderate.c
@@ -103,8 +103,7 @@ gs_shell_moderate_add_app (GsShellModerate *self, GsApp *app)
guint i;
/* this hides the action button */
- gs_app_set_kind (app, GS_APP_KIND_UNKNOWN);
- gs_app_set_kind (app, GS_APP_KIND_SYSTEM);
+ gs_app_set_compulsory (app, TRUE);
/* add top level app */
app_row = gs_app_row_new (app);
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index 7a29b98..fd6f70e 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -251,8 +251,8 @@ gs_shell_search_get_app_sort_key (GsApp *app)
key = g_string_sized_new (64);
/* sort missing codecs before applications */
- switch (gs_app_get_kind (app)) {
- case GS_APP_KIND_MISSING:
+ switch (gs_app_get_state (app)) {
+ case AS_APP_STATE_UNAVAILABLE:
g_string_append (key, "9:");
break;
default:
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index 7c6ba41..b78dd81 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -72,7 +72,7 @@ add_source (GtkListBox *listbox, GsApp *app)
/* split up the types */
for (i = 0; i < related->len; i++) {
GsApp *app_tmp = g_ptr_array_index (related, i);
- switch (gs_app_get_id_kind (app_tmp)) {
+ switch (gs_app_get_kind (app_tmp)) {
case AS_APP_KIND_WEB_APP:
case AS_APP_KIND_DESKTOP:
cnt_apps++;
@@ -276,8 +276,7 @@ list_row_activated_cb (GtkListBox *list_box,
for (i = 0; i < related->len; i++) {
GsApp *app_tmp = g_ptr_array_index (related, i);
switch (gs_app_get_kind (app_tmp)) {
- case GS_APP_KIND_NORMAL:
- case GS_APP_KIND_SYSTEM:
+ case AS_APP_KIND_DESKTOP:
add_app (GTK_LIST_BOX (dialog->listbox_apps), app_tmp);
cnt_apps++;
break;
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index a44b5a3..8dc5621 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -90,14 +90,14 @@ back_entry_free (BackEntry *entry)
static void
set_updates_description_ui (GsUpdateDialog *dialog, GsApp *app)
{
- GsAppKind kind;
+ AsAppKind kind;
const GdkPixbuf *pixbuf;
const gchar *update_details;
g_autofree gchar *update_desc = NULL;
/* set window title */
kind = gs_app_get_kind (app);
- if (kind == GS_APP_KIND_OS_UPDATE) {
+ if (kind == AS_APP_KIND_OS_UPDATE) {
gtk_window_set_title (GTK_WINDOW (dialog), gs_app_get_name (app));
} else if (gs_app_get_source_default (app) != NULL) {
g_autofree gchar *tmp = NULL;
@@ -129,7 +129,7 @@ set_updates_description_ui (GsUpdateDialog *dialog, GsApp *app)
}
/* set update header */
- gtk_widget_set_visible (dialog->box_header, kind == GS_APP_KIND_NORMAL || kind == GS_APP_KIND_SYSTEM);
+ gtk_widget_set_visible (dialog->box_header, kind == AS_APP_KIND_DESKTOP);
gtk_label_set_markup (GTK_LABEL (dialog->label_details), update_desc);
gtk_label_set_label (GTK_LABEL (dialog->label_name), gs_app_get_name (app));
gtk_label_set_label (GTK_LABEL (dialog->label_summary), gs_app_get_summary (app));
@@ -275,7 +275,7 @@ void
gs_update_dialog_show_update_details (GsUpdateDialog *dialog, GsApp *app)
{
GsApp *app_related;
- GsAppKind kind;
+ AsAppKind kind;
const gchar *sort;
kind = gs_app_get_kind (app);
@@ -288,7 +288,7 @@ gs_update_dialog_show_update_details (GsUpdateDialog *dialog, GsApp *app)
unset_focus (GTK_WIDGET (dialog));
/* set update description */
- if (kind == GS_APP_KIND_OS_UPDATE) {
+ if (kind == AS_APP_KIND_OS_UPDATE) {
GPtrArray *related;
guint i;
GtkWidget *row, *label;
diff --git a/src/gs-update-list.c b/src/gs-update-list.c
index 743fc11..2c29b14 100644
--- a/src/gs-update-list.c
+++ b/src/gs-update-list.c
@@ -96,7 +96,7 @@ static gboolean
is_addon_id_kind (GsApp *app)
{
AsAppKind id_kind;
- id_kind = gs_app_get_id_kind (app);
+ id_kind = gs_app_get_kind (app);
if (id_kind == AS_APP_KIND_DESKTOP)
return FALSE;
if (id_kind == AS_APP_KIND_WEB_APP)
@@ -147,7 +147,7 @@ get_app_sort_key (GsApp *app)
/* sort by kind */
switch (gs_app_get_kind (app)) {
- case GS_APP_KIND_OS_UPDATE:
+ case AS_APP_KIND_OS_UPDATE:
g_string_append (key, "1:");
break;
default:
@@ -156,7 +156,7 @@ get_app_sort_key (GsApp *app)
}
/* sort desktop files, then addons */
- switch (gs_app_get_id_kind (app)) {
+ switch (gs_app_get_kind (app)) {
case AS_APP_KIND_FIRMWARE:
g_string_append (key, "1:");
break;
diff --git a/src/gs-utils.c b/src/gs-utils.c
index f494a43..22c8a2a 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -139,7 +139,7 @@ gs_app_notify_installed (GsApp *app)
* has been successfully installed */
summary = g_strdup_printf (_("%s is now installed"), gs_app_get_name (app));
n = g_notification_new (summary);
- if (gs_app_get_id_kind (app) == AS_APP_KIND_DESKTOP) {
+ if (gs_app_get_kind (app) == AS_APP_KIND_DESKTOP) {
/* TRANSLATORS: this is button that opens the newly installed application */
g_notification_add_button_with_target (n, _("Launch"),
"app.launch", "s",
@@ -294,7 +294,7 @@ gs_app_notify_unavailable (GsApp *app, GtkWindow *parent)
/* be aware of patent clauses */
if (hint & GS_APP_LICENCE_PATENT_CONCERN) {
g_string_append (body, "\n\n");
- if (gs_app_get_id_kind (app) != AS_APP_KIND_CODEC) {
+ if (gs_app_get_kind (app) != AS_APP_KIND_CODEC) {
g_string_append_printf (body,
/* TRANSLATORS: Laws are geographical, urgh... */
_("It may be illegal to install "
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index d4dfe3b..075340d 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -497,7 +497,7 @@ gs_plugin_appstream_create_runtime (GsApp *parent, const gchar *runtime)
app = gs_app_new (id);
source = g_strdup_printf ("runtime/%s", runtime);
gs_app_add_source (app, source);
- gs_app_set_id_kind (app, AS_APP_KIND_RUNTIME);
+ gs_app_set_kind (app, AS_APP_KIND_RUNTIME);
gs_app_set_version (app, id_split[2]);
return g_steal_pointer (&app);
@@ -566,12 +566,12 @@ gs_plugin_refine_item (GsPlugin *plugin, GsApp *app, AsApp *item, GError **error
guint i;
/* is an app */
- if (gs_app_get_kind (app) == GS_APP_KIND_UNKNOWN ||
- gs_app_get_kind (app) == GS_APP_KIND_PACKAGE) {
+ if (gs_app_get_kind (app) == AS_APP_KIND_UNKNOWN ||
+ gs_app_get_kind (app) == AS_APP_KIND_GENERIC) {
if (as_app_get_kind (item) == AS_APP_KIND_SOURCE) {
- gs_app_set_kind (app, GS_APP_KIND_SOURCE);
+ gs_app_set_kind (app, AS_APP_KIND_SOURCE);
} else {
- gs_app_set_kind (app, GS_APP_KIND_NORMAL);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
}
}
@@ -580,7 +580,7 @@ gs_plugin_refine_item (GsPlugin *plugin, GsApp *app, AsApp *item, GError **error
switch (as_app_get_source_kind (item)) {
case AS_APP_SOURCE_KIND_APPDATA:
case AS_APP_SOURCE_KIND_DESKTOP:
- gs_app_set_kind (app, GS_APP_KIND_NORMAL);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
break;
case AS_APP_SOURCE_KIND_METAINFO:
@@ -679,12 +679,12 @@ gs_plugin_refine_item (GsPlugin *plugin, GsApp *app, AsApp *item, GError **error
/* this is a core application for the desktop and cannot be removed */
if (_as_app_has_compulsory_for_desktop (item, "GNOME") &&
- gs_app_get_kind (app) == GS_APP_KIND_NORMAL)
- gs_app_set_kind (app, GS_APP_KIND_SYSTEM);
+ gs_app_get_kind (app) == AS_APP_KIND_DESKTOP)
+ gs_app_set_compulsory (app, TRUE);
/* set id kind */
- if (gs_app_get_id_kind (app) == AS_APP_KIND_UNKNOWN)
- gs_app_set_id_kind (app, as_app_get_kind (item));
+ if (gs_app_get_kind (app) == AS_APP_KIND_UNKNOWN)
+ gs_app_set_kind (app, as_app_get_kind (item));
/* copy all the metadata */
gs_plugin_appstream_copy_metadata (app, item);
@@ -850,7 +850,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
g_autoptr(GsApp) app = NULL;
item = g_ptr_array_index (array, i);
- // FIXME: AS_APP_KIND_DISTRO_UPGRADE
+ // FIXME: AS_APP_KIND_OS_UPGRADE
if (as_app_get_kind (item) != AS_APP_KIND_UNKNOWN)
continue;
if (as_app_get_metadata_item (item, "X-IsUpgrade") == NULL)
@@ -858,7 +858,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
/* create */
app = gs_app_new (as_app_get_id (item));
- gs_app_set_kind (app, GS_APP_KIND_DISTRO_UPGRADE);
+ gs_app_set_kind (app, AS_APP_KIND_OS_UPGRADE);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
if (!gs_plugin_refine_item (plugin, app, item, error))
return FALSE;
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index df5c287..b0b97dd 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -73,8 +73,8 @@ gs_plugin_add_updates (GsPlugin *plugin,
app = gs_app_new ("gnome-boxes");
gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Boxes");
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Do not segfault when using newer versons of
libvirt.");
- gs_app_set_kind (app, GS_APP_KIND_NORMAL);
- gs_app_set_id_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_plugin_add_app (list, app);
g_object_unref (app);
@@ -82,8 +82,8 @@ gs_plugin_add_updates (GsPlugin *plugin,
app = gs_app_new ("libvirt-glib-devel;0.0.1;noarch;fedora");
gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "libvirt-glib-devel");
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Fix several memory leaks.");
- gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
- gs_app_set_id_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_plugin_add_app (list, app);
g_object_unref (app);
@@ -91,8 +91,8 @@ gs_plugin_add_updates (GsPlugin *plugin,
app = gs_app_new ("gnome-boxes-libs;0.0.1;i386;updates-testing");
gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "gnome-boxes-libs");
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Do not segfault when using newer versons of
libvirt.");
- gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
- gs_app_set_id_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_plugin_add_app (list, app);
g_object_unref (app);
@@ -112,9 +112,9 @@ gs_plugin_add_installed (GsPlugin *plugin,
gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Power Manager");
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Power Management Program");
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
- gs_app_set_kind (app, GS_APP_KIND_NORMAL);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_plugin_add_app (list, app);
- gs_app_set_id_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
return TRUE;
}
@@ -132,9 +132,9 @@ gs_plugin_add_popular (GsPlugin *plugin,
gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Power Manager");
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "Power Management Program");
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
- gs_app_set_kind (app, GS_APP_KIND_NORMAL);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_plugin_add_app (list, app);
- gs_app_set_id_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
return TRUE;
}
@@ -231,10 +231,10 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
gs_app_set_name (app, GS_APP_QUALITY_NORMAL, "Boxes");
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL, "View and use virtual machines");
gs_app_set_url (app, AS_URL_KIND_HOMEPAGE, "http://www.box.org");
- gs_app_set_kind (app, GS_APP_KIND_NORMAL);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
gs_app_set_pixbuf (app, gdk_pixbuf_new_from_file
("/usr/share/icons/hicolor/48x48/apps/gnome-boxes.png", NULL));
- gs_app_set_id_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_plugin_add_app (list, app);
return TRUE;
}
@@ -250,7 +250,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
{
g_autoptr(GsApp) app = NULL;
app = gs_app_new ("org.fedoraproject.release-rawhide.upgrade");
- gs_app_set_kind (app, GS_APP_KIND_DISTRO_UPGRADE);
+ gs_app_set_kind (app, AS_APP_KIND_OS_UPGRADE);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
gs_app_set_name (app, GS_APP_QUALITY_LOWEST, "Fedora");
gs_app_set_version (app, "rawhide");
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index ff20553..2e7ca6b 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -116,7 +116,7 @@ gs_plugin_app_install (GsPlugin *plugin, GsApp *app,
g_autoptr(GFile) symlink_icon = NULL;
/* only process web apps */
- if (gs_app_get_id_kind (app) != AS_APP_KIND_WEB_APP)
+ if (gs_app_get_kind (app) != AS_APP_KIND_WEB_APP)
return TRUE;
/* create the correct directory */
@@ -303,7 +303,7 @@ gs_plugin_refine (GsPlugin *plugin,
for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
- if (gs_app_get_id_kind (app) != AS_APP_KIND_WEB_APP)
+ if (gs_app_get_kind (app) != AS_APP_KIND_WEB_APP)
continue;
gs_app_set_size (app, 4096);
tmp = gs_app_get_source_id_default (app);
diff --git a/src/plugins/gs-plugin-fedora-distro-upgrades.c b/src/plugins/gs-plugin-fedora-distro-upgrades.c
index 735870d..193354d 100644
--- a/src/plugins/gs-plugin-fedora-distro-upgrades.c
+++ b/src/plugins/gs-plugin-fedora-distro-upgrades.c
@@ -254,7 +254,7 @@ gs_plugin_add_distro_upgrades (GsPlugin *plugin,
/* create */
app = gs_app_new (app_id);
- gs_app_set_kind (app, GS_APP_KIND_DISTRO_UPGRADE);
+ gs_app_set_kind (app, AS_APP_KIND_OS_UPGRADE);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
gs_app_set_name (app, GS_APP_QUALITY_LOWEST, distro_info->name);
gs_app_set_version (app, app_version);
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 01d51f9..427d90b 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -362,10 +362,10 @@ gs_plugin_add_update_app (GsPlugin *plugin,
/* actually add the application */
gs_app_set_management_plugin (app, "fwupd");
- gs_app_set_id_kind (app, AS_APP_KIND_FIRMWARE);
+ gs_app_set_kind (app, AS_APP_KIND_FIRMWARE);
gs_app_add_source_id (app, filename_cache);
gs_app_add_category (app, "System");
- gs_app_set_kind (app, GS_APP_KIND_FIRMWARE_UPDATE);
+ gs_app_set_kind (app, AS_APP_KIND_FIRMWARE);
gs_app_set_metadata (app, "fwupd::DeviceID", id);
gs_plugin_add_app (list, app);
@@ -437,7 +437,7 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
app = gs_app_new (NULL);
gs_app_set_management_plugin (app, "fwupd");
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
- gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
g_variant_get (val, "(a{sv})", &iter);
while (g_variant_iter_next (iter, "{&sv}", &key, &variant)) {
gs_plugin_fwupd_set_app_from_kv (app, key, variant);
@@ -933,7 +933,7 @@ gs_plugin_app_install (GsPlugin *plugin,
return FALSE;
}
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
- if (gs_app_get_kind (app) == GS_APP_KIND_FIRMWARE_UPDATE)
+ if (gs_app_get_kind (app) == AS_APP_KIND_FIRMWARE)
offline = FALSE;
if (!gs_plugin_fwupd_upgrade (plugin, filename, FWUPD_DEVICE_ID_ANY, offline,
cancellable, error))
@@ -1079,9 +1079,9 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
/* get results */
app = gs_app_new (NULL);
- gs_app_set_id_kind (app, AS_APP_KIND_FIRMWARE);
+ gs_app_set_kind (app, AS_APP_KIND_FIRMWARE);
gs_app_set_management_plugin (app, "fwupd");
- gs_app_set_kind (app, GS_APP_KIND_FIRMWARE_UPDATE);
+ gs_app_set_kind (app, AS_APP_KIND_FIRMWARE);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE_LOCAL);
gs_app_add_source_id (app, filename);
gs_app_add_category (app, "System");
diff --git a/src/plugins/gs-plugin-limba.c b/src/plugins/gs-plugin-limba.c
index b9d3ff5..e9f7af5 100644
--- a/src/plugins/gs-plugin-limba.c
+++ b/src/plugins/gs-plugin-limba.c
@@ -364,14 +364,14 @@ gs_plugin_add_updates (GsPlugin *plugin,
* In any other case, the Limba bundle name equals the AppStream ID of the component
it contains */
tmp = g_strdup_printf ("%s.desktop", li_pkg_info_get_name (old_pki));
app = gs_app_new (tmp);
- gs_app_set_id_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
} else {
app = gs_app_new (li_pkg_info_get_name (old_pki));
}
gs_app_set_management_plugin (app, "Limba");
gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
- gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
gs_plugin_add_app (list, app);
gs_app_set_name (app,
GS_APP_QUALITY_LOWEST,
diff --git a/src/plugins/gs-plugin-moduleset.c b/src/plugins/gs-plugin-moduleset.c
index d5937ae..7d32e36 100644
--- a/src/plugins/gs-plugin-moduleset.c
+++ b/src/plugins/gs-plugin-moduleset.c
@@ -332,7 +332,7 @@ gs_plugin_refine (GsPlugin *plugin,
/* mark each one as system */
for (i = 0; system_apps[i] != NULL; i++) {
if (g_strcmp0 (system_apps[i], gs_app_get_id (app)) == 0) {
- gs_app_set_kind (app, GS_APP_KIND_SYSTEM);
+ gs_app_set_compulsory (app, TRUE);
break;
}
}
@@ -340,7 +340,7 @@ gs_plugin_refine (GsPlugin *plugin,
/* mark each one as core */
for (i = 0; core_pkgs[i] != NULL; i++) {
if (g_strcmp0 (core_pkgs[i], gs_app_get_source_default (app)) == 0) {
- gs_app_set_kind (app, GS_APP_KIND_CORE);
+ gs_app_set_compulsory (app, TRUE);
break;
}
}
diff --git a/src/plugins/gs-plugin-packagekit-history.c b/src/plugins/gs-plugin-packagekit-history.c
index 5f20bd1..597eb62 100644
--- a/src/plugins/gs-plugin-packagekit-history.c
+++ b/src/plugins/gs-plugin-packagekit-history.c
@@ -93,7 +93,7 @@ gs_plugin_packagekit_refine_add_history (GsApp *app, GVariant *dict)
/* create new history item with same ID as parent */
history = gs_app_new (gs_app_get_id (app));
- gs_app_set_kind (history, GS_APP_KIND_PACKAGE);
+ gs_app_set_kind (history, AS_APP_KIND_GENERIC);
gs_app_set_name (history, GS_APP_QUALITY_NORMAL, gs_app_get_name (app));
/* get the installed state */
@@ -234,7 +234,7 @@ gs_plugin_packagekit_refine (GsPlugin *plugin,
g_autoptr(GsApp) app_dummy = NULL;
app_dummy = gs_app_new (gs_app_get_id (app));
gs_app_set_install_date (app_dummy, GS_APP_INSTALL_DATE_UNKNOWN);
- gs_app_set_kind (app_dummy, GS_APP_KIND_PACKAGE);
+ gs_app_set_kind (app_dummy, AS_APP_KIND_GENERIC);
gs_app_set_state (app_dummy, AS_APP_STATE_INSTALLED);
gs_app_set_version (app_dummy, gs_app_get_version (app));
gs_app_add_history (app, app_dummy);
diff --git a/src/plugins/gs-plugin-packagekit-offline.c b/src/plugins/gs-plugin-packagekit-offline.c
index a386858..ea5c62d 100644
--- a/src/plugins/gs-plugin-packagekit-offline.c
+++ b/src/plugins/gs-plugin-packagekit-offline.c
@@ -196,7 +196,7 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
gs_app_set_management_plugin (app, "PackageKit");
gs_app_add_source_id (app, package_ids[i]);
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
- gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
gs_app_set_install_date (app, mtime);
gs_plugin_add_app (list, app);
}
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 348f08f..d3c379f 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -248,7 +248,7 @@ gs_plugin_packagekit_resolve_packages_app (GsPlugin *plugin,
/* we have less packages returned than source packages */
tmp = gs_app_to_string (app);
g_debug ("Failed to find all packages for:\n%s", tmp);
- gs_app_set_kind (app, GS_APP_KIND_UNKNOWN);
+ gs_app_set_kind (app, AS_APP_KIND_UNKNOWN);
gs_app_set_state (app, AS_APP_STATE_UNAVAILABLE);
}
}
@@ -661,7 +661,7 @@ gs_plugin_refine_require_details (GsPlugin *plugin,
ptask = as_profile_start_literal (plugin->profile, "packagekit-refine[source->licence]");
for (l = list; l != NULL; l = l->next) {
app = GS_APP (l->data);
- if (gs_app_get_id_kind (app) == AS_APP_KIND_WEB_APP)
+ if (gs_app_get_kind (app) == AS_APP_KIND_WEB_APP)
continue;
if (g_strcmp0 (gs_app_get_management_plugin (app), "PackageKit") != 0)
continue;
@@ -819,7 +819,7 @@ gs_plugin_refine (GsPlugin *plugin,
if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPGRADE_REMOVED) {
for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
- if (gs_app_get_kind (app) != GS_APP_KIND_DISTRO_UPGRADE)
+ if (gs_app_get_kind (app) != AS_APP_KIND_OS_UPGRADE)
continue;
if (!gs_plugin_packagekit_refine_distro_upgrade (plugin,
app,
@@ -833,7 +833,7 @@ gs_plugin_refine (GsPlugin *plugin,
ptask = as_profile_start_literal (plugin->profile, "packagekit-refine[name->id]");
for (l = *list; l != NULL; l = l->next) {
app = GS_APP (l->data);
- if (gs_app_get_id_kind (app) == AS_APP_KIND_WEB_APP)
+ if (gs_app_get_kind (app) == AS_APP_KIND_WEB_APP)
continue;
if (g_strcmp0 (gs_app_get_management_plugin (app), "PackageKit") != 0)
continue;
@@ -870,7 +870,7 @@ gs_plugin_refine (GsPlugin *plugin,
tmp = gs_app_get_id (app);
if (tmp == NULL)
continue;
- switch (gs_app_get_id_kind (app)) {
+ switch (gs_app_get_kind (app)) {
case AS_APP_KIND_DESKTOP:
fn = g_strdup_printf ("/usr/share/applications/%s", tmp);
break;
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index 4b424d0..d1d1627 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -287,8 +287,8 @@ gs_plugin_packagekit_refresh_guess_app_id (GsPlugin *plugin,
g_str_has_suffix (fns[j], ".desktop")) {
g_autofree gchar *basename = g_path_get_basename (fns[j]);
gs_app_set_id (app, basename);
- gs_app_set_kind (app, GS_APP_KIND_NORMAL);
- gs_app_set_id_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
break;
}
}
@@ -366,7 +366,7 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
split = pk_package_id_split (package_id);
basename = g_path_get_basename (filename);
gs_app_set_management_plugin (app, "PackageKit");
- gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE_LOCAL);
if (pk_details_get_summary (item))
gs_app_set_name (app, GS_APP_QUALITY_LOWEST,
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index c3bfb8e..8bbe1e5 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -265,7 +265,7 @@ gs_plugin_add_sources (GsPlugin *plugin,
id = pk_repo_detail_get_id (rd);
app = gs_app_new (id);
gs_app_set_management_plugin (app, "PackageKit");
- gs_app_set_kind (app, GS_APP_KIND_SOURCE);
+ gs_app_set_kind (app, AS_APP_KIND_SOURCE);
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
gs_app_set_name (app,
GS_APP_QUALITY_LOWEST,
@@ -573,7 +573,7 @@ gs_plugin_app_remove (GsPlugin *plugin,
return TRUE;
/* remove repo and all apps in it */
- if (gs_app_get_kind (app) == GS_APP_KIND_SOURCE) {
+ if (gs_app_get_kind (app) == AS_APP_KIND_SOURCE) {
return gs_plugin_app_source_remove (plugin, app,
cancellable, error);
}
@@ -647,7 +647,7 @@ gs_plugin_app_upgrade_download (GsPlugin *plugin,
data.ptask = NULL;
/* check is distro-upgrade */
- if (gs_app_get_kind (app) != GS_APP_KIND_DISTRO_UPGRADE) {
+ if (gs_app_get_kind (app) != AS_APP_KIND_OS_UPGRADE) {
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_FAILED,
diff --git a/src/plugins/gs-plugin-self-test.c b/src/plugins/gs-plugin-self-test.c
index e010134..37b85d4 100644
--- a/src/plugins/gs-plugin-self-test.c
+++ b/src/plugins/gs-plugin-self-test.c
@@ -61,7 +61,7 @@ gs_plugin_refine (GsPlugin *plugin,
app = GS_APP (l->data);
if (gs_app_get_state (app) == AS_APP_STATE_UNKNOWN) {
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
- gs_app_set_kind (app, GS_APP_KIND_NORMAL);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
}
}
return TRUE;
diff --git a/src/plugins/gs-plugin-systemd-updates.c b/src/plugins/gs-plugin-systemd-updates.c
index 32abfd1..705f50d 100644
--- a/src/plugins/gs-plugin-systemd-updates.c
+++ b/src/plugins/gs-plugin-systemd-updates.c
@@ -143,7 +143,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
gs_app_add_source (app, split[PK_PACKAGE_ID_NAME]);
gs_app_set_update_version (app, split[PK_PACKAGE_ID_VERSION]);
gs_app_set_state (app, AS_APP_STATE_AVAILABLE);
- gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
gs_plugin_add_app (list, app);
}
return TRUE;
diff --git a/src/plugins/gs-plugin-xdg-app-reviews.c b/src/plugins/gs-plugin-xdg-app-reviews.c
index 45be4c3..0874ade 100644
--- a/src/plugins/gs-plugin-xdg-app-reviews.c
+++ b/src/plugins/gs-plugin-xdg-app-reviews.c
@@ -684,7 +684,7 @@ gs_plugin_refine (GsPlugin *plugin,
continue;
if (gs_app_get_id_no_prefix (app) == NULL)
continue;
- if (gs_app_get_id_kind (app) == AS_APP_KIND_ADDON)
+ if (gs_app_get_kind (app) == AS_APP_KIND_ADDON)
continue;
if (!gs_plugin_refine_reviews (plugin, app,
cancellable,
@@ -704,7 +704,7 @@ gs_plugin_refine (GsPlugin *plugin,
continue;
if (gs_app_get_id_no_prefix (app) == NULL)
continue;
- if (gs_app_get_id_kind (app) == AS_APP_KIND_ADDON)
+ if (gs_app_get_kind (app) == AS_APP_KIND_ADDON)
continue;
if (!gs_plugin_refine_ratings (plugin, app,
cancellable,
diff --git a/src/plugins/gs-plugin-xdg-app.c b/src/plugins/gs-plugin-xdg-app.c
index e7d1ca1..f0fb1b9 100644
--- a/src/plugins/gs-plugin-xdg-app.c
+++ b/src/plugins/gs-plugin-xdg-app.c
@@ -398,16 +398,16 @@ gs_plugin_xdg_app_create_installed (GsPlugin *plugin,
/* create new object */
id = gs_plugin_xdg_app_build_id (XDG_APP_REF (xref));
app = gs_app_new (id);
- gs_app_set_kind (app, GS_APP_KIND_NORMAL);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
gs_plugin_xdg_app_set_metadata_installed (app, xref);
switch (xdg_app_ref_get_kind (XDG_APP_REF(xref))) {
case XDG_APP_REF_KIND_APP:
- gs_app_set_id_kind (app, AS_APP_KIND_DESKTOP);
+ gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
break;
case XDG_APP_REF_KIND_RUNTIME:
gs_app_set_xdgapp_kind (app, XDG_APP_REF_KIND_RUNTIME);
- gs_app_set_id_kind (app, AS_APP_KIND_RUNTIME);
+ gs_app_set_kind (app, AS_APP_KIND_RUNTIME);
gs_app_set_name (app, GS_APP_QUALITY_NORMAL,
xdg_app_ref_get_name (XDG_APP_REF (xref)));
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL,
@@ -532,7 +532,7 @@ gs_plugin_add_sources (GsPlugin *plugin,
app = gs_app_new (xdg_app_remote_get_name (xremote));
gs_app_set_management_plugin (app, "XgdApp");
- gs_app_set_kind (app, GS_APP_KIND_SOURCE);
+ gs_app_set_kind (app, AS_APP_KIND_SOURCE);
gs_app_set_state (app, AS_APP_STATE_INSTALLED);
gs_app_set_name (app,
GS_APP_QUALITY_LOWEST,
@@ -1011,7 +1011,7 @@ gs_plugin_refine_item_runtime (GsPlugin *plugin,
app_runtime = gs_app_new (runtime);
source = g_strdup_printf ("runtime/%s", runtime);
gs_app_add_source (app_runtime, source);
- gs_app_set_id_kind (app_runtime, AS_APP_KIND_RUNTIME);
+ gs_app_set_kind (app_runtime, AS_APP_KIND_RUNTIME);
gs_app_set_runtime (app, app_runtime);
return TRUE;
}
@@ -1277,7 +1277,7 @@ gs_plugin_app_install (GsPlugin *plugin,
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
/* install required runtime if not already installed */
- if (gs_app_get_id_kind (app) == AS_APP_KIND_DESKTOP) {
+ if (gs_app_get_kind (app) == AS_APP_KIND_DESKTOP) {
GsApp *runtime;
runtime = gs_app_get_runtime (app);
diff --git a/src/plugins/packagekit-common.c b/src/plugins/packagekit-common.c
index ef17426..ea765a4 100644
--- a/src/plugins/packagekit-common.c
+++ b/src/plugins/packagekit-common.c
@@ -170,7 +170,7 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin,
g_warning ("unknown info state of %s",
pk_info_enum_to_string (pk_package_get_info (package)));
}
- gs_app_set_kind (app, GS_APP_KIND_PACKAGE);
+ gs_app_set_kind (app, AS_APP_KIND_GENERIC);
gs_plugin_add_app (list, app);
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]