summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornic80 <joe_c_moi@yahoo.fr>2020-05-30 14:01:10 +0200
committerNicolas Lécureuil <neoclust@mageia.org>2020-06-02 10:29:36 +0200
commitcada88197d8ffa8fe77bdb0c42e9f638ffcc40eb (patch)
treeee171a6fe81b9e46014efbf496e83b15b753bcaf
parentd0d79e785cca12bebd8b707589366f8669124f50 (diff)
downloaddraksnapshot-cada88197d8ffa8fe77bdb0c42e9f638ffcc40eb.tar
draksnapshot-cada88197d8ffa8fe77bdb0c42e9f638ffcc40eb.tar.gz
draksnapshot-cada88197d8ffa8fe77bdb0c42e9f638ffcc40eb.tar.bz2
draksnapshot-cada88197d8ffa8fe77bdb0c42e9f638ffcc40eb.tar.xz
draksnapshot-cada88197d8ffa8fe77bdb0c42e9f638ffcc40eb.zip
Migrate to Gtk3
-rwxr-xr-xdraksnapshot-config46
1 files changed, 24 insertions, 22 deletions
diff --git a/draksnapshot-config b/draksnapshot-config
index ac0f8d5..7cb686d 100755
--- a/draksnapshot-config
+++ b/draksnapshot-config
@@ -28,17 +28,17 @@ use standalone; #- warning, standalone must be loaded very first, for 'expla
use common;
use interactive;
use MDV::Snapshot::Common;
-use MDV::Snapshot::Hal;
+#use MDV::Snapshot::Hal;
# i18n: IMPORTANT: to get correct namespace (drakconf instead of libDrakX)
BEGIN { unshift @::textdomains, 'draksnapshot' }
-use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version
-use ugtk2 qw(:create :dialogs :helpers :wrappers);
-use Gtk2::SimpleList;
+use mygtk3 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version
+use ugtk3 qw(:create :dialogs :helpers :wrappers);
+use Gtk3::SimpleList;
use interactive;
-ugtk2::add_icon_path("/usr/share/draksnapshot/pixmaps/");
+ugtk3::add_icon_path("/usr/share/draksnapshot/pixmaps/");
######### read config
@@ -52,7 +52,7 @@ my %default_values = (
my ($backup_list, $exclude_list) = map {
my $key = $_;
- my $list = Gtk2::SimpleList->new('' => 'text');
+ my $list = Gtk3::SimpleList->new('' => 'text');
# properly size when not embedded:
$list->set_size_request($::isEmbedded ? -1 : 500, 100);
$list->set_headers_visible(0);
@@ -62,13 +62,13 @@ my ($backup_list, $exclude_list) = map {
my $interval_exists;
-my %default_intervals = (
- map {
- if (my ($type, $interval) = /^interval\s*(\S*)\s*(\S*)/) {
- $interval_exists = 1;
- $type => $interval;
+ my %default_intervals = (
+ map {
+ if (my ($type, $retain) = /^retain\s*(\S*)\s*(\S*)/) {
+ $interval_exists = 1;
+ $type => $retain;
}
- } grep { /^interval\s/ } cat_($config_file)
+ } grep { /^retain\s/ } cat_($config_file)
);
if ($interval_exists) {
@@ -81,12 +81,13 @@ if ($interval_exists) {
######### GUI
-$ugtk2::wm_icon = "draksnapshot-big";
-my $my_win = ugtk2->new(N("Backup snapshots configuration"));
+$ugtk3::wm_icon = "draksnapshot-big";
+my $my_win = ugtk3->new(N("Backup snapshots configuration"));
+
unless ($::isEmbedded) {
$my_win->{window}->set_border_width(5);
- #$my_win->{window}->set_default_size(540,460);
+ $my_win->{window}->set_default_size(540,460);
}
$my_win->{window}->signal_connect(delete_event => \&quit);
@@ -100,7 +101,8 @@ my @menu_items = (
{ path => N("/_Help"), item_type => '<LastBranch>' },
{ path => N("/Help/_About...") }
);
-my $_menubar = $::isEmbedded ? create_factory_menu($my_win->{rwindow}, @menu_items) : undef;
+my $_menubar = $::isEmbedded ? ugtk2::create_factory_menu($my_win->{rwindow}, @menu_items) : undef;
+#my $_menubar = create_factory_menu($my_win->{rwindow}, @menu_items);
######### menus end
@@ -115,7 +117,7 @@ if (!$backup_directory || $::testing) {
}
}
-my $dialog = ugtk2->new(N("Backup snapshots configuration"));
+my $dialog = ugtk3::new(N("Backup snapshots configuration"));
my $d_window = $dialog->{window};
gtkadd($dialog->{rwindow},
gtknew('VBox', children => [
@@ -134,7 +136,7 @@ my $is_enabled = to_bool(glob("/etc/cron.*/rsnapshot"));
my ($box, $button);
gtkadd($my_win->{window},
gtknew('VBox', children => [
- if_(!$::isEmbedded, 0, Gtk2::Banner->new('draksnapshot-big',
+ if_(!$::isEmbedded, 0, Gtk3::Banner->new('draksnapshot-big',
N("Backup snapshots configuration"))),
0, gtknew('Title1', label => N("Settings")),
0, gtknew('CheckButton', text => N("Enable Backups"), active_ref => \$is_enabled,
@@ -195,7 +197,7 @@ sub format_list {
my ($list, $o_check) = @_;
gtknew('HBox',
children => [
- 0, gtkset_size_request(Gtk2::Alignment->new(0, 0, 0, 0), 35, 1),
+ 0, gtkset_size_request(Gtk3::Alignment->new(0, 0, 0, 0), 35, 1),
1, gtknew('ScrolledWindow', child => $list),
0, gtknew('VBox', border_width => 5, spacing => 5,
children_tight => [
@@ -216,7 +218,7 @@ sub format_list {
);
}
-sub quit() { ugtk2->exit(0) }
+sub quit() { ugtk3->exit(0) }
sub add {
@@ -229,7 +231,7 @@ sub add {
my $alrd_exsts = defined $o_iter;
$browse->signal_connect(clicked => sub {
- my $file_dlg = Gtk2::FileSelection->new(N("Path selection"));
+ my $file_dlg = Gtk3::FileSelection->new(N("Path selection"));
$file_dlg->set_modal(1);
$file_dlg->set_transient_for($dlg);
$file_dlg->show;
@@ -280,7 +282,7 @@ sub add {
sub save() {
save_keyword('interval', map {
my $val = $default_intervals{$_};
- if_($val, join("\t", 'interval', $_, $val));
+ if_($val, join("\t", 'retain', $_, $val));
} @ordered_intervals);
if (!$button->get('sensitive')) { # Mandriva defaults