X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/02761f6cd478e3c2c97cf6f93442747f7b029833..883ea3bf80503de1f2aa797ce91acda654d88d74:/src/gtk/artgtk.cpp?ds=sidebyside diff --git a/src/gtk/artgtk.cpp b/src/gtk/artgtk.cpp index 9d4c51c768..07d8f4cf4c 100644 --- a/src/gtk/artgtk.cpp +++ b/src/gtk/artgtk.cpp @@ -20,7 +20,7 @@ #pragma hdrstop #endif -#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) +#if !defined(__WXUNIVERSAL__) #include "wx/artprov.h" @@ -28,8 +28,11 @@ #include "wx/module.h" #endif -#include "wx/gtk/private.h" - +#include +#if GTK_CHECK_VERSION(2, 9, 0) + // gtk_object_sink + #undef GTK_DISABLE_DEPRECATED +#endif #include // compatibility with older GTK+ versions: @@ -54,7 +57,7 @@ protected: /*static*/ void wxArtProvider::InitNativeProvider() { - wxArtProvider::PushProvider(new wxGTK2ArtProvider); + Push(new wxGTK2ArtProvider); } // ---------------------------------------------------------------------------- @@ -211,7 +214,7 @@ static GdkPixbuf *CreateStockIcon(const char *stockid, GtkIconSize size) gs_gtkStyle = gtk_rc_get_style(widget); wxASSERT( gs_gtkStyle != NULL ); g_object_ref(gs_gtkStyle); - gtk_widget_destroy(widget); + gtk_object_sink((GtkObject*)widget); } GtkIconSet *iconset = gtk_style_lookup_icon_set(gs_gtkStyle, stockid); @@ -262,10 +265,9 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id, GdkPixbuf *pixbuf = CreateStockIcon(stockid, stocksize); #ifdef __WXGTK24__ - if (!gtk_check_version(2,4,0)) + if (!pixbuf && !gtk_check_version(2,4,0)) { - if (!pixbuf) - pixbuf = CreateThemeIcon(stockid, stocksize, size); + pixbuf = CreateThemeIcon(stockid, stocksize, size); } #endif @@ -282,13 +284,9 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id, } } - if (!pixbuf) - return wxNullBitmap; - wxBitmap bmp; - bmp.SetWidth(gdk_pixbuf_get_width(pixbuf)); - bmp.SetHeight(gdk_pixbuf_get_height(pixbuf)); - bmp.SetPixbuf(pixbuf); + if (pixbuf != NULL) + bmp.SetPixbuf(pixbuf); return bmp; } @@ -315,4 +313,4 @@ public: IMPLEMENT_DYNAMIC_CLASS(wxArtGtkModule, wxModule) -#endif // defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) +#endif // !defined(__WXUNIVERSAL__)