aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAngelo Naselli <anaselli@linux.it>2015-04-29 15:16:53 +0200
committerAngelo Naselli <anaselli@linux.it>2015-04-29 15:16:53 +0200
commit521ffe4048d99419d3941f87248bc1f8dfc0adf9 (patch)
treedb7a0b0328706cb389a6ab88169a55f716febf49 /lib
parent92d7c81bda8496168faf5b7589eb3761a9b9f00c (diff)
downloadmanatools-521ffe4048d99419d3941f87248bc1f8dfc0adf9.tar
manatools-521ffe4048d99419d3941f87248bc1f8dfc0adf9.tar.gz
manatools-521ffe4048d99419d3941f87248bc1f8dfc0adf9.tar.bz2
manatools-521ffe4048d99419d3941f87248bc1f8dfc0adf9.tar.xz
manatools-521ffe4048d99419d3941f87248bc1f8dfc0adf9.zip
Managed button icons from manauser instead of userdrake
Diffstat (limited to 'lib')
-rw-r--r--lib/ManaTools/Module/Users.pm39
1 files changed, 29 insertions, 10 deletions
diff --git a/lib/ManaTools/Module/Users.pm b/lib/ManaTools/Module/Users.pm
index 8376f3e7..276a0930 100644
--- a/lib/ManaTools/Module/Users.pm
+++ b/lib/ManaTools/Module/Users.pm
@@ -87,7 +87,7 @@ use feature 'state';
extends qw( ManaTools::Module );
has '+icon' => (
- default => "/usr/share/icons/userdrake.png",
+ default => File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manauser.png'),
);
@@ -248,7 +248,7 @@ sub BUILD {
my $self = shift;
if (! $self->name) {
- $self->name ($self->loc->N("manauser"));
+ $self->name ($self->loc->N("manauser - Mageia Users Management Tool"));
}
%userEditLabel = (
@@ -1159,7 +1159,7 @@ sub _refreshUsers {
);
# TODO workaround to get first cell at least until we don't
- # a cast from YItem
+ # have a cast from YItem
$item->setLabel( $username );
$itemColl->push($item);
$item->DISOWN();
@@ -2366,8 +2366,6 @@ sub _manageUsersDialog {
return;
}
- ## TODO fix for manatools
- my $pixdir = '/usr/share/userdrake/pixmaps/';
## push application title
my $appTitle = yui::YUI::app()->applicationTitle();
@@ -2419,12 +2417,33 @@ sub _manageUsersDialog {
my $hbox = $factory->createHBox($layout);
$hbox = $factory->createHBox($factory->createLeft($hbox));
+
$self->set_widget(
- add_user => $factory->createIconButton($hbox, $pixdir . 'user_add.png', $self->loc->N("Add User")),
- add_group => $factory->createIconButton($hbox, $pixdir . 'group_add.png', $self->loc->N("Add Group")),
- edit => $factory->createIconButton($hbox, $pixdir . 'user_conf.png', $self->loc->N("Edit")),
- del => $factory->createIconButton($hbox, $pixdir . 'user_del.png', $self->loc->N("Delete")),
- refresh => $factory->createIconButton($hbox, $pixdir . 'refresh.png', $self->loc->N("Refresh")),
+ add_user => $factory->createIconButton(
+ $hbox,
+ File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manauser/user_add.png'),
+ $self->loc->N("Add User")
+ ),
+ add_group => $factory->createIconButton(
+ $hbox,
+ File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manauser/group_add.png'),
+ $self->loc->N("Add Group")
+ ),
+ edit => $factory->createIconButton(
+ $hbox,
+ File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manauser/user_conf.png'),
+ $self->loc->N("Edit")
+ ),
+ del => $factory->createIconButton(
+ $hbox,
+ File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manauser/user_del.png'),
+ $self->loc->N("Delete")
+ ),
+ refresh => $factory->createIconButton(
+ $hbox,
+ File::ShareDir::dist_file(ManaTools::Shared::distName(), 'images/manauser/refresh.png'),
+ $self->loc->N("Refresh")
+ ),
action_menu => $actionMenu,
);
'#n198'>198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
package fs::format; # $Id: format.pm 268842 2010-05-17 06:54:44Z pterjan $

use diagnostics;
use strict;
use String::ShellQuote;

use run_program;
use common;
use fs::type;
use fs::loopback;
use log;

my %cmds = (
    ext2     => [ 'e2fsprogs', 'mkfs.ext2', '-F' ],
    ext3     => [ 'e2fsprogs', 'mkfs.ext3', '-F' ],
    ext4     => [ 'e2fsprogs', 'mkfs.ext4', '-F' ],
    reiserfs => [ 'reiserfsprogs', 'mkfs.reiserfs', '-ff' ],
    reiser4  => [ 'reiser4progs', 'mkfs.reiser4', '-f', '-y' ],
    xfs      => [ 'xfsprogs', 'mkfs.xfs', '-f', '-q' ],
    jfs      => [ 'jfsutils', 'mkfs.jfs', '-f' ],
    hfs      => [ 'hfsutils', 'hformat' ],
    dos      => [ 'dosfstools', 'mkdosfs' ],
    vfat     => [ 'dosfstools', 'mkdosfs', '-F', '32' ],
    swap     => [ 'util-linux-ng', 'mkswap' ],
    ntfs     => [ 'ntfsprogs', 'mkntfs', '--fast' ],
   'ntfs-3g' => [ 'ntfsprogs', 'mkntfs', '--fast' ],
    btrfs    => [ 'btrfs-progs', 'mkfs.btrfs' ],
    nilfs2   => [ 'nilfs-utils', 'mkfs.nilfs2' ],
);

my %LABELs = ( #- option, length, handled_by_mount
    ext2     => [ '-L', 16, 1 ],
    ext3     => [ '-L', 16, 1 ],
    ext4     => [ '-L', 16, 1 ],
    reiserfs => [ '-l', 16, 1 ],
    reiser4  => [ '-L', 16, 1 ],
    xfs      => [ '-L', 12, 1 ],
    jfs      => [ '-L', 16, 1 ],
    hfs      => [ '-l', 27, 0 ],
    dos      => [ '-n', 11, 0 ],
    vfat     => [ '-n', 11, 0 ],
    swap     => [ '-L', 15, 1 ],
    ntfs     => [ '-L', 128, 0 ],
   'ntfs-3g' => [ '-L', 128, 0 ],
    btrfs    => [ '-L', 256, 1 ],
    nilfs2   => [ '-L', 16, 1],
);

my %edit_LABEL = ( # package, command, option
# If option is defined, run <command> <option> <label> <device>
# If no option, run <command> <device> <label>
    ext2     => [ 'e2fsprogs', 'tune2fs', '-L' ],
    ext3     => [ 'e2fsprogs', 'tune2fs', '-L' ],
    ext4     => [ 'e2fsprogs', 'tune2fs', '-L' ],
    reiserfs => [ 'reiserfsprogs', 'reiserfstune', '-l' ],
#    reiser4
    xfs      => [ 'xfsprogs', 'xfs_admin', '-L' ],
    jfs      => [ 'jfsutils', 'jfs_tune', '-L' ],
#    hfs
    dos      => [ 'mtools', 'mlabel', '-i' ],
    vfat     => [ 'mtools', 'mlabel', '-i' ],
#    swap     => [ 'util-linux-ng', 'mkswap' ],
    ntfs     => [ 'ntfsprogs', 'ntfslabel' ],
   'ntfs-3g' => [ 'ntfsprogs', 'ntfslabel' ],
#    btrfs
#    nilfs2
);

sub package_needed_for_partition_type {
    my ($part) = @_;
    my $l = $cmds{$part->{fs_type}} or return;
    $l->[0];
}

sub known_type {
    my ($part) = @_;
    to_bool($cmds{$part->{fs_type}});
}

sub check_package_is_installed_format {
    my ($do_pkgs, $fs_type) = @_;

    my ($pkg, $binary) = @{$cmds{$fs_type} || return};
    whereis_binary($binary) || $do_pkgs->ensure_binary_is_installed($pkg, $binary); #- ensure_binary_is_installed checks binary chrooted, whereas we run the binary non-chrooted (pb for Mageia One)
}

sub check_package_is_installed_label {
    my ($do_pkgs, $fs_type) = @_;

    my ($pkg, $binary) = @{$edit_LABEL{$fs_type} || return};
    whereis_binary($binary) || $do_pkgs->ensure_binary_is_installed($pkg, $binary); #- ensure_binary_is_installed checks binary chrooted, whereas we run the binary non-chrooted (pb for Mageia One)
}

sub canEditLabel {
    my ($part) = @_;
    to_bool($edit_LABEL{$part->{fs_type}});
}

sub part {
    my ($all_hds, $part, $wait_message) = @_;
    if (isRAID($part)) {
	$wait_message->(N("Formatting partition %s", $part->{device})) if $wait_message;
	require raid;
	raid::format_part($all_hds->{raids}, $part);
    } elsif (isLoopback($part)) {
	$wait_message->(N("Creating and formatting file %s", $part->{loopback_file})) if $wait_message;
	fs::loopback::format_part($part);
    } else {
	$wait_message->(N("Formatting partition %s", $part->{device})) if $wait_message;
	part_raw($part, $wait_message);
    }
}

sub write_label {
    my ($part) = @_;

    $part->{device_LABEL_changed} or return;
    maybeFormatted($part) or return;

    if ($part->{encrypt_key}) {
	fs::mount::set_loop($part);
    }

    my $dev = $part->{real_device} || $part->{device};
    my ($_pkg, $cmd, @first_options) = @{$edit_LABEL{$part->{fs_type}} || die N("I do not know how to set label on %s with type %s", $part->{device}, $part->{fs_type})};
    my @args;
    if ($cmd eq 'mlabel') {
      @args = ($cmd, @first_options, devices::make($dev), '::' . $part->{device_LABEL});
    } elsif (defined $first_options[0]) {