Commit 28cd260c authored by Gabriel Ivascu's avatar Gabriel Ivascu

sync: Return early if there is no network connectivity

https://bugzilla.gnome.org/show_bug.cgi?id=790286
parent de0cf7fa
......@@ -1375,11 +1375,18 @@ ephy_sync_service_sync_collection (EphySyncService *self,
static gboolean
ephy_sync_service_sync_internal (EphySyncService *self)
{
GNetworkMonitor *monitor;
guint index = 0;
guint num_managers;
g_assert (ephy_sync_utils_user_is_signed_in ());
monitor = g_network_monitor_get_default ();
if (g_network_monitor_get_connectivity (monitor) != G_NETWORK_CONNECTIVITY_FULL) {
g_signal_emit (self, signals[SYNC_FINISHED], 0);
return G_SOURCE_CONTINUE;
}
if (!self->managers) {
g_signal_emit (self, signals[SYNC_FINISHED], 0);
return G_SOURCE_CONTINUE;
......@@ -2191,10 +2198,16 @@ synchronizable_deleted_cb (EphySynchronizableManager *manager,
EphySynchronizable *synchronizable,
EphySyncService *self)
{
GNetworkMonitor *monitor;
g_assert (EPHY_IS_SYNCHRONIZABLE_MANAGER (manager));
g_assert (EPHY_IS_SYNCHRONIZABLE (synchronizable));
g_assert (EPHY_IS_SYNC_SERVICE (self));
monitor = g_network_monitor_get_default ();
if (g_network_monitor_get_connectivity (monitor) != G_NETWORK_CONNECTIVITY_FULL)
return;
if (!ephy_sync_utils_user_is_signed_in ())
return;
......@@ -2207,10 +2220,16 @@ synchronizable_modified_cb (EphySynchronizableManager *manager,
gboolean should_force,
EphySyncService *self)
{
GNetworkMonitor *monitor;
g_assert (EPHY_IS_SYNCHRONIZABLE_MANAGER (manager));
g_assert (EPHY_IS_SYNCHRONIZABLE (synchronizable));
g_assert (EPHY_IS_SYNC_SERVICE (self));
monitor = g_network_monitor_get_default ();
if (g_network_monitor_get_connectivity (monitor) != G_NETWORK_CONNECTIVITY_FULL)
return;
if (!ephy_sync_utils_user_is_signed_in ())
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment