~ubuntu-branches/ubuntu/oneiric/gnome-panel/oneiric

« back to all changes in this revision

Viewing changes to gnome-panel/nothing.cP

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-01-14 22:20:05 UTC
  • mto: (2.1.6 squeeze) (1.3.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 171.
  • Revision ID: james.westby@ubuntu.com-20100114222005-rll7tw9fojl3ac6z
Tags: upstream-2.29.5.1
ImportĀ upstreamĀ versionĀ 2.29.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#include <X11/Xlib.h>
6
6
#include <cairo.h>
7
7
#include <gdk/gdkkeysyms.h>
8
 
#include <libgnome/gnome-program.h>
9
 
#include <libgnome/gnome-sound.h>
 
8
#include <canberra-gtk.h>
 
9
 
 
10
#ifdef CA_CHECK_VERSION
 
11
#if CA_CHECK_VERSION(0, 13)
 
12
#define HAVE_CANBERRA_GTK_MULTIHEAD_SAFE
 
13
#endif
 
14
#endif
10
15
 
11
16
#include "panel-util.h"
12
17
#include "nothing.h"
46
51
static int goat_x = -1, goat_y = -1;
47
52
static int goat_accx = -1, goat_accy = -1;
48
53
 
49
 
static char *goat_filename = NULL;
50
 
 
51
54
static void
52
55
destroy_egg(GtkWidget *widget, gpointer data)
53
56
{
123
126
                sound = TRUE;
124
127
        }
125
128
 
126
 
        if (sound && goat_filename != NULL)
127
 
                gnome_sound_play (goat_filename);
 
129
        if (sound) {
 
130
#ifdef HAVE_CANBERRA_GTK_MULTIHEAD_SAFE
 
131
                ca_context_cancel (ca_gtk_context_get_for_screen (gtk_widget_get_screen (goat_darea)), 42);
 
132
#else
 
133
                ca_context_cancel (ca_gtk_context_get (), 42);
 
134
#endif
 
135
                ca_gtk_play_for_widget (goat_darea, 42,
 
136
                                        CA_PROP_EVENT_ID, "bell-window-system",
 
137
                                        CA_PROP_EVENT_DESCRIPTION, "Ouch! This box is small!",
 
138
                                        NULL);
 
139
        }
128
140
 
129
141
        real_goat_frame = goat_frame/2;
130
142
 
136
148
        cairo_paint (cr);
137
149
        
138
150
        gdk_cairo_set_source_pixmap (cr,
139
 
                                     goat_accx<0?goat_pix_rev[real_goat_frame]:
140
 
                                                 goat_pix[real_goat_frame],
 
151
                                     goat_accx<0?goat_pix[real_goat_frame]:
 
152
                                                 goat_pix_rev[real_goat_frame],
141
153
                                     goat_x,goat_y);
142
154
 
143
155
        cairo_paint (cr);
210
222
 
211
223
                goat_pix_rev[frame] = gdk_pixmap_new(widget->window,
212
224
                                                     width, height, -1);
213
 
                cr = gdk_cairo_create (goat_pix[frame]);
 
225
                cr = gdk_cairo_create (goat_pix_rev[frame]);
214
226
                gdk_cairo_set_source_pixbuf (cr, pb, 0, 0);
215
227
 
216
228
                cairo_matrix_init_identity (&matrix);
256
268
        clicks = 0;
257
269
        
258
270
        if(!goat_loaded) {
259
 
                if (goat_filename == NULL)
260
 
                        goat_filename =
261
 
                                gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_SOUND, 
262
 
                                                           /* FIXME "ricochet.wav", */
263
 
                                                           "gnometris/turn.wav",
264
 
                                                           TRUE /* only_if_exists */,
265
 
                                                           NULL /* ret_locations */);
266
 
 
267
271
                goat_darea = gtk_drawing_area_new();
268
272
 
269
273
                g_signal_connect (G_OBJECT(goat_darea),"destroy",