Revert r48365 as requested by Mike.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Apr 2010 19:41:11 +0000 (19:41 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Apr 2010 19:41:11 +0000 (19:41 +0000)
It turns out that the hal stringshare part will break efm without his
other changes, so it must wait the full change that includes udev
work.

Sorry!

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/e_dbus@48366 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/hal/E_Hal.h
src/lib/hal/e_hal_device.c
src/lib/hal/e_hal_manager.c
src/lib/hal/e_hal_util.c

index f18fbba..d41aa48 100644 (file)
@@ -42,7 +42,7 @@ struct E_Hal_String_List_Return
 
 struct E_Hal_Bool_Return
 {
 
 struct E_Hal_Bool_Return
 {
-  Eina_Bool boolean;
+  char boolean;
 };
 
 struct E_Hal_UDI_Return
 };
 
 struct E_Hal_UDI_Return
@@ -118,13 +118,13 @@ extern "C" {
    EAPI DBusPendingCall *e_hal_manager_find_device_by_capability(E_DBus_Connection *conn, const char *capability, E_DBus_Callback_Func cb_func, void *data);
 
 /* utility functions */
    EAPI DBusPendingCall *e_hal_manager_find_device_by_capability(E_DBus_Connection *conn, const char *capability, E_DBus_Callback_Func cb_func, void *data);
 
 /* utility functions */
-   EAPI void                e_hal_property_free(E_Hal_Property *prop);
-   EAPI const char          *e_hal_property_string_get(E_Hal_Properties *properties, const char *key, int *err);
-   EAPI Eina_Bool           e_hal_property_bool_get(E_Hal_Properties *properties, const char *key, int *err);
-   EAPI int                 e_hal_property_int_get(E_Hal_Properties *properties, const char *key, int *err);
-   EAPI dbus_uint64_t       e_hal_property_uint64_get(E_Hal_Properties *properties, const char *key, int *err);
-   EAPI double              e_hal_property_double_get(E_Hal_Properties *properties, const char *key, int *err);
-   EAPI const Eina_List     *e_hal_property_strlist_get(E_Hal_Properties *properties, const char *key, int *err);
+   EAPI void           e_hal_property_free(E_Hal_Property *prop);
+   EAPI char          *e_hal_property_string_get(E_Hal_Properties *properties, const char *key, int *err);
+   EAPI char           e_hal_property_bool_get(E_Hal_Properties *properties, const char *key, int *err);
+   EAPI int            e_hal_property_int_get(E_Hal_Properties *properties, const char *key, int *err);
+   EAPI dbus_uint64_t  e_hal_property_uint64_get(E_Hal_Properties *properties, const char *key, int *err);
+   EAPI double         e_hal_property_double_get(E_Hal_Properties *properties, const char *key, int *err);
+   EAPI Eina_List     *e_hal_property_strlist_get(E_Hal_Properties *properties, const char *key, int *err);
 
 /* (un)mount */
    EAPI DBusPendingCall *e_hal_device_volume_mount(E_DBus_Connection *conn, const char *udi, const char *mount_point, const char *fstype, Eina_List *options, E_DBus_Callback_Func cb_func, void *data);
 
 /* (un)mount */
    EAPI DBusPendingCall *e_hal_device_volume_mount(E_DBus_Connection *conn, const char *udi, const char *mount_point, const char *fstype, Eina_List *options, E_DBus_Callback_Func cb_func, void *data);
index 427df2d..bfb3c4d 100644 (file)
@@ -17,7 +17,6 @@ unmarshal_device_get_property(DBusMessage *msg, DBusError *err)
   E_Hal_Device_Get_Property_Return *ret = NULL;
   DBusMessageIter iter;
   int type;
   E_Hal_Device_Get_Property_Return *ret = NULL;
   DBusMessageIter iter;
   int type;
-  char *tmp;
 
   ret = calloc(1, sizeof(E_Hal_Device_Get_Property_Return));
   if (!ret) 
 
   ret = calloc(1, sizeof(E_Hal_Device_Get_Property_Return));
   if (!ret) 
@@ -30,17 +29,16 @@ unmarshal_device_get_property(DBusMessage *msg, DBusError *err)
   type = dbus_message_iter_get_arg_type(&iter);
   switch(type)
   {
   type = dbus_message_iter_get_arg_type(&iter);
   switch(type)
   {
-    case DBUS_TYPE_STRING:
-      dbus_message_iter_get_basic(&iter, &tmp);
-      ret->val.s = (char*)eina_stringshare_add(tmp);
+    case 's':
+      dbus_message_iter_get_basic(&iter, &(ret->val.s));
       break;
       break;
-    case DBUS_TYPE_INT32:
+    case 'i':
       dbus_message_iter_get_basic(&iter, &(ret->val.i));
       break;
       dbus_message_iter_get_basic(&iter, &(ret->val.i));
       break;
-    case DBUS_TYPE_BOOLEAN:
+    case 'b':
       dbus_message_iter_get_basic(&iter, &(ret->val.b));
       break;
       dbus_message_iter_get_basic(&iter, &(ret->val.b));
       break;
-    case DBUS_TYPE_DOUBLE:
+    case 'd':
       dbus_message_iter_get_basic(&iter, &(ret->val.d));
       break;
   }
       dbus_message_iter_get_basic(&iter, &(ret->val.d));
       break;
   }
@@ -54,14 +52,6 @@ free_device_get_property(void *data)
   E_Hal_Device_Get_Property_Return *ret = data;
 
   if (!ret) return;
   E_Hal_Device_Get_Property_Return *ret = data;
 
   if (!ret) return;
-  if (ret->type == E_HAL_PROPERTY_TYPE_STRLIST)
-    {
-       const char *s;
-       EINA_LIST_FREE(ret->val.strlist, s)
-         eina_stringshare_del(s);
-    }
-  else if (ret->type == E_HAL_PROPERTY_TYPE_STRING)
-    eina_stringshare_del(ret->val.s);
   free(ret);
 }
 
   free(ret);
 }
 
@@ -85,9 +75,7 @@ unmarshal_device_get_all_properties(DBusMessage *msg, DBusError *err)
 {
   E_Hal_Device_Get_All_Properties_Return *ret = NULL;
   DBusMessageIter iter, a_iter, s_iter, v_iter;
 {
   E_Hal_Device_Get_All_Properties_Return *ret = NULL;
   DBusMessageIter iter, a_iter, s_iter, v_iter;
-  char *tmp;
 
 
-  /* a{sv} = array of string+variant */
   if (!dbus_message_has_signature(msg, "a{sv}")) 
   {
     dbus_set_error(err, DBUS_ERROR_INVALID_SIGNATURE, "");
   if (!dbus_message_has_signature(msg, "a{sv}")) 
   {
     dbus_set_error(err, DBUS_ERROR_INVALID_SIGNATURE, "");
@@ -116,28 +104,27 @@ unmarshal_device_get_all_properties(DBusMessage *msg, DBusError *err)
     
     switch(dbus_message_iter_get_arg_type(&v_iter))
     {
     
     switch(dbus_message_iter_get_arg_type(&v_iter))
     {
-      case DBUS_TYPE_STRING:
+      case 's':
         prop->type = E_HAL_PROPERTY_TYPE_STRING;
         prop->type = E_HAL_PROPERTY_TYPE_STRING;
-        dbus_message_iter_get_basic(&v_iter, &tmp);
-        prop->val.s = (char*)eina_stringshare_add(tmp);
+        dbus_message_iter_get_basic(&v_iter, &(prop->val.s));
         break;
         break;
-      case DBUS_TYPE_INT32:
+      case 'i':
         prop->type = E_HAL_PROPERTY_TYPE_INT;
         dbus_message_iter_get_basic(&v_iter, &(prop->val.i));
         break;
         prop->type = E_HAL_PROPERTY_TYPE_INT;
         dbus_message_iter_get_basic(&v_iter, &(prop->val.i));
         break;
-      case DBUS_TYPE_UINT64:
+      case 't':
         prop->type = E_HAL_PROPERTY_TYPE_UINT64;
         dbus_message_iter_get_basic(&v_iter, &(prop->val.u64));
         break;
         prop->type = E_HAL_PROPERTY_TYPE_UINT64;
         dbus_message_iter_get_basic(&v_iter, &(prop->val.u64));
         break;
-      case DBUS_TYPE_BOOLEAN:
+      case 'b':
         prop->type = E_HAL_PROPERTY_TYPE_BOOL;
         dbus_message_iter_get_basic(&v_iter, &(prop->val.b));
         break;
         prop->type = E_HAL_PROPERTY_TYPE_BOOL;
         dbus_message_iter_get_basic(&v_iter, &(prop->val.b));
         break;
-      case DBUS_TYPE_DOUBLE:
+      case 'd':
         prop->type = E_HAL_PROPERTY_TYPE_DOUBLE;
         dbus_message_iter_get_basic(&v_iter, &(prop->val.d));
         break;
         prop->type = E_HAL_PROPERTY_TYPE_DOUBLE;
         dbus_message_iter_get_basic(&v_iter, &(prop->val.d));
         break;
-      case DBUS_TYPE_ARRAY:
+      case 'a':
         prop->type = E_HAL_PROPERTY_TYPE_STRLIST;
         {
           DBusMessageIter list_iter;
         prop->type = E_HAL_PROPERTY_TYPE_STRLIST;
         {
           DBusMessageIter list_iter;
@@ -147,8 +134,7 @@ unmarshal_device_get_all_properties(DBusMessage *msg, DBusError *err)
           {
             char *str;
             dbus_message_iter_get_basic(&list_iter, &str);
           {
             char *str;
             dbus_message_iter_get_basic(&list_iter, &str);
-            tmp = (char*)eina_stringshare_add(str);
-            prop->val.strlist = eina_list_append(prop->val.strlist, tmp);
+            prop->val.strlist = eina_list_append(prop->val.strlist, str);
             dbus_message_iter_next(&list_iter);
           }
         }
             dbus_message_iter_next(&list_iter);
           }
         }
@@ -267,7 +253,7 @@ e_hal_device_volume_mount(E_DBus_Connection *conn, const char *udi, const char *
   dbus_message_iter_init_append(msg, &iter);
   dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &mount_point);
   dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &fstype);
   dbus_message_iter_init_append(msg, &iter);
   dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &mount_point);
   dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &fstype);
-  dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &subiter);
+  dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &subiter);
 
   if (options)
   {
 
   if (options)
   {
@@ -307,7 +293,7 @@ e_hal_device_volume_unmount(E_DBus_Connection *conn, const char *udi, Eina_List
   msg = e_hal_device_volume_call_new(udi, "Unmount");
 
   dbus_message_iter_init_append(msg, &iter);
   msg = e_hal_device_volume_call_new(udi, "Unmount");
 
   dbus_message_iter_init_append(msg, &iter);
-  dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &subiter);
+  dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &subiter);
   if (options)
   {
     const char *opt;
   if (options)
   {
     const char *opt;
@@ -344,7 +330,7 @@ e_hal_device_volume_eject(E_DBus_Connection *conn, const char *udi, Eina_List *o
   msg = e_hal_device_volume_call_new(udi, "Eject");
 
   dbus_message_iter_init_append(msg, &iter);
   msg = e_hal_device_volume_call_new(udi, "Eject");
 
   dbus_message_iter_init_append(msg, &iter);
-  dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &subiter);
+  dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &subiter);
   if (options)
   {
     const char *opt;
   if (options)
   {
     const char *opt;
index 8b48958..935bb99 100644 (file)
@@ -44,11 +44,9 @@ static void
 free_string_list(void *data)
 {
   E_Hal_String_List_Return *ret = data;
 free_string_list(void *data)
 {
   E_Hal_String_List_Return *ret = data;
-  const char *x;
 
   if (!ret) return;
 
   if (!ret) return;
-  EINA_LIST_FREE(ret->strings, x)
-    eina_stringshare_del(x);
+  eina_list_free(ret->strings);
   free(ret);
 }
 
   free(ret);
 }
 
index f664989..a79003e 100644 (file)
@@ -21,20 +21,20 @@ e_hal_property_free(E_Hal_Property *prop)
  * @param key the key of the property to retrieve
  * @param err a pointer to an int, which if supplied, will be set to 0 on success and 1 on an error
  */
  * @param key the key of the property to retrieve
  * @param err a pointer to an int, which if supplied, will be set to 0 on success and 1 on an error
  */
-EAPI const char *
+EAPI char *
 e_hal_property_string_get(E_Hal_Properties *properties, const char *key, int *err)
 {
   E_Hal_Property *prop;
   if (err) *err = 0;
   if (!properties->properties) return NULL;
   prop = eina_hash_find(properties->properties, key);
 e_hal_property_string_get(E_Hal_Properties *properties, const char *key, int *err)
 {
   E_Hal_Property *prop;
   if (err) *err = 0;
   if (!properties->properties) return NULL;
   prop = eina_hash_find(properties->properties, key);
-  if (prop) return prop->val.s;
+  if (prop) return strdup(prop->val.s);
 
   if (err) *err = 1;
   return NULL;
 }
 
 
   if (err) *err = 1;
   return NULL;
 }
 
-EAPI Eina_Bool
+EAPI char
 e_hal_property_bool_get(E_Hal_Properties *properties, const char *key, int *err)
 {
   E_Hal_Property *prop;
 e_hal_property_bool_get(E_Hal_Properties *properties, const char *key, int *err)
 {
   E_Hal_Property *prop;
@@ -86,7 +86,7 @@ e_hal_property_double_get(E_Hal_Properties *properties, const char *key, int *er
   return 0;
 }
 
   return 0;
 }
 
-EAPI const Eina_List *
+EAPI Eina_List *
 e_hal_property_strlist_get(E_Hal_Properties *properties, const char *key, int *err)
 {
   E_Hal_Property *prop;
 e_hal_property_strlist_get(E_Hal_Properties *properties, const char *key, int *err)
 {
   E_Hal_Property *prop;