GNOME Bugzilla – Bug 725148
Automatic network awareness
Last modified: 2014-12-10 23:32:13 UTC
It would be useful to be able to tag sources as requiring internet connection, so that sources do not appear unless an internet connection is present. This is already possible for C sources, but it requires each source doing it. This would also be useful for Lua sources.
Created attachment 292156 [details] [review] core: Make sources network aware If a source says that it requires the local network, or access to the Internet to work properly, automatically hide it when the network becomes unavailable, and show it when the network comes back on again. This is implemented using GNetworkManager's connectivity property. See https://bugzilla.gnome.org/show_bug.cgi?id=664562 Sources only need to set the "net:local" or "net:internet" tags to be shown/hidden from applications depending on the network status.
Created attachment 292161 [details] [review] all: Update source-tags for all plugins Add relevant tags for most plugins, including "net:internet" for a large number of plugins that wouldn't be usable without an Internet connection. Note that a number of plugins were not marked as "net:internet" despite requiring an Internet connection to fetch new data because they do have local caching support (thetvdb and pocket for example). Plugins that use data from the local network but use other discovery methods (Freebox and DAAP with mDNS, Dleyna with DLNA/UPnP) were also not marked, as they will disappear if the shares become unavailable.
Created attachment 292303 [details] [review] all: Update source-tags for all plugins Add relevant tags for most plugins, including "net:internet" for a large number of plugins that wouldn't be usable without an Internet connection. Note that a number of plugins were not marked as "net:internet" despite requiring an Internet connection to fetch new data because they do have local caching support (thetvdb and pocket for example). Plugins that use data from the local network but use other discovery methods (Freebox and DAAP with mDNS, Dleyna with DLNA/UPnP) were also not marked, as they will disappear if the shares become unavailable.
Created attachment 292447 [details] [review] core: Don't require a newer GIO for network awareness As a separate commit, because it will make it easier to revert once we're ready to bump the GLib/GIO dependencies.
Review of attachment 292156 [details] [review]: Works well, great improvement! ::: src/grl-registry.c @@ +67,3 @@ + +#define SET_INVISIBLE_SOURCE(src, val) g_object_set_data(G_OBJECT(src), "invisible", GINT_TO_POINTER(val)) +#define GET_INVISIBLE_SOURCE(src) GPOINTER_TO_INT(g_object_get_data(G_OBJECT(src), "invisible")) (SOURCE_IS_INVISIBLE would fit better as it is only used to check source visibility. @@ +68,3 @@ +#define SET_INVISIBLE_SOURCE(src, val) g_object_set_data(G_OBJECT(src), "invisible", GINT_TO_POINTER(val)) +#define GET_INVISIBLE_SOURCE(src) GPOINTER_TO_INT(g_object_get_data(G_OBJECT(src), "invisible")) + Same identation of define below. @@ +231,3 @@ + !GET_INVISIBLE_SOURCE(current_source)) { + GRL_DEBUG ("Network isn't not available for '%s', hiding", + grl_source_get_id (current_source)); "is not" or "isn't" @@ +358,3 @@ + if (needs_local || needs_inet) { + GRL_DEBUG ("Network isn't not available for '%s', hiding", + grl_source_get_id (source)); Ditto @@ +365,3 @@ + if (needs_inet) { + GRL_DEBUG ("Internet isn't not available for '%s', hiding", + grl_source_get_id (source)); Ditto
Review of attachment 292303 [details] [review]: Ok!
Review of attachment 292447 [details] [review]: Ok! ::: configure.ac @@ +125,3 @@ AC_SUBST(GLIB_MKENUMS) +PKG_CHECK_MODULES(GIO_WITH_NM, gio-2.0 >= 2.43.1, [has_gio_with_netmon=yes], [has_gio_with_netmon=false]) > 2.43.1
Created attachment 292491 [details] [review] core: Make sources network aware If a source says that it requires the local network, or access to the Internet to work properly, automatically hide it when the network becomes unavailable, and show it when the network comes back on again. This is implemented using GNetworkManager's connectivity property. See https://bugzilla.gnome.org/show_bug.cgi?id=664562 Sources only need to set the "net:local" or "net:internet" tags to be shown/hidden from applications depending on the network status.
Created attachment 292492 [details] [review] core: Don't require a newer GIO for network awareness As a separate commit, because it will make it easier to revert once we're ready to bump the GLib/GIO dependencies.
Attachment 292491 [details] pushed as f30dccc - core: Make sources network aware Attachment 292492 [details] pushed as bfb7078 - core: Don't require a newer GIO for network awareness
Attachment 292303 [details] pushed as c9829dd - all: Update source-tags for all plugins