glom r1429 - in trunk: . glom glom/libglom/python_embed glom/python_embed



Author: murrayc
Date: Wed Feb 20 14:39:10 2008
New Revision: 1429
URL: http://svn.gnome.org/viewvc/glom?rev=1429&view=rev

Log:
2008-02-20  Murray Cumming  <murrayc murrayc com>

* glom/application.h: Moved the m_pDrag_Bar declaration to 
avoid a warning about initialization sequence.
* glom/libglom/python_embed/py_glom_relatedrecord.cc:
* glom/python_embed/glom_python.cc: Cast some static strings to 
gchar* because the Python C API does not use const. This avoids some 
warnings.

Modified:
   trunk/ChangeLog
   trunk/glom/application.cc
   trunk/glom/application.h
   trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc
   trunk/glom/python_embed/glom_python.cc

Modified: trunk/glom/application.cc
==============================================================================
--- trunk/glom/application.cc	(original)
+++ trunk/glom/application.cc	Wed Feb 20 14:39:10 2008
@@ -102,7 +102,7 @@
   m_pFrame(0),
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   m_window_translations(0),
-	m_pDrag_Bar(0),
+  m_pDrag_Bar(0),
 #endif // !GLOM_ENABLE_CLIENT_ONLY
   m_menu_tables_ui_merge_id(0),
   m_menu_reports_ui_merge_id(0),

Modified: trunk/glom/application.h
==============================================================================
--- trunk/glom/application.h	(original)
+++ trunk/glom/application.h	Wed Feb 20 14:39:10 2008
@@ -155,6 +155,9 @@
 
 #ifndef GLOM_ENABLE_CLIENT_ONLY
   Window_Translations* m_window_translations;
+
+  // Drag bar (to be replaced by the fancy selector widget from mathias)
+  DragBar* m_pDrag_Bar;
 #endif // !GLOM_ENABLE_CLIENT_ONLY
 
   Glib::RefPtr<Gtk::ActionGroup> m_refNavTablesActionGroup, m_refNavReportsActionGroup, m_refNavPrintLayoutsActionGroup;
@@ -181,9 +184,6 @@
   //we already asked for them when getting the document over the network,
   //so we can use them again when connecting directly to the database:
   Glib::ustring m_temp_username, m_temp_password;
-
-  // Drag bar (to be replaced by the fancy selector widget from mathias)
-  DragBar* m_pDrag_Bar;
 	
   bool m_show_sql_debug;
 };

Modified: trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc
==============================================================================
--- trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc	(original)
+++ trunk/glom/libglom/python_embed/py_glom_relatedrecord.cc	Wed Feb 20 14:39:10 2008
@@ -284,10 +284,11 @@
 static PyObject *
 RelatedRecord_generic_aggregate(PyGlomRelatedRecord* self, PyObject *args, PyObject *kwargs, const Glib::ustring& aggregate)
 {
-  static char *kwlist[] = { "field_name", 0 };
+  typedef const char* type_pch;
+  static type_pch kwlist[] = { "field_name", 0 };
   PyObject* py_field_name = 0;
 
-  if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:RelatedRecord.sum", kwlist, &py_field_name))
+  if (!PyArg_ParseTupleAndKeywords(args, kwargs, (char*)"O:RelatedRecord.sum", (char**)kwlist, &py_field_name))
     return NULL;
 
   if(!(PyString_Check(py_field_name)))
@@ -394,17 +395,17 @@
 }
 
 static PyMethodDef RelatedRecord_methods[] = {
-    {"sum", (PyCFunction)RelatedRecord_sum, METH_VARARGS | METH_KEYWORDS,
-     "Add all values of the field in the related records."
+    {(char*)"sum", (PyCFunction)RelatedRecord_sum, METH_VARARGS | METH_KEYWORDS,
+     (char*)"Add all values of the field in the related records."
     },
-    {"count", (PyCFunction)RelatedRecord_count, METH_VARARGS | METH_KEYWORDS,
-     "Count all values in the field in the related records."
+    {(char*)"count", (PyCFunction)RelatedRecord_count, METH_VARARGS | METH_KEYWORDS,
+     (char*)"Count all values in the field in the related records."
     },
-    {"min", (PyCFunction)RelatedRecord_min, METH_VARARGS | METH_KEYWORDS,
-     "Minimum of all values of the field in the related records."
+    {(char*)"min", (PyCFunction)RelatedRecord_min, METH_VARARGS | METH_KEYWORDS,
+     (char*)"Minimum of all values of the field in the related records."
     },
-    {"max", (PyCFunction)RelatedRecord_max, METH_VARARGS | METH_KEYWORDS,
-     "Maximum of all values of the field in the related records."
+    {(char*)"max", (PyCFunction)RelatedRecord_max, METH_VARARGS | METH_KEYWORDS,
+     (char*)"Maximum of all values of the field in the related records."
     },
     {NULL, 0, 0, 0}  /* Sentinel */
 };
@@ -415,7 +416,7 @@
 static PyTypeObject pyglom_RelatedRecordType = {
     PyObject_HEAD_INIT(NULL)
     0,                         /*ob_size*/
-    "glom.RelatedRecord",             /*tp_name*/
+    (char*)"glom.RelatedRecord",             /*tp_name*/
     sizeof(PyGlomRelatedRecord), /*tp_basicsize*/
     0,                         /*tp_itemsize*/
     (destructor)RelatedRecord_dealloc, /*tp_dealloc*/
@@ -434,7 +435,7 @@
     0,                         /*tp_setattro*/
     0,                         /*tp_as_buffer*/
     Py_TPFLAGS_DEFAULT,        /*tp_flags*/
-    "Glom objects",           /* tp_doc */
+    (char*)"Glom objects",           /* tp_doc */
     0,                  /* tp_traverse */
     0,                   /* tp_clear */
     0,                   /* tp_richcompare */

Modified: trunk/glom/python_embed/glom_python.cc
==============================================================================
--- trunk/glom/python_embed/glom_python.cc	(original)
+++ trunk/glom/python_embed/glom_python.cc	Wed Feb 20 14:39:10 2008
@@ -87,14 +87,14 @@
     std::cerr << "traceback = 0" << std::endl;
   }
 
-  PyObject *tracebackModule = PyImport_ImportModule("traceback");
+  PyObject *tracebackModule = PyImport_ImportModule((char*)"traceback");
   gchar* chrRetval = 0;
   if (tracebackModule != NULL)
   {
       PyObject* tbList = PyObject_CallMethod(
           tracebackModule,
-          "format_exception",
-          "OOO",
+          (char*)"format_exception",
+          (char*)"OOO",
           type,
           value == NULL ? Py_None : value,
           traceback == NULL ? Py_None : traceback);
@@ -106,8 +106,8 @@
       }
 
       PyObject* emptyString = PyString_FromString("");
-      PyObject* strRetval = PyObject_CallMethod(emptyString, "join",
-            "O", tbList);
+      PyObject* strRetval = PyObject_CallMethod(emptyString, (char*)"join",
+            (char*)"O", tbList);
       if (strRetval)
         chrRetval = g_strdup(PyString_AsString(strRetval));
     
@@ -172,7 +172,7 @@
   func_def = "def " + func_name + "(record):\n  import glom\n  import gda\n" + func_def;
   //We did this in main(): Py_Initialize();
 
-  PyObject* pMain = PyImport_AddModule("__main__");
+  PyObject* pMain = PyImport_AddModule((char*)"__main__");
   PyObject* pDict = PyModule_GetDict(pMain);
 
 
@@ -204,7 +204,7 @@
   }
 
 
-  PyObject* module_glom = PyImport_ImportModule("glom");
+  PyObject* module_glom = PyImport_ImportModule((char*)"glom");
   if(!module_glom)
   {
     g_warning("Could not import python glom module.");
@@ -213,7 +213,7 @@
 
   PyObject* module_glom_dict = PyModule_GetDict(module_glom);
   //This seems to be different to PyGlomRecord_GetPyType() - we can PyObject_Call() this one to instantiate it.
-  PyObject* pyTypeGlomRecord = PyDict_GetItemString(module_glom_dict, "Record"); //TODO: Unref this?
+  PyObject* pyTypeGlomRecord = PyDict_GetItemString(module_glom_dict, (char*)"Record"); //TODO: Unref this?
   if(!pyTypeGlomRecord || !PyType_Check(pyTypeGlomRecord))
   {
     g_warning("Could not get glom.Record from glom_module.");
@@ -221,7 +221,7 @@
   }
 
 
-  PyObject* module_gda = PyImport_ImportModule("gda");
+  PyObject* module_gda = PyImport_ImportModule((char*)"gda");
   if(!module_gda)
   {
     g_warning("Could not import python gda module.");



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