aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Steiner <jimmac@gmail.com>2008-11-29 22:50:00 +0100
committerJakub Steiner <jimmac@gmail.com>2008-11-29 22:50:00 +0100
commit60e840ed36fa23fb32598a3538190a70b044dd32 (patch)
tree4091f52e6dad53501f5109bb77a7e68afd4a59b7
parentc80b899f5277b31af90809ff9798fcfd4746df7a (diff)
downloadoriginal-60e840ed36fa23fb32598a3538190a70b044dd32.tar.gz
original-60e840ed36fa23fb32598a3538190a70b044dd32.tar.bz2
Port webgallery.pl to gtk2. Submitted by Jan Girlich -- vollkorn freenet de
-rwxr-xr-xconvert/contrib/webgallery.pl55
1 files changed, 27 insertions, 28 deletions
diff --git a/convert/contrib/webgallery.pl b/convert/contrib/webgallery.pl
index d8a7ce7..f58471e 100755
--- a/convert/contrib/webgallery.pl
+++ b/convert/contrib/webgallery.pl
@@ -16,8 +16,8 @@
die "No files to convert" unless @ARGV;
-use Gtk;
-init Gtk;
+use Gtk2;
+init Gtk2;
@files = sort(@ARGV);
@@ -52,22 +52,22 @@ sub make_gallery_fake {
}
-$w = new Gtk::Window;
-$label = new Gtk::Label(' Web Gallery generation in progress... ');
-$pbar = new Gtk::ProgressBar;
-$vb = new Gtk::VBox(0, 0);
-$b = new Gtk::Button('Cancel');
+$w = new Gtk2::Window;
+$label = new Gtk2::Label(' Web Gallery generation in progress... ');
+$pbar = new Gtk2::ProgressBar;
+$vb = new Gtk2::VBox(0, 0);
+$b = new Gtk2::Button('Cancel');
$w->add($vb);
$vb->add($label);
$vb->add($pbar);
$vb->add($b);
-$b->signal_connect('clicked', sub {Gtk->exit(0)});
-$w->signal_connect('destroy', sub {Gtk->exit(0)});
+$b->signal_connect('clicked', sub {exit(1)});
+$w->signal_connect('destroy', sub {exit(1)});
$w->show_all();
$i = 0;
-$pbar->update($i);
+$pbar->set_fraction($i);
@files = sort(@ARGV);
$num_of_files = scalar @files;
@@ -84,49 +84,48 @@ close(METAXML);
foreach $file (@files) {
- $pbar->update($progress);
- $pbar->set_show_text(1);
- $pbar->set_format_string("$i of $num_of_files");
+ $pbar->set_fraction($progress);
+ $pbar->set_text("$i / $num_of_files");
$progress += $increment;
- while (Gtk->events_pending) {
- Gtk->main_iteration;
+ while (Gtk2->events_pending) {
+ Gtk2->main_iteration;
}
# do the stuff, collect error messages to a variable.
#$reply=`convert -geometry 120x120 -colors 64 -dither $file $dir/thumbs/img-$i\.png 2>&1`;
$reply=`convert -geometry 120x120 $file $dir/thumbs/img-$i\.jpg 2>&1`;
- #$reply =`jpegtopnm $file | pnmscale -xysize 120 120 | ppmquant -floyd 16 | pnmtopng -interlace -compression 9 > $dir/thumbs/img-$i\.png 2>&1`;
+ #$reply =`jpegtopnm $file | pnmscale -xysize 120 120 | ppmquant -floyd 16 | pnmtopng -interlace -compression 9 > $dir/thumbs/img-$i\.png 2>&1`;
- $pbar->update($progress);
+ $pbar->set_fraction($progress);
$progress += $increment;
- while (Gtk->events_pending) {
- Gtk->main_iteration;
+ while (Gtk2->events_pending) {
+ Gtk2->main_iteration;
}
$reply = $reply . `convert -geometry 640x640 $file $dir/lq/img-$i.jpg 2>&1`;
#$reply = $reply . `jpegtopnm $file | pnmscale -xysize 640 640 | ppmtojpeg --quality 80 --progressive > $dir/lq/img-$i.jpg 2>&1`;
- $pbar->update($progress);
+ $pbar->set_fraction($progress);
$progress += $increment;
- while (Gtk->events_pending) {
- Gtk->main_iteration;
+ while (Gtk2->events_pending) {
+ Gtk2->main_iteration;
}
$reply = $reply . `convert -geometry 800x800 $file $dir/mq/img-$i.jpg 2>&1`;
#$reply = $reply . `jpegtopnm $file | pnmscale -xysize 800 800 | ppmtojpeg --quality 80 --progressive > $dir/mq/img-$i.jpg 2>&1`;
- $pbar->update($progress);
+ $pbar->set_fraction($progress);
$progress += $increment;
- while (Gtk->events_pending) {
- Gtk->main_iteration;
+ while (Gtk2->events_pending) {
+ Gtk2->main_iteration;
}
$reply = $reply . `cp $file $dir/hq/img-$i.jpg 2>&1`;
- $pbar->update($progress);
+ $pbar->set_fraction($progress);
$progress += $increment;
- while (Gtk->events_pending) {
- Gtk->main_iteration;
+ while (Gtk2->events_pending) {
+ Gtk2->main_iteration;
}
# comment