798
add_access_point_other (CcNetworkPanel *panel)
800
CcNetworkPanelPrivate *priv = panel->priv;
801
GtkListStore *liststore_wireless_network;
802
GtkTreeIter treeiter;
804
liststore_wireless_network = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
805
"liststore_wireless_network"));
807
gtk_list_store_append (liststore_wireless_network, &treeiter);
808
gtk_list_store_set (liststore_wireless_network,
810
PANEL_WIRELESS_COLUMN_ID, "ap-other...",
811
/* TRANSLATORS: this is when the access point is not listed
812
* in the dropdown (or hidden) and the user has to select
813
* another entry manually */
814
PANEL_WIRELESS_COLUMN_TITLE, C_("Wireless access point", "Other..."),
816
PANEL_WIRELESS_COLUMN_SORT, "",
817
PANEL_WIRELESS_COLUMN_STRENGTH, 0,
818
PANEL_WIRELESS_COLUMN_MODE, NM_802_11_MODE_UNKNOWN,
819
PANEL_WIRELESS_COLUMN_SECURITY, NM_AP_SEC_UNKNOWN,
799
825
ip4_address_as_string (guint32 ip)
1362
1388
ap = NM_ACCESS_POINT (g_ptr_array_index (aps_unique, i));
1363
1389
add_access_point (panel, ap, active_ap);
1391
add_access_point_other (panel);
1365
1392
if (active_ap == NULL) {
1366
1393
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
1367
1394
"combobox_wireless_network_name"));
2217
connect_to_hidden_network_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
2219
GError *error = NULL;
2220
GVariant *result = NULL;
2222
result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
2223
if (result == NULL) {
2224
g_warning ("failed to connect to hidden network: %s",
2226
g_error_free (error);
2232
connect_to_hidden_network (CcNetworkPanel *panel)
2235
GVariant *res = NULL;
2236
GError *error = NULL;
2238
/* connect to NM applet */
2239
proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
2240
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
2241
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
2243
"org.gnome.network_manager_applet",
2244
"/org/gnome/network_manager_applet",
2245
"org.gnome.network_manager_applet",
2246
panel->priv->cancellable,
2248
if (proxy == NULL) {
2249
g_warning ("failed to connect to NM applet: %s",
2251
g_error_free (error);
2255
/* try to show the hidden network UI */
2256
g_dbus_proxy_call (proxy,
2257
"ConnectToHiddenNetwork",
2259
G_DBUS_CALL_FLAGS_NONE,
2260
5000, /* don't wait forever */
2261
panel->priv->cancellable,
2262
connect_to_hidden_network_cb,
2266
g_object_unref (proxy);
2268
g_variant_unref (res);
2190
2272
wireless_ap_changed_cb (GtkComboBox *combo_box, CcNetworkPanel *panel)
2192
2274
const GByteArray *ssid;
2228
2310
g_debug ("try to connect to WIFI network %s [%s]",
2229
2311
ssid_target, object_path);
2312
if (g_strcmp0 (object_path, "ap-other...") == 0) {
2313
connect_to_hidden_network (panel);
2231
2317
/* look for an existing connection we can use */
2232
2318
list = nm_remote_settings_list_connections (panel->priv->remote_settings);
2276
2362
g_free (object_path);
2366
wireless_ap_model_sort_cb (GtkTreeModel *model,
2375
gtk_tree_model_get (model, a,
2376
PANEL_WIRELESS_COLUMN_SORT, &str_a,
2378
gtk_tree_model_get (model, b,
2379
PANEL_WIRELESS_COLUMN_SORT, &str_b,
2382
/* special case blank entries to the bottom */
2383
if (g_strcmp0 (str_a, "") == 0) {
2387
if (g_strcmp0 (str_b, "") == 0) {
2392
/* case sensitive search like before */
2393
g_debug ("compare %s with %s", str_a, str_b);
2394
retval = g_strcmp0 (str_a, str_b);
2280
2402
cc_network_panel_init (CcNetworkPanel *panel)
2437
2559
gtk_tree_sortable_set_sort_column_id (sortable,
2438
2560
PANEL_WIRELESS_COLUMN_SORT,
2439
2561
GTK_SORT_ASCENDING);
2562
gtk_tree_sortable_set_sort_func (sortable,
2563
PANEL_WIRELESS_COLUMN_SORT,
2564
wireless_ap_model_sort_cb,
2441
2568
renderer = panel_cell_renderer_signal_new ();
2442
2569
gtk_cell_renderer_set_padding (renderer, 4, 0);