Your message dated Mon, 13 Sep 2010 15:02:13 +0000
with message-id <[email protected]>
and subject line Bug#595043: fixed in gbackground 1.3-1
has caused the Debian Bug report #595043,
regarding gbackground: Add support for persistent configuration
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
595043: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595043
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: gbackground
Version: 1.2-1
Severity: wishlist
Tags: patch

gbackground would be much more usable if it saved a configuration file
- The patch I am attaching implements it, using YAML.

Greetings,

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-openvz-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages gbackground depends on:
ii  libglib-perl                  2:1.223-1  interface to the GLib and GObject 
ii  libgtk2-gladexml-perl         1.007-1    Perl interface to use user interfa
ii  libgtk2-perl                  2:1.222-1  Perl interface to the 2.x series o
ii  libproc-pid-file-perl         1.27-1     Perl module for managing process i
ii  libui-dialog-perl             1.08-1.1   UI::Dialog a wrapper for various d
ii  perl                          5.10.1-14  Larry Wall's Practical Extraction 

gbackground recommends no packages.

gbackground suggests no packages.

-- no debconf information
--- /usr/bin/gbackground        2009-08-25 18:35:06.000000000 -0500
+++ /tmp/gbackground-1.2/gbackground    2010-08-31 11:38:36.000000000 -0500
@@ -5,17 +5,20 @@
 use UI::Dialog;
 use UI::Dialog::Backend::Zenity;
 use Switch;
+use YAML;
 
 ## Variables Declaration
 
-my($program, $main_window, $background_path, $exit_button, $path_images, $pid, 
$label_number_of_seconds, $number_of_seconds, $label_status, $about_window, 
$about, $preferences_window, $filechooserbutton, $file_choose);
+my($config, $program, $main_window, $exit_button, $label_number_of_seconds, 
$label_status, $about_window, $about, $preferences_window, $filechooserbutton, 
$file_choose);
 
-my(@status, $home_directory, $path, $path_pid, $last_background);
+my(@status, $path, $last_background);
+my $path = "$ENV{HOME}/.gbackground";
+my $configfile = "$path/gbackground.yml";
 
 ## From Preferences window
-my($return_value_widget, $type_of_change_widget, $type_of_change, 
$last_change);
-my $return_value = 1;
+my($return_value_widget, $type_of_change_widget);
 
+load_config();
 &trash;
 
 ## Loading from UI::Dialog
@@ -46,12 +49,46 @@
 
 Gtk2->main;
 
+END {
+    save_config();
+}
+
 ## Subroutines ##
+sub config_defaults {
+    return { seconds => 5,
+            bg_dir => '/usr/share/backgrounds',
+            keep_last_bg => 1,
+            # bg_options:
+            # 0 => scaled, 1 => stretched, 2 => wallpaper, 3 => centered
+            # (hard-coded in gbackground.glade)
+            bg_options => 1, 
+            pid => "$path/gbackground.pid"
+    };
+}
+
+sub load_config {
+    my ($defaults);
+    mkdir($path, 0755) unless -d $path;
+    $defaults = &config_defaults;
+    if (-e $configfile) {
+       $config = YAML::LoadFile($configfile);
+       # Use default values for whatever has not been specified
+       map( { $config->{$_} = $defaults->{$_} unless defined $config->{$_} }
+            keys(%$defaults) );
+    } else {
+       $config = $defaults;
+    }
+}
+
+sub save_config {
+    my $file;
+    return undef unless $config;
+    mkdir($path, 0755) unless -d $path;
+    YAML::DumpFile($configfile, $config);
+}
+
 sub trash {
        @status = ("<span foreground=\"blue\">Running</span>", "<span 
foreground=\"red\">Stopped</span>");
-       $home_directory = $ENV{HOME};
-       $path_pid = $home_directory . "/.gbackground" . "/gbackground.pid";
-       $last_change = 'stretched';
 }
 sub load_widgets {
        $main_window = $program->get_widget('main_window');
@@ -63,11 +100,26 @@
        $return_value_widget = 
$program->get_widget('keep_last_bground_combobox');
        $type_of_change_widget = 
$program->get_widget('background_options_select');
        $filechooserbutton = $program->get_widget('filechooserbutton');
-       
$filechooserbutton->set_current_folder_uri("/usr/share/images/desktop-base/");
+       # Set values from configuration
+       $label_number_of_seconds->set_text($config->{seconds});
+       $filechooserbutton->set_current_folder($config->{bg_dir});
+       $return_value_widget->set_active($config->{keep_last_bg});
+       $type_of_change_widget->set_active($config->{bg_options});
+}
+
+# Returns the PID if it is running, undef otherwise
+sub is_running {
+    my ($fh, $pid);
+    return undef if ! -e $config->{pid};
+    open($fh, '<', $config->{pid});
+    $pid = $fh->getline;
+    chomp $pid;
+    # We assume to have a working /proc
+    return (-d "/proc/$pid") ? $pid : undef;
 }
 
 sub check_status {
-       if(-e $path_pid){
+       if(is_running()){
                $label_status->set_markup("@status[0]");
        }else{
                $label_status->set_markup("@status[1]");
@@ -75,44 +127,41 @@
 }
 
 sub on_start_button_event {
-       $path_images = $filechooserbutton->get_filename;
+       $config->{bg_dir} = $filechooserbutton->get_filename;
        $last_background = `gconftool-2 --get 
/desktop/gnome/background/picture_filename`;
        $last_background =~ s/\s/\\ /g;
-       if(-e "$path_pid"){
+       if(is_running()){
                $window_dialogs->error(title => 'Error!!', text => 'Gbackground 
<b>is already</b> working');
                }
        else{
-               if(-e $path_images){
-                       $number_of_seconds = 
$label_number_of_seconds->get_text();
-                       $path_images =~ s/\s/\\ /g;
+               if(-e $config->{bg_dir}){
+                       $config->{seconds} = 
$label_number_of_seconds->get_text();
+                       $config->{bg_dir} =~ s/\s/\\ /g;
                        if(-e './gbackgroundD'){
-                               system("perl ./gbackgroundD \"$path_images\" 
$number_of_seconds $last_change \&");
+                               system("perl ./gbackgroundD 
\"$config->{bg_dir}\" $config->{seconds} $config->{bg_options} \&");
                        } else {
-                               system("perl 
/usr/share/gbackground/gbackgroundD \"$path_images\" $number_of_seconds 
$last_change \&");
+                               system("perl 
/usr/share/gbackground/gbackgroundD \"$config->{bg_dir}\" $config->{seconds} 
$config->{bg_options} \&");
                        }
                        
                        sleep 1; # Esto es por que muchas veces tarda en crear 
el gbackground.pid
-                       $label_status->set_markup("@status[0]") if(-e 
"$path_pid");
+                       $label_status->set_markup("@status[0]") 
if(is_running());
                        $window_dialogs->msgbox(title => "Daemon Gbackground", 
text => 'Gbackground has started <b>successfully</b>');  
                }
                else{
                        $window_dialogs->error(title => "Error, dir doesn't 
exist", text => 'The directory that you introduced <b>is not valid</b>, please 
verify it and try again');   
                }
        }
+       save_config();
 }
 sub on_stop_button_event {
-       if(-e "$path_pid"){
-               open(ARCHIVO_PID, "$path_pid");
-               while(<ARCHIVO_PID>){
-                       $pid = $_;
-               }
+       if(my $pid = is_running()){
                system("kill -9 $pid");
-               system("rm -f $path_pid");
-               if($return_value == 1){
+               unlink($config->{pid});
+               if($config->{keep_last_bg} == 1){
                                system("gconftool-2 -t str -s 
/desktop/gnome/background/picture_filename $last_background");
                }
                $window_dialogs->msgbox(title => "Daemon Gbackground", text => 
'Gbackground has been <b>stopped</b> successfully'); 
-               $window_dialogs->error(title => 'Error!!', text => 'Error, it 
was not possible to stop Gbackground. Probably because it <b>is not</b> 
running') if(-e "$path_pid");
+               $window_dialogs->error(title => 'Error!!', text => 'Error, it 
was not possible to stop Gbackground. Probably because it <b>is not</b> 
running') if(is_running());
        }else{
                $window_dialogs->error(title => 'Error!!', text => 'Gbackground 
<b>is not</b> running');        
        }
@@ -120,8 +169,8 @@
 }
 
 sub on_preferences_accept_button_event {
-       $return_value = $return_value_widget->get_active;
-       $last_change = $type_of_change_widget->get_active_text();
+       $config->{keep_last_bg} = $return_value_widget->get_active;
+       $config->{bg_options} = $type_of_change_widget->get_active_text();
        $preferences_window->hide;
 }
 
@@ -144,7 +193,7 @@
 sub on_quit_button_event {Gtk2->main_quit;}
 sub on_about_menu_event {$about->present;}
 sub on_preferences_event {
-       my $value = $type_of_change_widget->set_active("1");
+       my $value = $type_of_change_widget->set_active($config->{bg_options});
        $preferences_window->show_all;
 }
 sub on_preferences_cancel_button_event {$preferences_window->hide;}

--- End Message ---
--- Begin Message ---
Source: gbackground
Source-Version: 1.3-1

We believe that the bug you reported is fixed in the latest version of
gbackground, which is due to be installed in the Debian FTP archive:

gbackground_1.3-1.debian.tar.gz
  to main/g/gbackground/gbackground_1.3-1.debian.tar.gz
gbackground_1.3-1.dsc
  to main/g/gbackground/gbackground_1.3-1.dsc
gbackground_1.3-1_all.deb
  to main/g/gbackground/gbackground_1.3-1_all.deb
gbackground_1.3.orig.tar.gz
  to main/g/gbackground/gbackground_1.3.orig.tar.gz



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Alejandro Garrido Mota <[email protected]> (supplier of updated gbackground 
package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sun, 12 Sep 2010 11:44:28 -0430
Source: gbackground
Binary: gbackground
Architecture: source all
Version: 1.3-1
Distribution: unstable
Urgency: low
Maintainer: Alejandro Garrido Mota <[email protected]>
Changed-By: Alejandro Garrido Mota <[email protected]>
Description: 
 gbackground - interval-based gnome background changer
Closes: 595027 595043
Changes: 
 gbackground (1.3-1) unstable; urgency=low
 .
   * New upstream release (Closes: #595027, #595043)
   * Remove DH_VERBOSE in d/rules
   * Update Standards-Version field
   * Add libyaml-perl like Depends
   * Adapt d/copyright to DEP5
   * Add source format 3.0
Checksums-Sha1: 
 a930ef3e22224034fdf9aa2339822d2fafe738cc 1686 gbackground_1.3-1.dsc
 5f7d08ce5043c25e1e52b1d0bc1f15a56b0e4528 11615 gbackground_1.3.orig.tar.gz
 17a99df06f049a63af9c573bb269116a2d0a0e0b 2281 gbackground_1.3-1.debian.tar.gz
 c8a41f43c97995ba3fefa16757d660b86b18283e 14198 gbackground_1.3-1_all.deb
Checksums-Sha256: 
 22e335009fd26ca153de43747f66aababd48e24928032c1ca332cb47c3bb9d93 1686 
gbackground_1.3-1.dsc
 213108924165875507810572c09c4afd15d4be1ddd97f061e17677de616a794e 11615 
gbackground_1.3.orig.tar.gz
 90abe99f687d093e0485931e1e41d2022ba9dd8d17a088f6718333928fdf7e99 2281 
gbackground_1.3-1.debian.tar.gz
 037926c9e0d50487a457bef0714e5fe4b9eef294f75e8b89c3549200311e122e 14198 
gbackground_1.3-1_all.deb
Files: 
 a44bf1f98723f8b5bb63259d5d3f667d 1686 gnome optional gbackground_1.3-1.dsc
 f132d6b78fb5ca08b43bb07d53686d47 11615 gnome optional 
gbackground_1.3.orig.tar.gz
 48b4fb49bbaca11cea7e96db32a7c110 2281 gnome optional 
gbackground_1.3-1.debian.tar.gz
 13076cd56f7766947e9e6b8547b1b9b9 14198 gnome optional gbackground_1.3-1_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQIcBAEBCAAGBQJMjjpeAAoJELs6aAGGSaoGAMEQALjCMWo0GTsysB4307RuESIW
usKaO+Q8FrmZAoP/NNfqDPcpFEk894H8LC4lItpx/6fJiKuBu5JeCNl3iYnM6nF9
sf+xp9e3xTcvE4v3THGsyhhBHIzW+Obnrl97ZEe0CqbYZfYHYWWoXSaGlv2HOawq
8vl4vRScHvOakCW8PCbcHiobG78ElkyQdJ11Fv4OrHgtqihLjSPqZOH8gyDt5jFe
2FEeTLuQ2H0P4hOlq+xMMo3zCrXKKldhNjmhE3f0t7whIdNZv4/z8Vmqt2rWiWcm
cu3pWHWY5CPvJT5rO941L0eJVALxQX0vM9H6XSRr3ZQ1NjJ1JB4BGUBrfCmWrgaG
xGoBOP7tpHstzSQ6qBNzyrq8G11XS2nHJxr6UWPWXqP8QJriVTJjoBfKTAzborB6
5tWL5L/eJx8rJSIkXAywsCx7WuvfvZhLGwiHCrlP43wNq6AhJSZOI0CwhI/7Re62
W4KeOwMWOxpmMp0eT+F0aESh/euFPThMUxT6Wqx3/vsEsVNCoLqe9R1+d22zZ+dX
ssAsEKSkDldsGGKe8gUNjRpjIC/PSL7Q0hDBJYXcFPciPEC/rg84WSyVCVJDJNOX
XBBrBiAfsnUvejgKF5kJstIuLtaAny0WORvO6cSKvlD04gwIBnQGdo5VFbRnZD6Z
0TVFyA/zDG+qnIdfPi7j
=4h3/
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to