Do not go back to online when marked as 'Offline'

The way it was, if you changed offline it was repeatedly toggling due
E "offline mode" state and connman module fighting. Now it does it once.

By: Lucas De Marchi <lucas.demarchi@profusion.mobi>



SVN revision: 45410
This commit is contained in:
Gustavo Sverzut Barbieri 2010-01-21 18:26:08 +00:00
parent 397c19771a
commit 251bb08baf
2 changed files with 9 additions and 18 deletions

View File

@ -112,9 +112,7 @@ _connman_toggle_offline_mode_cb(void *data, DBusMessage *msg __UNUSED__, DBusErr
if ((!error) || (!dbus_error_is_set(error))) if ((!error) || (!dbus_error_is_set(error)))
{ {
printf("DBG CONNMAN: successfuly toggled to offline mode\n"); printf("DBG CONNMAN: successfuly toggled to offline mode\n");
// XXX hack: connman does not emit propertychanged for this, they need to fix it ctxt->offline_mode_pending = EINA_FALSE;
e_connman_manager_sync_elements();
_connman_default_service_changed_delayed(ctxt);
return; return;
} }
@ -122,14 +120,6 @@ _connman_toggle_offline_mode_cb(void *data, DBusMessage *msg __UNUSED__, DBusErr
dbus_error_free(error); dbus_error_free(error);
} }
static void
_connman_toggle_offline_mode_pending_cb(void *data, DBusMessage *msg, DBusError *error)
{
E_Connman_Module_Context *ctxt = data;
ctxt->offline_mode_pending = EINA_FALSE;
_connman_toggle_offline_mode_cb(data, msg, error);
}
static void static void
_connman_toggle_offline_mode(E_Connman_Module_Context *ctxt) _connman_toggle_offline_mode(E_Connman_Module_Context *ctxt)
{ {
@ -915,6 +905,7 @@ _connman_popup_cb_offline_mode_changed(void *data, Evas_Object *obj, void *event
(_("Cannot toggle system's offline mode.")); (_("Cannot toggle system's offline mode."));
return; return;
} }
ctxt->offline_mode_pending = EINA_TRUE;
} }
static void static void
@ -1617,13 +1608,14 @@ _connman_event_mode_changed(void *data, int type __UNUSED__, void *event __UNUSE
if ((ctxt->offline_mode == e_config->mode.offline) || if ((ctxt->offline_mode == e_config->mode.offline) ||
(!ctxt->has_manager)) (!ctxt->has_manager))
return 1; return 1;
if (!ctxt->offline_mode_pending)
if (!e_connman_manager_offline_mode_set {
(e_config->mode.offline, _connman_toggle_offline_mode_pending_cb, ctxt)) if (!e_connman_manager_offline_mode_set(e_config->mode.offline,
_connman_operation_error_show _connman_toggle_offline_mode_cb, ctxt))
(_("Cannot toggle system's offline mode.")); _connman_operation_error_show(_("Cannot toggle system's offline mode."));
}
else else
ctxt->offline_mode_pending = EINA_TRUE; ctxt->offline_mode_pending = EINA_FALSE;
return 1; return 1;
} }

View File

@ -10,7 +10,6 @@
#define MOD_CONF_VERSION 2 #define MOD_CONF_VERSION 2
typedef struct E_Connman_Instance E_Connman_Instance; typedef struct E_Connman_Instance E_Connman_Instance;
typedef struct E_Connman_Module_Context E_Connman_Module_Context; typedef struct E_Connman_Module_Context E_Connman_Module_Context;
typedef struct E_Connman_Service E_Connman_Service; typedef struct E_Connman_Service E_Connman_Service;