diff options
author | Dongxiao Xu <dongxiao.xu@intel.com> | 2011-06-16 16:58:20 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-06-29 14:46:55 +0100 |
commit | 35d84744e94bdf8e58eb0ffe578390f6f5d76304 (patch) | |
tree | 405b15bcdddd798a28200657f7c37990d58dd3ac /meta/recipes-connectivity/connman/connman-gnome | |
parent | 663373c4fb0fa7919cdf1be9ef3cdfa44c8d3048 (diff) | |
download | poky-35d84744e94bdf8e58eb0ffe578390f6f5d76304.tar.gz |
connman-gnome: Add 3G configuration support
Apply 3g.patch which add cellular config option in connman-gnome.
(From OE-Core rev: 724a06bbbb0bb93e156d4769e08b8f6bf2de555c)
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/connman/connman-gnome')
-rw-r--r-- | meta/recipes-connectivity/connman/connman-gnome/3g.patch | 505 |
1 files changed, 505 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/connman/connman-gnome/3g.patch b/meta/recipes-connectivity/connman/connman-gnome/3g.patch new file mode 100644 index 0000000000..c73c1ea4b8 --- /dev/null +++ b/meta/recipes-connectivity/connman/connman-gnome/3g.patch | |||
@@ -0,0 +1,505 @@ | |||
1 | commit 15852e826b0b47f577718ada4b68b63515387f4d | ||
2 | Author: dongxiao <dongxiao@dongxiao-osel.(none)> | ||
3 | Date: Wed Jun 1 14:56:16 2011 +0800 | ||
4 | |||
5 | connman-gnome: Add cellular network config option. | ||
6 | |||
7 | Add cellular network config option in connman-gnome. | ||
8 | |||
9 | Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> | ||
10 | |||
11 | diff --git a/common/connman-client.c b/common/connman-client.c | ||
12 | index e907cc2..d6be363 100644 | ||
13 | --- a/common/connman-client.c | ||
14 | +++ b/common/connman-client.c | ||
15 | @@ -112,9 +112,10 @@ static void connman_client_init(ConnmanClient *client) | ||
16 | G_TYPE_STRING, /* address */ | ||
17 | G_TYPE_STRING, /* netmask */ | ||
18 | G_TYPE_STRING, /* gateway */ | ||
19 | - G_TYPE_BOOLEAN, /* gateway */ | ||
20 | - G_TYPE_BOOLEAN, /* gateway */ | ||
21 | - G_TYPE_BOOLEAN);/* gateway */ | ||
22 | + G_TYPE_BOOLEAN, /* ethernet enabled */ | ||
23 | + G_TYPE_BOOLEAN, /* wifi enabled */ | ||
24 | + G_TYPE_BOOLEAN, /* cellular enabled */ | ||
25 | + G_TYPE_BOOLEAN);/* offline */ | ||
26 | |||
27 | g_object_set_data(G_OBJECT(priv->store), | ||
28 | "State", g_strdup("unavailable")); | ||
29 | @@ -218,6 +219,7 @@ static gboolean device_filter(GtkTreeModel *model, | ||
30 | switch (type) { | ||
31 | case CONNMAN_TYPE_LABEL_ETHERNET: | ||
32 | case CONNMAN_TYPE_LABEL_WIFI: | ||
33 | + case CONNMAN_TYPE_LABEL_CELLULAR: | ||
34 | case CONNMAN_TYPE_SYSCONFIG: | ||
35 | return TRUE; | ||
36 | } | ||
37 | diff --git a/common/connman-client.h b/common/connman-client.h | ||
38 | index 37e86d0..15fa098 100644 | ||
39 | --- a/common/connman-client.h | ||
40 | +++ b/common/connman-client.h | ||
41 | @@ -117,6 +117,7 @@ enum { | ||
42 | |||
43 | CONNMAN_COLUMN_ETHERNET_ENABLED,/* G_TYPE_STRING */ | ||
44 | CONNMAN_COLUMN_WIFI_ENABLED, /* G_TYPE_STRING */ | ||
45 | + CONNMAN_COLUMN_CELLULAR_ENABLED,/* G_TYPE_STRING */ | ||
46 | CONNMAN_COLUMN_OFFLINEMODE, /* G_TYPE_STRING */ | ||
47 | |||
48 | _CONNMAN_NUM_COLUMNS | ||
49 | @@ -132,6 +133,7 @@ enum { | ||
50 | |||
51 | CONNMAN_TYPE_LABEL_ETHERNET, | ||
52 | CONNMAN_TYPE_LABEL_WIFI, | ||
53 | + CONNMAN_TYPE_LABEL_CELLULAR, | ||
54 | CONNMAN_TYPE_SYSCONFIG, | ||
55 | |||
56 | _CONNMAN_NUM_TYPE, | ||
57 | diff --git a/common/connman-dbus.c b/common/connman-dbus.c | ||
58 | index b5a635c..0f4e1db 100644 | ||
59 | --- a/common/connman-dbus.c | ||
60 | +++ b/common/connman-dbus.c | ||
61 | @@ -208,6 +208,8 @@ static const gchar *type2icon(guint type) | ||
62 | case CONNMAN_TYPE_WIFI: | ||
63 | case CONNMAN_TYPE_WIMAX: | ||
64 | return "network-wireless"; | ||
65 | + case CONNMAN_TYPE_CELLULAR: | ||
66 | + return "network-cellular"; | ||
67 | case CONNMAN_TYPE_BLUETOOTH: | ||
68 | return "bluetooth"; | ||
69 | } | ||
70 | @@ -220,6 +222,7 @@ static void enabled_technologies_changed(GtkTreeStore *store, GValue *value) | ||
71 | GtkTreeIter iter; | ||
72 | gboolean ethernet_enabled_prev, ethernet_enabled = FALSE; | ||
73 | gboolean wifi_enabled_prev, wifi_enabled = FALSE; | ||
74 | + gboolean cellular_enabled_prev, cellular_enabled = FALSE; | ||
75 | gchar **tech = g_value_get_boxed (value); | ||
76 | guint i; | ||
77 | |||
78 | @@ -227,10 +230,13 @@ static void enabled_technologies_changed(GtkTreeStore *store, GValue *value) | ||
79 | return; | ||
80 | |||
81 | for (i = 0; i < g_strv_length(tech); i++) { | ||
82 | + DBG("technology: %s", *(tech+i)); | ||
83 | if (g_str_equal("ethernet", *(tech + i))) | ||
84 | ethernet_enabled = TRUE; | ||
85 | else if (g_str_equal ("wifi", *(tech + i))) | ||
86 | wifi_enabled = TRUE; | ||
87 | + else if (g_str_equal ("cellular", *(tech + i))) | ||
88 | + cellular_enabled = TRUE; | ||
89 | } | ||
90 | |||
91 | get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_ETHERNET); | ||
92 | @@ -246,6 +252,13 @@ static void enabled_technologies_changed(GtkTreeStore *store, GValue *value) | ||
93 | if (wifi_enabled_prev != wifi_enabled) | ||
94 | gtk_tree_store_set(store, &iter, | ||
95 | CONNMAN_COLUMN_WIFI_ENABLED, wifi_enabled, -1); | ||
96 | + | ||
97 | + get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_CELLULAR); | ||
98 | + gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, | ||
99 | + CONNMAN_COLUMN_CELLULAR_ENABLED, &cellular_enabled_prev, -1); | ||
100 | + if (cellular_enabled_prev != cellular_enabled) | ||
101 | + gtk_tree_store_set(store, &iter, | ||
102 | + CONNMAN_COLUMN_CELLULAR_ENABLED, cellular_enabled, -1); | ||
103 | } | ||
104 | |||
105 | static void enabled_technologies_properties(GtkTreeStore *store, DBusGProxy *proxy, GValue *value) | ||
106 | @@ -253,14 +266,18 @@ static void enabled_technologies_properties(GtkTreeStore *store, DBusGProxy *pro | ||
107 | GtkTreeIter iter; | ||
108 | gboolean ethernet_enabled = FALSE; | ||
109 | gboolean wifi_enabled = FALSE; | ||
110 | + gboolean cellular_enabled = FALSE; | ||
111 | gchar **tech = g_value_get_boxed (value); | ||
112 | guint i; | ||
113 | |||
114 | for (i = 0; i < g_strv_length (tech); i++) { | ||
115 | + DBG("technology: %s", *(tech+i)); | ||
116 | if (g_str_equal("ethernet", *(tech + i))) | ||
117 | ethernet_enabled = TRUE; | ||
118 | else if (g_str_equal ("wifi", *(tech + i))) | ||
119 | wifi_enabled = TRUE; | ||
120 | + else if (g_str_equal ("cellular", *(tech + i))) | ||
121 | + cellular_enabled = TRUE; | ||
122 | } | ||
123 | |||
124 | if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_ETHERNET) == FALSE) | ||
125 | @@ -280,6 +297,15 @@ static void enabled_technologies_properties(GtkTreeStore *store, DBusGProxy *pro | ||
126 | CONNMAN_COLUMN_WIFI_ENABLED, wifi_enabled, | ||
127 | CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_WIFI, | ||
128 | -1); | ||
129 | + | ||
130 | + if (get_iter_from_type(store, &iter, CONNMAN_TYPE_LABEL_CELLULAR) == FALSE) | ||
131 | + gtk_tree_store_append(store, &iter, NULL); | ||
132 | + | ||
133 | + gtk_tree_store_set(store, &iter, | ||
134 | + CONNMAN_COLUMN_PROXY, proxy, | ||
135 | + CONNMAN_COLUMN_CELLULAR_ENABLED, cellular_enabled, | ||
136 | + CONNMAN_COLUMN_TYPE, CONNMAN_TYPE_LABEL_CELLULAR, | ||
137 | + -1); | ||
138 | } | ||
139 | |||
140 | static void offline_mode_changed(GtkTreeStore *store, GValue *value) | ||
141 | @@ -497,6 +523,9 @@ static void service_properties(DBusGProxy *proxy, GHashTable *hash, | ||
142 | case CONNMAN_TYPE_WIFI: | ||
143 | label_type = CONNMAN_TYPE_LABEL_WIFI; | ||
144 | break; | ||
145 | + case CONNMAN_TYPE_CELLULAR: | ||
146 | + label_type = CONNMAN_TYPE_LABEL_CELLULAR; | ||
147 | + break; | ||
148 | default: | ||
149 | label_type = CONNMAN_TYPE_UNKNOWN; | ||
150 | break; | ||
151 | diff --git a/icons/connman-type-cellular.png b/icons/connman-type-cellular.png | ||
152 | new file mode 100644 | ||
153 | index 0000000..386abd5 | ||
154 | Binary files /dev/null and b/icons/connman-type-cellular.png differ | ||
155 | diff --git a/properties/Makefile.am b/properties/Makefile.am | ||
156 | index fc1b8c6..30ae442 100644 | ||
157 | --- a/properties/Makefile.am | ||
158 | +++ b/properties/Makefile.am | ||
159 | @@ -1,7 +1,7 @@ | ||
160 | |||
161 | bin_PROGRAMS = connman-properties | ||
162 | |||
163 | -connman_properties_SOURCES = main.c advanced.h ethernet.c wifi.c | ||
164 | +connman_properties_SOURCES = main.c advanced.h ethernet.c wifi.c cellular.c | ||
165 | |||
166 | connman_properties_LDADD = $(top_builddir)/common/libcommon.a \ | ||
167 | @GTK_LIBS@ @DBUS_LIBS@ | ||
168 | diff --git a/properties/advanced.h b/properties/advanced.h | ||
169 | index 79a1c3c..d8f4117 100644 | ||
170 | --- a/properties/advanced.h | ||
171 | +++ b/properties/advanced.h | ||
172 | @@ -59,10 +59,18 @@ struct config_data { | ||
173 | GtkWidget *disconnect; | ||
174 | } wifi; | ||
175 | |||
176 | + struct { | ||
177 | + GtkWidget *name; | ||
178 | + GtkWidget *strength; | ||
179 | + GtkWidget *connect_info; | ||
180 | + GtkWidget *connect; | ||
181 | + GtkWidget *disconnect; | ||
182 | + } cellular; | ||
183 | + | ||
184 | GtkWidget *ethernet_button; | ||
185 | GtkWidget *wifi_button; | ||
186 | - | ||
187 | GtkWidget *scan_button; | ||
188 | + GtkWidget *cellular_button; | ||
189 | GtkWidget *offline_button; | ||
190 | }; | ||
191 | |||
192 | @@ -88,8 +96,11 @@ void update_ethernet_ipv4(struct config_data *data, guint policy); | ||
193 | void add_wifi_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data); | ||
194 | void update_wifi_policy(struct config_data *data, guint policy); | ||
195 | |||
196 | +void add_cellular_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data); | ||
197 | void add_ethernet_switch_button(GtkWidget *mainbox, GtkTreeIter *iter, | ||
198 | struct config_data *data); | ||
199 | |||
200 | void add_wifi_switch_button(GtkWidget *mainbox, GtkTreeIter *iter, | ||
201 | struct config_data *data); | ||
202 | +void add_cellular_switch_button(GtkWidget *mainbox, GtkTreeIter *iter, | ||
203 | + struct config_data *data); | ||
204 | diff --git a/properties/cellular.c b/properties/cellular.c | ||
205 | new file mode 100644 | ||
206 | index 0000000..7bbfb89 | ||
207 | --- /dev/null | ||
208 | +++ b/properties/cellular.c | ||
209 | @@ -0,0 +1,175 @@ | ||
210 | +/* | ||
211 | + * | ||
212 | + * Connection Manager | ||
213 | + * | ||
214 | + * Copyright (C) 2011 Intel Corporation. All rights reserved. | ||
215 | + * | ||
216 | + * This program is free software; you can redistribute it and/or modify | ||
217 | + * it under the terms of the GNU General Public License version 2 as | ||
218 | + * published by the Free Software Foundation. | ||
219 | + * | ||
220 | + * This program is distributed in the hope that it will be useful, | ||
221 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
222 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
223 | + * GNU General Public License for more details. | ||
224 | + * | ||
225 | + * You should have received a copy of the GNU General Public License | ||
226 | + * along with this program; if not, write to the Free Software | ||
227 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
228 | + * | ||
229 | + */ | ||
230 | + | ||
231 | +#ifdef HAVE_CONFIG_H | ||
232 | +#include <config.h> | ||
233 | +#endif | ||
234 | + | ||
235 | +#include <dbus/dbus-glib.h> | ||
236 | +#include <glib/gi18n.h> | ||
237 | +#include <gtk/gtk.h> | ||
238 | + | ||
239 | +#include "connman-client.h" | ||
240 | + | ||
241 | +#include "advanced.h" | ||
242 | + | ||
243 | +static void connect_reply_cb(DBusGProxy *proxy, GError *error, | ||
244 | + gpointer user_data) | ||
245 | +{ | ||
246 | + if (error) | ||
247 | + g_error_free(error); | ||
248 | +} | ||
249 | + | ||
250 | +static void connect_callback(GtkWidget *editable, gpointer user_data) | ||
251 | +{ | ||
252 | + struct config_data *data = user_data; | ||
253 | + | ||
254 | + connman_client_connect_async(data->client, data->device, connect_reply_cb, data); | ||
255 | +} | ||
256 | + | ||
257 | + | ||
258 | +static void disconnect_callback(GtkWidget *editable, gpointer user_data) | ||
259 | +{ | ||
260 | + struct config_data *data = user_data; | ||
261 | + | ||
262 | + connman_client_disconnect(data->client, data->device); | ||
263 | +} | ||
264 | + | ||
265 | +static void switch_callback(GtkWidget *editable, gpointer user_data) | ||
266 | +{ | ||
267 | + struct config_data *data = user_data; | ||
268 | + const gchar *label = gtk_button_get_label(GTK_BUTTON(data->cellular_button)); | ||
269 | + | ||
270 | + if (g_str_equal(label, "Disable")) | ||
271 | + connman_client_disable_technology(data->client, data->device, "cellular"); | ||
272 | + else | ||
273 | + connman_client_enable_technology(data->client, data->device, "cellular"); | ||
274 | +} | ||
275 | + | ||
276 | +void add_cellular_switch_button(GtkWidget *mainbox, GtkTreeIter *iter, | ||
277 | + struct config_data *data) | ||
278 | +{ | ||
279 | + GtkWidget *vbox; | ||
280 | + GtkWidget *table; | ||
281 | + GtkWidget *label; | ||
282 | + GtkWidget *buttonbox; | ||
283 | + GtkWidget *button; | ||
284 | + gboolean cellular_enabled; | ||
285 | + | ||
286 | + gtk_tree_model_get(data->model, iter, | ||
287 | + CONNMAN_COLUMN_CELLULAR_ENABLED, &cellular_enabled, | ||
288 | + -1); | ||
289 | + | ||
290 | + vbox = gtk_vbox_new(TRUE, 0); | ||
291 | + gtk_container_set_border_width(GTK_CONTAINER(vbox), 24); | ||
292 | + gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0); | ||
293 | + | ||
294 | + table = gtk_table_new(1, 1, TRUE); | ||
295 | + gtk_table_set_row_spacings(GTK_TABLE(table), 10); | ||
296 | + gtk_table_set_col_spacings(GTK_TABLE(table), 10); | ||
297 | + gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | ||
298 | + | ||
299 | + label = gtk_label_new(_("Configure Cellular Networks.")); | ||
300 | + gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); | ||
301 | + | ||
302 | + buttonbox = gtk_hbutton_box_new(); | ||
303 | + gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonbox), GTK_BUTTONBOX_CENTER); | ||
304 | + gtk_box_pack_start(GTK_BOX(mainbox), buttonbox, FALSE, FALSE, 0); | ||
305 | + | ||
306 | + button = gtk_button_new(); | ||
307 | + data->cellular_button = button; | ||
308 | + | ||
309 | + if (cellular_enabled) | ||
310 | + gtk_button_set_label(GTK_BUTTON(button), _("Disable")); | ||
311 | + else | ||
312 | + gtk_button_set_label(GTK_BUTTON(button), _("Enable")); | ||
313 | + | ||
314 | + gtk_container_add(GTK_CONTAINER(buttonbox), button); | ||
315 | + g_signal_connect(G_OBJECT(button), "clicked", | ||
316 | + G_CALLBACK(switch_callback), data); | ||
317 | +} | ||
318 | + | ||
319 | +void add_cellular_service(GtkWidget *mainbox, GtkTreeIter *iter, struct config_data *data) | ||
320 | +{ | ||
321 | + GtkWidget *vbox; | ||
322 | + GtkWidget *table; | ||
323 | + GtkWidget *label; | ||
324 | + GtkWidget *button; | ||
325 | + | ||
326 | + const char *name, *icon, *state; | ||
327 | + guint strength; | ||
328 | + | ||
329 | + gtk_tree_model_get(data->model, iter, | ||
330 | + CONNMAN_COLUMN_NAME, &name, | ||
331 | + CONNMAN_COLUMN_ICON, &icon, | ||
332 | + CONNMAN_COLUMN_STATE, &state, | ||
333 | + CONNMAN_COLUMN_STRENGTH, &strength, | ||
334 | + -1); | ||
335 | + | ||
336 | + if (g_str_equal(state, "failure") == TRUE) | ||
337 | + connman_client_remove(data->client, data->device); | ||
338 | + | ||
339 | + vbox = gtk_vbox_new(TRUE, 0); | ||
340 | + gtk_container_set_border_width(GTK_CONTAINER(vbox), 24); | ||
341 | + gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0); | ||
342 | + | ||
343 | + table = gtk_table_new(4, 8, TRUE); | ||
344 | + gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); | ||
345 | + data->table = table; | ||
346 | + | ||
347 | + label = gtk_label_new(_("Access Point:")); | ||
348 | + gtk_table_attach_defaults(GTK_TABLE(table), label, 3, 4, 0, 1); | ||
349 | + | ||
350 | + label = gtk_label_new(_(name)); | ||
351 | + gtk_table_attach_defaults(GTK_TABLE(table), label, 4, 5, 0, 1); | ||
352 | + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); | ||
353 | + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); | ||
354 | + data->cellular.name = label; | ||
355 | + | ||
356 | + label = gtk_label_new(_("")); | ||
357 | + gtk_table_attach_defaults(GTK_TABLE(table), label, 3, 5, 2, 3); | ||
358 | + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); | ||
359 | + gtk_widget_hide(label); | ||
360 | + data->cellular.connect_info = label; | ||
361 | + | ||
362 | + button = gtk_button_new_with_label(_("Connect")); | ||
363 | + gtk_table_attach_defaults(GTK_TABLE(table), button, 3, 5, 3, 4); | ||
364 | + g_signal_connect(G_OBJECT(button), "clicked", | ||
365 | + G_CALLBACK(connect_callback), data); | ||
366 | + gtk_widget_set_no_show_all(button, TRUE); | ||
367 | + data->cellular.connect = button; | ||
368 | + | ||
369 | + button = gtk_button_new_with_label(_("Disconnect")); | ||
370 | + gtk_table_attach_defaults(GTK_TABLE(table), button, 3, 5, 3, 4); | ||
371 | + g_signal_connect(G_OBJECT(button), "clicked", | ||
372 | + G_CALLBACK(disconnect_callback), data); | ||
373 | + data->cellular.disconnect = button; | ||
374 | + gtk_widget_set_no_show_all(button, TRUE); | ||
375 | + | ||
376 | + if (g_str_equal(state, "failure") == TRUE | ||
377 | + || g_str_equal(state, "idle") == TRUE) { | ||
378 | + gtk_widget_show(data->cellular.connect); | ||
379 | + gtk_widget_hide(data->cellular.disconnect); | ||
380 | + } else { | ||
381 | + gtk_widget_hide(data->cellular.connect); | ||
382 | + gtk_widget_show(data->cellular.disconnect); | ||
383 | + } | ||
384 | +} | ||
385 | diff --git a/properties/main.c b/properties/main.c | ||
386 | index a09c721..ec36aef 100644 | ||
387 | --- a/properties/main.c | ||
388 | +++ b/properties/main.c | ||
389 | @@ -42,6 +42,7 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path, | ||
390 | const char *name = NULL, *_name = NULL, *state = NULL; | ||
391 | gboolean ethernet_enabled; | ||
392 | gboolean wifi_enabled; | ||
393 | + gboolean cellular_enabled; | ||
394 | gboolean offline_mode; | ||
395 | |||
396 | gtk_tree_model_get(model, iter, | ||
397 | @@ -50,6 +51,7 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path, | ||
398 | CONNMAN_COLUMN_TYPE, &type, | ||
399 | CONNMAN_COLUMN_ETHERNET_ENABLED, ðernet_enabled, | ||
400 | CONNMAN_COLUMN_WIFI_ENABLED, &wifi_enabled, | ||
401 | + CONNMAN_COLUMN_CELLULAR_ENABLED, &cellular_enabled, | ||
402 | CONNMAN_COLUMN_OFFLINEMODE, &offline_mode, | ||
403 | -1); | ||
404 | |||
405 | @@ -75,6 +77,29 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path, | ||
406 | gtk_widget_hide(data->wifi.connect); | ||
407 | gtk_widget_show(data->wifi.disconnect); | ||
408 | } | ||
409 | + } else if (type == CONNMAN_TYPE_CELLULAR) { | ||
410 | + if (data->cellular.name) | ||
411 | + _name = gtk_label_get_text(GTK_LABEL(data->cellular.name)); | ||
412 | + | ||
413 | + if (!(name && _name && g_str_equal(name, _name))) | ||
414 | + return; | ||
415 | + | ||
416 | + if (g_str_equal(state, "failure") == TRUE) { | ||
417 | + gtk_label_set_text(GTK_LABEL(data->cellular.connect_info), | ||
418 | + _("connection failed")); | ||
419 | + gtk_widget_show(data->cellular.connect_info); | ||
420 | + gtk_widget_show(data->cellular.connect); | ||
421 | + gtk_widget_hide(data->cellular.disconnect); | ||
422 | + } else if (g_str_equal(state, "idle") == TRUE) { | ||
423 | + gtk_widget_hide(data->cellular.connect_info); | ||
424 | + gtk_widget_show(data->cellular.connect); | ||
425 | + gtk_widget_hide(data->cellular.disconnect); | ||
426 | + } else { | ||
427 | + gtk_widget_hide(data->cellular.connect_info); | ||
428 | + gtk_widget_hide(data->cellular.connect); | ||
429 | + gtk_widget_show(data->cellular.disconnect); | ||
430 | + } | ||
431 | + | ||
432 | } else if (type == CONNMAN_TYPE_LABEL_ETHERNET) { | ||
433 | if (!data->ethernet_button) | ||
434 | return; | ||
435 | @@ -92,6 +117,13 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path, | ||
436 | gtk_button_set_label(GTK_BUTTON(data->wifi_button), _("Enable")); | ||
437 | gtk_widget_set_sensitive(data->scan_button, 0); | ||
438 | } | ||
439 | + } else if (type == CONNMAN_TYPE_LABEL_CELLULAR) { | ||
440 | + if (!data->cellular_button) | ||
441 | + return; | ||
442 | + if (cellular_enabled) | ||
443 | + gtk_button_set_label(GTK_BUTTON(data->cellular_button), _("Disable")); | ||
444 | + else | ||
445 | + gtk_button_set_label(GTK_BUTTON(data->cellular_button), _("Enable")); | ||
446 | } else if (type == CONNMAN_TYPE_SYSCONFIG) { | ||
447 | if (!data->offline_button) | ||
448 | return; | ||
449 | @@ -100,7 +132,6 @@ static void status_update(GtkTreeModel *model, GtkTreePath *path, | ||
450 | else | ||
451 | gtk_button_set_label(GTK_BUTTON(data->offline_button), _("OfflineMode")); | ||
452 | } | ||
453 | - | ||
454 | } | ||
455 | |||
456 | static void set_offline_callback(GtkWidget *button, gpointer user_data) | ||
457 | @@ -207,12 +238,18 @@ static struct config_data *create_config(GtkTreeModel *model, | ||
458 | case CONNMAN_TYPE_WIFI: | ||
459 | add_wifi_service(mainbox, iter, data); | ||
460 | break; | ||
461 | + case CONNMAN_TYPE_CELLULAR: | ||
462 | + add_cellular_service(mainbox, iter, data); | ||
463 | + break; | ||
464 | case CONNMAN_TYPE_LABEL_ETHERNET: | ||
465 | add_ethernet_switch_button(mainbox, iter, data); | ||
466 | break; | ||
467 | case CONNMAN_TYPE_LABEL_WIFI: | ||
468 | add_wifi_switch_button(mainbox, iter, data); | ||
469 | break; | ||
470 | + case CONNMAN_TYPE_LABEL_CELLULAR: | ||
471 | + add_cellular_switch_button(mainbox, iter, data); | ||
472 | + break; | ||
473 | case CONNMAN_TYPE_SYSCONFIG: | ||
474 | add_system_config(mainbox, iter, data); | ||
475 | break; | ||
476 | @@ -295,6 +332,7 @@ static void device_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell, | ||
477 | markup = g_strdup_printf(" %s\n", title); | ||
478 | break; | ||
479 | case CONNMAN_TYPE_WIFI: | ||
480 | + case CONNMAN_TYPE_CELLULAR: | ||
481 | /* Show the AP name */ | ||
482 | title = N_(name); | ||
483 | if (g_str_equal(state, "association") == TRUE) | ||
484 | @@ -324,6 +362,10 @@ static void device_to_text(GtkTreeViewColumn *column, GtkCellRenderer *cell, | ||
485 | title = N_("Wireless Networks"); | ||
486 | markup = g_strdup_printf("<b>\n%s\n</b>", title); | ||
487 | break; | ||
488 | + case CONNMAN_TYPE_LABEL_CELLULAR: | ||
489 | + title = N_("Cellular Networks"); | ||
490 | + markup = g_strdup_printf("<b>\n%s\n</b>", title); | ||
491 | + break; | ||
492 | case CONNMAN_TYPE_SYSCONFIG: | ||
493 | title = N_("System Configuration"); | ||
494 | markup = g_strdup_printf("<b>\n%s\n</b>", title); | ||
495 | @@ -362,6 +404,10 @@ static void type_to_icon(GtkTreeViewColumn *column, GtkCellRenderer *cell, | ||
496 | g_object_set(cell, "icon-name", "network-wireless", | ||
497 | "stock-size", 4, NULL); | ||
498 | break; | ||
499 | + case CONNMAN_TYPE_LABEL_CELLULAR: | ||
500 | + g_object_set(cell, "icon-name", "network-cellular", | ||
501 | + "stock-size", 4, NULL); | ||
502 | + break; | ||
503 | default: | ||
504 | g_object_set(cell, "icon-name", NULL, NULL); | ||
505 | break; | ||