~bcurtiswx/ubuntu/precise/empathy/3.4.2.1-0ubuntu1

« back to all changes in this revision

Viewing changes to src/empathy-event-manager.c

Tags: upstream-2.29.4
ImportĀ upstreamĀ versionĀ 2.29.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
  EventFunc func;
97
97
  gboolean inhibit;
98
98
  gpointer user_data;
 
99
  guint autoremove_timeout_id;
99
100
};
100
101
 
101
102
enum {
160
161
  g_free (event->public.header);
161
162
  g_free (event->public.message);
162
163
 
 
164
  if (event->autoremove_timeout_id != 0)
 
165
    g_source_remove (event->autoremove_timeout_id);
 
166
 
163
167
  if (event->public.contact)
164
168
    {
165
169
      g_object_unref (event->public.contact);
174
178
  EmpathyEventManagerPriv *priv = GET_PRIV (event->manager);
175
179
 
176
180
  DEBUG ("Removing event %p", event);
 
181
 
177
182
  priv->events = g_slist_remove (priv->events, event);
178
183
  g_signal_emit (event->manager, signals[EVENT_REMOVED], 0, event);
179
184
  event_free (event);
182
187
static gboolean
183
188
autoremove_event_timeout_cb (EventPriv *event)
184
189
{
 
190
  event->autoremove_timeout_id = 0;
185
191
  event_remove (event);
186
192
  return FALSE;
187
193
}
219
225
 
220
226
  if (!event->public.must_ack)
221
227
    {
222
 
      g_timeout_add_seconds (NOTIFICATION_TIMEOUT,
223
 
        (GSourceFunc) autoremove_event_timeout_cb, event);
 
228
      event->autoremove_timeout_id = g_timeout_add_seconds (
 
229
          NOTIFICATION_TIMEOUT, (GSourceFunc) autoremove_event_timeout_cb,
 
230
          event);
224
231
    }
225
232
}
226
233
 
319
326
  GtkWidget *dialog;
320
327
  GtkWidget *button;
321
328
  GtkWidget *image;
 
329
  EmpathyTpCall *call;
 
330
  gboolean video;
322
331
 
323
332
  if (event->approval->dialog != NULL)
324
333
    {
326
335
      return;
327
336
    }
328
337
 
 
338
  call = EMPATHY_TP_CALL (empathy_dispatch_operation_get_channel_wrapper (
 
339
        event->approval->operation));
 
340
 
 
341
  video = empathy_tp_call_has_initial_video (call);
 
342
 
329
343
  dialog = gtk_message_dialog_new (NULL, 0,
330
 
      GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Incoming call"));
 
344
      GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
 
345
      video ? _("Incoming video call"): _("Incoming call"));
 
346
 
331
347
  gtk_message_dialog_format_secondary_text (
332
 
    GTK_MESSAGE_DIALOG (dialog),
 
348
    GTK_MESSAGE_DIALOG (dialog), video ?
 
349
      _("%s is video calling you, do you want to answer?"):
333
350
      _("%s is calling you, do you want to answer?"),
334
351
      empathy_contact_get_name (event->approval->contact));
335
352
 
 
353
  /* Set image of the dialog */
 
354
  if (video)
 
355
    {
 
356
      image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_VIDEO_CALL,
 
357
          GTK_ICON_SIZE_DIALOG);
 
358
    }
 
359
  else
 
360
    {
 
361
      image = gtk_image_new_from_icon_name (EMPATHY_IMAGE_VOIP,
 
362
          GTK_ICON_SIZE_DIALOG);
 
363
    }
 
364
 
 
365
  gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image);
 
366
  gtk_widget_show (image);
 
367
 
336
368
  gtk_dialog_set_default_response (GTK_DIALOG (dialog),
337
369
      GTK_RESPONSE_OK);
338
370
 
451
483
{
452
484
  EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager);
453
485
  gchar *header;
454
 
 
455
 
  header = g_strdup_printf (_("Incoming call from %s"),
 
486
  EmpathyTpCall *call;
 
487
  gboolean video;
 
488
 
 
489
  call = EMPATHY_TP_CALL (empathy_dispatch_operation_get_channel_wrapper (
 
490
        approval->operation));
 
491
 
 
492
  video = empathy_tp_call_has_initial_video (call);
 
493
 
 
494
  header = g_strdup_printf (
 
495
    video ? _("Incoming video call from %s") :_("Incoming call from %s"),
456
496
    empathy_contact_get_name (approval->contact));
457
497
 
458
498
  event_manager_add (approval->manager, approval->contact,
459
 
      EMPATHY_EVENT_TYPE_VOIP, EMPATHY_IMAGE_VOIP, header, NULL, approval,
 
499
      EMPATHY_EVENT_TYPE_VOIP,
 
500
      video ? EMPATHY_IMAGE_VIDEO_CALL : EMPATHY_IMAGE_VOIP,
 
501
      header, NULL, approval,
460
502
      event_channel_process_voip_func, NULL);
461
503
 
462
504
  g_free (header);