Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
26db78d8
Commit
26db78d8
authored
Sep 08, 2011
by
Tristan Matthews
Browse files
* #6894: fix leaks, cleanup in sflnotify
parent
34a0d59b
Changes
5
Show whitespace changes
Inline
Side-by-side
gnome/src/actions.c
View file @
26db78d8
...
...
@@ -414,7 +414,6 @@ sflphone_hang_up()
call_remove_all_errors
(
selectedCall
);
selectedCall
->
_state
=
CALL_STATE_DIALING
;
DEBUG
(
"from sflphone_hang_up : "
);
stop_notification
();
break
;
case
CALL_STATE_TRANSFER
:
dbus_hang_up
(
selectedCall
);
...
...
@@ -465,7 +464,6 @@ sflphone_pick_up()
}
dbus_accept
(
selectedCall
);
stop_notification
();
break
;
case
CALL_STATE_TRANSFER
:
dbus_transfer
(
selectedCall
);
...
...
@@ -766,11 +764,9 @@ sflphone_keypad (guint keyval, gchar * key)
c
->
_history_state
=
INCOMING
;
calltree_update_call
(
history
,
c
,
NULL
);
dbus_accept
(
c
);
stop_notification
();
break
;
case
GDK_Escape
:
dbus_refuse
(
c
);
stop_notification
();
break
;
}
...
...
@@ -825,15 +821,14 @@ sflphone_keypad (guint keyval, gchar * key)
break
;
}
}
else
{
}
else
sflphone_new_call
();
}
}
static
void
place_direct_call
(
const
callable_obj_t
*
c
)
{
assert
(
c
->
_state
==
CALL_STATE_DIALING
);
dbus_place_call
(
c
);
g_
assert
(
c
->
_state
==
CALL_STATE_DIALING
);
dbus_place_call
(
c
);
}
static
int
place_registered_call
(
callable_obj_t
*
c
)
...
...
@@ -861,7 +856,7 @@ static int place_registered_call (callable_obj_t * c)
DEBUG
(
"Actions: Get account for this call"
);
if
(
g_
str
casecmp
(
c
->
_accountID
,
""
)
!=
0
)
{
if
(
str
len
(
c
->
_accountID
)
!=
0
)
{
DEBUG
(
"Actions: Account %s already set for this call"
,
c
->
_accountID
);
current
=
account_list_get_by_id
(
c
->
_accountID
);
}
else
{
...
...
gnome/src/contacts/calltree.c
View file @
26db78d8
...
...
@@ -202,7 +202,6 @@ row_activated (GtkTreeView *tree_view UNUSED,
switch
(
selectedCall
->
_state
)
{
case
CALL_STATE_INCOMING
:
dbus_accept
(
selectedCall
);
stop_notification
();
break
;
case
CALL_STATE_HOLD
:
dbus_unhold
(
selectedCall
);
...
...
gnome/src/dbus/dbus.c
View file @
26db78d8
...
...
@@ -160,8 +160,6 @@ call_state_cb (DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state
time
(
&
c
->
_time_stop
);
calltree_update_call
(
history
,
c
,
NULL
);
}
stop_notification
();
calltree_update_call
(
history
,
c
,
NULL
);
status_bar_display_account
();
sflphone_hung_up
(
c
);
...
...
gnome/src/sflnotify.c
View file @
26db78d8
...
...
@@ -32,245 +32,175 @@
#include
"config.h"
#include
"sflnotify.h"
static
GnomeNotification
*
_gnome_notification
;
void
create_new_gnome_notification
(
gchar
*
title
,
gchar
*
body
,
NotifyUrgency
urgency
,
gint
timeout
,
GnomeNotification
**
notif
)
typedef
struct
{
NotifyNotification
*
notification
;
gchar
*
title
;
gchar
*
body
;
GdkPixbuf
*
icon
;
}
GnomeNotification
;
static
void
create_new_gnome_notification
(
gchar
*
title
,
gchar
*
body
,
NotifyUrgency
urgency
,
gint
timeout
)
{
GnomeNotification
*
_
notif
;
GnomeNotification
notif
;
if
(
eel_gconf_get_integer
(
NOTIFY_ALL
))
{
_notif
=
g_new0
(
GnomeNotification
,
1
);
notify_init
(
"SFLphone"
);
// Set struct fields
#ifdef LIBNOTIFY_VERSION_0_7_2
_
notif
->
notification
=
notify_notification_new
(
title
,
body
,
NULL
);
notif
.
notification
=
notify_notification_new
(
title
,
body
,
NULL
);
#else
_
notif
->
notification
=
notify_notification_new
(
title
,
body
,
NULL
,
NULL
);
notif
.
notification
=
notify_notification_new
(
title
,
body
,
NULL
,
NULL
);
#endif
_
notif
->
icon
=
gdk_pixbuf_new_from_file
(
LOGO_SMALL
,
NULL
);
notif
.
icon
=
gdk_pixbuf_new_from_file
(
LOGO_SMALL
,
NULL
);
#ifdef LIBNOTIFY_VERSION_0_7_2
#else
#if GTK_CHECK_VERSION(2,10,0)
notify_notification_attach_to_status_icon
(
_
notif
->
notification
,
get_status_icon
());
notify_notification_attach_to_status_icon
(
notif
.
notification
,
get_status_icon
());
#endif
#endif
notify_notification_set_urgency
(
_
notif
->
notification
,
urgency
);
notify_notification_set_urgency
(
notif
.
notification
,
urgency
);
if
(
_
notif
->
icon
!=
NULL
)
notify_notification_set_icon_from_pixbuf
(
_
notif
->
notification
,
_
notif
->
icon
);
if
(
notif
.
icon
!=
NULL
)
notify_notification_set_icon_from_pixbuf
(
notif
.
notification
,
notif
.
icon
);
else
ERROR
(
"notify(), cannot load notification icon"
);
notify_notification_set_timeout
(
_
notif
->
notification
,
timeout
);
notify_notification_set_timeout
(
notif
.
notification
,
timeout
);
if
(
!
notify_notification_show
(
_
notif
->
notification
,
NULL
))
{
if
(
!
notify_notification_show
(
notif
.
notification
,
NULL
))
{
ERROR
(
"notify(), failed to send notification"
);
}
*
notif
=
_notif
;
}
g_free
(
title
);
g_free
(
body
);
}
void
notify_incoming_message
(
const
gchar
*
callID
,
const
gchar
*
msg
)
{
gchar
*
title
=
g_markup_printf_escaped
(
_
(
"%s says:"
),
callID
);
gchar
*
title
;
title
=
g_markup_printf_escaped
(
_
(
"%s says:"
),
callID
);
create_new_gnome_notification
(
title
,
create_new_gnome_notification
(
title
,
(
gchar
*
)
msg
,
NOTIFY_URGENCY_CRITICAL
,
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
,
&
_gnome_notification
);
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
);
}
void
notify_incoming_call
(
callable_obj_t
*
c
)
{
gchar
*
callerid
;
gchar
*
title
;
if
(
g_
str
casecmp
(
c
->
_accountID
,
""
)
==
0
)
{
title
=
g_markup_printf_escaped
(
"IP-to-IP call"
);
}
else
{
title
=
g_markup_printf_escaped
(
_
(
"%s account : %s"
)
,
if
(
str
len
(
c
->
_accountID
)
==
0
)
title
=
g_markup_printf_escaped
(
"IP-to-IP call"
);
else
{
title
=
g_markup_printf_escaped
(
_
(
"%s account : %s"
)
,
(
gchar
*
)
g_hash_table_lookup
(
account_list_get_by_id
(
c
->
_accountID
)
->
properties
,
ACCOUNT_TYPE
)
,
(
gchar
*
)
g_hash_table_lookup
(
account_list_get_by_id
(
c
->
_accountID
)
->
properties
,
ACCOUNT_ALIAS
))
;
}
callerid
=
g_markup_printf_escaped
(
_
(
"<i>From</i> %s"
),
c
->
_peer_number
);
gchar
*
callerid
=
g_markup_printf_escaped
(
_
(
"<i>From</i> %s"
),
c
->
_peer_number
);
create_new_gnome_notification
(
title
,
create_new_gnome_notification
(
title
,
callerid
,
NOTIFY_URGENCY_CRITICAL
,
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
,
&
_gnome_notification
);
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
);
}
void
notify_voice_mails
(
guint
count
,
account_t
*
acc
)
notify_voice_mails
(
guint
count
,
account_t
*
acc
)
{
// the account is different from NULL
gchar
*
title
;
gchar
*
body
;
title
=
g_markup_printf_escaped
(
_
(
"%s account : %s"
)
,
gchar
*
title
=
g_markup_printf_escaped
(
_
(
"%s account : %s"
)
,
(
gchar
*
)
g_hash_table_lookup
(
acc
->
properties
,
ACCOUNT_TYPE
)
,
(
gchar
*
)
g_hash_table_lookup
(
acc
->
properties
,
ACCOUNT_ALIAS
))
;
body
=
g_markup_printf_escaped
(
n_
(
"%d voice mail"
,
"%d voice mails"
,
count
),
count
);
gchar
*
body
=
g_markup_printf_escaped
(
n_
(
"%d voice mail"
,
"%d voice mails"
,
count
),
count
);
create_new_gnome_notification
(
title
,
create_new_gnome_notification
(
title
,
body
,
NOTIFY_URGENCY_LOW
,
NOTIFY_EXPIRES_DEFAULT
,
&
_gnome_notification
);
NOTIFY_EXPIRES_DEFAULT
);
}
void
notify_current_account
(
account_t
*
acc
)
{
// the account is different from NULL
gchar
*
title
;
gchar
*
body
=
""
;
body
=
g_markup_printf_escaped
(
_
(
"Calling with %s account <i>%s</i>"
)
,
(
gchar
*
)
g_hash_table_lookup
(
acc
->
properties
,
ACCOUNT_TYPE
)
,
(
gchar
*
)
g_hash_table_lookup
(
acc
->
properties
,
ACCOUNT_ALIAS
));
gchar
*
body
=
g_markup_printf_escaped
(
_
(
"Calling with %s account <i>%s</i>"
),
(
gchar
*
)
g_hash_table_lookup
(
acc
->
properties
,
ACCOUNT_TYPE
)
,
(
gchar
*
)
g_hash_table_lookup
(
acc
->
properties
,
ACCOUNT_ALIAS
));
title
=
g_markup_printf_escaped
(
_
(
"Current account"
));
gchar
*
title
=
g_markup_printf_escaped
(
_
(
"Current account"
));
create_new_gnome_notification
(
title
,
body
,
NOTIFY_URGENCY_NORMAL
,
NOTIFY_EXPIRES_DEFAULT
,
&
_gnome_notification
);
create_new_gnome_notification
(
title
,
body
,
NOTIFY_URGENCY_NORMAL
,
NOTIFY_EXPIRES_DEFAULT
);
}
void
notify_no_accounts
()
notify_no_accounts
()
{
gchar
*
title
;
gchar
*
body
=
""
;
gchar
*
body
=
g_markup_printf_escaped
(
_
(
"You have no accounts set up"
))
;
gchar
*
title
=
g_markup_printf_escaped
(
_
(
"Error"
))
;
body
=
g_markup_printf_escaped
(
_
(
"You have no accounts set up"
));
title
=
g_markup_printf_escaped
(
_
(
"Error"
));
create_new_gnome_notification
(
title
,
body
,
NOTIFY_URGENCY_CRITICAL
,
NOTIFY_EXPIRES_DEFAULT
,
&
_gnome_notification
);
create_new_gnome_notification
(
title
,
body
,
NOTIFY_URGENCY_CRITICAL
,
NOTIFY_EXPIRES_DEFAULT
);
}
void
notify_no_registered_accounts
()
{
gchar
*
title
;
gchar
*
body
=
""
;
gchar
*
body
=
g_markup_printf_escaped
(
_
(
"You have no registered accounts"
))
;
gchar
*
title
=
g_markup_printf_escaped
(
_
(
"Error"
))
;
body
=
g_markup_printf_escaped
(
_
(
"You have no registered accounts"
));
title
=
g_markup_printf_escaped
(
_
(
"Error"
));
create_new_gnome_notification
(
title
,
body
,
NOTIFY_URGENCY_CRITICAL
,
NOTIFY_EXPIRES_DEFAULT
,
&
_gnome_notification
);
create_new_gnome_notification
(
title
,
body
,
NOTIFY_URGENCY_CRITICAL
,
NOTIFY_EXPIRES_DEFAULT
);
}
void
stop_notification
(
void
)
{
/*
if( _gnome_notification != NULL )
{
if(_gnome_notification->notification != NULL)
{
notify_notification_close (_gnome_notification->notification, NULL);
g_object_unref(_gnome_notification->notification );
_gnome_notification->notification = NULL;
}
free_notification (_gnome_notification);
}*/
}
/**
* Freeing a notification instance
*/
void
free_notification
(
GnomeNotification
*
g
)
{
g_free
(
g
->
title
);
g_free
(
g
->
body
);
g_free
(
g
);
}
void
notify_secure_on
(
callable_obj_t
*
c
)
{
gchar
*
callerid
;
gchar
*
title
;
title
=
g_markup_printf_escaped
(
"Secure mode on."
);
callerid
=
g_markup_printf_escaped
(
_
(
"<i>With:</i> %s
\n
using %s"
)
,
c
->
_peer_number
,
c
->
_srtp_cipher
);
create_new_gnome_notification
(
title
,
gchar
*
title
=
g_markup_printf_escaped
(
"Secure mode on."
);
gchar
*
callerid
=
g_markup_printf_escaped
(
_
(
"<i>With:</i> %s
\n
using %s"
)
,
c
->
_peer_number
,
c
->
_srtp_cipher
);
create_new_gnome_notification
(
title
,
callerid
,
NOTIFY_URGENCY_CRITICAL
,
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
,
&
_gnome_notification
);
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
);
}
void
notify_zrtp_not_supported
(
callable_obj_t
*
c
)
{
gchar
*
callerid
;
gchar
*
title
;
title
=
g_markup_printf_escaped
(
"ZRTP Error."
);
callerid
=
g_markup_printf_escaped
(
_
(
"%s does not support ZRTP."
)
,
c
->
_peer_number
);
gchar
*
title
=
g_markup_printf_escaped
(
"ZRTP Error."
);
gchar
*
callerid
=
g_markup_printf_escaped
(
_
(
"%s does not support ZRTP."
)
,
c
->
_peer_number
);
create_new_gnome_notification
(
title
,
callerid
,
NOTIFY_URGENCY_CRITICAL
,
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
,
&
_gnome_notification
);
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
);
}
void
notify_zrtp_negotiation_failed
(
callable_obj_t
*
c
)
{
gchar
*
callerid
;
gchar
*
title
;
title
=
g_markup_printf_escaped
(
"ZRTP Error."
);
callerid
=
g_markup_printf_escaped
(
_
(
"ZRTP negotiation failed with %s"
)
,
c
->
_peer_number
);
create_new_gnome_notification
(
title
,
gchar
*
title
=
g_markup_printf_escaped
(
"ZRTP Error."
);
gchar
*
callerid
=
g_markup_printf_escaped
(
_
(
"ZRTP negotiation failed with %s"
),
c
->
_peer_number
);
create_new_gnome_notification
(
title
,
callerid
,
NOTIFY_URGENCY_CRITICAL
,
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
,
&
_gnome_notification
);
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
);
}
void
notify_secure_off
(
callable_obj_t
*
c
)
{
gchar
*
callerid
;
gchar
*
title
;
title
=
g_markup_printf_escaped
(
"Secure mode is off."
);
callerid
=
g_markup_printf_escaped
(
_
(
"<i>With:</i> %s"
)
,
c
->
_peer_number
);
create_new_gnome_notification
(
title
,
gchar
*
title
=
g_markup_printf_escaped
(
"Secure mode is off."
);
gchar
*
callerid
=
g_markup_printf_escaped
(
_
(
"<i>With:</i> %s"
),
c
->
_peer_number
);
create_new_gnome_notification
(
title
,
callerid
,
NOTIFY_URGENCY_CRITICAL
,
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
,
&
_gnome_notification
);
(
g_strcasecmp
(
__TIMEOUT_MODE
,
"default"
)
==
0
)
?
__TIMEOUT_TIME
:
NOTIFY_EXPIRES_NEVER
);
}
gnome/src/sflnotify.h
View file @
26db78d8
...
...
@@ -44,17 +44,6 @@
G_BEGIN_DECLS
typedef
struct
{
NotifyNotification
*
notification
;
gchar
*
title
;
gchar
*
body
;
GdkPixbuf
*
icon
;
}
GnomeNotification
;
void
create_new_gnome_notification
(
gchar
*
title
,
gchar
*
body
,
NotifyUrgency
urgency
,
gint
timeout
,
GnomeNotification
**
notif
);
void
free_notification
(
GnomeNotification
*
g
);
/**
* Notify an incoming call
* A dialog box is attached to the status icon
...
...
@@ -93,11 +82,6 @@ void notify_no_accounts();
*/
void
notify_no_registered_accounts
();
/**
* Stop and close the current notification if an action occured before the timeout
*/
void
stop_notification
(
void
);
/**
* Notify that the RTP session is secured
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment