[gnome-software/wip/ubuntu-xenial: 203/208] Revert "Use GFile instead of a filename when converting apps."



commit ab2fa9cc61e50e6aed141078f7b0de36f1cfe683
Author: Robert Ancell <robert ancell canonical com>
Date:   Mon Aug 15 12:16:08 2016 +1200

    Revert "Use GFile instead of a filename when converting apps."
    
    This reverts commit 00af88c2d5836e79116150db8781f4043b58df5f.
    
    This was making it harder to merge with the GNOME 3.20 branch

 src/gs-cmd.c                               |   12 ++---
 src/gs-plugin-loader-sync.c                |   36 ++++++++--------
 src/gs-plugin-loader-sync.h                |    4 +-
 src/gs-plugin-loader.c                     |   59 ++++++++++++++--------------
 src/gs-plugin-loader.h                     |    6 +-
 src/gs-plugin.h                            |    8 ++--
 src/gs-self-test.c                         |   16 ++++---
 src/gs-shell-details.c                     |   37 ++++++++---------
 src/gs-shell-extras.c                      |   26 ++++++-------
 src/gs-utils.c                             |    4 +-
 src/gs-utils.h                             |    2 +-
 src/plugins/gs-plugin-dpkg.c               |   17 ++++----
 src/plugins/gs-plugin-fwupd.c              |   16 +++----
 src/plugins/gs-plugin-packagekit-refresh.c |   14 +++---
 src/plugins/gs-plugin-xdg-app.c            |   14 +++---
 15 files changed, 134 insertions(+), 137 deletions(-)
---
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index d695216..c169d33 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -192,7 +192,6 @@ main (int argc, char **argv)
        g_autoptr(GError) error = NULL;
        g_autofree gchar *refine_flags_str = NULL;
        g_autoptr(GsApp) app = NULL;
-       g_autoptr(GFile) file = NULL;
        g_autoptr(GsPluginLoader) plugin_loader = NULL;
        g_autoptr(AsProfile) profile = NULL;
        g_autoptr(AsProfileTask) ptask = NULL;
@@ -315,12 +314,11 @@ main (int argc, char **argv)
                                break;
                }
        } else if (argc == 3 && g_strcmp0 (argv[1], "filename-to-app") == 0) {
-               file = g_file_new_for_path (argv[2]);
-               app = gs_plugin_loader_file_to_app (plugin_loader,
-                                                   file,
-                                                   refine_flags,
-                                                   NULL,
-                                                   &error);
+               app = gs_plugin_loader_filename_to_app (plugin_loader,
+                                                       argv[2],
+                                                       refine_flags,
+                                                       NULL,
+                                                       &error);
                if (app == NULL) {
                        ret = FALSE;
                } else {
diff --git a/src/gs-plugin-loader-sync.c b/src/gs-plugin-loader-sync.c
index b139a78..254b8b9 100644
--- a/src/gs-plugin-loader-sync.c
+++ b/src/gs-plugin-loader-sync.c
@@ -615,27 +615,27 @@ gs_plugin_loader_refresh (GsPluginLoader *plugin_loader,
 }
 
 static void
-gs_plugin_loader_file_to_app_finish_sync (GObject *source_object,
-                                         GAsyncResult *res,
-                                         gpointer user_data)
+gs_plugin_loader_filename_to_app_finish_sync (GObject *source_object,
+                                             GAsyncResult *res,
+                                             gpointer user_data)
 {
        GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
        GsPluginLoaderHelper *helper = (GsPluginLoaderHelper *) user_data;
-       helper->app = gs_plugin_loader_file_to_app_finish (plugin_loader,
-                                                          res,
-                                                          helper->error);
+       helper->app = gs_plugin_loader_filename_to_app_finish (plugin_loader,
+                                                              res,
+                                                              helper->error);
        g_main_loop_quit (helper->loop);
 }
 
 /**
- * gs_plugin_loader_file_to_app:
+ * gs_plugin_loader_filename_to_app:
  **/
 GsApp *
-gs_plugin_loader_file_to_app (GsPluginLoader *plugin_loader,
-                             GFile *file,
-                             GsPluginRefineFlags flags,
-                             GCancellable *cancellable,
-                             GError **error)
+gs_plugin_loader_filename_to_app (GsPluginLoader *plugin_loader,
+                                 const gchar *filename,
+                                 GsPluginRefineFlags flags,
+                                 GCancellable *cancellable,
+                                 GError **error)
 {
        GsPluginLoaderHelper helper;
 
@@ -648,12 +648,12 @@ gs_plugin_loader_file_to_app (GsPluginLoader *plugin_loader,
        g_main_context_push_thread_default (helper.context);
 
        /* run async method */
-       gs_plugin_loader_file_to_app_async (plugin_loader,
-                                           file,
-                                           flags,
-                                           cancellable,
-                                           gs_plugin_loader_file_to_app_finish_sync,
-                                           &helper);
+       gs_plugin_loader_filename_to_app_async (plugin_loader,
+                                               filename,
+                                               flags,
+                                               cancellable,
+                                               gs_plugin_loader_filename_to_app_finish_sync,
+                                               &helper);
        g_main_loop_run (helper.loop);
 
        g_main_context_pop_thread_default (helper.context);
diff --git a/src/gs-plugin-loader-sync.h b/src/gs-plugin-loader-sync.h
index 03a3238..b1b88ec 100644
--- a/src/gs-plugin-loader-sync.h
+++ b/src/gs-plugin-loader-sync.h
@@ -86,8 +86,8 @@ GsApp         *gs_plugin_loader_get_app_by_id         (GsPluginLoader *plugin_loader,
                                                         GsPluginRefineFlags flags,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
-GsApp          *gs_plugin_loader_file_to_app           (GsPluginLoader *plugin_loader,
-                                                        GFile          *file,
+GsApp          *gs_plugin_loader_filename_to_app       (GsPluginLoader *plugin_loader,
+                                                        const gchar    *filename,
                                                         GsPluginRefineFlags flags,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 3bace24..131e14e 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -71,7 +71,7 @@ typedef struct {
        GList                           *list;
        GsPluginRefineFlags              flags;
        gchar                           *value;
-       GFile                           *file;
+       gchar                           *filename;
        guint                            cache_age;
        GsCategory                      *category;
        GsApp                           *app;
@@ -89,9 +89,8 @@ gs_plugin_loader_free_async_state (GsPluginLoaderAsyncState *state)
                g_object_unref (state->app);
        if (state->review != NULL)
                g_object_unref (state->review);
-       if (state->file != NULL)
-               g_object_unref (state->file);
 
+       g_free (state->filename);
        g_free (state->value);
        gs_plugin_list_free (state->list);
        g_slice_free (GsPluginLoaderAsyncState, state);
@@ -3658,23 +3657,23 @@ gs_plugin_loader_refresh_finish (GsPluginLoader *plugin_loader,
 /******************************************************************************/
 
 /**
- * gs_plugin_loader_file_to_app_thread_cb:
+ * gs_plugin_loader_filename_to_app_thread_cb:
  **/
 static void
-gs_plugin_loader_file_to_app_thread_cb (GTask *task,
-                                       gpointer object,
-                                       gpointer task_data,
-                                       GCancellable *cancellable)
+gs_plugin_loader_filename_to_app_thread_cb (GTask *task,
+                                           gpointer object,
+                                           gpointer task_data,
+                                           GCancellable *cancellable)
 {
        GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (object);
        GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
-       const gchar *function_name = "gs_plugin_file_to_app";
+       const gchar *function_name = "gs_plugin_filename_to_app";
        gboolean ret = TRUE;
        GError *error = NULL;
        GList *l;
        GsPluginLoaderAsyncState *state = (GsPluginLoaderAsyncState *) task_data;
        GsPlugin *plugin;
-       GsPluginFileToAppFunc plugin_func = NULL;
+       GsPluginFilenameToAppFunc plugin_func = NULL;
        guint i;
 
        /* run each plugin */
@@ -3696,7 +3695,7 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          plugin->name,
                                          function_name);
-               ret = plugin_func (plugin, &state->list, state->file,
+               ret = plugin_func (plugin, &state->list, state->filename,
                                   cancellable, &error_local);
                if (!ret) {
                        g_warning ("failed to call %s on %s: %s",
@@ -3713,8 +3712,10 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
        /* set the local file on any of the returned results */
        for (l = state->list; l != NULL; l = l->next) {
                GsApp *app = GS_APP (l->data);
-               if (gs_app_get_local_file (app) == NULL)
-                       gs_app_set_local_file (app, state->file);
+               if (gs_app_get_local_file (app) == NULL) {
+                       g_autoptr (GFile) file = g_file_new_for_path (state->filename);
+                       gs_app_set_local_file (app, file);
+               }
        }
 
        /* run refine() on each one */
@@ -3735,7 +3736,7 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
                g_task_return_new_error (task,
                                         GS_PLUGIN_LOADER_ERROR,
                                         GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
-                                        "no file_to_app results to show");
+                                        "no filename_to_app results to show");
                return;
        }
 
@@ -3745,16 +3746,16 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
                                         GS_PLUGIN_LOADER_ERROR,
                                         GS_PLUGIN_LOADER_ERROR_NO_RESULTS,
                                         "no application was created for %s",
-                                        g_file_get_path (state->file));
+                                        state->filename);
                return;
        }
        g_task_return_pointer (task, g_object_ref (state->list->data), (GDestroyNotify) g_object_unref);
 }
 
 /**
- * gs_plugin_loader_file_to_app_async:
+ * gs_plugin_loader_filename_to_app_async:
  *
- * This method calls all plugins that implement the gs_plugin_add_file_to_app()
+ * This method calls all plugins that implement the gs_plugin_add_filename_to_app()
  * function. The plugins can either return #GsApp objects of kind
  * %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.
@@ -3767,12 +3768,12 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
  * from the gs_app_get_local_file() method.
  **/
 void
-gs_plugin_loader_file_to_app_async (GsPluginLoader *plugin_loader,
-                                   GFile *file,
-                                   GsPluginRefineFlags flags,
-                                   GCancellable *cancellable,
-                                   GAsyncReadyCallback callback,
-                                   gpointer user_data)
+gs_plugin_loader_filename_to_app_async (GsPluginLoader *plugin_loader,
+                                       const gchar *filename,
+                                       GsPluginRefineFlags flags,
+                                       GCancellable *cancellable,
+                                       GAsyncReadyCallback callback,
+                                       gpointer user_data)
 {
        GsPluginLoaderAsyncState *state;
        g_autoptr(GTask) task = NULL;
@@ -3783,24 +3784,24 @@ gs_plugin_loader_file_to_app_async (GsPluginLoader *plugin_loader,
        /* save state */
        state = g_slice_new0 (GsPluginLoaderAsyncState);
        state->flags = flags;
-       state->file = g_object_ref (file);
+       state->filename = g_strdup (filename);
 
        /* run in a thread */
        task = g_task_new (plugin_loader, cancellable, callback, user_data);
        g_task_set_task_data (task, state, (GDestroyNotify) gs_plugin_loader_free_async_state);
        g_task_set_return_on_cancel (task, TRUE);
-       g_task_run_in_thread (task, gs_plugin_loader_file_to_app_thread_cb);
+       g_task_run_in_thread (task, gs_plugin_loader_filename_to_app_thread_cb);
 }
 
 /**
- * gs_plugin_loader_file_to_app_finish:
+ * gs_plugin_loader_filename_to_app_finish:
  *
  * Return value: (element-type GsApp) (transfer full): An application, or %NULL
  **/
 GsApp *
-gs_plugin_loader_file_to_app_finish (GsPluginLoader *plugin_loader,
-                                    GAsyncResult *res,
-                                    GError **error)
+gs_plugin_loader_filename_to_app_finish (GsPluginLoader *plugin_loader,
+                                        GAsyncResult *res,
+                                        GError **error)
 {
        g_return_val_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader), NULL);
        g_return_val_if_fail (G_IS_TASK (res), NULL);
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index ab4c36e..b55acf9 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -171,13 +171,13 @@ void               gs_plugin_loader_search_what_provides_async (GsPluginLoader    
*plugin_loade
 GList          *gs_plugin_loader_search_what_provides_finish (GsPluginLoader   *plugin_loader,
                                                         GAsyncResult   *res,
                                                         GError         **error);
-void            gs_plugin_loader_file_to_app_async     (GsPluginLoader *plugin_loader,
-                                                        GFile          *file,
+void            gs_plugin_loader_filename_to_app_async (GsPluginLoader *plugin_loader,
+                                                        const gchar    *filename,
                                                         GsPluginRefineFlags flags,
                                                         GCancellable   *cancellable,
                                                         GAsyncReadyCallback callback,
                                                         gpointer        user_data);
-GsApp          *gs_plugin_loader_file_to_app_finish    (GsPluginLoader *plugin_loader,
+GsApp          *gs_plugin_loader_filename_to_app_finish(GsPluginLoader *plugin_loader,
                                                         GAsyncResult   *res,
                                                         GError         **error);
 void            gs_plugin_loader_update_async          (GsPluginLoader *plugin_loader,
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index d40fcfa..731a219 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -163,9 +163,9 @@ typedef gboolean     (*GsPluginRefreshFunc  )       (GsPlugin       *plugin,
                                                         GsPluginRefreshFlags flags,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
-typedef gboolean        (*GsPluginFileToAppFunc)       (GsPlugin       *plugin,
+typedef gboolean        (*GsPluginFilenameToAppFunc)   (GsPlugin       *plugin,
                                                         GList          **list,
-                                                        GFile          *file,
+                                                        const gchar    *filename,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 typedef gboolean        (*GsPluginUpdateFunc)          (GsPlugin       *plugin,
@@ -332,9 +332,9 @@ gboolean     gs_plugin_refresh                      (GsPlugin       *plugin,
                                                         GsPluginRefreshFlags flags,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
-gboolean        gs_plugin_file_to_app                  (GsPlugin       *plugin,
+gboolean        gs_plugin_filename_to_app              (GsPlugin       *plugin,
                                                         GList          **list,
-                                                        GFile          *file,
+                                                        const gchar    *filename,
                                                         GCancellable   *cancellable,
                                                         GError         **error);
 gboolean        gs_plugin_update                       (GsPlugin       *plugin,
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index e66c515..98b9911 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -701,17 +701,19 @@ gs_plugin_loader_dpkg_func (GsPluginLoader *plugin_loader)
        g_autoptr(GsApp) app = NULL;
        g_autoptr(GError) error = NULL;
        g_autofree gchar *fn = NULL;
-       g_autoptr(GFile) file = NULL;
+
+       /* no dpkg, abort */
+       if (!gs_plugin_loader_get_enabled (plugin_loader, "dpkg"))
+               return;
 
        /* load local file */
        fn = gs_test_get_filename ("tests/chiron-1.1-1.deb");
        g_assert (fn != NULL);
-       file = g_file_new_for_path (fn);
-       app = gs_plugin_loader_file_to_app (plugin_loader,
-                                           file,
-                                           GS_PLUGIN_REFINE_FLAGS_DEFAULT,
-                                           NULL,
-                                           &error);
+       app = gs_plugin_loader_filename_to_app (plugin_loader,
+                                               fn,
+                                               GS_PLUGIN_REFINE_FLAGS_DEFAULT,
+                                               NULL,
+                                               &error);
        g_assert_no_error (error);
        g_assert (app != NULL);
        g_assert_cmpstr (gs_app_get_id (app), ==, NULL);
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 91c8e1d..7414701 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -176,7 +176,7 @@ gs_shell_details_switch_to (GsPage *page, gboolean scroll_up)
        widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "application_details_header"));
        gtk_widget_show (widget);
 
-       /* not set, perhaps file-to-app */
+       /* not set, perhaps filename-to-app */
        if (self->app == NULL)
                return;
 
@@ -1182,12 +1182,12 @@ gs_shell_details_failed_response_cb (GtkDialog *dialog,
 }
 
 /**
- * gs_shell_details_filen_to_app_cb:
+ * gs_shell_details_filename_to_app_cb:
  **/
 static void
-gs_shell_details_file_to_app_cb (GObject *source,
-                                GAsyncResult *res,
-                                gpointer user_data)
+gs_shell_details_filename_to_app_cb (GObject *source,
+                                    GAsyncResult *res,
+                                    gpointer user_data)
 {
        GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
        GsShellDetails *self = GS_SHELL_DETAILS (user_data);
@@ -1201,9 +1201,9 @@ gs_shell_details_file_to_app_cb (GObject *source,
        }
        /* save app */
        g_set_object (&self->app,
-                     gs_plugin_loader_file_to_app_finish (plugin_loader,
-                                                          res,
-                                                          &error));
+                     gs_plugin_loader_filename_to_app_finish(plugin_loader,
+                                                             res,
+                                                             &error));
        if (self->app == NULL) {
                GtkWidget *dialog;
 
@@ -1255,19 +1255,16 @@ gs_shell_details_file_to_app_cb (GObject *source,
 void
 gs_shell_details_set_filename (GsShellDetails *self, const gchar *filename)
 {
-       g_autoptr(GFile) file = NULL;
-
        gs_shell_details_set_state (self, GS_SHELL_DETAILS_STATE_LOADING);
-       file = g_file_new_for_path (filename);
-       gs_plugin_loader_file_to_app_async (self->plugin_loader,
-                                           file,
-                                           GS_PLUGIN_REFINE_FLAGS_DEFAULT |
-                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
-                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS |
-                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS,
-                                           self->cancellable,
-                                           gs_shell_details_file_to_app_cb,
-                                           self);
+       gs_plugin_loader_filename_to_app_async (self->plugin_loader,
+                                               filename,
+                                               GS_PLUGIN_REFINE_FLAGS_DEFAULT |
+                                               GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
+                                               GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEW_RATINGS |
+                                               GS_PLUGIN_REFINE_FLAGS_REQUIRE_REVIEWS,
+                                               self->cancellable,
+                                               gs_shell_details_filename_to_app_cb,
+                                               self);
 }
 
 /**
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index abcc910..96ba78d 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -563,9 +563,9 @@ search_files_cb (GObject *source_object,
 }
 
 static void
-file_to_app_cb (GObject *source_object,
-                GAsyncResult *res,
-                gpointer user_data)
+filename_to_app_cb (GObject *source_object,
+                    GAsyncResult *res,
+                    gpointer user_data)
 {
        SearchData *search_data = (SearchData *) user_data;
        GsShellExtras *self = search_data->self;
@@ -573,7 +573,7 @@ file_to_app_cb (GObject *source_object,
        GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
        g_autoptr(GError) error = NULL;
 
-       app = gs_plugin_loader_file_to_app_finish (plugin_loader, res, &error);
+       app = gs_plugin_loader_filename_to_app_finish (plugin_loader, res, &error);
        if (app == NULL) {
                if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
                        g_debug ("extras: search what provides cancelled");
@@ -702,17 +702,15 @@ gs_shell_extras_load (GsShellExtras *self, GPtrArray *array_search_data)
                                                             search_files_cb,
                                                             search_data);
                } else if (search_data->package_filename != NULL) {
-                       g_autoptr (GFile) file = NULL;
                        g_debug ("resolving filename to app: '%s'", search_data->package_filename);
-                       file = g_file_new_for_path (search_data->package_filename);
-                       gs_plugin_loader_file_to_app_async (self->plugin_loader,
-                                                           file,
-                                                           GS_PLUGIN_REFINE_FLAGS_DEFAULT |
-                                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
-                                                           GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES,
-                                                           self->search_cancellable,
-                                                           file_to_app_cb,
-                                                           search_data);
+                       gs_plugin_loader_filename_to_app_async (self->plugin_loader,
+                                                               search_data->package_filename,
+                                                               GS_PLUGIN_REFINE_FLAGS_DEFAULT |
+                                                               GS_PLUGIN_REFINE_FLAGS_REQUIRE_RATING |
+                                                               GS_PLUGIN_REFINE_FLAGS_ALLOW_PACKAGES,
+                                                               self->search_cancellable,
+                                                               filename_to_app_cb,
+                                                               search_data);
                } else {
                        g_debug ("searching what provides: '%s'", search_data->search);
                        gs_plugin_loader_search_what_provides_async (self->plugin_loader,
diff --git a/src/gs-utils.c b/src/gs-utils.c
index b7a6b99..9bc2572 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -496,14 +496,16 @@ gs_utils_get_permission (const gchar *id)
  * gs_utils_get_content_type:
  */
 gchar *
-gs_utils_get_content_type (GFile *file,
+gs_utils_get_content_type (const gchar *filename,
                           GCancellable *cancellable,
                           GError **error)
 {
        const gchar *tmp;
+       g_autoptr(GFile) file = NULL;
        g_autoptr(GFileInfo) info = NULL;
 
        /* get content type */
+       file = g_file_new_for_path (filename);
        info = g_file_query_info (file,
                                  G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
                                  G_FILE_QUERY_INFO_NONE,
diff --git a/src/gs-utils.h b/src/gs-utils.h
index a9d4cb4..0540a9f 100644
--- a/src/gs-utils.h
+++ b/src/gs-utils.h
@@ -36,7 +36,7 @@ void   gs_container_remove_all        (GtkContainer   *container);
 void    gs_grab_focus_when_mapped      (GtkWidget      *widget);
 
 guint   gs_utils_get_file_age          (GFile          *file);
-gchar  *gs_utils_get_content_type      (GFile          *file,
+gchar  *gs_utils_get_content_type      (const gchar    *filename,
                                         GCancellable   *cancellable,
                                         GError         **error);
 
diff --git a/src/plugins/gs-plugin-dpkg.c b/src/plugins/gs-plugin-dpkg.c
index b5005fc..afe24c8 100644
--- a/src/plugins/gs-plugin-dpkg.c
+++ b/src/plugins/gs-plugin-dpkg.c
@@ -51,14 +51,14 @@ gs_plugin_initialize (GsPlugin *plugin)
 }
 
 /**
- * gs_plugin_file_to_app:
+ * gs_plugin_filename_to_app:
  */
 gboolean
-gs_plugin_file_to_app (GsPlugin *plugin,
-                      GList **list,
-                      GFile *file,
-                      GCancellable *cancellable,
-                      GError **error)
+gs_plugin_filename_to_app (GsPlugin *plugin,
+                          GList **list,
+                          const gchar *filename,
+                          GCancellable *cancellable,
+                          GError **error)
 {
        GsApp *app;
        guint i;
@@ -72,7 +72,7 @@ gs_plugin_file_to_app (GsPlugin *plugin,
                NULL };
 
        /* does this match any of the mimetypes we support */
-       content_type = gs_utils_get_content_type (file, cancellable, error);
+       content_type = gs_utils_get_content_type (filename, cancellable, error);
        if (content_type == NULL)
                return FALSE;
        if (!g_strv_contains (mimetypes, content_type))
@@ -87,7 +87,8 @@ gs_plugin_file_to_app (GsPlugin *plugin,
                            "${Homepage}\\n"
                            "${Description}");
        argv[2] = g_strdup ("-W");
-       argv[3] = g_file_get_path (file);
+       argv[3] = g_strdup (filename);
+       argv[4] = NULL;
        if (!g_spawn_sync (NULL, argv, NULL,
                           G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL,
                           NULL, NULL, &output, NULL, NULL, error))
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index 32aa9a3..38294d9 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -1050,14 +1050,14 @@ gs_plugin_update_app (GsPlugin *plugin,
 }
 
 /**
- * gs_plugin_file_to_app:
+ * gs_plugin_filename_to_app:
  */
 gboolean
-gs_plugin_file_to_app (GsPlugin *plugin,
-                      GList **list,
-                      GFile *file,
-                      GCancellable *cancellable,
-                      GError **error)
+gs_plugin_filename_to_app (GsPlugin *plugin,
+                          GList **list,
+                          const gchar *filename,
+                          GCancellable *cancellable,
+                          GError **error)
 {
        FwupdDeviceFlags flags = FU_DEVICE_FLAG_ALLOW_OFFLINE;
        GVariant *body;
@@ -1078,10 +1078,9 @@ gs_plugin_file_to_app (GsPlugin *plugin,
        const gchar *mimetypes[] = {
                "application/vnd.ms-cab-compressed",
                NULL };
-       g_autofree gchar *filename = NULL;
 
        /* does this match any of the mimetypes we support */
-       content_type = gs_utils_get_content_type (file, cancellable, error);
+       content_type = gs_utils_get_content_type (filename, cancellable, error);
        if (content_type == NULL)
                return FALSE;
        if (!g_strv_contains (mimetypes, content_type))
@@ -1093,7 +1092,6 @@ gs_plugin_file_to_app (GsPlugin *plugin,
                return FALSE;
 
        /* open file */
-       filename = g_file_get_path (file);
        fd = open (filename, O_RDONLY);
        if (fd < 0) {
                g_set_error (error,
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index d027d25..0032130 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -271,14 +271,14 @@ gs_plugin_packagekit_refresh_guess_app_id (GsPlugin *plugin,
 }
 
 /**
- * gs_plugin_file_to_app:
+ * gs_plugin_filename_to_app:
  */
 gboolean
-gs_plugin_file_to_app (GsPlugin *plugin,
-                      GList **list,
-                      GFile *file,
-                      GCancellable *cancellable,
-                      GError **error)
+gs_plugin_filename_to_app (GsPlugin *plugin,
+                          GList **list,
+                          const gchar *filename,
+                          GCancellable *cancellable,
+                          GError **error)
 {
        const gchar *package_id;
        PkDetails *item;
@@ -300,7 +300,7 @@ gs_plugin_file_to_app (GsPlugin *plugin,
                NULL };
 
        /* does this match any of the mimetypes we support */
-       content_type = gs_utils_get_content_type (file, cancellable, error);
+       content_type = gs_utils_get_content_type (filename, cancellable, error);
        if (content_type == NULL)
                return FALSE;
        if (!g_strv_contains (mimetypes, content_type))
diff --git a/src/plugins/gs-plugin-xdg-app.c b/src/plugins/gs-plugin-xdg-app.c
index 94674a3..3444cbc 100644
--- a/src/plugins/gs-plugin-xdg-app.c
+++ b/src/plugins/gs-plugin-xdg-app.c
@@ -1399,14 +1399,14 @@ gs_plugin_update_app (GsPlugin *plugin,
 }
 
 /**
- * gs_plugin_file_to_app:
+ * gs_plugin_filename_to_app:
  */
 gboolean
-gs_plugin_file_to_app (GsPlugin *plugin,
-                      GList **list,
-                      GFile *file,
-                      GCancellable *cancellable,
-                      GError **error)
+gs_plugin_filename_to_app (GsPlugin *plugin,
+                          GList **list,
+                          const gchar *filename,
+                          GCancellable *cancellable,
+                          GError **error)
 {
        g_autofree gchar *content_type = NULL;
        g_autofree gchar *id_prefixed = NULL;
@@ -1420,7 +1420,7 @@ gs_plugin_file_to_app (GsPlugin *plugin,
                NULL };
 
        /* does this match any of the mimetypes we support */
-       content_type = gs_utils_get_content_type (file, cancellable, error);
+       content_type = gs_utils_get_content_type (filename, cancellable, error);
        if (content_type == NULL)
                return FALSE;
        if (!g_strv_contains (mimetypes, content_type))


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