[pygtk] Add extra warning against accidental misuse of tree model columns



commit bf8333755b4db98a54650f1cd15ecfe4fa2b4451
Author: Paul Pogonyshev <pogonyshev gmx net>
Date:   Fri May 8 21:46:45 2009 +0300

    Add extra warning against accidental misuse of tree model columns
    
    If a property is bound from a boolean (which is treated as integer,
    even though user most likely has different intentions), issue a
    warning.  Closes bug #554061.
---
 gtk/gtktreeview.override |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/gtk/gtktreeview.override b/gtk/gtktreeview.override
index 2a2c419..05d93c9 100644
--- a/gtk/gtktreeview.override
+++ b/gtk/gtktreeview.override
@@ -113,6 +113,12 @@ _wrap_gtk_tree_view_column_new(PyGObject *self, PyObject*args, PyObject*kwargs)
                 g_object_unref(tvc);
                 return -1;
             }
+
+            if (PyBool_Check(item)) {
+                g_warning("column number is a boolean, but will be interpreted "
+                          "as an integer; this is likely not what you intended");
+            }
+
             gtk_tree_view_column_add_attribute(tvc, cell, attr,
                                                PyInt_AsLong(item));
         }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]