Mercurial > pidgin.yaz
comparison src/applet.c @ 3256:a7c241854218
[gaim-migrate @ 3274]
Fixed an applet memory leak. Serves me right for not reading the documentation.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Thu, 16 May 2002 22:46:42 +0000 |
parents | 01279615a5fe |
children | 51e55584b71e |
comparison
equal
deleted
inserted
replaced
3255:bea080f7f5c7 | 3256:a7c241854218 |
---|---|
70 return NULL; | 70 return NULL; |
71 cache = gdk_pixmap_new(applet->window, sizehint, sizehint, | 71 cache = gdk_pixmap_new(applet->window, sizehint, sizehint, |
72 gtk_widget_get_visual(applet)->depth); | 72 gtk_widget_get_visual(applet)->depth); |
73 gc = gdk_gc_new(cache); | 73 gc = gdk_gc_new(cache); |
74 gdk_gc_copy(gc, applet->style->bg_gc[GTK_WIDGET_STATE(applet)]); | 74 gdk_gc_copy(gc, applet->style->bg_gc[GTK_WIDGET_STATE(applet)]); |
75 | |
76 path = gnome_pixmap_file(name); | 75 path = gnome_pixmap_file(name); |
77 if (path) | 76 if (path) { |
78 scale = gdk_pixbuf_new_from_file(path); | 77 scale = gdk_pixbuf_new_from_file(path); |
79 g_free(path); | 78 g_free(path); |
79 } | |
80 if (!scale) | 80 if (!scale) |
81 return NULL; | 81 return NULL; |
82 pb = gdk_pixbuf_scale_simple(scale, sizehint, sizehint, GDK_INTERP_HYPER); | 82 pb = gdk_pixbuf_scale_simple(scale, sizehint, sizehint, GDK_INTERP_HYPER); |
83 gdk_pixbuf_unref(scale); | 83 gdk_pixbuf_unref(scale); |
84 | 84 |
85 dst = g_new0(guchar, sizehint*sizehint*3); | 85 applet_widget_get_rgb_bg(APPLET_WIDGET(applet), &dst, &w, &h, &rowstride); |
86 applet_widget_get_rgb_bg(applet, &dst, &w, &h, &rowstride); | |
87 | 86 |
88 art_affine_identity(affine); | 87 art_affine_identity(affine); |
89 art_rgb_rgba_affine(dst, 0, 0, w, h, rowstride, | 88 art_rgb_rgba_affine(dst, 0, 0, w, h, rowstride, |
90 gdk_pixbuf_get_pixels(pb), gdk_pixbuf_get_width(pb), | 89 gdk_pixbuf_get_pixels(pb), gdk_pixbuf_get_width(pb), |
91 gdk_pixbuf_get_height(pb), gdk_pixbuf_get_rowstride(pb), | 90 gdk_pixbuf_get_height(pb), gdk_pixbuf_get_rowstride(pb), |
333 applet_widget_init("Gaim", VERSION, argc, argv, NULL, 0, NULL); | 332 applet_widget_init("Gaim", VERSION, argc, argv, NULL, 0, NULL); |
334 | 333 |
335 applet = applet_widget_new("gaim_applet"); | 334 applet = applet_widget_new("gaim_applet"); |
336 if (!applet) | 335 if (!applet) |
337 g_error(_("Can't create Gaim applet!")); | 336 g_error(_("Can't create Gaim applet!")); |
338 applet_widget_send_draw(applet, TRUE); | |
339 gtk_signal_connect(GTK_OBJECT(applet), "do-draw", GTK_SIGNAL_FUNC(update_applet), NULL); | |
340 gtk_widget_set_events(applet, gtk_widget_get_events(applet) | GDK_BUTTON_PRESS_MASK); | 337 gtk_widget_set_events(applet, gtk_widget_get_events(applet) | GDK_BUTTON_PRESS_MASK); |
341 gtk_widget_realize(applet); | 338 gtk_widget_realize(applet); |
342 | 339 |
343 pm = get_applet_icon(GAIM_GNOME_OFFLINE_ICON); | 340 pm = get_applet_icon(GAIM_GNOME_OFFLINE_ICON); |
344 if (!pm) | 341 if (!pm) |
366 #ifdef HAVE_PANEL_PIXEL_SIZE | 363 #ifdef HAVE_PANEL_PIXEL_SIZE |
367 gtk_signal_connect(GTK_OBJECT(applet), "change_pixel_size", | 364 gtk_signal_connect(GTK_OBJECT(applet), "change_pixel_size", |
368 GTK_SIGNAL_FUNC(applet_change_pixel_size), NULL); | 365 GTK_SIGNAL_FUNC(applet_change_pixel_size), NULL); |
369 #endif | 366 #endif |
370 | 367 |
368 applet_widget_send_draw(applet, TRUE); | |
369 gtk_signal_connect(GTK_OBJECT(applet), "do-draw", GTK_SIGNAL_FUNC(update_applet), NULL); | |
371 gtk_widget_show(icon); | 370 gtk_widget_show(icon); |
372 gtk_widget_show(applet); | 371 gtk_widget_show(applet); |
373 return 0; | 372 return 0; |
374 } | 373 } |
375 | 374 |