예제 #1
0
void
daemon_note_show(Daemon_Data *d, E_Notification *n)
{
  e_notification_ref(n);
  d->open_notes = eina_list_append(d->open_notes, n); 
  e_notification_ref(n);
  d->history = eina_list_append(d->history, n); 

  // adjust history
  if ((int) eina_list_count(d->history) > d->max_history_length)
  {
    E_Notification *old;
    old = eina_list_data_get(d->history);
    d->history = eina_list_remove_list(d->history, d->history);
    d->history_start = e_notification_id_get(old) + 1;
    e_notification_unref(old);
  }

  {
    int timeout;

    timeout = e_notification_timeout_get(n);
    Timer_Data *td = calloc(1, sizeof(Timer_Data));
    td->d = d;
    e_notification_ref(n);
    td->n = n;
    ecore_timer_add(timeout == -1 ? d->default_timeout : (float)timeout / 1000, cb_note_close_timer, td);
  }

  printf("Received notification from %s:\n%s\n%s\n\n", 
    e_notification_app_name_get(n),
    e_notification_summary_get(n), e_notification_body_get(n)
  );
}
예제 #2
0
static unsigned int
_notification_notify(E_Notification *n)
{
   const char *appname;
   unsigned int replaces_id, new_id;
   int popuped;

   if (e_desklock_state_get()) return 0;
   appname = e_notification_app_name_get(n);
   replaces_id = e_notification_replaces_id_get(n);
   if (replaces_id) new_id = replaces_id;
   else new_id = notification_cfg->next_id++;

   e_notification_id_set(n, new_id);

   popuped = notification_popup_notify(n, replaces_id, appname);
   if (!popuped)
     {
        e_notification_hint_urgency_set(n, 4);
        notification_popup_notify(n, replaces_id, appname);
     }

   return new_id;
}