~ubuntu-branches/ubuntu/quantal/pidgin/quantal

« back to all changes in this revision

Viewing changes to finch/gntsound.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-08-11 14:16:15 UTC
  • mfrom: (1.3.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20100811141615-lsqya0vlqrnu14lo
Tags: 1:2.7.3-1ubuntu1
* Resync on Debian, workaround build issue (lp:#600952) 
* debian/control:
  - Build-Depends on liblaunchpad-integration-dev
  - Drop libpurple0 dependency from libpurple-bin
  - Drop pidgin-data dependency from libpurple0
  - Recommends pidgin-libnotify
* debian/libpurple0.symbols: 
  - add epochs
* debian/patches/02_lpi.patch:
  - launchpad integration
* debian/patches/04_let_crasher_for_apport.patch:
  - stop catching the SIGSEGV signal and let apport handle it
* debian/patches/05_default_to_irc_ubuntu_com.patch:
  - set the default IRC server to irc.ubuntu.com
* debian/patches/10_docklet_default_off.patch:
  - default behavior to have no notification area icon.
* debian/patches/11_buddy_list_really_show.patch:
  - the buddy list tries harder to appear.  This fixes some issues with it
    not appearing.
* debian/patches/ 13_sounds_and_timers.patch:
  - adjusts the time out for sounds to be 15 seconds, 
    which helps get fewer spurious login notifications on slow connections.
* debian/patches/60_1024x600_gtk*.c.patch: 
  - add scrollbars into preferences and pounce dialogs
* debian/prefs.xml: 
  - Update to set the notify plugin prefs /plugins/gtk/X11/notify/*, 
    set /pidgin/plugins/loaded to load the notify plugin and enable 
    the standard logging options by default
* debian/rules:
  - install a launcher in the message indicator
  - set translation domain and update template
  - use simple-patchsys rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
        {PURPLE_SOUND_CHAT_YOU_SAY, N_("You talk in chat"), "send_chat_msg", "send.wav", NULL},
105
105
        {PURPLE_SOUND_CHAT_SAY,     N_("Others talk in chat"), "chat_msg_recv", "receive.wav", NULL},
106
106
        {PURPLE_SOUND_POUNCE_DEFAULT, NULL, "pounce_default", "alert.wav", NULL},
107
 
        {PURPLE_SOUND_CHAT_NICK,    N_("Someone says your username in chat"), "nick_said", "alert.wav", NULL}
 
107
        {PURPLE_SOUND_CHAT_NICK,    N_("Someone says your username in chat"), "nick_said", "alert.wav", NULL},
 
108
        {PURPLE_SOUND_GOT_ATTENTION, N_("Attention received"), "got_attention", "alert.wav", NULL}
108
109
};
109
110
 
110
111
const char *
273
274
                play_conv_event(conv, event);
274
275
}
275
276
 
 
277
static void
 
278
got_attention_cb(PurpleAccount *account, const char *who,
 
279
        PurpleConversation *conv, guint type, PurpleSoundEventID event)
 
280
{
 
281
        play_conv_event(conv, event);
 
282
}
 
283
 
 
284
 
276
285
/*
277
286
 * We mute sounds for the 10 seconds after you log in so that
278
287
 * you don't get flooded with sounds when the blist shows all
300
309
static void
301
310
initialize_profile(const char *name, PurplePrefType type, gconstpointer val, gpointer null)
302
311
{
 
312
        FinchSoundEvent *event;
303
313
        if (purple_prefs_exists(make_pref("")))
304
314
                return;
305
315
 
306
316
        purple_prefs_add_none(make_pref(""));
307
317
        purple_prefs_add_none(make_pref("/enabled"));
308
318
        purple_prefs_add_none(make_pref("/file"));
309
 
        purple_prefs_add_bool(make_pref("/enabled/login"), FALSE);
310
 
        purple_prefs_add_path(make_pref("/file/login"), "");
311
 
        purple_prefs_add_bool(make_pref("/enabled/logout"), FALSE);
312
 
        purple_prefs_add_path(make_pref("/file/logout"), "");
313
 
        purple_prefs_add_bool(make_pref("/enabled/im_recv"), FALSE);
314
 
        purple_prefs_add_path(make_pref("/file/im_recv"), "");
315
 
        purple_prefs_add_bool(make_pref("/enabled/first_im_recv"), FALSE);
316
 
        purple_prefs_add_path(make_pref("/file/first_im_recv"), "");
317
 
        purple_prefs_add_bool(make_pref("/enabled/send_im"), FALSE);
318
 
        purple_prefs_add_path(make_pref("/file/send_im"), "");
319
 
        purple_prefs_add_bool(make_pref("/enabled/join_chat"), FALSE);
320
 
        purple_prefs_add_path(make_pref("/file/join_chat"), "");
321
 
        purple_prefs_add_bool(make_pref("/enabled/left_chat"), FALSE);
322
 
        purple_prefs_add_path(make_pref("/file/left_chat"), "");
323
 
        purple_prefs_add_bool(make_pref("/enabled/send_chat_msg"), FALSE);
324
 
        purple_prefs_add_path(make_pref("/file/send_chat_msg"), "");
325
 
        purple_prefs_add_bool(make_pref("/enabled/chat_msg_recv"), FALSE);
326
 
        purple_prefs_add_path(make_pref("/file/chat_msg_recv"), "");
327
 
        purple_prefs_add_bool(make_pref("/enabled/nick_said"), FALSE);
328
 
        purple_prefs_add_path(make_pref("/file/nick_said"), "");
329
 
        purple_prefs_add_bool(make_pref("/enabled/pounce_default"), FALSE);
330
 
        purple_prefs_add_path(make_pref("/file/pounce_default"), "");
 
319
 
 
320
        for (event = sounds; event - sounds < PURPLE_NUM_SOUNDS; event++) {
 
321
                char pref[512];
 
322
                g_snprintf(pref, sizeof(pref), "/enabled/%s", event->pref);
 
323
                purple_prefs_add_bool(make_pref(pref), FALSE);
 
324
                g_snprintf(pref, sizeof(pref), "/file/%s", event->pref);
 
325
                purple_prefs_add_path(make_pref(pref), "");
 
326
        }
 
327
 
331
328
        purple_prefs_add_bool(make_pref("/conv_focus"), FALSE);
332
329
        purple_prefs_add_bool(make_pref("/mute"), FALSE);
333
330
        purple_prefs_add_path(make_pref("/command"), "");
336
333
}
337
334
 
338
335
static void
 
336
update_profiles(void)
 
337
{
 
338
        GList *list = finch_sound_get_profiles();
 
339
        for (; list; list = g_list_delete_link(list, list)) {
 
340
                char pname[512];
 
341
 
 
342
                /* got_attention was added in libpurple 2.7.0 */
 
343
                g_snprintf(pname, sizeof(pname), FINCH_PREFS_ROOT "/sound/profiles/%s%s",
 
344
                                (char *)list->data, "/enabled/got_attention");
 
345
                purple_prefs_add_bool(pname, FALSE);
 
346
                g_snprintf(pname, sizeof(pname), FINCH_PREFS_ROOT "/sound/profiles/%s%s",
 
347
                                (char *)list->data, "/file/got_attention");
 
348
                purple_prefs_add_path(pname, "");
 
349
 
 
350
                g_free(list->data);
 
351
        }
 
352
}
 
353
 
 
354
static void
339
355
finch_sound_init(void)
340
356
{
341
357
        void *gnt_sound_handle = finch_sound_get_handle();
356
372
        purple_prefs_connect_callback(gnt_sound_handle, FINCH_PREFS_ROOT "/sound/actprofile", initialize_profile, NULL);
357
373
        purple_prefs_trigger_callback(FINCH_PREFS_ROOT "/sound/actprofile");
358
374
 
359
 
        
 
375
 
360
376
#ifdef USE_GSTREAMER
361
377
        purple_debug_info("sound", "Initializing sound output drivers.\n");
362
378
#if (GST_VERSION_MAJOR > 0 || \
399
415
        purple_signal_connect(conv_handle, "received-chat-msg",
400
416
                                                gnt_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb),
401
417
                                                GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY));
 
418
        purple_signal_connect(conv_handle, "got-attention",
 
419
                                                gnt_sound_handle, PURPLE_CALLBACK(got_attention_cb),
 
420
                                                GINT_TO_POINTER(PURPLE_SOUND_GOT_ATTENTION));
 
421
 
 
422
        update_profiles();
402
423
}
403
424
 
404
425
static void
577
598
        if ((event == PURPLE_SOUND_BUDDY_ARRIVE) && mute_login_sounds)
578
599
                return;
579
600
 
580
 
        if (event >= PURPLE_NUM_SOUNDS) {
 
601
        if (event >= PURPLE_NUM_SOUNDS ||
 
602
                        event >= G_N_ELEMENTS(sounds)) {
581
603
                purple_debug_error("sound", "got request for unknown sound: %d\n", event);
582
604
                return;
583
605
        }