Gentoo Archives: gentoo-commits

From: Nirbheek Chauhan <nirbheek@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gnome:master commit in: gnome-base/gnome-control-center/, gnome-base/gnome-control-center/files/
Date: Mon, 28 Feb 2011 07:48:42
Message-Id: 9ab32e0c1e4a93ad6a4a5644c014028a48605d85.nirbheek@gentoo
1 commit: 9ab32e0c1e4a93ad6a4a5644c014028a48605d85
2 Author: Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 28 07:27:16 2011 +0000
4 Commit: Nirbheek Chauhan <nirbheek <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 28 07:34:48 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gnome.git;a=commit;h=9ab32e0c
7
8 gnome-base/gnome-control-center: fix bug 356729 and bug 356715
9
10 * Reported by Alexandre Rostovtsev
11
12 ---
13 ...ome-control-center-fix-networkmanager-api.patch | 285 ++++++++++++++++++++
14 .../gnome-control-center-2.91.90.ebuild | 5 +
15 .../gnome-control-center-9999.ebuild | 5 +
16 3 files changed, 295 insertions(+), 0 deletions(-)
17
18 diff --git a/gnome-base/gnome-control-center/files/gnome-control-center-fix-networkmanager-api.patch b/gnome-base/gnome-control-center/files/gnome-control-center-fix-networkmanager-api.patch
19 new file mode 100644
20 index 0000000..e73b16d
21 --- /dev/null
22 +++ b/gnome-base/gnome-control-center/files/gnome-control-center-fix-networkmanager-api.patch
23 @@ -0,0 +1,285 @@
24 +From ab15c3ce94424c25f4afdb13a8c0acd4dc6351ea Mon Sep 17 00:00:00 2001
25 +From: Daniel Trebbien <dtrebbien@×××××.com>
26 +Date: Sun, 27 Feb 2011 11:10:10 -0500
27 +Subject: [PATCH 1/1] Use the NetworkManager modem capabilities API.
28 +
29 +A recent change to the NetworkManager API combined the
30 +NM_DEVICE_TYPE_GSM and NM_DEVICE_TYPE_CDMA types as
31 +NM_DEVICE_TYPE_MODEM and provided an alternative API for accessing the
32 +modem device's capabilities (including GSM_UMTS and CDMA_EVDO).
33 +
34 +https://bugzilla.gnome.org/show_bug.cgi?id=643390
35 +---
36 + panels/network/cc-network-panel.c | 76 ++++++++++++++++++++-----------------
37 + panels/network/panel-common.c | 51 ++++++++++++++++---------
38 + panels/network/panel-common.h | 7 ++-
39 + 3 files changed, 78 insertions(+), 56 deletions(-)
40 +
41 +diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
42 +index 9148df7..ba37581 100644
43 +--- a/panels/network/cc-network-panel.c
44 ++++ b/panels/network/cc-network-panel.c
45 +@@ -28,6 +28,7 @@
46 + #include "nm-client.h"
47 + #include "nm-device.h"
48 + #include "nm-device-ethernet.h"
49 ++#include "nm-device-modem.h"
50 + #include "nm-device-wifi.h"
51 + #include "nm-utils.h"
52 + #include "nm-active-connection.h"
53 +@@ -376,8 +377,7 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
54 +
55 + /* do we have to get additonal data from ModemManager */
56 + type = nm_device_get_device_type (device);
57 +- if (type == NM_DEVICE_TYPE_GSM ||
58 +- type == NM_DEVICE_TYPE_CDMA) {
59 ++ if (type == NM_DEVICE_TYPE_MODEM) {
60 + g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
61 + G_DBUS_PROXY_FLAGS_NONE,
62 + NULL,
63 +@@ -400,15 +400,15 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
64 +
65 + /* make title a bit bigger */
66 + title = g_strdup_printf ("<span size=\"large\">%s</span>",
67 +- panel_device_type_to_localized_string (nm_device_get_device_type (device)));
68 ++ panel_device_to_localized_string (device));
69 +
70 + liststore_devices = GTK_LIST_STORE (gtk_builder_get_object (priv->builder,
71 + "liststore_devices"));
72 + gtk_list_store_append (liststore_devices, &iter);
73 + gtk_list_store_set (liststore_devices,
74 + &iter,
75 +- PANEL_DEVICES_COLUMN_ICON, panel_device_type_to_icon_name (nm_device_get_device_type (device)),
76 +- PANEL_DEVICES_COLUMN_SORT, panel_device_type_to_sortable_string (nm_device_get_device_type (device)),
77 ++ PANEL_DEVICES_COLUMN_ICON, panel_device_to_icon_name (device),
78 ++ PANEL_DEVICES_COLUMN_SORT, panel_device_to_sortable_string (device),
79 + PANEL_DEVICES_COLUMN_TITLE, title,
80 + PANEL_DEVICES_COLUMN_ID, nm_device_get_udi (device),
81 + PANEL_DEVICES_COLUMN_TOOLTIP, NULL,
82 +@@ -729,14 +729,14 @@ nm_device_refresh_item_ui (CcNetworkPanel *panel, NMDevice *device)
83 + widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
84 + "image_device"));
85 + gtk_image_set_from_icon_name (GTK_IMAGE (widget),
86 +- panel_device_type_to_icon_name (type),
87 ++ panel_device_to_icon_name (device),
88 + GTK_ICON_SIZE_DIALOG);
89 +
90 + /* set device kind */
91 + widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
92 + "label_device"));
93 + gtk_label_set_label (GTK_LABEL (widget),
94 +- panel_device_type_to_localized_string (type));
95 ++ panel_device_to_localized_string (device));
96 +
97 +
98 + /* set device state */
99 +@@ -754,10 +754,13 @@ nm_device_refresh_item_ui (CcNetworkPanel *panel, NMDevice *device)
100 + } else if (type == NM_DEVICE_TYPE_WIFI) {
101 + gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 1);
102 + sub_pane = "wireless";
103 +- } else if (type == NM_DEVICE_TYPE_GSM ||
104 +- type == NM_DEVICE_TYPE_CDMA) {
105 +- gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 4);
106 +- sub_pane = "mobilebb";
107 ++ } else if (type == NM_DEVICE_TYPE_MODEM) {
108 ++ NMDeviceModemCapabilities caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
109 ++ if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
110 ++ (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) {
111 ++ gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 4);
112 ++ sub_pane = "mobilebb";
113 ++ }
114 + }
115 + if (sub_pane == NULL)
116 + goto out;
117 +@@ -824,30 +827,33 @@ nm_device_refresh_item_ui (CcNetworkPanel *panel, NMDevice *device)
118 + active_ap);
119 + }
120 +
121 +- } else if (type == NM_DEVICE_TYPE_GSM ||
122 +- type == NM_DEVICE_TYPE_CDMA) {
123 ++ } else if (type == NM_DEVICE_TYPE_MODEM) {
124 ++ NMDeviceModemCapabilities caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
125 +
126 +- /* IMEI */
127 +- str = g_object_get_data (G_OBJECT (device),
128 +- "ControlCenter::EquipmentIdentifier");
129 +- panel_set_widget_data (panel,
130 +- sub_pane,
131 +- "imei",
132 +- str);
133 ++ if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
134 ++ (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) {
135 ++ /* IMEI */
136 ++ str = g_object_get_data (G_OBJECT (device),
137 ++ "ControlCenter::EquipmentIdentifier");
138 ++ panel_set_widget_data (panel,
139 ++ sub_pane,
140 ++ "imei",
141 ++ str);
142 +
143 +- /* operator name */
144 +- str = g_object_get_data (G_OBJECT (device),
145 +- "ControlCenter::OperatorName");
146 +- panel_set_widget_data (panel,
147 +- sub_pane,
148 +- "provider",
149 +- str);
150 ++ /* operator name */
151 ++ str = g_object_get_data (G_OBJECT (device),
152 ++ "ControlCenter::OperatorName");
153 ++ panel_set_widget_data (panel,
154 ++ sub_pane,
155 ++ "provider",
156 ++ str);
157 +
158 +- /* device speed */
159 +- panel_set_widget_data (panel,
160 +- sub_pane,
161 +- "speed",
162 +- NULL);
163 ++ /* device speed */
164 ++ panel_set_widget_data (panel,
165 ++ sub_pane,
166 ++ "speed",
167 ++ NULL);
168 ++ }
169 + }
170 +
171 + /* get IP4 parameters */
172 +diff --git a/panels/network/panel-common.c b/panels/network/panel-common.c
173 +index 928b0c4..b07189b 100644
174 +--- a/panels/network/panel-common.c
175 ++++ b/panels/network/panel-common.c
176 +@@ -26,25 +26,32 @@
177 + #include <gtk/gtk.h>
178 +
179 + #include "panel-common.h"
180 ++#include "nm-device-modem.h"
181 +
182 + /**
183 +- * panel_device_type_to_icon_name:
184 ++ * panel_device_to_icon_name:
185 + **/
186 + const gchar *
187 +-panel_device_type_to_icon_name (NMDeviceType type)
188 ++panel_device_to_icon_name (NMDevice *device)
189 + {
190 + const gchar *value = NULL;
191 +- switch (type) {
192 ++ NMDeviceModemCapabilities caps;
193 ++ switch (nm_device_get_device_type (device)) {
194 + case NM_DEVICE_TYPE_ETHERNET:
195 + value = "network-wired";
196 + break;
197 + case NM_DEVICE_TYPE_WIFI:
198 +- case NM_DEVICE_TYPE_GSM:
199 +- case NM_DEVICE_TYPE_CDMA:
200 + case NM_DEVICE_TYPE_BT:
201 + case NM_DEVICE_TYPE_OLPC_MESH:
202 + value = "network-wireless";
203 + break;
204 ++ case NM_DEVICE_TYPE_MODEM:
205 ++ caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
206 ++ if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
207 ++ (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) {
208 ++ value = "network-wireless";
209 ++ }
210 ++ break;
211 + default:
212 + break;
213 + }
214 +@@ -52,13 +59,14 @@ panel_device_type_to_icon_name (NMDeviceType type)
215 + }
216 +
217 + /**
218 +- * panel_device_type_to_localized_string:
219 ++ * panel_device_to_localized_string:
220 + **/
221 + const gchar *
222 +-panel_device_type_to_localized_string (NMDeviceType type)
223 ++panel_device_to_localized_string (NMDevice *device)
224 + {
225 + const gchar *value = NULL;
226 +- switch (type) {
227 ++ NMDeviceModemCapabilities caps;
228 ++ switch (nm_device_get_device_type (device)) {
229 + case NM_DEVICE_TYPE_UNKNOWN:
230 + /* TRANSLATORS: device type */
231 + value = _("Unknown");
232 +@@ -71,10 +79,13 @@ panel_device_type_to_localized_string (NMDeviceType type)
233 + /* TRANSLATORS: device type */
234 + value = _("Wireless");
235 + break;
236 +- case NM_DEVICE_TYPE_GSM:
237 +- case NM_DEVICE_TYPE_CDMA:
238 +- /* TRANSLATORS: device type */
239 +- value = _("Mobile broadband");
240 ++ case NM_DEVICE_TYPE_MODEM:
241 ++ caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
242 ++ if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
243 ++ (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) {
244 ++ /* TRANSLATORS: device type */
245 ++ value = _("Mobile broadband");
246 ++ }
247 + break;
248 + case NM_DEVICE_TYPE_BT:
249 + /* TRANSLATORS: device type */
250 +@@ -91,24 +102,28 @@ panel_device_type_to_localized_string (NMDeviceType type)
251 + }
252 +
253 + /**
254 +- * panel_device_type_to_sortable_string:
255 ++ * panel_device_to_sortable_string:
256 + *
257 + * Try to return order of approximate connection speed.
258 + **/
259 + const gchar *
260 +-panel_device_type_to_sortable_string (NMDeviceType type)
261 ++panel_device_to_sortable_string (NMDevice *device)
262 + {
263 + const gchar *value = NULL;
264 +- switch (type) {
265 ++ NMDeviceModemCapabilities caps;
266 ++ switch (nm_device_get_device_type (device)) {
267 + case NM_DEVICE_TYPE_ETHERNET:
268 + value = "1";
269 + break;
270 + case NM_DEVICE_TYPE_WIFI:
271 + value = "2";
272 + break;
273 +- case NM_DEVICE_TYPE_GSM:
274 +- case NM_DEVICE_TYPE_CDMA:
275 +- value = "3";
276 ++ case NM_DEVICE_TYPE_MODEM:
277 ++ caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
278 ++ if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
279 ++ (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) {
280 ++ value = "3";
281 ++ }
282 + break;
283 + case NM_DEVICE_TYPE_BT:
284 + value = "4";
285 +diff --git a/panels/network/panel-common.h b/panels/network/panel-common.h
286 +index c50f6b3..dd0eb08 100644
287 +--- a/panels/network/panel-common.h
288 ++++ b/panels/network/panel-common.h
289 +@@ -24,12 +24,13 @@
290 +
291 + #include <glib-object.h>
292 + #include <NetworkManager.h>
293 ++#include <nm-device.h>
294 +
295 + G_BEGIN_DECLS
296 +
297 +-const gchar *panel_device_type_to_icon_name (NMDeviceType type);
298 +-const gchar *panel_device_type_to_localized_string (NMDeviceType type);
299 +-const gchar *panel_device_type_to_sortable_string (NMDeviceType type);
300 ++const gchar *panel_device_to_icon_name (NMDevice *device);
301 ++const gchar *panel_device_to_localized_string (NMDevice *device);
302 ++const gchar *panel_device_to_sortable_string (NMDevice *device);
303 + const gchar *panel_ap_mode_to_localized_string (NM80211Mode mode);
304 + const gchar *panel_device_state_to_localized_string (NMDeviceState type);
305 +
306 +--
307 +1.7.2.3
308 +
309
310 diff --git a/gnome-base/gnome-control-center/gnome-control-center-2.91.90.ebuild b/gnome-base/gnome-control-center/gnome-control-center-2.91.90.ebuild
311 index d1101b0..9cb2b1b 100644
312 --- a/gnome-base/gnome-control-center/gnome-control-center-2.91.90.ebuild
313 +++ b/gnome-base/gnome-control-center/gnome-control-center-2.91.90.ebuild
314 @@ -89,4 +89,9 @@ src_prepare() {
315 --disable-schemas-install
316 $(use_with socialweb libsocialweb)"
317 DOCS="AUTHORS ChangeLog NEWS README TODO"
318 +
319 + # bug 356729
320 + epatch "${FILESDIR}/${PN}-fix-networkmanager-api.patch"
321 +
322 + gnome2_src_prepare
323 }
324
325 diff --git a/gnome-base/gnome-control-center/gnome-control-center-9999.ebuild b/gnome-base/gnome-control-center/gnome-control-center-9999.ebuild
326 index d1101b0..9cb2b1b 100644
327 --- a/gnome-base/gnome-control-center/gnome-control-center-9999.ebuild
328 +++ b/gnome-base/gnome-control-center/gnome-control-center-9999.ebuild
329 @@ -89,4 +89,9 @@ src_prepare() {
330 --disable-schemas-install
331 $(use_with socialweb libsocialweb)"
332 DOCS="AUTHORS ChangeLog NEWS README TODO"
333 +
334 + # bug 356729
335 + epatch "${FILESDIR}/${PN}-fix-networkmanager-api.patch"
336 +
337 + gnome2_src_prepare
338 }