以同理心自动接听电话

时间:2011-07-28 05:19:09

标签: c++

我需要自定义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;
}

任何人都可以帮我解决这个问题吗?

2 个答案:

答案 0 :(得分:1)

尝试以下方法:

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

答案 1 :(得分: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);

}

datz all needed。>>>>>!

tanx mike