~ubuntu-branches/ubuntu/vivid/modemmanager/vivid-proposed

« back to all changes in this revision

Viewing changes to obsolete-patches/nm-applet-r1053-use-modem-manager.patch

  • Committer: Bazaar Package Importer
  • Author(s): Michael Biebl
  • Date: 2011-06-16 17:12:41 UTC
  • mfrom: (16.1.1 oneiric)
  • Revision ID: james.westby@ubuntu.com-20110616171241-k8vgsdmbpsvx467q
Tags: 0.4.997-1
* debian/watch: Switch to .bz2 tarballs.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
commit 48892f9ff93f48fc560e706f47afcaadd002f41e
2
 
Author: Tambet Ingo <tambet@gmail.com>
3
 
Date:   Tue Jan 13 13:36:29 2009 +0200
4
 
 
5
 
    Use ModemManager.
6
 
 
7
 
diff --git a/configure.ac b/configure.ac
8
 
index 7524739..db7597a 100644
9
 
--- a/configure.ac
10
 
+++ b/configure.ac
11
 
@@ -222,6 +222,7 @@ src/gconf-helpers/Makefile
12
 
 src/wireless-security/Makefile
13
 
 src/polkit-helpers/Makefile
14
 
 src/connection-editor/Makefile
15
 
+src/modems/Makefile
16
 
 icons/Makefile
17
 
 po/Makefile.in
18
 
 ])
19
 
diff --git a/src/Makefile.am b/src/Makefile.am
20
 
index 3486186..33d2c49 100644
21
 
--- a/src/Makefile.am
22
 
+++ b/src/Makefile.am
23
 
@@ -1,4 +1,4 @@
24
 
-SUBDIRS = marshallers utils gconf-helpers wireless-security polkit-helpers connection-editor
25
 
+SUBDIRS = marshallers utils gconf-helpers wireless-security polkit-helpers connection-editor modems
26
 
 
27
 
 NULL=
28
 
 
29
 
@@ -49,6 +49,9 @@ nm_applet_SOURCES =                   \
30
 
        applet-device-gsm.c \
31
 
        applet-device-cdma.h \
32
 
        applet-device-cdma.c \
33
 
+       mm-types.h \
34
 
+       nma-gsm-modem.c \
35
 
+       nma-gsm-modem.h \
36
 
        $(NULL)
37
 
 
38
 
 nm_applet_LDADD = \
39
 
diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c
40
 
index eaacf48..2a3d8bc 100644
41
 
--- a/src/applet-device-gsm.c
42
 
+++ b/src/applet-device-gsm.c
43
 
@@ -24,6 +24,9 @@
44
 
 #include <config.h>
45
 
 #endif
46
 
 
47
 
+#include <sys/types.h>
48
 
+#include <unistd.h>
49
 
+
50
 
 #include <glib/gi18n.h>
51
 
 #include <gtk/gtkwidget.h>
52
 
 #include <gtk/gtkmenuitem.h>
53
 
@@ -39,6 +42,8 @@
54
 
 
55
 
 #include "applet.h"
56
 
 #include "applet-device-gsm.h"
57
 
+#include "nma-gsm-modem.h"
58
 
+#include "mm-types.h"
59
 
 #include "utils.h"
60
 
 
61
 
 typedef struct {
62
 
@@ -174,6 +179,50 @@ add_default_connection_item (NMDevice *device,
63
 
 }
64
 
 
65
 
 static void
66
 
+child_setup (gpointer user_data G_GNUC_UNUSED)
67
 
+{
68
 
+       /* We are in the child process at this point */
69
 
+       pid_t pid = getpid ();
70
 
+       setpgid (pid, pid);
71
 
+}
72
 
+
73
 
+static void
74
 
+gsm_properties_cb (GtkMenuItem *mi, gpointer user_data)
75
 
+{
76
 
+       NMDevice *device = NM_DEVICE (user_data);
77
 
+       char *argv[3];
78
 
+       GError *error = NULL;
79
 
+       gboolean success;
80
 
+
81
 
+       argv[0] = BINDIR "/nm-modem-properties";
82
 
+       argv[1] = (char *) nm_device_get_udi (device);
83
 
+       argv[2] = NULL;
84
 
+
85
 
+       success = g_spawn_async ("/", argv, NULL, 0, &child_setup, NULL, NULL, &error);
86
 
+       if (!success) {
87
 
+               g_warning ("Error launching modem properties dialog: %s", error->message);
88
 
+               g_error_free (error);
89
 
+       }
90
 
+}
91
 
+
92
 
+static void
93
 
+add_properties_item (NMDevice *device,
94
 
+                     GtkWidget *menu)
95
 
+{
96
 
+       GtkWidget *item;
97
 
+
98
 
+       if (nm_device_get_state (device) != NM_DEVICE_STATE_DISCONNECTED)
99
 
+               return;
100
 
+
101
 
+       item = gtk_menu_item_new_with_label (_("Properties"));
102
 
+       g_signal_connect (item, "activate",
103
 
+                                  G_CALLBACK (gsm_properties_cb),
104
 
+                                  device);
105
 
+
106
 
+       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
107
 
+}
108
 
+
109
 
+static void
110
 
 gsm_menu_item_deactivate (GtkMenuItem *item, gpointer user_data)
111
 
 {
112
 
        GSMMenuItemInfo *info = (GSMMenuItemInfo *) user_data;
113
 
@@ -273,41 +322,67 @@ gsm_add_menu_item (NMDevice *device,
114
 
                add_connection_items (device, connections, active, menu, applet);
115
 
        else
116
 
                add_default_connection_item (device, menu, applet);
117
 
+
118
 
        add_disconnect_item (device, menu, applet);
119
 
+       add_properties_item (device, menu);
120
 
 
121
 
 out:
122
 
        g_slist_free (connections);
123
 
 }
124
 
 
125
 
 static void
126
 
+signal_quality_changed (NMAGsmModem *modem, guint32 quality, gpointer user_data)
127
 
+{
128
 
+       applet_schedule_update_icon (NM_APPLET (user_data));
129
 
+}
130
 
+
131
 
+static void
132
 
 gsm_device_state_changed (NMDevice *device,
133
 
                           NMDeviceState new_state,
134
 
                           NMDeviceState old_state,
135
 
                           NMDeviceStateReason reason,
136
 
                           NMApplet *applet)
137
 
 {
138
 
-       if (new_state == NM_DEVICE_STATE_ACTIVATED) {
139
 
-               NMConnection *connection;
140
 
-               NMSettingConnection *s_con = NULL;
141
 
-               char *str = NULL;
142
 
-
143
 
-               connection = applet_find_active_connection_for_device (device, applet, NULL);
144
 
-               if (connection) {
145
 
-                       const char *id;
146
 
-
147
 
-                       s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
148
 
-                       id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
149
 
-                       if (id)
150
 
-                               str = g_strdup_printf (_("You are now connected to '%s'."), id);
151
 
-               }
152
 
+       NMAGsmModem *modem;
153
 
+       char *oper_code;
154
 
+       char *oper_name;
155
 
+       char *msg;
156
 
+       guint32 reg_status;
157
 
+
158
 
+       if (new_state != NM_DEVICE_STATE_ACTIVATED)
159
 
+               return;
160
 
 
161
 
-               applet_do_notify_with_pref (applet,
162
 
-                                           _("Connection Established"),
163
 
-                                           str ? str : _("You are now connected to the GSM network."),
164
 
-                                           "nm-device-wwan",
165
 
-                                           PREF_DISABLE_CONNECTED_NOTIFICATIONS);
166
 
-               g_free (str);
167
 
+       modem = (NMAGsmModem *) g_object_get_data (G_OBJECT (device), "gsm-modem");
168
 
+       if (!modem) {
169
 
+                       DBusGConnection *bus;
170
 
+
171
 
+                       bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
172
 
+                       if (!bus)
173
 
+                               return;
174
 
+
175
 
+                       modem = nma_gsm_modem_new (bus, nm_device_get_udi (device));
176
 
+                       dbus_g_connection_unref (bus);
177
 
+
178
 
+                       g_object_set_data_full (G_OBJECT (device), "gsm-modem", modem, g_object_unref);
179
 
+
180
 
+                       g_signal_connect (modem, "signal-quality",
181
 
+                                                  G_CALLBACK (signal_quality_changed),
182
 
+                                                  applet);
183
 
        }
184
 
+
185
 
+       oper_code = NULL;
186
 
+       oper_name = NULL;
187
 
+       reg_status = nma_gsm_modem_get_registration_info (modem, &oper_code, &oper_name);
188
 
+       msg = g_strdup_printf (_("You are now connected to the %s GSM network '%s'."),
189
 
+                                          reg_status == MM_GSM_MODEM_REG_STATUS_ROAMING ? _("roaming") : _("home"),
190
 
+                                          oper_name);
191
 
+
192
 
+       applet_do_notify_with_pref (applet, _("Connection Established"), msg,
193
 
+                                                  "nm-device-wwan", PREF_DISABLE_CONNECTED_NOTIFICATIONS);
194
 
+
195
 
+       g_free (oper_code);
196
 
+       g_free (oper_name);
197
 
+       g_free (msg);
198
 
 }
199
 
 
200
 
 static GdkPixbuf *
201
 
@@ -318,6 +393,7 @@ gsm_get_icon (NMDevice *device,
202
 
               NMApplet *applet)
203
 
 {
204
 
        NMSettingConnection *s_con;
205
 
+       NMAGsmModem *modem;
206
 
        GdkPixbuf *pixbuf = NULL;
207
 
        const char *id;
208
 
 
209
 
@@ -341,8 +417,40 @@ gsm_get_icon (NMDevice *device,
210
 
                *tip = g_strdup_printf (_("Requesting a network address for '%s'..."), id);
211
 
                break;
212
 
        case NM_DEVICE_STATE_ACTIVATED:
213
 
-               pixbuf = applet->wwan_icon;
214
 
-               *tip = g_strdup_printf (_("Mobile broadband connection '%s' active"), id);
215
 
+               modem = (NMAGsmModem *) g_object_get_data (G_OBJECT (device), "gsm-modem");
216
 
+               if (modem) {
217
 
+                       char *oper_code;
218
 
+                       char *oper_name;
219
 
+                       guint32 reg_status;
220
 
+                       guint32 quality;
221
 
+
222
 
+                       quality = nma_gsm_modem_get_signal_quality (modem);
223
 
+                       quality = CLAMP (quality, 0, 100);
224
 
+
225
 
+                       if (quality > 80)
226
 
+                               pixbuf = applet->wireless_100_icon;
227
 
+                       else if (quality > 55)
228
 
+                               pixbuf = applet->wireless_75_icon;
229
 
+                       else if (quality > 30)
230
 
+                               pixbuf = applet->wireless_50_icon;
231
 
+                       else if (quality > 5)
232
 
+                               pixbuf = applet->wireless_25_icon;
233
 
+                       else
234
 
+                               pixbuf = applet->wireless_00_icon;
235
 
+
236
 
+                       reg_status = nma_gsm_modem_get_registration_info (modem, &oper_code, &oper_name);
237
 
+                       *tip = g_strdup_printf (_("%s GSM connection '%s' (%d%%)"),
238
 
+                                                           reg_status == MM_GSM_MODEM_REG_STATUS_ROAMING ? _("Roaming") : _("Home"),
239
 
+                                               oper_name, quality);
240
 
+
241
 
+                       g_free (oper_name);
242
 
+                       g_free (oper_code);
243
 
+
244
 
+               } else {
245
 
+                       pixbuf = applet->wireless_00_icon;
246
 
+                       *tip = g_strdup_printf (_("GSM connection"));
247
 
+               }
248
 
+
249
 
                break;
250
 
        default:
251
 
                break;
252
 
@@ -514,6 +622,7 @@ ask_for_pin_puk (NMDevice *device,
253
 
 
254
 
        w = gtk_entry_new ();
255
 
        *out_secret_entry = GTK_ENTRY (w);
256
 
+       gtk_entry_set_visibility (GTK_ENTRY (w), FALSE);
257
 
        gtk_entry_set_max_length (GTK_ENTRY (w), 4);
258
 
        gtk_entry_set_width_chars (GTK_ENTRY (w), 4);
259
 
        gtk_entry_set_activates_default (GTK_ENTRY (w), TRUE);
260
 
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
261
 
index 2522ff1..40f2d44 100644
262
 
--- a/src/connection-editor/page-mobile.c
263
 
+++ b/src/connection-editor/page-mobile.c
264
 
@@ -107,7 +107,6 @@ populate_gsm_ui (CEPageMobile *self, NMConnection *connection)
265
 
        int type_idx;
266
 
        GHashTable *secrets;
267
 
        GValue *value;
268
 
-       GtkWidget *widget;
269
 
        const char *s;
270
 
 
271
 
        s = nm_setting_gsm_get_number (setting);
272
 
@@ -146,17 +145,6 @@ populate_gsm_ui (CEPageMobile *self, NMConnection *connection)
273
 
        }
274
 
        gtk_combo_box_set_active (priv->network_type, type_idx);
275
 
 
276
 
-       /* Hide network type widgets; not supported yet */
277
 
-       gtk_widget_hide (GTK_WIDGET (priv->network_type));
278
 
-       widget = glade_xml_get_widget (CE_PAGE (self)->xml, "type_label");
279
 
-       gtk_widget_hide (widget);
280
 
-
281
 
-       /* Hide Band widgets; not supported yet */
282
 
-       widget = glade_xml_get_widget (CE_PAGE (self)->xml, "mobile_band");
283
 
-       gtk_widget_hide (widget);
284
 
-       widget = glade_xml_get_widget (CE_PAGE (self)->xml, "band_label");
285
 
-       gtk_widget_hide (widget);
286
 
-
287
 
        secrets = get_secrets (connection, nm_setting_get_name (priv->setting));
288
 
 
289
 
        s = nm_setting_gsm_get_password (setting);
290
 
diff --git a/src/mm-types.h b/src/mm-types.h
291
 
new file mode 100644
292
 
index 0000000..a1f9979
293
 
--- /dev/null
294
 
+++ b/src/mm-types.h
295
 
@@ -0,0 +1,18 @@
296
 
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
297
 
+
298
 
+#ifndef MM_TYPES_H
299
 
+#define MM_TYPES_H
300
 
+
301
 
+#define MM_DBUS_SERVICE "org.freedesktop.ModemManager"
302
 
+#define MM_DBUS_INTERFACE_MODEM_GSM "org.freedesktop.ModemManager.Modem.Gsm.Network"
303
 
+
304
 
+enum {
305
 
+  MM_GSM_MODEM_REG_STATUS_IDLE = 0,
306
 
+  MM_GSM_MODEM_REG_STATUS_HOME = 1,
307
 
+  MM_GSM_MODEM_REG_STATUS_SEARCHING = 2,
308
 
+  MM_GSM_MODEM_REG_STATUS_DENIED = 3,
309
 
+  MM_GSM_MODEM_REG_STATUS_UNKNOWN = 4,
310
 
+  MM_GSM_MODEM_REG_STATUS_ROAMING = 5
311
 
+};
312
 
+
313
 
+#endif /* MM_TYPES_H */
314
 
diff --git a/src/modems/Makefile.am b/src/modems/Makefile.am
315
 
new file mode 100644
316
 
index 0000000..206ee52
317
 
--- /dev/null
318
 
+++ b/src/modems/Makefile.am
319
 
@@ -0,0 +1,25 @@
320
 
+bin_PROGRAMS = nm-modem-properties
321
 
+
322
 
+nm_modem_properties_CPPFLAGS = \
323
 
+       $(NMA_CFLAGS)                           \
324
 
+       -DICONDIR=\""$(datadir)/icons"\"        \
325
 
+       -DGLADEDIR=\""$(gladedir)"\"            \
326
 
+       -DBINDIR=\""$(bindir)"\"                \
327
 
+       -DSYSCONFDIR=\""$(sysconfdir)"\"        \
328
 
+       -DLIBDIR=\""$(libdir)"\"        \
329
 
+       -DNMALOCALEDIR=\"$(datadir)/locale\"    \
330
 
+       $(DBUS_CFLAGS)                          \
331
 
+       -I${top_srcdir}/src/gconf-helpers
332
 
+
333
 
+nm_modem_properties_SOURCES = \
334
 
+       main.c
335
 
+
336
 
+nm_modem_properties_LDADD = \
337
 
+       $(top_builddir)/src/gconf-helpers/libgconf-helpers.la \
338
 
+       $(NMA_LIBS)
339
 
+
340
 
+gladedir = $(datadir)/nm-applet
341
 
+glade_DATA = nm-modem-properties.glade
342
 
+
343
 
+CLEANFILES = *.bak *.gladep
344
 
+EXTRA_DIST = $(glade_DATA)
345
 
diff --git a/src/modems/main.c b/src/modems/main.c
346
 
new file mode 100644
347
 
index 0000000..3243a6c
348
 
--- /dev/null
349
 
+++ b/src/modems/main.c
350
 
@@ -0,0 +1,559 @@
351
 
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
352
 
+
353
 
+#include <string.h>
354
 
+#include <gtk/gtk.h>
355
 
+#include <glade/glade.h>
356
 
+#include <dbus/dbus-glib.h>
357
 
+#include <gconf/gconf-client.h>
358
 
+#include <nm-connection.h>
359
 
+#include <nm-setting-connection.h>
360
 
+#include <nm-setting-gsm.h>
361
 
+#include <nm-setting-serial.h>
362
 
+#include <nm-setting-ppp.h>
363
 
+#include <nm-utils.h>
364
 
+#include "gconf-helpers.h"
365
 
+
366
 
+#define MM_DBUS_SERVICE              "org.freedesktop.ModemManager"
367
 
+#define MM_DBUS_PATH                 "/org/freedesktop/ModemManager"
368
 
+#define MM_DBUS_INTERFACE            "org.freedesktop.ModemManager"
369
 
+#define MM_DBUS_INTERFACE_MODEM      "org.freedesktop.ModemManager.Modem"
370
 
+
371
 
+#define MM_DBUS_INTERFACE_MODEM_GSM_CARD    "org.freedesktop.ModemManager.Modem.Gsm.Card"
372
 
+#define MM_DBUS_INTERFACE_MODEM_GSM_NETWORK "org.freedesktop.ModemManager.Modem.Gsm.Network"
373
 
+
374
 
+#define MM_MODEM_TYPE_UNKNOWN  0
375
 
+#define MM_MODEM_TYPE_GSM      1
376
 
+#define MM_MODEM_TYPE_CDMA     2
377
 
+
378
 
+#define SCAN_COL_NAME    0
379
 
+#define SCAN_COL_STATUS  1
380
 
+#define SCAN_COL_OPER_ID 2
381
 
+
382
 
+typedef struct {
383
 
+       /* UI */
384
 
+       GladeXML *glade_xml;
385
 
+       GtkDialog *main_dialog;
386
 
+       GtkTreeView *network_list;
387
 
+       GtkListStore *network_store;
388
 
+       GtkWidget *scan_button;
389
 
+       GtkWidget *create_net_button;
390
 
+
391
 
+       GtkWidget *scan_dialog;
392
 
+       GtkProgressBar *scan_progress_bar;
393
 
+
394
 
+       GtkDialog *create_network_dialog;
395
 
+       GtkEntry *create_network_name;
396
 
+
397
 
+       /* DBus */
398
 
+       DBusGConnection *bus;
399
 
+       DBusGProxy *proxy;
400
 
+       DBusGProxy *gsm_net_proxy;
401
 
+
402
 
+       GMainLoop *main_loop;
403
 
+} AppData;
404
 
+
405
 
+static void
406
 
+get_str_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
407
 
+{
408
 
+       char *result = NULL;
409
 
+       GError *error = NULL;
410
 
+
411
 
+       if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_STRING, &result, G_TYPE_INVALID)) {
412
 
+               g_warning ("%s", error->message);
413
 
+               g_error_free (error);
414
 
+       } else {
415
 
+               gtk_label_set_text (GTK_LABEL (user_data), result);
416
 
+               g_free (result);
417
 
+       }
418
 
+}
419
 
+
420
 
+static void
421
 
+get_card_info_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
422
 
+{
423
 
+       GladeXML *glade_xml = GLADE_XML (user_data);
424
 
+       char *manufacturer = NULL;
425
 
+       char *model = NULL;
426
 
+       char *version = NULL;
427
 
+       GError *error = NULL;
428
 
+
429
 
+       if (!dbus_g_proxy_end_call (proxy, call_id, &error,
430
 
+                                                               G_TYPE_STRING, &manufacturer,
431
 
+                                                               G_TYPE_STRING, &model,
432
 
+                                                               G_TYPE_STRING, &version,
433
 
+                                                               G_TYPE_INVALID)) {
434
 
+               g_warning ("Couldn't get modem information: %s", error->message);
435
 
+               g_error_free (error);
436
 
+       } else {
437
 
+               gtk_label_set_text (GTK_LABEL (glade_xml_get_widget (glade_xml, "vendor_label")), manufacturer);
438
 
+               gtk_label_set_text (GTK_LABEL (glade_xml_get_widget (glade_xml, "model_label")), model);
439
 
+               gtk_label_set_text (GTK_LABEL (glade_xml_get_widget (glade_xml, "version_label")), version);
440
 
+
441
 
+               g_free (manufacturer);
442
 
+               g_free (model);
443
 
+               g_free (version);
444
 
+       }
445
 
+}
446
 
+
447
 
+static void
448
 
+get_property_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
449
 
+{
450
 
+       GValue value = { 0, };
451
 
+       GError *error = NULL;
452
 
+
453
 
+       if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_VALUE, &value, G_TYPE_INVALID)) {
454
 
+               g_warning ("%s", error->message);
455
 
+               g_error_free (error);
456
 
+       } else {
457
 
+               gtk_label_set_text (GTK_LABEL (user_data), g_value_get_string (&value));
458
 
+               g_value_unset (&value);
459
 
+       }
460
 
+}
461
 
+
462
 
+static gboolean
463
 
+get_info (gpointer data)
464
 
+{
465
 
+       AppData *app_data = (AppData *) data;
466
 
+
467
 
+       dbus_g_proxy_set_interface (app_data->proxy, MM_DBUS_INTERFACE_MODEM_GSM_CARD);
468
 
+       dbus_g_proxy_begin_call (app_data->proxy, "GetImsi", get_str_done,
469
 
+                                                        glade_xml_get_widget (app_data->glade_xml, "imsi_label"), NULL,
470
 
+                                                        G_TYPE_INVALID);
471
 
+
472
 
+       dbus_g_proxy_begin_call (app_data->proxy, "GetImei", get_str_done,
473
 
+                                                        glade_xml_get_widget (app_data->glade_xml, "imei_label"), NULL,
474
 
+                                                        G_TYPE_INVALID);
475
 
+
476
 
+       dbus_g_proxy_begin_call (app_data->proxy, "GetInfo", get_card_info_done,
477
 
+                                                        app_data->glade_xml, NULL,
478
 
+                                                        G_TYPE_INVALID);
479
 
+
480
 
+       dbus_g_proxy_set_interface (app_data->proxy, "org.freedesktop.DBus.Properties");
481
 
+
482
 
+       dbus_g_proxy_begin_call (app_data->proxy, "Get", get_property_done,
483
 
+                                                        glade_xml_get_widget (app_data->glade_xml, "driver_label"), NULL,
484
 
+                                                        G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM,
485
 
+                                                        G_TYPE_STRING, "Driver",
486
 
+                                                        G_TYPE_INVALID);
487
 
+
488
 
+       dbus_g_proxy_begin_call (app_data->proxy, "Get", get_property_done,
489
 
+                                                        glade_xml_get_widget (app_data->glade_xml, "device_label"), NULL,
490
 
+                                                        G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM,
491
 
+                                                        G_TYPE_STRING, "DataDevice",
492
 
+                                                        G_TYPE_INVALID);
493
 
+
494
 
+       return FALSE;
495
 
+}
496
 
+
497
 
+static void
498
 
+got_signal_quality (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
499
 
+{
500
 
+       guint32 quality = 0;
501
 
+       GError *error = NULL;
502
 
+
503
 
+       if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_UINT, &quality, G_TYPE_INVALID)) {
504
 
+               g_warning ("%s", error->message);
505
 
+               g_error_free (error);
506
 
+       } else {
507
 
+               char *tmp;
508
 
+
509
 
+               tmp = g_strdup_printf ("%d%%", quality);
510
 
+               gtk_label_set_text (GTK_LABEL (user_data), tmp);
511
 
+               g_free (tmp);
512
 
+       }
513
 
+}
514
 
+
515
 
+static void
516
 
+signal_quality_changed (DBusGProxy *proxy,
517
 
+                                               guint32 signal_quality,
518
 
+                                               gpointer user_data)
519
 
+{
520
 
+       char *tmp;
521
 
+
522
 
+       tmp = g_strdup_printf ("%d%%", signal_quality);
523
 
+       gtk_label_set_text (GTK_LABEL (user_data), tmp);
524
 
+       g_free (tmp);
525
 
+}
526
 
+
527
 
+static gboolean
528
 
+monitor_signal_quality (gpointer data)
529
 
+{
530
 
+       AppData *app_data = (AppData *) data;
531
 
+       GtkWidget *label;
532
 
+
533
 
+       label = glade_xml_get_widget (app_data->glade_xml, "signal_quality_label");
534
 
+
535
 
+       dbus_g_proxy_add_signal (app_data->gsm_net_proxy, "SignalQuality", G_TYPE_UINT, G_TYPE_INVALID);
536
 
+       dbus_g_proxy_connect_signal (app_data->gsm_net_proxy, "SignalQuality",
537
 
+                                                                G_CALLBACK (signal_quality_changed),
538
 
+                                                                label, NULL);
539
 
+
540
 
+       dbus_g_proxy_begin_call (app_data->gsm_net_proxy, "GetSignalQuality",
541
 
+                                                        got_signal_quality, label, NULL, G_TYPE_INVALID);
542
 
+
543
 
+       return FALSE;
544
 
+}
545
 
+
546
 
+static void
547
 
+got_scan_results (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
548
 
+{
549
 
+       AppData *app_data = (AppData *) user_data;
550
 
+       GPtrArray *array = NULL;
551
 
+       GError *error = NULL;
552
 
+       GType type;
553
 
+
554
 
+       type = dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_STRING_STRING_HASHTABLE);
555
 
+
556
 
+       if (!dbus_g_proxy_end_call (proxy, call_id, &error, type, &array, G_TYPE_INVALID)) {
557
 
+               g_warning ("Couldn't scan: %s", error->message);
558
 
+               g_error_free (error);
559
 
+       } else {
560
 
+               GtkTreeIter iter;
561
 
+               int i;
562
 
+
563
 
+               for (i = 0; i < array->len; i++) {
564
 
+                       GHashTable *hash = (GHashTable *) g_ptr_array_index (array, i);
565
 
+                       char *status;
566
 
+                       const char *status_str;
567
 
+
568
 
+                       status = g_hash_table_lookup (hash, "status");
569
 
+                       if (!strcmp (status, "1"))
570
 
+                               status_str = "Available";
571
 
+                       else if (!strcmp (status, "2"))
572
 
+                               status_str = "Current";
573
 
+                       else if (!strcmp (status, "3"))
574
 
+                               status_str = "Forbidden";
575
 
+                       else
576
 
+                               status_str = "Unknown";
577
 
+
578
 
+                       gtk_list_store_append (app_data->network_store, &iter);
579
 
+                       gtk_list_store_set (app_data->network_store, &iter,
580
 
+                                                               SCAN_COL_NAME, g_hash_table_lookup (hash, "operator-long"),
581
 
+                                                               SCAN_COL_STATUS, status_str,
582
 
+                                                               SCAN_COL_OPER_ID, g_hash_table_lookup (hash, "operator-num"),
583
 
+                                                               -1);
584
 
+
585
 
+                       g_hash_table_destroy (hash);
586
 
+               }
587
 
+
588
 
+               g_ptr_array_free (array, TRUE);
589
 
+       }
590
 
+
591
 
+       gtk_widget_hide (app_data->scan_dialog);
592
 
+       gtk_widget_set_sensitive (app_data->scan_button, TRUE);
593
 
+}
594
 
+
595
 
+static gboolean
596
 
+scan_pulse (gpointer data)
597
 
+{
598
 
+       GtkProgressBar *bar = GTK_PROGRESS_BAR (data);
599
 
+
600
 
+       gtk_progress_bar_pulse (bar);
601
 
+       return gdk_window_is_visible (gtk_widget_get_parent_window (GTK_WIDGET (bar)));
602
 
+}
603
 
+
604
 
+static void
605
 
+scan (GtkButton *button, gpointer user_data)
606
 
+{
607
 
+       AppData *app_data = (AppData *) user_data;
608
 
+
609
 
+       dbus_g_proxy_begin_call_with_timeout (app_data->gsm_net_proxy, "Scan", got_scan_results,
610
 
+                                                                                 app_data, NULL, 120000, G_TYPE_INVALID);
611
 
+
612
 
+       gtk_widget_set_sensitive (app_data->scan_button, FALSE);
613
 
+       gtk_list_store_clear (app_data->network_store);
614
 
+
615
 
+       g_timeout_add (200, scan_pulse, app_data->scan_progress_bar);
616
 
+       gtk_widget_show (app_data->scan_dialog);
617
 
+}
618
 
+
619
 
+static void
620
 
+modem_enabled (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
621
 
+{
622
 
+       AppData *app_data = (AppData *) user_data;
623
 
+       GError *error = NULL;
624
 
+
625
 
+       if (!dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID)) {
626
 
+               g_warning ("Couldn't enable modem: %s", error->message);
627
 
+               g_error_free (error);
628
 
+               g_main_loop_quit (app_data->main_loop);
629
 
+               return;
630
 
+       }
631
 
+
632
 
+       g_idle_add (get_info, app_data);
633
 
+       g_idle_add (monitor_signal_quality, app_data);
634
 
+}
635
 
+
636
 
+static void
637
 
+modem_enable (AppData *app_data)
638
 
+{
639
 
+       dbus_g_proxy_begin_call (app_data->proxy, "Enable", modem_enabled,
640
 
+                                                        app_data, NULL,
641
 
+                                                        G_TYPE_BOOLEAN, TRUE, G_TYPE_INVALID);
642
 
+}
643
 
+
644
 
+static void
645
 
+create_network (const char *name, const char *oper_code)
646
 
+{
647
 
+       NMConnection *connection;
648
 
+       NMSettingGsm *s_gsm;
649
 
+       NMSettingSerial *s_serial;
650
 
+       NMSettingPPP *s_ppp;
651
 
+       NMSettingConnection *s_con;
652
 
+       GConfClient *gconf_client;
653
 
+       char *uuid;
654
 
+
655
 
+       connection = nm_connection_new ();
656
 
+
657
 
+       s_gsm = NM_SETTING_GSM (nm_setting_gsm_new ());
658
 
+       g_object_set (s_gsm,
659
 
+                                 NM_SETTING_GSM_NUMBER, "*99#",
660
 
+                                 NM_SETTING_GSM_NETWORK_ID, oper_code,
661
 
+                                 NULL);
662
 
+
663
 
+       nm_connection_add_setting (connection, NM_SETTING (s_gsm));
664
 
+
665
 
+       /* Serial setting */
666
 
+       s_serial = (NMSettingSerial *) nm_setting_serial_new ();
667
 
+       g_object_set (s_serial,
668
 
+                                 NM_SETTING_SERIAL_BAUD, 115200,
669
 
+                                 NM_SETTING_SERIAL_BITS, 8,
670
 
+                                 NM_SETTING_SERIAL_PARITY, 'n',
671
 
+                                 NM_SETTING_SERIAL_STOPBITS, 1,
672
 
+                                 NULL);
673
 
+
674
 
+       nm_connection_add_setting (connection, NM_SETTING (s_serial));
675
 
+
676
 
+       s_ppp = (NMSettingPPP *) nm_setting_ppp_new ();
677
 
+       nm_connection_add_setting (connection, NM_SETTING (s_ppp));
678
 
+
679
 
+       s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
680
 
+       uuid = nm_utils_uuid_generate ();
681
 
+       g_object_set (s_con,
682
 
+                                 NM_SETTING_CONNECTION_ID, name,
683
 
+                                 NM_SETTING_CONNECTION_TYPE, nm_setting_get_name (NM_SETTING (s_gsm)),
684
 
+                                 NM_SETTING_CONNECTION_AUTOCONNECT, FALSE,
685
 
+                                 NM_SETTING_CONNECTION_UUID, uuid,
686
 
+                                 NULL);
687
 
+
688
 
+       g_free (uuid);
689
 
+       nm_connection_add_setting (connection, NM_SETTING (s_con));
690
 
+
691
 
+       gconf_client = gconf_client_get_default ();
692
 
+       if (gconf_client) {
693
 
+               char *dir = NULL;
694
 
+               int i;
695
 
+
696
 
+               /* Find free GConf directory */
697
 
+               for (i = 0; i < G_MAXUINT32; i++) {
698
 
+                       char buf[255];
699
 
+
700
 
+                       snprintf (&buf[0], 255, GCONF_PATH_CONNECTIONS"/%d", i);
701
 
+                       if (!gconf_client_dir_exists (gconf_client, buf, NULL)) {
702
 
+                               dir = g_strdup (buf);
703
 
+                               break;
704
 
+                       }
705
 
+               }
706
 
+
707
 
+               nm_gconf_write_connection (connection, gconf_client, dir);
708
 
+               gconf_client_notify (gconf_client, dir);
709
 
+               gconf_client_suggest_sync (gconf_client, NULL);
710
 
+               g_free (dir);
711
 
+               g_object_unref (gconf_client);
712
 
+       } else
713
 
+               g_warning ("Writing conneciton failed");
714
 
+
715
 
+       g_object_unref (connection);
716
 
+}
717
 
+
718
 
+static void
719
 
+create_network_clicked (GtkButton *button, gpointer user_data)
720
 
+{
721
 
+       AppData *app_data = (AppData *) user_data;
722
 
+       GtkTreeSelection *selection;
723
 
+       GList *selected_rows;
724
 
+       GtkTreeModel *model = NULL;
725
 
+       GtkTreeIter iter;
726
 
+
727
 
+       selection = gtk_tree_view_get_selection (app_data->network_list);
728
 
+       selected_rows = gtk_tree_selection_get_selected_rows (selection, &model);
729
 
+       if (!selected_rows)
730
 
+               return;
731
 
+
732
 
+       if (gtk_tree_model_get_iter (model, &iter, (GtkTreePath *) selected_rows->data)) {
733
 
+               char *oper_name = NULL;
734
 
+               char *oper_id = NULL;
735
 
+               gint result;
736
 
+
737
 
+               gtk_tree_model_get (model, &iter, SCAN_COL_NAME, &oper_name, -1);
738
 
+               gtk_tree_model_get (model, &iter, SCAN_COL_OPER_ID, &oper_id, -1);
739
 
+
740
 
+               gtk_entry_set_text (app_data->create_network_name, oper_name);
741
 
+               gtk_editable_select_region (GTK_EDITABLE (app_data->create_network_name), 0, -1);
742
 
+               gtk_widget_grab_focus (GTK_WIDGET (app_data->create_network_name));
743
 
+
744
 
+               result = gtk_dialog_run (app_data->create_network_dialog);
745
 
+               gtk_widget_hide (GTK_WIDGET (app_data->create_network_dialog));
746
 
+
747
 
+               if (result == GTK_RESPONSE_OK)
748
 
+                       create_network (gtk_entry_get_text (app_data->create_network_name), oper_id);
749
 
+
750
 
+               g_free (oper_name);
751
 
+               g_free (oper_id);
752
 
+       }
753
 
+
754
 
+       /* free memory */
755
 
+       g_list_foreach (selected_rows, (GFunc) gtk_tree_path_free, NULL);
756
 
+       g_list_free (selected_rows);
757
 
+}
758
 
+
759
 
+static void
760
 
+network_list_selection_changed (GtkTreeSelection *selection, gpointer user_data)
761
 
+{
762
 
+       AppData *app_data = (AppData *) user_data;
763
 
+       GtkTreeIter iter;
764
 
+       GtkTreeModel *model;
765
 
+
766
 
+       if (gtk_tree_selection_get_selected (selection, &model, &iter))
767
 
+               gtk_widget_set_sensitive (app_data->create_net_button, TRUE);
768
 
+       else
769
 
+               gtk_widget_set_sensitive (app_data->create_net_button, FALSE);
770
 
+}
771
 
+
772
 
+
773
 
+static void
774
 
+app_data_destroy (AppData *app_data)
775
 
+{
776
 
+       if (app_data->bus)
777
 
+               dbus_g_connection_unref (app_data->bus);
778
 
+
779
 
+       if (app_data->proxy)
780
 
+               g_object_unref (app_data->proxy);
781
 
+
782
 
+       if (app_data->gsm_net_proxy)
783
 
+               g_object_unref (app_data->gsm_net_proxy);
784
 
+
785
 
+       if (app_data->glade_xml)
786
 
+               g_object_unref (app_data->glade_xml);
787
 
+
788
 
+       if (app_data->main_loop)
789
 
+               g_main_loop_unref (app_data->main_loop);
790
 
+
791
 
+       g_slice_free (AppData, app_data);
792
 
+}
793
 
+
794
 
+static void
795
 
+close_cb (GtkDialog *dialog,
796
 
+                 gint response_id,
797
 
+                 gpointer user_data)
798
 
+{
799
 
+       AppData *app_data = (AppData *) user_data;
800
 
+
801
 
+       dbus_g_proxy_set_interface (app_data->proxy, MM_DBUS_INTERFACE_MODEM);
802
 
+       dbus_g_proxy_call_no_reply (app_data->proxy, "Enable", G_TYPE_BOOLEAN, FALSE, G_TYPE_INVALID);
803
 
+
804
 
+       g_main_loop_quit (app_data->main_loop);
805
 
+       app_data_destroy (app_data);
806
 
+}
807
 
+
808
 
+
809
 
+static GtkListStore *
810
 
+prepare_network_list (GtkTreeView *treeview)
811
 
+{
812
 
+       GtkListStore *store;
813
 
+
814
 
+       store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
815
 
+       gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (store));
816
 
+       g_object_unref (store);
817
 
+
818
 
+       gtk_tree_view_insert_column_with_attributes (treeview,
819
 
+                                                    -1, "Name", gtk_cell_renderer_text_new (),
820
 
+                                                    "text", SCAN_COL_NAME,
821
 
+                                                    NULL);
822
 
+
823
 
+       gtk_tree_view_insert_column_with_attributes (treeview,
824
 
+                                                    -1, "Status", gtk_cell_renderer_text_new (),
825
 
+                                                    "text", SCAN_COL_STATUS,
826
 
+                                                    NULL);
827
 
+
828
 
+       return store;
829
 
+}
830
 
+
831
 
+static AppData *
832
 
+app_data_create (const char *udi)
833
 
+{
834
 
+       AppData *app_data;
835
 
+       GtkTreeSelection *selection;
836
 
+       GError *error = NULL;
837
 
+
838
 
+       app_data = g_slice_new0 (AppData);
839
 
+
840
 
+       /* DBus */
841
 
+       app_data->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
842
 
+       if (!app_data->bus) {
843
 
+               g_error ("Couldn't connect to DBus: %s", error->message);
844
 
+               g_error_free (error);
845
 
+               g_slice_free (AppData, app_data);
846
 
+
847
 
+               return NULL;
848
 
+       }
849
 
+
850
 
+       app_data->proxy = dbus_g_proxy_new_for_name (app_data->bus, MM_DBUS_SERVICE, udi, MM_DBUS_INTERFACE_MODEM);
851
 
+       app_data->gsm_net_proxy = dbus_g_proxy_new_from_proxy (app_data->proxy, MM_DBUS_INTERFACE_MODEM_GSM_NETWORK, NULL);
852
 
+
853
 
+       /* UI */
854
 
+       app_data->glade_xml = glade_xml_new (GLADEDIR "/nm-modem-properties.glade", NULL, NULL);
855
 
+       if (!app_data->glade_xml) {
856
 
+               g_error ("Could not load Glade file");
857
 
+               g_slice_free (AppData, app_data);
858
 
+
859
 
+               return NULL;
860
 
+       }
861
 
+
862
 
+       app_data->main_dialog = GTK_DIALOG (glade_xml_get_widget (app_data->glade_xml, "main_dialog"));
863
 
+       g_signal_connect (app_data->main_dialog, "response", G_CALLBACK (close_cb), app_data);
864
 
+
865
 
+       app_data->network_list = GTK_TREE_VIEW (glade_xml_get_widget (app_data->glade_xml, "network_list"));
866
 
+       app_data->network_store = prepare_network_list (app_data->network_list);
867
 
+       app_data->scan_button = glade_xml_get_widget (app_data->glade_xml, "scan_button");
868
 
+       g_signal_connect (app_data->scan_button, "clicked", G_CALLBACK (scan), app_data);
869
 
+
870
 
+       app_data->scan_dialog = glade_xml_get_widget (app_data->glade_xml, "scan_dialog");
871
 
+       gtk_window_set_transient_for (GTK_WINDOW (app_data->scan_dialog), GTK_WINDOW (app_data->main_dialog));
872
 
+
873
 
+       app_data->scan_progress_bar = GTK_PROGRESS_BAR (glade_xml_get_widget (app_data->glade_xml, "scan_progress_bar"));
874
 
+
875
 
+       app_data->create_net_button = glade_xml_get_widget (app_data->glade_xml, "create_connection_button");
876
 
+       gtk_widget_set_sensitive (app_data->create_net_button, FALSE);
877
 
+       g_signal_connect (app_data->create_net_button, "clicked", G_CALLBACK (create_network_clicked), app_data);
878
 
+       selection = gtk_tree_view_get_selection (app_data->network_list);
879
 
+       g_signal_connect (selection, "changed", G_CALLBACK (network_list_selection_changed), app_data);
880
 
+
881
 
+       app_data->create_network_dialog = GTK_DIALOG (glade_xml_get_widget (app_data->glade_xml, "create_network_dialog"));
882
 
+       app_data->create_network_name = GTK_ENTRY (glade_xml_get_widget (app_data->glade_xml, "create_network_name"));
883
 
+
884
 
+       app_data->main_loop = g_main_loop_new (NULL, FALSE);
885
 
+
886
 
+       return app_data;
887
 
+}
888
 
+
889
 
+int
890
 
+main (int argc, char *argv[])
891
 
+{
892
 
+       //const char *udi = "/org/freedesktop/Hal/devices/usb_device_12d1_1003_noserial_if0_serial_usb_0";
893
 
+       AppData *app_data;
894
 
+
895
 
+       if (argc != 2) {
896
 
+               g_print ("Usage: %s <udi>\n", argv[0]);
897
 
+               return 1;
898
 
+       }
899
 
+
900
 
+       gtk_init (&argc, &argv);
901
 
+
902
 
+       app_data = app_data_create (argv[1]);
903
 
+       if (app_data) {
904
 
+               modem_enable (app_data);
905
 
+               g_main_loop_run (app_data->main_loop);
906
 
+       }
907
 
+
908
 
+       return 0;
909
 
+}
910
 
diff --git a/src/modems/nm-modem-properties.glade b/src/modems/nm-modem-properties.glade
911
 
new file mode 100644
912
 
index 0000000..5c1285c
913
 
--- /dev/null
914
 
+++ b/src/modems/nm-modem-properties.glade
915
 
@@ -0,0 +1,1083 @@
916
 
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
917
 
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
918
 
+
919
 
+<glade-interface>
920
 
+
921
 
+<widget class="GtkDialog" id="main_dialog">
922
 
+  <property name="visible">True</property>
923
 
+  <property name="title" translatable="yes">GSM modem properties</property>
924
 
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
925
 
+  <property name="window_position">GTK_WIN_POS_NONE</property>
926
 
+  <property name="modal">False</property>
927
 
+  <property name="resizable">True</property>
928
 
+  <property name="destroy_with_parent">False</property>
929
 
+  <property name="decorated">True</property>
930
 
+  <property name="skip_taskbar_hint">False</property>
931
 
+  <property name="skip_pager_hint">False</property>
932
 
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
933
 
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
934
 
+  <property name="focus_on_map">True</property>
935
 
+  <property name="urgency_hint">False</property>
936
 
+  <property name="has_separator">True</property>
937
 
+
938
 
+  <child internal-child="vbox">
939
 
+    <widget class="GtkVBox" id="dialog-vbox1">
940
 
+      <property name="visible">True</property>
941
 
+      <property name="homogeneous">False</property>
942
 
+      <property name="spacing">0</property>
943
 
+
944
 
+      <child internal-child="action_area">
945
 
+       <widget class="GtkHButtonBox" id="dialog-action_area1">
946
 
+         <property name="visible">True</property>
947
 
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
948
 
+
949
 
+         <child>
950
 
+           <widget class="GtkButton" id="closebutton1">
951
 
+             <property name="visible">True</property>
952
 
+             <property name="can_default">True</property>
953
 
+             <property name="can_focus">True</property>
954
 
+             <property name="label">gtk-close</property>
955
 
+             <property name="use_stock">True</property>
956
 
+             <property name="relief">GTK_RELIEF_NORMAL</property>
957
 
+             <property name="focus_on_click">True</property>
958
 
+             <property name="response_id">-7</property>
959
 
+           </widget>
960
 
+         </child>
961
 
+       </widget>
962
 
+       <packing>
963
 
+         <property name="padding">0</property>
964
 
+         <property name="expand">False</property>
965
 
+         <property name="fill">True</property>
966
 
+         <property name="pack_type">GTK_PACK_END</property>
967
 
+       </packing>
968
 
+      </child>
969
 
+
970
 
+      <child>
971
 
+       <widget class="GtkVBox" id="vbox1">
972
 
+         <property name="visible">True</property>
973
 
+         <property name="homogeneous">False</property>
974
 
+         <property name="spacing">6</property>
975
 
+
976
 
+         <child>
977
 
+           <widget class="GtkHBox" id="hbox2">
978
 
+             <property name="visible">True</property>
979
 
+             <property name="homogeneous">False</property>
980
 
+             <property name="spacing">6</property>
981
 
+
982
 
+             <child>
983
 
+               <widget class="GtkFrame" id="frame1">
984
 
+                 <property name="visible">True</property>
985
 
+                 <property name="label_xalign">0</property>
986
 
+                 <property name="label_yalign">0.5</property>
987
 
+                 <property name="shadow_type">GTK_SHADOW_NONE</property>
988
 
+
989
 
+                 <child>
990
 
+                   <widget class="GtkAlignment" id="alignment1">
991
 
+                     <property name="visible">True</property>
992
 
+                     <property name="xalign">0.5</property>
993
 
+                     <property name="yalign">0.5</property>
994
 
+                     <property name="xscale">1</property>
995
 
+                     <property name="yscale">1</property>
996
 
+                     <property name="top_padding">0</property>
997
 
+                     <property name="bottom_padding">0</property>
998
 
+                     <property name="left_padding">12</property>
999
 
+                     <property name="right_padding">0</property>
1000
 
+
1001
 
+                     <child>
1002
 
+                       <widget class="GtkTable" id="info_table">
1003
 
+                         <property name="visible">True</property>
1004
 
+                         <property name="n_rows">8</property>
1005
 
+                         <property name="n_columns">2</property>
1006
 
+                         <property name="homogeneous">False</property>
1007
 
+                         <property name="row_spacing">0</property>
1008
 
+                         <property name="column_spacing">6</property>
1009
 
+
1010
 
+                         <child>
1011
 
+                           <widget class="GtkLabel" id="label6">
1012
 
+                             <property name="visible">True</property>
1013
 
+                             <property name="label" translatable="yes">Vendor</property>
1014
 
+                             <property name="use_underline">False</property>
1015
 
+                             <property name="use_markup">False</property>
1016
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1017
 
+                             <property name="wrap">False</property>
1018
 
+                             <property name="selectable">False</property>
1019
 
+                             <property name="xalign">0</property>
1020
 
+                             <property name="yalign">0</property>
1021
 
+                             <property name="xpad">0</property>
1022
 
+                             <property name="ypad">0</property>
1023
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1024
 
+                             <property name="width_chars">-1</property>
1025
 
+                             <property name="single_line_mode">False</property>
1026
 
+                             <property name="angle">0</property>
1027
 
+                           </widget>
1028
 
+                           <packing>
1029
 
+                             <property name="left_attach">0</property>
1030
 
+                             <property name="right_attach">1</property>
1031
 
+                             <property name="top_attach">0</property>
1032
 
+                             <property name="bottom_attach">1</property>
1033
 
+                             <property name="x_options">fill</property>
1034
 
+                             <property name="y_options"></property>
1035
 
+                           </packing>
1036
 
+                         </child>
1037
 
+
1038
 
+                         <child>
1039
 
+                           <widget class="GtkLabel" id="label7">
1040
 
+                             <property name="visible">True</property>
1041
 
+                             <property name="label" translatable="yes">Model</property>
1042
 
+                             <property name="use_underline">False</property>
1043
 
+                             <property name="use_markup">False</property>
1044
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1045
 
+                             <property name="wrap">False</property>
1046
 
+                             <property name="selectable">False</property>
1047
 
+                             <property name="xalign">0</property>
1048
 
+                             <property name="yalign">0</property>
1049
 
+                             <property name="xpad">0</property>
1050
 
+                             <property name="ypad">0</property>
1051
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1052
 
+                             <property name="width_chars">-1</property>
1053
 
+                             <property name="single_line_mode">False</property>
1054
 
+                             <property name="angle">0</property>
1055
 
+                           </widget>
1056
 
+                           <packing>
1057
 
+                             <property name="left_attach">0</property>
1058
 
+                             <property name="right_attach">1</property>
1059
 
+                             <property name="top_attach">1</property>
1060
 
+                             <property name="bottom_attach">2</property>
1061
 
+                             <property name="x_options">fill</property>
1062
 
+                             <property name="y_options"></property>
1063
 
+                           </packing>
1064
 
+                         </child>
1065
 
+
1066
 
+                         <child>
1067
 
+                           <widget class="GtkLabel" id="label8">
1068
 
+                             <property name="visible">True</property>
1069
 
+                             <property name="label" translatable="yes">Version</property>
1070
 
+                             <property name="use_underline">False</property>
1071
 
+                             <property name="use_markup">False</property>
1072
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1073
 
+                             <property name="wrap">False</property>
1074
 
+                             <property name="selectable">False</property>
1075
 
+                             <property name="xalign">0</property>
1076
 
+                             <property name="yalign">0</property>
1077
 
+                             <property name="xpad">0</property>
1078
 
+                             <property name="ypad">0</property>
1079
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1080
 
+                             <property name="width_chars">-1</property>
1081
 
+                             <property name="single_line_mode">False</property>
1082
 
+                             <property name="angle">0</property>
1083
 
+                           </widget>
1084
 
+                           <packing>
1085
 
+                             <property name="left_attach">0</property>
1086
 
+                             <property name="right_attach">1</property>
1087
 
+                             <property name="top_attach">2</property>
1088
 
+                             <property name="bottom_attach">3</property>
1089
 
+                             <property name="x_options">fill</property>
1090
 
+                             <property name="y_options"></property>
1091
 
+                           </packing>
1092
 
+                         </child>
1093
 
+
1094
 
+                         <child>
1095
 
+                           <widget class="GtkLabel" id="label9">
1096
 
+                             <property name="visible">True</property>
1097
 
+                             <property name="label" translatable="yes">Driver</property>
1098
 
+                             <property name="use_underline">False</property>
1099
 
+                             <property name="use_markup">False</property>
1100
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1101
 
+                             <property name="wrap">False</property>
1102
 
+                             <property name="selectable">False</property>
1103
 
+                             <property name="xalign">0</property>
1104
 
+                             <property name="yalign">0</property>
1105
 
+                             <property name="xpad">0</property>
1106
 
+                             <property name="ypad">0</property>
1107
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1108
 
+                             <property name="width_chars">-1</property>
1109
 
+                             <property name="single_line_mode">False</property>
1110
 
+                             <property name="angle">0</property>
1111
 
+                           </widget>
1112
 
+                           <packing>
1113
 
+                             <property name="left_attach">0</property>
1114
 
+                             <property name="right_attach">1</property>
1115
 
+                             <property name="top_attach">3</property>
1116
 
+                             <property name="bottom_attach">4</property>
1117
 
+                             <property name="x_options">fill</property>
1118
 
+                             <property name="y_options"></property>
1119
 
+                           </packing>
1120
 
+                         </child>
1121
 
+
1122
 
+                         <child>
1123
 
+                           <widget class="GtkLabel" id="label10">
1124
 
+                             <property name="visible">True</property>
1125
 
+                             <property name="label" translatable="yes">Data device</property>
1126
 
+                             <property name="use_underline">False</property>
1127
 
+                             <property name="use_markup">False</property>
1128
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1129
 
+                             <property name="wrap">False</property>
1130
 
+                             <property name="selectable">False</property>
1131
 
+                             <property name="xalign">0</property>
1132
 
+                             <property name="yalign">0</property>
1133
 
+                             <property name="xpad">0</property>
1134
 
+                             <property name="ypad">0</property>
1135
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1136
 
+                             <property name="width_chars">-1</property>
1137
 
+                             <property name="single_line_mode">False</property>
1138
 
+                             <property name="angle">0</property>
1139
 
+                           </widget>
1140
 
+                           <packing>
1141
 
+                             <property name="left_attach">0</property>
1142
 
+                             <property name="right_attach">1</property>
1143
 
+                             <property name="top_attach">4</property>
1144
 
+                             <property name="bottom_attach">5</property>
1145
 
+                             <property name="x_options">fill</property>
1146
 
+                             <property name="y_options"></property>
1147
 
+                           </packing>
1148
 
+                         </child>
1149
 
+
1150
 
+                         <child>
1151
 
+                           <widget class="GtkLabel" id="label11">
1152
 
+                             <property name="visible">True</property>
1153
 
+                             <property name="label" translatable="yes">IMSI</property>
1154
 
+                             <property name="use_underline">False</property>
1155
 
+                             <property name="use_markup">False</property>
1156
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1157
 
+                             <property name="wrap">False</property>
1158
 
+                             <property name="selectable">False</property>
1159
 
+                             <property name="xalign">0</property>
1160
 
+                             <property name="yalign">0</property>
1161
 
+                             <property name="xpad">0</property>
1162
 
+                             <property name="ypad">0</property>
1163
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1164
 
+                             <property name="width_chars">-1</property>
1165
 
+                             <property name="single_line_mode">False</property>
1166
 
+                             <property name="angle">0</property>
1167
 
+                           </widget>
1168
 
+                           <packing>
1169
 
+                             <property name="left_attach">0</property>
1170
 
+                             <property name="right_attach">1</property>
1171
 
+                             <property name="top_attach">5</property>
1172
 
+                             <property name="bottom_attach">6</property>
1173
 
+                             <property name="x_options">fill</property>
1174
 
+                             <property name="y_options"></property>
1175
 
+                           </packing>
1176
 
+                         </child>
1177
 
+
1178
 
+                         <child>
1179
 
+                           <widget class="GtkLabel" id="label12">
1180
 
+                             <property name="visible">True</property>
1181
 
+                             <property name="label" translatable="yes">IMEI</property>
1182
 
+                             <property name="use_underline">False</property>
1183
 
+                             <property name="use_markup">False</property>
1184
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1185
 
+                             <property name="wrap">False</property>
1186
 
+                             <property name="selectable">False</property>
1187
 
+                             <property name="xalign">0</property>
1188
 
+                             <property name="yalign">0</property>
1189
 
+                             <property name="xpad">0</property>
1190
 
+                             <property name="ypad">0</property>
1191
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1192
 
+                             <property name="width_chars">-1</property>
1193
 
+                             <property name="single_line_mode">False</property>
1194
 
+                             <property name="angle">0</property>
1195
 
+                           </widget>
1196
 
+                           <packing>
1197
 
+                             <property name="left_attach">0</property>
1198
 
+                             <property name="right_attach">1</property>
1199
 
+                             <property name="top_attach">6</property>
1200
 
+                             <property name="bottom_attach">7</property>
1201
 
+                             <property name="x_options">fill</property>
1202
 
+                             <property name="y_options"></property>
1203
 
+                           </packing>
1204
 
+                         </child>
1205
 
+
1206
 
+                         <child>
1207
 
+                           <widget class="GtkLabel" id="label13">
1208
 
+                             <property name="visible">True</property>
1209
 
+                             <property name="label" translatable="yes">Signal quality</property>
1210
 
+                             <property name="use_underline">False</property>
1211
 
+                             <property name="use_markup">False</property>
1212
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1213
 
+                             <property name="wrap">False</property>
1214
 
+                             <property name="selectable">False</property>
1215
 
+                             <property name="xalign">0</property>
1216
 
+                             <property name="yalign">0</property>
1217
 
+                             <property name="xpad">0</property>
1218
 
+                             <property name="ypad">0</property>
1219
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1220
 
+                             <property name="width_chars">-1</property>
1221
 
+                             <property name="single_line_mode">False</property>
1222
 
+                             <property name="angle">0</property>
1223
 
+                           </widget>
1224
 
+                           <packing>
1225
 
+                             <property name="left_attach">0</property>
1226
 
+                             <property name="right_attach">1</property>
1227
 
+                             <property name="top_attach">7</property>
1228
 
+                             <property name="bottom_attach">8</property>
1229
 
+                             <property name="x_options">fill</property>
1230
 
+                             <property name="y_options"></property>
1231
 
+                           </packing>
1232
 
+                         </child>
1233
 
+
1234
 
+                         <child>
1235
 
+                           <widget class="GtkLabel" id="vendor_label">
1236
 
+                             <property name="visible">True</property>
1237
 
+                             <property name="label" translatable="yes"></property>
1238
 
+                             <property name="use_underline">False</property>
1239
 
+                             <property name="use_markup">False</property>
1240
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1241
 
+                             <property name="wrap">False</property>
1242
 
+                             <property name="selectable">False</property>
1243
 
+                             <property name="xalign">0</property>
1244
 
+                             <property name="yalign">0</property>
1245
 
+                             <property name="xpad">0</property>
1246
 
+                             <property name="ypad">0</property>
1247
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1248
 
+                             <property name="width_chars">-1</property>
1249
 
+                             <property name="single_line_mode">False</property>
1250
 
+                             <property name="angle">0</property>
1251
 
+                           </widget>
1252
 
+                           <packing>
1253
 
+                             <property name="left_attach">1</property>
1254
 
+                             <property name="right_attach">2</property>
1255
 
+                             <property name="top_attach">0</property>
1256
 
+                             <property name="bottom_attach">1</property>
1257
 
+                             <property name="x_options">fill</property>
1258
 
+                             <property name="y_options"></property>
1259
 
+                           </packing>
1260
 
+                         </child>
1261
 
+
1262
 
+                         <child>
1263
 
+                           <widget class="GtkLabel" id="model_label">
1264
 
+                             <property name="visible">True</property>
1265
 
+                             <property name="label" translatable="yes"></property>
1266
 
+                             <property name="use_underline">False</property>
1267
 
+                             <property name="use_markup">False</property>
1268
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1269
 
+                             <property name="wrap">False</property>
1270
 
+                             <property name="selectable">False</property>
1271
 
+                             <property name="xalign">0</property>
1272
 
+                             <property name="yalign">0</property>
1273
 
+                             <property name="xpad">0</property>
1274
 
+                             <property name="ypad">0</property>
1275
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1276
 
+                             <property name="width_chars">-1</property>
1277
 
+                             <property name="single_line_mode">False</property>
1278
 
+                             <property name="angle">0</property>
1279
 
+                           </widget>
1280
 
+                           <packing>
1281
 
+                             <property name="left_attach">1</property>
1282
 
+                             <property name="right_attach">2</property>
1283
 
+                             <property name="top_attach">1</property>
1284
 
+                             <property name="bottom_attach">2</property>
1285
 
+                             <property name="x_options">fill</property>
1286
 
+                             <property name="y_options"></property>
1287
 
+                           </packing>
1288
 
+                         </child>
1289
 
+
1290
 
+                         <child>
1291
 
+                           <widget class="GtkLabel" id="version_label">
1292
 
+                             <property name="visible">True</property>
1293
 
+                             <property name="label" translatable="yes"></property>
1294
 
+                             <property name="use_underline">False</property>
1295
 
+                             <property name="use_markup">False</property>
1296
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1297
 
+                             <property name="wrap">False</property>
1298
 
+                             <property name="selectable">False</property>
1299
 
+                             <property name="xalign">0</property>
1300
 
+                             <property name="yalign">0</property>
1301
 
+                             <property name="xpad">0</property>
1302
 
+                             <property name="ypad">0</property>
1303
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1304
 
+                             <property name="width_chars">-1</property>
1305
 
+                             <property name="single_line_mode">False</property>
1306
 
+                             <property name="angle">0</property>
1307
 
+                           </widget>
1308
 
+                           <packing>
1309
 
+                             <property name="left_attach">1</property>
1310
 
+                             <property name="right_attach">2</property>
1311
 
+                             <property name="top_attach">2</property>
1312
 
+                             <property name="bottom_attach">3</property>
1313
 
+                             <property name="x_options">fill</property>
1314
 
+                             <property name="y_options"></property>
1315
 
+                           </packing>
1316
 
+                         </child>
1317
 
+
1318
 
+                         <child>
1319
 
+                           <widget class="GtkLabel" id="driver_label">
1320
 
+                             <property name="visible">True</property>
1321
 
+                             <property name="label" translatable="yes"></property>
1322
 
+                             <property name="use_underline">False</property>
1323
 
+                             <property name="use_markup">False</property>
1324
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1325
 
+                             <property name="wrap">False</property>
1326
 
+                             <property name="selectable">False</property>
1327
 
+                             <property name="xalign">0</property>
1328
 
+                             <property name="yalign">0</property>
1329
 
+                             <property name="xpad">0</property>
1330
 
+                             <property name="ypad">0</property>
1331
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1332
 
+                             <property name="width_chars">-1</property>
1333
 
+                             <property name="single_line_mode">False</property>
1334
 
+                             <property name="angle">0</property>
1335
 
+                           </widget>
1336
 
+                           <packing>
1337
 
+                             <property name="left_attach">1</property>
1338
 
+                             <property name="right_attach">2</property>
1339
 
+                             <property name="top_attach">3</property>
1340
 
+                             <property name="bottom_attach">4</property>
1341
 
+                             <property name="x_options">fill</property>
1342
 
+                             <property name="y_options"></property>
1343
 
+                           </packing>
1344
 
+                         </child>
1345
 
+
1346
 
+                         <child>
1347
 
+                           <widget class="GtkLabel" id="device_label">
1348
 
+                             <property name="visible">True</property>
1349
 
+                             <property name="label" translatable="yes"></property>
1350
 
+                             <property name="use_underline">False</property>
1351
 
+                             <property name="use_markup">False</property>
1352
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1353
 
+                             <property name="wrap">False</property>
1354
 
+                             <property name="selectable">False</property>
1355
 
+                             <property name="xalign">0</property>
1356
 
+                             <property name="yalign">0</property>
1357
 
+                             <property name="xpad">0</property>
1358
 
+                             <property name="ypad">0</property>
1359
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1360
 
+                             <property name="width_chars">-1</property>
1361
 
+                             <property name="single_line_mode">False</property>
1362
 
+                             <property name="angle">0</property>
1363
 
+                           </widget>
1364
 
+                           <packing>
1365
 
+                             <property name="left_attach">1</property>
1366
 
+                             <property name="right_attach">2</property>
1367
 
+                             <property name="top_attach">4</property>
1368
 
+                             <property name="bottom_attach">5</property>
1369
 
+                             <property name="x_options">fill</property>
1370
 
+                             <property name="y_options"></property>
1371
 
+                           </packing>
1372
 
+                         </child>
1373
 
+
1374
 
+                         <child>
1375
 
+                           <widget class="GtkLabel" id="imsi_label">
1376
 
+                             <property name="visible">True</property>
1377
 
+                             <property name="label" translatable="yes"></property>
1378
 
+                             <property name="use_underline">False</property>
1379
 
+                             <property name="use_markup">False</property>
1380
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1381
 
+                             <property name="wrap">False</property>
1382
 
+                             <property name="selectable">False</property>
1383
 
+                             <property name="xalign">0</property>
1384
 
+                             <property name="yalign">0</property>
1385
 
+                             <property name="xpad">0</property>
1386
 
+                             <property name="ypad">0</property>
1387
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1388
 
+                             <property name="width_chars">-1</property>
1389
 
+                             <property name="single_line_mode">False</property>
1390
 
+                             <property name="angle">0</property>
1391
 
+                           </widget>
1392
 
+                           <packing>
1393
 
+                             <property name="left_attach">1</property>
1394
 
+                             <property name="right_attach">2</property>
1395
 
+                             <property name="top_attach">5</property>
1396
 
+                             <property name="bottom_attach">6</property>
1397
 
+                             <property name="x_options">fill</property>
1398
 
+                             <property name="y_options"></property>
1399
 
+                           </packing>
1400
 
+                         </child>
1401
 
+
1402
 
+                         <child>
1403
 
+                           <widget class="GtkLabel" id="imei_label">
1404
 
+                             <property name="visible">True</property>
1405
 
+                             <property name="label" translatable="yes"></property>
1406
 
+                             <property name="use_underline">False</property>
1407
 
+                             <property name="use_markup">False</property>
1408
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1409
 
+                             <property name="wrap">False</property>
1410
 
+                             <property name="selectable">False</property>
1411
 
+                             <property name="xalign">0</property>
1412
 
+                             <property name="yalign">0</property>
1413
 
+                             <property name="xpad">0</property>
1414
 
+                             <property name="ypad">0</property>
1415
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1416
 
+                             <property name="width_chars">-1</property>
1417
 
+                             <property name="single_line_mode">False</property>
1418
 
+                             <property name="angle">0</property>
1419
 
+                           </widget>
1420
 
+                           <packing>
1421
 
+                             <property name="left_attach">1</property>
1422
 
+                             <property name="right_attach">2</property>
1423
 
+                             <property name="top_attach">6</property>
1424
 
+                             <property name="bottom_attach">7</property>
1425
 
+                             <property name="x_options">fill</property>
1426
 
+                             <property name="y_options"></property>
1427
 
+                           </packing>
1428
 
+                         </child>
1429
 
+
1430
 
+                         <child>
1431
 
+                           <widget class="GtkLabel" id="signal_quality_label">
1432
 
+                             <property name="visible">True</property>
1433
 
+                             <property name="label" translatable="yes"></property>
1434
 
+                             <property name="use_underline">False</property>
1435
 
+                             <property name="use_markup">False</property>
1436
 
+                             <property name="justify">GTK_JUSTIFY_LEFT</property>
1437
 
+                             <property name="wrap">False</property>
1438
 
+                             <property name="selectable">False</property>
1439
 
+                             <property name="xalign">0</property>
1440
 
+                             <property name="yalign">0</property>
1441
 
+                             <property name="xpad">0</property>
1442
 
+                             <property name="ypad">0</property>
1443
 
+                             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1444
 
+                             <property name="width_chars">-1</property>
1445
 
+                             <property name="single_line_mode">False</property>
1446
 
+                             <property name="angle">0</property>
1447
 
+                           </widget>
1448
 
+                           <packing>
1449
 
+                             <property name="left_attach">1</property>
1450
 
+                             <property name="right_attach">2</property>
1451
 
+                             <property name="top_attach">7</property>
1452
 
+                             <property name="bottom_attach">8</property>
1453
 
+                             <property name="x_options">fill</property>
1454
 
+                             <property name="y_options"></property>
1455
 
+                           </packing>
1456
 
+                         </child>
1457
 
+                       </widget>
1458
 
+                     </child>
1459
 
+                   </widget>
1460
 
+                 </child>
1461
 
+
1462
 
+                 <child>
1463
 
+                   <widget class="GtkLabel" id="label1">
1464
 
+                     <property name="visible">True</property>
1465
 
+                     <property name="label" translatable="yes">&lt;b&gt;Information&lt;/b&gt;</property>
1466
 
+                     <property name="use_underline">False</property>
1467
 
+                     <property name="use_markup">True</property>
1468
 
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
1469
 
+                     <property name="wrap">False</property>
1470
 
+                     <property name="selectable">False</property>
1471
 
+                     <property name="xalign">0.5</property>
1472
 
+                     <property name="yalign">0.5</property>
1473
 
+                     <property name="xpad">0</property>
1474
 
+                     <property name="ypad">0</property>
1475
 
+                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1476
 
+                     <property name="width_chars">-1</property>
1477
 
+                     <property name="single_line_mode">False</property>
1478
 
+                     <property name="angle">0</property>
1479
 
+                   </widget>
1480
 
+                   <packing>
1481
 
+                     <property name="type">label_item</property>
1482
 
+                   </packing>
1483
 
+                 </child>
1484
 
+               </widget>
1485
 
+               <packing>
1486
 
+                 <property name="padding">0</property>
1487
 
+                 <property name="expand">True</property>
1488
 
+                 <property name="fill">True</property>
1489
 
+               </packing>
1490
 
+             </child>
1491
 
+
1492
 
+             <child>
1493
 
+               <widget class="GtkFrame" id="frame3">
1494
 
+                 <property name="label_xalign">0</property>
1495
 
+                 <property name="label_yalign">0.5</property>
1496
 
+                 <property name="shadow_type">GTK_SHADOW_NONE</property>
1497
 
+
1498
 
+                 <child>
1499
 
+                   <widget class="GtkAlignment" id="alignment3">
1500
 
+                     <property name="visible">True</property>
1501
 
+                     <property name="xalign">0.5</property>
1502
 
+                     <property name="yalign">0.5</property>
1503
 
+                     <property name="xscale">1</property>
1504
 
+                     <property name="yscale">1</property>
1505
 
+                     <property name="top_padding">0</property>
1506
 
+                     <property name="bottom_padding">0</property>
1507
 
+                     <property name="left_padding">12</property>
1508
 
+                     <property name="right_padding">0</property>
1509
 
+
1510
 
+                     <child>
1511
 
+                       <placeholder/>
1512
 
+                     </child>
1513
 
+                   </widget>
1514
 
+                 </child>
1515
 
+
1516
 
+                 <child>
1517
 
+                   <widget class="GtkLabel" id="label4">
1518
 
+                     <property name="visible">True</property>
1519
 
+                     <property name="label" translatable="yes">&lt;b&gt;PIN operations&lt;/b&gt;</property>
1520
 
+                     <property name="use_underline">False</property>
1521
 
+                     <property name="use_markup">True</property>
1522
 
+                     <property name="justify">GTK_JUSTIFY_LEFT</property>
1523
 
+                     <property name="wrap">False</property>
1524
 
+                     <property name="selectable">False</property>
1525
 
+                     <property name="xalign">0.5</property>
1526
 
+                     <property name="yalign">0.5</property>
1527
 
+                     <property name="xpad">0</property>
1528
 
+                     <property name="ypad">0</property>
1529
 
+                     <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1530
 
+                     <property name="width_chars">-1</property>
1531
 
+                     <property name="single_line_mode">False</property>
1532
 
+                     <property name="angle">0</property>
1533
 
+                   </widget>
1534
 
+                   <packing>
1535
 
+                     <property name="type">label_item</property>
1536
 
+                   </packing>
1537
 
+                 </child>
1538
 
+               </widget>
1539
 
+               <packing>
1540
 
+                 <property name="padding">0</property>
1541
 
+                 <property name="expand">True</property>
1542
 
+                 <property name="fill">True</property>
1543
 
+               </packing>
1544
 
+             </child>
1545
 
+           </widget>
1546
 
+           <packing>
1547
 
+             <property name="padding">0</property>
1548
 
+             <property name="expand">True</property>
1549
 
+             <property name="fill">True</property>
1550
 
+           </packing>
1551
 
+         </child>
1552
 
+
1553
 
+         <child>
1554
 
+           <widget class="GtkFrame" id="frame2">
1555
 
+             <property name="visible">True</property>
1556
 
+             <property name="label_xalign">0</property>
1557
 
+             <property name="label_yalign">0.5</property>
1558
 
+             <property name="shadow_type">GTK_SHADOW_NONE</property>
1559
 
+
1560
 
+             <child>
1561
 
+               <widget class="GtkAlignment" id="alignment2">
1562
 
+                 <property name="visible">True</property>
1563
 
+                 <property name="xalign">0.5</property>
1564
 
+                 <property name="yalign">0.5</property>
1565
 
+                 <property name="xscale">1</property>
1566
 
+                 <property name="yscale">1</property>
1567
 
+                 <property name="top_padding">0</property>
1568
 
+                 <property name="bottom_padding">0</property>
1569
 
+                 <property name="left_padding">12</property>
1570
 
+                 <property name="right_padding">0</property>
1571
 
+
1572
 
+                 <child>
1573
 
+                   <widget class="GtkHBox" id="hbox1">
1574
 
+                     <property name="visible">True</property>
1575
 
+                     <property name="homogeneous">False</property>
1576
 
+                     <property name="spacing">6</property>
1577
 
+
1578
 
+                     <child>
1579
 
+                       <widget class="GtkScrolledWindow" id="scrolledwindow1">
1580
 
+                         <property name="visible">True</property>
1581
 
+                         <property name="can_focus">True</property>
1582
 
+                         <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
1583
 
+                         <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
1584
 
+                         <property name="shadow_type">GTK_SHADOW_IN</property>
1585
 
+                         <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
1586
 
+
1587
 
+                         <child>
1588
 
+                           <widget class="GtkTreeView" id="network_list">
1589
 
+                             <property name="visible">True</property>
1590
 
+                             <property name="can_focus">True</property>
1591
 
+                             <property name="headers_visible">False</property>
1592
 
+                             <property name="rules_hint">False</property>
1593
 
+                             <property name="reorderable">False</property>
1594
 
+                             <property name="enable_search">True</property>
1595
 
+                             <property name="fixed_height_mode">False</property>
1596
 
+                             <property name="hover_selection">False</property>
1597
 
+                             <property name="hover_expand">False</property>
1598
 
+                           </widget>
1599
 
+                         </child>
1600
 
+                       </widget>
1601
 
+                       <packing>
1602
 
+                         <property name="padding">0</property>
1603
 
+                         <property name="expand">True</property>
1604
 
+                         <property name="fill">True</property>
1605
 
+                       </packing>
1606
 
+                     </child>
1607
 
+
1608
 
+                     <child>
1609
 
+                       <widget class="GtkVButtonBox" id="vbuttonbox1">
1610
 
+                         <property name="visible">True</property>
1611
 
+                         <property name="layout_style">GTK_BUTTONBOX_START</property>
1612
 
+                         <property name="spacing">0</property>
1613
 
+
1614
 
+                         <child>
1615
 
+                           <widget class="GtkButton" id="scan_button">
1616
 
+                             <property name="visible">True</property>
1617
 
+                             <property name="can_default">True</property>
1618
 
+                             <property name="can_focus">True</property>
1619
 
+                             <property name="label" translatable="yes">Scan</property>
1620
 
+                             <property name="use_underline">True</property>
1621
 
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
1622
 
+                             <property name="focus_on_click">True</property>
1623
 
+                           </widget>
1624
 
+                         </child>
1625
 
+
1626
 
+                         <child>
1627
 
+                           <widget class="GtkButton" id="create_connection_button">
1628
 
+                             <property name="visible">True</property>
1629
 
+                             <property name="can_default">True</property>
1630
 
+                             <property name="can_focus">True</property>
1631
 
+                             <property name="label" translatable="yes">Create connection</property>
1632
 
+                             <property name="use_underline">True</property>
1633
 
+                             <property name="relief">GTK_RELIEF_NORMAL</property>
1634
 
+                             <property name="focus_on_click">True</property>
1635
 
+                           </widget>
1636
 
+                         </child>
1637
 
+                       </widget>
1638
 
+                       <packing>
1639
 
+                         <property name="padding">0</property>
1640
 
+                         <property name="expand">False</property>
1641
 
+                         <property name="fill">False</property>
1642
 
+                       </packing>
1643
 
+                     </child>
1644
 
+                   </widget>
1645
 
+                 </child>
1646
 
+               </widget>
1647
 
+             </child>
1648
 
+
1649
 
+             <child>
1650
 
+               <widget class="GtkLabel" id="label2">
1651
 
+                 <property name="visible">True</property>
1652
 
+                 <property name="label" translatable="yes">&lt;b&gt;Networks&lt;/b&gt;</property>
1653
 
+                 <property name="use_underline">False</property>
1654
 
+                 <property name="use_markup">True</property>
1655
 
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
1656
 
+                 <property name="wrap">False</property>
1657
 
+                 <property name="selectable">False</property>
1658
 
+                 <property name="xalign">0.5</property>
1659
 
+                 <property name="yalign">0.5</property>
1660
 
+                 <property name="xpad">0</property>
1661
 
+                 <property name="ypad">0</property>
1662
 
+                 <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1663
 
+                 <property name="width_chars">-1</property>
1664
 
+                 <property name="single_line_mode">False</property>
1665
 
+                 <property name="angle">0</property>
1666
 
+               </widget>
1667
 
+               <packing>
1668
 
+                 <property name="type">label_item</property>
1669
 
+               </packing>
1670
 
+             </child>
1671
 
+           </widget>
1672
 
+           <packing>
1673
 
+             <property name="padding">0</property>
1674
 
+             <property name="expand">True</property>
1675
 
+             <property name="fill">True</property>
1676
 
+           </packing>
1677
 
+         </child>
1678
 
+       </widget>
1679
 
+       <packing>
1680
 
+         <property name="padding">0</property>
1681
 
+         <property name="expand">True</property>
1682
 
+         <property name="fill">True</property>
1683
 
+       </packing>
1684
 
+      </child>
1685
 
+    </widget>
1686
 
+  </child>
1687
 
+</widget>
1688
 
+
1689
 
+<widget class="GtkDialog" id="create_network_dialog">
1690
 
+  <property name="title" translatable="yes">Create new connection</property>
1691
 
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
1692
 
+  <property name="window_position">GTK_WIN_POS_NONE</property>
1693
 
+  <property name="modal">False</property>
1694
 
+  <property name="resizable">False</property>
1695
 
+  <property name="destroy_with_parent">False</property>
1696
 
+  <property name="decorated">True</property>
1697
 
+  <property name="skip_taskbar_hint">False</property>
1698
 
+  <property name="skip_pager_hint">False</property>
1699
 
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
1700
 
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
1701
 
+  <property name="focus_on_map">True</property>
1702
 
+  <property name="urgency_hint">False</property>
1703
 
+  <property name="has_separator">True</property>
1704
 
+
1705
 
+  <child internal-child="vbox">
1706
 
+    <widget class="GtkVBox" id="dialog-vbox2">
1707
 
+      <property name="visible">True</property>
1708
 
+      <property name="homogeneous">False</property>
1709
 
+      <property name="spacing">0</property>
1710
 
+
1711
 
+      <child internal-child="action_area">
1712
 
+       <widget class="GtkHButtonBox" id="dialog-action_area2">
1713
 
+         <property name="visible">True</property>
1714
 
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
1715
 
+
1716
 
+         <child>
1717
 
+           <widget class="GtkButton" id="cancelbutton1">
1718
 
+             <property name="visible">True</property>
1719
 
+             <property name="can_default">True</property>
1720
 
+             <property name="can_focus">True</property>
1721
 
+             <property name="label">gtk-cancel</property>
1722
 
+             <property name="use_stock">True</property>
1723
 
+             <property name="relief">GTK_RELIEF_NORMAL</property>
1724
 
+             <property name="focus_on_click">True</property>
1725
 
+             <property name="response_id">-6</property>
1726
 
+           </widget>
1727
 
+         </child>
1728
 
+
1729
 
+         <child>
1730
 
+           <widget class="GtkButton" id="okbutton1">
1731
 
+             <property name="visible">True</property>
1732
 
+             <property name="can_default">True</property>
1733
 
+             <property name="can_focus">True</property>
1734
 
+             <property name="label">gtk-ok</property>
1735
 
+             <property name="use_stock">True</property>
1736
 
+             <property name="relief">GTK_RELIEF_NORMAL</property>
1737
 
+             <property name="focus_on_click">True</property>
1738
 
+             <property name="response_id">-5</property>
1739
 
+           </widget>
1740
 
+         </child>
1741
 
+       </widget>
1742
 
+       <packing>
1743
 
+         <property name="padding">0</property>
1744
 
+         <property name="expand">False</property>
1745
 
+         <property name="fill">True</property>
1746
 
+         <property name="pack_type">GTK_PACK_END</property>
1747
 
+       </packing>
1748
 
+      </child>
1749
 
+
1750
 
+      <child>
1751
 
+       <widget class="GtkVBox" id="vbox2">
1752
 
+         <property name="border_width">6</property>
1753
 
+         <property name="visible">True</property>
1754
 
+         <property name="homogeneous">False</property>
1755
 
+         <property name="spacing">6</property>
1756
 
+
1757
 
+         <child>
1758
 
+           <widget class="GtkLabel" id="label3">
1759
 
+             <property name="visible">True</property>
1760
 
+             <property name="label" translatable="yes">Please choose a name for the connection</property>
1761
 
+             <property name="use_underline">False</property>
1762
 
+             <property name="use_markup">False</property>
1763
 
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
1764
 
+             <property name="wrap">False</property>
1765
 
+             <property name="selectable">False</property>
1766
 
+             <property name="xalign">0.5</property>
1767
 
+             <property name="yalign">0.5</property>
1768
 
+             <property name="xpad">0</property>
1769
 
+             <property name="ypad">0</property>
1770
 
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1771
 
+             <property name="width_chars">-1</property>
1772
 
+             <property name="single_line_mode">False</property>
1773
 
+             <property name="angle">0</property>
1774
 
+           </widget>
1775
 
+           <packing>
1776
 
+             <property name="padding">0</property>
1777
 
+             <property name="expand">False</property>
1778
 
+             <property name="fill">False</property>
1779
 
+           </packing>
1780
 
+         </child>
1781
 
+
1782
 
+         <child>
1783
 
+           <widget class="GtkEntry" id="create_network_name">
1784
 
+             <property name="visible">True</property>
1785
 
+             <property name="can_focus">True</property>
1786
 
+             <property name="editable">True</property>
1787
 
+             <property name="visibility">True</property>
1788
 
+             <property name="max_length">0</property>
1789
 
+             <property name="text" translatable="yes"></property>
1790
 
+             <property name="has_frame">True</property>
1791
 
+             <property name="invisible_char">●</property>
1792
 
+             <property name="activates_default">True</property>
1793
 
+           </widget>
1794
 
+           <packing>
1795
 
+             <property name="padding">0</property>
1796
 
+             <property name="expand">False</property>
1797
 
+             <property name="fill">False</property>
1798
 
+           </packing>
1799
 
+         </child>
1800
 
+       </widget>
1801
 
+       <packing>
1802
 
+         <property name="padding">0</property>
1803
 
+         <property name="expand">True</property>
1804
 
+         <property name="fill">True</property>
1805
 
+       </packing>
1806
 
+      </child>
1807
 
+    </widget>
1808
 
+  </child>
1809
 
+</widget>
1810
 
+
1811
 
+<widget class="GtkWindow" id="scan_dialog">
1812
 
+  <property name="title" translatable="yes"></property>
1813
 
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
1814
 
+  <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
1815
 
+  <property name="modal">True</property>
1816
 
+  <property name="resizable">False</property>
1817
 
+  <property name="destroy_with_parent">False</property>
1818
 
+  <property name="decorated">False</property>
1819
 
+  <property name="skip_taskbar_hint">True</property>
1820
 
+  <property name="skip_pager_hint">True</property>
1821
 
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
1822
 
+  <property name="gravity">GDK_GRAVITY_CENTER</property>
1823
 
+  <property name="focus_on_map">True</property>
1824
 
+  <property name="urgency_hint">False</property>
1825
 
+
1826
 
+  <child>
1827
 
+    <widget class="GtkVBox" id="vbox3">
1828
 
+      <property name="border_width">6</property>
1829
 
+      <property name="visible">True</property>
1830
 
+      <property name="homogeneous">False</property>
1831
 
+      <property name="spacing">6</property>
1832
 
+
1833
 
+      <child>
1834
 
+       <widget class="GtkLabel" id="label5">
1835
 
+         <property name="visible">True</property>
1836
 
+         <property name="label" translatable="yes">Scanning... Please wait.</property>
1837
 
+         <property name="use_underline">False</property>
1838
 
+         <property name="use_markup">False</property>
1839
 
+         <property name="justify">GTK_JUSTIFY_LEFT</property>
1840
 
+         <property name="wrap">False</property>
1841
 
+         <property name="selectable">False</property>
1842
 
+         <property name="xalign">0.5</property>
1843
 
+         <property name="yalign">0.5</property>
1844
 
+         <property name="xpad">0</property>
1845
 
+         <property name="ypad">0</property>
1846
 
+         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1847
 
+         <property name="width_chars">-1</property>
1848
 
+         <property name="single_line_mode">False</property>
1849
 
+         <property name="angle">0</property>
1850
 
+       </widget>
1851
 
+       <packing>
1852
 
+         <property name="padding">0</property>
1853
 
+         <property name="expand">False</property>
1854
 
+         <property name="fill">False</property>
1855
 
+       </packing>
1856
 
+      </child>
1857
 
+
1858
 
+      <child>
1859
 
+       <widget class="GtkProgressBar" id="scan_progress_bar">
1860
 
+         <property name="visible">True</property>
1861
 
+         <property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
1862
 
+         <property name="fraction">0</property>
1863
 
+         <property name="pulse_step">0.10000000149</property>
1864
 
+         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1865
 
+       </widget>
1866
 
+       <packing>
1867
 
+         <property name="padding">0</property>
1868
 
+         <property name="expand">False</property>
1869
 
+         <property name="fill">False</property>
1870
 
+       </packing>
1871
 
+      </child>
1872
 
+    </widget>
1873
 
+  </child>
1874
 
+</widget>
1875
 
+
1876
 
+<widget class="GtkDialog" id="pin_dialog">
1877
 
+  <property name="visible">False</property>
1878
 
+  <property name="title" translatable="yes">PIN code required</property>
1879
 
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
1880
 
+  <property name="window_position">GTK_WIN_POS_NONE</property>
1881
 
+  <property name="modal">False</property>
1882
 
+  <property name="resizable">False</property>
1883
 
+  <property name="destroy_with_parent">False</property>
1884
 
+  <property name="decorated">True</property>
1885
 
+  <property name="skip_taskbar_hint">False</property>
1886
 
+  <property name="skip_pager_hint">False</property>
1887
 
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
1888
 
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
1889
 
+  <property name="focus_on_map">True</property>
1890
 
+  <property name="urgency_hint">False</property>
1891
 
+  <property name="has_separator">True</property>
1892
 
+
1893
 
+  <child internal-child="vbox">
1894
 
+    <widget class="GtkVBox" id="dialog-vbox3">
1895
 
+      <property name="homogeneous">False</property>
1896
 
+      <property name="spacing">0</property>
1897
 
+
1898
 
+      <child internal-child="action_area">
1899
 
+       <widget class="GtkHButtonBox" id="dialog-action_area3">
1900
 
+         <property name="visible">True</property>
1901
 
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
1902
 
+
1903
 
+         <child>
1904
 
+           <widget class="GtkButton" id="cancelbutton2">
1905
 
+             <property name="visible">True</property>
1906
 
+             <property name="can_default">True</property>
1907
 
+             <property name="can_focus">True</property>
1908
 
+             <property name="label">gtk-cancel</property>
1909
 
+             <property name="use_stock">True</property>
1910
 
+             <property name="relief">GTK_RELIEF_NORMAL</property>
1911
 
+             <property name="focus_on_click">True</property>
1912
 
+             <property name="response_id">-6</property>
1913
 
+           </widget>
1914
 
+         </child>
1915
 
+
1916
 
+         <child>
1917
 
+           <widget class="GtkButton" id="okbutton2">
1918
 
+             <property name="visible">True</property>
1919
 
+             <property name="can_default">True</property>
1920
 
+             <property name="can_focus">True</property>
1921
 
+             <property name="label">gtk-ok</property>
1922
 
+             <property name="use_stock">True</property>
1923
 
+             <property name="relief">GTK_RELIEF_NORMAL</property>
1924
 
+             <property name="focus_on_click">True</property>
1925
 
+             <property name="response_id">-5</property>
1926
 
+           </widget>
1927
 
+         </child>
1928
 
+       </widget>
1929
 
+       <packing>
1930
 
+         <property name="padding">0</property>
1931
 
+         <property name="expand">False</property>
1932
 
+         <property name="fill">True</property>
1933
 
+         <property name="pack_type">GTK_PACK_END</property>
1934
 
+       </packing>
1935
 
+      </child>
1936
 
+
1937
 
+      <child>
1938
 
+       <widget class="GtkVBox" id="vbox4">
1939
 
+         <property name="border_width">6</property>
1940
 
+         <property name="visible">True</property>
1941
 
+         <property name="homogeneous">False</property>
1942
 
+         <property name="spacing">6</property>
1943
 
+
1944
 
+         <child>
1945
 
+           <widget class="GtkLabel" id="pin_dialog_label">
1946
 
+             <property name="visible">True</property>
1947
 
+             <property name="label" translatable="yes">Please enter SIM PIN code</property>
1948
 
+             <property name="use_underline">False</property>
1949
 
+             <property name="use_markup">False</property>
1950
 
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
1951
 
+             <property name="wrap">False</property>
1952
 
+             <property name="selectable">False</property>
1953
 
+             <property name="xalign">0.5</property>
1954
 
+             <property name="yalign">0.5</property>
1955
 
+             <property name="xpad">0</property>
1956
 
+             <property name="ypad">0</property>
1957
 
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
1958
 
+             <property name="width_chars">-1</property>
1959
 
+             <property name="single_line_mode">False</property>
1960
 
+             <property name="angle">0</property>
1961
 
+           </widget>
1962
 
+           <packing>
1963
 
+             <property name="padding">0</property>
1964
 
+             <property name="expand">False</property>
1965
 
+             <property name="fill">False</property>
1966
 
+           </packing>
1967
 
+         </child>
1968
 
+
1969
 
+         <child>
1970
 
+           <widget class="GtkEntry" id="pin_dialog_entry">
1971
 
+             <property name="visible">True</property>
1972
 
+             <property name="can_focus">True</property>
1973
 
+             <property name="editable">True</property>
1974
 
+             <property name="visibility">True</property>
1975
 
+             <property name="max_length">0</property>
1976
 
+             <property name="text" translatable="yes"></property>
1977
 
+             <property name="has_frame">True</property>
1978
 
+             <property name="invisible_char">●</property>
1979
 
+             <property name="activates_default">False</property>
1980
 
+           </widget>
1981
 
+           <packing>
1982
 
+             <property name="padding">0</property>
1983
 
+             <property name="expand">False</property>
1984
 
+             <property name="fill">False</property>
1985
 
+           </packing>
1986
 
+         </child>
1987
 
+       </widget>
1988
 
+       <packing>
1989
 
+         <property name="padding">0</property>
1990
 
+         <property name="expand">True</property>
1991
 
+         <property name="fill">True</property>
1992
 
+       </packing>
1993
 
+      </child>
1994
 
+    </widget>
1995
 
+  </child>
1996
 
+</widget>
1997
 
+
1998
 
+</glade-interface>
1999
 
diff --git a/src/nma-gsm-modem.c b/src/nma-gsm-modem.c
2000
 
new file mode 100644
2001
 
index 0000000..0dba9cd
2002
 
--- /dev/null
2003
 
+++ b/src/nma-gsm-modem.c
2004
 
@@ -0,0 +1,198 @@
2005
 
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
2006
 
+
2007
 
+#include "nma-gsm-modem.h"
2008
 
+#include "mm-types.h"
2009
 
+
2010
 
+G_DEFINE_TYPE (NMAGsmModem, nma_gsm_modem, G_TYPE_OBJECT)
2011
 
+
2012
 
+#define NMA_GSM_MODEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NMA_TYPE_GSM_MODEM, NMAGsmModemPrivate))
2013
 
+
2014
 
+typedef struct {
2015
 
+       DBusGProxy *proxy;
2016
 
+       int signal_quality;
2017
 
+
2018
 
+       gboolean disposed;
2019
 
+} NMAGsmModemPrivate;
2020
 
+
2021
 
+enum {
2022
 
+       SIGNAL_QUALITY,
2023
 
+       NETWORK_MODE,
2024
 
+
2025
 
+       LAST_SIGNAL
2026
 
+};
2027
 
+
2028
 
+static guint signals[LAST_SIGNAL] = { 0 };
2029
 
+
2030
 
+static void
2031
 
+signal_quality_proxy (DBusGProxy *proxy,
2032
 
+                                 guint32 signal_quality,
2033
 
+                                 gpointer user_data)
2034
 
+{
2035
 
+       NMAGsmModem *modem = NMA_GSM_MODEM (user_data);
2036
 
+
2037
 
+       NMA_GSM_MODEM_GET_PRIVATE (modem)->signal_quality = signal_quality;
2038
 
+
2039
 
+       g_signal_emit (modem, signals[SIGNAL_QUALITY], 0, signal_quality);
2040
 
+}
2041
 
+
2042
 
+static void
2043
 
+network_mode_proxy (DBusGProxy *proxy,
2044
 
+                               guint32 network_mode,
2045
 
+                               gpointer user_data)
2046
 
+{
2047
 
+       NMAGsmModem *modem = NMA_GSM_MODEM (user_data);
2048
 
+
2049
 
+       g_signal_emit (modem, signals[NETWORK_MODE], 0, network_mode);
2050
 
+}
2051
 
+
2052
 
+NMAGsmModem *
2053
 
+nma_gsm_modem_new (DBusGConnection *bus, const char *object_path)
2054
 
+{
2055
 
+       NMAGsmModem *modem;
2056
 
+       NMAGsmModemPrivate *priv;
2057
 
+
2058
 
+       g_return_val_if_fail (bus != NULL, NULL);
2059
 
+       g_return_val_if_fail (object_path != NULL, NULL);
2060
 
+
2061
 
+       modem = (NMAGsmModem *) g_object_new (NMA_TYPE_GSM_MODEM, NULL);
2062
 
+       if (!modem)
2063
 
+               return NULL;
2064
 
+
2065
 
+       priv = NMA_GSM_MODEM_GET_PRIVATE (modem);
2066
 
+       priv->proxy = dbus_g_proxy_new_for_name (bus, MM_DBUS_SERVICE, object_path, MM_DBUS_INTERFACE_MODEM_GSM);
2067
 
+
2068
 
+       dbus_g_proxy_add_signal (priv->proxy, "SignalQuality", G_TYPE_UINT, G_TYPE_INVALID);
2069
 
+       dbus_g_proxy_connect_signal (priv->proxy, "SignalQuality",
2070
 
+                                                   G_CALLBACK (signal_quality_proxy),
2071
 
+                                                   modem,
2072
 
+                                                   NULL);
2073
 
+
2074
 
+       dbus_g_proxy_add_signal (priv->proxy, "NetworkMode", G_TYPE_UINT, G_TYPE_INVALID);
2075
 
+       dbus_g_proxy_connect_signal (priv->proxy, "NetworkMode",
2076
 
+                                                   G_CALLBACK (network_mode_proxy),
2077
 
+                                                   modem,
2078
 
+                                                   NULL);
2079
 
+
2080
 
+       return modem;
2081
 
+}
2082
 
+
2083
 
+guint32
2084
 
+nma_gsm_modem_get_signal_quality (NMAGsmModem *modem)
2085
 
+{
2086
 
+       NMAGsmModemPrivate *priv = NMA_GSM_MODEM_GET_PRIVATE (modem);
2087
 
+       GError *err = NULL;
2088
 
+
2089
 
+       g_return_val_if_fail (NMA_IS_GSM_MODEM (modem), 0);
2090
 
+
2091
 
+       if (priv->signal_quality == -1) {
2092
 
+               if (!dbus_g_proxy_call (priv->proxy, "GetSignalQuality", &err,
2093
 
+                                                   G_TYPE_INVALID,
2094
 
+                                                   G_TYPE_UINT, &priv->signal_quality,
2095
 
+                                                   G_TYPE_INVALID)) {
2096
 
+                       g_warning ("Error in getting signal quality: %s", err->message);
2097
 
+                       g_error_free (err);
2098
 
+               }
2099
 
+       }
2100
 
+
2101
 
+       return priv->signal_quality;
2102
 
+}
2103
 
+
2104
 
+guint32
2105
 
+nma_gsm_modem_get_registration_info (NMAGsmModem *modem,
2106
 
+                                                         char **operator_code,
2107
 
+                                                         char **operator_name)
2108
 
+{
2109
 
+       NMAGsmModemPrivate *priv = NMA_GSM_MODEM_GET_PRIVATE (modem);
2110
 
+       GError *err = NULL;
2111
 
+       guint32 status = MM_GSM_MODEM_REG_STATUS_UNKNOWN;
2112
 
+
2113
 
+       g_return_val_if_fail (NMA_IS_GSM_MODEM (modem), 0);
2114
 
+
2115
 
+       if (!dbus_g_proxy_call (priv->proxy, "GetRegistrationInfo", &err,
2116
 
+                                           G_TYPE_INVALID,
2117
 
+                                           G_TYPE_UINT, &status,
2118
 
+                                           G_TYPE_STRING, operator_code,
2119
 
+                                           G_TYPE_STRING, operator_name,
2120
 
+                                           G_TYPE_INVALID)) {
2121
 
+               g_warning ("Error in getting network mode: %s", err->message);
2122
 
+               g_error_free (err);
2123
 
+       }
2124
 
+
2125
 
+       return status;
2126
 
+}
2127
 
+
2128
 
+guint32
2129
 
+nma_gsm_modem_get_network_mode (NMAGsmModem *modem)
2130
 
+{
2131
 
+       NMAGsmModemPrivate *priv = NMA_GSM_MODEM_GET_PRIVATE (modem);
2132
 
+       GError *err = NULL;
2133
 
+       guint32 network_mode = 0;
2134
 
+
2135
 
+       g_return_val_if_fail (NMA_IS_GSM_MODEM (modem), 0);
2136
 
+
2137
 
+       if (!dbus_g_proxy_call (priv->proxy, "GetNetworkMode", &err,
2138
 
+                                           G_TYPE_INVALID,
2139
 
+                                           G_TYPE_UINT, &network_mode,
2140
 
+                                           G_TYPE_INVALID)) {
2141
 
+               g_warning ("Error in getting network mode: %s", err->message);
2142
 
+               g_error_free (err);
2143
 
+       }
2144
 
+
2145
 
+       return network_mode;
2146
 
+}
2147
 
+
2148
 
+static void
2149
 
+nma_gsm_modem_init (NMAGsmModem *modem)
2150
 
+{
2151
 
+       NMAGsmModemPrivate *priv = NMA_GSM_MODEM_GET_PRIVATE (modem);
2152
 
+
2153
 
+       priv->signal_quality = -1;
2154
 
+}
2155
 
+
2156
 
+static void
2157
 
+dispose (GObject *object)
2158
 
+{
2159
 
+       NMAGsmModemPrivate *priv = NMA_GSM_MODEM_GET_PRIVATE (object);
2160
 
+
2161
 
+       if (priv->disposed)
2162
 
+               return;
2163
 
+
2164
 
+       priv->disposed = TRUE;
2165
 
+
2166
 
+       if (priv->proxy)
2167
 
+               g_object_unref (priv->proxy);
2168
 
+
2169
 
+       G_OBJECT_CLASS (nma_gsm_modem_parent_class)->dispose (object);
2170
 
+}
2171
 
+
2172
 
+static void
2173
 
+nma_gsm_modem_class_init (NMAGsmModemClass *modem_class)
2174
 
+{
2175
 
+       GObjectClass *object_class = G_OBJECT_CLASS (modem_class);
2176
 
+
2177
 
+       g_type_class_add_private (modem_class, sizeof (NMAGsmModemPrivate));
2178
 
+
2179
 
+       /* virtual methods */
2180
 
+       object_class->dispose = dispose;
2181
 
+
2182
 
+       /* Signals */
2183
 
+       signals[SIGNAL_QUALITY] = 
2184
 
+               g_signal_new ("signal-quality",
2185
 
+                                   G_OBJECT_CLASS_TYPE (object_class),
2186
 
+                                   G_SIGNAL_RUN_FIRST,
2187
 
+                                   G_STRUCT_OFFSET (NMAGsmModemClass, signal_quality),
2188
 
+                                   NULL, NULL,
2189
 
+                                   g_cclosure_marshal_VOID__UINT,
2190
 
+                                   G_TYPE_NONE, 1,
2191
 
+                                   G_TYPE_UINT);
2192
 
+
2193
 
+       signals[NETWORK_MODE] = 
2194
 
+               g_signal_new ("network-mode",
2195
 
+                                   G_OBJECT_CLASS_TYPE (object_class),
2196
 
+                                   G_SIGNAL_RUN_FIRST,
2197
 
+                                   G_STRUCT_OFFSET (NMAGsmModemClass, network_mode),
2198
 
+                                   NULL, NULL,
2199
 
+                                   g_cclosure_marshal_VOID__UINT,
2200
 
+                                   G_TYPE_NONE, 1,
2201
 
+                                   G_TYPE_UINT);
2202
 
+}
2203
 
diff --git a/src/nma-gsm-modem.h b/src/nma-gsm-modem.h
2204
 
new file mode 100644
2205
 
index 0000000..90e7ae0
2206
 
--- /dev/null
2207
 
+++ b/src/nma-gsm-modem.h
2208
 
@@ -0,0 +1,45 @@
2209
 
+/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
2210
 
+
2211
 
+#ifndef NMA_GSM_MODEM_H
2212
 
+#define NMA_GSM_MODEM_H
2213
 
+
2214
 
+#include <glib/gtypes.h>
2215
 
+#include <glib-object.h>
2216
 
+#include <dbus/dbus-glib.h>
2217
 
+
2218
 
+G_BEGIN_DECLS
2219
 
+
2220
 
+#define NMA_TYPE_GSM_MODEM            (nma_gsm_modem_get_type ())
2221
 
+#define NMA_GSM_MODEM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NMA_TYPE_GSM_MODEM, NMAGsmModem))
2222
 
+#define NMA_GSM_MODEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NMA_TYPE_GSM_MODEM, NMAGsmModemClass))
2223
 
+#define NMA_IS_GSM_MODEM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NMA_TYPE_GSM_MODEM))
2224
 
+#define NMA_IS_GSM_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NMA_TYPE_GSM_MODEM))
2225
 
+#define NMA_GSM_MODEM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NMA_TYPE_GSM_MODEM, NMAGsmModemClass))
2226
 
+
2227
 
+typedef struct {
2228
 
+       GObject parent;
2229
 
+} NMAGsmModem;
2230
 
+
2231
 
+typedef struct {
2232
 
+       GObjectClass parent;
2233
 
+
2234
 
+       /* Signals */
2235
 
+       void (*signal_quality) (NMAGsmModem *modem, guint32 signal_quality);
2236
 
+       void (*network_mode) (NMAGsmModem *modem, guint32 network_mode);
2237
 
+} NMAGsmModemClass;
2238
 
+
2239
 
+GType        nma_gsm_modem_get_type (void);
2240
 
+
2241
 
+NMAGsmModem *nma_gsm_modem_new (DBusGConnection *bus,
2242
 
+                                                 const char *object_path);
2243
 
+
2244
 
+guint32 nma_gsm_modem_get_signal_quality (NMAGsmModem *modem);
2245
 
+guint32 nma_gsm_modem_get_registration_info (NMAGsmModem *modem,
2246
 
+                                                                       char **operator_code,
2247
 
+                                                                       char **operator_name);
2248
 
+
2249
 
+guint32 nma_gsm_modem_get_network_mode (NMAGsmModem *modem);
2250
 
+
2251
 
+G_END_DECLS
2252
 
+
2253
 
+#endif /* NMA_GSM_MODEM_H */