Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track internet connectivity using NMClient #142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

suokko
Copy link

@suokko suokko commented Aug 23, 2013

If network connection isn't up when the extension starts it will show no
weather information for long period of time. It is fairly simple to
avoid that issue if using networkmanager signal for connection state to
reload weather information when connection comes up.

Signed-off-by: Pauli Nieminen [email protected]

@@ -619,7 +652,7 @@ const WEATHER_DEBUG_EXTENSION = 'debug-extension'; // Weather extension settin
this.rebuildLocationSelectorItem(); this.status("Location selector builded");

this.UI.reloadButton = new PopupMenu.PopupMenuItem(_("Reload Weather Information"));
this.UI.reloadButton.connect('activate', Lang.bind(this, function(){this.info.update();}));
this.UI.reloadButton.connect('activate', Lang.bind(this, function(){if (this._connected) this.info.update();}));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder... is this wise, to hold the reload button effectively "dead" while the connection's offline? Perhaps, if the extension is going to defer to the NM connection state, it should be more proactive in cases where the user explicitly requests an update rather than simply "playing dumb". (Unless I've interpreted this wrong, apologies if that's the case.)

Like, maybe if the connection's not up and the user clicks "Reload", the extension could actually signal NM with a request to bring up the network connection? (In case it's not already doing so.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did read it correctly.

I know that mobile device like to offer connecting to network from application actions. But I don't know gnome-shell UI for application connecting. Creating automatic connection from user actions in applications isn't good idea because some people might be switching between monthly pay connections and usage pay connections (like 3G or 4G).

But I will check if gnome people have UI for that already somewhere hidden.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it is possible to open network chooser menu. I added a new patch to pull request that implements automatic menu opening if trying to reload while no network connection.

But gnome-shell master already has some rewrite happening for panel menus. I don't know if that will break this patch for 3.10.

@foghina
Copy link

foghina commented Sep 15, 2013

+1, I never use a wired connection so every time I sign in, weather data is unavailable because Wi-Fi takes a while to connect. So I always have to refresh manually. It would be great if the extension would automatically refresh when I get connectivity.

However, the extension should not depend on the presence of NetworkManager, as some setups don't have that available. For example in Arch Linux it's optional -- if you're just using the same ethernet connection all the time there's no point in installing NM.

@suokko
Copy link
Author

suokko commented Sep 15, 2013

As far as I understand gnome-shell and gir (gobject introspection?) This only depends on gir interface to be installed. If system doesn't have network manager async_new shouldn't complete. In that case this patch will assume there is internet connectivity.

Of course I may have understood the gir interface incorrectly. I suppose I should find some time later today to test when networkmanager isn't running.

If network connection isn't up when the extension starts it will show no
weather information for long period of time. It is fairly simple to
avoid that issue if using networkmanager signal for connection state to
reload weather information when connection comes up.

Signed-off-by: Pauli Nieminen <[email protected]>
If no network connection is running user probably wants reload to
propose connecting to internet. With that assumption we open network
chooser menu.

This change uses shell panel internal interfaces so it may break between
versions. I only tested with gnome 3.8. Gnome 3.10 seems to be about
rewrite panel menus to dialogs that most likely requires changes to
extensions too.

https://wiki.gnome.org/GnomeShell/Design/Guidelines/SystemStatus/
https://mail.gnome.org/archives/commits-list/2013-July/msg07691.html

Signed-off-by: Pauli Nieminen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants