diff options
Diffstat (limited to 'perl-install/diskdrake')
| -rw-r--r-- | perl-install/diskdrake/dav.pm | 2 | ||||
| -rw-r--r-- | perl-install/diskdrake/hd_gtk.pm | 124 | ||||
| -rw-r--r-- | perl-install/diskdrake/interactive.pm | 103 | ||||
| -rw-r--r-- | perl-install/diskdrake/removable.pm | 2 | ||||
| -rw-r--r-- | perl-install/diskdrake/resize_ext2.pm | 2 | ||||
| -rw-r--r-- | perl-install/diskdrake/smbnfs_gtk.pm | 26 |
6 files changed, 143 insertions, 116 deletions
diff --git a/perl-install/diskdrake/dav.pm b/perl-install/diskdrake/dav.pm index 8ad2421c7..317452f72 100644 --- a/perl-install/diskdrake/dav.pm +++ b/perl-install/diskdrake/dav.pm @@ -1,4 +1,4 @@ -package diskdrake::dav; # $Id: dav.pm 259328 2009-08-17 12:57:51Z alefebvre $ +package diskdrake::dav; use diagnostics; use strict; diff --git a/perl-install/diskdrake/hd_gtk.pm b/perl-install/diskdrake/hd_gtk.pm index 2ceb5ac40..63d52ecb2 100644 --- a/perl-install/diskdrake/hd_gtk.pm +++ b/perl-install/diskdrake/hd_gtk.pm @@ -1,11 +1,11 @@ -package diskdrake::hd_gtk; # $Id: hd_gtk.pm 269772 2010-06-03 11:51:31Z pterjan $ +package diskdrake::hd_gtk; use diagnostics; use strict; use common; -use mygtk2 qw(gtknew); -use ugtk2 qw(:helpers :wrappers :create); +use mygtk3 qw(gtknew); +use ugtk3 qw(:helpers :wrappers :create); use partition_table; use fs::type; use detect_devices; @@ -16,21 +16,19 @@ use log; use fsedit; use feature qw(state); -my ($width, $height, $minwidth) = (400, 50, 5); +my ($width, $height, $minwidth) = (400, 50, 16); my ($all_hds, $in, $do_force_reload, $current_kind, $current_entry, $update_all); my ($w, @notebook, $done_button); -=begin - =head1 SYNOPSYS -struct { + struct { string name # which is displayed in tab of the notebook bool no_auto # wether the kind can disappear after creation string type # one of { 'hd', 'raid', 'lvm', 'loopback', 'removable', 'nfs', 'smb', 'dmcrypt' } hd | hd_lvm | part_raid[] | part_dmcrypt[] | part_loopback[] | raw_hd[] val - + # widget main_box widget display_box @@ -38,17 +36,19 @@ struct { widget info_box } current_kind -part current_entry + part current_entry -notebook current_kind[] + notebook current_kind[] =cut sub load_theme() { - my $rc = "/usr/share/libDrakX/diskdrake.rc"; - -r $rc or $rc = dirname(__FILE__) . "/../diskdrake.rc"; - -r $rc or $rc = dirname(__FILE__) . "/../share/diskdrake.rc"; - Gtk2::Rc->parse($rc); + my $css = "/usr/share/libDrakX/diskdrake.css"; + -r $css or $css = dirname(__FILE__) . "/../diskdrake.css"; + -r $css or $css = dirname(__FILE__) . "/../share/diskdrake.css"; + my $pl = Gtk3::CssProvider->new; + $pl->load_from_path($css); + Gtk3::StyleContext::add_provider_for_screen(Gtk3::Gdk::Screen::get_default(), $pl, Gtk3::STYLE_PROVIDER_PRIORITY_APPLICATION); } sub main { @@ -58,26 +58,27 @@ sub main { local $in->{grab} = 1; - $w = ugtk2->new(N("Partitioning")); - $::main_window = $w->{real_window} if !$::isEmbedded && !$::isInstall; + $w = ugtk3->new(N("Partitioning")); + mygtk3::register_main_window($w->{real_window}) if !$::isEmbedded && !$::isInstall; load_theme(); + $w->{window}->signal_connect('style-updated' => \&load_theme); # TODO # is_empty_array_ref($all_hds->{raids}) or raid::stopAll; # updateLoopback(); gtkadd($w->{window}, - gtkpack_(Gtk2::VBox->new(0,7), + gtkpack_(Gtk3::VBox->new(0,7), 0, gtknew(($::isInstall ? ('Title1', 'label') : ('Label_Left', 'text')) => N("Click on a partition, choose a filesystem type then choose an action"), # workaround infamous 6 years old gnome bug #101968: - width => mygtk2::get_label_width() + width => mygtk3::get_label_width() ), - 1, (my $notebook_widget = Gtk2::Notebook->new), + 1, (my $notebook_widget = Gtk3::Notebook->new), 0, (my $per_kind_action_box = gtknew('HButtonBox', layout => 'edge')), 0, (my $per_kind_action_box2 = gtknew('HButtonBox', layout => 'end')), - 0, Gtk2::HSeparator->new, + 0, Gtk3::HSeparator->new, 0, (my $general_action_box = gtknew('HBox', spacing => 5)), ), ); @@ -97,8 +98,9 @@ sub main { current_entry_changed($current_kind, $current_entry); $lock = 0; if ($o_refresh_gui) { + my $new_page = $o_refresh_gui > 1 ? $notebook_widget->get_current_page : 0; $notebook_widget->set_current_page(-1); - $notebook_widget->set_current_page(0); + $notebook_widget->set_current_page($new_page); } }; create_automatic_notebooks($notebook_widget); @@ -108,13 +110,21 @@ sub main { $current_entry = ''; $update_all->(); }); - # ensure partitions bar is properlyz size on first display: + # ensure partitions bar is properly sized on first display: $notebook_widget->signal_connect(realize => $update_all); $w->sync; + # workaround for $notebook_widget being realized too early: + if (!$done_button) { + $notebook_widget->set_current_page(-1); + $notebook_widget->set_current_page(0); + $update_all->(2); + } $done_button->grab_focus; - $in->ask_from_list_(N("Read carefully"), N("Please make a backup of your data first"), - [ N_("Exit"), N_("Continue") ], N_("Continue")) eq N_("Continue") or return - if $::isStandalone; + if (!$::testing) { + $in->ask_from_list_(N("Read carefully"), N("Please make a backup of your data first"), + [ N_("Exit"), N_("Continue") ], N_("Continue")) eq N_("Continue") or return + if $::isStandalone; + } undef $initializing; $w->main; @@ -128,19 +138,29 @@ sub try { sub try_ { my ($name, $f, @args) = @_; + my $dm_active_before = ($current_entry && $current_entry->{dm_active} && $current_entry->{dm_name}); my $v = eval { $f->($in, @args, $all_hds) }; if (my $err = $@) { + warn $err, "\n", backtrace() if $in->isa('interactive::gtk'); $in->ask_warn(N("Error"), formatError($err)); } + my $refresh = 0; if ($v eq 'force_reload') { $all_hds = $do_force_reload->(); - $update_all->(1); + $refresh = 1; } - $current_entry = '' if !diskdrake::interactive::is_part_existing($current_entry, $all_hds); - $update_all->(); + if (!diskdrake::interactive::is_part_existing($current_entry, $all_hds)) { + $current_entry = ''; + } elsif (!$dm_active_before && $current_entry->{dm_active} && $current_entry->{dm_name}) { + if (my $mapped_part = fs::get::device2part("mapper/$current_entry->{dm_name}", $all_hds->{dmcrypts})) { + $current_entry = $mapped_part; + $refresh = 2; + } + } + $update_all->($refresh); - Gtk2->main_quit if $v && member($name, 'Done'); + Gtk3->main_quit if $v && member($name, 'Done'); } sub get_action_box_size() { @@ -154,11 +174,11 @@ sub add_kind2notebook { my ($notebook_widget, $kind) = @_; die if $kind->{main_box}; - $kind->{display_box} = gtkset_size_request(Gtk2::HBox->new(0,0), $width, $height); - $kind->{action_box} = gtkset_size_request(Gtk2::VBox->new, get_action_box_size()); - $kind->{info_box} = Gtk2::VBox->new(0,0); + $kind->{display_box} = gtkset_size_request(Gtk3::HBox->new(0,0), $width, $height); + $kind->{action_box} = gtkset_size_request(Gtk3::VBox->new, get_action_box_size()); + $kind->{info_box} = Gtk3::VBox->new(0,0); my $box = - gtkpack_(Gtk2::VBox->new(0,7), + gtkpack_(Gtk3::VBox->new(0,7), 0, $kind->{display_box}, 0, filesystems_button_box(), 1, $kind->{info_box}); @@ -166,14 +186,14 @@ sub add_kind2notebook { 1, $box, 0, $kind->{action_box}, ]); - ugtk2::add2notebook($notebook_widget, $kind->{name}, $kind->{main_box}); + ugtk3::add2notebook($notebook_widget, $kind->{name}, $kind->{main_box}); push @notebook, $kind; $kind; } sub interactive_help() { if ($::isInstall) { - $in->display_help({ interactive_help_id => 'diskdrake' }, $w); + $in->display_help({ interactive_help_id => 'diskdrake' }); } else { require run_program; run_program::raw({ detach => 1 }, 'drakhelp', '--id', 'diskdrake'); @@ -193,7 +213,7 @@ sub general_action_box { N_("Done")); my $box_end = gtknew('HButtonBox', layout => 'end', spacing => 5); foreach my $s (@actions) { - my $button = Gtk2::Button->new(translate($s)); + my $button = Gtk3::Button->new(translate($s)); $done_button = $button if $s eq 'Done'; gtkadd($box_end, gtksignal_connect($button, clicked => sub { try($s) })); } @@ -207,12 +227,12 @@ sub per_kind_action_box { foreach my $s (diskdrake::interactive::hd_possible_actions_base($in)) { gtkadd($box, - gtksignal_connect(Gtk2::Button->new(translate($s)), + gtksignal_connect(Gtk3::Button->new(translate($s)), clicked => sub { try($s, kind2hd($kind)) })); } foreach my $s (diskdrake::interactive::hd_possible_actions_extra($in)) { gtkadd($box2, - gtksignal_connect(Gtk2::Button->new(translate($s)), + gtksignal_connect(Gtk3::Button->new(translate($s)), clicked => sub { try($s, kind2hd($kind)) })); } } @@ -223,18 +243,18 @@ sub per_entry_action_box { if ($entry) { my @buttons = map { my $s = $_; - my $w = Gtk2::Button->new(translate($s)); + my $w = Gtk3::Button->new(translate($s)); $w->signal_connect(clicked => sub { try($s, kind2hd($kind), $entry) }); $w; } diskdrake::interactive::part_possible_actions($in, kind2hd($kind), $entry, $all_hds); - gtkadd($box, create_scrolled_window(gtkpack__(Gtk2::VBox->new, @buttons), undef, 'none')) if @buttons; + gtkadd($box, create_scrolled_window(gtkpack__(Gtk3::VBox->new, @buttons), undef, 'none')) if @buttons; } else { my $txt = !$::isStandalone && fsedit::is_one_big_fat_or_NT($all_hds->{hds}) ? N("You have one big Microsoft Windows partition. I suggest you first resize that partition (click on it, then click on \"Resize\")") : N("Please click on a partition"); - gtkpack($box, gtktext_insert(Gtk2::TextView->new, $txt)); + gtkpack($box, gtktext_insert(Gtk3::TextView->new, $txt)); } } @@ -305,10 +325,16 @@ sub create_automatic_notebooks { sub create_buttons4partitions { my ($kind, $totalsectors, @parts) = @_; - $width = first($w->{window}->window->get_size) - first(get_action_box_size()) - 25 if $w->{window}->window; + if ($w->{window}->get_window) { + my $windowwidth = $w->{window}->get_allocated_width; + $windowwidth = $::real_windowwidth if $windowwidth <= 1; + $width = $windowwidth - first(get_action_box_size()) - 25; + } my $ratio = $totalsectors ? ($width - @parts * $minwidth) / $totalsectors : 1; - while (1) { + my $i = 1; + while ($i < 30) { + $i++; my $totalwidth = sum(map { $_->{size} * $ratio + $minwidth } @parts); $totalwidth <= $width and last; $ratio /= $totalwidth / $width * 1.1; @@ -326,9 +352,11 @@ sub create_buttons4partitions { my $p = find { $entry->{dm_name} eq $_->{dmcrypt_name} } @{$all_hds->{dmcrypts}}; $entry = $p if $p; } - my $info = $entry->{mntpoint} || $entry->{device_LABEL}; + my $info = $entry->{mntpoint} || $entry->{device_LABEL} || ''; $info .= "\n" . ($entry->{size} ? formatXiB($entry->{size}, 512) : N("Unknown")) if $info; - my $w = Gtk2::ToggleButton->new_with_label($info) or internal_error('new_with_label'); + my $w = Gtk3::ToggleButton->new_with_label($info) or internal_error('new_with_label'); + $w->get_child->set_ellipsize('end'); + $w->set_tooltip_text($info); $w->signal_connect(clicked => sub { $current_button != $w or return; current_entry_changed($kind, $entry); @@ -392,17 +420,17 @@ sub hd2kind { } sub filesystems_button_box() { - my @types = (N_("Ext4"), N_("XFS"), N_("Swap"), arch() =~ /sparc/ ? N_("SunOS") : arch() eq "ppc" ? N_("HFS") : N_("Windows"), + my @types = (N_("Ext4"), N_("XFS"), N_("Swap"), N_("Windows"), N_("Other"), N_("Empty")); my %name2fs_type = (Ext3 => 'ext3', Ext4 => 'ext4', 'XFS' => 'xfs', Swap => 'swap', Other => 'other', "Windows" => 'vfat', HFS => 'hfs'); - gtkpack(Gtk2::HBox->new, + gtkpack(Gtk3::HBox->new, map { my $t = $name2fs_type{$_}; my $w = gtknew('Button', text => translate($_), widget_name => 'PART_' . ($t || 'empty'), tip => N("Filesystem types:"), clicked => sub { try_('', \&createOrChangeType, $t, current_hd(), current_part()) }); - $w->can_focus(0); + $w->set_can_focus(0); $w; } @types); } diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 8a4d9bb9c..9356a1930 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -1,4 +1,4 @@ -package diskdrake::interactive; # $Id: interactive.pm 269771 2010-06-03 11:50:24Z pterjan $ +package diskdrake::interactive; use diagnostics; use strict; @@ -21,18 +21,16 @@ use any; use log; -=begin - =head1 SYNOPSYS -struct part { + struct part { int active # one of { 0 | 0x80 } x86 only, primary only int start # in sectors int size # in sectors int pt_type # 0x82, 0x83, 0x6 ... string fs_type # 'ext2', 'nfs', ... string type_name # 'Linux RAID', 'Linux Logical Volume Manager', ... - + int part_number # 1 for hda1... string device # 'hda5', 'sdc1' ... string device_LABEL # volume label. LABEL=xxx or /dev/disk/by-label/xxx can be used in fstab instead of the device @@ -42,7 +40,7 @@ struct part { bool prefer_device # should the {device} be used in fstab bool faked_device # false if {device} is a real device, true for nfs/smb/dav/none devices. If the field does not exist, we do not know bool device_LABEL_changed # true if device_LABEL is different from the one on the disk - + string rootDevice # 'sda', 'hdc' ... (can also be a VG_name) string real_mntpoint # directly on real /, '/tmp/hdimage' ... string mntpoint # '/', '/usr' ... @@ -51,32 +49,32 @@ struct part { string encrypt_key # [0-9A-Za-z./]{20,} string comment # comment to have in fstab string volume_label # - + bool is_removable # is the partition on a removable drive bool isMounted - + bool isFormatted bool notFormatted # isFormatted means the device is formatted # !isFormatted && notFormatted means the device is not formatted # !isFormatted && !notFormatted means we do not know which state we're in - + string raid # for partitions of type isRawRAID and which isPartOfRAID, the raid device string lvm # partition used as a PV for the VG with {lvm} as VG_name #-# loopback loopback[] # loopback living on this partition - + string dmcrypt_key string dm_name bool dm_active - + # internal string real_device # '/dev/loop0', '/dev/loop1' ... (used for encrypted loopback) - + # internal CHS (Cylinder/Head/Sector) int start_cyl, start_head, start_sec, end_cyl, end_head, end_sec, } -struct part_allocate inherits part { + struct part_allocate inherits part { int maxsize # in sectors (alike "size") int min_hd_size # in sectors (do not allocate if the drive is smaller than the given size) int ratio # @@ -84,44 +82,44 @@ struct part_allocate inherits part { string parts # for creating raid partitions. eg: 'foo bar' where 'foo' and 'bar' are mntpoint } -struct part_raid inherits part { + struct part_raid inherits part { string chunk-size # in KiB, usually '64' string level # one of { 0, 1, 4, 5, 'linear' } string UUID - + part disks[] - + # invalid: active, start, rootDevice, device_windobe?, CHS } -struct part_dmcrypt inherits part { + struct part_dmcrypt inherits part { string dmcrypt_name - + # rootDevice is special here: it is the device hosting the dm } -struct part_loopback inherits part { + struct part_loopback inherits part { string loopback_file # absolute file name which is relative to the partition part loopback_device # where the loopback file live - + # device is special here: it is the absolute filename of the loopback file. - + # invalid: active, start, rootDevice, device_windobe, CHS } -struct part_lvm inherits part { + struct part_lvm inherits part { # invalid: active, start, device_windobe, CHS string lv_name } -struct partition_table_elem { + struct partition_table_elem { part normal[] # part extended # the main/next extended part raw[4] # primary partitions } -struct geom { + struct geom { int heads int sectors int cylinders @@ -129,14 +127,14 @@ struct geom { int start # always 0, forget it } -struct hd { + struct hd { int totalsectors # size in sectors string device # 'hda', 'sdc' ... string device_alias # 'cdrom', 'floppy' ... string media_type # one of { 'hd', 'cdrom', 'fd', 'tape' } string capacity # contain of the strings of { 'burner', 'DVD' } string info # name of the hd, eg: 'QUANTUM ATLAS IV 9 WLS' - + bool readonly # is it allowed to modify the partition table bool getting_rid_of_readonly_allowed # is it forbidden to write because the partition table is badly handled, or is it because we MUST not change the partition table bool isDirty # does it need to be written to the disk @@ -147,37 +145,37 @@ struct hd { # - add an extended partition which is the first extended partition list allPartitionsRenumbered # used to update bootloader configuration int bus, id - + bool is_removable # is it a removable drive - + partition_table_elem primary partition_table_elem extended[] - + geom geom - + # internal string prefix # for some RAID arrays device=>c0d0 and prefix=>c0d0p string file # '/dev/hda' ... } -struct hd_lvm inherits hd { + struct hd_lvm inherits hd { int PE_size # block size (granularity, similar to cylinder size on x86) string VG_name # VG name - + part_lvm disks[] - + # invalid: bus, id, extended, geom } -struct raw_hd inherits hd { + struct raw_hd inherits hd { string fs_type # 'ext2', 'nfs', ... string mntpoint # '/', '/usr' ... string options # 'defaults', 'noauto' - + # invalid: isDirty, will_tell_kernel, rebootNeeded, primary, extended } -struct all_hds { + struct all_hds { hd hds[] hd_lvm lvms[] part_raid raids[] @@ -188,7 +186,7 @@ struct all_hds { raw_hd smbs[] raw_hd davs[] raw_hd special[] - + # internal: if fstab_to_string($all_hds) eq current_fstab then no need to save string current_fstab } @@ -602,9 +600,6 @@ sub Delete { delete $part->{loopback_device}{loopback} if @$l == 0; fsedit::recompute_loopbacks($all_hds); } else { - if (arch() =~ /ppc/) { - undef $partition_table::mac::bootstrap_part if isAppleBootstrap($part) && ($part->{device} = $partition_table::mac::bootstrap_part); - } partition_table::remove($hd, $part); warn_if_renumbered($in, $hd); } @@ -893,7 +888,7 @@ filesystem checks will be run on your next boot into Microsoft Windows®")); mkdir_p($dir); fs::mount::mount(devices::make($part->{device}), $dir, $part->{fs_type}); } - if (!run_program::run("btrfsctl", "-r", $part->{size}*512, $dir)) { + if (!run_program::run(qw(btrfs filesystem resize), $part->{size}*512, $dir)) { $nice_resize{btrfs} = undef; if (!$part->{isMounted}) { fs::mount::umount($dir); @@ -954,8 +949,21 @@ sub dmcrypt_open { delete $part->{dmcrypt_key}; die(($? >> 8) == 255 ? N("Invalid key") : $@); } - # Detect LVMs on top of dmcrypt + detect_lvms_on_dmcrypt($all_hds); +} + +# Detect LVMs on top of dmcrypt +sub detect_lvms_on_dmcrypt { + my ($all_hds) = @_, + require File::Temp; + require fs::dmcrypt; + my (undef, $tmp_file) = File::Temp::mkstemp('/tmp/crypttab.XXXXXXX'); + fs::dmcrypt::save_crypttab_($all_hds, $tmp_file); $all_hds->{lvms} = [ fsedit::lvms($all_hds) ]; + fs::dmcrypt::read_crypttab_($all_hds, $tmp_file); + rm_rf($tmp_file); + require lvm; + lvm::detect_during_install() if $::isInstall; } sub Add2RAID { @@ -1373,16 +1381,7 @@ sub format_part_info { $info .= N("Volume label: ") . "$part->{device_LABEL}\n" if $part->{device_LABEL}; $info .= N("UUID: ") . "$part->{device_UUID}\n" if $::expert && $part->{device_UUID}; $info .= N("DOS drive letter: %s (just a guess)\n", $part->{device_windobe}) if $part->{device_windobe}; - if (arch() eq "ppc") { - my $pType = $part->{pType}; - $pType =~ s/[^A-Za-z0-9_]//g; - $info .= N("Type: ") . $pType . ($::expert ? sprintf " (0x%x)", $part->{pt_type} : '') . "\n"; - if (defined $part->{pName}) { - my $pName = $part->{pName}; - $pName =~ s/[^A-Za-z0-9_]//g; - $info .= N("Name: ") . $pName . "\n"; - } - } elsif (isEmpty($part)) { + if (isEmpty($part)) { $info .= N("Empty") . "\n"; } else { $info .= N("Type: ") . (fs::type::part2type_name($part) || $part->{fs_type}) . ($::expert ? sprintf " (0x%x)", $part->{pt_type} : '') . "\n"; diff --git a/perl-install/diskdrake/removable.pm b/perl-install/diskdrake/removable.pm index 0ed8e0f80..f3b73ed4b 100644 --- a/perl-install/diskdrake/removable.pm +++ b/perl-install/diskdrake/removable.pm @@ -1,4 +1,4 @@ -package diskdrake::removable; # $Id: removable.pm 215411 2007-04-25 12:26:16Z pixel $ +package diskdrake::removable; use diagnostics; use strict; diff --git a/perl-install/diskdrake/resize_ext2.pm b/perl-install/diskdrake/resize_ext2.pm index ca222b35a..a09cdb542 100644 --- a/perl-install/diskdrake/resize_ext2.pm +++ b/perl-install/diskdrake/resize_ext2.pm @@ -1,4 +1,4 @@ -package diskdrake::resize_ext2; # $Id: resize_ext2.pm 214945 2006-02-13 16:10:35Z tvignaud $ +package diskdrake::resize_ext2; use diagnostics; use strict; diff --git a/perl-install/diskdrake/smbnfs_gtk.pm b/perl-install/diskdrake/smbnfs_gtk.pm index 28fc9f2ea..b2417ce83 100644 --- a/perl-install/diskdrake/smbnfs_gtk.pm +++ b/perl-install/diskdrake/smbnfs_gtk.pm @@ -1,4 +1,4 @@ -package diskdrake::smbnfs_gtk; # $Id: smbnfs_gtk.pm 243679 2008-07-29 11:55:58Z tv $ +package diskdrake::smbnfs_gtk; use diagnostics; use strict; @@ -9,8 +9,8 @@ use common; use interactive; use fs::remote::smb; use fs::remote::nfs; -use mygtk2 qw(gtknew gtkset); -use ugtk2 qw(:helpers :wrappers :create); +use mygtk3 qw(gtknew gtkset); +use ugtk3 qw(:helpers :wrappers :create); my ($all_hds, $in, $tree_model, $current_entry, $current_leaf, %icons); @@ -19,7 +19,7 @@ sub main { my ($kind) = $type eq 'smb' ? smb2kind() : nfs2kind(); $kind->check($in) or return; - my $w = ugtk2->new(N("Partitioning")); + my $w = ugtk3->new(N("Partitioning")); add_smbnfs($w->{window}, $kind); $w->{rwindow}->set_default_size(400, 300) if $w->{rwindow}->can('set_default_size'); @@ -42,7 +42,7 @@ sub try_ { $in->ask_warn(N("Error"), formatError($err)); } update($kind); - Gtk2->main_quit if member($name, 'Cancel', 'Done'); + Gtk3->main_quit if member($name, 'Cancel', 'Done'); } sub raw_hd_options { @@ -127,14 +127,14 @@ sub import_tree { my ($kind, $info_box) = @_; my (%servers_displayed, %wservers, %wexports); - $tree_model = Gtk2::TreeStore->new("Gtk2::Gdk::Pixbuf", "Glib::String"); - my $tree = Gtk2::TreeView->new_with_model($tree_model); + $tree_model = Gtk3::TreeStore->new("Gtk3::Gdk::Pixbuf", "Glib::String"); + my $tree = Gtk3::TreeView->new_with_model($tree_model); $tree->get_selection->set_mode('browse'); - my $col = Gtk2::TreeViewColumn->new; - $col->pack_start(my $pixrender = Gtk2::CellRendererPixbuf->new, 0); + my $col = Gtk3::TreeViewColumn->new; + $col->pack_start(my $pixrender = Gtk3::CellRendererPixbuf->new, 0); $col->add_attribute($pixrender, 'pixbuf', 0); - $col->pack_start(my $texrender = Gtk2::CellRendererText->new, 1); + $col->pack_start(my $texrender = Gtk3::CellRendererText->new, 1); $col->add_attribute($texrender, 'text', 1); $tree->append_column($col); @@ -226,10 +226,10 @@ sub import_tree { $current_entry = find_fstab_entry($kind, $wexports{$tree_model->get_path_str($curr)} || die(''), 'add'); } else { if (!$tree_model->iter_has_child($curr)) { - gtkset_mousecursor_wait($tree->window); - ugtk2::flush(); + gtkset_mousecursor_wait($tree->get_window); + ugtk3::flush(); $add_exports->($curr); - gtkset_mousecursor_normal($tree->window); + gtkset_mousecursor_normal($tree->get_window); } $current_entry = undef; } |
