Beispiel #1
0
/* react to a new call being inserted in history */
static void
on_contact_added (Ekiga::ContactPtr contact,
                  GtkListStore *store)
{
  time_t t;
  struct tm *timeinfo = NULL;
  char buffer [80];
  std::stringstream info;
  std::string id;

  boost::shared_ptr<History::Contact> hcontact = boost::dynamic_pointer_cast<History::Contact> (contact);
  GtkTreeIter iter;

  if (hcontact) {

    switch (hcontact->get_type ()) {

    case History::RECEIVED:
      id = "go-previous-symbolic";
      break;

    case History::PLACED:
      id = "go-next-symbolic";
      break;

    case History::MISSED:
      id = "call-missed-symbolic";
      break;

    default:
      break;
    }
  }

  gtk_list_store_prepend (store, &iter);
  t = hcontact->get_call_start ();
  timeinfo = localtime (&t);
  if (timeinfo != NULL) {
    strftime (buffer, 80, "%x %X", timeinfo);
    info << buffer;
    if (!hcontact->get_call_duration ().empty ())
      info << " (" << hcontact->get_call_duration () << ")";
    else
      gtk_list_store_set (store, &iter,
                          COLUMN_ERROR_PIXBUF, "error",
                          -1);
  }
  else
    info << hcontact->get_call_duration ();

  gtk_list_store_set (store, &iter,
                      COLUMN_CONTACT, contact.get (),
                      COLUMN_PIXBUF, id.c_str (),
                      COLUMN_NAME, contact->get_name ().c_str (),
                      COLUMN_INFO, info.str ().c_str (),
                      -1);
}
Beispiel #2
0
bool
Opal::Bank::populate_menu (Ekiga::ContactPtr contact,
			   const std::string uri,
			   Ekiga::MenuBuilder& builder)
{
  return populate_menu_helper (contact->get_name (), uri, builder);
}
Beispiel #3
0
static gboolean
book_view_gtk_find_iter_for_contact (BookViewGtk *view,
                                     Ekiga::ContactPtr contact,
                                     GtkTreeIter *iter)
{
  GtkTreeModel *model = NULL;
  gboolean found = FALSE;

  model = gtk_tree_view_get_model (view->priv->tree_view);

  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), iter)) {

    do {

      Ekiga::Contact *iter_contact = NULL;
      gtk_tree_model_get (model, iter,
                          COLUMN_CONTACT_POINTER, &iter_contact,
                          -1);
      if (iter_contact == contact.get ())
        found = TRUE;

    } while (!found && gtk_tree_model_iter_next (model, iter));
  }

  return found;
}
Beispiel #4
0
/* Implementation of the static functions */
static void
book_view_gtk_add_contact (BookViewGtk *self,
                           Ekiga::ContactPtr contact)
{
  GtkTreeModel *model = NULL;
  GtkListStore *store = NULL;
  GtkTreeIter iter;

  model = gtk_tree_view_get_model (self->priv->tree_view);
  store = GTK_LIST_STORE (model);

  gtk_list_store_append (store, &iter);
  gtk_list_store_set (store, &iter, COLUMN_CONTACT_POINTER, contact.get (), -1);
  book_view_gtk_update_contact (self, contact, &iter);
}
Beispiel #5
0
static void
book_view_gtk_update_contact (BookViewGtk *self,
			      Ekiga::ContactPtr contact,
			      GtkTreeIter *iter)
{
  GtkListStore *store = NULL;
  GdkPixbuf *pixbuf = NULL;

  store = GTK_LIST_STORE (gtk_tree_view_get_model (self->priv->tree_view));
  pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
                                     "avatar-default",
                                     GTK_ICON_SIZE_MENU, (GtkIconLookupFlags) 0, NULL);
  gtk_list_store_set (store, iter,
                      COLUMN_PIXBUF, pixbuf,
		      COLUMN_NAME, contact->get_name ().c_str (),
		      -1);
  if (pixbuf)
    g_object_unref (pixbuf);
}
Beispiel #6
0
bool
Local::ContactDecorator::populate_menu (Ekiga::ContactPtr contact,
					const std::string uri,
					Ekiga::MenuBuilder &builder)
{
  bool populated = false;

  if (cluster->is_supported_uri (uri)) {

    HeapPtr heap(cluster->get_heap ());

    if (!heap->has_presentity_with_uri (uri)) {

      builder.add_action ("add", _("Add to local roster"),
			  boost::bind (&Local::Heap::new_presentity, heap.get (),
			  contact->get_name (), uri));
      populated = true;
    }
  }

  return populated;
}