After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 682175 - gnome-online-accounts shows "No online accounts configured" when there are online accounts configured
gnome-online-accounts shows "No online accounts configured" when there are on...
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Online Accounts
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME Online Accounts maintainer(s)
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-19 01:17 UTC by Ray Strode [halfline]
Modified: 2012-08-21 17:24 UTC
See Also:
GNOME target: 3.6
GNOME version: ---


Attachments
online-accounts: stop bogus "No online accounts configured" message (3.14 KB, patch)
2012-08-19 01:18 UTC, Ray Strode [halfline]
none Details | Review
online-accounts: Don't show spurious "No online accounts configured" (4.71 KB, patch)
2012-08-21 15:30 UTC, Debarshi Ray
committed Details | Review

Description Ray Strode [halfline] 2012-08-19 01:17:53 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.
Comment 1 Ray Strode [halfline] 2012-08-19 01:18:21 UTC
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.
Comment 2 Ray Strode [halfline] 2012-08-19 02:55:47 UTC
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.
Comment 3 Debarshi Ray 2012-08-21 12:28:38 UTC
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
Comment 4 Ray Strode [halfline] 2012-08-21 14:28:14 UTC
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.
Comment 5 Debarshi Ray 2012-08-21 15:30:08 UTC
Created attachment 222035 [details] [review]
online-accounts: Don't show spurious "No online accounts configured"
Comment 6 Ray Strode [halfline] 2012-08-21 15:39:19 UTC
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).
Comment 7 Debarshi Ray 2012-08-21 15:45:27 UTC
(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.
Comment 8 Debarshi Ray 2012-08-21 15:48:25 UTC
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.
Comment 9 Ray Strode [halfline] 2012-08-21 16:50:52 UTC
ah okay
Comment 10 Debarshi Ray 2012-08-21 17:24:09 UTC
<halfline> yea go 4 it
...
<hadess> do what you want, i'll come get you if it breaks
Comment 11 Debarshi Ray 2012-08-21 17:24:34 UTC
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