[Digikam-devel] [PATCH] Remove dependance on libgphoto2 CamList internals

Hans Ulrich Niedermann gp at n-dimensional.de
Sun Jun 12 14:27:29 BST 2005


This patch makes gpiface.cpp use the libgphoto2 CamList type in
the way it was intended to be.

The internals of the CamList type may eventually become private,
and this removes digikam's dependency on those internals.

Index: digikam/utilities/setup/gpiface.cpp
===================================================================
--- digikam/utilities/setup/gpiface.cpp	(revision 424397)
+++ digikam/utilities/setup/gpiface.cpp	(working copy)
@@ -30,36 +30,40 @@
 
 int GPIface::autoDetect(QString& model, QString& port)
 {
-    CameraList camList;
+    CameraList *camList;
     CameraAbilitiesList *abilList;
     GPPortInfoList *infoList;
     const char *camModel_, *camPort_;
     GPContext *context;
 
     context = gp_context_new ();
-
+    gp_list_new (&camList);
+    
     gp_abilities_list_new (&abilList);
     gp_abilities_list_load (abilList, context);
     gp_port_info_list_new (&infoList);
     gp_port_info_list_load (infoList);
     gp_abilities_list_detect (abilList, infoList,
-                              &camList, context);
+                              camList, context);
     gp_abilities_list_free (abilList);
     gp_port_info_list_free (infoList);
 
     gp_context_unref( context );
 
-    int count = gp_list_count (&camList);
+    int count = gp_list_count (camList);
 
     if (count<=0) {
+        gp_list_free (camList);
         return -1;
     }
 
     for (int i = 0; i < count; i++) {
-        gp_list_get_name  (&camList, i, &camModel_);
-        gp_list_get_value (&camList, i, &camPort_);
+        gp_list_get_name  (camList, i, &camModel_);
+        gp_list_get_value (camList, i, &camPort_);
     }
 
+    gp_list_free (camList);
+
     model = camModel_;
     port  = camPort_;
 



More information about the Digikam-devel mailing list