[gnome-control-center] info: Conditionally display the "Check for updates" button



commit f43a7a88a465da610c894e6250075738a910d9ae
Author: Antoine Jacoutot <ajacoutot gnome org>
Date:   Tue Apr 8 13:38:53 2014 +0200

    info: Conditionally display the "Check for updates" button
    
    When neither gnome-software nor gpk-update-viewer are available,
    it does not make sense to display the "Check for updates" button.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727819

 panels/info/cc-info-panel.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/panels/info/cc-info-panel.c b/panels/info/cc-info-panel.c
index 58ed617..2d09453 100644
--- a/panels/info/cc-info-panel.c
+++ b/panels/info/cc-info-panel.c
@@ -1567,6 +1567,12 @@ does_gnome_software_exist (void)
   return g_file_test (BINDIR "/gnome-software", G_FILE_TEST_EXISTS);
 }
 
+static gboolean
+does_gpk_update_viewer_exist (void)
+{
+  return g_file_test (BINDIR "/gpk-update-viewer", G_FILE_TEST_EXISTS);
+}
+
 static void
 on_updates_button_clicked (GtkWidget   *widget,
                            CcInfoPanel *self)
@@ -1625,7 +1631,14 @@ cc_info_panel_init (CcInfoPanel *self)
   self->priv->graphics_data = get_graphics_data ();
 
   widget = WID ("updates_button");
-  g_signal_connect (widget, "clicked", G_CALLBACK (on_updates_button_clicked), self);
+  if (does_gnome_software_exist () || does_gpk_update_viewer_exist ())
+    {
+      g_signal_connect (widget, "clicked", G_CALLBACK (on_updates_button_clicked), self);
+    }
+  else
+    {
+      gtk_widget_destroy (widget);
+    }
 
   info_panel_setup_selector (self);
   info_panel_setup_overview (self);


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