Skip to content
This repository was archived by the owner on Jul 30, 2018. It is now read-only.

Commit 831d6f6

Browse files
committed
fix #37 inaccurate filesize display
1 parent f8276a0 commit 831d6f6

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Alluvion 0.3 (master/unreleased)
1+
# Alluvion 0.3 (20/05/2015)
22

33
* implement file_lengths / file_names for hash lookup tool
44
* check for newer version of Alluvion (Help> Check for updates)

alluvion-gtk.pl

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
# default user settings
6161
my %settings = (
6262
"timeout" => "10",
63-
"filesize_type" => "MB",
63+
"filesize_type" => "mb",
6464
"magnet_exec" => "/usr/bin/xdg-open",
6565
"proxy_enabled" => 0,
6666
"proxy_type" => "none",
@@ -925,13 +925,13 @@ sub on_menu_edit_preferences_activate {
925925
$builder->get_object( 'checkbutton_proxy' )->set_active(0);
926926
}
927927

928-
if ($settings{"filesize_type"} eq "Bytes") {
928+
if ($settings{"filesize_type"} eq "bytes") {
929929
$builder->get_object( 'radio_bytes' )->set_active(TRUE);
930-
} elsif ($settings{"filesize_type"} eq "KB") {
930+
} elsif ($settings{"filesize_type"} eq "kb") {
931931
$builder->get_object( 'radio_kb' )->set_active(TRUE);
932-
} elsif ($settings{"filesize_type"} eq "MB") {
932+
} elsif ($settings{"filesize_type"} eq "mb") {
933933
$builder->get_object( 'radio_mb' )->set_active(TRUE);
934-
} elsif ($settings{"filesize_type"} eq "GB") {
934+
} elsif ($settings{"filesize_type"} eq "gb") {
935935
$builder->get_object( 'radio_gb' )->set_active(TRUE);
936936
}
937937

@@ -969,10 +969,10 @@ sub on_button_pref_ok_clicked {
969969
$settings{"api_query"} = $builder->get_object( 'entry_apiquery' )->get_text();
970970
$settings{"api_file"} = $builder->get_object( 'entry_apifile' )->get_text();
971971

972-
if ($builder->get_object( 'radio_bytes' )->get_active() == TRUE ) { $settings{"filesize_type"} = "Bytes"; }
973-
if ($builder->get_object( 'radio_kb' )->get_active() == TRUE ) { $settings{"filesize_type"} = "KB"; }
974-
if ($builder->get_object( 'radio_mb' )->get_active() == TRUE ) { $settings{"filesize_type"} = "MB"; }
975-
if ($builder->get_object( 'radio_gb' )->get_active() == TRUE ) { $settings{"filesize_type"} = "GB"; }
972+
if ($builder->get_object( 'radio_bytes' )->get_active() == TRUE ) { $settings{"filesize_type"} = "bytes"; }
973+
if ($builder->get_object( 'radio_kb' )->get_active() == TRUE ) { $settings{"filesize_type"} = "kb"; }
974+
if ($builder->get_object( 'radio_mb' )->get_active() == TRUE ) { $settings{"filesize_type"} = "mb"; }
975+
if ($builder->get_object( 'radio_gb' )->get_active() == TRUE ) { $settings{"filesize_type"} = "gb"; }
976976

977977

978978
# check if we enabled/disabled the HTTP/HTTPS proxy option
@@ -1197,16 +1197,16 @@ ($)
11971197

11981198
no warnings;
11991199
given ($settings{"filesize_type"}) {
1200-
when (m/^KB/) {
1201-
return sprintf "%.2f KB",($bytes / 1024);
1200+
when (m/^kb/) {
1201+
return sprintf "%.2f kb",($bytes / 1000);
12021202
}
1203-
when (m/^MB$/) {
1204-
return sprintf "%.2f MB",($bytes / (1024 * 1024));
1203+
when (m/^mb$/) {
1204+
return sprintf "%.2f mb",($bytes / (1000 * 1000));
12051205
}
1206-
when (m/^GB$/) {
1207-
return sprintf "%.2f GB",($bytes / (1024 * 1024 * 1024));
1206+
when (m/^gb$/) {
1207+
return sprintf "%.2f gb",($bytes / (1000 * 1000 * 1000));
12081208
}
1209-
return $bytes . " Bytes";
1209+
return $bytes . " bytes";
12101210
}
12111211

12121212
}

data/alluvion.glade

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ http://github.com/jigoku/</property>
12521252
</child>
12531253
<child>
12541254
<object class="GtkRadioButton" id="radio_bytes">
1255-
<property name="label" translatable="yes">Bytes</property>
1255+
<property name="label" translatable="yes">bytes</property>
12561256
<property name="visible">True</property>
12571257
<property name="can_focus">True</property>
12581258
<property name="receives_default">False</property>
@@ -1267,7 +1267,7 @@ http://github.com/jigoku/</property>
12671267
</child>
12681268
<child>
12691269
<object class="GtkRadioButton" id="radio_kb">
1270-
<property name="label" translatable="yes">KB</property>
1270+
<property name="label" translatable="yes">kb</property>
12711271
<property name="visible">True</property>
12721272
<property name="can_focus">True</property>
12731273
<property name="receives_default">False</property>
@@ -1283,7 +1283,7 @@ http://github.com/jigoku/</property>
12831283
</child>
12841284
<child>
12851285
<object class="GtkRadioButton" id="radio_mb">
1286-
<property name="label" translatable="yes">MB</property>
1286+
<property name="label" translatable="yes">mb</property>
12871287
<property name="visible">True</property>
12881288
<property name="can_focus">True</property>
12891289
<property name="receives_default">False</property>
@@ -1299,7 +1299,7 @@ http://github.com/jigoku/</property>
12991299
</child>
13001300
<child>
13011301
<object class="GtkRadioButton" id="radio_gb">
1302-
<property name="label" translatable="yes">GB</property>
1302+
<property name="label" translatable="yes">gb</property>
13031303
<property name="visible">True</property>
13041304
<property name="can_focus">True</property>
13051305
<property name="receives_default">False</property>

0 commit comments

Comments
 (0)