GNOME Bugzilla – Bug 608842
when adding a new ticker, user has to specify label
Last modified: 2018-03-12 12:45:47 UTC
Created attachment 152887 [details] [review] retrieve label automatically when pressing the add button in the preferences dialog, a new row is created with ticker 'GOOG' and label 'Google Inc.', the user should change both the ticker and label accordingly. With this patch the label is automatically retrieved from yahoo, after the user enters the ticker
Review of attachment 152887 [details] [review]: Nice patch. It does the job. However, the code has to make sure that on a slow internet connection, the retrieved label does not overwrite a user's label just entered after setting the symbol. Maybe, once the label field of a stock gets modified, the name resolver should be stopped, or its result should be discarded if the user currently enters / already entered a label.
Created attachment 153702 [details] [review] retrieve ticker label automatically, cancel if user edits field in the meantime now the retrieve process is cancelled if the user edits the label field before it is updated
it would be nice to add a spinning icon or something like that so that the user notices that the label is updating automatically
Created attachment 165481 [details] [review] updated version of the automatic stock name retriever Thanks for the patch. I updated it so it works with git head. Though it handles the "user changed the label in the meantime", it still leaves some serious states unhandled: - when label of existing stock is modified, this gives exception, since NameResolver is None then - name retriever are never removed from the store - when a new name retriever is created, a possibly existing one has to be cancelled and dropped first - only retrieve the name when the symbol is really changed, otherwise existing (possibly user-entered) label will be overwritten These are all fixed in the new patch. still open issues - removing a stock that has a running name retriever causes a segfault or at least exception when name is retrieved and the store is to be updated (the respective row is not existing anymore) This could be fixed in two ways: - make sure the store_path is still valid when updating the label - cancel the name retriever before removing a stock I am not too familiar with the path and iterator of the liststore wrapping treeview. I also do not know how to check if the store_path of the liststore is still valid. I guess it is easier for you to fix the problem at any of the two locations.
A further bug that I just recognized, due to a feature of Yahoo, that can be exploited via the name retriever is the following: - add YHOO.DE stock - the applet will retrieve data for YHO.DE, which it then does not know where in the store to put them - this will cause an exception and no stock information can be retrieved and displayed The solution would be to check when the name retriever recieves the data if the symbol changed, and correct the respective value in the store. This should be done even if the retriever was cancelled, because a wrong symbol will break everything and the cancellation does only hold for the label. It will be problematic if someone changes the symbol and then changes it again while the first retriever did not finish. Since the retriever knows the original symbol, it can check if there is still that symbol in the store.
the latter bug is fixed in http://git.gnome.org/browse/gnome-applets/commit/?id=9be66818e7b75df4db86b88154c7df47afda9a79
Invest applet has been removed because Yahoo Finance API is no longer available.