diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index d6ae9de9187d17958876779cecf7f2e005aa13fe..3d7edc976bae573fbcb91bbb4e074d28dc2b053a 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -69,12 +69,15 @@ sflphone_notify_voice_mail ( const gchar* accountID , guint count ) } void -status_bar_display_account( call_t* c) +status_bar_display_account () { gchar* msg; account_t* acc; - if(c->accountID != NULL){ - acc = account_list_get_by_id(c->accountID); + + statusbar_pop_message(__MSG_ACCOUNT_DEFAULT); + + acc = account_list_get_current (); + if(acc){ msg = 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)); @@ -133,8 +136,6 @@ sflphone_hung_up( call_t * c) #if GTK_CHECK_VERSION(2,10,0) status_tray_icon_blink( FALSE ); #endif - - statusbar_pop_message(__MSG_ACCOUNT_DEFAULT); } /** Internal to actions: Fill account list */ @@ -716,7 +717,6 @@ sflphone_place_call ( call_t * c ) { // OK, everything alright - the call is made with the current account c -> accountID = current -> accountID; - status_bar_display_account(c); dbus_place_call(c); } else @@ -728,7 +728,6 @@ sflphone_place_call ( call_t * c ) c -> accountID = current -> accountID; dbus_place_call(c); notify_current_account( current ); - status_bar_display_account(c); account_list_set_current_id( c-> accountID ); } } @@ -742,7 +741,6 @@ sflphone_place_call ( call_t * c ) c -> accountID = current -> accountID; dbus_place_call(c); notify_current_account( current ); - status_bar_display_account(c); account_list_set_current_id( c-> accountID ); } } diff --git a/sflphone-gtk/src/actions.h b/sflphone-gtk/src/actions.h index 28cd87c9ac36f44188313358fd9fdf094526a1aa..19a22694d6b11a29bf3700c4e02d41a74187c125 100644 --- a/sflphone-gtk/src/actions.h +++ b/sflphone-gtk/src/actions.h @@ -170,4 +170,7 @@ void sflphone_rec_call (void); gchar* sflphone_get_current_codec_name(); void sflphone_display_selected_codec (const gchar* codecName); + +void status_bar_display_account (); + #endif diff --git a/sflphone-gtk/src/config/configwindow.c b/sflphone-gtk/src/config/configwindow.c index 87dfc907fa3f299f4a1d9743a62b16d9beecf91a..2a16f8c53a0408086fcefa7d0370dd43e4703fa4 100644 --- a/sflphone-gtk/src/config/configwindow.c +++ b/sflphone-gtk/src/config/configwindow.c @@ -848,7 +848,10 @@ show_accounts_window( void ) gtk_dialog_run( dialog ); + status_bar_display_account (); + accDialogOpen=FALSE; + gtk_widget_destroy(GTK_WIDGET(dialog)); if( account_list_get_size() >0 && account_list_get_current()==NULL ) account_list_set_current_pos(0); diff --git a/sflphone-gtk/src/contacts/calltree.c b/sflphone-gtk/src/contacts/calltree.c index 11e45d620b41a38ce716d08a080a2e2245e3e8fd..c7548763fcfeb9567706636f3255afb94a6e5f70 100644 --- a/sflphone-gtk/src/contacts/calltree.c +++ b/sflphone-gtk/src/contacts/calltree.c @@ -147,11 +147,15 @@ if (event->button == 3 && event->type == GDK_BUTTON_PRESS) show_popup_menu(widget, event); return TRUE; } - else + else if (active_calltree == history) { - show_popup_menu_history(widget, event); + show_popup_menu_history (widget, event); return TRUE; } + else{ + show_popup_menu_contacts (widget, event); + return TRUE; + } } return FALSE; } diff --git a/sflphone-gtk/src/main.c b/sflphone-gtk/src/main.c index b3c92c07315d4765c13d28c82ffad85591efd6c2..3f82b21f010515f62876b20c1f7d557dafd5e704 100644 --- a/sflphone-gtk/src/main.c +++ b/sflphone-gtk/src/main.c @@ -59,6 +59,8 @@ There is NO WARRANTY, to the extent permitted by law.\n\n"); } #endif + status_bar_display_account (); + /* start the main loop */ gtk_main (); } diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c index 9f0140ab2796b06a36d765c3e21c0ad79b44de24..f1628570a1a261433892e5b553e5e9bdebbc2120 100644 --- a/sflphone-gtk/src/menus.c +++ b/sflphone-gtk/src/menus.c @@ -201,6 +201,7 @@ switch_account( GtkWidget* item , gpointer data UNUSED) account_t* acc = g_object_get_data( G_OBJECT(item) , "account" ); g_print("%s\n" , acc->accountID); account_list_set_current_id( acc->accountID ); + status_bar_display_account (); } static void @@ -835,32 +836,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event) if(accounts) { - menu_items = gtk_separator_menu_item_new (); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items); - gtk_widget_show (menu_items); - - unsigned int i; - account_t* acc; - gchar* alias; - for( i = 0 ; i < account_list_get_size() ; i++ ){ - acc = account_list_get_nth(i); - // Display only the registered accounts - if( g_strcasecmp( account_state_name(acc -> state) , account_state_name(ACCOUNT_STATE_REGISTERED) ) == 0 ){ - alias = g_strconcat( g_hash_table_lookup(acc->properties , ACCOUNT_ALIAS) , " - ",g_hash_table_lookup(acc->properties , ACCOUNT_TYPE), NULL); - menu_items = gtk_check_menu_item_new_with_mnemonic(alias); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items); - g_object_set_data( G_OBJECT( menu_items ) , "account" , acc ); - g_free( alias ); - if( account_list_get_current() != NULL ){ - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items), - (g_strcasecmp( acc->accountID , account_list_get_current()->accountID) == 0)? TRUE : FALSE); - } - g_signal_connect (G_OBJECT (menu_items), "activate", - G_CALLBACK (switch_account), - NULL); - gtk_widget_show (menu_items); - } // fi - } + add_registered_accounts_to_menu (menu); } if (event) @@ -940,4 +916,95 @@ show_popup_menu_history(GtkWidget *my_widget, GdkEventButton *event) gtk_menu_attach_to_widget (GTK_MENU (menu), my_widget, NULL); gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, button, event_time); +} + + void +show_popup_menu_contacts(GtkWidget *my_widget, GdkEventButton *event) +{ + + gboolean pickup = FALSE; + gboolean remove = FALSE; + gboolean accounts = FALSE; + + call_t * selectedCall = calltab_get_selected_call( history ); + if (selectedCall) + { + remove = TRUE; + pickup = TRUE; + accounts = TRUE; + } + + GtkWidget *menu; + GtkWidget *image; + int button, event_time; + GtkWidget * menu_items; + + menu = gtk_menu_new (); + //g_signal_connect (menu, "deactivate", + // G_CALLBACK (gtk_widget_destroy), NULL); + + if(pickup) + { + + menu_items = gtk_image_menu_item_new_with_mnemonic(_("_New call")); + image = gtk_image_new_from_file( ICONS_DIR "/icon_accept.svg"); + gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( menu_items ), image ); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items); + g_signal_connect (G_OBJECT (menu_items), "activate",G_CALLBACK (call_back), NULL); + gtk_widget_show (menu_items); + } + + if(accounts) + { + add_registered_accounts_to_menu (menu); + } + + if (event) + { + button = event->button; + event_time = event->time; + } + else + { + button = 0; + event_time = gtk_get_current_event_time (); + } + + gtk_menu_attach_to_widget (GTK_MENU (menu), my_widget, NULL); + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, + button, event_time); +} + + +void add_registered_accounts_to_menu (GtkWidget *menu) { + + GtkWidget *menu_items; + unsigned int i; + account_t* acc; + gchar* alias; + + menu_items = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items); + gtk_widget_show (menu_items); + + for( i = 0 ; i < account_list_get_size() ; i++ ){ + acc = account_list_get_nth(i); + // Display only the registered accounts + if( g_strcasecmp( account_state_name(acc -> state) , account_state_name(ACCOUNT_STATE_REGISTERED) ) == 0 ){ + alias = g_strconcat( g_hash_table_lookup(acc->properties , ACCOUNT_ALIAS) , " - ",g_hash_table_lookup(acc->properties , ACCOUNT_TYPE), NULL); + menu_items = gtk_check_menu_item_new_with_mnemonic(alias); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items); + g_object_set_data( G_OBJECT( menu_items ) , "account" , acc ); + g_free( alias ); + if( account_list_get_current() != NULL ){ + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu_items), + (g_strcasecmp( acc->accountID , account_list_get_current()->accountID) == 0)? TRUE : FALSE); + } + g_signal_connect (G_OBJECT (menu_items), "activate", + G_CALLBACK (switch_account), + NULL); + gtk_widget_show (menu_items); + } // fi + } + } diff --git a/sflphone-gtk/src/menus.h b/sflphone-gtk/src/menus.h index 1d1efe53147c705e3110a323ab0f3f42226a7dbf..4944dd9664de754edc13ba124d567dec830064d1 100644 --- a/sflphone-gtk/src/menus.h +++ b/sflphone-gtk/src/menus.h @@ -49,4 +49,8 @@ void show_popup_menu (GtkWidget *my_widget, GdkEventButton *event); * @param event The mouse event */ void show_popup_menu_history (GtkWidget *my_widget, GdkEventButton *event); + +void show_popup_menu_contacts (GtkWidget *my_widget, GdkEventButton *event); + +void add_registered_accounts_to_menu (GtkWidget *menu); #endif diff --git a/sflphone-gtk/src/sflnotify.c b/sflphone-gtk/src/sflnotify.c index ebcccd38c548e8773ff83f293cb873e38d8220ff..2b86e308d9c14ef3c078ea9971573e0e02a9d434 100644 --- a/sflphone-gtk/src/sflnotify.c +++ b/sflphone-gtk/src/sflnotify.c @@ -182,7 +182,7 @@ notify_no_accounts( ) notify_notification_attach_to_status_icon( notification , get_status_icon() ); #endif notify_notification_set_timeout( notification , NOTIFY_EXPIRES_DEFAULT ); - notify_notification_add_action( notification , "setup" , _("Setup Accounts") , (NotifyActionCallback) setup_accounts_cb , NULL , NULL ); + //notify_notification_add_action( notification , "setup" , _("Setup Accounts") , (NotifyActionCallback) setup_accounts_cb , NULL , NULL ); if (!notify_notification_show (notification, NULL)) { g_print("notify(), failed to send notification\n"); @@ -223,7 +223,7 @@ notify_no_registered_accounts( ) notify_notification_attach_to_status_icon( notification , get_status_icon() ); #endif notify_notification_set_timeout( notification , NOTIFY_EXPIRES_DEFAULT ); - notify_notification_add_action( notification , "setup" , _("Setup Accounts") , (NotifyActionCallback) setup_accounts_cb , NULL , NULL ); + //notify_notification_add_action( notification , "setup" , _("Setup Accounts") , (NotifyActionCallback) setup_accounts_cb , NULL , NULL ); if (!notify_notification_show (notification, NULL)) { g_print("notify(), failed to send notification\n"); diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index b381c6181ce6a942173130251dde4741afc856c7..3e4aefe158b3de006c0f4fa069c6ec07705c7f98 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -864,8 +864,6 @@ void ManagerImpl::connectionStatusNotification( ) { if (_dbus) _dbus->getConfigurationManager()->accountsChanged(); - else - _debug("Error: DBus connection not found\n"); } /** diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 12e014016fd358f8b918f578e002b31cd833b11a..0bf0c72020d4918af2a2fd6bdbcbfd3ce9bf1971 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -1748,6 +1748,7 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam case PJSIP_SC_NOT_ACCEPTABLE_HERE: /* no compatible codecs */ case PJSIP_SC_NOT_ACCEPTABLE_ANYWHERE: case PJSIP_SC_UNSUPPORTED_MEDIA_TYPE: + case PJSIP_SC_UNAUTHORIZED: accId = Manager::instance().getAccountFromCall(call->getCallId()); link = dynamic_cast<SIPVoIPLink *> (Manager::instance().getAccountLink(accId)); if (link) {