spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit bf139c96a9858c198dc2668edb554e564e20efde
parent 9f03626d27cfaf1cfa1f3bb4fd60e35d0e3a35f7
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Mon, 28 Mar 2011 14:15:36 +0800

Don't use API deprecated in GTK3

Diffstat:
Msrc/spek-preferences-dialog.vala | 1+
Msrc/spek-spectrogram.vala | 9++++++++-
Msrc/spek-window.vala | 2+-
3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/spek-preferences-dialog.vala b/src/spek-preferences-dialog.vala @@ -69,6 +69,7 @@ namespace Spek { box.pack_start (general_box, false, false, 0); alignment.add (box); + var vbox = (VBox) get_content_area (); vbox.pack_start (alignment, false, false, 0); vbox.show_all (); diff --git a/src/spek-spectrogram.vala b/src/spek-spectrogram.vala @@ -67,6 +67,8 @@ namespace Spek { } public void save (string file_name) { + Allocation allocation; + get_allocation (out allocation); var surface = new ImageSurface (Format.RGB24, allocation.width, allocation.height); draw (new Cairo.Context (surface)); surface.write_to_png (file_name); @@ -80,6 +82,8 @@ namespace Spek { // The number of samples is the number of pixels available for the image. // The number of bands is fixed, FFT results are very different for // different values but we need some consistency. + Allocation allocation; + get_allocation (out allocation); int samples = allocation.width - LPAD - RPAD; if (samples > 0) { image = new ImageSurface (Format.RGB24, samples, BANDS); @@ -117,7 +121,8 @@ namespace Spek { } protected override bool expose_event (EventExpose event) { - var cr = cairo_create (this.window); + var window = get_window (); + var cr = cairo_create (window); // Clip to the exposed area. cr.rectangle (event.area.x, event.area.y, event.area.width, event.area.height); @@ -128,6 +133,8 @@ namespace Spek { } private void draw (Cairo.Context cr) { + Allocation allocation; + get_allocation (out allocation); double w = allocation.width; double h = allocation.height; int text_width, text_height; diff --git a/src/spek-window.vala b/src/spek-window.vala @@ -131,7 +131,7 @@ namespace Spek { } void on_dropped (DragContext cx, int x, int y, SelectionData data, uint info, uint time) { - if (data.length > 0 && data.format == 8) { + if (data.get_length () > 0 && data.get_format () == 8) { string[] files = data.get_uris (); if (files.length > 0) { try {