updated on Sun Jan 15 08:01:04 UTC 2012
[aur-mirror.git] / netspeed-applet / 03_gtk3.patch
blobcc4ca26447d7e14f644ac182b7f44f5a5786bdf0
1 From f1ac39d327ef8f57a8d284a79bda9d37eb71f089 Mon Sep 17 00:00:00 2001
2 From: Carlos Garcia Campos <carlosgc@gnome.org>
3 Date: Wed, 16 Feb 2011 19:43:09 +0100
4 Subject: [PATCH 2/2] Port to GTK+ 3
6 ---
7 Makefile.am | 2 +-
8 configure.in | 4 +-
9 src/netspeed.c | 382 ++++++++++++++++++++++----------------------------------
10 3 files changed, 154 insertions(+), 234 deletions(-)
12 diff --git a/Makefile.am b/Makefile.am
13 index 2a7d33f..11a04ca 100644
14 --- a/Makefile.am
15 +++ b/Makefile.am
16 @@ -1,6 +1,6 @@
17 SUBDIRS = help icons po src
19 -appletdir = $(datadir)/gnome-panel/applets
20 +appletdir = $(LIBPANEL_APPLET_DIR)
21 applet_in_files = org.gnome.panel.Netspeed.panel-applet.in
22 applet_DATA = $(applet_in_files:.panel-applet.in=.panel-applet)
24 diff --git a/configure.in b/configure.in
25 index 0a8330b..b070de3 100644
26 --- a/configure.in
27 +++ b/configure.in
28 @@ -20,8 +20,10 @@ GETTEXT_PACKAGE=netspeed_applet
29 AC_SUBST(GETTEXT_PACKAGE)
30 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", GETTEXT_PACKAGE)
32 -PKG_CHECK_MODULES(NETSPEED, libpanelapplet-3.0 >= 2.32 libgtop-2.0 >= 2.14.2)
33 +PKG_CHECK_MODULES(NETSPEED, libpanelapplet-4.0 >= 2.32 libgtop-2.0 >= 2.14.2)
34 +LIBPANEL_APPLET_DIR=`$PKG_CONFIG --variable=libpanel_applet_dir libpanelapplet-4.0`
36 +AC_SUBST(LIBPANEL_APPLET_DIR)
37 AC_SUBST(NETSPEED_APPLET_CFLAGS)
38 AC_SUBST(NETSPEED_APPLET_LIBS)
40 diff --git a/src/netspeed.c b/src/netspeed.c
41 index 6371b65..8a41535 100644
42 --- a/src/netspeed.c
43 +++ b/src/netspeed.c
44 @@ -27,7 +27,6 @@
45 #include <glib/gi18n.h>
46 #include <panel-applet.h>
47 #include <panel-applet-gconf.h>
48 -#include <gconf/gconf-client.h>
49 #include "backend.h"
51 /* Icons for the interfaces */
52 @@ -119,21 +118,6 @@ update_tooltip(NetspeedApplet* applet);
53 static void
54 device_change_cb(GtkComboBox *combo, NetspeedApplet *applet);
56 -static gboolean
57 -open_uri (GtkWidget *parent, const char *url, GError **error)
59 - gboolean ret;
60 - char *cmdline;
61 - GdkScreen *screen;
63 - screen = gtk_widget_get_screen (parent);
64 - cmdline = g_strconcat ("xdg-open ", url, NULL);
65 - ret = gdk_spawn_command_line_on_screen (screen, cmdline, error);
66 - g_free (cmdline);
68 - return ret;
71 /* Adds a Pango markup "size" to a bytestring
73 static void
74 @@ -169,12 +153,12 @@ applet_change_size_or_orient(PanelApplet *applet_widget, int arg1, NetspeedApple
75 size = panel_applet_get_size(applet_widget);
76 orient = panel_applet_get_orient(applet_widget);
78 - gtk_widget_ref(applet->pix_box);
79 - gtk_widget_ref(applet->in_pix);
80 - gtk_widget_ref(applet->in_label);
81 - gtk_widget_ref(applet->out_pix);
82 - gtk_widget_ref(applet->out_label);
83 - gtk_widget_ref(applet->sum_label);
84 + g_object_ref(applet->pix_box);
85 + g_object_ref(applet->in_pix);
86 + g_object_ref(applet->in_label);
87 + g_object_ref(applet->out_pix);
88 + g_object_ref(applet->out_label);
89 + g_object_ref(applet->sum_label);
91 if (applet->in_box) {
92 gtk_container_remove(GTK_CONTAINER(applet->in_box), applet->in_label);
93 @@ -228,12 +212,12 @@ applet_change_size_or_orient(PanelApplet *applet_widget, int arg1, NetspeedApple
94 gtk_box_pack_start(GTK_BOX(applet->sum_box), applet->sum_label, TRUE, TRUE, 0);
95 gtk_box_pack_start(GTK_BOX(applet->box), applet->pix_box, FALSE, FALSE, 0);
97 - gtk_widget_unref(applet->pix_box);
98 - gtk_widget_unref(applet->in_pix);
99 - gtk_widget_unref(applet->in_label);
100 - gtk_widget_unref(applet->out_pix);
101 - gtk_widget_unref(applet->out_label);
102 - gtk_widget_unref(applet->sum_label);
103 + g_object_unref(applet->pix_box);
104 + g_object_unref(applet->in_pix);
105 + g_object_unref(applet->in_label);
106 + g_object_unref(applet->out_pix);
107 + g_object_unref(applet->out_label);
108 + g_object_unref(applet->sum_label);
110 if (applet->show_sum) {
111 gtk_box_pack_start(GTK_BOX(applet->box), applet->sum_box, TRUE, TRUE, 0);
112 @@ -246,41 +230,6 @@ applet_change_size_or_orient(PanelApplet *applet_widget, int arg1, NetspeedApple
113 gtk_container_add(GTK_CONTAINER(applet->applet), applet->box);
116 -/* Change the background of the applet according to
117 - * the panel background.
118 - */
119 -static void
120 -change_background_cb(PanelApplet *applet_widget,
121 - PanelAppletBackgroundType type,
122 - GdkColor *color, GdkPixmap *pixmap,
123 - NetspeedApplet *applet)
125 - GtkStyle *style;
126 - GtkRcStyle *rc_style = gtk_rc_style_new ();
127 - gtk_widget_set_style (GTK_WIDGET (applet_widget), NULL);
128 - gtk_widget_modify_style (GTK_WIDGET (applet_widget), rc_style);
129 - gtk_rc_style_unref (rc_style);
131 - switch (type) {
132 - case PANEL_PIXMAP_BACKGROUND:
133 - style = gtk_style_copy (GTK_WIDGET (applet_widget)->style);
134 - if(style->bg_pixmap[GTK_STATE_NORMAL])
135 - g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]);
136 - style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap);
137 - gtk_widget_set_style (GTK_WIDGET(applet_widget), style);
138 - g_object_unref (style);
139 - break;
141 - case PANEL_COLOR_BACKGROUND:
142 - gtk_widget_modify_bg(GTK_WIDGET(applet_widget), GTK_STATE_NORMAL, color);
143 - break;
145 - case PANEL_NO_BACKGROUND:
146 - break;
151 /* Change the icons according to the selected device
153 static void
154 @@ -316,8 +265,8 @@ change_icons(NetspeedApplet *applet)
156 gtk_image_set_from_pixbuf(GTK_IMAGE(applet->out_pix), out_arrow);
157 gtk_image_set_from_pixbuf(GTK_IMAGE(applet->in_pix), in_arrow);
158 - gdk_pixbuf_unref(in_arrow);
159 - gdk_pixbuf_unref(out_arrow);
160 + g_object_unref(in_arrow);
161 + g_object_unref(out_arrow);
163 if (applet->devinfo.running) {
164 gtk_widget_show(applet->in_box);
165 @@ -429,100 +378,6 @@ bytes_to_string(double bytes, gboolean per_sec, gboolean bits)
166 return g_strdup_printf(format, bytes, gettext(unit));
170 -/* Redraws the graph drawingarea
171 - * Some really black magic is going on in here ;-)
172 - */
173 -static void
174 -redraw_graph(NetspeedApplet *applet)
176 - GdkGC *gc;
177 - GdkColor color;
178 - GtkWidget *da = GTK_WIDGET(applet->drawingarea);
179 - GdkWindow *window, *real_window = da->window;
180 - GdkRectangle ra;
181 - GtkStateType state;
182 - GdkPoint in_points[GRAPH_VALUES], out_points[GRAPH_VALUES];
183 - PangoLayout *layout;
184 - PangoRectangle logical_rect;
185 - char *text;
186 - int i, offset, w, h;
187 - double max_val;
189 - gc = gdk_gc_new (real_window);
190 - gdk_drawable_get_size(real_window, &w, &h);
192 - /* use doublebuffering to avoid flickering */
193 - window = gdk_pixmap_new(real_window, w, h, -1);
195 - /* the graph hight should be: hight/2 <= applet->max_graph < hight */
196 - for (max_val = 1; max_val < applet->max_graph; max_val *= 2) ;
198 - /* calculate the polygons (GdkPoint[]) for the graphs */
199 - offset = 0;
200 - for (i = (applet->index_graph + 1) % GRAPH_VALUES; applet->in_graph[i] < 0; i = (i + 1) % GRAPH_VALUES)
201 - offset++;
202 - for (i = offset + 1; i < GRAPH_VALUES; i++)
204 - int index = (applet->index_graph + i) % GRAPH_VALUES;
205 - out_points[i].x = in_points[i].x = ((w - 6) * i) / GRAPH_VALUES + 4;
206 - in_points[i].y = h - 6 - (int)((h - 8) * applet->in_graph[index] / max_val);
207 - out_points[i].y = h - 6 - (int)((h - 8) * applet->out_graph[index] / max_val);
208 - }
209 - in_points[offset].x = out_points[offset].x = ((w - 6) * offset) / GRAPH_VALUES + 4;
210 - in_points[offset].y = in_points[(offset + 1) % GRAPH_VALUES].y;
211 - out_points[offset].y = out_points[(offset + 1) % GRAPH_VALUES].y;
213 - /* draw the background */
214 - gdk_gc_set_rgb_fg_color (gc, &da->style->black);
215 - gdk_draw_rectangle (window, gc, TRUE, 0, 0, w, h);
217 - color.red = 0x3a00; color.green = 0x8000; color.blue = 0x1400;
218 - gdk_gc_set_rgb_fg_color(gc, &color);
219 - gdk_draw_rectangle (window, gc, FALSE, 2, 2, w - 6, h - 6);
221 - for (i = 0; i < GRAPH_LINES; i++) {
222 - int y = 2 + ((h - 6) * i) / GRAPH_LINES;
223 - gdk_draw_line(window, gc, 2, y, w - 4, y);
226 - /* draw the polygons */
227 - gdk_gc_set_line_attributes(gc, 2, GDK_LINE_SOLID, GDK_CAP_ROUND, GDK_JOIN_ROUND);
228 - gdk_gc_set_rgb_fg_color(gc, &applet->in_color);
229 - gdk_draw_lines(window, gc, in_points + offset, GRAPH_VALUES - offset);
230 - gdk_gc_set_rgb_fg_color(gc, &applet->out_color);
231 - gdk_draw_lines(window, gc, out_points + offset, GRAPH_VALUES - offset);
233 - /* draw the 2 labels */
234 - state = GTK_STATE_NORMAL;
235 - ra.x = 0; ra.y = 0;
236 - ra.width = w; ra.height = h;
238 - text = bytes_to_string(max_val, TRUE, applet->show_bits);
239 - add_markup_fgcolor(&text, "white");
240 - layout = gtk_widget_create_pango_layout (da, NULL);
241 - pango_layout_set_markup(layout, text, -1);
242 - g_free (text);
243 - gtk_paint_layout(da->style, window, state, FALSE, &ra, da, "max_graph", 3, 2, layout);
244 - g_object_unref(G_OBJECT(layout));
246 - text = bytes_to_string(0.0, TRUE, applet->show_bits);
247 - add_markup_fgcolor(&text, "white");
248 - layout = gtk_widget_create_pango_layout (da, NULL);
249 - pango_layout_set_markup(layout, text, -1);
250 - pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
251 - g_free (text);
252 - gtk_paint_layout(da->style, window, state, FALSE, &ra, da, "max_graph", 3, h - 4 - logical_rect.height, layout);
253 - g_object_unref(G_OBJECT(layout));
255 - /* draw the pixmap to the real window */
256 - gdk_draw_drawable(real_window, gc, window, 0, 0, 0, 0, w, h);
258 - g_object_unref(G_OBJECT(gc));
259 - g_object_unref(G_OBJECT(window));
263 static gboolean
264 set_applet_devinfo(NetspeedApplet* applet, const char* iface)
266 @@ -680,8 +535,8 @@ update_applet(NetspeedApplet *applet)
268 /* Redraw the graph of the Infodialog */
269 if (applet->drawingarea)
270 - redraw_graph(applet);
272 + gtk_widget_queue_draw (GTK_WIDGET (applet->drawingarea));
274 /* Save old values... */
275 applet->in_old[applet->index_old] = applet->devinfo.rx;
276 applet->out_old[applet->index_old] = applet->devinfo.tx;
277 @@ -742,7 +597,7 @@ display_help (GtkWidget *dialog, const gchar *section)
278 else
279 uri = g_strdup ("ghelp:netspeed_applet");
281 - ret = open_uri (dialog, uri, &error);
282 + ret = gtk_show_uri (gtk_widget_get_screen (dialog), uri, GDK_CURRENT_TIME, &error);
283 g_free (uri);
284 if (ret == FALSE) {
285 GtkWidget *error_dialog = gtk_message_dialog_new (NULL,
286 @@ -769,45 +624,6 @@ help_cb (GtkAction *action, NetspeedApplet *ap)
287 display_help (GTK_WIDGET (ap->applet), NULL);
290 -enum {
291 - LINK_TYPE_EMAIL,
292 - LINK_TYPE_URL
295 -/* handle the links of the about dialog */
296 -static void
297 -handle_links (GtkAboutDialog *about, const gchar *link, gpointer data)
299 - gchar *new_link;
300 - GError *error = NULL;
301 - gboolean ret;
302 - GtkWidget *dialog;
304 - switch (GPOINTER_TO_INT (data)){
305 - case LINK_TYPE_EMAIL:
306 - new_link = g_strdup_printf ("mailto:%s", link);
307 - break;
308 - case LINK_TYPE_URL:
309 - new_link = g_strdup (link);
310 - break;
311 - default:
312 - g_assert_not_reached ();
315 - ret = open_uri (GTK_WIDGET (about), new_link, &error);
317 - if (ret == FALSE) {
318 - dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
319 - GTK_DIALOG_DESTROY_WITH_PARENT,
320 - GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
321 - _("Failed to show:\n%s"), new_link);
322 - gtk_dialog_run (GTK_DIALOG (dialog));
323 - gtk_widget_destroy (dialog);
324 - g_error_free(error);
326 - g_free (new_link);
329 /* Just the about window... If it's already open, just fokus it
331 static void
332 @@ -821,13 +637,7 @@ about_cb(GtkAction *action, gpointer data)
333 "Benoît Dejean <benoit@placenet.org>",
334 NULL
337 - gtk_about_dialog_set_email_hook ((GtkAboutDialogActivateLinkFunc) handle_links,
338 - GINT_TO_POINTER (LINK_TYPE_EMAIL), NULL);
340 - gtk_about_dialog_set_url_hook ((GtkAboutDialogActivateLinkFunc) handle_links,
341 - GINT_TO_POINTER (LINK_TYPE_URL), NULL);
344 gtk_show_about_dialog (NULL,
345 "version", VERSION,
346 "copyright", "Copyright 2002 - 2010 Jörgen Scheibengruber",
347 @@ -945,6 +755,7 @@ settings_cb(GtkAction *action, gpointer data)
348 GtkWidget *show_sum_checkbutton;
349 GtkWidget *show_bits_checkbutton;
350 GtkWidget *change_icon_checkbutton;
351 + GtkWidget *dialog_vbox;
352 GtkSizeGroup *category_label_size_group;
353 GtkSizeGroup *category_units_size_group;
354 gchar *header_str;
355 @@ -964,8 +775,7 @@ settings_cb(GtkAction *action, gpointer data)
357 applet->settings = GTK_DIALOG(gtk_dialog_new_with_buttons(_("Netspeed Preferences"),
358 NULL,
359 - GTK_DIALOG_DESTROY_WITH_PARENT |
360 - GTK_DIALOG_NO_SEPARATOR,
361 + GTK_DIALOG_DESTROY_WITH_PARENT,
362 GTK_STOCK_HELP, GTK_RESPONSE_HELP,
363 GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
364 NULL));
365 @@ -1012,15 +822,15 @@ settings_cb(GtkAction *action, gpointer data)
366 gtk_size_group_add_widget(category_label_size_group, network_device_label);
367 gtk_box_pack_start(GTK_BOX (network_device_hbox), network_device_label, FALSE, FALSE, 0);
369 - applet->network_device_combo = gtk_combo_box_new_text();
370 + applet->network_device_combo = gtk_combo_box_text_new();
371 gtk_label_set_mnemonic_widget(GTK_LABEL(network_device_label), applet->network_device_combo);
372 gtk_box_pack_start (GTK_BOX (network_device_hbox), applet->network_device_combo, TRUE, TRUE, 0);
374 /* Default means device with default route set */
375 - gtk_combo_box_append_text(GTK_COMBO_BOX(applet->network_device_combo), _("Default"));
376 + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(applet->network_device_combo), _("Default"));
377 ptr = devices = get_available_devices();
378 for (i = 1; ptr; ptr = g_list_next(ptr)) {
379 - gtk_combo_box_append_text(GTK_COMBO_BOX(applet->network_device_combo), ptr->data);
380 + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(applet->network_device_combo), ptr->data);
381 if (g_str_equal(ptr->data, applet->devinfo.name)) active = i;
382 ++i;
384 @@ -1057,20 +867,130 @@ settings_cb(GtkAction *action, gpointer data)
385 g_signal_connect(G_OBJECT (applet->settings), "response",
386 G_CALLBACK(pref_response_cb), (gpointer)applet);
388 - gtk_container_add(GTK_CONTAINER(applet->settings->vbox), vbox);
389 + dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (applet->settings));
390 + gtk_container_add(GTK_CONTAINER(dialog_vbox), vbox);
392 gtk_widget_show_all(GTK_WIDGET(applet->settings));
395 +/* Redraws the graph drawingarea
396 + * Some really black magic is going on in here ;-)
397 + */
398 static gboolean
399 -da_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
400 +da_draw(GtkWidget *widget, cairo_t *cr, gpointer data)
402 NetspeedApplet *applet = (NetspeedApplet*)data;
404 - redraw_graph(applet);
406 + GtkStyleContext *context;
407 + GtkStateFlags state;
408 + GdkWindow *window;
409 + GdkPoint in_points[GRAPH_VALUES], out_points[GRAPH_VALUES];
410 + PangoLayout *layout;
411 + PangoRectangle logical_rect;
412 + GdkColor color;
413 + char *text;
414 + gint width, height;
415 + int i, offset;
416 + double max_val;
417 + cairo_surface_t *surface;
418 + cairo_t *tmp_cr;
420 + state = gtk_widget_get_state_flags (widget);
421 + context = gtk_widget_get_style_context (widget);
422 + gtk_style_context_save (context);
424 + gtk_style_context_set_state (context, state);
426 + window = gtk_widget_get_window (widget);
427 + width = gtk_widget_get_allocated_width (widget);
428 + height = gtk_widget_get_allocated_height (widget);
430 + /* use doublebuffering to avoid flickering */
431 + surface = gdk_window_create_similar_surface (window, CAIRO_CONTENT_COLOR, width, height);
433 + tmp_cr = cairo_create (surface);
435 + /* the graph hight should be: hight/2 <= applet->max_graph < hight */
436 + for (max_val = 1; max_val < applet->max_graph; max_val *= 2) ;
438 + /* calculate the polygons (GdkPoint[]) for the graphs */
439 + offset = 0;
440 + for (i = (applet->index_graph + 1) % GRAPH_VALUES; applet->in_graph[i] < 0; i = (i + 1) % GRAPH_VALUES)
441 + offset++;
442 + for (i = offset + 1; i < GRAPH_VALUES; i++)
444 + int index = (applet->index_graph + i) % GRAPH_VALUES;
445 + out_points[i].x = in_points[i].x = ((width - 6) * i) / GRAPH_VALUES + 4;
446 + in_points[i].y = height - 6 - (int)((height - 8) * applet->in_graph[index] / max_val);
447 + out_points[i].y = height - 6 - (int)((height - 8) * applet->out_graph[index] / max_val);
449 + in_points[offset].x = out_points[offset].x = ((width - 6) * offset) / GRAPH_VALUES + 4;
450 + in_points[offset].y = in_points[(offset + 1) % GRAPH_VALUES].y;
451 + out_points[offset].y = out_points[(offset + 1) % GRAPH_VALUES].y;
453 + /* draw the background */
454 + cairo_set_source_rgb (tmp_cr, 0., 0., 0.);
455 + cairo_rectangle (tmp_cr, 0, 0, width, height);
456 + cairo_fill (tmp_cr);
458 + cairo_set_line_width (tmp_cr, 1.);
459 + color.red = 0x3a00; color.green = 0x8000; color.blue = 0x1400;
460 + gdk_cairo_set_source_color (tmp_cr, &color);
461 + cairo_rectangle (tmp_cr, 2.5, 2.5, width - 6.5, height - 6.5);
462 + cairo_stroke (tmp_cr);
464 + for (i = 0; i < GRAPH_LINES; i++) {
465 + int y = 2 + ((height - 6) * i) / GRAPH_LINES;
466 + cairo_move_to (tmp_cr, 2.5, y + 0.5);
467 + cairo_line_to (tmp_cr, width - 4.5, y - 0.5);
468 + cairo_stroke (tmp_cr);
471 + /* draw the polygons */
472 + cairo_set_line_width (tmp_cr, 2.);
473 + cairo_set_line_join (tmp_cr, CAIRO_LINE_JOIN_ROUND);
474 + cairo_set_line_cap (tmp_cr, CAIRO_LINE_CAP_ROUND);
476 + gdk_cairo_set_source_color (tmp_cr, &applet->in_color);
477 + cairo_move_to (tmp_cr, in_points[offset].x, in_points[offset].y);
478 + for (i = offset + 1; i < GRAPH_VALUES; i++)
479 + cairo_line_to (tmp_cr, in_points[i].x, in_points[i].y);
480 + cairo_stroke (tmp_cr);
482 + gdk_cairo_set_source_color (tmp_cr, &applet->out_color);
483 + cairo_move_to (tmp_cr, out_points[offset].x, out_points[offset].y);
484 + for (i = offset + 1; i < GRAPH_VALUES; i++)
485 + cairo_line_to (tmp_cr, out_points[i].x, out_points[i].y);
486 + cairo_stroke (tmp_cr);
488 + /* draw the 2 labels */
489 + gtk_style_context_set_state (context, GTK_STATE_FLAG_NORMAL);
491 + text = bytes_to_string(max_val, TRUE, applet->show_bits);
492 + add_markup_fgcolor(&text, "white");
493 + layout = gtk_widget_create_pango_layout (widget, NULL);
494 + pango_layout_set_markup(layout, text, -1);
495 + g_free (text);
496 + gtk_render_layout (context, tmp_cr, 3, 2, layout);
497 + g_object_unref(G_OBJECT(layout));
499 + text = bytes_to_string(0.0, TRUE, applet->show_bits);
500 + add_markup_fgcolor(&text, "white");
501 + layout = gtk_widget_create_pango_layout (widget, NULL);
502 + pango_layout_set_markup(layout, text, -1);
503 + pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
504 + g_free (text);
505 + gtk_render_layout (context, tmp_cr, 3, height - 4 - logical_rect.height, layout);
506 + g_object_unref(G_OBJECT(layout));
508 + cairo_destroy (tmp_cr);
510 + /* draw the surface to the real window */
511 + cairo_set_source_surface (cr, surface, 0, 0);
512 + cairo_paint (cr);
513 + cairo_surface_destroy (surface);
515 return FALSE;
519 static void
520 incolor_changed_cb (GtkColorButton *cb, gpointer data)
521 @@ -1139,6 +1059,7 @@ showinfo_cb(GtkAction *action, gpointer data)
522 GtkWidget *inbytes_label, *outbytes_label;
523 GtkWidget *incolor_sel, *incolor_label;
524 GtkWidget *outcolor_sel, *outcolor_label;
525 + GtkWidget *dialog_vbox;
526 char *title;
528 g_assert(applet);
529 @@ -1152,8 +1073,7 @@ showinfo_cb(GtkAction *action, gpointer data)
530 title = g_strdup_printf(_("Device Details for %s"), applet->devinfo.name);
531 applet->details = GTK_DIALOG(gtk_dialog_new_with_buttons(title,
532 NULL,
533 - GTK_DIALOG_DESTROY_WITH_PARENT |
534 - GTK_DIALOG_NO_SEPARATOR,
535 + GTK_DIALOG_DESTROY_WITH_PARENT,
536 GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT,
537 GTK_STOCK_HELP, GTK_RESPONSE_HELP,
538 NULL));
539 @@ -1289,26 +1209,27 @@ showinfo_cb(GtkAction *action, gpointer data)
540 gtk_table_attach_defaults (GTK_TABLE (table), essid_text, 1, 4, 4, 5);
543 - g_signal_connect(G_OBJECT(applet->drawingarea), "expose_event",
544 - GTK_SIGNAL_FUNC(da_expose_event),
545 + g_signal_connect(applet->drawingarea, "draw",
546 + G_CALLBACK(da_draw),
547 (gpointer)applet);
549 - g_signal_connect(G_OBJECT(incolor_sel), "color_set",
550 + g_signal_connect(incolor_sel, "color_set",
551 G_CALLBACK(incolor_changed_cb),
552 (gpointer)applet);
554 - g_signal_connect(G_OBJECT(outcolor_sel), "color_set",
555 + g_signal_connect(outcolor_sel, "color_set",
556 G_CALLBACK(outcolor_changed_cb),
557 (gpointer)applet);
559 - g_signal_connect(G_OBJECT(applet->details), "response",
560 + g_signal_connect(applet->details, "response",
561 G_CALLBACK(info_response_cb), (gpointer)applet);
563 gtk_box_pack_start(GTK_BOX(box), da_frame, TRUE, TRUE, 0);
564 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0);
565 gtk_box_pack_start(GTK_BOX(box), table, FALSE, FALSE, 0);
567 - gtk_container_add(GTK_CONTAINER(applet->details->vbox), box);
568 + dialog_vbox = gtk_dialog_get_content_area (GTK_DIALOG (applet->details));
569 + gtk_container_add(GTK_CONTAINER(dialog_vbox), box);
570 gtk_widget_show_all(GTK_WIDGET(applet->details));
573 @@ -1639,7 +1560,7 @@ netspeed_applet_factory(PanelApplet *applet_widget, const gchar *iid, gpointer d
574 panel_applet_set_flags(applet_widget, PANEL_APPLET_EXPAND_MINOR);
576 applet->timeout_id = g_timeout_add(applet->refresh_time,
577 - (GtkFunction)timeout_function,
578 + (GSourceFunc)timeout_function,
579 (gpointer)applet);
581 g_signal_connect(G_OBJECT(applet_widget), "change_size",
582 @@ -1654,10 +1575,6 @@ netspeed_applet_factory(PanelApplet *applet_widget, const gchar *iid, gpointer d
583 G_CALLBACK(applet_change_size_or_orient),
584 (gpointer)applet);
586 - g_signal_connect(G_OBJECT(applet_widget), "change_background",
587 - G_CALLBACK(change_background_cb),
588 - (gpointer)applet);
590 g_signal_connect(G_OBJECT(applet->in_label), "size_request",
591 G_CALLBACK(label_size_request_cb),
592 (gpointer)applet);
593 @@ -1686,6 +1603,7 @@ netspeed_applet_factory(PanelApplet *applet_widget, const gchar *iid, gpointer d
594 G_CALLBACK(netspeed_enter_cb),
595 (gpointer)applet);
597 + panel_applet_set_background_widget (applet_widget, GTK_WIDGET (applet_widget));
599 action_group = gtk_action_group_new("Netspeed Applet Actions");
600 gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
602 1.7.1