diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2013-11-07 16:57:13 +0100 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2013-11-24 11:00:40 +0100 |
commit | 4a4453328a1a2051307f44e6c1c200625666ba16 (patch) | |
tree | 9fb9eb5089abd561cf1c857e448e3c63fcc4465e /bin/draksambashare | |
parent | 7bf101337af175668274aaae14b6320a5224f480 (diff) | |
download | drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.tar drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.tar.gz drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.tar.bz2 drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.tar.xz drakx-net-4a4453328a1a2051307f44e6c1c200625666ba16.zip |
switch from gtk2 to gtk3
Diffstat (limited to 'bin/draksambashare')
-rwxr-xr-x | bin/draksambashare | 218 |
1 files changed, 109 insertions, 109 deletions
diff --git a/bin/draksambashare b/bin/draksambashare index 0c5f97d..92209f0 100755 --- a/bin/draksambashare +++ b/bin/draksambashare @@ -27,10 +27,10 @@ use standalone; use common; use network::network; use interactive; -use mygtk2 qw(gtknew); -use ugtk2 qw(:ask :wrappers :create :dialogs); -use Gtk2::SimpleList; -use Gtk2::Gdk::Keysyms; +use mygtk3 qw(gtknew); +use ugtk3 qw(:ask :wrappers :create :dialogs); +use Gtk3::SimpleList; +use Gtk3::Gdk::Keysyms; use run_program; # use libconf @@ -53,9 +53,9 @@ my $sambaicon = "/usr/share/mcc/themes/default/diskdrake_samba.png"; my $fileshare_icon = "$icon_path/IC-winacces2-16.png"; my $printershare_icon = "$icon_path/IC-sambaprt-16.png"; my $sambauser_icon = "$icon_path/ic82-users-16.png"; -my $pixbuf_file = Gtk2::Gdk::Pixbuf->new_from_file($fileshare_icon); -my $pixbuf_printer = Gtk2::Gdk::Pixbuf->new_from_file($printershare_icon); -my $pixbuf_user = Gtk2::Gdk::Pixbuf->new_from_file($sambauser_icon); +my $pixbuf_file = Gtk3::Gdk::Pixbuf->new_from_file($fileshare_icon); +my $pixbuf_printer = Gtk3::Gdk::Pixbuf->new_from_file($printershare_icon); +my $pixbuf_user = Gtk3::Gdk::Pixbuf->new_from_file($sambauser_icon); my $printer_list = create_printer_list(); my $share_list = create_share_list(); @@ -63,14 +63,14 @@ my $user_list = create_user_list(); my $display_share = create_display_share(); sub create_user_list() { - my $user_list = Gtk2::SimpleList->new('' => 'pixbuf', + my $user_list = Gtk3::SimpleList->new('' => 'pixbuf', N("User name") => 'text', ); $user_list; } sub create_share_list() { - my $share_list = Gtk2::SimpleList->new('' => 'pixbuf', + my $share_list = Gtk3::SimpleList->new('' => 'pixbuf', N("Share name") => 'text', N("Share directory") => 'text', N("Comment") => 'text', @@ -98,7 +98,7 @@ sub create_share_list() { } sub create_display_share() { - my $display_share = Gtk2::SimpleList->new('' => 'pixbuf', + my $display_share = Gtk3::SimpleList->new('' => 'pixbuf', N("Share name") => 'text', N("Share directory") => 'text', N("Comment") => 'text', @@ -115,7 +115,7 @@ sub create_display_share() { } sub create_printer_list() { - my $printer_list = Gtk2::SimpleList->new('' => 'pixbuf', + my $printer_list = Gtk3::SimpleList->new('' => 'pixbuf', N("Printer name") => 'text', N("Path") => 'text', N("Comment") => 'text', @@ -215,7 +215,7 @@ sub get_items() { } sub quit_all() { - ugtk2->exit; + ugtk3->exit; } sub restart_dialog() { @@ -233,10 +233,10 @@ sub wait_action { undef $w; } -my %size_groups = map { $_ => Gtk2::SizeGroup->new('horizontal') } qw(label widget button); +my %size_groups = map { $_ => Gtk3::SizeGroup->new('horizontal') } qw(label widget button); my $label_and_widgets = sub { my ($label, $widget, $button) = @_; - gtkpack_(Gtk2::HBox->new(0,1), + gtkpack_(Gtk3::HBox->new(0,1), 0, gtkadd_widget($size_groups{label}, $label), 0, gtkadd_widget($size_groups{widget}, $widget), if_($button, 0, gtkadd_widget($size_groups{button}, $button)), @@ -369,22 +369,22 @@ sub printers_section() { sub add_entry() { my ($addshare_name, $addshare_comment, $addshare_dir); - $_ = Gtk2::Entry->new foreach $addshare_name, $addshare_comment, $addshare_dir; - my $button = Gtk2::Button->new(N("Open")); + $_ = Gtk3::Entry->new foreach $addshare_name, $addshare_comment, $addshare_dir; + my $button = Gtk3::Button->new(N("Open")); $button->signal_connect(clicked => sub { show_file_dialog($addshare_dir) }); my $dialog = _create_dialog(N("DrakSamba add entry"), { transient_for => $::main_window, modal => 1 }); local $::main_window = $dialog; gtkpack_($dialog->vbox, - 0, gtkadd(Gtk2::Frame->new(N("Add a share")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 3), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkadd(Gtk3::Frame->new(N("Add a share")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 3), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Name of the share:"), $addshare_name, ""), 0, $label_and_widgets->(N("Comment:"), $addshare_comment, ""), 0, $label_and_widgets->(N("Directory:"), $addshare_dir, $button), ), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, create_okcancel({ cancel_clicked => sub { $dialog->destroy }, ok_clicked => sub { @@ -545,9 +545,9 @@ sub modify_printers_entry { my ($selected) = @_; my ($dir, $comment, $print_command, $guest_ok, $share_name, $browseable, $printable, $write_list, $printing, $lpq_command, $create_mode, $writable, $use_client_driver, $inherit_permissions); - $share_name = Gtk2::Label->new; - $_ = Gtk2::Entry->new foreach $dir, $comment, $print_command, $write_list, $printing, $lpq_command, $create_mode; - $_ = Gtk2::OptionMenu->new foreach $browseable, $printable, $guest_ok, $writable, $use_client_driver, $inherit_permissions; + $share_name = Gtk3::Label->new; + $_ = Gtk3::Entry->new foreach $dir, $comment, $print_command, $write_list, $printing, $lpq_command, $create_mode; + $_ = Gtk3::OptionMenu->new foreach $browseable, $printable, $guest_ok, $writable, $use_client_driver, $inherit_permissions; $_->set_popdown_strings(@yesno) foreach $browseable, $printable, $guest_ok, $writable, $use_client_driver, $inherit_permissions; @@ -567,7 +567,7 @@ sub modify_printers_entry { $create_mode->set_text($printer_list->{data}[$selected][13]); $use_client_driver->set_text($printer_list->{data}[$selected][14]); - my $button = Gtk2::Button->new(N("Open")); + my $button = Gtk3::Button->new(N("Open")); $button->signal_connect(clicked => sub { show_file_dialog($dir) }); my $dialog = _create_dialog(N("DrakSamba Printers entry"), { transient_for => $::main_window, modal => 1 }); @@ -583,34 +583,34 @@ sub modify_printers_entry { } gtkpack_($dialog->vbox, - 0, gtkadd(Gtk2::Frame->new(N("Printer share")), - gtkpack_(gtkset_border_width(Gtk2::HBox->new, 3), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkadd(Gtk3::Frame->new(N("Printer share")), + gtkpack_(gtkset_border_width(Gtk3::HBox->new, 3), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Printer name:"), $share_name, ""), 0, $label_and_widgets->(N("Comment:"), $comment, ""), 0, $label_and_widgets->(N("Directory:"), $dir, $button), ), - 0, Gtk2::VSeparator->new, - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, Gtk3::VSeparator->new, + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Writable:"), $writable, ""), 0, $label_and_widgets->(N("Browseable:"), $browseable, ""), 0, $label_and_widgets->(N("Printable"), $printable, ""), ), ), ), - 0, gtkadd(Gtk2::Frame->new(N("Advanced options")), - gtkpack_(gtkset_border_width(Gtk2::HBox->new, 3), - 0, gtkadd(Gtk2::Frame->new(N("Printer access")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkadd(Gtk3::Frame->new(N("Advanced options")), + gtkpack_(gtkset_border_width(Gtk3::HBox->new, 3), + 0, gtkadd(Gtk3::Frame->new(N("Printer access")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Write list"), $write_list, ""), 0, $label_and_widgets->(N("Inherit permissions"), $inherit_permissions, ""), 0, $label_and_widgets->(N("Guest ok:"), $guest_ok, ""), 0, $label_and_widgets->(N("Create mode:"), $create_mode, ""), ), ), - 0, Gtk2::VSeparator->new, - 0, gtkadd(Gtk2::Frame->new(N("Printer command")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, Gtk3::VSeparator->new, + 0, gtkadd(Gtk3::Frame->new(N("Printer command")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->(N("Print command:"), $print_command, ""), 0, $label_and_widgets->(N("LPQ command:"), $lpq_command, ""), 0, $label_and_widgets->(N("Printing:"), $printing, ""), @@ -679,18 +679,18 @@ sub modify_entry { my ($selected) = @_; my ($dir, $comment, $create_mask, $directory_mask, $read_list, $write_list, $admin_users, $valid_users, $force_group, $browseable, $public, $writable, $hide_files, $hide_dot_files, $force_create_mode, $preserve_case, $default_case, $inherit_permissions, $share_name); - $share_name = Gtk2::Label->new; - $_ = Gtk2::Entry->new foreach $dir, $comment, $create_mask, $directory_mask, $hide_files; - $_ = Gtk2::Entry->new foreach $read_list, $write_list, $admin_users, $valid_users, $force_group, $force_create_mode; - $_ = Gtk2::OptionMenu->new foreach $browseable, $public, $writable, $default_case, $preserve_case, $hide_dot_files, $inherit_permissions; + $share_name = Gtk3::Label->new; + $_ = Gtk3::Entry->new foreach $dir, $comment, $create_mask, $directory_mask, $hide_files; + $_ = Gtk3::Entry->new foreach $read_list, $write_list, $admin_users, $valid_users, $force_group, $force_create_mode; + $_ = Gtk3::OptionMenu->new foreach $browseable, $public, $writable, $default_case, $preserve_case, $hide_dot_files, $inherit_permissions; $default_case->set_popdown_strings(@default_case); $_->set_popdown_strings(@yesno) foreach $browseable, $public, $writable, $hide_dot_files, $preserve_case, $inherit_permissions; - my $button = Gtk2::Button->new(N("Open")); + my $button = Gtk3::Button->new(N("Open")); $button->signal_connect(clicked => sub { show_file_dialog($dir) }); - my $w = ugtk2->new(N("DrakSamba entry")); + my $w = ugtk3->new(N("DrakSamba entry")); $w->{window}->set_modal(1); $w->{window}->set_position('center'); @@ -716,18 +716,18 @@ sub modify_entry { $force_group->set_text($share_list->{data}[$selected][18]); $default_case->set_text($share_list->{data}[$selected][19]); - my $expander_user = Gtk2::Expander->new(N("User options (user access, mask option, force mode)")); - $expander_user->add(gtkpack_(Gtk2::HBox->new, - 0, gtkadd(Gtk2::Frame->new(N("Samba user access")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + my $expander_user = Gtk3::Expander->new(N("User options (user access, mask option, force mode)")); + $expander_user->add(gtkpack_(Gtk3::HBox->new, + 0, gtkadd(Gtk3::Frame->new(N("Samba user access")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->($adv_options{read_list}, $read_list, ""), 0, $label_and_widgets->($adv_options{write_list}, $write_list, ""), 0, $label_and_widgets->($adv_options{admin_users}, $admin_users, ""), 0, $label_and_widgets->($adv_options{valid_users}, $valid_users, ""), ), ), - 0, gtkadd(Gtk2::Frame->new(N("Mask options")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + 0, gtkadd(Gtk3::Frame->new(N("Mask options")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $label_and_widgets->($adv_options{create_mask}, $create_mask, ""), 0, $label_and_widgets->($adv_options{directory_mask}, $directory_mask, ""), 0, $label_and_widgets->($adv_options{force_group}, $force_group, ""), @@ -738,16 +738,16 @@ sub modify_entry { ), ); - my $expander_file = Gtk2::Expander->new(N("File options (hide files, case)")); - $expander_file->add(gtkpack_(Gtk2::VBox->new, - 0, gtkadd(Gtk2::Frame->new(N("Display options")), - gtkpack_(gtkset_border_width(Gtk2::HBox->new, 1), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + my $expander_file = Gtk3::Expander->new(N("File options (hide files, case)")); + $expander_file->add(gtkpack_(Gtk3::VBox->new, + 0, gtkadd(Gtk3::Frame->new(N("Display options")), + gtkpack_(gtkset_border_width(Gtk3::HBox->new, 1), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, $label_and_widgets->($adv_options{hide_dot_files}, $hide_dot_files, ""), 0, $label_and_widgets->($adv_options{hide_files}, $hide_files, ""), ), - 0, Gtk2::VSeparator->new, - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + 0, Gtk3::VSeparator->new, + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, $label_and_widgets->($adv_options{default_case}, $default_case, ""), 0, $label_and_widgets->($adv_options{preserve_case}, $preserve_case, ""), ), @@ -762,25 +762,25 @@ sub modify_entry { gtkadd($w->{window}, gtknew('VBox', spacing => 0, children_loose => [ - gtkadd(Gtk2::Frame->new(N("Samba share directory")), - gtkpack_(gtkset_border_width(Gtk2::HBox->new, 1), - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + gtkadd(Gtk3::Frame->new(N("Samba share directory")), + gtkpack_(gtkset_border_width(Gtk3::HBox->new, 1), + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, $label_and_widgets->(N("Share name:"), $share_name), 0, $label_and_widgets->(N("Directory:"), $dir, $button), 0, $label_and_widgets->(N("Comment:"), $comment, ""), ), - 0, Gtk2::VSeparator->new, - 0, gtkpack_(gtkset_border_width(Gtk2::VBox->new, 0), + 0, Gtk3::VSeparator->new, + 0, gtkpack_(gtkset_border_width(Gtk3::VBox->new, 0), 0, $label_and_widgets->(N("Public:"), $public, ""), 0, $label_and_widgets->(N("Writable:"), $writable, ""), 0, $label_and_widgets->(N("Browseable:"), $browseable, ""), ), ), ), - gtkadd(Gtk2::Frame->new(N("Advanced options")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 1), + gtkadd(Gtk3::Frame->new(N("Advanced options")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 1), 0, $expander_user, - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, 0, $expander_file, ), ), @@ -914,24 +914,24 @@ sub get_user() { sub modify_user_info { my ($user, $_passwd, $todo) = @_; my ($buser, $bpasswd); - my $dialog = new Gtk2::Dialog(); + my $dialog = new Gtk3::Dialog(); $dialog->set_title(N("Add Samba user")); $dialog->set_modal(1); $dialog->set_position('center'); $dialog->set_resizable(0); if ($todo eq "add") { - $buser = Gtk2::ComboBox->new_with_strings([ get_user() ]); + $buser = Gtk3::ComboBox->new_with_strings([ get_user() ]); $buser->set_wrap_width(3); } else { - $buser = Gtk2::Label->new; + $buser = Gtk3::Label->new; $buser->set_text($user); } - $bpasswd = Gtk2::Entry->new; + $bpasswd = Gtk3::Entry->new; $bpasswd->set_visibility(0); gtkpack_($dialog->vbox, - 0, gtkadd(Gtk2::Frame->new(N("User information")), - gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5), + 0, gtkadd(Gtk3::Frame->new(N("User information")), + gtkpack_(gtkset_border_width(Gtk3::VBox->new, 5), 0, $label_and_widgets->(N("User name:"), $buser, ""), 0, $label_and_widgets->(N("Password:"), $bpasswd, ""), ), @@ -1288,13 +1288,13 @@ add_data_printer_list($printer_list); add_data_user_list($user_list); $_->set_rules_hint(1) foreach $display_share, $printer_list, $user_list; -$ugtk2::wm_icon = $fileshare_icon; -$window = ugtk2->new(N("Manage Samba configuration")); +$ugtk3::wm_icon = $fileshare_icon; +$window = ugtk3->new(N("Manage Samba configuration")); $::main_window = $window->{real_window}; $window->{rwindow}->set_size_request(600, 410) unless $::isEmbedded; $window->{rwindow}->set_position('center') if !$::isEmbedded; my $W = $window->{window}; -$W->signal_connect(delete_event => sub { ugtk2->exit }); +$W->signal_connect(delete_event => sub { ugtk3->exit }); # double clic and popup modify window $display_share->signal_connect(button_press_event => sub { @@ -1326,9 +1326,9 @@ $user_list->signal_connect(button_press_event => sub { #} [ $share_list, $printer_list, $user_list ], [ modify_entry, modify_printers_entry, modify_user_info ]; # create popup menu -my $menupopup = Gtk2::Menu->new; -my $menuitem1 = Gtk2::MenuItem->new(N("Modify")); -my $menuitem2 = Gtk2::MenuItem->new(N("Remove")); +my $menupopup = Gtk3::Menu->new; +my $menuitem1 = Gtk3::MenuItem->new(N("Modify")); +my $menuitem2 = Gtk3::MenuItem->new(N("Remove")); $menuitem1->signal_connect(activate => sub { my ($selected) = $display_share->get_selected_indices; modify_entry($selected); @@ -1349,7 +1349,7 @@ $display_share->signal_connect('button-press-event' => sub { $display_share->signal_connect(key_press_event => sub { my (undef, $event) = @_; - return unless $event->keyval == $Gtk2::Gdk::Keysyms{Return}; + return unless $event->keyval == $Gtk3::Gdk::Keysyms{Return}; my ($selected) = $display_share->get_selected_indices; modify_entry($selected); return 1; @@ -1357,22 +1357,22 @@ $display_share->signal_connect(key_press_event => sub { # create menu my @items = get_items(); -my $factory = Gtk2::ItemFactory->new('Gtk2::MenuBar', '<main>', undef); +my $factory = Gtk3::ItemFactory->new('Gtk3::MenuBar', '<main>', undef); $factory->create_items('menu', @items); my $menu = $factory->get_widget('<main>'); my $okcancel = create_okcancel({ - cancel_clicked => sub { ugtk2->exit }, - ok_clicked => sub { &write_conf; ugtk2->exit }, + cancel_clicked => sub { ugtk3->exit }, + ok_clicked => sub { &write_conf; ugtk3->exit }, }, ); -gtkappend_page(my $nb = Gtk2::Notebook->new, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), +gtkappend_page(my $nb = Gtk3::Notebook->new, gtkpack_(gtkset_border_width(Gtk3::HBox->new, 0), 1, create_scrolled_window($display_share), 0, gtkpack_(create_vbox('start'), - 0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => \&add_entry), - 0, Gtk2::HSeparator->new, - 0, gtksignal_connect(Gtk2::Button->new(N("Modify")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Add")), clicked => \&add_entry), + 0, Gtk3::HSeparator->new, + 0, gtksignal_connect(Gtk3::Button->new(N("Modify")), clicked => sub { my ($selected) = $display_share->get_selected_indices; eval { modify_entry($selected) }; my $err = $@; @@ -1380,7 +1380,7 @@ gtkappend_page(my $nb = Gtk2::Notebook->new, gtkpack_(gtkset_border_width(Gtk2:: err_dialog(N("Error"), N("Failed to Modify Samba share.") . "\n\n" . $err); } }), - 0, gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Remove")), clicked => sub { my ($selected) = $display_share->get_selected_indices; ask_okcancel("Remove entry ?", "Remove $display_share->{data}[$selected][1]") or return; eval { remove_entry($selected, $display_share) }; @@ -1391,19 +1391,19 @@ gtkappend_page(my $nb = Gtk2::Notebook->new, gtkpack_(gtkset_border_width(Gtk2:: }), ), ), - gtkshow(gtkpack_(Gtk2::HBox->new(0,0), - 0, Gtk2::Image->new_from_file($fileshare_icon), - 0, Gtk2::Label->new(N("File share")), + gtkshow(gtkpack_(Gtk3::HBox->new(0,0), + 0, Gtk3::Image->new_from_file($fileshare_icon), + 0, Gtk3::Label->new(N("File share")), ), ), ); -gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), +gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk3::HBox->new, 0), 1, create_scrolled_window($printer_list), 0, gtkpack_(create_vbox('start'), - 0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => \&add_printers_entry), - 0, Gtk2::HSeparator->new, - 0, gtksignal_connect(Gtk2::Button->new(N("Modify")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Add")), clicked => \&add_printers_entry), + 0, Gtk3::HSeparator->new, + 0, gtksignal_connect(Gtk3::Button->new(N("Modify")), clicked => sub { my ($selected) = $printer_list->get_selected_indices; eval { modify_printers_entry($selected) }; my $err = $@; @@ -1411,7 +1411,7 @@ gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), err_dialog(N("Error"), N("Failed to Modify.") . "\n\n" . $err); } }), - 0, gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Remove")), clicked => sub { my ($selected) = $printer_list->get_selected_indices; ask_okcancel("Remove entry ?", "Remove $printer_list->{data}[$selected][1]") or return; eval { remove_entry($selected, $printer_list) }; @@ -1422,25 +1422,25 @@ gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), }), ), ), - gtkshow(gtkpack_(Gtk2::HBox->new(0,0), - 0, Gtk2::Image->new_from_file($printershare_icon), - 0, Gtk2::Label->new(N("Printers")), + gtkshow(gtkpack_(Gtk3::HBox->new(0,0), + 0, Gtk3::Image->new_from_file($printershare_icon), + 0, Gtk3::Label->new(N("Printers")), ), ), ); -gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), +gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk3::HBox->new, 0), 1, create_scrolled_window($user_list), 0, gtkpack_(create_vbox('start'), - 0, gtksignal_connect(Gtk2::Button->new(N("Add")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Add")), clicked => sub { eval { modify_user_info("", "", "add") }; my $err = $@; if ($err) { err_dialog(N("Error"), N("Failed to add user.") . "\n\n" . $err); } }), - 0, Gtk2::HSeparator->new, - 0, gtksignal_connect(Gtk2::Button->new(N("Modify")), clicked => sub { + 0, Gtk3::HSeparator->new, + 0, gtksignal_connect(Gtk3::Button->new(N("Modify")), clicked => sub { my ($selected) = $user_list->get_selected_indices; eval { modify_user_info($user_list->{data}[$selected][1], "", "change") }; my $err = $@; @@ -1448,7 +1448,7 @@ gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), err_dialog(N("Error"), N("Failed to change user password.") . "\n\n" . $err); } }), - 0, gtksignal_connect(Gtk2::Button->new(N("Remove")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Remove")), clicked => sub { my ($selected) = $user_list->get_selected_indices; ask_okcancel("Remove entry ?", "Remove $user_list->{data}[$selected][1]") or return; eval { @@ -1460,17 +1460,17 @@ gtkappend_page($nb, gtkpack_(gtkset_border_width(Gtk2::HBox->new, 0), err_dialog(N("Error"), N("Failed to delete user.") . "\n\n" . $err); } }), - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, # FIXME: Why do we have both an "add" button and a "userdrake" one ??? - 0, gtksignal_connect(Gtk2::Button->new(N("Userdrake")), clicked => sub { + 0, gtksignal_connect(Gtk3::Button->new(N("Userdrake")), clicked => sub { run_program::raw({ detach => 1 }, 'userdrake'); } ), ), ), - gtkshow(gtkpack_(Gtk2::HBox->new(0,0), - 0, Gtk2::Image->new_from_file($sambauser_icon), - 0, Gtk2::Label->new(N("Samba Users"))), + gtkshow(gtkpack_(Gtk3::HBox->new(0,0), + 0, Gtk3::Image->new_from_file($sambauser_icon), + 0, Gtk3::Label->new(N("Samba Users"))), ), ); @@ -1485,10 +1485,10 @@ sub check_first_launch() { } # main interface -$W->add(gtkpack_(Gtk2::VBox->new(0,0), +$W->add(gtkpack_(Gtk3::VBox->new(0,0), 0, $menu, - 0, Gtk2::Banner->new($sambaicon, N("DrakSamba manage Samba shares")), - #if_($::isEmbedded, 0, Gtk2::Label->new("Here you can add, remove and alter Samba shares.")), + 0, Gtk3::Banner->new($sambaicon, N("DrakSamba manage Samba shares")), + #if_($::isEmbedded, 0, Gtk3::Label->new("Here you can add, remove and alter Samba shares.")), 1, $nb, 0, $okcancel, ), @@ -1496,4 +1496,4 @@ $W->add(gtkpack_(Gtk2::VBox->new(0,0), check_first_launch; $W->show_all; -Gtk2->main; +Gtk3->main; |