How to list all the removable devices with DBus and UDisks2?

2020-08-22 Thread Adnan338 via Digitalmars-d-learn
Originally asked here: https://stackoverflow.com/questions/63537158/how-to-list-all-the-removable-devices-with-dbus-and-udisks2 I need to list, filter and open block devices with UDisks2. I am trying to list all the removable devices. The GetBlockDevices method provided by UDisks2 requires

How to specify a version from dub build command

2020-07-06 Thread adnan338 via Digitalmars-d-learn
I have a separate version for flatpak builds in my app. Let's say I have a large project that builds with dub that goes like this: import std.stdio; void main() { version (flatpak) { writeln(`Flatpak build`); } else { writeln("Edit source/app.d to

Re: How to send ownerTid into a parallel foreach loop?

2020-06-27 Thread adnan338 via Digitalmars-d-learn
On Saturday, 27 June 2020 at 07:31:56 UTC, Kagamin wrote: std.concurrency is for noninteractive appications, the approach with gui timer was the correct one. Thank you. That works but my progress bar is sometimes getting stuck because of a possible data race. See https://forum.dlang.org/post/

How to send ownerTid into a parallel foreach loop?

2020-06-26 Thread adnan338 via Digitalmars-d-learn
I have a list of files to download, and I want to download them in parallel. At the end of each of those parallel download I want to send the main thread a message from the parallel loop. import std.concurrency, std.parallelism; string[] files = ["a", "b", "c"]; void download(string[] links)

Re: GtkD code review - How to update a progressbar using data sharing concurrency

2020-06-21 Thread adnan338 via Digitalmars-d-learn
On Sunday, 21 June 2020 at 12:43:32 UTC, adnan338 wrote: On Sunday, 21 June 2020 at 09:16:06 UTC, Ali Çehreli wrote: On 6/20/20 9:30 AM, adnan338 wrote: > Hello, I need a code review on my strategy I don't know gtkd so I did not compile the code and I did not review the code very carefully.

Re: GtkD code review - How to update a progressbar using data sharing concurrency

2020-06-21 Thread adnan338 via Digitalmars-d-learn
On Sunday, 21 June 2020 at 09:16:06 UTC, Ali Çehreli wrote: On 6/20/20 9:30 AM, adnan338 wrote: > Hello, I need a code review on my strategy I don't know gtkd so I did not compile the code and I did not review the code very carefully. However, I don't think you need to 'synchronized' the who

GtkD code review - How to update a progressbar using data sharing concurrency

2020-06-20 Thread adnan338 via Digitalmars-d-learn
Hello, I need a code review on my strategy of updating a GtkD progressbar. Gtk is not thread safe, I interpret that as "I must only access data available in the main thread from the Gtk objects". This example is a simplified excerpt of my project. I have never done concurrency before and thus

How to create Multi Producer-Single Consumer concurrency

2020-06-12 Thread adnan338 via Digitalmars-d-learn
I have a list of files to download from the internet. Each of those downloads are a time consuming task. What I want to do is download them concurrently and when each of those downloads finish, I want to activate something in my main thread, which will update a progressbar in the GUI thread.

Re: Does std.net.curl: download have support for callbacks?

2020-06-10 Thread adnan338 via Digitalmars-d-learn
On Thursday, 11 June 2020 at 06:05:09 UTC, adnan338 wrote: I would like to set a callback for the `download()` function but I do not seem to find a way to add a callback to the procedure. [...] I have also been told that Gtk is not thread safe. What does this mean and does it effect me on t

Does std.net.curl: download have support for callbacks?

2020-06-10 Thread adnan338 via Digitalmars-d-learn
I would like to set a callback for the `download()` function but I do not seem to find a way to add a callback to the procedure. Let's say, for example I have a GtkD Widget called "pb" (short for progressBar). I want to download a file from a url and when done, I want a callback to access pb

Re: `this` template params for struct not expressing constness.

2020-06-08 Thread adnan338 via Digitalmars-d-learn
On Monday, 8 June 2020 at 08:10:19 UTC, Simen Kjærås wrote: On Monday, 8 June 2020 at 07:35:12 UTC, adnan338 wrote: Self* searchTree(this Self)(auto in ref T item) const { if (&this is null) return null; if (this.item == item) return &this; ret

`this` template params for struct not expressing constness.

2020-06-08 Thread adnan338 via Digitalmars-d-learn
Hi, as far as I understand, the `this` template parameter includes constness qualifiers as seen in https://ddili.org/ders/d.en/templates_more.html To apply this I have this following struct: module bst; struct Tree(T) { T item; Tree!T* parent, left, right; this(T item) {