]>
Commit | Line | Data |
---|---|---|
d912c196 MB |
1 | From a55917cad258da5688d23db6fedfc2e24afdc819 Mon Sep 17 00:00:00 2001 |
2 | From: Mirsal Ennaime <mirsal.ennaime@gmail.com> | |
3 | Date: Mon, 02 Aug 2010 22:28:06 +0000 | |
4 | Subject: applet: fix compilation with -DGSEAL_ENABLE (bgo #615653) | |
5 | ||
6 | This patch substitutes all direct access to Gtk+ object fields | |
7 | with accessor functions in order to fulfill the UseGseal goal | |
8 | as described at http://live.gnome.org/GnomeGoals/UseGseal | |
9 | ||
10 | (GTK 2.14+ compat fixes by dcbw) | |
11 | --- | |
12 | diff --git a/src/applet.c b/src/applet.c | |
13 | index 2734045..6cb4e8c 100644 | |
14 | --- a/src/applet.c | |
15 | +++ b/src/applet.c | |
16 | @@ -482,6 +482,7 @@ applet_new_menu_item_helper (NMConnection *connection, | |
17 | static gboolean | |
18 | menu_title_item_expose (GtkWidget *widget, GdkEventExpose *event) | |
19 | { | |
20 | + GtkAllocation allocation; | |
21 | GtkStyle *style; | |
22 | GtkWidget *label; | |
23 | PangoFontDescription *desc; | |
24 | @@ -509,6 +510,11 @@ menu_title_item_expose (GtkWidget *widget, GdkEventExpose *event) | |
25 | /* We also need to reposition the cairo context so that (0, 0) is the | |
26 | * top-left of where we're supposed to start drawing. | |
27 | */ | |
28 | +#if GTK_CHECK_VERSION(2,18,0) | |
29 | + gtk_widget_get_allocation (widget, &allocation); | |
30 | +#else | |
31 | + allocation = widget->allocation; | |
32 | +#endif | |
33 | cairo_translate (cr, widget->allocation.x, widget->allocation.y); | |
34 | ||
35 | text = gtk_label_get_text (GTK_LABEL (label)); | |
36 | diff --git a/src/utils/nma-bling-spinner.c b/src/utils/nma-bling-spinner.c | |
37 | index 5522046..0587727 100644 | |
38 | --- a/src/utils/nma-bling-spinner.c | |
39 | +++ b/src/utils/nma-bling-spinner.c | |
40 | @@ -67,30 +67,30 @@ static GtkDrawingAreaClass *parent_class; | |
41 | static void | |
42 | draw (GtkWidget *widget, cairo_t *cr) | |
43 | { | |
44 | + NmaBlingSpinnerPrivate *priv; | |
45 | + GtkAllocation allocation; | |
46 | double x, y; | |
47 | double radius; | |
48 | double half; | |
49 | int i; | |
50 | - int width, height; | |
51 | - | |
52 | - NmaBlingSpinnerPrivate *priv; | |
53 | ||
54 | priv = NMA_BLING_SPINNER_GET_PRIVATE (widget); | |
55 | ||
56 | cairo_set_operator (cr, CAIRO_OPERATOR_OVER); | |
57 | ||
58 | - width = widget->allocation.width; | |
59 | - height = widget->allocation.height; | |
60 | - | |
61 | - if ( (width < 12) || (height <12) ) | |
62 | +#if GTK_CHECK_VERSION(2,18,0) | |
63 | + gtk_widget_get_allocation (widget, &allocation); | |
64 | +#else | |
65 | + allocation = widget->allocation; | |
66 | +#endif | |
67 | + if ((allocation.width < 12) || (allocation.height < 12)) | |
68 | gtk_widget_set_size_request(widget, 12, 12); | |
69 | ||
70 | - //x = widget->allocation.x + widget->allocation.width / 2; | |
71 | - //y = widget->allocation.y + widget->allocation.height / 2; | |
72 | - x = widget->allocation.width / 2; | |
73 | - y = widget->allocation.height / 2; | |
74 | - radius = MIN (widget->allocation.width / 2, | |
75 | - widget->allocation.height / 2); | |
76 | + //x = allocation.x + allocation.width / 2; | |
77 | + //y = allocation.y + allocation.height / 2; | |
78 | + x = allocation.width / 2; | |
79 | + y = allocation.height / 2; | |
80 | + radius = MIN (allocation.width / 2, allocation.height / 2); | |
81 | half = priv->lines / 2; | |
82 | ||
83 | /*FIXME: render in B&W for non transparency */ | |
84 | @@ -154,7 +154,11 @@ nma_bling_spinner_init (NmaBlingSpinner *spinner) | |
85 | priv->current = 0; | |
86 | priv->timeout = 0; | |
87 | ||
88 | +#if GTK_CHECK_VERSION(2,18,0) | |
89 | + gtk_widget_set_has_window (GTK_WIDGET (spinner), FALSE); | |
90 | +#else | |
91 | GTK_WIDGET_SET_FLAGS (GTK_WIDGET (spinner), GTK_NO_WINDOW); | |
92 | +#endif | |
93 | } | |
94 | ||
95 | static gboolean | |
96 | -- | |
97 | cgit v0.8.3.1 | |
98 | From 7143a4c40d05c857e2c8e817e0e2f768936bf66c Mon Sep 17 00:00:00 2001 | |
99 | From: Vincent Untz <vuntz@gnome.org> | |
100 | Date: Mon, 09 Aug 2010 15:34:11 +0000 | |
101 | Subject: build: fix compilation with glib >= 2.25.12 (bgo #626424) | |
102 | ||
103 | Work around API breakage in glib. | |
104 | --- | |
105 | diff --git a/src/utils/tests/test-utils.c b/src/utils/tests/test-utils.c | |
106 | index 7eb1ffa..83b8ffe 100644 | |
107 | --- a/src/utils/tests/test-utils.c | |
108 | +++ b/src/utils/tests/test-utils.c | |
109 | @@ -413,7 +413,11 @@ test_ap_hash_foobar_asdf11_adhoc_wpa_rsn (void *f, TestData *d) | |
110 | g_assert (strcmp (d->foobar_adhoc_wpa_rsn, d->asdf11_adhoc_wpa_rsn)); | |
111 | } | |
112 | ||
113 | +#if GLIB_CHECK_VERSION(2,25,12) | |
114 | +typedef GTestFixtureFunc TCFunc; | |
115 | +#else | |
116 | typedef void (*TCFunc)(void); | |
117 | +#endif | |
118 | ||
119 | #define TESTCASE(t, d) g_test_create_case (#t, 0, d, NULL, (TCFunc) t, NULL) | |
120 | ||
121 | -- | |
122 | cgit v0.8.3.1 | |
123 | From f7d629b6bd1ddcddcc449db83a999e3e65084fd2 Mon Sep 17 00:00:00 2001 | |
124 | From: Mirsal Ennaime <mirsal.ennaime@gmail.com> | |
125 | Date: Mon, 02 Aug 2010 22:01:53 +0000 | |
126 | Subject: applet: use GSEAL compatible code for GTK 2.14+ functions | |
127 | ||
128 | This makes the applet GSEAL compatible except for those functions | |
129 | that do not exist in GTK 2.14. Patch for full GSeal compatibility | |
130 | will come soon. | |
131 | --- | |
132 | diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c | |
133 | index 27cfb67..eaa2267 100644 | |
134 | --- a/src/applet-device-gsm.c | |
135 | +++ b/src/applet-device-gsm.c | |
136 | @@ -700,8 +700,8 @@ ask_for_pin_puk (NMDevice *device, | |
137 | GtkEntry **out_secret_entry) | |
138 | { | |
139 | GtkDialog *dialog; | |
140 | - GtkWidget *w = NULL, *ok_button; | |
141 | - GtkBox *box; | |
142 | + GtkWidget *w = NULL, *ok_button = NULL; | |
143 | + GtkBox *box = NULL, *vbox = NULL; | |
144 | char *dev_str; | |
145 | ||
146 | dialog = GTK_DIALOG (gtk_dialog_new ()); | |
147 | @@ -718,21 +718,23 @@ ask_for_pin_puk (NMDevice *device, | |
148 | ok_button = gtk_dialog_add_button (dialog, GTK_STOCK_OK, GTK_RESPONSE_OK); | |
149 | gtk_window_set_default (GTK_WINDOW (dialog), ok_button); | |
150 | ||
151 | + vbox = GTK_BOX (gtk_dialog_get_content_area (dialog)); | |
152 | + | |
153 | if (!strcmp (secret_name, NM_SETTING_GSM_PIN)) | |
154 | w = gtk_label_new (_("PIN code is needed for the mobile broadband device")); | |
155 | else if (!strcmp (secret_name, NM_SETTING_GSM_PUK)) | |
156 | w = gtk_label_new (_("PUK code is needed for the mobile broadband device")); | |
157 | if (w) | |
158 | - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); | |
159 | + gtk_box_pack_start (vbox, w, TRUE, TRUE, 0); | |
160 | ||
161 | dev_str = g_strdup_printf ("<b>%s</b>", utils_get_device_description (device)); | |
162 | w = gtk_label_new (NULL); | |
163 | gtk_label_set_markup (GTK_LABEL (w), dev_str); | |
164 | g_free (dev_str); | |
165 | - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); | |
166 | + gtk_box_pack_start (vbox, w, TRUE, TRUE, 0); | |
167 | ||
168 | w = gtk_alignment_new (0.5, 0.5, 0, 1.0); | |
169 | - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); | |
170 | + gtk_box_pack_start (vbox, w, TRUE, TRUE, 0); | |
171 | ||
172 | box = GTK_BOX (gtk_hbox_new (FALSE, 6)); | |
173 | gtk_container_set_border_width (GTK_CONTAINER (box), 6); | |
174 | @@ -749,7 +751,7 @@ ask_for_pin_puk (NMDevice *device, | |
175 | g_signal_connect (w, "changed", G_CALLBACK (pin_entry_changed), ok_button); | |
176 | pin_entry_changed (GTK_EDITABLE (w), ok_button); | |
177 | ||
178 | - gtk_widget_show_all (dialog->vbox); | |
179 | + gtk_widget_show_all (GTK_WIDGET (vbox)); | |
180 | return GTK_WIDGET (dialog); | |
181 | } | |
182 | ||
183 | diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c | |
184 | index cebdf80..0821e7f 100644 | |
185 | --- a/src/applet-device-wifi.c | |
186 | +++ b/src/applet-device-wifi.c | |
187 | @@ -57,7 +57,8 @@ show_ignore_focus_stealing_prevention (GtkWidget *widget) | |
188 | { | |
189 | gtk_widget_realize (widget); | |
190 | gtk_widget_show (widget); | |
191 | - gtk_window_present_with_time (GTK_WINDOW (widget), gdk_x11_get_server_time (widget->window)); | |
192 | + gtk_window_present_with_time (GTK_WINDOW (widget), | |
193 | + gdk_x11_get_server_time (gtk_widget_get_window (widget))); | |
194 | } | |
195 | ||
196 | static void | |
197 | diff --git a/src/applet-device-wired.c b/src/applet-device-wired.c | |
198 | index 7f10e57..b1649cd 100644 | |
199 | --- a/src/applet-device-wired.c | |
200 | +++ b/src/applet-device-wired.c | |
201 | @@ -569,7 +569,7 @@ pppoe_get_secrets (NMDevice *device, | |
202 | w = gtk_dialog_add_button (GTK_DIALOG (info->dialog), GTK_STOCK_OK, GTK_RESPONSE_OK); | |
203 | info->ok_button = w; | |
204 | ||
205 | - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (info->dialog)->vbox), | |
206 | + gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (info->dialog))), | |
207 | glade_xml_get_widget (xml, "DslPage"), | |
208 | TRUE, TRUE, 0); | |
209 | ||
210 | diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c | |
211 | index 7681e48..ae6ae69 100644 | |
212 | --- a/src/applet-dialogs.c | |
213 | +++ b/src/applet-dialogs.c | |
214 | @@ -564,7 +564,8 @@ applet_info_dialog_show (NMApplet *applet) | |
215 | g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), dialog); | |
216 | g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_hide), dialog); | |
217 | gtk_widget_realize (dialog); | |
218 | - gtk_window_present_with_time (GTK_WINDOW (dialog), gdk_x11_get_server_time (dialog->window)); | |
219 | + gtk_window_present_with_time (GTK_WINDOW (dialog), | |
220 | + gdk_x11_get_server_time (gtk_widget_get_window (dialog))); | |
221 | } | |
222 | ||
223 | static void | |
224 | @@ -697,7 +698,8 @@ applet_warning_dialog_show (const char *message) | |
225 | gtk_window_set_title (GTK_WINDOW (dialog), _("Missing resources")); | |
226 | gtk_widget_realize (dialog); | |
227 | gtk_widget_show (dialog); | |
228 | - gtk_window_present_with_time (GTK_WINDOW (dialog), gdk_x11_get_server_time (dialog->window)); | |
229 | + gtk_window_present_with_time (GTK_WINDOW (dialog), | |
230 | + gdk_x11_get_server_time (gtk_widget_get_window (dialog))); | |
231 | ||
232 | g_signal_connect_swapped (dialog, "response", | |
233 | G_CALLBACK (gtk_widget_destroy), | |
234 | @@ -712,7 +714,7 @@ applet_mobile_password_dialog_new (NMDevice *device, | |
235 | { | |
236 | GtkDialog *dialog; | |
237 | GtkWidget *w; | |
238 | - GtkBox *box; | |
239 | + GtkBox *box = NULL, *vbox = NULL; | |
240 | char *dev_str; | |
241 | NMSettingConnection *s_con; | |
242 | char *tmp; | |
243 | @@ -732,16 +734,19 @@ applet_mobile_password_dialog_new (NMDevice *device, | |
244 | tmp = g_strdup_printf (_("A password is required to connect to '%s'."), id); | |
245 | w = gtk_label_new (tmp); | |
246 | g_free (tmp); | |
247 | - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); | |
248 | + | |
249 | + vbox = GTK_BOX (gtk_dialog_get_content_area (dialog)); | |
250 | + | |
251 | + gtk_box_pack_start (vbox, w, TRUE, TRUE, 0); | |
252 | ||
253 | dev_str = g_strdup_printf ("<b>%s</b>", utils_get_device_description (device)); | |
254 | w = gtk_label_new (NULL); | |
255 | gtk_label_set_markup (GTK_LABEL (w), dev_str); | |
256 | g_free (dev_str); | |
257 | - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); | |
258 | + gtk_box_pack_start (vbox, w, TRUE, TRUE, 0); | |
259 | ||
260 | w = gtk_alignment_new (0.5, 0.5, 0, 1.0); | |
261 | - gtk_box_pack_start (GTK_BOX (dialog->vbox), w, TRUE, TRUE, 0); | |
262 | + gtk_box_pack_start (vbox, w, TRUE, TRUE, 0); | |
263 | ||
264 | box = GTK_BOX (gtk_hbox_new (FALSE, 6)); | |
265 | gtk_container_set_border_width (GTK_CONTAINER (box), 6); | |
266 | @@ -754,7 +759,7 @@ applet_mobile_password_dialog_new (NMDevice *device, | |
267 | gtk_entry_set_activates_default (GTK_ENTRY (w), TRUE); | |
268 | gtk_box_pack_start (box, w, FALSE, FALSE, 0); | |
269 | ||
270 | - gtk_widget_show_all (dialog->vbox); | |
271 | + gtk_widget_show_all (GTK_WIDGET (vbox)); | |
272 | return GTK_WIDGET (dialog); | |
273 | } | |
274 | ||
275 | @@ -914,7 +919,8 @@ applet_mobile_pin_dialog_present (GtkWidget *dialog, gboolean now) | |
276 | /* Show the dialog */ | |
277 | gtk_widget_realize (dialog); | |
278 | if (now) | |
279 | - gtk_window_present_with_time (GTK_WINDOW (dialog), gdk_x11_get_server_time (dialog->window)); | |
280 | + gtk_window_present_with_time (GTK_WINDOW (dialog), | |
281 | + gdk_x11_get_server_time (gtk_widget_get_window (dialog))); | |
282 | else | |
283 | gtk_window_present (GTK_WINDOW (dialog)); | |
284 | } | |
285 | diff --git a/src/applet.c b/src/applet.c | |
286 | index fb4936c..2734045 100644 | |
287 | --- a/src/applet.c | |
288 | +++ b/src/applet.c | |
289 | @@ -496,7 +496,7 @@ menu_title_item_expose (GtkWidget *widget, GdkEventExpose *event) | |
290 | ||
291 | label = gtk_bin_get_child (GTK_BIN (widget)); | |
292 | ||
293 | - cr = gdk_cairo_create (widget->window); | |
294 | + cr = gdk_cairo_create (gtk_widget_get_window (widget)); | |
295 | ||
296 | /* The drawing area we get is the whole menu; clip the drawing to the | |
297 | * event area, which should just be our menu item. | |
298 | @@ -2922,9 +2922,12 @@ applet_pre_keyring_callback (gpointer user_data) | |
299 | NMApplet *applet = NM_APPLET (user_data); | |
300 | GdkScreen *screen; | |
301 | GdkDisplay *display; | |
302 | + GdkWindow *window = NULL; | |
303 | ||
304 | - if (applet->menu && applet->menu->window) { | |
305 | - screen = gdk_drawable_get_screen (applet->menu->window); | |
306 | + if (applet->menu) | |
307 | + window = gtk_widget_get_window (applet->menu); | |
308 | + if (window) { | |
309 | + screen = gdk_drawable_get_screen (window); | |
310 | display = gdk_screen_get_display (screen); | |
311 | g_object_ref (display); | |
312 | ||
313 | @@ -2941,8 +2944,11 @@ applet_pre_keyring_callback (gpointer user_data) | |
314 | g_object_unref (display); | |
315 | } | |
316 | ||
317 | - if (applet->context_menu && applet->context_menu->window) { | |
318 | - screen = gdk_drawable_get_screen (applet->context_menu->window); | |
319 | + window = NULL; | |
320 | + if (applet->context_menu) | |
321 | + window = gtk_widget_get_window (applet->context_menu); | |
322 | + if (window) { | |
323 | + screen = gdk_drawable_get_screen (window); | |
324 | display = gdk_screen_get_display (screen); | |
325 | g_object_ref (display); | |
326 | ||
327 | diff --git a/src/wireless-dialog.c b/src/wireless-dialog.c | |
328 | index 8a4bc03..d312744 100644 | |
329 | --- a/src/wireless-dialog.c | |
330 | +++ b/src/wireless-dialog.c | |
331 | @@ -1084,7 +1084,7 @@ internal_init (NMAWirelessDialog *self, | |
332 | gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (self))), 2); | |
333 | ||
334 | widget = gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); | |
335 | - gtk_box_set_child_packing (GTK_BOX (GTK_DIALOG (self)->action_area), widget, | |
336 | + gtk_box_set_child_packing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (self))), widget, | |
337 | FALSE, TRUE, 0, GTK_PACK_END); | |
338 | ||
339 | /* Connect/Create button */ | |
340 | @@ -1100,7 +1100,7 @@ internal_init (NMAWirelessDialog *self, | |
341 | } else | |
342 | widget = gtk_dialog_add_button (GTK_DIALOG (self), GTK_STOCK_CONNECT, GTK_RESPONSE_OK); | |
343 | ||
344 | - gtk_box_set_child_packing (GTK_BOX (GTK_DIALOG (self)->action_area), widget, | |
345 | + gtk_box_set_child_packing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (self))), widget, | |
346 | FALSE, TRUE, 0, GTK_PACK_END); | |
347 | g_object_set (G_OBJECT (widget), "can-default", TRUE, NULL); | |
348 | gtk_widget_grab_default (widget); | |
349 | -- | |
350 | cgit v0.8.3.1 | |
351 | From c3644402e9e3ade371bada2547e248cd2601e6a6 Mon Sep 17 00:00:00 2001 | |
352 | From: Martin Pitt <martin.pitt@ubuntu.com> | |
353 | Date: Fri, 01 Oct 2010 10:09:28 +0000 | |
354 | Subject: Drop deprecated gtk_dialog_set_has_separator() | |
355 | ||
356 | https://bugzilla.gnome.org/show_bug.cgi?id=631083 | |
357 | --- | |
358 | diff --git a/src/wireless-dialog.c b/src/wireless-dialog.c | |
359 | index 98b684c..621526f 100644 | |
360 | --- a/src/wireless-dialog.c | |
361 | +++ b/src/wireless-dialog.c | |
362 | @@ -1069,7 +1069,6 @@ internal_init (NMAWirelessDialog *self, | |
363 | gtk_container_set_border_width (GTK_CONTAINER (self), 6); | |
364 | gtk_window_set_default_size (GTK_WINDOW (self), 488, -1); | |
365 | gtk_window_set_resizable (GTK_WINDOW (self), FALSE); | |
366 | - gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE); | |
367 | ||
368 | priv->auth_only = auth_only; | |
369 | if (auth_only) | |
370 | -- | |
371 | cgit v0.8.3.1 |