From 33cc59d726225f77b91de96d17707b5384134580 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 22 Oct 2013 13:12:11 +0100 Subject: [PATCH] info: Use gnome-software for showing the list of updates if installed Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=710595 --- panels/info/Makefile.am | 1 + panels/info/cc-info-panel.c | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/panels/info/Makefile.am b/panels/info/Makefile.am index 9333bb776..96d06d5ab 100644 --- a/panels/info/Makefile.am +++ b/panels/info/Makefile.am @@ -5,6 +5,7 @@ INCLUDES = \ $(INFO_PANEL_CFLAGS) \ -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ -DDATADIR="\"$(datadir)\"" \ + -DBINDIR="\"$(bindir)\"" \ $(NULL) noinst_LTLIBRARIES = libinfo.la diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c index a90256f4c..2890ba55c 100644 --- a/panels/info/cc-info-panel.c +++ b/panels/info/cc-info-panel.c @@ -1730,18 +1730,37 @@ on_pk_signal (GDBusProxy *proxy, } } +static gboolean +does_gnome_software_exist (void) +{ + return g_file_test (BINDIR "/gnome-software", G_FILE_TEST_EXISTS); +} + static void on_updates_button_clicked (GtkWidget *widget, CcInfoPanel *self) { - GError *error; - error = NULL; - g_spawn_command_line_async ("gpk-update-viewer", &error); - if (error != NULL) + GError *error = NULL; + gboolean ret; + gchar **argv; + + argv = g_new0 (gchar *, 3); + if (does_gnome_software_exist ()) { - g_warning ("unable to launch Software Updates: %s", error->message); + argv[0] = g_build_filename (BINDIR, "gnome-software", NULL); + argv[1] = g_strdup_printf ("--mode=updates"); + } + else + { + argv[0] = g_build_filename (BINDIR, "gpk-update-viewer", NULL); + } + ret = g_spawn_async (NULL, argv, NULL, 0, NULL, NULL, NULL, &error); + if (!ret) + { + g_warning ("Failed to spawn %s: %s", argv[0], error->message); g_error_free (error); } + g_strfreev (argv); } static gboolean