source: scripts/scripts/untested/gnome-patches/gnome-vfs-2.10.1-hal_0.5.0-1.patch @ 0b402ff

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 0b402ff was 0b402ff, checked in by Jim Gifford <clfs@…>, 15 years ago

r698@server (orig r696): ryan | 2005-11-13 00:00:47 -0800

r704@rei: lfs | 2005-11-13 19:01:08 +1100
Import updates for untested blfs-scripts



  • Property mode set to 100644
File size: 30.3 KB
  • libgnomevfs/gnome-vfs-hal-mounts.c

    Submitted By:            Randy McMurchy <randy_at_linuxfromscratch_dot_org>
    Date:                    2005-04-22
    Initial Package Version: 2.10.1
    Upstream Status:         Already in CVS
    Origin:                  GNOME CVS
    Description:             Port to the new HAL API (hal-0.5.0)
    
    $LastChangedBy: bdubbs $
    $Date: 2005-08-01 13:29:19 -0600 (Mon, 01 Aug 2005) $
    
    diff -Naur gnome-vfs-2.10.1-orig/libgnomevfs/gnome-vfs-hal-mounts.c gnome-vfs-2.10.1/libgnomevfs/gnome-vfs-hal-mounts.c
    old new  
    4949
    5050typedef struct {
    5151        GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
    52         HalStoragePolicy *hal_storage_policy;
     52        LibHalStoragePolicy *hal_storage_policy;
    5353} GnomeVFSHalUserData;
    5454
    55 static void
    56 _hal_mainloop_integration (LibHalContext *ctx,
    57                            DBusConnection * dbus_connection)
    58 {
    59         dbus_connection_setup_with_g_main (dbus_connection, NULL);
    60 }
    61 
    6255static void
    6356_hal_device_added (LibHalContext *hal_ctx,
    6457                   const char *udi)
     
    6659        GnomeVFSHalUserData *hal_userdata;
    6760        GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
    6861       
    69         hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
     62        hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
    7063        volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
    7164
    7265        /* Handle optical discs without data since these are not handled
    7366         * by GNOME VFS
    7467         */
    75         if (hal_device_get_property_bool (hal_ctx, udi, "volume.is_disc")) {
     68        if (libhal_device_get_property_bool (hal_ctx, udi, "volume.is_disc", NULL)) {
    7669                const char *storage_udi;
    7770
    78                 storage_udi = hal_device_get_property_string (hal_ctx, udi, "block.storage_device");
     71                storage_udi = libhal_device_get_property_string (hal_ctx, udi, "block.storage_device", NULL);
    7972                if (storage_udi != NULL) {
    8073                        GnomeVFSDrive *drive;
    8174
     
    9790        GnomeVFSHalUserData *hal_userdata;
    9891        GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
    9992       
    100         hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
     93        hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
    10194        volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
    10295
    10396        drive = _gnome_vfs_volume_monitor_find_drive_by_hal_udi (
     
    122115        }
    123116}
    124117
    125 static void
    126 _hal_device_new_capability (LibHalContext *hal_ctx,
    127                             const char *udi,
    128                             const char *capability)
    129 {
    130         GnomeVFSHalUserData *hal_userdata;
    131         GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
    132        
    133         hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
    134         volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
    135 
    136         /* do nothing */
    137 }
    138 
    139 static void
    140 _hal_device_lost_capability (LibHalContext *hal_ctx,
    141                              const char *udi,
    142                              const char *capability)
    143 {
    144         GnomeVFSHalUserData *hal_userdata;
    145         GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
    146        
    147         hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
    148         volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
    149118
    150         /* do nothing */
    151 }
    152119
    153 static void
    154 _hal_device_property_modified (LibHalContext *hal_ctx,
    155                                const char *udi,
    156                                const char *key,
    157                                dbus_bool_t is_removed,
    158                                dbus_bool_t is_added)
    159 {
    160         GnomeVFSHalUserData *hal_userdata;
    161         GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
    162        
    163         hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
    164         volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
    165 
    166         /* do nothing */
    167 }
    168 
    169 static void
    170 _hal_device_condition (LibHalContext *hal_ctx,
    171                        const char *udi,
    172                        const char *condition_name,
    173                        DBusMessage *message)
    174 {
    175         GnomeVFSHalUserData *hal_userdata;
    176         GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon;
    177        
    178         hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
    179         volume_monitor_daemon = hal_userdata->volume_monitor_daemon;
    180 
    181         /* do nothing */
    182 }
    183 
    184 static LibHalFunctions
    185 hal_functions = { _hal_mainloop_integration,
    186                   _hal_device_added,
    187                   _hal_device_removed,
    188                   _hal_device_new_capability,
    189                   _hal_device_lost_capability,
    190                   _hal_device_property_modified,
    191                   _hal_device_condition };
    192 
    193 static HalStoragePolicyIconPair icon_mapping[] = {
    194         {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK,           "gnome-dev-removable"},
    195         {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IDE,       "gnome-dev-removable"},
    196         {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_SCSI,      "gnome-dev-removable"},
    197         {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_USB,       "gnome-dev-removable-usb"},
    198         {HAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IEEE1394,  "gnome-dev-removable-1394"},
    199         {HAL_STORAGE_ICON_DRIVE_DISK,                     "gnome-dev-removable"},
    200         {HAL_STORAGE_ICON_DRIVE_DISK_IDE,                 "gnome-dev-removable"},
    201         {HAL_STORAGE_ICON_DRIVE_DISK_SCSI,                "gnome-dev-removable"},
    202         {HAL_STORAGE_ICON_DRIVE_DISK_USB,                 "gnome-dev-removable-usb"},
    203         {HAL_STORAGE_ICON_DRIVE_DISK_IEEE1394,            "gnome-dev-removable-1394"},
    204         {HAL_STORAGE_ICON_DRIVE_CDROM,                    "gnome-dev-removable"},
    205         {HAL_STORAGE_ICON_DRIVE_CDROM_IDE,                "gnome-dev-removable"},
    206         {HAL_STORAGE_ICON_DRIVE_CDROM_SCSI,               "gnome-dev-removable"},
    207         {HAL_STORAGE_ICON_DRIVE_CDROM_USB,                "gnome-dev-removable-usb"},
    208         {HAL_STORAGE_ICON_DRIVE_CDROM_IEEE1394,           "gnome-dev-removable-1394"},
    209         {HAL_STORAGE_ICON_DRIVE_FLOPPY,                   "gnome-dev-removable"},
    210         {HAL_STORAGE_ICON_DRIVE_FLOPPY_IDE,               "gnome-dev-removable"},
    211         {HAL_STORAGE_ICON_DRIVE_FLOPPY_SCSI,              "gnome-dev-removable"},
    212         {HAL_STORAGE_ICON_DRIVE_FLOPPY_USB,               "gnome-dev-removable-usb"},
    213         {HAL_STORAGE_ICON_DRIVE_FLOPPY_IEEE1394,          "gnome-dev-removable-1394"},
    214         {HAL_STORAGE_ICON_DRIVE_TAPE,                     "gnome-dev-removable"},
    215         {HAL_STORAGE_ICON_DRIVE_COMPACT_FLASH,            "gnome-dev-removable"},
    216         {HAL_STORAGE_ICON_DRIVE_MEMORY_STICK,             "gnome-dev-removable"},
    217         {HAL_STORAGE_ICON_DRIVE_SMART_MEDIA,              "gnome-dev-removable"},
    218         {HAL_STORAGE_ICON_DRIVE_SD_MMC,                   "gnome-dev-removable"},
    219         {HAL_STORAGE_ICON_DRIVE_CAMERA,                   "gnome-dev-removable"},
    220         {HAL_STORAGE_ICON_DRIVE_PORTABLE_AUDIO_PLAYER,    "gnome-dev-removable"},
    221 
    222         {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK,          "gnome-dev-harddisk"},
    223         {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IDE,      "gnome-dev-harddisk"},
    224         {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_SCSI,     "gnome-dev-harddisk"},
    225         {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_USB,      "gnome-dev-harddisk-usb"},
    226         {HAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IEEE1394, "gnome-dev-harddisk-1394"},
    227         {HAL_STORAGE_ICON_VOLUME_DISK,                    "gnome-dev-harddisk"},
    228         {HAL_STORAGE_ICON_VOLUME_DISK_IDE,                "gnome-dev-harddisk"},
    229         {HAL_STORAGE_ICON_VOLUME_DISK_SCSI,               "gnome-dev-harddisk"},
    230         {HAL_STORAGE_ICON_VOLUME_DISK_USB,                "gnome-dev-harddisk-usb"},
    231         {HAL_STORAGE_ICON_VOLUME_DISK_IEEE1394,           "gnome-dev-harddisk-1394"},
    232         {HAL_STORAGE_ICON_VOLUME_CDROM,                   "gnome-dev-cdrom"},
    233         {HAL_STORAGE_ICON_VOLUME_CDROM_IDE,               "gnome-dev-cdrom"},
    234         {HAL_STORAGE_ICON_VOLUME_CDROM_SCSI,              "gnome-dev-cdrom"},
    235         {HAL_STORAGE_ICON_VOLUME_CDROM_USB,               "gnome-dev-cdrom"},
    236         {HAL_STORAGE_ICON_VOLUME_CDROM_IEEE1394,          "gnome-dev-cdrom"},
    237         {HAL_STORAGE_ICON_VOLUME_FLOPPY,                  "gnome-dev-floppy"},
    238         {HAL_STORAGE_ICON_VOLUME_FLOPPY_IDE,              "gnome-dev-floppy"},
    239         {HAL_STORAGE_ICON_VOLUME_FLOPPY_SCSI,             "gnome-dev-floppy"},
    240         {HAL_STORAGE_ICON_VOLUME_FLOPPY_USB,              "gnome-dev-floppy"},
    241         {HAL_STORAGE_ICON_VOLUME_FLOPPY_IEEE1394,         "gnome-dev-floppy"},
    242         {HAL_STORAGE_ICON_VOLUME_TAPE,                    "gnome-dev-harddisk"},
    243         {HAL_STORAGE_ICON_VOLUME_COMPACT_FLASH,           "gnome-dev-media-cf"},
    244         {HAL_STORAGE_ICON_VOLUME_MEMORY_STICK,            "gnome-dev-media-ms"},
    245         {HAL_STORAGE_ICON_VOLUME_SMART_MEDIA,             "gnome-dev-media-sm"},
    246         {HAL_STORAGE_ICON_VOLUME_SD_MMC,                  "gnome-dev-media-sdmmc"},
    247         {HAL_STORAGE_ICON_VOLUME_CAMERA,                  "camera"},
    248         {HAL_STORAGE_ICON_VOLUME_PORTABLE_AUDIO_PLAYER,   "gnome-dev-ipod"},
    249 
    250         {HAL_STORAGE_ICON_DISC_CDROM,                     "gnome-dev-cdrom"},
    251         {HAL_STORAGE_ICON_DISC_CDR,                       "gnome-dev-cdrom"},
    252         {HAL_STORAGE_ICON_DISC_CDRW,                      "gnome-dev-cdrom"},
    253         {HAL_STORAGE_ICON_DISC_DVDROM,                    "gnome-dev-dvd"},
    254         {HAL_STORAGE_ICON_DISC_DVDRAM,                    "gnome-dev-dvd"},
    255         {HAL_STORAGE_ICON_DISC_DVDR,                      "gnome-dev-dvd"},
    256         {HAL_STORAGE_ICON_DISC_DVDRW,                     "gnome-dev-dvd"},
    257         {HAL_STORAGE_ICON_DISC_DVDPLUSR,                  "gnome-dev-dvd"},
    258         {HAL_STORAGE_ICON_DISC_DVDPLUSRW,                 "gnome-dev-dvd"},
     120static LibHalStoragePolicyIconPair icon_mapping[] = {
     121        {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK,           "gnome-dev-removable"},
     122        {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IDE,       "gnome-dev-removable"},
     123        {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_SCSI,      "gnome-dev-removable"},
     124        {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_USB,       "gnome-dev-removable-usb"},
     125        {LIBHAL_STORAGE_ICON_DRIVE_REMOVABLE_DISK_IEEE1394,  "gnome-dev-removable-1394"},
     126        {LIBHAL_STORAGE_ICON_DRIVE_DISK,                     "gnome-dev-removable"},
     127        {LIBHAL_STORAGE_ICON_DRIVE_DISK_IDE,                 "gnome-dev-removable"},
     128        {LIBHAL_STORAGE_ICON_DRIVE_DISK_SCSI,                "gnome-dev-removable"},
     129        {LIBHAL_STORAGE_ICON_DRIVE_DISK_USB,                 "gnome-dev-removable-usb"},
     130        {LIBHAL_STORAGE_ICON_DRIVE_DISK_IEEE1394,            "gnome-dev-removable-1394"},
     131        {LIBHAL_STORAGE_ICON_DRIVE_CDROM,                    "gnome-dev-removable"},
     132        {LIBHAL_STORAGE_ICON_DRIVE_CDROM_IDE,                "gnome-dev-removable"},
     133        {LIBHAL_STORAGE_ICON_DRIVE_CDROM_SCSI,               "gnome-dev-removable"},
     134        {LIBHAL_STORAGE_ICON_DRIVE_CDROM_USB,                "gnome-dev-removable-usb"},
     135        {LIBHAL_STORAGE_ICON_DRIVE_CDROM_IEEE1394,           "gnome-dev-removable-1394"},
     136        {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY,                   "gnome-dev-removable"},
     137        {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_IDE,               "gnome-dev-removable"},
     138        {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_SCSI,              "gnome-dev-removable"},
     139        {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_USB,               "gnome-dev-removable-usb"},
     140        {LIBHAL_STORAGE_ICON_DRIVE_FLOPPY_IEEE1394,          "gnome-dev-removable-1394"},
     141        {LIBHAL_STORAGE_ICON_DRIVE_TAPE,                     "gnome-dev-removable"},
     142        {LIBHAL_STORAGE_ICON_DRIVE_COMPACT_FLASH,            "gnome-dev-removable"},
     143        {LIBHAL_STORAGE_ICON_DRIVE_MEMORY_STICK,             "gnome-dev-removable"},
     144        {LIBHAL_STORAGE_ICON_DRIVE_SMART_MEDIA,              "gnome-dev-removable"},
     145        {LIBHAL_STORAGE_ICON_DRIVE_SD_MMC,                   "gnome-dev-removable"},
     146        {LIBHAL_STORAGE_ICON_DRIVE_CAMERA,                   "gnome-dev-removable"},
     147        {LIBHAL_STORAGE_ICON_DRIVE_PORTABLE_AUDIO_PLAYER,    "gnome-dev-removable"},
     148        {LIBHAL_STORAGE_ICON_DRIVE_ZIP,                      "gnome-dev-removable"},
     149        {LIBHAL_STORAGE_ICON_DRIVE_JAZ,                      "gnome-dev-removable"},
     150        {LIBHAL_STORAGE_ICON_DRIVE_FLASH_KEY,                "gnome-dev-removable"},
     151
     152        {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK,          "gnome-dev-harddisk"},
     153        {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IDE,      "gnome-dev-harddisk"},
     154        {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_SCSI,     "gnome-dev-harddisk"},
     155        {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_USB,      "gnome-dev-harddisk-usb"},
     156        {LIBHAL_STORAGE_ICON_VOLUME_REMOVABLE_DISK_IEEE1394, "gnome-dev-harddisk-1394"},
     157        {LIBHAL_STORAGE_ICON_VOLUME_DISK,                    "gnome-dev-harddisk"},
     158        {LIBHAL_STORAGE_ICON_VOLUME_DISK_IDE,                "gnome-dev-harddisk"},
     159        {LIBHAL_STORAGE_ICON_VOLUME_DISK_SCSI,               "gnome-dev-harddisk"},
     160        {LIBHAL_STORAGE_ICON_VOLUME_DISK_USB,                "gnome-dev-harddisk-usb"},
     161        {LIBHAL_STORAGE_ICON_VOLUME_DISK_IEEE1394,           "gnome-dev-harddisk-1394"},
     162        {LIBHAL_STORAGE_ICON_VOLUME_CDROM,                   "gnome-dev-cdrom"},
     163        {LIBHAL_STORAGE_ICON_VOLUME_CDROM_IDE,               "gnome-dev-cdrom"},
     164        {LIBHAL_STORAGE_ICON_VOLUME_CDROM_SCSI,              "gnome-dev-cdrom"},
     165        {LIBHAL_STORAGE_ICON_VOLUME_CDROM_USB,               "gnome-dev-cdrom"},
     166        {LIBHAL_STORAGE_ICON_VOLUME_CDROM_IEEE1394,          "gnome-dev-cdrom"},
     167        {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY,                  "gnome-dev-floppy"},
     168        {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_IDE,              "gnome-dev-floppy"},
     169        {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_SCSI,             "gnome-dev-floppy"},
     170        {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_USB,              "gnome-dev-floppy"},
     171        {LIBHAL_STORAGE_ICON_VOLUME_FLOPPY_IEEE1394,         "gnome-dev-floppy"},
     172        {LIBHAL_STORAGE_ICON_VOLUME_TAPE,                    "gnome-dev-harddisk"},
     173        {LIBHAL_STORAGE_ICON_VOLUME_COMPACT_FLASH,           "gnome-dev-media-cf"},
     174        {LIBHAL_STORAGE_ICON_VOLUME_MEMORY_STICK,            "gnome-dev-media-ms"},
     175        {LIBHAL_STORAGE_ICON_VOLUME_SMART_MEDIA,             "gnome-dev-media-sm"},
     176        {LIBHAL_STORAGE_ICON_VOLUME_SD_MMC,                  "gnome-dev-media-sdmmc"},
     177        {LIBHAL_STORAGE_ICON_VOLUME_CAMERA,                  "camera"},
     178        {LIBHAL_STORAGE_ICON_VOLUME_PORTABLE_AUDIO_PLAYER,   "gnome-dev-ipod"},
     179        {LIBHAL_STORAGE_ICON_VOLUME_ZIP,                     "gnome-dev-zipdisk"},
     180        {LIBHAL_STORAGE_ICON_VOLUME_JAZ,                     "gnome-dev-jazdisk"},
     181        {LIBHAL_STORAGE_ICON_VOLUME_FLASH_KEY,               "gnome-dev-harddisk"},
    259182
    260183/*
    261         {HAL_STORAGE_ICON_DISC_CDROM,                     "gnome-dev-disc-cdrom"},
    262         {HAL_STORAGE_ICON_DISC_CDR,                       "gnome-dev-disc-cdr"},
    263         {HAL_STORAGE_ICON_DISC_CDRW,                      "gnome-dev-disc-cdrw"},
    264         {HAL_STORAGE_ICON_DISC_DVDROM,                    "gnome-dev-disc-dvdrom"},
    265         {HAL_STORAGE_ICON_DISC_DVDRAM,                    "gnome-dev-disc-dvdram"},
    266         {HAL_STORAGE_ICON_DISC_DVDR,                      "gnome-dev-disc-dvdr"},
    267         {HAL_STORAGE_ICON_DISC_DVDRW,                     "gnome-dev-disc-dvdrw"},
    268         {HAL_STORAGE_ICON_DISC_DVDPLUSR,                  "gnome-dev-disc-dvdr-plus"},
    269         {HAL_STORAGE_ICON_DISC_DVDPLUSRW,                 "gnome-dev-disc-dvdrw-plus"},
     184        {LIBHAL_STORAGE_ICON_DISC_CDROM,                     "gnome-dev-cdrom"},
     185        {LIBHAL_STORAGE_ICON_DISC_CDR,                       "gnome-dev-cdrom"},
     186        {LIBHAL_STORAGE_ICON_DISC_CDRW,                      "gnome-dev-cdrom"},
     187        {LIBHAL_STORAGE_ICON_DISC_DVDROM,                    "gnome-dev-dvd"},
     188        {LIBHAL_STORAGE_ICON_DISC_DVDRAM,                    "gnome-dev-dvd"},
     189        {LIBHAL_STORAGE_ICON_DISC_DVDR,                      "gnome-dev-dvd"},
     190        {LIBHAL_STORAGE_ICON_DISC_DVDRW,                     "gnome-dev-dvd"},
     191        {LIBHAL_STORAGE_ICON_DISC_DVDPLUSR,                  "gnome-dev-dvd"},
     192        {LIBHAL_STORAGE_ICON_DISC_DVDPLUSRW,                 "gnome-dev-dvd"},
    270193*/
    271194
     195        {LIBHAL_STORAGE_ICON_DISC_CDROM,                     "gnome-dev-cdrom"},
     196        {LIBHAL_STORAGE_ICON_DISC_CDR,                       "gnome-dev-disc-cdr"},
     197        {LIBHAL_STORAGE_ICON_DISC_CDRW,                      "gnome-dev-disc-cdrw"},
     198        {LIBHAL_STORAGE_ICON_DISC_DVDROM,                    "gnome-dev-disc-dvdrom"},
     199        {LIBHAL_STORAGE_ICON_DISC_DVDRAM,                    "gnome-dev-disc-dvdram"},
     200        {LIBHAL_STORAGE_ICON_DISC_DVDR,                      "gnome-dev-disc-dvdr"},
     201        {LIBHAL_STORAGE_ICON_DISC_DVDRW,                     "gnome-dev-disc-dvdrw"},
     202        {LIBHAL_STORAGE_ICON_DISC_DVDPLUSR,                  "gnome-dev-disc-dvdr-plus"},
     203        {LIBHAL_STORAGE_ICON_DISC_DVDPLUSRW,                 "gnome-dev-disc-dvdrw"}, /* missing -plus icon here! */
     204
    272205        {0x00, NULL}
    273206};
    274207
     
    276209gboolean
    277210_gnome_vfs_hal_mounts_init (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
    278211{
     212        DBusError error;
     213        DBusConnection *dbus_connection;
    279214        GnomeVFSHalUserData *hal_userdata;
    280         HalStoragePolicy *hal_storage_policy;
     215        LibHalStoragePolicy *hal_storage_policy;
    281216
    282217        /* Initialise the connection to the hal daemon */
    283218        if ((volume_monitor_daemon->hal_ctx =
    284              hal_initialize (&hal_functions, FALSE)) == NULL) {
    285                 g_warning ("hal_initialize failed\n");
     219             libhal_ctx_new ()) == NULL) {
     220                g_warning ("libhal_ctx_new failed\n");
     221                return FALSE;
     222        }
     223
     224        dbus_error_init (&error);
     225        dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
     226        if (dbus_error_is_set (&error)) {
     227                g_warning ("Error connecting to D-BUS system bus: %s\n",
     228                           error.message);
     229                dbus_error_free (&error);
     230                return FALSE;
     231        }       
     232        dbus_connection_setup_with_g_main (dbus_connection, NULL);
     233
     234        libhal_ctx_set_dbus_connection (volume_monitor_daemon->hal_ctx,
     235                                        dbus_connection);
     236
     237        libhal_ctx_set_device_added (volume_monitor_daemon->hal_ctx,
     238                                     _hal_device_added);
     239        libhal_ctx_set_device_removed (volume_monitor_daemon->hal_ctx,
     240                                       _hal_device_removed);
     241       
     242        if (!libhal_ctx_init (volume_monitor_daemon->hal_ctx, &error)) {
     243                g_warning ("libhal_ctx_init failed: %s\n", error.message);
     244                dbus_error_free (&error);
    286245                return FALSE;
    287246        }
    288247
    289248
    290249        /* Setup GNOME specific policy - right now this is only icons */
    291         hal_storage_policy = hal_storage_policy_new ();
    292         hal_storage_policy_set_icon_mapping (hal_storage_policy, icon_mapping);
     250        hal_storage_policy = libhal_storage_policy_new ();
     251        libhal_storage_policy_set_icon_mapping (hal_storage_policy, icon_mapping);
    293252
    294253        /* Tie some data with the libhal context */
    295254        hal_userdata = g_new0 (GnomeVFSHalUserData, 1);
    296255        hal_userdata->volume_monitor_daemon = volume_monitor_daemon;
    297256        hal_userdata->hal_storage_policy = hal_storage_policy;
    298         hal_ctx_set_user_data (volume_monitor_daemon->hal_ctx,
     257        libhal_ctx_set_user_data (volume_monitor_daemon->hal_ctx,
    299258                               hal_userdata);
    300259        return TRUE;
    301260}
     
    304263_gnome_vfs_hal_mounts_shutdown (GnomeVFSVolumeMonitorDaemon *volume_monitor_daemon)
    305264{
    306265        GnomeVFSHalUserData *hal_userdata;
     266        DBusError error;
     267
     268        hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (volume_monitor_daemon->hal_ctx);
     269        libhal_storage_policy_free (hal_userdata->hal_storage_policy);
    307270
    308         hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (volume_monitor_daemon->hal_ctx);
    309         hal_storage_policy_free (hal_userdata->hal_storage_policy);
     271        dbus_error_init (&error);
     272        if (!libhal_ctx_shutdown (volume_monitor_daemon->hal_ctx, &error)) {
     273                g_warning ("hal_shutdown failed: %s\n", error.message);
     274                dbus_error_free (&error);
     275                return;
     276        }
    310277
    311         if (hal_shutdown (volume_monitor_daemon->hal_ctx) != 0) {
    312                 g_warning ("hal_shutdown failed\n");
     278        if (!libhal_ctx_free (volume_monitor_daemon->hal_ctx)) {
     279                g_warning ("hal_shutdown failed - unable to free hal context\n");
    313280        }
     281
    314282}
    315283
    316284/**************************************************************************/
     
    330298        char *drive_icon;
    331299        char *unique_drive_name;
    332300        LibHalContext *hal_ctx;
    333         HalDrive *hal_drive;
    334         HalVolume *hal_volume;
     301        LibHalDrive *hal_drive;
     302        LibHalVolume *hal_volume;
    335303        GnomeVFSHalUserData *hal_userdata;
    336         HalStoragePolicy *hal_storage_policy;
     304        LibHalStoragePolicy *hal_storage_policy;
    337305        char *target_mount_point;
    338306
    339307        hal_drive = NULL;
     
    342310        if ((hal_ctx = volume_monitor_daemon->hal_ctx) == NULL)
    343311                goto out;
    344312
    345         hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
     313        hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
    346314        hal_storage_policy = hal_userdata->hal_storage_policy;
    347315
    348316        if (drive == NULL || drive->priv == NULL || drive->priv->device_path == NULL)
     
    352320         * /dev/sda1 etc, however we get the Drive object for the parent if
    353321         * that is the case. This is a feature of libhal-storage.
    354322         */
    355         if ((hal_drive = hal_drive_from_device_file (hal_ctx, drive->priv->device_path)) == NULL) {
     323        if ((hal_drive = libhal_drive_from_device_file (hal_ctx, drive->priv->device_path)) == NULL) {
    356324                g_warning ("%s: no hal drive for device=%s", __FUNCTION__, drive->priv->device_path);
    357325                goto out;
    358326        }
    359327
    360328        /* There may not be a volume object associated, so hal_volume may be NULL */
    361         hal_volume = hal_volume_from_device_file (hal_ctx, drive->priv->device_path);
     329        hal_volume = libhal_volume_from_device_file (hal_ctx, drive->priv->device_path);
    362330
    363331        /* For optical discs, we manually add/remove GnomeVFSVolume optical discs without
    364332         * data (e.g. blank and pure audio) since these don't appear in the mounted filesystems
    365333         * file /etc/mtab
    366334         */
    367335        if (hal_volume != NULL &&
    368             hal_drive_get_type (hal_drive) == HAL_DRIVE_TYPE_CDROM &&
    369             hal_volume_is_disc (hal_volume) && !hal_volume_disc_has_data (hal_volume)) {
     336            libhal_drive_get_type (hal_drive) == LIBHAL_DRIVE_TYPE_CDROM &&
     337            libhal_volume_is_disc (hal_volume) && !libhal_volume_disc_has_data (hal_volume)) {
    370338                GnomeVFSVolume *volume;
    371339                char *volume_name;
    372340                char *volume_icon;
     
    377345                        gnome_vfs_volume_unref (volume);
    378346                } else {
    379347                       
    380                         volume_name = hal_volume_policy_compute_display_name (
     348                        volume_name = libhal_volume_policy_compute_display_name (
    381349                                hal_drive, hal_volume, hal_storage_policy);
    382350
    383351                        /* set icon name; try dedicated icon name first... */
    384                         if (hal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
    385                                 volume_icon = strdup (hal_drive_get_dedicated_icon_volume (hal_drive));
     352                        if (libhal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
     353                                volume_icon = strdup (libhal_drive_get_dedicated_icon_volume (hal_drive));
    386354                        else
    387                                 volume_icon = hal_volume_policy_compute_icon_name (
     355                                volume_icon = libhal_volume_policy_compute_icon_name (
    388356                                        hal_drive, hal_volume, hal_storage_policy);
    389357
    390358                        volume = g_object_new (GNOME_VFS_TYPE_VOLUME, NULL);
    391                         volume->priv->hal_udi = g_strdup (hal_volume_get_udi (hal_volume));
     359                        volume->priv->hal_udi = g_strdup (libhal_volume_get_udi (hal_volume));
    392360                        volume->priv->volume_type = GNOME_VFS_VOLUME_TYPE_MOUNTPOINT;
    393361                       
    394                         if (hal_volume_disc_is_blank (hal_volume)) {
     362                        if (libhal_volume_disc_is_blank (hal_volume)) {
    395363                                /* Blank discs should open the burn:/// location */
    396                                 volume->priv->device_path = g_strdup (hal_volume_get_device_file (hal_volume));
     364                                volume->priv->device_path = g_strdup (libhal_volume_get_device_file (hal_volume));
    397365                                volume->priv->activation_uri = g_strdup ("burn:///");
    398                                 volume->priv->unix_device = makedev (hal_volume_get_device_major (hal_volume),
    399                                                                      hal_volume_get_device_minor (hal_volume));
    400                                 volume->priv->filesystem_type = g_strdup (hal_volume_get_fstype (hal_volume));
    401                         } else if (hal_volume_disc_has_audio (hal_volume)) {
     366                                volume->priv->unix_device = makedev (libhal_volume_get_device_major (hal_volume),
     367                                                                     libhal_volume_get_device_minor (hal_volume));
     368                                volume->priv->filesystem_type = g_strdup (libhal_volume_get_fstype (hal_volume));
     369                        } else if (libhal_volume_disc_has_audio (hal_volume)) {
    402370                                /* Audio discs with data should open the cdda:///dev/cdrom location */
    403                                 volume->priv->device_path = g_strdup (hal_volume_get_device_file (hal_volume));
     371                                volume->priv->device_path = g_strdup (libhal_volume_get_device_file (hal_volume));
    404372                                volume->priv->activation_uri = g_strdup_printf (
    405                                         "cdda://%s", hal_volume_get_device_file (hal_volume));
    406                                 volume->priv->unix_device = makedev (hal_volume_get_device_major (hal_volume),
    407                                                                      hal_volume_get_device_minor (hal_volume));
    408                                 volume->priv->filesystem_type = g_strdup (hal_volume_get_fstype (hal_volume));
     373                                        "cdda://%s", libhal_volume_get_device_file (hal_volume));
     374                                volume->priv->unix_device = makedev (libhal_volume_get_device_major (hal_volume),
     375                                                                     libhal_volume_get_device_minor (hal_volume));
     376                                volume->priv->filesystem_type = g_strdup (libhal_volume_get_fstype (hal_volume));
    409377                        }
    410378                       
    411379                        volume->priv->is_read_only = TRUE;
     
    419387                        volume->priv->is_user_visible = TRUE;
    420388                       
    421389                        volume->priv->drive = drive;
     390
    422391                        _gnome_vfs_drive_add_mounted_volume (drive, volume);
    423392                       
    424393                        _gnome_vfs_volume_monitor_mounted (GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume);
     
    427396                        free (volume_name);
    428397                        free (volume_icon);
    429398                }
    430         } else if (hal_volume == NULL && hal_drive_get_type (hal_drive) == HAL_DRIVE_TYPE_CDROM) {
     399        } else if (hal_volume == NULL && libhal_drive_get_type (hal_drive) == LIBHAL_DRIVE_TYPE_CDROM) {
    431400                GnomeVFSVolume *volume;
    432401
    433402                /* Remove GnomeVFSVolume with same device file */
     
    444413                goto out;
    445414
    446415        /* set whether we need to eject */
    447         drive->priv->must_eject_at_unmount = hal_drive_requires_eject (hal_drive);
     416        drive->priv->must_eject_at_unmount = libhal_drive_requires_eject (hal_drive);
    448417
    449418        /* set display name */
    450         drive_name = hal_drive_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
     419        drive_name = libhal_drive_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
    451420        unique_drive_name = _gnome_vfs_volume_monitor_uniquify_drive_name (
    452421                GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), drive_name);
    453422        if (drive->priv->display_name != NULL)
     
    456425        free (drive_name);
    457426
    458427        /* set icon name; try dedicated icon name first... */
    459         if (hal_drive_get_dedicated_icon_drive (hal_drive) != NULL)
    460                 drive_icon = strdup (hal_drive_get_dedicated_icon_drive (hal_drive));
     428        if (libhal_drive_get_dedicated_icon_drive (hal_drive) != NULL)
     429                drive_icon = strdup (libhal_drive_get_dedicated_icon_drive (hal_drive));
    461430        else
    462                 drive_icon = hal_drive_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
     431                drive_icon = libhal_drive_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
    463432        if (drive->priv->icon != NULL)
    464433                g_free (drive->priv->icon);
    465434        drive->priv->icon = g_strdup (drive_icon);
     
    469438        target_mount_point = NULL;
    470439        if (hal_volume != NULL) {
    471440                const char *str;
    472                 str = hal_volume_get_mount_point (hal_volume);
     441                str = libhal_volume_get_mount_point (hal_volume);
    473442                if (str != NULL)
    474443                        target_mount_point = g_strdup (str);
    475444        }
     
    479448                target_mount_point = gnome_vfs_get_local_path_from_uri (drive->priv->activation_uri);
    480449
    481450        /* if we don't use removable media and the volume shouldn't be visible, then hide the drive */
    482         if(!hal_drive_uses_removable_media (hal_drive) &&
    483            !hal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point))
     451        if(!libhal_drive_uses_removable_media (hal_drive) &&
     452           !libhal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point))
    484453                drive->priv->is_user_visible = FALSE;
    485454
    486455        g_free (target_mount_point);
    487456
    488457        /* set hal udi */
    489         drive->priv->hal_udi = g_strdup (hal_drive_get_udi (hal_drive));
     458        drive->priv->hal_udi = g_strdup (libhal_drive_get_udi (hal_drive));
    490459
    491460out:
    492         hal_volume_free (hal_volume);
    493         hal_drive_free (hal_drive);
     461        libhal_volume_free (hal_volume);
     462        libhal_drive_free (hal_drive);
    494463}
    495464
    496465void
     
    501470        char *volume_icon;
    502471        char *unique_volume_name;
    503472        LibHalContext *hal_ctx;
    504         HalDrive *hal_drive;
    505         HalVolume *hal_volume;
     473        LibHalDrive *hal_drive;
     474        LibHalVolume *hal_volume;
    506475        GnomeVFSHalUserData *hal_userdata;
    507         HalStoragePolicy *hal_storage_policy;
     476        LibHalStoragePolicy *hal_storage_policy;
    508477        char *target_mount_point;
    509478
    510479        hal_volume = NULL;
     
    515484        if (volume == NULL || volume->priv == NULL || volume->priv->device_path == NULL)
    516485                goto out;
    517486
    518         hal_userdata = (GnomeVFSHalUserData *) hal_ctx_get_user_data (hal_ctx);
     487        hal_userdata = (GnomeVFSHalUserData *) libhal_ctx_get_user_data (hal_ctx);
    519488        hal_storage_policy = hal_userdata->hal_storage_policy;
    520489
    521490        /* Now, modify the drive with the hal stuff, unless we've already done so */
     
    526495         * /dev/sda1 etc, however we get the Drive object for the parent if
    527496         * that is the case. This is a feature of libhal-storage.
    528497         */
    529         if ((hal_drive = hal_drive_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
     498        if ((hal_drive = libhal_drive_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
    530499                g_warning ("%s: no hal drive for device=%s", __FUNCTION__, volume->priv->device_path);
    531500                goto out;
    532501        }
    533         if ((hal_volume = hal_volume_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
     502        if ((hal_volume = libhal_volume_from_device_file (hal_ctx, volume->priv->device_path)) == NULL) {
    534503                g_warning ("%s: no hal volume for device=%s", __FUNCTION__, volume->priv->device_path);
    535504                goto out;
    536505        }
    537506
    538507        /* set display name */
    539         volume_name = hal_volume_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
     508        volume_name = libhal_volume_policy_compute_display_name (hal_drive, hal_volume, hal_storage_policy);
    540509        unique_volume_name = _gnome_vfs_volume_monitor_uniquify_volume_name (
    541510                GNOME_VFS_VOLUME_MONITOR (volume_monitor_daemon), volume_name);
    542511        if (volume->priv->display_name != NULL)
     
    545514        free (volume_name);
    546515
    547516        /* set icon name; try dedicated icon name first... */
    548         if (hal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
    549                 volume_icon = strdup (hal_drive_get_dedicated_icon_volume (hal_drive));
     517        if (libhal_drive_get_dedicated_icon_volume (hal_drive) != NULL)
     518                volume_icon = strdup (libhal_drive_get_dedicated_icon_volume (hal_drive));
    550519        else
    551                 volume_icon = hal_volume_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
     520                volume_icon = libhal_volume_policy_compute_icon_name (hal_drive, hal_volume, hal_storage_policy);
    552521        if (volume->priv->icon != NULL)
    553522                g_free (volume->priv->icon);
    554523        volume->priv->icon = g_strdup (volume_icon);
     
    558527        target_mount_point = NULL;
    559528        {
    560529                const char *str;
    561                 str = hal_volume_get_mount_point (hal_volume);
     530                str = libhal_volume_get_mount_point (hal_volume);
    562531                if (str != NULL)
    563532                        target_mount_point = g_strdup (str);
    564533        }
     
    569538
    570539        /* set whether it's visible on the desktop */
    571540        volume->priv->is_user_visible =
    572                 hal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point) &&
    573                 (hal_drive_is_hotpluggable (hal_drive) || hal_drive_uses_removable_media (hal_drive));
     541                libhal_volume_policy_should_be_visible (hal_drive, hal_volume, hal_storage_policy, target_mount_point) &&
     542                (libhal_drive_is_hotpluggable (hal_drive) || libhal_drive_uses_removable_media (hal_drive));
    574543
    575544        g_free (target_mount_point);
    576545
    577546        /* set hal udi */
    578         volume->priv->hal_udi = g_strdup (hal_volume_get_udi (hal_volume));
     547        volume->priv->hal_udi = g_strdup (libhal_volume_get_udi (hal_volume));
    579548out:
    580         hal_drive_free (hal_drive);
    581         hal_volume_free (hal_volume);
     549        libhal_drive_free (hal_drive);
     550        libhal_volume_free (hal_volume);
    582551}
    583552
    584553#endif /* USE_HAL */
Note: See TracBrowser for help on using the repository browser.