media:/ shows unnecessary media
Kari Pihkala
kari.pihkala at gmail.com
Tue May 24 14:17:20 CDT 2005
Hi,
yes, it is possible to rename the names using dcop! I wrote a perl
script to do that. Here's how it looks.
The old (on my machine with 3 windows partitions, swap & boot partition):
Floppy Drive
1.0K Media
17G Media
32M Media
4.2G Media
542M Media
8.4G Media
9.7G Media
The new:
Floppy Drive (fd0) (/media/floppy0)
1.0K Media (hda3) (unknown)
17G Media (hda7) (/wind)
32M Media (hda2) (/boot)
4.2G Media (hda1) (/winc)
542M Media (hda6) (swap)
8.4G Media (hda5) (/)
9.7G Media (hda8) (/winf)
What do you think about this? I added the hda-text, since clicking on
a media will open media:/hda location. It looks quite logical to have
it in the name.
However, it starts to look a bit geeky, I don't know if regular users
care to see such technical information. Also, I don't know how
removable media (USB memory, cameras etc.) will look like..
- Kari
Here's the script to do the trick:
#!/usr/bin/perl
sub trim($);
# read fstab
open FSTAB, "/etc/fstab"or die "Can't open /etc/fstab";
%devs = { "dummy", "value" };
while (<FSTAB>) {
if (substr($_, 0, 1) eq "/") {
@fields = split;
$devs{(@fields[0])} = @fields[1];
if (@fields[2] eq "swap") {
$devs{(@fields[0])} = "swap";
}
}
}
close FSTAB;
# run dcop to get all media
open DCOP, "dcop kcookiejar mediamanager fullList |" or die "Can't access DCOP";
$i=1;
$found=0;
# go through lines and rename media using dcop
while (<DCOP>){
$found = $found + 1;
if ($found == 2) {
$devname = trim($_);
}
if ($found == 3) {
$defaultname = trim($_);
}
# got dev line, then rename the media
if ($found > 4 && $_ =~ m/dev/) {
$dev = trim($_);
$newname = " \"".$defaultname." (".$devname.") (".$devs{$dev}.")\"";
if ($devs{$dev} eq "") {
$newname = " \"".$defaultname." (".$devname.") (unknown)\"";
}
system "dcop kcookiejar mediamanager setUserLabel ".$devname.$newname;
}
if ($_ =~ /---/) {
$found = 0;
}
$i++;
}
print "All done!\n";
close DCOP;
# Remove whitespaces
sub trim($)
{
my $string = shift;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
return $string;
}
On 5/23/05, Rajeev J Sebastian <rajeev_jsv at dinamis.com> wrote:
> On Monday 23 May 2005 4:08 pm, Rajeev J Sebastian wrote:
> > The media names can be modified (which are also saved for future
> sessions)
> > via the DCOP interface. A script to do this could be made quite easily. I
> > have asked regarding this same question to the media:/ developers, and I
> > doubt there will be much more intelligence in the basic KDE packages
> I.e., I doubt there will any more intelligence coded into the media:/
> ioslave
> in the near future (but I am not sure of their position atm).
>
> Rajeev J Sebastian
> >
> > On Monday 23 May 2005 6:15 am, Kari Pihkala wrote:
> > > Is it possible to display the name of the mount point? Now, it only
> > > displays the size of the disk. If it would display the mount point
> > > (boot, root, windowsc), it would be much clearer.
> > >
> > > Also, in general, how can we know which issues should be fixed by
> > > Kubuntu distro and which should be reported to KDE?? I bet there are
> > > some things that can be fixed in the distro with some configuration
> > > files (not necessarily this one..).
> > >
> > > - Kari
> > >
> > > On 5/22/05, Donatas G. <ziogelis77 at takas.lt> wrote:
> > > > In my konqueror media:/ view I can see both the realy important
> disks,
> > > > and the unnecessary disks, like the 1kb large „disk" of my second
> > > > extended partition and also the swap.
> > > >
> > > > Is this a bug, and, if I were to report it, which part of KDE is it a
> > > > bug of ?
> > > >
> > > > --
> > > > Donatas Glodenis
> > > > http://dgvirtual.kikilis.evs.lt
> > > >
> > > > --
> > > > kubuntu-devel mailing list
> > > > kubuntu-devel at lists.ubuntu.com
> > > > http://lists.ubuntu.com/mailman/listinfo/kubuntu-devel
>
> --
> kubuntu-devel mailing list
> kubuntu-devel at lists.ubuntu.com
> http://lists.ubuntu.com/mailman/listinfo/kubuntu-devel
>
More information about the kubuntu-devel
mailing list