[gnome-control-center] info-overview: Search path for gnome-software rather than rely on exact location
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] info-overview: Search path for gnome-software rather than rely on exact location
- Date: Sun, 13 Dec 2020 21:53:23 +0000 (UTC)
commit 84c8803d7662a8adcb35224c27cc970a3af80ff7
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Apr 17 11:29:20 2020 +1200
info-overview: Search path for gnome-software rather than rely on exact location
panels/info-overview/cc-info-overview-panel.c | 19 +++++++++++--------
panels/info-overview/meson.build | 1 -
2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/panels/info-overview/cc-info-overview-panel.c b/panels/info-overview/cc-info-overview-panel.c
index 98c77e97f..fe7a23c2c 100644
--- a/panels/info-overview/cc-info-overview-panel.c
+++ b/panels/info-overview/cc-info-overview-panel.c
@@ -722,13 +722,15 @@ info_overview_panel_setup_overview (CcInfoOverviewPanel *self)
static gboolean
does_gnome_software_exist (void)
{
- return g_file_test (BINDIR "/gnome-software", G_FILE_TEST_EXISTS);
+ g_autofree gchar *path = g_find_program_in_path ("gnome-software");
+ return path != NULL;
}
static gboolean
does_gpk_update_viewer_exist (void)
{
- return g_file_test (BINDIR "/gpk-update-viewer", G_FILE_TEST_EXISTS);
+ g_autofree gchar *path = g_find_program_in_path ("gpk-update-viewer");
+ return path != NULL;
}
static void
@@ -736,19 +738,20 @@ open_software_update (CcInfoOverviewPanel *self)
{
g_autoptr(GError) error = NULL;
gboolean ret;
- g_auto(GStrv) argv = NULL;
+ char *argv[3];
- argv = g_new0 (gchar *, 3);
if (does_gnome_software_exist ())
{
- argv[0] = g_build_filename (BINDIR, "gnome-software", NULL);
- argv[1] = g_strdup_printf ("--mode=updates");
+ argv[0] = "gnome-software";
+ argv[1] = "--mode=updates";
+ argv[2] = NULL;
}
else
{
- argv[0] = g_build_filename (BINDIR, "gpk-update-viewer", NULL);
+ argv[0] = "gpk-update-viewer";
+ argv[1] = NULL;
}
- ret = g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, &error);
+ ret = g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error);
if (!ret)
g_warning ("Failed to spawn %s: %s", argv[0], error->message);
}
diff --git a/panels/info-overview/meson.build b/panels/info-overview/meson.build
index 14eddb07a..14663f24c 100644
--- a/panels/info-overview/meson.build
+++ b/panels/info-overview/meson.build
@@ -18,7 +18,6 @@ i18n.merge_file(
)
cflags += [
- '-DBINDIR="@0@"'.format(control_center_bindir),
'-DDATADIR="@0@"'.format(control_center_datadir),
'-DLIBEXECDIR="@0@"'.format(control_center_libexecdir),
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]