~ubuntu-branches/ubuntu/utopic/gossip/utopic

« back to all changes in this revision

Viewing changes to src/gossip-notify.c

  • Committer: Bazaar Package Importer
  • Author(s): Sjoerd Simons
  • Date: 2007-04-17 01:15:10 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20070417011510-479gmj79geztkdhd
Tags: 0.24-2
* Target unstable
* Build-depend on libnotify-dev (>= 0.4.4-3)
* Build-depend on gnome-pkg-tools (>= 0.6) for
  /usr/share/gnome-pkg-tools/1/rules/gnome-version.mk
* Add versioned depend on gossip-common

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
static void                notify_contact_removed_cb              (GossipSession      *session,
96
96
                                                                   GossipContact      *contact,
97
97
                                                                   gpointer            user_data);
98
 
static void                notify_contact_remove                  (GossipContact      *contact);
99
98
static gboolean            notify_subscription_request_show_cb    (GossipContact      *contact);
100
99
static void                notify_event_added_cb                  (GossipEventManager *event_manager,
101
100
                                                                   GossipEvent        *event,
347
346
        if (event) {
348
347
                message = GOSSIP_MESSAGE (gossip_event_get_data (event));
349
348
                contact = gossip_message_get_sender (message);
 
349
                
 
350
                gossip_chat_manager_remove_events(gossip_app_get_chat_manager(),contact);
 
351
                
 
352
                g_hash_table_remove (event_notifications, notify);
 
353
                g_hash_table_remove (message_notifications, contact);
 
354
        } else {
 
355
                g_warning ("No event found for NotifyNotification: %p", notify);
 
356
        }
 
357
 
 
358
        g_object_unref (event_manager);
 
359
}
 
360
 
 
361
static void
 
362
notify_new_message_respond_cb (NotifyNotification *notify,
 
363
                               gchar              *label,
 
364
                               GossipEventManager *event_manager)
 
365
{
 
366
        GossipEvent   *event;
 
367
        GossipMessage *message;
 
368
        GossipContact *contact = NULL;
 
369
 
 
370
        event = g_hash_table_lookup (event_notifications, notify);
 
371
        if (event) {
 
372
                message = GOSSIP_MESSAGE (gossip_event_get_data (event));
 
373
                contact = gossip_message_get_sender (message);
350
374
 
351
375
                gossip_event_manager_activate (event_manager, event);
352
376
 
468
492
                                        (NotifyActionCallback) notify_new_message_default_cb,
469
493
                                        g_object_ref (event_manager), NULL);
470
494
        notify_notification_add_action (notify, "respond", _("Show"),
471
 
                                        (NotifyActionCallback) notify_new_message_default_cb,
 
495
                                        (NotifyActionCallback) notify_new_message_respond_cb,
472
496
                                        g_object_ref (event_manager), NULL);
473
497
 
474
498
        if (gossip_contact_get_type (contact) == GOSSIP_CONTACT_TYPE_TEMPORARY) {
636
660
                           GossipContact *contact,
637
661
                           gpointer       user_data)
638
662
{
639
 
        g_hash_table_remove (contact_states, contact);
640
 
}
641
 
 
642
 
static void
643
 
notify_contact_remove (GossipContact *contact)
644
 
{
645
663
        g_signal_handlers_disconnect_by_func (contact,
646
664
                                              notify_contact_presence_updated_cb,
647
665
                                              NULL);
648
 
        g_object_unref (contact);
 
666
 
 
667
        g_hash_table_remove (contact_states, contact);
649
668
}
650
669
 
651
670
static gboolean
863
882
 
864
883
        contact_states = g_hash_table_new_full (gossip_contact_hash,
865
884
                                                gossip_contact_equal,
866
 
                                                (GDestroyNotify) notify_contact_remove,
 
885
                                                (GDestroyNotify) g_object_unref,
867
886
                                                (GDestroyNotify) g_object_unref);
868
887
 
869
888
        g_signal_connect (session, "protocol-connected",