summaryrefslogtreecommitdiffstats
path: root/draksnapshot-applet
diff options
context:
space:
mode:
authortv <tv@99302b65-d5f7-0310-b3dd-f8cd6f4e3d94>2008-09-29 16:33:45 +0000
committertv <tv@99302b65-d5f7-0310-b3dd-f8cd6f4e3d94>2008-09-29 16:33:45 +0000
commit22a09ee966bb5d0c043be047721b03d8673f53fa (patch)
treeb8930ca44d66de8c02709e399355c41e45c7897f /draksnapshot-applet
parentb924be1403c5be6e452e41ec817a9b844262e31b (diff)
downloaddraksnapshot-22a09ee966bb5d0c043be047721b03d8673f53fa.tar
draksnapshot-22a09ee966bb5d0c043be047721b03d8673f53fa.tar.gz
draksnapshot-22a09ee966bb5d0c043be047721b03d8673f53fa.tar.bz2
draksnapshot-22a09ee966bb5d0c043be047721b03d8673f53fa.tar.xz
draksnapshot-22a09ee966bb5d0c043be047721b03d8673f53fa.zip
split Hal code so that it can be reused in configurator
git-svn-id: http://svn.mandriva.com/svn/soft/draksnapshot/trunk@247028 99302b65-d5f7-0310-b3dd-f8cd6f4e3d94
Diffstat (limited to 'draksnapshot-applet')
-rwxr-xr-xdraksnapshot-applet21
1 files changed, 3 insertions, 18 deletions
diff --git a/draksnapshot-applet b/draksnapshot-applet
index 32100f0..e50c042 100755
--- a/draksnapshot-applet
+++ b/draksnapshot-applet
@@ -29,7 +29,7 @@ use interactive;
use common;
use run_program;
use detect_devices;
-use dbus_object;
+use MDV::Snapshot::Hal;
use Gtk2::Pango;
@@ -87,11 +87,8 @@ $icon->signal_connect(activate => \&configure);
$icon->set_from_pixbuf(gtkcreate_pixbuf('draksnapshot'));
-my $hal_dn = 'org.freedesktop.Hal';
-my $hal_manager = "$hal_dn.Manager";
-my $manager_path = '/org/freedesktop/Hal/Manager';
-my $dbus = eval { dbus_object::system_bus() };
+my $dbus = get_system_bus();
my $dbus_error = $@;
@@ -207,20 +204,8 @@ sub configure() {
go2State('config_in_progress');
}
-sub is_proper_device {
- my ($device, $o_is_first_check) = @_;
- my $device_name = $device->QueryCapability('block') && $device->GetProperty('block.device');
- return if !$device_name;
- my $bool = $device->QueryCapability('volume') && !$device->GetProperty('volume.is_disc') &&
- $device->GetProperty('volume.is_mounted');
- return $o_is_first_check ? $bool && $device_name && cat_('/media/.hal-mtab') =~ m!^$device_name\s!sg : $bool;
-}
-
sub firstCheck() {
- my $hal = $dbus->get_service($hal_dn);
- my $manager = $hal->get_object($manager_path, $hal_manager);
-
- my @discs = grep { is_proper_device($_, 1) } map { $hal->get_object($_, "$hal_dn.Device") } @{$manager->GetAllDevices};
+ my @discs = find_removable_volumes($dbus);
go2State(@discs ? 'disk_found' : 'okay');
}