diff --git a/sflphone-gtk/src/SFLnotify.c b/sflphone-gtk/src/SFLnotify.c index 8c68cdfc272ba17c33832afef4dee5edc269c334..5a4308cd6a51468d091940beb6405ef68afc9072 100644 --- a/sflphone-gtk/src/SFLnotify.c +++ b/sflphone-gtk/src/SFLnotify.c @@ -78,7 +78,36 @@ refuse_call_cb( NotifyNotification *notification, gchar *action, gpointer data ) void ignore_call_cb( NotifyNotification *notification, gchar *action, gpointer data ) { - call_t* c = (call_t*)g_object_get_data( G_OBJECT( notification ) , "call" ); g_object_unref( notification ); } +void +notify_voice_mails( guint count , account_t* acc ) +{ + // the account is different from NULL + GdkPixbuf *pixbuf; + gchar* title; + gchar* body; + notify_init("sflphone"); + + title = g_markup_printf_escaped(_("%s account: %s") , + g_hash_table_lookup(acc->properties , ACCOUNT_TYPE) , + g_hash_table_lookup(acc->properties , ACCOUNT_ALIAS) ) ; + body = g_markup_printf_escaped(_("%d voice mails"), count); + + pixbuf = gdk_pixbuf_new_from_file(ICON_DIR "/sflphone.png", NULL); + + notification = notify_notification_new( title, + body, + NULL, + NULL); + notify_notification_set_urgency( notification , NOTIFY_URGENCY_NORMAL ); + notify_notification_set_icon_from_pixbuf (notification, pixbuf); + notify_notification_attach_to_status_icon( notification , get_status_icon() ); + notify_notification_set_timeout( notification , NOTIFY_EXPIRES_DEFAULT ); + notify_notification_add_action( notification , "ignore" , _("Ignore") , (NotifyActionCallback) ignore_call_cb , NULL , NULL ); + + if (!notify_notification_show (notification, NULL)) { + g_print("notify(), failed to send notification\n"); + } +} diff --git a/sflphone-gtk/src/SFLnotify.h b/sflphone-gtk/src/SFLnotify.h index 40471de50116f2cb095a22d30a9eb1a6d4bc1374..276a62079207444498d166258056461acc9a4cab 100644 --- a/sflphone-gtk/src/SFLnotify.h +++ b/sflphone-gtk/src/SFLnotify.h @@ -41,6 +41,8 @@ */ void notify_incoming_call( call_t* c); +void notify_voice_mails( guint count , account_t* acc ); + /* * Callback when answer button is pressed. * Action: Pick up the incoming call diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index e265c98d9ccf151ae19b3049678fe9a28c2dabb9..d8b72f8c63aa3aa330a5ad7a18efaa61514552ef 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -55,6 +55,28 @@ sflphone_notify_voice_mail (guint count) status_bar_message_add(message, __MSG_VOICE_MAILS); g_free(message); } + // TODO: add ifdef + if( account_list_get_size() > 0 ) + { + account_t* acc = account_list_get_by_state( ACCOUNT_STATE_REGISTERED ); + if( acc == NULL ) + { + // Notify that no account is registered + //notify_no_account_registered(); + } + else + { + if( account_list_get_default() == NULL ){ + // Notify that the first registered account has count voice mails + notify_voice_mails( count , acc ); + } + else + { + // Notify that the default registered account has count voice mails + notify_voice_mails( count , account_list_get_by_id(account_list_get_default()) ); + } + } + } } void @@ -345,6 +367,7 @@ sflphone_unset_transfert() } toolbar_update_buttons(); } + void sflphone_incoming_call (call_t * c) { @@ -357,7 +380,7 @@ sflphone_incoming_call (call_t * c) void process_dialing(call_t * c, guint keyval, gchar * key) { // We stop the tone - if(strlen(c->to) == 0){ + if(strlen(c->to) == 0 && c->state != CALL_STATE_TRANSFERT){ dbus_start_tone( FALSE , 0 ); dbus_play_dtmf( key ); } @@ -421,10 +444,10 @@ void process_dialing(call_t * c, guint keyval, gchar * key) call_t * sflphone_new_call() { + // Play a tone when creating a new call if( call_list_get_size() == 0 ) - { dbus_start_tone( TRUE , ( voice_mails > 0 )? TONE_WITH_MESSAGE : TONE_WITHOUT_MESSAGE) ; - } + call_t * c = g_new0 (call_t, 1); c->state = CALL_STATE_DIALING; c->from = g_strconcat("\"\" <>", NULL); diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c index 3f94ec72d77375df21ee887532cbf09ff8b2a3ac..df13d1216f8851491e3e733ee5dbd0068ab83a17 100644 --- a/sflphone-gtk/src/menus.c +++ b/sflphone-gtk/src/menus.c @@ -169,7 +169,8 @@ static void call_minimize ( void * foo) { gtk_widget_hide(GTK_WIDGET( get_main_window() )); - set_minimized( !MAIN_WINDOW_SHOW ); + + set_minimized( TRUE ); } static void diff --git a/sflphone-gtk/src/statusicon.c b/sflphone-gtk/src/statusicon.c index 490673d421e6c2253f1fb68664fe2ced77c8ed75..01b1eb82776de16c5cbb97762508f600a1abae45 100644 --- a/sflphone-gtk/src/statusicon.c +++ b/sflphone-gtk/src/statusicon.c @@ -25,7 +25,7 @@ GtkStatusIcon* status; GtkWidget * show_menu_item; -gboolean __minimized = MAIN_WINDOW_SHOW; +gboolean __minimized = MINIMIZED; void status_quit ( void * foo) @@ -48,25 +48,17 @@ main_widget_minimized() void show_hide (void) { - /*if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(show_menu_item))) + if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(show_menu_item))) { gtk_widget_show(GTK_WIDGET(get_main_window())); + set_minimized( !MINIMIZED ); } else { gtk_widget_hide(GTK_WIDGET(get_main_window())); - }*/ - - if( main_widget_minimized() ) - { - gtk_widget_show(GTK_WIDGET(get_main_window())); - set_minimized(MAIN_WINDOW_SHOW) ; - } - else - { - gtk_widget_hide(GTK_WIDGET(get_main_window())); - set_minimized(!MAIN_WINDOW_SHOW) ; + set_minimized( MINIMIZED ); } + } @@ -148,4 +140,5 @@ void set_minimized( gboolean state) { __minimized = state ; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_menu_item), !state); } diff --git a/sflphone-gtk/src/statusicon.h b/sflphone-gtk/src/statusicon.h index 78964048e4b2b6705c794a8785e3ae4b0aa29c4e..b3f6ba7d15ad5280e6c57b52d00fb5bbbad12ad1 100644 --- a/sflphone-gtk/src/statusicon.h +++ b/sflphone-gtk/src/statusicon.h @@ -20,7 +20,7 @@ #ifndef __STATUSICON_H__ #define __STATUSICON_H__ -#define MAIN_WINDOW_SHOW TRUE +#define MINIMIZED TRUE #include <gtk/gtk.h> /** @file statusicon.h diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index e1551edd5d4ba5bd5b62aad2a8c0944aa1fe0603..c587538cf891d7601334ca402b2a648ec6de3c9a 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -377,6 +377,7 @@ ManagerImpl::transferCall(const CallID& id, const std::string& to) if (_dbus) _dbus->getCallManager()->callStateChanged(id, "HUNGUP"); switchCall(""); + return returnValue; } diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index a8ac06b184fabeb152e00365058c3fd3135b7837..d2cd1aea7ccadc49da616f0a7b3bee05c0b28601 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -840,6 +840,7 @@ SIPVoIPLink::transfer(const CallID& id, const std::string& to) } eXosip_unlock(); + _audiortp.closeRtpSession(); // shall we delete the call? //removeCall(id); return true;