[gnome-software] Do not set the application state in the loader



commit 11ece7eace9d0eb7170cbbcfa0ae8e4a9c168c7b
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jan 30 20:50:09 2014 +0000

    Do not set the application state in the loader
    
    If we have two plugins that want to be run on install, the second has to process
    a patch with the 'wrong' state. Rely on the plugin to do the right thing itself.

 src/gs-plugin-loader.c             |    6 ------
 src/plugins/gs-plugin-packagekit.c |    3 +++
 2 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 67c11b4..ae25003 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -648,7 +648,6 @@ typedef struct {
        guint                            cache_age;
        GsCategory                      *category;
        GsApp                           *app;
-       GsAppState                       state_progress;
        GsAppState                       state_success;
        GsAppState                       state_failure;
 } GsPluginLoaderAsyncState;
@@ -1997,8 +1996,6 @@ gs_plugin_loader_app_action_thread_cb (GSimpleAsyncResult *res,
        guint id;
 
        /* add to list */
-       if (state->state_progress != GS_APP_STATE_UNKNOWN)
-               gs_app_set_state_in_idle (state->app, state->state_progress);
        g_mutex_lock (&state->plugin_loader->priv->pending_apps_mutex);
        g_ptr_array_add (state->plugin_loader->priv->pending_apps, g_object_ref (state->app));
        g_mutex_unlock (&state->plugin_loader->priv->pending_apps_mutex);
@@ -2230,19 +2227,16 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
        switch (action) {
        case GS_PLUGIN_LOADER_ACTION_INSTALL:
                state->function_name = "gs_plugin_app_install";
-               state->state_progress = GS_APP_STATE_INSTALLING;
                state->state_success = GS_APP_STATE_INSTALLED;
                state->state_failure = GS_APP_STATE_AVAILABLE;
                break;
        case GS_PLUGIN_LOADER_ACTION_REMOVE:
                state->function_name = "gs_plugin_app_remove";
-               state->state_progress = GS_APP_STATE_REMOVING;
                state->state_success = GS_APP_STATE_AVAILABLE;
                state->state_failure = GS_APP_STATE_INSTALLED;
                break;
        case GS_PLUGIN_LOADER_ACTION_SET_RATING:
                state->function_name = "gs_plugin_app_set_rating";
-               state->state_progress = GS_APP_STATE_UNKNOWN;
                state->state_success = GS_APP_STATE_UNKNOWN;
                state->state_failure = GS_APP_STATE_UNKNOWN;
                break;
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 5dc287c..ecdc1ef 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -200,6 +200,7 @@ gs_plugin_app_install (GsPlugin *plugin,
                                             "no packages to install");
                        goto out;
                }
+               gs_app_set_state (app, GS_APP_STATE_INSTALLING);
                results = pk_task_install_packages_sync (plugin->priv->task,
                                                         package_ids,
                                                         cancellable,
@@ -221,6 +222,7 @@ gs_plugin_app_install (GsPlugin *plugin,
                        goto out;
                }
                package_ids = g_strsplit (package_id, "\t", -1);
+               gs_app_set_state (app, GS_APP_STATE_INSTALLING);
                results = pk_task_install_files_sync (plugin->priv->task,
                                                      package_ids,
                                                      cancellable,
@@ -314,6 +316,7 @@ gs_plugin_app_remove (GsPlugin *plugin,
        }
 
        /* do the action */
+       gs_app_set_state (app, GS_APP_STATE_REMOVING);
        results = pk_task_remove_packages_sync (plugin->priv->task,
                                                package_ids,
                                                TRUE, FALSE,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]