Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Unused #293

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/DownloadRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,6 @@ namespace Gabut {
Idle.add (()=> { update_progress (); return GLib.Source.REMOVE;});
}

public void fraction_laucher () {
set_progress_visible.begin (progressbar.fraction);
}

private void action_dowload () {
status = status_aria (aria_tell_status (ariagid, TellStatus.STATUS));
if (status == StatusMode.ACTIVE) {
Expand Down
106 changes: 40 additions & 66 deletions src/GabutWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ namespace Gabut {
private Gtk.Label labelact;
private Gtk.Image modeview;
private int animation = 0;
private int allactive = 0;
private int limitcount = 0;
private int64 totalfiles = 0;
private int64 totalrecv = 0;
private bool removing = false;

SortBy _sorttype = null;
Expand Down Expand Up @@ -864,56 +868,9 @@ namespace Gabut {
listrow.add (row);
row.show ();
row.notify_property ("status");
row.notify["status"].connect (()=> {
switch (row.status) {
case StatusMode.PAUSED:
case StatusMode.COMPLETE:
case StatusMode.ERROR:
next_download ();
stop_launcher ();
remove_dbus.begin (row.rowbus);
break;
case StatusMode.WAIT:
case StatusMode.NOTHING:
remove_dbus.begin (row.rowbus);
break;
case StatusMode.ACTIVE:
if (!menudbus.get_exist (row.rowbus)) {
run_launcher ();
if (!active_downloader (row.ariagid)) {
append_dbus.begin (row.rowbus);
}
view_status ();
}
if (dbmenu) {
row.fraction_laucher ();
}
update_info ();
return;
}
view_status ();
update_info ();
});
if (list_box.get_selected_row () == null) {
list_box.select_row (row);
list_box.row_activated (row);
}
row.destroy.connect (()=> {
listrow.remove (row);
list_box.remove (row);
remove_dbus.begin (row.rowbus);
next_download ();
stop_launcher ();
view_status ();
});
row.update_agid.connect ((ariagid, newgid)=> update_agid (ariagid, newgid));
row.activedm.connect (activedm);
on_append (row);
}
});
listrow.sort (sort_dm);
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
update_info ();
view_status ();
}

public void add_url_box (string url, Gee.HashMap<string, string> options, bool later, int linkmode) {
Expand All @@ -926,6 +883,16 @@ namespace Gabut {
list_box.append (row);
listrow.add (row);
row.show ();
on_append (row);
if (!later) {
row.download ();
} else {
aria_pause (row.ariagid);
}
row.start_notif (later);
}

private void on_append (DownloadRow row) {
row.notify["status"].connect (()=> {
switch (row.status) {
case StatusMode.PAUSED:
Expand All @@ -940,17 +907,7 @@ namespace Gabut {
remove_dbus.begin (row.rowbus);
break;
case StatusMode.ACTIVE:
if (!menudbus.get_exist (row.rowbus)) {
run_launcher ();
if (!active_downloader (row.ariagid)) {
append_dbus.begin (row.rowbus);
}
view_status ();
}
if (dbmenu) {
row.fraction_laucher ();
}
update_info ();
on_active (row);
return;
}
view_status ();
Expand All @@ -970,18 +927,35 @@ namespace Gabut {
list_box.select_row (row);
list_box.row_activated (row);
}
if (!later) {
row.download ();
} else {
aria_pause (row.ariagid);
}
row.start_notif (later);
listrow.sort (sort_dm);
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
update_info ();
view_status ();
}

private void on_active (DownloadRow row) {
if (!menudbus.get_exist (row.rowbus)) {
run_launcher ();
if (!active_downloader (row.ariagid)) {
append_dbus.begin (row.rowbus);
}
view_status ();
}
if (limitcount >= allactive) {
double fraction = (double) totalrecv / (double) totalfiles;
if (fraction > 0.0) {
if (dbmenu) {
set_progress_visible.begin (fraction);
}
}
update_info ();
totalfiles = totalrecv = limitcount = 0;
}
totalrecv = totalrecv + row.transferred;
totalfiles = totalfiles + row.totalsize;
limitcount++;
}

public int activedm () {
int count = 0;
listrow.foreach ((row)=> {
Expand All @@ -995,7 +969,7 @@ namespace Gabut {

private void update_info () {
var infol = aria_label_info ();
var allactive = int64.parse (infol.fetch (2));
allactive = int.parse (infol.fetch (2));
download_rate.label = GLib.format_size (allactive > 0? int64.parse (infol.fetch (1)) : 0);
upload_rate.label = GLib.format_size (allactive > 0? int64.parse (infol.fetch (6)) : 0);
labelact.label = allactive.to_string ();
Expand Down
Loading