[ekiga/v4_0] libnotify plugin: make sure the actions retain references on the call objects
- From: Eugen Dedu <ededu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/v4_0] libnotify plugin: make sure the actions retain references on the call objects
- Date: Mon, 18 Feb 2013 20:16:04 +0000 (UTC)
commit 3148d6c0d01b11685da20fa0b431e236bbfaa00e
Author: Julien Puydt <jpuydt free fr>
Date: Tue Jan 15 09:52:40 2013 +0100
libnotify plugin: make sure the actions retain references on the call objects
plugins/libnotify/libnotify-main.cpp | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/plugins/libnotify/libnotify-main.cpp b/plugins/libnotify/libnotify-main.cpp
index 1d6afbb..502e53b 100644
--- a/plugins/libnotify/libnotify-main.cpp
+++ b/plugins/libnotify/libnotify-main.cpp
@@ -81,18 +81,32 @@ private:
container_type live;
};
+struct call_reference
+{
+ call_reference(boost::shared_ptr<Ekiga::Call> _call): call(_call)
+ {}
+
+ boost::shared_ptr<Ekiga::Call> call;
+};
+
+static void
+delete_call_reference (gpointer data)
+{
+ delete (call_reference *)data;
+}
+
static void
call_notification_action_cb (NotifyNotification *notification,
gchar *action,
gpointer data)
{
- Ekiga::Call *call = (Ekiga::Call *) data;
+ call_reference* ref = (call_reference *) data;
notify_notification_close (notification, NULL);
if (!g_strcmp0 (action, "accept"))
- call->answer ();
+ ref->call->answer ();
else
- call->hangup ();
+ ref->call->hangup ();
}
static void
@@ -250,6 +264,7 @@ LibNotify::on_call_notification (boost::shared_ptr<Ekiga::CallManager> manager,
boost::shared_ptr<Ekiga::Call> call)
{
NotifyNotification *notify = NULL;
+ call_reference* ref = NULL;
if (call->is_outgoing () || manager->get_auto_answer ())
return; // Ignore
@@ -267,8 +282,10 @@ LibNotify::on_call_notification (boost::shared_ptr<Ekiga::CallManager> manager,
#endif
#endif
);
- notify_notification_add_action (notify, "reject", _("Reject"), call_notification_action_cb, call.get (),
NULL);
- notify_notification_add_action (notify, "accept", _("Accept"), call_notification_action_cb, call.get (),
NULL);
+ ref = new call_reference (call);
+ notify_notification_add_action (notify, "reject", _("Reject"), call_notification_action_cb, ref,
delete_call_reference);
+ ref = new call_reference (call);
+ notify_notification_add_action (notify, "accept", _("Accept"), call_notification_action_cb, ref,
delete_call_reference);
notify_notification_set_timeout (notify, NOTIFY_EXPIRES_NEVER);
notify_notification_set_urgency (notify, NOTIFY_URGENCY_CRITICAL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]