[gnome-software] Add a GsPluginRefineFlags entry for getting the update details
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add a GsPluginRefineFlags entry for getting the update details
- Date: Wed, 30 Oct 2013 19:45:18 +0000 (UTC)
commit e68c7382bfe359f5826a95e22b126da405407037
Author: Richard Hughes <richard hughsie com>
Date: Wed Oct 30 19:33:11 2013 +0000
Add a GsPluginRefineFlags entry for getting the update details
This isn't something we normally need, and using yum it takes aaggggggeeesss.
src/gs-cmd.c | 2 ++
src/gs-plugin-loader.c | 7 ++++++-
src/gs-plugin.h | 1 +
src/gs-shell-updates.c | 1 +
src/plugins/gs-plugin-packagekit-refine.c | 20 +++++++++++++++-----
5 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index 52ff393..d61775c 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -129,6 +129,8 @@ gs_cmd_refine_flag_from_string (const gchar *flag, GError **error)
return GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY;
if (g_strcmp0 (flag, "setup-action") == 0)
return GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION;
+ if (g_strcmp0 (flag, "update-details") == 0)
+ return GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS;
g_set_error (error,
GS_PLUGIN_ERROR,
GS_PLUGIN_ERROR_NOT_SUPPORTED,
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 113c29d..6e0c0b6 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -336,6 +336,7 @@ out:
static GList *
gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
const gchar *function_name,
+ GsPluginRefineFlags flags,
GCancellable *cancellable,
GError **error)
{
@@ -382,7 +383,7 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
ret = gs_plugin_loader_run_refine (plugin_loader,
function_name,
list,
- GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+ flags,
cancellable,
error);
if (!ret)
@@ -780,6 +781,7 @@ gs_plugin_loader_get_updates_thread_cb (GSimpleAsyncResult *res,
state->list = gs_plugin_loader_run_results (plugin_loader,
method_name,
+ state->flags,
cancellable,
&error);
if (state->list == NULL) {
@@ -915,6 +917,7 @@ gs_plugin_loader_get_installed_thread_cb (GSimpleAsyncResult *res,
/* do things that would block */
state->list = gs_plugin_loader_run_results (plugin_loader,
"gs_plugin_add_installed",
+ state->flags,
cancellable,
&error);
state->list = g_list_concat (state->list, g_list_copy_deep (plugin_loader->priv->queued_installs,
(GCopyFunc)g_object_ref, NULL));
@@ -1041,6 +1044,7 @@ gs_plugin_loader_get_popular_thread_cb (GSimpleAsyncResult *res,
/* do things that would block */
state->list = gs_plugin_loader_run_results (plugin_loader,
"gs_plugin_add_popular",
+ state->flags,
cancellable,
&error);
if (state->list == NULL) {
@@ -1147,6 +1151,7 @@ gs_plugin_loader_get_featured_thread_cb (GSimpleAsyncResult *res,
/* do things that would block */
state->list = gs_plugin_loader_run_results (plugin_loader,
"gs_plugin_add_featured",
+ state->flags,
cancellable,
&error);
if (state->list == NULL) {
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 1e0761d..3792648 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -90,6 +90,7 @@ typedef enum {
GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION = 1 << 6,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY = 1 << 7,
GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION = 1 << 8,
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS = 1 << 9,
GS_PLUGIN_REFINE_FLAGS_LAST
} GsPluginRefineFlags;
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 57a0dd9..dab8fd5 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -202,6 +202,7 @@ gs_shell_updates_refresh (GsShellUpdates *shell_updates,
gs_container_remove_all (GTK_CONTAINER (priv->list_box_updates));
refine_flags = GS_PLUGIN_REFINE_FLAGS_DEFAULT |
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION;
if (show_historical)
refine_flags |= GS_PLUGIN_REFINE_FLAGS_USE_HISTORY;
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 857f963..b1126cc 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -580,6 +580,19 @@ gs_plugin_refine_requires_version (GsApp *app, GsPluginRefineFlags flags)
}
/**
+ * gs_plugin_refine_requires_update_details:
+ */
+static gboolean
+gs_plugin_refine_requires_update_details (GsApp *app, GsPluginRefineFlags flags)
+{
+ const gchar *tmp;
+ tmp = gs_app_get_update_details (app);
+ if (tmp != NULL)
+ return FALSE;
+ return (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS) > 0;
+}
+
+/**
* gs_plugin_refine_requires_package_id:
*/
static gboolean
@@ -678,11 +691,8 @@ gs_plugin_refine (GsPlugin *plugin,
app = GS_APP (l->data);
if (gs_app_get_state (app) != GS_APP_STATE_UPDATABLE)
continue;
- if (gs_app_get_update_details (app) != NULL)
- continue;
- if (gs_app_get_source_id_default (app) == NULL)
- continue;
- updatedetails_all = g_list_prepend (updatedetails_all, app);
+ if (gs_plugin_refine_requires_update_details (app, flags))
+ updatedetails_all = g_list_prepend (updatedetails_all, app);
}
if (updatedetails_all != NULL) {
ret = gs_plugin_packagekit_refine_updatedetails (plugin,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]