Use our own DirPicker on GTK 2.24.17 (which seems to have a bugs in its GtkFileChoose...
authorCarl Hetherington <cth@carlh.net>
Fri, 28 Jun 2013 09:40:23 +0000 (10:40 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 28 Jun 2013 09:40:23 +0000 (10:40 +0100)
src/wx/new_film_dialog.cc
src/wx/new_film_dialog.h
src/wx/wscript
wscript

index 191482a7cbcdb23ca3da8f48720dbbcdc7bf2d06..91caa4963c268e3c3727b5af5c456ebec254b6f3 100644 (file)
@@ -21,7 +21,7 @@
 #include <wx/stdpaths.h>
 #include "lib/config.h"
 #include "new_film_dialog.h"
-#ifdef __WXMSW__
+#if defined(__WXMSW__) || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 24 && GTK_MICRO_VERSION == 17)
 #include "dir_picker_ctrl.h"
 #endif
 #include "wx_util.h"
@@ -46,8 +46,12 @@ NewFilmDialog::NewFilmDialog (wxWindow* parent)
        table->Add (_name, 1, wxEXPAND);
 
        add_label_to_sizer (table, this, _("Create in folder"));
-#ifdef __WXMSW__
-       _folder = new DirPickerCtrl (this);
+
+       /* GTK 2.24.17 has a buggy GtkFileChooserButton and it was put in Ubuntu 13.04.
+          Use our own dir picker as this is the least bad option I can think of.
+       */
+#if defined(__WXMSW__) || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 24 && GTK_MICRO_VERSION == 17)
+       _folder = new DirPickerCtrl (this); 
 #else  
        _folder = new wxDirPickerCtrl (this, wxDD_DIR_MUST_EXIST);
 #endif
index bfcbd423c2cb31a3cc60a9a07bfbc15ab8ad7e17..70bb7945b1db915fbdc133c1a5ce9ed9af34570a 100644 (file)
@@ -19,6 +19,9 @@
 
 #include <wx/wx.h>
 #include <wx/filepicker.h>
+#ifdef __WXGTK__
+#include <gtk/gtk.h>
+#endif
 
 class DirPickerCtrl;
 
@@ -32,10 +35,10 @@ public:
 
 private:
        wxTextCtrl* _name;
-#ifdef __WXMSW__       
+#if defined(__WXMSW__) || (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION == 24 && GTK_MICRO_VERSION == 17)
        DirPickerCtrl* _folder;
-#else
+#else  
        wxDirPickerCtrl* _folder;
-#endif
+#endif 
        static boost::optional<std::string> _directory;
 };
index 9213d722012e556e35380c108c83164f4f943d92..4bc79d6bb61b812c1fc04b73f8a5a6af446d7127 100644 (file)
@@ -52,6 +52,8 @@ def build(bld):
     obj.includes = [ '..' ]
     obj.export_includes = ['.']
     obj.uselib = 'WXWIDGETS'
+    if bld.env.TARGET_LINUX:
+        obj.uselib += ' GTK'
     obj.use = 'libdvdomatic'
     obj.source = sources
     obj.target = 'dvdomatic-wx'
diff --git a/wscript b/wscript
index cfbaa09dd49bdf64c6856222bb7eb954b8d60936..db4d93e4d2666a69d3b21731b411fcbefa916413 100644 (file)
--- a/wscript
+++ b/wscript
@@ -112,6 +112,8 @@ def configure(conf):
 
     if conf.env.TARGET_LINUX:
         conf.check_cfg(package='liblzma', args='--cflags --libs', uselib_store='LZMA', mandatory=True)
+        # On Linux we need to be able to include <gtk/gtk.h> to check GTK's version
+        conf.check_cfg(package='gtk+-2.0', args='--cflags', uselib_store='GTK', mandatory=True)
 
     conf.check_cfg(package = '', path = conf.options.magickpp_config, args = '--cppflags --cxxflags --libs', uselib_store = 'MAGICK', mandatory = True)