]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/listbox.cpp
simplify code to return from the end of the function
[wxWidgets.git] / src / gtk / listbox.cpp
index 788f1f4cb22cd9438f2ca39f1faf143799fe3105..6cdf71a549755354d7520cda572ee79c64a516a9 100644 (file)
@@ -36,7 +36,7 @@
 #include "wx/gtk/treeentry_gtk.h"
 
 #include <gdk/gdkkeysyms.h>
-#if GTK_CHECK_VERSION(3,0,0)
+#ifdef __WXGTK3__
 #include <gdk/gdkkeysyms-compat.h>
 #endif
 
@@ -404,7 +404,13 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
 wxListBox::~wxListBox()
 {
-    m_hasVMT = false;
+    if (m_treeview)
+    {
+        GTKDisconnect(m_treeview);
+        GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview);
+        if (selection)
+            GTKDisconnect(selection);
+    }
 
     Clear();
 }
@@ -775,7 +781,7 @@ void wxListBox::DoScrollToCell(int n, float alignY, float alignX)
     wxCHECK_RET( IsValid(n), wxT("invalid index"));
 
     //RN: I have no idea why this line is needed...
-    if (gdk_pointer_is_grabbed () && gtk_widget_has_grab(GTK_WIDGET(m_treeview)))
+    if (gtk_widget_has_grab(GTK_WIDGET(m_treeview)))
         return;
 
     GtkTreeIter iter;
@@ -925,7 +931,7 @@ wxSize wxListBox::DoGetBestSize() const
 wxVisualAttributes
 wxListBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
 {
-    return GetDefaultAttributesFromGTKWidget(gtk_tree_view_new, true);
+    return GetDefaultAttributesFromGTKWidget(gtk_tree_view_new(), true);
 }
 
 #endif // wxUSE_LISTBOX