[gnome-software/ramcq/no-baobab] shell: only show "Examine Disk" button when baobab is available



commit eed1962914798477369c9a2f371c3c2630768a0a
Author: Robert McQueen <rob endlessm com>
Date:   Thu Sep 6 16:47:00 2018 +0100

    shell: only show "Examine Disk" button when baobab is available
    
    Mask the visibility of "Examine Disk" based on whether "baobab" can be
    launched.

 src/gs-shell.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-shell.c b/src/gs-shell.c
index d935a41a..8d9eaf65 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -920,6 +920,13 @@ typedef enum {
        GS_SHELL_EVENT_BUTTON_LAST
 } GsShellEventButtons;
 
+static gboolean
+gs_shell_has_disk_examination_app (void)
+{
+       g_autofree gchar *baobab = g_find_program_in_path ("baobab");
+       return (baobab != NULL);
+}
+
 static void
 gs_shell_show_event_app_notify (GsShell *shell,
                                const gchar *title,
@@ -938,7 +945,8 @@ gs_shell_show_event_app_notify (GsShell *shell,
 
        /* no-space button */
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_events_no_space"));
-       gtk_widget_set_visible (widget, (buttons & GS_SHELL_EVENT_BUTTON_NO_SPACE) > 0);
+       gtk_widget_set_visible (widget, (buttons & GS_SHELL_EVENT_BUTTON_NO_SPACE) > 0 &&
+                                       gs_shell_has_disk_examination_app());
 
        /* network settings button */
        widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_events_network_settings"));


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