Skip to content

Commit

Permalink
color-panel: Replace broken package-kit installation of gnome-
Browse files Browse the repository at this point in the history
color-manager with apturl (if available).
  • Loading branch information
mtwebster committed Nov 14, 2024
1 parent f484ddd commit 183cf31
Showing 1 changed file with 6 additions and 53 deletions.
59 changes: 6 additions & 53 deletions panels/color/cc-color-panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,61 +259,14 @@ gcm_prefs_file_chooser_get_icc_profile (CcColorPanel *prefs)
return file;
}

typedef struct
{
GPtrArray *argv;
guint xid;

} ClosureData;

static void free_data(ClosureData *data)
{
g_ptr_array_unref (data->argv);
g_slice_free (ClosureData, data);
}

static void
installer_finished_cb (gboolean success, gpointer user_data)
install_gcm (void)
{
ClosureData *data = (ClosureData *)user_data;
GError *error;
gboolean ret;

if (!success)
{
g_warning ("failed to install required component");
free_data (data);
return;
}

error = NULL;
g_autofree gchar *apturl = g_find_program_in_path ("apturl");

ret = g_spawn_async (NULL, (gchar**) data->argv->pdata, NULL, 0,
NULL, NULL, NULL, &error);
free_data (data);
if (!ret)
{
g_warning ("failed to run command: %s", error->message);
g_error_free (error);
}
}

static void
gcm_prefs_install_component (guint xid, GPtrArray *argv)
{
ClosureData *data;
data = g_slice_new(ClosureData);
data->argv = argv;
data->xid = xid;
g_ptr_array_ref (data->argv);

const gchar *to_install[2];
to_install[0] = "gnome-color-manager";
to_install[1] = NULL;

gnome_installer_install_packages(to_install,
(GnomeInstallerClientCallback) installer_finished_cb,
data);
if (apturl != NULL) {
g_spawn_command_line_async ("apturl apt://gnome-color-manager", NULL);
}
}

static void
Expand All @@ -329,7 +282,7 @@ gcm_prefs_run_maybe_install (guint xid, gchar *filename, GPtrArray *argv)
if ((error->domain == g_spawn_error_quark ()) &&
(error->code == G_SPAWN_ERROR_NOENT))
{
gcm_prefs_install_component (xid, argv);
install_gcm ();
}
else
{
Expand Down

0 comments on commit 183cf31

Please sign in to comment.