Skip to content

Commit

Permalink
Merge pull request #266 from torikulhabib/master
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
torikulhabib authored Jun 19, 2024
2 parents 00f5b7a + f3b631a commit ddc44bf
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 81 deletions.
2 changes: 1 addition & 1 deletion data/com.github.gabutakut.gabutdm.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<binary>com.github.gabutakut.gabutdm</binary>
</provides>
​ <releases>
<release version="2.2.5" date="2024-6-19">
<release version="2.2.6" date="2024-6-19">
<description>
<p>Replace Treeview to Listbox</p>
<p>Remove and replace Deprecated library</p>
Expand Down
2 changes: 1 addition & 1 deletion data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ actions = [
'.cookie.svg',
'.opt.svg',
'.menu.svg',
'.onactive.svg',
'.onactive.svg'
]

foreach m : actions
Expand Down
73 changes: 30 additions & 43 deletions src/AddUrl.vala
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,8 @@ namespace Gabut {

method_flow = new Gtk.FlowBox ();
var method_popover = new Gtk.Popover () {
position = Gtk.PositionType.TOP,
width_request = 70,
child = method_flow
};
method_popover.show.connect (() => {
if (proxymethod != null) {
method_flow.select_child (proxymethod);
proxymethod.grab_focus ();
}
});
prometh_button = new Gtk.MenuButton () {
popover = method_popover
};
Expand All @@ -339,23 +331,20 @@ namespace Gabut {
}
method_flow.show ();
method_flow.child_activated.connect ((method)=> {
((Gtk.Label)((ProxyMethod) proxymethod).get_last_child ()).attributes = set_attribute (Pango.Weight.BOLD);
proxymethod = method as ProxyMethod;
((Gtk.Label)proxymethod.get_last_child ()).attributes = color_attribute (0, 60000, 0);
method_popover.hide ();
});
proxymethod = method_flow.get_child_at_index (0) as ProxyMethod;

((Gtk.Label)proxymethod.get_last_child ()).attributes = color_attribute (0, 60000, 0);
method_popover.show.connect (() => {
method_flow.unselect_all ();
});
type_flow = new Gtk.FlowBox ();
var type_popover = new Gtk.Popover () {
position = Gtk.PositionType.TOP,
width_request = 70,
child = type_flow
};
type_popover.show.connect (() => {
if (proxytype != null) {
type_flow.select_child (proxytype);
proxytype.grab_focus ();
}
});
type_button = new Gtk.MenuButton () {
popover = type_popover
};
Expand All @@ -364,11 +353,16 @@ namespace Gabut {
}
type_flow.show ();
type_flow.child_activated.connect ((typepr)=> {
((Gtk.Label)((ProxyType) proxytype).get_last_child ()).attributes = set_attribute (Pango.Weight.BOLD);
proxytype = typepr as ProxyType;
((Gtk.Label)proxytype.get_last_child ()).attributes = color_attribute (0, 60000, 0);
type_popover.hide ();
});
proxytype = type_flow.get_child_at_index (0) as ProxyType;

((Gtk.Label)proxytype.get_last_child ()).attributes = color_attribute (0, 60000, 0);
type_popover.show.connect (() => {
type_flow.unselect_all ();
});
proxy_entry = new MediaEntry ("com.github.gabutakut.gabutdm.gohome", "edit-paste") {
width_request = 250,
placeholder_text = _("Address")
Expand Down Expand Up @@ -408,16 +402,8 @@ namespace Gabut {

login_flow = new Gtk.FlowBox ();
var login_popover = new Gtk.Popover () {
position = Gtk.PositionType.TOP,
width_request = 70,
child = login_flow
};
login_popover.show.connect (() => {
if (loginuser != null) {
login_flow.select_child (loginuser);
loginuser.grab_focus ();
}
});
login_button = new Gtk.MenuButton () {
tooltip_text = _("FTP/HTTP download with username and password"),
popover = login_popover
Expand All @@ -428,11 +414,16 @@ namespace Gabut {
login_flow.show ();

login_flow.child_activated.connect ((logn)=> {
((Gtk.Label)((LoginUser) loginuser).get_last_child ()).attributes = set_attribute (Pango.Weight.BOLD);
loginuser = logn as LoginUser;
((Gtk.Label)loginuser.get_last_child ()).attributes = color_attribute (0, 60000, 0);
login_popover.hide ();
});
loginuser = login_flow.get_child_at_index (0) as LoginUser;

((Gtk.Label)loginuser.get_last_child ()).attributes = color_attribute (0, 60000, 0);
login_popover.show.connect (() => {
login_flow.unselect_all ();
});
loguser_entry = new MediaEntry ("avatar-default", "edit-paste") {
width_request = 350,
placeholder_text = _("User")
Expand Down Expand Up @@ -476,16 +467,8 @@ namespace Gabut {

checksums_flow = new Gtk.FlowBox ();
var checksums_popover = new Gtk.Popover () {
position = Gtk.PositionType.TOP,
width_request = 70,
child = checksums_flow
};
checksums_popover.show.connect (() => {
if (checksumtype != null) {
checksums_flow.select_child (checksumtype);
checksumtype.grab_focus ();
}
});
checksum_button = new Gtk.MenuButton () {
tooltip_text = _("TYPE is hash type"),
popover = checksums_popover
Expand All @@ -500,11 +483,17 @@ namespace Gabut {
placeholder_text = _("Hash")
};
checksums_flow.child_activated.connect ((checksum)=> {
((Gtk.Label)((ChecksumType) checksumtype).get_last_child ()).attributes = set_attribute (Pango.Weight.BOLD);
checksumtype = checksum as ChecksumType;
((Gtk.Label)checksumtype.get_last_child ()).attributes = color_attribute (0, 60000, 0);
checksums_popover.hide ();
});
checksumtype = checksums_flow.get_child_at_index (0) as ChecksumType;
((Gtk.Label)checksumtype.get_last_child ()).attributes = color_attribute (0, 60000, 0);

checksums_popover.show.connect (() => {
checksums_flow.unselect_all ();
});
var checksumgrid = new Gtk.Grid () {
height_request = 130,
halign = Gtk.Align.CENTER,
Expand All @@ -528,17 +517,9 @@ namespace Gabut {

encrypt_flow = new Gtk.FlowBox ();
var encrypt_popover = new Gtk.Popover () {
width_request = 70,
child = encrypt_flow
};
encrypt_popover.show.connect (() => {
if (btencrypt != null) {
encrypt_flow.select_child (btencrypt);
btencrypt.grab_focus ();
}
});
encrypt_button = new Gtk.MenuButton () {
direction = Gtk.ArrowType.UP,
popover = encrypt_popover
};
foreach (var encrp in BTEncrypts.get_all ()) {
Expand All @@ -547,11 +528,17 @@ namespace Gabut {
encrypt_flow.show ();

encrypt_flow.child_activated.connect ((encrp)=> {
((Gtk.Label)((BTEncrypt) btencrypt).get_last_child ()).attributes = set_attribute (Pango.Weight.BOLD);
btencrypt = encrp as BTEncrypt;
((Gtk.Label)btencrypt.get_last_child ()).attributes = color_attribute (0, 60000, 0);
encrypt_popover.hide ();
});
btencrypt = encrypt_flow.get_child_at_index (0) as BTEncrypt;
((Gtk.Label)btencrypt.get_last_child ()).attributes = color_attribute (0, 60000, 0);

encrypt_popover.show.connect (() => {
encrypt_flow.unselect_all ();
});
encrypt = new Gtk.CheckButton.with_label (_("BT Require Crypto")) {
tooltip_text = _("Aria2 doesn't accept and establish connection with legacy BitTorrent handshake"),
width_request = 350,
Expand Down
3 changes: 2 additions & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ namespace Gabut {
protected override void activate () {
if (gabutwindow == null) {
if (open_database (out gabutdb) != Sqlite.OK) {
notify_app (_("Database Error"), _("Can't open database: %s\n").printf (gabutdb.errmsg ()), new ThemedIcon ("office-database"));
notify_app (_("Database Error"),
_("Can't open database: %s\n").printf (gabutdb.errmsg ()), new ThemedIcon ("office-database"));
play_sound ("dialog-error");
}
settings_table ();
Expand Down
11 changes: 1 addition & 10 deletions src/ModeButton.vala
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,9 @@ namespace Gabut {
return index;
}

private void clear_selected () {
_selected = -1;
foreach (var item in item_map.values) {
if (item != null && item.active) {
item.set_active (false);
}
}
}

public void set_active (int new_active_index) {
if (new_active_index <= -1) {
clear_selected ();
_selected = -1;
return;
}
var new_item = item_map[new_active_index] as Item;
Expand Down
46 changes: 21 additions & 25 deletions src/Preferences.vala
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,9 @@ namespace Gabut {

var stream_flow = new Gtk.FlowBox ();
var stream_popover = new Gtk.Popover () {
width_request = 70,
child = stream_flow
};
stream_popover.show.connect (() => {
if (pieceselector != null) {
stream_flow.select_child (pieceselector);
pieceselector.grab_focus ();
}
});

piecesel_button = new Gtk.MenuButton () {
direction = Gtk.ArrowType.UP,
tooltip_text = _("Specify piece selection algorithm used in HTTP/FTP download"),
Expand All @@ -192,27 +186,26 @@ namespace Gabut {
}
stream_flow.show ();
stream_flow.child_activated.connect ((piecesel)=> {
((Gtk.Label)((PieceSelector) pieceselector).get_last_child ()).attributes = set_attribute (Pango.Weight.BOLD);
pieceselector = piecesel as PieceSelector;
((Gtk.Label)pieceselector.get_last_child ()).attributes = color_attribute (0, 60000, 0);
stream_popover.hide ();
});
for (int a = 0; a <= PieceSelectors.GEOM; a++) {
var piecesel = stream_flow.get_child_at_index (a);
if (((PieceSelector) piecesel).selector.to_string ().down () == pharse_options (pack_data, AriaOptions.STREAM_PIECE_SELECTOR)) {
pieceselector = piecesel as PieceSelector;
((Gtk.Label)pieceselector.get_last_child ()).attributes = color_attribute (0, 60000, 0);
}
}

stream_popover.show.connect (() => {
stream_flow.unselect_all ();
});
var urisel_flow = new Gtk.FlowBox ();
var urisel_popover = new Gtk.Popover () {
width_request = 70,
child = urisel_flow
};
urisel_popover.show.connect (() => {
if (uriselector != null) {
urisel_flow.select_child (uriselector);
uriselector.grab_focus ();
}
});

urisel_button = new Gtk.MenuButton () {
direction = Gtk.ArrowType.UP,
tooltip_text = _("Specify URI selection algorithm"),
Expand All @@ -223,16 +216,21 @@ namespace Gabut {
}
urisel_flow.show ();
urisel_flow.child_activated.connect ((urisel)=> {
((Gtk.Label)((UriSelector) uriselector).get_last_child ()).attributes = set_attribute (Pango.Weight.BOLD);
uriselector = urisel as UriSelector;
((Gtk.Label)uriselector.get_last_child ()).attributes = color_attribute (0, 60000, 0);
urisel_popover.hide ();
});
for (int a = 0; a <= UriSelectors.ADAPTIVE; a++) {
var urisel = urisel_flow.get_child_at_index (a);
if (((UriSelector) urisel).selector.to_string ().down () == pharse_options (pack_data, AriaOptions.URI_SELECTOR)) {
uriselector = urisel as UriSelector;
((Gtk.Label)uriselector.get_last_child ()).attributes = color_attribute (0, 60000, 0);
}
}

urisel_popover.show.connect (() => {
urisel_flow.unselect_all ();
});
var settings = new Gtk.Grid () {
column_homogeneous = true,
height_request = 150,
Expand Down Expand Up @@ -586,16 +584,9 @@ namespace Gabut {

var allocate_flow = new Gtk.FlowBox ();
var allocate_popover = new Gtk.Popover () {
position = Gtk.PositionType.TOP,
width_request = 70,
child = allocate_flow
};
allocate_popover.show.connect (() => {
if (fileallocation != null) {
allocate_flow.select_child (fileallocation);
fileallocation.grab_focus ();
}
});

allocate_button = new Gtk.MenuButton () {
tooltip_text = _("Specify file allocation method"),
popover = allocate_popover
Expand All @@ -605,16 +596,21 @@ namespace Gabut {
}
allocate_flow.show ();
allocate_flow.child_activated.connect ((allocate)=> {
((Gtk.Label)((FileAllocation) fileallocation).get_last_child ()).attributes = set_attribute (Pango.Weight.BOLD);
fileallocation = allocate as FileAllocation;
((Gtk.Label)fileallocation.get_last_child ()).attributes = color_attribute (0, 60000, 0);
allocate_popover.hide ();
});
for (int a = 0; a <= FileAllocations.FALLOC; a++) {
var allocate = allocate_flow.get_child_at_index (a);
if (((FileAllocation) allocate).fileallocation.to_string ().down () == pharse_options (pack_data, AriaOptions.FILE_ALLOCATION)) {
fileallocation = allocate as FileAllocation;
((Gtk.Label)fileallocation.get_last_child ()).attributes = color_attribute (0, 60000, 0);
}
}

allocate_popover.show.connect (() => {
allocate_flow.unselect_all ();
});
var moreoptions = new Gtk.Grid () {
column_homogeneous = true,
height_request = 150,
Expand Down

0 comments on commit ddc44bf

Please sign in to comment.