2011-07-28 48 views
0

我需要自定義Empathy 2.28,以便當來電到達時,它會自動接受,而無需窗口。代碼部分如下:自動接受同理電話

static void 
event_channel_process_voip_func (EventPriv *event) 
{ 
    GtkWidget *dialog; 
    GtkWidget *button; 
    GtkWidget *image; 

    if (event->approval->dialog != NULL) 
    { 
     gtk_window_present (GTK_WINDOW (event->approval->dialog)); 
     return; 
    } 

    dialog = gtk_message_dialog_new (NULL, 0, 
     GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Incoming call")); 
    gtk_message_dialog_format_secondary_text (
    GTK_MESSAGE_DIALOG (dialog), 
     _("%s is calling you, do you want to answer?"), 
     empathy_contact_get_name (event->approval->contact)); 

    gtk_dialog_set_default_response (GTK_DIALOG (dialog), 
     GTK_RESPONSE_OK); 

    button = gtk_dialog_add_button (GTK_DIALOG (dialog), 
     _("_Reject"), GTK_RESPONSE_REJECT); 
    image = gtk_image_new_from_icon_name (GTK_STOCK_CANCEL, 
    GTK_ICON_SIZE_BUTTON); 
    gtk_button_set_image (GTK_BUTTON (button), image); 

    button = gtk_dialog_add_button (GTK_DIALOG (dialog), 
     _("_Answer"), GTK_RESPONSE_ACCEPT); 

    image = gtk_image_new_from_icon_name (GTK_STOCK_APPLY, GTK_ICON_SIZE_BUTTON); 
    gtk_button_set_image (GTK_BUTTON (button), image); 

    g_signal_connect (dialog, "response", 
     G_CALLBACK (event_manager_call_window_confirmation_dialog_response_cb), 
     event->approval); 

    gtk_widget_show (dialog); 

    event->approval->dialog = dialog; 
} 

任何人都可以幫我解決這個問題嗎?

回答

1

嘗試以下操作:

static void 
event_channel_process_voip_func (EventPriv *event) 
{ 
    empathy_call_factory_claim_channel(empathy_call_factory_get(), 
             GTK_RESPONSE_ACCEPT); 
} 
+0

tanx先生,但它不工作。我可以kn wat dis_ call_factory_claim_channel()是爲了什麼?先生,還有其他解決問題的方法嗎? – levisantony

1
static void 
event_channel_process_voip_func (EventPriv *event) 
{ 
     EmpathyCallFactory *factory = empathy_call_factory_get(); 
     empathy_call_factory_claim_channel (factory, event->approval->operation); 

} 

道茨所有需要>>>>>!

tanx mike