From 5c341ac3fd2ae8a3e93cdeb58b2c05f2ddcdde19 Mon Sep 17 00:00:00 2001 From: Gustavo Sverzut Barbieri Date: Thu, 9 Oct 2008 22:07:32 +0000 Subject: [PATCH] whitespace cleanup before work. SVN revision: 36556 --- src/modules/connman/e_iface.c | 178 ++++++++++++++++++------------------- src/modules/connman/e_iface.h | 2 +- src/modules/connman/e_mod_main.c | 184 +++++++++++++++++++-------------------- 3 files changed, 182 insertions(+), 182 deletions(-) diff --git a/src/modules/connman/e_iface.c b/src/modules/connman/e_iface.c index d570ad9..fb4a76c 100644 --- a/src/modules/connman/e_iface.c +++ b/src/modules/connman/e_iface.c @@ -41,10 +41,10 @@ iface_ipv4_decode(DBusMessage *msg) { DBusMessageIter array, iter, item, val; Interface_IPv4 *d; - + d = calloc(1, sizeof(Interface_IPv4)); if (!d) return NULL; - + if (dbus_message_iter_init(msg, &array)) { if (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY) @@ -55,7 +55,7 @@ iface_ipv4_decode(DBusMessage *msg) char *key, *v; int sig; int type; - + dbus_message_iter_recurse(&iter, &item); key = NULL; dbus_message_iter_get_basic(&item, &key); @@ -102,7 +102,7 @@ iface_getipv4_callback(void *data, void *ret, DBusError *err) Interface *iface = data; Interface_IPv4 *d = ret; - if (!d) + if (!d) { iface_unref(iface); return; @@ -112,7 +112,7 @@ iface_getipv4_callback(void *data, void *ret, DBusError *err) if (iface->ipv4.gateway) evas_stringshare_del(iface->ipv4.gateway); if (iface->ipv4.netmask) evas_stringshare_del(iface->ipv4.netmask); memcpy(&(iface->ipv4), d, sizeof(Interface_IPv4)); - iface->callbacks = iface_callback(iface->callbacks, + iface->callbacks = iface_callback(iface->callbacks, IFACE_EVENT_IPV4_CHANGE, iface, NULL); iface_unref(iface); @@ -130,10 +130,10 @@ iface_network_selection_decode(DBusMessage *msg) { DBusMessageIter array, iter, item, val; Interface_Network_Selection *d; - + d = calloc(1, sizeof(Interface_Network_Selection)); if (!d) return NULL; - + if (dbus_message_iter_init(msg, &array)) { if (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY) @@ -144,7 +144,7 @@ iface_network_selection_decode(DBusMessage *msg) char *key, *v; int sig; int type; - + dbus_message_iter_recurse(&iter, &item); key = NULL; dbus_message_iter_get_basic(&item, &key); @@ -180,8 +180,8 @@ iface_getnetwork_callback(void *data, void *ret, DBusError *err) { Interface *iface = data; Interface_Network_Selection *d = ret; - - if (!d) + + if (!d) { iface_unref(iface); return; @@ -189,8 +189,8 @@ iface_getnetwork_callback(void *data, void *ret, DBusError *err) if (iface->network_selection.id) evas_stringshare_del(iface->network_selection.id); if (iface->network_selection.pass) evas_stringshare_del(iface->network_selection.pass); memcpy(&(iface->network_selection), d, sizeof(Interface_Network_Selection)); - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_NETWORK_SELECTION_CHANGE, + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_NETWORK_SELECTION_CHANGE, iface, NULL); iface_unref(iface); } @@ -207,10 +207,10 @@ iface_getproperties_unmarhsall(DBusMessage *msg, DBusError *err) { DBusMessageIter array, iter, item, val; Interface_Properties *d; - + d = calloc(1, sizeof(Interface_Properties)); if (!d) return NULL; - + if (dbus_message_iter_init(msg, &array)) { if (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY) @@ -221,7 +221,7 @@ iface_getproperties_unmarhsall(DBusMessage *msg, DBusError *err) char *key, *v; int sig; int type; - + dbus_message_iter_recurse(&iter, &item); key = NULL; dbus_message_iter_get_basic(&item, &key); @@ -277,7 +277,7 @@ iface_getproperties_callback(void *data, void *ret, DBusError *err) { Interface *iface = data; Interface_Properties *d = ret; - if (!d) + if (!d) { iface_unref(iface); iface_unref(iface); @@ -312,16 +312,16 @@ iface_net_add(Interface *iface, const char *essid, const char *bssid, int signal { Interface_Network *net; Evas_List *l; - + for (l = iface->networks; l; l = l->next) { net = l->data; if (!strcmp(bssid, net->bssid)) { int changes = 0; - + net->last_seen_time = ecore_time_get(); - if (((essid) && (net->essid) && + if (((essid) && (net->essid) && (!strcmp(essid, net->essid))) || (!!essid != !!net->essid)) { @@ -335,7 +335,7 @@ iface_net_add(Interface *iface, const char *essid, const char *bssid, int signal net->signal_strength = signal_strength; changes++; } - if (((security) && (net->security) && + if (((security) && (net->security) && (!strcmp(security, net->security))) || (!!security != !!net->security)) { @@ -345,8 +345,8 @@ iface_net_add(Interface *iface, const char *essid, const char *bssid, int signal changes++; } if (changes > 0) - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_SCAN_NETWORK_CHANGE, + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_SCAN_NETWORK_CHANGE, iface, net); return; } @@ -360,8 +360,8 @@ iface_net_add(Interface *iface, const char *essid, const char *bssid, int signal net->signal_strength = signal_strength; if (security) net->security = evas_stringshare_add(security); iface->networks = evas_list_append(iface->networks, net); - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_SCAN_NETWORK_ADD, + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_SCAN_NETWORK_ADD, iface, net); } } @@ -373,13 +373,13 @@ iface_sigh_network_found(void *data, DBusMessage *msg) Interface *iface = data; DBusMessageIter array, iter, item, val; Interface_Properties *d; - + if (dbus_message_iter_init(msg, &array)) { if (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_ARRAY) { Interface_Network *net; - + dbus_message_iter_recurse(&array, &iter); net = calloc(1, sizeof(Interface_Network)); if (net) @@ -388,7 +388,7 @@ iface_sigh_network_found(void *data, DBusMessage *msg) { char *key, *v; int type; - + dbus_message_iter_recurse(&iter, &item); key = NULL; dbus_message_iter_get_basic(&item, &key); @@ -440,8 +440,8 @@ iface_sigh_signal_changed(void *data, DBusMessage *msg) /* FIXME: need to handle signal changed - and fix connman */ /* FIXME: wpa_supplicant doesn't support this yet. see: * mlme.c: ieee80211_associated() */ - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_SIGNAL_CHANGE, + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_SIGNAL_CHANGE, iface, NULL); } @@ -452,13 +452,13 @@ iface_sigh_state_changed(void *data, DBusMessage *msg) Interface *iface = data; DBusMessageIter iter; const char *s = NULL; - + dbus_message_iter_init(msg, &iter); dbus_message_iter_get_basic(&iter, &(s)); if (!s) return; if (iface->prop.state) evas_stringshare_del(iface->prop.state); iface->prop.state = evas_stringshare_add(s); - + msg = dbus_message_new_method_call("org.freedesktop.connman", iface->ifpath, "org.freedesktop.connman.Interface", @@ -472,8 +472,8 @@ iface_sigh_state_changed(void *data, DBusMessage *msg) dbus_message_unref(msg); iface_ref(iface); } - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_STATE_CHANGE, + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_STATE_CHANGE, iface, NULL); } @@ -484,14 +484,14 @@ iface_sigh_policy_changed(void *data, DBusMessage *msg) Interface *iface = data; DBusMessageIter iter; const char *s = NULL; - + dbus_message_iter_init(msg, &iter); dbus_message_iter_get_basic(&iter, &(s)); if (!s) return; if (iface->prop.policy) evas_stringshare_del(iface->prop.policy); iface->prop.policy = evas_stringshare_add(s); - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_POLICY_CHANGE, + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_POLICY_CHANGE, iface, NULL); } @@ -501,16 +501,16 @@ iface_sigh_network_changed(void *data, DBusMessage *msg) DBusError err; Interface *iface = data; Interface_Network_Selection *d; - + d = iface_network_selection_decode(msg); if (!d) return; - + if (iface->network_selection.id) evas_stringshare_del(iface->network_selection.id); if (iface->network_selection.pass) evas_stringshare_del(iface->network_selection.pass); memcpy(&(iface->network_selection), d, sizeof(Interface_Network_Selection)); free(d); - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_NETWORK_SELECTION_CHANGE, + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_NETWORK_SELECTION_CHANGE, iface, NULL); } @@ -520,7 +520,7 @@ iface_sigh_ipv4_changed(void *data, DBusMessage *msg) DBusError err; Interface *iface = data; Interface_IPv4 *d; - + d = iface_ipv4_decode(msg); if (!d) return; @@ -530,8 +530,8 @@ iface_sigh_ipv4_changed(void *data, DBusMessage *msg) if (iface->ipv4.netmask) evas_stringshare_del(iface->ipv4.netmask); memcpy(&(iface->ipv4), d, sizeof(Interface_IPv4)); free(d); - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_IPV4_CHANGE, + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_IPV4_CHANGE, iface, NULL); } @@ -542,7 +542,7 @@ iface_timer_network_timeout(void *data) double now; Interface_Network *net; Evas_List *l, *l_del; - + now = ecore_time_get(); iface_ref(iface); for (l = iface->networks; l;) @@ -552,8 +552,8 @@ iface_timer_network_timeout(void *data) { l_del = l; l = l->next; - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_SCAN_NETWORK_DEL, + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_SCAN_NETWORK_DEL, iface, net); iface->networks = evas_list_remove_list(iface->networks, l_del); if (net->essid) evas_stringshare_del(net->essid); @@ -580,7 +580,7 @@ iface_system_listinterfaces_unmarhsall(DBusMessage *msg, DBusError *err) do { char *ifpath; - + ifpath = NULL; dbus_message_iter_get_basic(&iter, &ifpath); if (ifpath) @@ -614,7 +614,7 @@ iface_system_added(void *data, DBusMessage *msg) DBusError err; DBusMessageIter iter; const char *s = NULL; - + dbus_message_iter_init(msg, &iter); dbus_message_iter_get_basic(&iter, &(s)); if (!s) return; @@ -630,7 +630,7 @@ iface_system_removed(void *data, DBusMessage *msg) DBusMessageIter iter; const char *s = NULL; Interface *iface; - + dbus_message_iter_init(msg, &iter); dbus_message_iter_get_basic(&iter, &(s)); if (!s) return; @@ -645,7 +645,7 @@ static void iface_system_interfaces_list(void) { DBusMessage *msg; - + msg = dbus_message_new_method_call("org.freedesktop.connman", "/", "org.freedesktop.connman.Manager", @@ -656,7 +656,7 @@ iface_system_interfaces_list(void) iface_system_listinterfaces_callback, iface_system_listinterfaces_result_free, -1, NULL); dbus_message_unref(msg); - + if (sigh_interface_added) e_dbus_signal_handler_del(conn, sigh_interface_added); sigh_interface_added = e_dbus_signal_handler_add @@ -675,7 +675,7 @@ iface_system_name_ownerchanged(void *data, DBusMessage *msg) DBusError err; DBusMessageIter iter; const char *s1, *s2, *s3; - + dbus_error_init(&err); if (!dbus_message_get_args(msg, &err, DBUS_TYPE_STRING, &s1, @@ -693,11 +693,11 @@ iface_add(const char *ifpath) { Interface *iface; DBusMessage *msg; - + iface = calloc(1, sizeof(Interface)); iface->ref = 1; iface->ifpath = evas_stringshare_add(ifpath); - + msg = dbus_message_new_method_call("org.freedesktop.connman", iface->ifpath, "org.freedesktop.connman.Interface", @@ -714,7 +714,7 @@ iface_add(const char *ifpath) iface_getproperties_result_free, -1, iface); dbus_message_unref(msg); iface_ref(iface); - + msg = dbus_message_new_method_call("org.freedesktop.connman", iface->ifpath, "org.freedesktop.connman.Interface", @@ -742,7 +742,7 @@ iface_add(const char *ifpath) dbus_message_unref(msg); iface_ref(iface); } - + iface->sigh.network_found = e_dbus_signal_handler_add (conn, "org.freedesktop.connman", iface->ifpath, "org.freedesktop.connman.Interface", "NetworkFound", @@ -785,11 +785,11 @@ iface_unref(Interface *iface) { iface->ref--; if (iface->ref != 0) return; - - iface->callbacks = iface_callback(iface->callbacks, - IFACE_EVENT_DEL, + + iface->callbacks = iface_callback(iface->callbacks, + IFACE_EVENT_DEL, iface, NULL); - + while (iface->callbacks) { free(iface->callbacks->data); @@ -850,7 +850,7 @@ iface_network_set(Interface *iface, const char *ssid, const char *pass) DBusMessage *msg; DBusMessageIter iter, array, item, val; const char *key; - + msg = dbus_message_new_method_call("org.freedesktop.connman", iface->ifpath, "org.freedesktop.connman.Interface", @@ -862,7 +862,7 @@ iface_network_set(Interface *iface, const char *ssid, const char *pass) DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &array); - + dbus_message_iter_open_container(&array, DBUS_TYPE_DICT_ENTRY, NULL, &item); key = "ESSID"; dbus_message_iter_append_basic(&item, DBUS_TYPE_STRING, &key); @@ -881,7 +881,7 @@ iface_network_set(Interface *iface, const char *ssid, const char *pass) dbus_message_iter_close_container(&item, &val); dbus_message_iter_close_container(&array, &item); } - + dbus_message_iter_close_container(&iter, &array); e_dbus_method_call_send(conn, msg, NULL, NULL, NULL, -1, NULL); @@ -893,7 +893,7 @@ iface_policy_set(Interface *iface, const char *policy) { DBusMessage *msg; DBusMessageIter iter; - + msg = dbus_message_new_method_call("org.freedesktop.connman", iface->ifpath, "org.freedesktop.connman.Interface", @@ -910,7 +910,7 @@ void iface_scan(Interface *iface, const char *policy) { DBusMessage *msg; - + msg = dbus_message_new_method_call("org.freedesktop.connman", iface->ifpath, "org.freedesktop.connman.Interface", @@ -926,7 +926,7 @@ iface_ipv4_set(Interface *iface, const char *method, const char *address, const DBusMessage *msg; DBusMessageIter iter, array, item, val; const char *key; - + msg = dbus_message_new_method_call("org.freedesktop.connman", iface->ifpath, "org.freedesktop.connman.Interface", @@ -949,7 +949,7 @@ iface_ipv4_set(Interface *iface, const char *method, const char *address, const dbus_message_iter_close_container(&item, &val); dbus_message_iter_close_container(&array, &item); } - + if (address) { dbus_message_iter_open_container(&array, DBUS_TYPE_DICT_ENTRY, NULL, &item); @@ -960,7 +960,7 @@ iface_ipv4_set(Interface *iface, const char *method, const char *address, const dbus_message_iter_close_container(&item, &val); dbus_message_iter_close_container(&array, &item); } - + if (gateway) { dbus_message_iter_open_container(&array, DBUS_TYPE_DICT_ENTRY, NULL, &item); @@ -971,7 +971,7 @@ iface_ipv4_set(Interface *iface, const char *method, const char *address, const dbus_message_iter_close_container(&item, &val); dbus_message_iter_close_container(&array, &item); } - + if (netmask) { dbus_message_iter_open_container(&array, DBUS_TYPE_DICT_ENTRY, NULL, &item); @@ -982,7 +982,7 @@ iface_ipv4_set(Interface *iface, const char *method, const char *address, const dbus_message_iter_close_container(&item, &val); dbus_message_iter_close_container(&array, &item); } - + dbus_message_iter_close_container(&iter, &array); e_dbus_method_call_send(conn, msg, NULL, NULL, NULL, -1, NULL); @@ -993,7 +993,7 @@ void iface_callback_add(Interface *iface, Interface_Event event, void (*func) (void *data, Interface *iface, Interface_Network *ifnet), void *data) { Interface_Callback *cb; - + cb = calloc(1, sizeof(Interface_Callback)); if (!cb) return; cb->event = event; @@ -1006,7 +1006,7 @@ void iface_callback_del(Interface *iface, Interface_Event event, void (*func) (void *data, Interface *iface, Interface_Network *ifnet), void *data) { Evas_List *l; - + for (l = iface->callbacks; l; l = l->next) { Interface_Callback *cb; @@ -1044,7 +1044,7 @@ void iface_system_shutdown(void) { Evas_List *l, *tlist = NULL; - + for (l = interfaces; l; l = l->next) tlist = evas_list_append(tlist, l->data); while (tlist) @@ -1073,7 +1073,7 @@ void iface_system_callback_add(Interface_Event event, void (*func) (void *data, Interface *iface, Interface_Network *ifnet), void *data) { Interface_Callback *cb; - + cb = calloc(1, sizeof(Interface_Callback)); if (!cb) return; cb->event = event; @@ -1086,7 +1086,7 @@ void iface_system_callback_del(Interface_Event event, void (*func) (void *data, Interface *iface, Interface_Network *ifnet), void *data) { Evas_List *l; - + for (l = callbacks; l; l = l->next) { Interface_Callback *cb; @@ -1121,7 +1121,7 @@ cb_if_ipv4(void *data, Interface *iface, Interface_Network *ifnet) { printf("IF %s\n", iface->ifpath); printf(" IPV4: [%s][%s][%s][%s]\n", - iface->ipv4.method, iface->ipv4.address, + iface->ipv4.method, iface->ipv4.address, iface->ipv4.gateway, iface->ipv4.netmask); } @@ -1137,7 +1137,7 @@ static void cb_if_scan_net_add(void *data, Interface *iface, Interface_Network *ifnet) { printf("IF %s\n", iface->ifpath); - printf(" SCAN NET ADD: [%s] %i \"%s\" %s\n", + printf(" SCAN NET ADD: [%s] %i \"%s\" %s\n", ifnet->bssid, ifnet->signal_strength, ifnet->essid, ifnet->security); } @@ -1145,7 +1145,7 @@ static void cb_if_scan_net_del(void *data, Interface *iface, Interface_Network *ifnet) { printf("IF %s\n", iface->ifpath); - printf(" SCAN NET DEL: [%s] %i \"%s\" %s\n", + printf(" SCAN NET DEL: [%s] %i \"%s\" %s\n", ifnet->bssid, ifnet->signal_strength, ifnet->essid, ifnet->security); } @@ -1153,7 +1153,7 @@ static void cb_if_scan_net_change(void *data, Interface *iface, Interface_Network *ifnet) { printf("IF %s\n", iface->ifpath); - printf(" SCAN NET CHANGE: [%s] %i \"%s\" %s\n", + printf(" SCAN NET CHANGE: [%s] %i \"%s\" %s\n", ifnet->bssid, ifnet->signal_strength, ifnet->essid, ifnet->security); } @@ -1186,7 +1186,7 @@ static int delay_down(void *data) { Interface *iface = data; - + // turn interface off iface_policy_set(iface, "off"); // in 5 seconds call delay_up @@ -1227,7 +1227,7 @@ cb_if_policy(void *data, Interface *iface, Interface_Network *ifnet) // ignore // auto // ask - // + // printf("IF %s\n", iface->ifpath); printf(" POLICY: %s\n", iface->prop.policy); } @@ -1236,7 +1236,7 @@ static void cb_main_if_add(void *data, Interface *iface, Interface_Network *ifnet) { printf("IF++ %s\n", iface->ifpath); - + // TESTING ... // add callbacks to events so we know when things happen iface_callback_add(iface, IFACE_EVENT_DEL, cb_if_del, NULL); @@ -1256,7 +1256,7 @@ cb_main_if_add(void *data, Interface *iface, Interface_Network *ifnet) // wimax // modem // bluetooth - // + // // if it is 802.11 - try connect if (essid_test) { @@ -1273,7 +1273,7 @@ int main(int argc, char **argv) { E_DBus_Connection *c; - + { int i; @@ -1314,13 +1314,13 @@ main(int argc, char **argv) } } } - + ecore_init(); ecore_string_init(); ecore_app_args_set(argc, (const char **)argv); e_dbus_init(); evas_init(); - + c = e_dbus_bus_get(DBUS_BUS_SYSTEM); if (!c) { @@ -1332,17 +1332,17 @@ main(int argc, char **argv) // or on initial lst of interfaces that are present iface_system_callback_add(IFACE_EVENT_ADD, cb_main_if_add, NULL); iface_system_init(c); - + ecore_main_loop_begin(); iface_system_shutdown(); - + e_dbus_connection_close(c); evas_shutdown(); e_dbus_shutdown(); ecore_string_shutdown(); ecore_shutdown(); - + return 0; } #endif diff --git a/src/modules/connman/e_iface.h b/src/modules/connman/e_iface.h index fc26eb1..7da55e2 100644 --- a/src/modules/connman/e_iface.h +++ b/src/modules/connman/e_iface.h @@ -82,7 +82,7 @@ struct _Interface Interface_Network_Selection network_selection; Evas_List *networks; int signal_strength; - + /* private - don't touch */ Evas_List *callbacks; struct { diff --git a/src/modules/connman/e_mod_main.c b/src/modules/connman/e_mod_main.c index 48d03ce..a9e578c 100644 --- a/src/modules/connman/e_mod_main.c +++ b/src/modules/connman/e_mod_main.c @@ -6,14 +6,14 @@ #include "e_iface.h" // FUCK. -// +// // connman now completely changed api in git upstream (just found out) after // weeks of no changes - huge change. nothing seems compatible anymore. -// +// // ... -// +// // this basically puts this all on hold. hoo-ray! -// +// // back to ignoring network stuff. // FIXME: need config to @@ -59,7 +59,7 @@ struct _Instance { E_Gadcon_Client *gcc; Evas_Object *o_net; // FIXME: clock to go... - + E_Gadcon_Popup *popup; Evas_Object *popup_ilist_obj; E_Dialog *if_dia; @@ -68,7 +68,7 @@ struct _Instance E_Dialog *net_dia; E_Dialog *manual_dia; E_Dialog *netlist_dia; - + struct { int ifmode; int ifmode_tmp; @@ -79,7 +79,7 @@ struct _Instance Conf_Network *cfnet, *cfnet_new; Conf_Interface *cfif; } config; -}; +}; struct _Conf_Interface { @@ -125,9 +125,9 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) E_Gadcon_Client *gcc; Instance *inst; Evas_List *l; - + inst = E_NEW(Instance, 1); - + o = edje_object_add(gc->evas); e_theme_edje_object_set(o, "base/theme/modules/connman", "e/modules/connman/main"); @@ -135,13 +135,13 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style) evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, gadget_cb_mouse_down, inst); - + gcc = e_gadcon_client_new(gc, name, id, style, o); gcc->data = inst; - + inst->gcc = gcc; inst->o_net = o; - + e_gadcon_client_util_menu_attach(gcc); instances = evas_list_append(instances, inst); @@ -182,10 +182,10 @@ static void _gc_shutdown(E_Gadcon_Client *gcc) { Instance *inst; - + inst = gcc->data; instances = evas_list_remove(instances, inst); - + evas_object_del(inst->o_net); free(inst); } @@ -195,7 +195,7 @@ _gc_orient(E_Gadcon_Client *gcc) { Instance *inst; Evas_Coord mw, mh; - + inst = gcc->data; mw = 0, mh = 0; edje_object_size_min_get(inst->o_net, &mw, &mh); @@ -218,7 +218,7 @@ _gc_icon(Evas *evas) { Evas_Object *o; char buf[4096]; - + o = edje_object_add(evas); snprintf(buf, sizeof(buf), "%s/e-module-connman.edj", e_module_dir_get(connman_module)); @@ -248,10 +248,10 @@ static Evas_List *ifaces = NULL; static int inst_if_matches(Instance *inst, Interface *iface) { - if ((inst->config.ifmode == 0) && (iface->prop.type) && + if ((inst->config.ifmode == 0) && (iface->prop.type) && (!strcmp(iface->prop.type, "80211"))) return 1; - if ((inst->config.ifmode == 1) && (iface->prop.type) && + if ((inst->config.ifmode == 1) && (iface->prop.type) && (!strcmp(iface->prop.type, "80203"))) return 1; if ((inst->config.ifpath) && (!strcmp(iface->ifpath, inst->config.ifpath))) @@ -264,7 +264,7 @@ if_get(Instance *inst) { Evas_List *l; Interface *iface = NULL; - + if (inst->config.ifpath) iface = iface_find(inst->config.ifpath); else @@ -290,7 +290,7 @@ net_join(Instance *inst, Interface *iface, Conf_Network *cfnet) iface_ipv4_set(iface, "dhcp", NULL, NULL, NULL); } else - iface_ipv4_set(iface, "static", + iface_ipv4_set(iface, "static", cfnet->ip, cfnet->gateway, cfnet->netmask); if ((!cfnet->remember_password) && (cfnet->password)) @@ -314,7 +314,7 @@ net_join(Instance *inst, Interface *iface, Conf_Network *cfnet) iface_ipv4_set(iface, "dhcp", NULL, NULL, NULL); } else - iface_ipv4_set(iface, "static", + iface_ipv4_set(iface, "static", cfnet->ip, cfnet->gateway, cfnet->netmask); if ((!cfnet->remember_password) && (cfnet->password)) @@ -344,7 +344,7 @@ net_dialog_cb_ok(void *data, E_Dialog *dialog) Conf_Network *cfnet; char *s; Interface *iface; - + inst = data; cfnet = inst->config.cfnet_new; inst->config.cfnet = cfnet; @@ -369,7 +369,7 @@ net_dialog_cb_cancel(void *data, E_Dialog *dialog) { Instance *inst; Conf_Network *cfnet; - + inst = data; cfnet = inst->config.cfnet_new; inst->config.cfnet_new = NULL; @@ -402,7 +402,7 @@ net_dialog_cb_del(E_Win *win) E_Dialog *dialog; Instance *inst; Conf_Network *cfnet; - + dialog = win->data; inst = dialog->data; cfnet = inst->config.cfnet_new; @@ -442,7 +442,7 @@ net_dialog_show(Instance *inst, Conf_Network *cfnet) E_Radio_Group *rg; Evas_List *l; int row = 0; - + dialog = e_dialog_new(inst->gcc->gadcon->zone->container, "e", "e_connman_net_dialog"); e_dialog_title_set(dialog, "Connection Details"); dialog->data = inst; @@ -465,11 +465,11 @@ net_dialog_show(Instance *inst, Conf_Network *cfnet) o = e_widget_label_add(evas, cfnet->essid); e_widget_table_object_append(table, o, 1, row, 1, 1, 1, 1, 0, 0); row++; - + o = e_widget_check_add(evas, "Use when available", &(cfnet->use_always)); e_widget_table_object_append(table, o, 0, row, 2, 1, 1, 1, 0, 0); row++; - + if (inst->config.sec) { o = e_widget_label_add(evas, "Password"); @@ -491,12 +491,12 @@ net_dialog_show(Instance *inst, Conf_Network *cfnet) inst, NULL); e_widget_table_object_append(table, button, 0, row, 2, 1, 0, 0, 0, 0); row++; - + e_widget_min_size_get(table, &mw, &mh); e_dialog_content_set(dialog, table, mw, mh); - + e_win_delete_callback_set(dialog->win, net_dialog_cb_del); - + e_dialog_button_add(dialog, "OK", NULL, net_dialog_cb_ok, inst); e_dialog_button_add(dialog, "Cancel", NULL, net_dialog_cb_cancel, inst); e_dialog_button_focus_num(dialog, 1); @@ -576,7 +576,7 @@ static void button_cb_netlist(void *data, void *data2) { Instance *inst; - + inst = data; if (!inst->netlist_dia) netlist_dialog_show(inst); else netlist_dialog_hide(inst); @@ -586,7 +586,7 @@ static void if_dialog_cb_ok(void *data, E_Dialog *dialog) { Instance *inst; - + inst = data; if_dialog_hide(inst); E_FREE(inst->config.ifpath); @@ -613,7 +613,7 @@ static void if_dialog_cb_cancel(void *data, E_Dialog *dialog) { Instance *inst; - + inst = data; if_dialog_hide(inst); E_FREE(inst->config.ifpath_tmp); @@ -624,7 +624,7 @@ if_dialog_cb_del(E_Win *win) { E_Dialog *dialog; Instance *inst; - + dialog = win->data; inst = dialog->data; if_dialog_hide(inst); @@ -635,7 +635,7 @@ static void if_radio_cb_generic(void *data, Evas_Object *obj, void *event_info) { Instance *inst; - + inst = data; if (inst->config.ifmode != 2) { @@ -648,7 +648,7 @@ static void if_ilist_cb_if_sel(void *data) { Instance *inst; - + inst = data; e_widget_radio_toggle_set(inst->if_radio_device, 1); } @@ -659,12 +659,12 @@ if_ilist_update(Instance *inst) Evas_Object *ilist; Evas_List *l; int i; - + ilist = inst->if_ilist_obj; if (!ilist) return; e_widget_ilist_freeze(ilist); e_widget_ilist_clear(ilist); - + for (i = 0, l = ifaces; l; l = l->next, i++) { Interface *iface; @@ -709,13 +709,13 @@ if_ilist_update(Instance *inst) if (!product) product = "Unknown"; if (!type) type = "Unknown"; snprintf(buf, sizeof(buf), "%s (%s)", type, product); - e_widget_ilist_append(ilist, icon, buf, if_ilist_cb_if_sel, inst, + e_widget_ilist_append(ilist, icon, buf, if_ilist_cb_if_sel, inst, iface->ifpath); if ((inst->config.ifpath) && (!strcmp(inst->config.ifpath, iface->ifpath))) e_widget_ilist_selected_set(ilist, i); } - + e_widget_ilist_go(ilist); e_widget_ilist_thaw(ilist); } @@ -729,7 +729,7 @@ if_dialog_show(Instance *inst) Evas_Coord mw, mh; E_Radio_Group *rg; Evas_List *l; - + dialog = e_dialog_new(inst->gcc->gadcon->zone->container, "e", "e_connman_iface_dialog"); e_dialog_title_set(dialog, _("Network Connection Settings")); dialog->data = inst; @@ -741,7 +741,7 @@ if_dialog_show(Instance *inst) inst->config.ifmode_tmp = inst->config.ifmode; rg = e_widget_radio_group_new(&(inst->config.ifmode_tmp)); - + o = e_widget_radio_add(evas, _("Wifi"), 0, rg); evas_object_smart_callback_add(o, "changed", if_radio_cb_generic, inst); e_widget_framelist_object_append(flist, o); @@ -758,7 +758,7 @@ if_dialog_show(Instance *inst) inst->config.ifpath_tmp = NULL; ilist = e_widget_ilist_add(evas, 48, 48, &(inst->config.ifpath_tmp)); inst->if_ilist_obj = ilist; - + e_widget_ilist_freeze(ilist); if_ilist_update(inst); @@ -768,19 +768,19 @@ if_dialog_show(Instance *inst) e_widget_min_size_set(ilist, 240, 180); e_widget_framelist_object_append(flist, ilist); - + e_widget_list_object_append(list, flist, 1, 0, 0.5); // FIXME: netlist needs to work button = e_widget_button_add(evas, _("Networks"), NULL, button_cb_netlist, inst, NULL); e_widget_list_object_append(list, button, 1, 0, 0.5); - + e_widget_min_size_get(list, &mw, &mh); e_dialog_content_set(dialog, list, mw, mh); - + e_win_delete_callback_set(dialog->win, if_dialog_cb_del); - + e_dialog_button_add(dialog, _("OK"), NULL, if_dialog_cb_ok, inst); e_dialog_button_add(dialog, _("Cancel"), NULL, if_dialog_cb_cancel, inst); e_dialog_button_focus_num(dialog, 1); @@ -810,7 +810,7 @@ static void popup_cb_setup(void *data, void *data2) { Instance *inst; - + inst = data; popup_hide(inst); if (!inst->if_dia) if_dialog_show(inst); @@ -821,12 +821,12 @@ static void popup_cb_resize(Evas_Object *obj, int *w, int *h) { int mw, mh; - + e_widget_min_size_get(obj, &mw, &mh); - + if (mh < 180) mh = 180; if (mw < 160) mw = 160; - + if (*w) *w = (mw + 8); if (*h) *h = (mh + 8); } @@ -837,7 +837,7 @@ popup_ifnet_icon_adjust(Evas_Object *icon, Interface_Network *ifnet) Edje_Message_Int_Set *msg; Evas_List *l; int saved = 0; - + msg = alloca(sizeof(Edje_Message_Int_Set) + (0 * sizeof(int))); msg->count = 1; msg->val[0] = ifnet->signal_strength; @@ -859,9 +859,9 @@ popup_ifnet_icon_adjust(Evas_Object *icon, Interface_Network *ifnet) for (l = conf->networks; l; l = l->next) { Conf_Network *cfnet; - + cfnet = l->data; - if ((cfnet->essid) && (ifnet->essid) && + if ((cfnet->essid) && (ifnet->essid) && (!strcmp(cfnet->essid, ifnet->essid))) { saved = 1; @@ -881,7 +881,7 @@ popup_cb_ifnet_sel(void *data) Instance *inst; Evas_List *l; Interface *iface; - + inst = data; if (!inst->config.bssid) return; iface = if_get(inst); @@ -897,7 +897,7 @@ popup_cb_ifnet_sel(void *data) { Conf_Network *cfnet; char buf[256]; - + printf("SEL %s\n", ifnet->essid); if (!conf) conf = E_NEW(Conf, 1); @@ -945,7 +945,7 @@ popup_ifnet_net_add(Instance *inst, Interface_Network *ifnet) { const char *label; Evas_Object *icon; - + label = ifnet->essid; if (!label) label = "NONE"; icon = edje_object_add(evas_object_evas_get(inst->popup_ilist_obj)); @@ -975,12 +975,12 @@ popup_ifnet_nets_refresh(Instance *inst) Interface *iface; Evas_Object *ilist; Evas_List *nets; - + if (!inst->popup_ilist_obj) return; ilist = inst->popup_ilist_obj; - + iface = if_get(inst); - + e_widget_ilist_freeze(ilist); e_widget_ilist_clear(ilist); @@ -989,9 +989,9 @@ popup_ifnet_nets_refresh(Instance *inst) for (l = iface->networks; l; l = l->next) networks = evas_list_append(networks, l->data); } -/* +/* if (networks) - networks = evas_list_sort(networks, + networks = evas_list_sort(networks, evas_list_count(networks), popup_ifnet_cb_sort); */ @@ -1013,7 +1013,7 @@ ifnet_num_get(Interface *iface, Interface_Network *ifnet) { Evas_List *l; int i; - + for (i = 0, l = iface->networks; l; l = l->next, i++) { if (ifnet == l->data) return i; @@ -1034,7 +1034,7 @@ static void popup_ifnet_del(Instance *inst, Interface *iface, Interface_Network *ifnet) { int i; - + if (!inst->popup_ilist_obj) return; i = ifnet_num_get(iface, ifnet); if (i < 0) return; @@ -1067,14 +1067,14 @@ popup_show(Instance *inst) Evas_Object *base, *ilist, *button, *o; Evas *evas; Evas_Coord mw, mh; - + inst->popup = e_gadcon_popup_new(inst->gcc, popup_cb_resize); evas = inst->popup->win->evas; edje_freeze(); base = e_widget_table_add(evas, 0); - + o = edje_object_add(evas); e_theme_edje_object_set(o, "base/theme/modules/connman", "e/modules/connman/network"); @@ -1085,11 +1085,11 @@ popup_show(Instance *inst) evas_object_del(o); ilist = e_widget_ilist_add(evas, mw, mh, &(inst->config.bssid)); inst->popup_ilist_obj = ilist; - + e_widget_ilist_freeze(ilist); popup_ifnet_nets_refresh(inst); - + e_widget_ilist_go(ilist); e_widget_ilist_thaw(ilist); @@ -1097,13 +1097,13 @@ popup_show(Instance *inst) e_widget_table_object_append(base, ilist, 0, 0, 1, 1, 1, 1, 1, 1); - button = e_widget_button_add(evas, _("Settings"), NULL, popup_cb_setup, + button = e_widget_button_add(evas, _("Settings"), NULL, popup_cb_setup, inst, NULL); e_widget_table_object_append(base, button, 0, 1, 1, 1, 0, 0, 0, 0); - + edje_thaw(); - + e_gadcon_popup_content_set(inst->popup, base); e_gadcon_popup_show(inst->popup); } @@ -1124,7 +1124,7 @@ gadget_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event) { Instance *inst; Evas_Event_Mouse_Down *ev; - + ev = event; inst = data; if (ev->button == 1) @@ -1210,7 +1210,7 @@ static void cb_if_del(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l; - + printf("IF-- %s\n", iface->ifpath); ifaces = evas_list_remove(ifaces, iface); for (l = instances; l; l = l->next) @@ -1228,7 +1228,7 @@ static void cb_if_ipv4(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l; - + printf("IF %s\n", iface->ifpath); printf(" IPV4: [%s][%s][%s][%s]\n", iface->ipv4.method, iface->ipv4.address, @@ -1247,7 +1247,7 @@ static void cb_if_net_sel(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l; - + printf("IF %s\n", iface->ifpath); printf(" NET_SEL: [%s] [%s]\n", iface->network_selection.id, iface->network_selection.pass); @@ -1266,7 +1266,7 @@ static void cb_if_scan_net_add(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l, *l2; - + // printf("IF %s\n", iface->ifpath); // printf(" SCAN NET ADD: [%s] %i \"%s\" %s\n", // ifnet->bssid, ifnet->signal_strength, ifnet->essid, ifnet->security); @@ -1282,7 +1282,7 @@ cb_if_scan_net_add(void *data, Interface *iface, Interface_Network *ifnet) for (l2 = conf->networks; l2; l2 = l2->next) { Conf_Network *cfnet; - + cfnet = l2->data; if ((ifnet->essid) && (cfnet->essid) && (!strcmp(ifnet->essid, cfnet->essid))) @@ -1300,7 +1300,7 @@ static void cb_if_scan_net_del(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l; - + // printf("IF %s\n", iface->ifpath); // printf(" SCAN NET DEL: [%s] %i \"%s\" %s\n", // ifnet->bssid, ifnet->signal_strength, ifnet->essid, ifnet->security); @@ -1320,7 +1320,7 @@ static void cb_if_scan_net_change(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l; - + // printf("IF %s\n", iface->ifpath); // printf(" SCAN NET CHANGE: [%s] %i \"%s\" %s\n", // ifnet->bssid, ifnet->signal_strength, ifnet->essid, ifnet->security); @@ -1338,7 +1338,7 @@ static void cb_if_signal(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l; - + printf("IF %s\n", iface->ifpath); printf(" SIGNAL: %i\n", iface->signal_strength); for (l = instances; l; l = l->next) @@ -1355,7 +1355,7 @@ static void cb_if_state(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l; - + // .. iface->prop.state: // scanning // carrier @@ -1395,12 +1395,12 @@ cb_if_state(void *data, Interface *iface, Interface_Network *ifnet) } } } - + static void cb_if_policy(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l; - + // .. iface->prop.policy: // unknown // off @@ -1435,7 +1435,7 @@ static void cb_main_if_add(void *data, Interface *iface, Interface_Network *ifnet) { Evas_List *l, *l2; - + printf("IF++ %s\n", iface->ifpath); ifaces = evas_list_append(ifaces, iface); iface_callback_add(iface, IFACE_EVENT_DEL, cb_if_del, NULL); @@ -1466,7 +1466,7 @@ cb_main_if_add(void *data, Interface *iface, Interface_Network *ifnet) inst_on(inst); else if (!strcmp(iface->prop.policy, "ask")) inst_on(inst); - + if (inst->config.cfif->netconf) { // FIXME: must be ethernet - bring up netconf @@ -1510,11 +1510,11 @@ e_modapi_init(E_Module *m) E_CONFIG_VAL(conf_interface_edd, Conf_Interface, ifpath, STR); E_CONFIG_VAL(conf_interface_edd, Conf_Interface, ifmode, INT); E_CONFIG_SUB(conf_interface_edd, Conf_Interface, netconf, conf_network_edd); - + conf_edd = E_CONFIG_DD_NEW("Conf", Conf); E_CONFIG_LIST(conf_edd, Conf, interfaces, conf_interface_edd); E_CONFIG_LIST(conf_edd, Conf, networks, conf_network_edd); - + conf = e_config_domain_load("module.connman", conf_edd); connman_dbus = e_dbus_bus_get(DBUS_BUS_SYSTEM); @@ -1523,7 +1523,7 @@ e_modapi_init(E_Module *m) iface_system_callback_add(IFACE_EVENT_ADD, cb_main_if_add, NULL); iface_system_init(connman_dbus); } - + e_gadcon_provider_register(&_gadcon_class); return m; } @@ -1532,15 +1532,15 @@ EAPI int e_modapi_shutdown(E_Module *m) { // FIXME: free conf - + E_CONFIG_DD_FREE(conf_network_edd); E_CONFIG_DD_FREE(conf_interface_edd); E_CONFIG_DD_FREE(conf_edd); - + conf_network_edd = NULL; conf_interface_edd = NULL; conf_edd = NULL; - + e_gadcon_provider_unregister(&_gadcon_class); if (connman_dbus) { @@ -1553,7 +1553,7 @@ e_modapi_shutdown(E_Module *m) // e_dbus_connection_close(connman_dbus); connman_dbus = NULL; } - + connman_module = NULL; return 1; -- 2.7.4