glibmm r495 - in trunk: . gio/src tools/extra_defs_gen



Author: murrayc
Date: Thu Jan 10 10:11:00 2008
New Revision: 495
URL: http://svn.gnome.org/viewvc/glibmm?rev=495&view=rev

Log:
2008-01-10  Murray Cumming  <murrayc murrayc com>

* tools/extra_defs_gen/generate_defs_gio.cc: Added some types used so 
far. There are probably more that should be added here.
* tools/extra_defs_gen/generate_extra_defs.cc: get_properties(): 
Added warnings and a check to avoid a crash when 
g_object_interface_list_properties() returns a NULL paramspec, but a 
non-null properties count, as is happening with GVolume.
* gio/src/gio_signals.defs: Generated this from generate_defs_gio.

Modified:
   trunk/ChangeLog
   trunk/gio/src/gio_signals.defs
   trunk/tools/extra_defs_gen/generate_defs_gio.cc
   trunk/tools/extra_defs_gen/generate_extra_defs.cc

Modified: trunk/gio/src/gio_signals.defs
==============================================================================
--- trunk/gio/src/gio_signals.defs	(original)
+++ trunk/gio/src/gio_signals.defs	Thu Jan 10 10:11:00 2008
@@ -1,4 +1,121 @@
+;; From GAsyncResult
+
+;; From GCancellable
+
+(define-signal cancelled
+  (of-object "GCancellable")
+  (return-type "void")
+  (when "last")
+)
+
 ;; From GDrive
 
+;; From GFile
+
+;; From GFileEnumerator
+
+;; From GFileInfo
+
+;; From GFileIcon
+
+;; From GFileInputStream
+
+;; From GFileOutputStream
+
+;; From GInputStream
+
+;; From GLoadableIcon
+
+;; From GMountOperation
+
+(define-signal ask-password
+  (of-object "GMountOperation")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("const-gchar*" "p0")
+    '("const-gchar*" "p1")
+    '("const-gchar*" "p2")
+    '("GAskPasswordFlags" "p3")
+  )
+)
+
+(define-signal ask-question
+  (of-object "GMountOperation")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("const-gchar*" "p0")
+    '("GStrv*" "p1")
+  )
+)
+
+(define-signal reply
+  (of-object "GMountOperation")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("GMountOperationResult" "p0")
+  )
+)
+
+(define-property username
+  (of-object "GMountOperation")
+  (prop-type "GParamString")
+  (docs "The user name")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property password
+  (of-object "GMountOperation")
+  (prop-type "GParamString")
+  (docs "The password")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property anonymous
+  (of-object "GMountOperation")
+  (prop-type "GParamBoolean")
+  (docs "Whether to use an anonymous user")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property domain
+  (of-object "GMountOperation")
+  (prop-type "GParamString")
+  (docs "The domain of the mount operation")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property password-save
+  (of-object "GMountOperation")
+  (prop-type "GParamEnum")
+  (docs "How passwords should be saved")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property choice
+  (of-object "GMountOperation")
+  (prop-type "GParamInt")
+  (docs "The users choice")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+;; From GSimpleAsyncResult
+
 ;; From GVolume
 
+;; Warning: g_object_interface_list_properties() returned NULL for GVolume
+

Modified: trunk/tools/extra_defs_gen/generate_defs_gio.cc
==============================================================================
--- trunk/tools/extra_defs_gen/generate_defs_gio.cc	(original)
+++ trunk/tools/extra_defs_gen/generate_defs_gio.cc	Thu Jan 10 10:11:00 2008
@@ -25,8 +25,28 @@
 {
   g_type_init ();
 
-//  std::cout << get_defs(G_TYPE_FILE)
-//            << std::endl;
-   
+  std::cout << get_defs(G_TYPE_ASYNC_RESULT)
+            << get_defs(G_TYPE_CANCELLABLE)
+            << get_defs(G_TYPE_DRIVE)
+            << get_defs(G_TYPE_FILE)
+            << get_defs(G_TYPE_FILE_ENUMERATOR)
+            << get_defs(G_TYPE_FILE_INFO)
+            << get_defs(G_TYPE_FILE_ICON)
+//            << get_defs(G_TYPE_FILE_ATTRIBUTE_INFO_LIST)
+//            << get_defs(G_TYPE_FILE_ATTRIBUTE_MATCHER)
+            << get_defs(G_TYPE_FILE_INPUT_STREAM)
+            << get_defs(G_TYPE_FILE_OUTPUT_STREAM)
+
+            << get_defs(G_TYPE_INPUT_STREAM)
+            << get_defs(G_TYPE_LOADABLE_ICON)
+            << get_defs(G_TYPE_MOUNT_OPERATION)
+            << get_defs(G_TYPE_SIMPLE_ASYNC_RESULT)
+
+            //TODO: This causes a g_warning:
+            //GLib-GObject-CRITICAL **: g_param_spec_pool_list: assertion `pool != NULL' failed"
+            << get_defs(G_TYPE_VOLUME)
+
+            << std::endl;
+  
   return 0;
 }

Modified: trunk/tools/extra_defs_gen/generate_extra_defs.cc
==============================================================================
--- trunk/tools/extra_defs_gen/generate_extra_defs.cc	(original)
+++ trunk/tools/extra_defs_gen/generate_extra_defs.cc	Thu Jan 10 10:11:00 2008
@@ -35,14 +35,31 @@
     GObjectClass* pGClass = G_OBJECT_CLASS(g_type_class_ref(gtype));
     ppParamSpec = g_object_class_list_properties (pGClass, &iCount);
     g_type_class_unref(pGClass);
+
+    if(!ppParamSpec)
+    {
+      strResult += ";; Warning: g_object_class_list_properties() returned NULL for " + std::string(g_type_name(gtype)) + "\n";
+    }
   }
   else if (G_TYPE_IS_INTERFACE(gtype))
   {
     gpointer pGInterface = g_type_default_interface_ref(gtype);
-    ppParamSpec = g_object_interface_list_properties(pGInterface, &iCount);
-    g_type_default_interface_unref(pGInterface);
+    if(pGInterface) //We check because this fails for G_TYPE_VOLUME, for some reason.
+    {
+      ppParamSpec = g_object_interface_list_properties(pGInterface, &iCount);
+      g_type_default_interface_unref(pGInterface);
+
+      if(!ppParamSpec)
+      {
+        strResult +=  ";; Warning: g_object_interface_list_properties() returned NULL for " + std::string(g_type_name(gtype)) + "\n";
+      }
+    }
   }
 
+  //This extra check avoids an occasional crash, for instance for GVolume
+  if(!ppParamSpec)
+    iCount = 0;
+
   for(guint i = 0; i < iCount; i++)
   {
     GParamSpec* pParamSpec = ppParamSpec[i];



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