~dylanmccall/notify-osd/sounds-support

« back to all changes in this revision

Viewing changes to src/bubble.c

  • Committer: Dylan McCall
  • Date: 2010-03-27 23:49:23 UTC
  • Revision ID: dylanmccall@gmail.com-20100327234923-l4tgvil01ca80ptp
Implement suppress-sound hint. Haven't been able to test this, but it _should_ work, I think...

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
        guint            timeout;
99
99
        guint            urgency;
100
100
        //notification_t* notification;
 
101
        gboolean         suppress_sound;
101
102
        gchar*           sound_id;
102
103
        gchar*           sound_file;
103
104
 
171
172
#define BUBBLE_CONTENT_BLUR_RADIUS 4
172
173
#define TEXT_DROP_SHADOW_SIZE      2
173
174
 
 
175
#define BUBBLE_CA_GTK_SOUNDS_ID    1
 
176
 
174
177
//-- private functions ---------------------------------------------------------
175
178
 
176
179
static guint g_bubble_signals[LAST_SIGNAL] = { 0 };
2426
2429
}
2427
2430
 
2428
2431
void
 
2432
bubble_set_suppress_sound (Bubble* self,
 
2433
                           gboolean suppress_sound)
 
2434
{
 
2435
        if (!self || !IS_BUBBLE (self))
 
2436
                return;
 
2437
 
 
2438
        GET_PRIVATE (self)->suppress_sound = suppress_sound;
 
2439
}
 
2440
 
 
2441
gboolean
 
2442
bubble_get_suppress_sound (Bubble* self)
 
2443
{
 
2444
        if (!self || !IS_BUBBLE (self))
 
2445
                return FALSE;
 
2446
 
 
2447
        return GET_PRIVATE (self)->suppress_sound;
 
2448
}
 
2449
 
 
2450
void
2429
2451
bubble_set_sound_id (Bubble* self,
2430
2452
                     const gchar* id)
2431
2453
{
2869
2891
                                                 self);
2870
2892
 
2871
2893
        // play an attached sound using Canberra
2872
 
        // FIXME: implement "suppress-sound" hint
2873
 
        // FIXME: keep track of event id
 
2894
        if (priv->suppress_sound)
 
2895
        {
 
2896
                ca_context* c = ca_gtk_context_get ();
 
2897
                ca_context_cancel(c, BUBBLE_CA_GTK_SOUNDS_ID);
 
2898
        }
 
2899
 
2874
2900
        if (priv->sound_id)
2875
2901
        {
2876
 
                ca_gtk_play_for_widget (priv->widget, 0,
 
2902
                ca_gtk_play_for_widget (priv->widget, BUBBLE_CA_GTK_SOUNDS_ID,
2877
2903
                                        CA_PROP_EVENT_ID, priv->sound_id,
2878
2904
                                        /*CA_PROP_EVENT_DESCRIPTION, "event description",
2879
2905
                                        CA_PROP_APPLICATION_ID, "application id",*/