Changeset 2051
- Timestamp:
- 02/21/10 01:30:04 (5 months ago)
- Files:
-
- 1 modified
-
trunk/src/filesystem/e2_devkit.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/filesystem/e2_devkit.c
r2050 r2051 1 1 /* $Id$ 2 2 3 Copyright (C) 2009 tooar <tooar@emelfm2.net>3 Copyright (C) 2009-2010 tooar <tooar@emelfm2.net> 4 4 5 5 This file is part of emelFM2. … … 48 48 //PATH_ROOT supplied to funcs will be "/org/freedesktop/UDisks/devices/" 49 49 50 // subset of available device-properties50 //device-properties that are useful here, a subset of all available properties 51 51 typedef struct _DeviceProperties 52 52 { … … 75 75 // gboolean drive_requires_eject; not application-controllable ? 76 76 gboolean optical_disc_is_blank; 77 gboolean ignored; //flag for device not relevant, not a devkit property 77 78 gboolean ignored; //flag for device not relevant, not a daemon property 78 79 } DeviceProperties; 79 80 … … 113 114 @brief get daemon version 114 115 Queries the DaemonVersion property on @a iface of @a object_path owned by the 115 well-known name @a iface on the D-Bus system message bus.116 well-known-name @a iface on the DBus system message bus. 116 117 @param bus pointer to dbus connection object 117 118 @param iface string like "org.freedesktop.DeviceKit.Disks" … … 124 125 gchar *version; 125 126 DBusGProxy *prop_proxy; 126 GValue value 1= {0};127 GValue value = {0}; 127 128 GError *error; 128 129 … … 147 148 G_TYPE_INVALID, 148 149 G_TYPE_VALUE, 149 &value 1,150 &value, 150 151 G_TYPE_INVALID)) 151 152 { 152 version = g_strdup (g_value_get_string (&value 1));153 g_value_unset (&value 1);153 version = g_strdup (g_value_get_string (&value)); 154 g_value_unset (&value); 154 155 printd (DEBUG,"DaemonVersion property for %s is \"%s\"", object_path, version); 155 156 } … … 181 182 gchar *device_iface; 182 183 DBusGProxy *prop_proxy; 183 GValue value 1= {0};184 GValue value = {0}; 184 185 GError *error; 185 186 GHashTable *hash_table; … … 199 200 memset (props, 0, sizeof(DeviceProperties)); 200 201 error = NULL; 201 // no point in doing async interrogations here202 // since most devices are not relevant, best to do some separate, minimal,202 //No point in doing async interrogations here 203 //Since most devices are not relevant, best to do some separate, minimal, 203 204 //checks before getting full set of device properties 204 205 if (dbus_g_proxy_call (prop_proxy, … … 211 212 G_TYPE_INVALID, 212 213 G_TYPE_VALUE, 213 &value 1,214 &value, 214 215 G_TYPE_INVALID)) 215 216 { 216 if (g_value_get_boolean (&value1)) 217 props->device_is_drive = TRUE; 218 else 219 { 220 g_value_unset (&value1); 217 props->device_is_drive = g_value_get_boolean (&value); 218 if (!props->device_is_drive) 219 { 220 g_value_unset (&value); 221 221 abort: 222 222 g_free (device_iface); … … 229 229 { 230 230 printd (DEBUG,"Failed to get DeviceIsDrive property for %s: %s", 231 device_iface, error->message);231 object_path, error->message); 232 232 g_error_free (error); 233 233 g_free (device_iface); 234 g_object_unref (G_OBJECT(prop_proxy)); 234 235 return FALSE; 235 236 } 236 237 237 g_value_unset (&value 1);238 g_value_unset (&value); 238 239 239 240 if (dbus_g_proxy_call (prop_proxy, … … 246 247 G_TYPE_INVALID, 247 248 G_TYPE_VALUE, 248 &value 1,249 &value, 249 250 G_TYPE_INVALID)) 250 251 { 251 props->device_is_removable = g_value_get_boolean (&value1); 252 g_value_unset (&value1); 252 props->device_is_removable = g_value_get_boolean (&value); 253 253 } 254 254 else 255 255 { 256 256 printd (DEBUG,"Failed to get DeviceIsRemovable property for %s: %s", 257 device_iface, error->message);257 object_path, error->message); 258 258 g_error_free (error); 259 259 g_free (device_iface); 260 g_object_unref (G_OBJECT(prop_proxy)); 260 261 return FALSE; 261 262 } 263 264 g_value_unset (&value); 262 265 263 266 #ifdef DEVKIT_IFACE … … 274 277 G_TYPE_INVALID, 275 278 G_TYPE_VALUE, 276 &value 1,279 &value, 277 280 G_TYPE_INVALID)) 278 281 { 279 props->device_is_detachable = g_value_get_boolean (&value1); 280 g_value_unset (&value1); 282 props->device_is_detachable = g_value_get_boolean (&value); 283 if (props->device_is_detachable) 284 printd (DEBUG,"Device %s is detachable", object_path); 281 285 } 282 286 else 283 287 { 284 288 printd (DEBUG,"Failed to get DriveCanDetach property for %s: %s", 285 device_iface, error->message);289 object_path, error->message); 286 290 g_error_free (error); 287 291 g_free (device_iface); 292 g_object_unref (G_OBJECT(prop_proxy)); 288 293 return FALSE; 289 294 } 295 g_value_unset (&value); 290 296 #ifdef DEVKIT_IFACE 291 297 } … … 379 385 //CHECKME props->ignored = ? 380 386 g_free (device_iface); 381 g_object_unref ( prop_proxy);387 g_object_unref (G_OBJECT(prop_proxy)); 382 388 383 389 return retval;