diff --git a/data/com.github.gabutakut.gabutdm.appdata.xml.in b/data/com.github.gabutakut.gabutdm.appdata.xml.in index 6606ace..8b5e7b2 100644 --- a/data/com.github.gabutakut.gabutdm.appdata.xml.in +++ b/data/com.github.gabutakut.gabutdm.appdata.xml.in @@ -31,12 +31,13 @@ com.github.gabutakut.gabutdm - +

Replace Treeview to Listbox

Remove and replace Deprecated library

Adwaita style

Fix

+

Optimize Download Menu

diff --git a/meson.build b/meson.build index f26b8fe..2b71ae9 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project ('com.github.gabutakut.gabutdm','vala', 'c', version: '2.2.9') +project ('com.github.gabutakut.gabutdm','vala', 'c', version: '2.5.0') i18n = import ('i18n') diff --git a/src/Application.vala b/src/Application.vala index b693415..bc2762a 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -166,12 +166,12 @@ namespace Gabut { gabutwindow.remove_item (status); }); gdm_theme.begin (); - set_dbsetting (Gabut.DBSettings.THEMESYSTEM, Gtk.Settings.get_default ().gtk_theme_name); gabutwindow.load_dowanload (); download_table (); if (!startingup && !dontopen) { open_now (); } + lastclipboard = get_dbsetting (Gabut.DBSettings.LASTCLIPBOARD); clipboard = Gdk.Display.get_default ().get_clipboard (); Timeout.add_seconds (1, on_clipboard); } else { @@ -386,7 +386,7 @@ namespace Gabut { if (textclip != null && textclip != "" && textclip != lastclipboard) { if (!url_active (textclip.strip ())) { if (!dialog_url (textclip.strip ())) { - lastclipboard = textclip; + lastclipboard = set_dbsetting (Gabut.DBSettings.LASTCLIPBOARD, textclip); } } } diff --git a/src/DownloadRow.vala b/src/DownloadRow.vala index fcf801b..651d4c2 100644 --- a/src/DownloadRow.vala +++ b/src/DownloadRow.vala @@ -453,18 +453,13 @@ namespace Gabut { } public void start_notif () { - if (linkmode == LinkMode.TORRENT) { - notify_app (_("Starting"), - _("Torrent"), new ThemedIcon ("com.github.gabutakut.gabutdm.torrent")); - } else if (linkmode == LinkMode.METALINK) { - notify_app (_("Starting"), - _("Metalink"), new ThemedIcon ("com.github.gabutakut.gabutdm.metalink")); - } else if (linkmode == LinkMode.MAGNETLINK) { - notify_app (_("Starting"), url, new ThemedIcon ("com.github.gabutakut.gabutdm.magnet")); - } else { - notify_app (_("Starting"), url, new ThemedIcon ("com.github.gabutakut.gabutdm.insertlink")); - } - play_sound ("device-added"); + Idle.add (()=> { + if (status != StatusMode.ERROR) { + notify_app (_("Starting"), filename, imagefile.gicon); + play_sound ("device-added"); + } + return false; + }); } public void idle_progress () { @@ -648,10 +643,10 @@ namespace Gabut { if (url.has_prefix ("magnet:?")) { gabutinfo.set_info (url, InfoSucces.ADDRESS); } else { - gabutinfo.set_info ("File Torrent", InfoSucces.ADDRESS); + gabutinfo.set_info (filename, InfoSucces.ADDRESS); } } else if (linkmode == LinkMode.METALINK) { - gabutinfo.set_info ("File Metalink", InfoSucces.ADDRESS); + gabutinfo.set_info (filename, InfoSucces.ADDRESS); } else { gabutinfo.set_info (url, InfoSucces.ADDRESS); } diff --git a/src/GabutWindow.vala b/src/GabutWindow.vala index b0e0c17..fc9b84c 100644 --- a/src/GabutWindow.vala +++ b/src/GabutWindow.vala @@ -36,7 +36,7 @@ namespace Gabut { private Gtk.SearchEntry search_entry; private ModeButton view_mode; private AlertView nodown_alert; - private GLib.List properties; + private Gee.ArrayList properties; private Gee.ArrayList listrow; private DbusmenuItem menudbus; private DbusmenuItem openmenu; @@ -520,7 +520,7 @@ namespace Gabut { margin_start = 6, tooltip_text = _("Property") }; - properties = new GLib.List (); + properties = new Gee.ArrayList (); list_box.row_selected.connect ((rw)=> { if (rw != null) { var row = (DownloadRow) rw; @@ -531,23 +531,19 @@ namespace Gabut { transient_for = this, row = row }; - properties.append (property); + properties.add (property); property.save_button.clicked.connect (()=> { row = property.row; }); property.close.connect (()=> { - properties.foreach ((proper)=> { - if (proper == property) { - properties.delete_link (properties.find (proper)); - } - }); + if (properties.contains (property)) { + properties.remove (property); + } }); property.close_request.connect (()=> { - properties.foreach ((proper)=> { - if (proper == property) { - properties.delete_link (properties.find (proper)); - } - }); + if (properties.contains (property)) { + properties.remove (property); + } return false; }); property.update_agid.connect ((ariagid, newgid)=> { @@ -589,6 +585,17 @@ namespace Gabut { return actionbar; } + private bool property_active (DownloadRow row) { + bool active = false; + properties.foreach ((propet)=> { + if (propet.row == row) { + active = true; + } + return true; + }); + return active; + } + public Gtk.Popover get_menu () { var sort_flow = new Gtk.FlowBox (); showtime = new Gtk.CheckButton.with_label (_("Time")) { @@ -760,16 +767,6 @@ namespace Gabut { } } - private bool property_active (DownloadRow row) { - bool active = false; - properties.foreach ((propet)=> { - if (propet.row == row) { - active = true; - } - }); - return active; - } - public void save_all_download () { var downloads = new GLib.List (); listrow.foreach ((row)=> { diff --git a/src/Preferences.vala b/src/Preferences.vala index b9f92cb..176eb7a 100644 --- a/src/Preferences.vala +++ b/src/Preferences.vala @@ -743,6 +743,13 @@ namespace Gabut { active = bool.parse (pharse_options (pack_data, AriaOptions.AUTO_FILE_RENAMING)) }; + var optimdw = new Gtk.CheckButton.with_label (_("Optimizes the number of concurrent downloads")) { + margin_top = 5, + width_request = 450, + active = bool.parse (pharse_options (pack_data, AriaOptions.OPTIMIZE_CONCURRENT_DOWNLOADS)), + tooltip_text = _("Optimizes the number of concurrent downloads according to the bandwidth available") + }; + var style_mode = new ModeTogle (); style_mode.add_item (new ModeTogle.with_label (_("System Default"))); style_mode.add_item (new ModeTogle.with_label (_("Light"))); @@ -773,6 +780,7 @@ namespace Gabut { notifyopt.attach (headerlabel (_("File Download:"), 450), 0, 16, 1, 1); notifyopt.attach (allowrepl, 0, 17, 1, 1); notifyopt.attach (autorename, 0, 18, 1, 1); + notifyopt.attach (optimdw, 0, 19, 1, 1); label_mode.sensitive = dbusmenu.active && menuindicator.active; var notyscr = new Gtk.ScrolledWindow () { @@ -846,6 +854,7 @@ namespace Gabut { aria_set_globalops (AriaOptions.LOWEST_SPEED_LIMIT, set_dbsetting (DBSettings.LOWESTSPEED, (lowestspd.value * 1024).to_string ())); aria_set_globalops (AriaOptions.URI_SELECTOR, set_dbsetting (DBSettings.URISELECTOR, uriselector.selector.to_string ().down ())); aria_set_globalops (AriaOptions.STREAM_PIECE_SELECTOR, set_dbsetting (DBSettings.PIECESELECTOR, pieceselector.selector.to_string ().down ())); + aria_set_globalops (AriaOptions.OPTIMIZE_CONCURRENT_DOWNLOADS, set_dbsetting (DBSettings.OPTIMIZEDOW, optimdw.active.to_string ())); set_dbsetting (DBSettings.RPCPORT, rpc_port.value.to_string ()); set_dbsetting (DBSettings.RPCSIZE, maxrequest.value.to_string ()); set_dbsetting (DBSettings.DISKCACHE, diskcache.value.to_string ()); diff --git a/src/QrCode.vala b/src/QrCode.vala index 5ef6634..a83608e 100644 --- a/src/QrCode.vala +++ b/src/QrCode.vala @@ -85,16 +85,15 @@ namespace Gabut { var header = get_header_bar (); header.title_widget = header_grid; header.decoration_layout = "none"; - + qrpaint = new QrcodePaint (); var imageqr = new Gtk.Image () { halign = Gtk.Align.START, valign = Gtk.Align.START, pixel_size = 256, margin_start = 10, - margin_end = 10 + margin_end = 10, + paintable = qrpaint }; - qrpaint = new QrcodePaint (); - imageqr.paintable = qrpaint; qrpaint.queue_draw.connect (imageqr.queue_draw); linkbutton = new Gtk.LinkButton (""); diff --git a/src/TorrentRow.vala b/src/TorrentRow.vala index 9f45381..e03ee46 100644 --- a/src/TorrentRow.vala +++ b/src/TorrentRow.vala @@ -175,13 +175,12 @@ namespace Gabut { valign = Gtk.Align.CENTER, attributes = color_attribute (60000, 0, 0) }; - + progrespaint = new ProgressPaintable (); var progresimg = new Gtk.Image () { + paintable = progrespaint, valign = Gtk.Align.CENTER, width_request = 20 }; - progrespaint = new ProgressPaintable (); - progresimg.paintable = progrespaint; progrespaint.queue_draw.connect (progresimg.queue_draw); persenlabel = new Gtk.Label (null) { diff --git a/src/Utils.vala b/src/Utils.vala index 9ddcdfc..a2cf850 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -70,7 +70,8 @@ namespace Gabut { LABELMODE = 46, THEMESELECT = 47, THEMECUSTOM = 48, - THEMESYSTEM = 49; + LASTCLIPBOARD = 49, + OPTIMIZEDOW = 50; public string to_string () { switch (this) { @@ -170,8 +171,10 @@ namespace Gabut { return "themeselect"; case THEMECUSTOM: return "themecustom"; - case THEMESYSTEM: - return "themesystem"; + case LASTCLIPBOARD: + return "lastclipboard"; + case OPTIMIZEDOW: + return "optimizedow"; default: return "id"; } @@ -2061,6 +2064,9 @@ namespace Gabut { if (get_dbsetting (DBSettings.PIECESELECTOR) != aria_get_option (ariagid, AriaOptions.STREAM_PIECE_SELECTOR)) { aria_set_option (ariagid, AriaOptions.STREAM_PIECE_SELECTOR, get_dbsetting (DBSettings.PIECESELECTOR)); } + if (get_dbsetting (DBSettings.OPTIMIZEDOW) != aria_get_option (ariagid, AriaOptions.OPTIMIZE_CONCURRENT_DOWNLOADS)) { + aria_set_option (ariagid, AriaOptions.OPTIMIZE_CONCURRENT_DOWNLOADS, get_dbsetting (DBSettings.OPTIMIZEDOW)); + } } private void set_startup () { @@ -2127,6 +2133,9 @@ namespace Gabut { do { aria_set_globalops (AriaOptions.STREAM_PIECE_SELECTOR, get_dbsetting (DBSettings.PIECESELECTOR)); } while (get_dbsetting (DBSettings.PIECESELECTOR) != aria_get_globalops (AriaOptions.STREAM_PIECE_SELECTOR)); + do { + aria_set_globalops (AriaOptions.OPTIMIZE_CONCURRENT_DOWNLOADS, get_dbsetting (DBSettings.OPTIMIZEDOW)); + } while (get_dbsetting (DBSettings.OPTIMIZEDOW) != aria_get_globalops (AriaOptions.OPTIMIZE_CONCURRENT_DOWNLOADS)); } private async void boot_strap () throws Error { @@ -2790,13 +2799,14 @@ namespace Gabut { labelmode TEXT NOT NULL, themeselect TEXT NOT NULL, themecustom TEXT NOT NULL, - themesystem TEXT NOT NULL); - INSERT INTO settings (id, rpcport, maxtries, connserver, timeout, dir, retry, rpcsize, btmaxpeers, diskcache, maxactive, bttimeouttrack, split, maxopenfile, dialognotif, systemnotif, onbackground, iplocal, portlocal, seedtime, overwrite, autorenaming, allocation, startup, style, uploadlimit, downloadlimit, btlistenport, dhtlistenport, bttracker, bttrackerexc, splitsize, lowestspeed, uriselector, pieceselector, clipboard, sharedir, switchdir, sortby, ascedescen, showtime, showdate, dbusmenu, tdefault, notifsound, menuindicator, labelmode, themeselect, themecustom, themesystem) - VALUES (1, \"6807\", \"5\", \"6\", \"60\", \"$(dir.replace ("/", "\\/"))\", \"0\", \"2097152\", \"55\", \"16777216\", \"5\", \"60\", \"5\", \"100\", \"true\", \"true\", \"true\", \"true\", \"2021\", \"0\", \"false\", \"false\", \"None\", \"true\", \"1\", \"128000\", \"0\", \"21301\", \"26701\", \"\", \"\", \"20971520\", \"0\", \"feedback\", \"default\", \"true\", \"$(dir)\", \"false\", \"0\", \"0\", \"false\", \"false\", \"false\", \"false\", \"false\", \"false\", \"0\", \"0\" ,\"Breeze\", \"\");"); + lastclipboard TEXT NOT NULL, + optimizedow TEXT NOT NULL); + INSERT INTO settings (id, rpcport, maxtries, connserver, timeout, dir, retry, rpcsize, btmaxpeers, diskcache, maxactive, bttimeouttrack, split, maxopenfile, dialognotif, systemnotif, onbackground, iplocal, portlocal, seedtime, overwrite, autorenaming, allocation, startup, style, uploadlimit, downloadlimit, btlistenport, dhtlistenport, bttracker, bttrackerexc, splitsize, lowestspeed, uriselector, pieceselector, clipboard, sharedir, switchdir, sortby, ascedescen, showtime, showdate, dbusmenu, tdefault, notifsound, menuindicator, labelmode, themeselect, themecustom, lastclipboard, optimizedow) + VALUES (1, \"6807\", \"5\", \"6\", \"60\", \"$(dir.replace ("/", "\\/"))\", \"0\", \"2097152\", \"55\", \"16777216\", \"5\", \"60\", \"5\", \"100\", \"true\", \"true\", \"true\", \"true\", \"2021\", \"0\", \"false\", \"false\", \"None\", \"true\", \"1\", \"128000\", \"0\", \"21301\", \"26701\", \"\", \"\", \"20971520\", \"0\", \"feedback\", \"default\", \"true\", \"$(dir)\", \"false\", \"0\", \"0\", \"false\", \"false\", \"false\", \"false\", \"false\", \"false\", \"0\", \"0\" ,\"Breeze\", \"\", \"false\");"); } private void settings_table () { - if ((db_get_cols ("settings") - 1) != DBSettings.THEMESYSTEM) { + if ((db_get_cols ("settings") - 1) != DBSettings.OPTIMIZEDOW) { gabutdb.exec ("DROP TABLE settings;"); table_settings (gabutdb); }