Add GTK 2.10 version checks around code using GtkLinkButton

Blindly repair compiling/running against GTK < 2.10 after the previous
commit.
This commit is contained in:
Vadim Zeitlin 2020-04-18 17:55:50 +02:00
parent 9c76bdefca
commit 1b4a5ece64

View File

@ -87,10 +87,11 @@ static GtkWidget* ButtonWidget()
return s_widget;
}
#if GTK_CHECK_VERSION(2,10,0)
static GtkWidget* LinkButtonWidget()
{
static GtkWidget *s_widget;
if (s_widget == NULL)
if (s_widget == NULL && wx_is_at_least_gtk2(10))
{
s_widget = gtk_link_button_new("http://test.com");
g_object_add_weak_pointer(G_OBJECT(s_widget), (void**)&s_widget);
@ -99,6 +100,7 @@ static GtkWidget* LinkButtonWidget()
}
return s_widget;
}
#endif // GTK 2.10+
static GtkWidget* ListWidget()
{
@ -636,14 +638,16 @@ static const GtkStyle* ButtonStyle()
return gtk_widget_get_style(ButtonWidget());
}
static const wxColor LinkButtonStyle()
static const wxColor LinkButtonColor()
{
#if GTK_CHECK_VERSION(2,10,0)
GdkColor *link_color = NULL;
gtk_widget_style_get(LinkButtonWidget(), "link-color", &link_color, NULL);
if (link_color)
return wxColor(*link_color);
else
return *wxBLUE;
#endif // GTK 2.10+
return *wxBLUE;
}
static const GtkStyle* ListStyle()
@ -771,7 +775,7 @@ wxColour wxSystemSettingsNative::GetColour( wxSystemColour index )
break;
case wxSYS_COLOUR_HOTLIGHT:
color = LinkButtonStyle();
color = LinkButtonColor();
break;
case wxSYS_COLOUR_MAX: