119
119
GList *pConnList = NULL;
120
120
//\_____________ On cherche une connection qui ait le meme type (wifi ou filaire), et soit le meme SSID, soit la meme interface.
121
121
gchar *cConnection;
123
123
for (i = 0; i < paConnections->len; i++)
125
125
cConnection = (gchar *)g_ptr_array_index(paConnections, i);
141
141
GHashTable *pSettings = g_hash_table_new_full (g_str_hash,
144
g_hash_table_destroy);
146
GHashTable *pSubSettings = g_hash_table_new_full (g_str_hash,
150
g_hash_table_insert (pSettings, "connection", pSubSettings);
151
g_hash_table_insert (pSubSettings, "type", g_strdup ("802-11-wireless"));
152
g_hash_table_insert (pSettings, "id", g_strdup_printf ("CD - %s", pItemData->cSsid));
154
pSubSettings = g_hash_table_new_full (g_str_hash,
158
g_hash_table_insert (pSubSettings, "ssid", g_strdup (pItemData->cSsid));
159
g_hash_table_insert (pSubSettings, "mode", g_strdup ("infrastructure"));
144
(GDestroyNotify) g_hash_table_destroy); // a table of tables.
145
GHashTable *pSubSettings;
147
// connection: type, id, uuid
148
pSubSettings = g_hash_table_new_full (g_str_hash,
152
g_hash_table_insert (pSettings, g_strdup ("connection"), pSubSettings);
153
g_hash_table_insert (pSubSettings, g_strdup ("type"), g_strdup ("802-11-wireless"));
154
g_hash_table_insert (pSubSettings, g_strdup ("id"), g_strdup_printf ("CD - %s", pItemData->cSsid));
156
// 802-11-wireless: ssid, mode, seen-bssids
157
pSubSettings = g_hash_table_new_full (g_str_hash,
161
g_hash_table_insert (pSettings, g_strdup ("802-11-wireless"), pSubSettings);
162
g_hash_table_insert (pSubSettings, g_strdup ("ssid"), g_strdup (pItemData->cSsid));
163
g_hash_table_insert (pSubSettings, g_strdup ("mode"), g_strdup ("infrastructure"));
162
166
DBusGProxy *dbus_proxy_Settings = cairo_dock_create_new_system_proxy (
192
196
//ActivateConnection ( s: service_name, o: connection, o: device, o: specific_object )o
193
197
GError *erreur = NULL;
194
GValue active_connection_path = {0};
198
GValue active_connection_path = G_VALUE_INIT;
195
199
g_value_init (&active_connection_path, DBUS_TYPE_G_OBJECT_PATH);
197
201
gchar *cNewActiveConnectionPath = NULL;
233
237
DBusGProxy *dbus_proxy_ConnectionSettings;
234
238
GError *erreur = NULL;
235
239
GHashTable *pSettingsTable;
237
241
for (i = 0; i < paConnections->len; i++)
239
243
cConnection = (gchar *)g_ptr_array_index(paConnections, i);
281
285
gchar *cAccessPointPath;
282
286
GHashTable *hProperties;
286
290
const gchar *cHwAddress;
287
291
int iMode, iWirelessCapabilities;
288
292
CDMenuItemData *pItemData;
289
293
GtkWidget *pHBox;
291
295
for (i = 0; i < paDevices->len; i++)
293
297
// on recupere le device.
387
391
v = (GValue *)g_hash_table_lookup (hProperties, "Strength");
388
392
if (v != NULL && G_VALUE_HOLDS_UCHAR (v))
390
iPercent = (gint) g_value_get_uchar (v);
394
iPercent = g_value_get_uchar (v);
393
397
v = (GValue *)g_hash_table_lookup (hProperties, "Ssid");
400
404
// on empeche les doublons.
401
pItemData = g_hash_table_lookup (pSsidTable, cSsid);
405
pItemData = (cSsid ? g_hash_table_lookup (pSsidTable, cSsid) : NULL);
402
406
if (pItemData != NULL)
404
408
if (pItemData->iPercent > iPercent)
438
442
cd_debug ("%d) %s : %s (%s, %d%%)\n", j, cSsid, cAccessPointPath, cHwAddress, iPercent);
440
gchar *cImage = NULL;
444
const gchar *cImage = NULL;
441
445
if (iPercent > 80)
442
446
cImage = MY_APPLET_SHARE_DATA_DIR"/link-5.svg";
443
447
else if (iPercent > 60)
480
484
int n = GPOINTER_TO_INT (pConnList->data);
481
485
pItemData->cConnection = g_strdup (g_ptr_array_index (paConnections, n));
483
cairo_dock_add_in_menu_with_stock_and_data (cSsid, cImage, _on_select_access_point, pMenu, pItemData);
487
cairo_dock_add_in_menu_with_stock_and_data (cSsid, cImage, (GFunc) _on_select_access_point, pMenu, pItemData);
505
509
pItemData->cDevice = g_strdup (cDevice);
506
510
pItemData->cAccessPoint = g_strdup (cAccessPointPath);
508
cairo_dock_add_in_menu_with_stock_and_data (cID, NULL, _on_select_access_point, pSubMenu, GINT_TO_POINTER (n));
512
cairo_dock_add_in_menu_with_stock_and_data (cID, NULL, (GFunc) _on_select_access_point, pSubMenu, GINT_TO_POINTER (n));