]> sjero.net Git - linphone/commitdiff
fix unauthenticated call messages, implement transfer in gtk
authorSimon Morlat <simon.morlat@linphone.org>
Wed, 19 Jan 2011 12:17:09 +0000 (13:17 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Wed, 19 Jan 2011 12:17:09 +0000 (13:17 +0100)
coreapi/sal_eXosip2.c
gtk/incall_view.c
gtk/linphone.h
gtk/main.c
gtk/main.ui

index 315c566a6db5566d38a1c7b431f944948677b7d0..6cadde1cefb10e582afdd6ef1df269e1ef0b81a0 100644 (file)
@@ -1702,7 +1702,7 @@ static bool_t process_event(Sal *sal, eXosip_event_t *ev){
                        call_message_new(sal,ev);
                        break;
                case EXOSIP_CALL_MESSAGE_REQUESTFAILURE:
-                       if (ev->did<0 && ev->response &&
+                       if (ev->response &&
                                (ev->response->status_code==407 || ev->response->status_code==401)){
                                 return process_authentication(sal,ev);
                        }
index 83df3a44754075406dc1fae01f37c2db19b25a82..6cf5d58bd9ce7d250cba34d662e47ff318590f3a 100644 (file)
@@ -58,7 +58,7 @@ static GtkWidget *make_tab_header(int number){
        GtkWidget *w=gtk_hbox_new (FALSE,0);
        GtkWidget *i=create_pixmap ("status-green.png");
        GtkWidget *l;
-       gchar *text=g_strdup_printf("Call %i",number);
+       gchar *text=g_strdup_printf("Call #%i",number);
        l=gtk_label_new (text);
        gtk_box_pack_start (GTK_BOX(w),i,FALSE,FALSE,0);
        gtk_box_pack_end(GTK_BOX(w),l,TRUE,TRUE,0);
@@ -66,6 +66,60 @@ static GtkWidget *make_tab_header(int number){
        return w;
 }
 
+static void linphone_gtk_transfer_call(LinphoneCall *dest_call){
+       LinphoneCall *call=linphone_gtk_get_currently_displayed_call();
+       linphone_core_transfer_call_to_another (linphone_gtk_get_core(),call,dest_call);
+}
+
+static void transfer_button_clicked(GtkWidget *button, gpointer call_ref){
+       GtkWidget *menu_item;
+       GtkWidget *menu=gtk_menu_new();
+       LinphoneCall *call=(LinphoneCall*)call_ref;
+       LinphoneCore *lc=linphone_gtk_get_core();
+       const MSList *elem=linphone_core_get_calls(lc);
+       
+       for(;elem!=NULL;elem=elem->next){
+               LinphoneCall *other_call=(LinphoneCall*)elem->data;
+               GtkWidget *call_view=(GtkWidget*)linphone_call_get_user_pointer(other_call);
+               if (other_call!=call){
+                       int call_index=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(call_view),"call_index"));
+                       char *remote_uri=linphone_call_get_remote_address_as_string (call);
+                       char *text=g_strdup_printf("Transfer to call #%i with %s",call_index,remote_uri);
+                       menu_item=gtk_image_menu_item_new_with_label(text);
+                       ms_free(remote_uri);
+                       g_free(text);
+                       gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),create_pixmap("status-green.png"));
+                       gtk_widget_show(menu_item);
+                       gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
+                       g_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_transfer_call,other_call);
+               }
+       }
+       gtk_menu_popup(GTK_MENU(menu),NULL,NULL,NULL,NULL,0,
+               gtk_get_current_event_time());
+       gtk_widget_show(menu);
+}
+
+void linphone_gtk_enable_transfer_button(LinphoneCore *lc, gboolean value){
+       const MSList *elem=linphone_core_get_calls(lc);
+       for(;elem!=NULL;elem=elem->next){
+               LinphoneCall *call=(LinphoneCall*)elem->data;
+               GtkWidget *call_view=(GtkWidget*)linphone_call_get_user_pointer(call);
+               GtkWidget *box=linphone_gtk_get_widget (call_view,"mute_pause_buttons");
+               GtkWidget *button=(GtkWidget*)g_object_get_data(G_OBJECT(box),"transfer");
+               if (button && value==FALSE){
+                       gtk_widget_destroy(button);
+                       button=NULL;
+               }else if (!button && value==TRUE){
+                       button=gtk_button_new_with_label (_("Transfer"));
+                       gtk_button_set_image(GTK_BUTTON(button),gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD,GTK_ICON_SIZE_BUTTON));
+                       g_signal_connect(G_OBJECT(button),"clicked",(GCallback)transfer_button_clicked,call);
+                       gtk_widget_show_all(button);
+                       gtk_container_add(GTK_CONTAINER(box),button);
+               }
+               g_object_set_data(G_OBJECT(box),"transfer",button);
+       }
+}
+
 void linphone_gtk_create_in_call_view(LinphoneCall *call){
        GtkWidget *call_view=linphone_gtk_create_widget("main","in_call_frame");
        GtkWidget *main_window=linphone_gtk_get_main_window ();
@@ -78,6 +132,8 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){
                call_index=1;
        }
        g_object_set_data(G_OBJECT(call_view),"call",call);
+       g_object_set_data(G_OBJECT(call_view),"call_index",GINT_TO_POINTER(call_index));
+
        linphone_call_set_user_pointer (call,call_view);
        linphone_call_ref(call);
        gtk_notebook_append_page (notebook,call_view,make_tab_header(call_index));
index 70e1d5dc4545a93dcc632d4c99cba1dca0016e12..faa2cb5ed3a10eff8417d8f8a1a76ff0802af7d3 100644 (file)
@@ -97,6 +97,7 @@ void linphone_gtk_in_call_view_set_incoming(LinphoneCall *call, bool_t with_paus
 void linphone_gtk_in_call_view_set_paused(LinphoneCall *call);
 void linphone_gtk_enable_mute_button(GtkButton *button, gboolean sensitive);
 void linphone_gtk_enable_hold_button(LinphoneCall *call, gboolean sensitive, gboolean holdon);
+void linphone_gtk_enable_transfer_button(LinphoneCore *lc, gboolean value);
 
 void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg);
 void linphone_gtk_exit_login_frame(void);
index f88f9cfcda2807d6040733b7804255956b0d181b..643f948d9adb2e11e2e0a52067c96181e3e3e5f3 100644 (file)
@@ -689,6 +689,7 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){
        bool_t start_active=TRUE;
        bool_t stop_active=FALSE;
        bool_t add_call=FALSE;
+       int call_list_size=ms_list_size(calls);
        
        if (calls==NULL){
                start_active=TRUE;
@@ -699,7 +700,7 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){
                        start_active=TRUE;
                        add_call=TRUE;
                }else if (call!=NULL && linphone_call_get_state(call)==LinphoneCallIncomingReceived && all_other_calls_paused(call,calls)){
-                       if (ms_list_size(calls)>1){
+                       if (call_list_size>1){
                                start_active=TRUE;
                                add_call=TRUE;
                        }else{
@@ -724,6 +725,7 @@ static void linphone_gtk_update_call_buttons(LinphoneCall *call){
                                GTK_BUTTON(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"main_mute")),
                        FALSE);
        }
+       linphone_gtk_enable_transfer_button(lc,call_list_size>1);
        update_video_title();
 }
 
index a2c717df58e86ad65c275902c278959a0c0672ba..4f3e6797ad1d8edbfe9f709354ed7aaab61f65e2 100644 (file)
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
                     <property name="position">2</property>
                   </packing>
                 </child>