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 725148 - Automatic network awareness
Automatic network awareness
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: core
git master
Other Mac OS
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on: 664562
Blocks:
 
 
Reported: 2014-02-25 13:52 UTC by Bastien Nocera
Modified: 2014-12-10 23:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
core: Make sources network aware (10.38 KB, patch)
2014-12-04 22:38 UTC, Bastien Nocera
reviewed Details | Review
all: Update source-tags for all plugins (12.86 KB, patch)
2014-12-05 00:08 UTC, Bastien Nocera
none Details | Review
all: Update source-tags for all plugins (13.32 KB, patch)
2014-12-08 17:09 UTC, Bastien Nocera
committed Details | Review
core: Don't require a newer GIO for network awareness (4.39 KB, patch)
2014-12-10 15:08 UTC, Bastien Nocera
reviewed Details | Review
core: Make sources network aware (10.42 KB, patch)
2014-12-10 23:26 UTC, Bastien Nocera
committed Details | Review
core: Don't require a newer GIO for network awareness (4.48 KB, patch)
2014-12-10 23:26 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2014-02-25 13:52:09 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.
Comment 1 Bastien Nocera 2014-12-04 22:38:12 UTC
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.
Comment 2 Bastien Nocera 2014-12-05 00:08:35 UTC
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.
Comment 3 Bastien Nocera 2014-12-08 17:09:21 UTC
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.
Comment 4 Bastien Nocera 2014-12-10 15:08:57 UTC
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.
Comment 5 Victor Toso 2014-12-10 20:15:51 UTC
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
Comment 6 Victor Toso 2014-12-10 20:16:20 UTC
Review of attachment 292303 [details] [review]:

Ok!
Comment 7 Victor Toso 2014-12-10 20:17:47 UTC
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
Comment 8 Bastien Nocera 2014-12-10 23:26:24 UTC
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.
Comment 9 Bastien Nocera 2014-12-10 23:26:37 UTC
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.
Comment 10 Bastien Nocera 2014-12-10 23:30:04 UTC
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
Comment 11 Bastien Nocera 2014-12-10 23:32:01 UTC
Attachment 292303 [details] pushed as c9829dd - all: Update source-tags for all plugins