aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xuserdrake54
1 files changed, 24 insertions, 30 deletions
diff --git a/userdrake b/userdrake
index 1e72e00..4b913fb 100755
--- a/userdrake
+++ b/userdrake
@@ -70,8 +70,8 @@ sub HelpSystem { system("drakhelp Drakxtools-Guide.html/userdrake.html &") };
$us->{wnd} = ugtk2->new(N("Mandrake Linux Users Management Tool") . " " . $us->{VERSION}, center => 1);
gtkset_size_request($us->{wnd}{window}, 660, 460);
$us->{wnd}{rwindow}->signal_connect(delete_event => \&QuitGlobal);
-my $utree_model = Gtk2::ListStore->new(Gtk2::GType->STRING, Gtk2::GType->INT, Gtk2::GType->STRING, Gtk2::GType->STRING, Gtk2::GType->STRING, Gtk2::GType->STRING, Gtk2::GType->STRING );
-my $gtree_model = Gtk2::ListStore->new(Gtk2::GType->STRING, Gtk2::GType->INT, Gtk2::GType->STRING );
+my $utree_model = Gtk2::ListStore->new("Glib::String", "Glib::Int", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String" );
+my $gtree_model = Gtk2::ListStore->new("Glib::String", "Glib::Int", "Glib::String" );
my ($usertree, $grouptree);
$usertree = CreateTree($utree_model); $grouptree = CreateTree($gtree_model);
# slightly verbatimed from control-center
@@ -82,21 +82,23 @@ my %options = (
);
my %buttorcheck;
my ($menu, $factory) = create_factory_menu($us->{wnd}{rwindow},
- ({ path => N("/_File"), type => '<Branch>' },
- { path => N("/_File") . N("/_Refresh"), callback => sub { Refresh($sysfilter, $stringsearch)} },
- { path => N("/_File") . N("/_Quit"), callback => \&QuitGlobal, accelerator => N("<control>Q") },
- { path => N("/_Actions"), type => '<Branch>' },
- { path => N("/_Actions") . N("/_Add User"), callback => \&AddUser },
- { path => N("/_Actions") . N("/Add _Group"), callback => \&AddGroup },
- { path => join('', @{$options{edit}}), callback => \&Edit },
- { path => join('', @{$options{delete}}), callback => \&Delete },
- { path => N("/_Options"), type => '<Branch>' },
- { path => join('', @{$options{filter}}), type => '<CheckItem>',
- callback => sub { $sysfilter = $buttorcheck{filter}->active; Refresh($sysfilter, $stringsearch) } },
- { path => N("/_Help"), type => '<Branch>' },
- { path => N("/_Help").N("/_Help"), callback => \&HelpSystem },
- { path => N("/_Help").N("/_Report Bug"), callback => sub { system("drakhelp https://qa.mandrakesoft.com &") } },
- { path => N("/_Help").N("/_About..."), callback => \&About }
+ ([ N("/_File"), undef, undef, undef, '<Branch>' ],
+ [ N("/_File") . N("/_Refresh"), undef, sub { Refresh($sysfilter, $stringsearch)}, undef, '<Item>' ],
+ [ N("/_File") . N("/_Quit"), N("<control>Q"), \&QuitGlobal, undef, '<Item>' ],
+ [ N("/_Actions"), undef, undef, undef, '<Branch>' ],
+ [ N("/_Actions") . N("/_Add User"), undef, \&AddUser, undef, '<Item>' ],
+ [ N("/_Actions") . N("/Add _Group"), undef, \&AddGroup, undef, '<Item>' ],
+ [ join('', @{$options{edit}}), undef, \&Edit, undef, '<Item>' ],
+ [ join('', @{$options{delete}}), undef, \&Delete, undef, '<Item>' ],
+ [ N("/_Options"), undef, undef, undef, '<Branch>' ],
+ [ join('', @{$options{filter}}), undef, sub {
+ $sysfilter = $buttorcheck{filter}->get_active;
+ Refresh($sysfilter, $stringsearch)
+ }, undef, '<CheckItem>' ],
+ [ N("/_Help"), undef, undef, undef, '<Branch>' ],
+ [ N("/_Help").N("/_Help"), undef, \&HelpSystem, undef, '<Item>' ],
+ [ N("/_Help").N("/_Report Bug"), undef, sub { system("drakhelp https://qa.mandrakesoft.com &"), undef, '<Item>' } ],
+ [ N("/_Help").N("/_About..."), undef, \&About, undef, '<Item>' ]
)
);
%buttorcheck = map {
@@ -113,7 +115,7 @@ my $toolb = Gtk2::Toolbar->new;
my $searchBox = Gtk2::HBox->new(0,5); my $filter;
$searchBox->pack_end(my $fbut = Gtk2::Button->new(N("Apply filter")), 0, 0, 4);
$searchBox->pack_end(gtksignal_connect($filter = Gtk2::Entry->new,
- key_press_event => sub { $_[1]->keyval == Gtk2::Gdk::Event::Key->Sym_Return and Refresh($sysfilter, $filter->get_text()) } ), 0, 0, 4);
+ key_press_event => sub { $_[1]->keyval == 0xFF0D and Refresh($sysfilter, $filter->get_text()) } ), 0, 0, 4);
gtkappend_page(my $nb = Gtk2::Notebook->new, gtkpack(create_scrolled_window($usertree)), gtkshow(Gtk2::Label->new(N("Users"))));
gtkappend_page($nb, gtkpack(create_scrolled_window($grouptree)), gtkshow(Gtk2::Label->new(N("Group Users"))));
$nb->set_show_border(0);
@@ -404,7 +406,6 @@ sub GetNameEntFromIter {
my ($tree, $model, $rank) = @_;
my (undef, $iter) = $tree->get_selection->get_selected;
my $name = $model->get($iter, $rank);
- $iter->free;
$name
}
sub FillUserInfo {
@@ -461,14 +462,12 @@ sub CreateTree {
return unless $iter;
foreach (($tbedit, $tbdel, $buttorcheck{edit}, $buttorcheck{delete})) { $_->set_sensitive(1) };
Edit() if $event->type eq '2button-press';
- $iter->free;
});
$tree->signal_connect(key_press_event => sub {
my (undef, $event) = @_;
my (undef, $iter) = $tree->get_selection->get_selected;
return unless $iter;
- Edit() if ($event->keyval == Gtk2::Gdk::Event::Key->Sym_Return);
- $iter->free;
+ Edit() if ($event->keyval == 0xFF0D);
});
$tree
}
@@ -510,7 +509,7 @@ sub BuildGui {
}
sub Edit {
my $w = ugtk2->new('userdrake', grab => 1);
- my $model = Gtk2::ListStore->new(Gtk2::GType->OBJECT, Gtk2::GType->STRING, Gtk2::GType->INT);
+ my $model = Gtk2::ListStore->new("Gtk2::Gdk::Pixbuf", "Glib::String", "Glib::Int");
my $tree = Gtk2::TreeView->new_with_model($model); my %g; my %u;
my ($groupname, $username, $groupEnt, $userEnt, $members, $times, $min, $max, $warn, $inact, $primgid, $temp);
my @primgroup;
@@ -671,7 +670,6 @@ sub Edit {
$ctx->GroupModify($gEnt);
}
}
- $iter->free;
return 0;
}, undef);
if ($us->{o}->{primgroup}->entry->get_text() eq '') {
@@ -740,7 +738,6 @@ sub Edit {
}
}
}
- $iter->free;
return 0;
}, undef);
if (!$error) {
@@ -774,10 +771,8 @@ sub Edit {
}
$us->{o}->{primgroup}->set_popdown_strings(@primgroup);
}
- $iter->free;
}
}
- $path->free;
}
});
$tree->signal_connect( key_press_event => sub {
@@ -797,7 +792,6 @@ sub Edit {
}
$us->{o}->{primgroup}->set_popdown_strings(@primgroup);
}
- $iter->free;
}
0;
});
@@ -852,13 +846,13 @@ sub NewDialog {
}
sub About {
my $window_about = NewDialog(N("Userdrake"));
- my $tree_model = Gtk2::TreeStore->new(Gtk2::GType->STRING, Gtk2::GType->STRING, Gtk2::GType->STRING);
+ my $tree_model = Gtk2::TreeStore->new("Glib::String", "Glib::String", "Glib::String");
my $list = Gtk2::TreeView->new_with_model($tree_model);
$list->can_focus(0);
each_index { $list->append_column(Gtk2::TreeViewColumn->new_with_attributes(undef, Gtk2::CellRendererText->new, 'text' => $::i)) } 0..2;
$list->set_headers_visible(0);
foreach my $row ([ N("Authors: "), '', '' ], [ '', 'Daouda Lo', '<daouda@mandrakesoft.com>' ], ['', '', '']) {
- $tree_model->append_set(undef, [ map_index { $::i => $_ } @$row ])->free;
+ $tree_model->append_set(undef, [ map_index { $::i => $_ } @$row ]);
}
$list->get_selection()->set_mode('none');
gtkpack_($window_about->vbox,