Hide icon option when platforms disable

Mac and some Linux configs disable menu icons.  We shouldn't offer the
option when the system does not support this as it leads to confusion

Fixes https://gitlab.com/kicad/code/kicad/issues/10425
This commit is contained in:
Seth Hillbrand 2022-02-07 10:26:43 -08:00
parent f9b27a53b2
commit d0d472f39d
5 changed files with 32 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#include <dialog_shim.h>
#include <gal/dpi_scaling.h>
#include <kiface_base.h>
#include <kiplatform/ui.h>
#include <pgm_base.h>
#include <id.h>
#include <settings/common_settings.h>
@ -132,6 +133,9 @@ PANEL_COMMON_SETTINGS::PANEL_COMMON_SETTINGS( DIALOG_SHIM* aDialog, wxWindow* aP
m_canvasScaleAuto->Show( false );
}
// Hide the option of icons in menus for platforms that do not support them
m_checkBoxIconsInMenus->Show( KIPLATFORM::UI::AllowIconsInMenus() );
/*
* Font scaling hacks are only needed on GTK under wxWidgets 3.0.
*/
@ -483,4 +487,4 @@ void PANEL_COMMON_SETTINGS::setPdfViewerPathState()
{
m_PDFViewerPath->Enable( m_otherPDFViewer->GetValue() );
m_pdfViewerBtn->Enable( m_otherPDFViewer->GetValue() );
}
}

View File

@ -134,3 +134,13 @@ void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay
gtk_scrolled_window_set_overlay_scrolling( GTK_SCROLLED_WINDOW( aWindow->GetHandle() ),
overlay );
}
bool KIPLATFORM::UI::AllowIconsInMenus()
{
gboolean allowed = 1;
g_object_get( gtk_settings_get_default(), "gtk-menu-images", &allowed, NULL );
return !!allowed;
}

View File

@ -115,6 +115,11 @@ namespace KIPLATFORM
* Implemented only on GTK.
*/
void SetOverlayScrolling( const wxWindow* aWindow, bool overlay );
/**
* If the user has disabled icons system-wide, we check that here
*/
bool AllowIconsInMenus();
}
}

View File

@ -132,3 +132,9 @@ void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay
{
// Not implemented
}
bool KIPLATFORM::UI::AllowIconsInMenus()
{
return true;
}

View File

@ -132,3 +132,9 @@ void KIPLATFORM::UI::SetOverlayScrolling( const wxWindow* aWindow, bool overlay
{
// Not implemented
}
bool KIPLATFORM::UI::AllowIconsInMenus()
{
return false;
}