Changeset 2051

Show
Ignore:
Timestamp:
02/21/10 01:30:04 (5 months ago)
Author:
tpgww
Message:

cleanups

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/filesystem/e2_devkit.c

    r2050 r2051  
    11/* $Id$ 
    22 
    3 Copyright (C) 2009 tooar <tooar@emelfm2.net> 
     3Copyright (C) 2009-2010 tooar <tooar@emelfm2.net> 
    44 
    55This file is part of emelFM2. 
     
    4848//PATH_ROOT supplied to funcs will be "/org/freedesktop/UDisks/devices/" 
    4949 
    50 //subset of available device-properties 
     50//device-properties that are useful here, a subset of all available properties 
    5151typedef struct _DeviceProperties 
    5252{ 
     
    7575//      gboolean drive_requires_eject; not application-controllable ? 
    7676        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 
    7879} DeviceProperties; 
    7980 
     
    113114@brief get daemon version 
    114115Queries 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. 
     116well-known-name @a iface on the DBus system message bus. 
    116117@param bus pointer to dbus connection object 
    117118@param iface string like "org.freedesktop.DeviceKit.Disks" 
     
    124125        gchar *version; 
    125126        DBusGProxy *prop_proxy; 
    126         GValue value1 = {0}; 
     127        GValue value = {0}; 
    127128        GError *error; 
    128129 
     
    147148                        G_TYPE_INVALID, 
    148149                        G_TYPE_VALUE, 
    149                         &value1, 
     150                        &value, 
    150151                        G_TYPE_INVALID)) 
    151152        { 
    152                 version = g_strdup (g_value_get_string (&value1)); 
    153                 g_value_unset (&value1); 
     153                version = g_strdup (g_value_get_string (&value)); 
     154                g_value_unset (&value); 
    154155                printd (DEBUG,"DaemonVersion property for %s is \"%s\"", object_path, version); 
    155156        } 
     
    181182        gchar *device_iface; 
    182183        DBusGProxy *prop_proxy; 
    183         GValue value1 = {0}; 
     184        GValue value = {0}; 
    184185        GError *error; 
    185186        GHashTable *hash_table; 
     
    199200        memset (props, 0, sizeof(DeviceProperties)); 
    200201        error = NULL; 
    201         //no point in doing async interrogations here 
    202         //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, 
    203204        //checks before getting full set of device properties 
    204205        if (dbus_g_proxy_call (prop_proxy, 
     
    211212                        G_TYPE_INVALID, 
    212213                        G_TYPE_VALUE, 
    213                         &value1, 
     214                        &value, 
    214215                        G_TYPE_INVALID)) 
    215216        { 
    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); 
    221221abort: 
    222222                        g_free (device_iface); 
     
    229229        { 
    230230                printd (DEBUG,"Failed to get DeviceIsDrive property for %s: %s", 
    231                         device_iface, error->message); 
     231                        object_path, error->message); 
    232232                g_error_free (error); 
    233233                g_free (device_iface); 
     234                g_object_unref (G_OBJECT(prop_proxy)); 
    234235                return FALSE; 
    235236        } 
    236237 
    237         g_value_unset (&value1); 
     238        g_value_unset (&value); 
    238239 
    239240        if (dbus_g_proxy_call (prop_proxy, 
     
    246247                        G_TYPE_INVALID, 
    247248                        G_TYPE_VALUE, 
    248                         &value1, 
     249                        &value, 
    249250                        G_TYPE_INVALID)) 
    250251        { 
    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); 
    253253        } 
    254254        else 
    255255        { 
    256256                printd (DEBUG,"Failed to get DeviceIsRemovable property for %s: %s", 
    257                         device_iface, error->message); 
     257                        object_path, error->message); 
    258258                g_error_free (error); 
    259259                g_free (device_iface); 
     260                g_object_unref (G_OBJECT(prop_proxy)); 
    260261                return FALSE; 
    261262        } 
     263 
     264        g_value_unset (&value); 
    262265 
    263266#ifdef DEVKIT_IFACE 
     
    274277                                G_TYPE_INVALID, 
    275278                                G_TYPE_VALUE, 
    276                                 &value1, 
     279                                &value, 
    277280                                G_TYPE_INVALID)) 
    278281                { 
    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); 
    281285                } 
    282286                else 
    283287                { 
    284288                        printd (DEBUG,"Failed to get DriveCanDetach property for %s: %s", 
    285                                 device_iface, error->message); 
     289                                object_path, error->message); 
    286290                        g_error_free (error); 
    287291                        g_free (device_iface); 
     292                        g_object_unref (G_OBJECT(prop_proxy)); 
    288293                        return FALSE; 
    289294                } 
     295                g_value_unset (&value); 
    290296#ifdef DEVKIT_IFACE 
    291297        } 
     
    379385        //CHECKME props->ignored = ? 
    380386        g_free (device_iface); 
    381         g_object_unref (prop_proxy); 
     387        g_object_unref (G_OBJECT(prop_proxy)); 
    382388 
    383389        return retval;