GNOME Bugzilla – Bug 678161
online accounts: network error handling
Last modified: 2017-04-27 20:33:38 UTC
I've noticed that the error handling when trying to add new accounts without network is somewhat uneven. Google - I get an error dialog with a somewhat cryptic error message about an unexpected token Microsoft Live - I get a 'couldn't load page' error inside the web view I think we should have uniform error handling for all account types, and make it look nice.
Yes, we need to use the GNetworkMonitor APIs. There are some FIXMEs in the code for that. Currently you get those different behaviours because OAuth and OAuth2 providers behave differently and hence fail differently. :-(
Created attachment 228485 [details] screenshot Encountered this today trying to add my Facebook account.
Created attachment 230165 [details] [review] network error handling patch
hi i added for solving this error.
Review of attachment 230165 [details] [review]: Personally I would do: monitor = g_network_monitor_get_default (); And then use g_object_bind_property() to bind the "network-available" property from the monitor to the "sensitive" property of the widgets. ::: cc-online-accounts-panel.c @@ +55,3 @@ + GNetworkMonitor *monitor; + gboolean network_available; + Extraneous lifefeeds. @@ +136,3 @@ +static void +netw_status(monitor){ Incomplete declaration. @@ +138,3 @@ +netw_status(monitor){ + network_available = g_network_monitor_get_network_available (monitor); + if(network_available){ Do: if (g_network_monitor_get_network_available (monitor)) directly. @@ +161,3 @@ error = NULL; + panel->monitor = g_network_monitor_get_default (); + netw_status(monitor); panel->monitor.
Created attachment 230210 [details] [review] online accounts: network error handling i changed it as your suggestion.
Comment on attachment 230210 [details] [review] online accounts: network error handling Use g_object_bind_property(), there's no need for a separate function (and please try to compile the code before submitting it).
Created attachment 230375 [details] [review] network error handling patch Hi, i added patch file. I used g_object_property()
I made a simple example with using g_object_bind_property(). Codes in the link are working. https://github.com/ebruAkagunduz/online-account/blob/master/playground/addAccount.c But i couldn't execute g_object_bind_property() for online-account. May be i added g_object_property() wrong place for online-account.
Review of attachment 230375 [details] [review]: Looks pretty good overall. ::: orjinal.c @@ +142,3 @@ GtkTreeIter iter; + No need to have that line feed here. @@ +180,2 @@ button = GTK_WIDGET (gtk_builder_get_object (panel->builder, "accounts-button-add")); + GNetworkMonitor *monitor; Move the declaration to the top of the block please. @@ +184,3 @@ +g_object_bind_property (monitor, "network-available", + button, "sensitive", + G_BINDING_SYNC_CREATE); Use G_BINDING_DEFAULT instead, otherwise it won't be sync'ed at run-time. @@ -768,3 @@ add_account (panel); } - Another white space change that's not required.
Created attachment 230431 [details] [review] network error handling patch i changed it as your suggestion
Review of attachment 230431 [details] [review]: A few more notes: - Please read https://live.gnome.org/Git/Developers#Contributing_patches about contributing patches. The patch you've given lacks all data to commit it. - The binding needs to be unref'ed when the panel is disposed (otherwise closing the panel and changing the network state will crash gnome-control-center).
Hey Ebru, I modified the last version of your patch as per Bastien's comments, except the following: - I restored the G_BINDING_SYNC_CREATE because otherwise if you start with network-available == FALSE, the button is not desensitized. - Also, there is no need to unref the GBinding because the binding is automatically broken if either the source or target object used in the binding is finalized. However, you left out "accounts-tree-toolbutton-add". It is the small "+" button on the left of the panel. The same thing needs to be done to toggle its sensitive property as the network changes. Can you please submit another patch to do that? Now that you are a bit more familiar with the code, try reading https://live.gnome.org/Git/Developers#Contributing_patches (as Bastien pointed out) and see if you can use "git format-patch" to create your second patch.
Created attachment 230520 [details] [review] online-accounts: Bind "accounts-button-add" to network availability
Comment on attachment 230520 [details] [review] online-accounts: Bind "accounts-button-add" to network availability commit ff186736dc2e063ee2df48a887ba394a20cd8d0e Author: Ebru Akagunduz <ebru.akagunduz@gmail.com> Date: Mon Dec 3 13:14:34 2012 +0100 online-accounts: Bind "accounts-button-add" to network availability Fixes: https://bugzilla.gnome.org/678161
Created attachment 230533 [details] [review] online accounts: network error handling patch hi, i changed it as your comment
Created attachment 230640 [details] [review] online-accounts: Bind "accounts-tree-toolbutton-add" to network monitor
(In reply to comment #16) > Created an attachment (id=230533) [details] [review] > online accounts: network error handling patch > > hi, i changed it as your comment Well done. It works. Two things: - there was a typo in your name, and I fixed it to "Ebru Akagunduz <ebru.akagunduz@gmail.com>" - I edited your commit message according to the format used elsewhere.
Created attachment 230653 [details] [review] Disable adding accounts when network unavailable
Is there anything left to do here?
Created attachment 284670 [details] facebook on online account this happen when i try to signing in to facebook in online accounts.
Comment on attachment 284670 [details] facebook on online account this happen when i try to signing in to facebook in online accounts.
The Online Accounts redesign introduced code to detect the availability of network, an this issue likely won't happen anymore for we block all the UI when no network is available. I'm closing this bug as FIXED, but feel free to reopen it if you see any other issues regarding network handling.