diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c index 31570ec4b..19b477cfe 100644 --- a/panels/applications/cc-applications-panel.c +++ b/panels/applications/cc-applications-panel.c @@ -87,6 +87,7 @@ struct _CcApplicationsPanel GtkStack *stack; GtkBox *empty_box; GtkBox *settings_box; + GtkButton *install_button; GtkBox *permission_section; GtkListBox *permission_list; @@ -153,6 +154,13 @@ enum PROP_PARAMETERS }; +static gboolean +gnome_software_is_installed (void) +{ + g_autofree gchar *path = g_find_program_in_path ("gnome-software"); + return path != NULL; +} + /* Callbacks */ static gboolean @@ -1659,7 +1667,7 @@ update_panel (CcApplicationsPanel *self, gtk_label_set_label (self->title_label, g_app_info_get_display_name (info)); gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->settings_box)); - gtk_widget_show (GTK_WIDGET (self->header_button)); + gtk_widget_set_visible (GTK_WIDGET (self->header_button), gnome_software_is_installed ()); g_clear_pointer (&self->current_app_id, g_free); g_clear_pointer (&self->current_portal_app_id, g_free); @@ -1975,6 +1983,7 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass) gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_section); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_reset); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_list); + gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, install_button); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_list); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_section); gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, location); @@ -2043,6 +2052,8 @@ cc_applications_panel_init (CcApplicationsPanel *self) gtk_widget_init_template (GTK_WIDGET (self)); + gtk_widget_set_visible (GTK_WIDGET (self->install_button), gnome_software_is_installed ()); + provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ()); gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/org/gnome/control-center/applications/cc-applications-panel.css"); diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui index 7a08465bf..13f26d457 100644 --- a/panels/applications/cc-applications-panel.ui +++ b/panels/applications/cc-applications-panel.ui @@ -53,7 +53,7 @@ - + Install someā€¦ 1 1