comparison pidgin/gtksound.c @ 15500:d75099d2567e

gaim_gtk to pidgin. I hope
author Sean Egan <seanegan@gmail.com>
date Sat, 03 Feb 2007 07:23:11 +0000
parents 5fe8042783c1
children 535f002e7b0f
comparison
equal deleted inserted replaced
15499:45ecefd0ce3a 15500:d75099d2567e
114 play_conv_event(GaimConversation *conv, GaimSoundEventID event) 114 play_conv_event(GaimConversation *conv, GaimSoundEventID event)
115 { 115 {
116 /* If we should not play the sound for some reason, then exit early */ 116 /* If we should not play the sound for some reason, then exit early */
117 if (conv != NULL) 117 if (conv != NULL)
118 { 118 {
119 GaimGtkConversation *gtkconv; 119 PidginConversation *gtkconv;
120 GaimGtkWindow *win; 120 PidginWindow *win;
121 gboolean has_focus; 121 gboolean has_focus;
122 122
123 gtkconv = GAIM_GTK_CONVERSATION(conv); 123 gtkconv = PIDGIN_CONVERSATION(conv);
124 win = gtkconv->win; 124 win = gtkconv->win;
125 125
126 has_focus = gaim_conversation_has_focus(conv); 126 has_focus = gaim_conversation_has_focus(conv);
127 127
128 if (!gtkconv->make_sound || 128 if (!gtkconv->make_sound ||
232 mute_login_sounds = TRUE; 232 mute_login_sounds = TRUE;
233 mute_login_sounds_timeout = gaim_timeout_add(10000, unmute_login_sounds_cb, NULL); 233 mute_login_sounds_timeout = gaim_timeout_add(10000, unmute_login_sounds_cb, NULL);
234 } 234 }
235 235
236 const char * 236 const char *
237 gaim_gtk_sound_get_event_option(GaimSoundEventID event) 237 pidgin_sound_get_event_option(GaimSoundEventID event)
238 { 238 {
239 if(event >= GAIM_NUM_SOUNDS) 239 if(event >= GAIM_NUM_SOUNDS)
240 return 0; 240 return 0;
241 241
242 return sounds[event].pref; 242 return sounds[event].pref;
243 } 243 }
244 244
245 const char * 245 const char *
246 gaim_gtk_sound_get_event_label(GaimSoundEventID event) 246 pidgin_sound_get_event_label(GaimSoundEventID event)
247 { 247 {
248 if(event >= GAIM_NUM_SOUNDS) 248 if(event >= GAIM_NUM_SOUNDS)
249 return NULL; 249 return NULL;
250 250
251 return sounds[event].label; 251 return sounds[event].label;
252 } 252 }
253 253
254 void * 254 void *
255 gaim_gtk_sound_get_handle() 255 pidgin_sound_get_handle()
256 { 256 {
257 static int handle; 257 static int handle;
258 258
259 return &handle; 259 return &handle;
260 } 260 }
261 261
262 static void 262 static void
263 gaim_gtk_sound_init(void) 263 pidgin_sound_init(void)
264 { 264 {
265 void *gtk_sound_handle = gaim_gtk_sound_get_handle(); 265 void *gtk_sound_handle = pidgin_sound_get_handle();
266 void *blist_handle = gaim_blist_get_handle(); 266 void *blist_handle = gaim_blist_get_handle();
267 void *conv_handle = gaim_conversations_get_handle(); 267 void *conv_handle = gaim_conversations_get_handle();
268 #ifdef USE_GSTREAMER 268 #ifdef USE_GSTREAMER
269 GError *error = NULL; 269 GError *error = NULL;
270 #endif 270 #endif
342 gtk_sound_handle, GAIM_CALLBACK(chat_msg_received_cb), 342 gtk_sound_handle, GAIM_CALLBACK(chat_msg_received_cb),
343 GINT_TO_POINTER(GAIM_SOUND_CHAT_SAY)); 343 GINT_TO_POINTER(GAIM_SOUND_CHAT_SAY));
344 } 344 }
345 345
346 static void 346 static void
347 gaim_gtk_sound_uninit(void) 347 pidgin_sound_uninit(void)
348 { 348 {
349 #ifdef USE_GSTREAMER 349 #ifdef USE_GSTREAMER
350 if (!gst_init_failed) 350 if (!gst_init_failed)
351 gst_deinit(); 351 gst_deinit();
352 #endif 352 #endif
353 353
354 gaim_signals_disconnect_by_handle(gaim_gtk_sound_get_handle()); 354 gaim_signals_disconnect_by_handle(pidgin_sound_get_handle());
355 } 355 }
356 356
357 #ifdef USE_GSTREAMER 357 #ifdef USE_GSTREAMER
358 static gboolean 358 static gboolean
359 bus_call (GstBus *bus, 359 bus_call (GstBus *bus,
384 return TRUE; 384 return TRUE;
385 } 385 }
386 #endif 386 #endif
387 387
388 static void 388 static void
389 gaim_gtk_sound_play_file(const char *filename) 389 pidgin_sound_play_file(const char *filename)
390 { 390 {
391 const char *method; 391 const char *method;
392 #ifdef USE_GSTREAMER 392 #ifdef USE_GSTREAMER
393 float volume; 393 float volume;
394 char *uri; 394 char *uri;
506 } 506 }
507 #endif /* _WIN32 */ 507 #endif /* _WIN32 */
508 } 508 }
509 509
510 static void 510 static void
511 gaim_gtk_sound_play_event(GaimSoundEventID event) 511 pidgin_sound_play_event(GaimSoundEventID event)
512 { 512 {
513 char *enable_pref; 513 char *enable_pref;
514 char *file_pref; 514 char *file_pref;
515 515
516 if ((event == GAIM_SOUND_BUDDY_ARRIVE) && mute_login_sounds) 516 if ((event == GAIM_SOUND_BUDDY_ARRIVE) && mute_login_sounds)
541 g_free(file_pref); 541 g_free(file_pref);
542 } 542 }
543 543
544 static GaimSoundUiOps sound_ui_ops = 544 static GaimSoundUiOps sound_ui_ops =
545 { 545 {
546 gaim_gtk_sound_init, 546 pidgin_sound_init,
547 gaim_gtk_sound_uninit, 547 pidgin_sound_uninit,
548 gaim_gtk_sound_play_file, 548 pidgin_sound_play_file,
549 gaim_gtk_sound_play_event 549 pidgin_sound_play_event
550 }; 550 };
551 551
552 GaimSoundUiOps * 552 GaimSoundUiOps *
553 gaim_gtk_sound_get_ui_ops(void) 553 pidgin_sound_get_ui_ops(void)
554 { 554 {
555 return &sound_ui_ops; 555 return &sound_ui_ops;
556 } 556 }