[gnome-control-center/gnome-3-10] info: Use gnome-software for showing the list of updates if installed



commit 52db5c3696f362b30579b6e7f9cefe6bb65fca63
Author: Richard Hughes <richard hughsie com>
Date:   Tue Oct 22 13:12:11 2013 +0100

    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 9333bb7..96d06d5 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 247f41c..3e0580e 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -1731,18 +1731,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 ())
+    {
+      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 ("unable to launch Software Updates: %s", error->message);
+      g_warning ("Failed to spawn %s: %s", argv[0], error->message);
       g_error_free (error);
     }
+  g_strfreev (argv);
 }
 
 static gboolean


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