GNOME Bugzilla – Bug 682175
gnome-online-accounts shows "No online accounts configured" when there are online accounts configured
Last modified: 2012-08-21 17:24:34 UTC
If I go into gnome-online-accounts and 1) Add an account 2) Remove the account without touching the list then it shows me the "No online accounts configured" overlay even though a previous account is still in the list.
Created attachment 221724 [details] [review] online-accounts: stop bogus "No online accounts configured" message If an account is added and then quickly removed, the panel will think all accounts are removed and show the "No online accounts configured" dialog. This seems to be a bug in gtk+ where gtk_tree_selection_select_iter updates the visible selection, but fails to update all of the tree view's internal state, such that when that row later gets removed selection gets cleared instead of moved. This commit changes all gtk_tree_selection_select_iter calls to gtk_tree_view_set_cursor calls, which seems to work around the issue for now.
actually, thinking about this more, using the selection isn't really conceptually right anyway. We should instead look and see if there are items in the list. I think maybe we should: 1) use if (gtk_tree_model_get_iter_first()) to poll when the list has items 2) When it has items poll on "row-deleted" to find out when it no longer has items 3) When it doesn't have items poll on 'row-inserted' to know when it gets them.
Thanks for filing this bug. I had seen a similar outcome before but not due to the same reasons. You basically end up in the same situation if some restarts the daemon while the control-center panel is being shown. While your patch solves your case, it does not fix this other case. Not sure how related they are. /me investigates further
I think the proposal in comment 2 has a strong chance of fixing the issue, though I haven't tried it yet. It's on my todo list of things to look into though.
Created attachment 222035 [details] [review] online-accounts: Don't show spurious "No online accounts configured"
Review of attachment 222035 [details] [review]: hmm, why is the root question "has selected item?" and not "has item?". We're asking the wrong question I think. Certainly the overlay only works if there are no items (not no selected items).
(In reply to comment #6) > Review of attachment 222035 [details] [review]: > > hmm, why is the root question "has selected item?" and not "has item?". We're > asking the wrong question I think. Certainly the overlay only works if there > are no items (not no selected items). Connecting to the row-inserted signal fixes the case where you restart the daemon. When the daemon restarts and the accounts reappear on the bus, we don't want to set the selection every time. Essentially we just set the selection only for the first insertion.
Also, on_tree_view_selection_changed assumes that if the model is non-empty then something is selected. I am just trying to satisfy that invariant.
ah okay
<halfline> yea go 4 it ... <hadess> do what you want, i'll come get you if it breaks
Comment on attachment 222035 [details] [review] online-accounts: Don't show spurious "No online accounts configured" commit 06ede122abd90194eff4275ed1b97cd9bfa1902e Author: Debarshi Ray <debarshir@gnome.org> Date: Tue Aug 21 17:23:50 2012 +0200 online-accounts: Don't show spurious "No online accounts configured" Programmatically deleting or inserting a row into a GtkTreeModel implementation does not change the selection on the GtkTreeView even if it is in browse mode (see GTK+ documentation). So, we need to connect to the model's row-deleted and row-inserted signals and adjust the selection ourselves. Fixes: https://bugzilla.gnome.org/682175