]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/taskbar.cpp
Remove obsolete header used only with CodeWarrior MetroWerks compiler.
[wxWidgets.git] / src / gtk / taskbar.cpp
index f3069bb79ec623b86328684d864a5888e8c5aea7..e45534a5d22fbdda71bc860948e0ddc29094291e 100644 (file)
@@ -12,7 +12,7 @@
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
-#if wxUSE_TASKBARICON && defined(__WXGTK210__)
+#if wxUSE_TASKBARICON
 
 #include "wx/taskbar.h"
 
 #include "eggtrayicon.h"
 #include <gtk/gtk.h>
 
+#if !GTK_CHECK_VERSION(2,10,0)
+    typedef struct _GtkStatusIcon GtkStatusIcon;
+#endif
+
 class wxTaskBarIcon::Private
 {
 public:
@@ -112,6 +116,7 @@ status_icon_popup_menu(GtkStatusIcon*, guint, guint, wxTaskBarIcon* taskBarIcon)
 
 bool wxTaskBarIconBase::IsAvailable()
 {
+#ifdef GDK_WINDOWING_X11
     char name[32];
     g_snprintf(name, sizeof(name), "_NET_SYSTEM_TRAY_S%d",
         gdk_x11_get_default_screen());
@@ -120,6 +125,9 @@ bool wxTaskBarIconBase::IsAvailable()
     Window manager = XGetSelectionOwner(gdk_x11_get_default_xdisplay(), atom);
 
     return manager != None;
+#else
+    return true;
+#endif
 }
 //-----------------------------------------------------------------------------
 
@@ -176,7 +184,7 @@ void wxTaskBarIcon::Private::SetIcon()
         m_size = 0;
         if (m_eggTrayIcon)
         {
-            GtkWidget* image = GTK_BIN(m_eggTrayIcon)->child;
+            GtkWidget* image = gtk_bin_get_child(GTK_BIN(m_eggTrayIcon));
             gtk_image_set_from_pixbuf(GTK_IMAGE(image), m_bitmap.GetPixbuf());
         }
         else
@@ -203,10 +211,22 @@ void wxTaskBarIcon::Private::SetIcon()
 
 #if GTK_CHECK_VERSION(2,10,0)
     if (m_statusIcon)
-        gtk_status_icon_set_tooltip(m_statusIcon, tip_text);
-    else
+    {
+#if GTK_CHECK_VERSION(2,16,0)
+        if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,16,0) == NULL)
+            gtk_status_icon_set_tooltip_text(m_statusIcon, tip_text);
+        else
 #endif
+        {
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
+            gtk_status_icon_set_tooltip(m_statusIcon, tip_text);
+#endif
+        }
+    }
+    else
+#endif // GTK_CHECK_VERSION(2,10,0)
     {
+#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
         if (tip_text && m_tooltips == NULL)
         {
             m_tooltips = gtk_tooltips_new();
@@ -215,6 +235,7 @@ void wxTaskBarIcon::Private::SetIcon()
         }
         if (m_tooltips)
             gtk_tooltips_set_tip(m_tooltips, m_eggTrayIcon, tip_text, "");
+#endif
     }
 #endif // wxUSE_TOOLTIPS
 }
@@ -236,7 +257,7 @@ void wxTaskBarIcon::Private::size_allocate(int width, int height)
         if (h > size) h = size;
         GdkPixbuf* pixbuf =
             gdk_pixbuf_scale_simple(m_bitmap.GetPixbuf(), w, h, GDK_INTERP_BILINEAR);
-        GtkImage* image = GTK_IMAGE(GTK_BIN(m_eggTrayIcon)->child);
+        GtkImage* image = GTK_IMAGE(gtk_bin_get_child(GTK_BIN(m_eggTrayIcon)));
         gtk_image_set_from_pixbuf(image, pixbuf);
         g_object_unref(pixbuf);
     }