コード例 #1
0
ファイル: opal-bank.cpp プロジェクト: Klom/ekiga
bool
Opal::Bank::populate_menu (Ekiga::PresentityPtr presentity,
			   const std::string uri,
			   Ekiga::MenuBuilder& builder)
{
  return populate_menu_helper (presentity->get_name (), uri, builder);
}
コード例 #2
0
ファイル: heap-view.cpp プロジェクト: Pobegunchik/ekiga
static void
on_presentity_added (HeapView* self,
		     Ekiga::PresentityPtr presentity)
{
  GtkTreeIter group_iter;
  GtkTreeIter iter;
  std::set<std::string> groups = presentity->get_groups ();
  GtkTreeSelection* selection = gtk_tree_view_get_selection (self->priv->view);
  bool should_emit = false;

  if (groups.empty ())
    groups.insert (_("Unsorted"));

  for (std::set<std::string>::const_iterator group = groups.begin ();
       group != groups.end (); ++group) {

    find_iter_for_group (self, group->c_str (), &group_iter);
    find_iter_for_presentity (self, presentity.get (), &group_iter, &iter);

    if (gtk_tree_selection_iter_is_selected (selection, &iter))
      should_emit = true;

    gtk_tree_store_set (self->priv->store, &iter,
			COLUMN_TYPE, TYPE_PRESENTITY,
			COLUMN_PRESENTITY, presentity.get (),
			COLUMN_NAME, presentity->get_name ().c_str (),
			COLUMN_PRESENCE, presentity->get_presence ().c_str (),
			COLUMN_STATUS, presentity->get_status ().c_str (),
			-1);
  }

  if (should_emit)
    g_signal_emit (self, signals[SELECTION_CHANGED_SIGNAL], 0);
}
コード例 #3
0
ファイル: roster-view-gtk.cpp プロジェクト: NpNike/ekiga
static void
on_presentity_added (RosterViewGtk* self,
		     G_GNUC_UNUSED Ekiga::ClusterPtr cluster,
		     Ekiga::HeapPtr heap,
		     Ekiga::PresentityPtr presentity)
{
  GtkTreeIter heap_iter;
  std::set<std::string> groups = presentity->get_groups ();
  GtkTreeSelection* selection = gtk_tree_view_get_selection (self->priv->tree_view);
  GtkTreeModelFilter* filtered_model = GTK_TREE_MODEL_FILTER (gtk_tree_view_get_model (self->priv->tree_view));
  GtkTreeIter group_iter;
  GtkTreeIter iter;
  GtkTreeIter filtered_iter;
  bool active = false;
  bool away = false;
  guint timeout = 0;
  std::string status;
  gchar *old_presence = NULL;
  gboolean should_emit = FALSE;

  roster_view_gtk_find_iter_for_heap (self, heap, &heap_iter);

  active = presentity->get_presence () != "offline";
  away = presentity->get_presence () == "away";

  if (groups.empty ())
    groups.insert (_("Unsorted"));

  for (std::set<std::string>::const_iterator group = groups.begin ();
       group != groups.end ();
       group++) {

    roster_view_gtk_find_iter_for_group (self, heap, &heap_iter,
					 *group, &group_iter);
    roster_view_gtk_find_iter_for_presentity (self, &group_iter, presentity, &iter);

    if (gtk_tree_model_filter_convert_child_iter_to_iter (filtered_model, &filtered_iter, &iter))
      if (gtk_tree_selection_iter_is_selected (selection, &filtered_iter))
	should_emit = TRUE;

    // Find out what our presence was
    gtk_tree_model_get (GTK_TREE_MODEL (self->priv->store), &iter,
                        COLUMN_PRESENCE, &old_presence, -1);

    if (old_presence && presentity->get_presence () != old_presence
        && presentity->get_presence () != "unknown" && presentity->get_presence () != "offline"
        && (!g_strcmp0 (old_presence, "unknown") || !g_strcmp0 (old_presence, "offline"))) {

      StatusIconInfo *info = new StatusIconInfo ();
      info->model = GTK_TREE_MODEL (self->priv->store);
      info->iter = gtk_tree_iter_copy (&iter);
      info->cpt = 0;

      timeout = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, 1, roster_view_gtk_icon_blink_cb,
                                            (gpointer) info, (GDestroyNotify) status_icon_info_delete);
      gtk_tree_store_set (self->priv->store, &iter,
                          COLUMN_TIMEOUT, timeout, -1);
    }
    else {

      std::string icon = "avatar-default";
      if (!old_presence) {
        gtk_tree_store_set (self->priv->store, &iter,
                            COLUMN_PRESENCE_ICON, icon.c_str (),
                            -1);
      }
      else if (old_presence != presentity->get_presence ()) {
        if (presentity->get_presence () != "unknown")
          icon = "user-" + presentity->get_presence ();
        gtk_tree_store_set (self->priv->store, &iter,
                            COLUMN_PRESENCE_ICON, icon.c_str (),
                            -1);
      }
    }
    status = presentity->get_status ();
    if (status.empty ()) {
      if (presentity->get_presence () == "away")
        status = _("Away");
      else if (presentity->get_presence () == "available")
        status = _("Available");
      else if (presentity->get_presence () == "offline")
        status = _("Offline");
      else if (presentity->get_presence () == "busy")
        status = _("Busy");
    }
    gtk_tree_store_set (self->priv->store, &iter,
                        COLUMN_TYPE, TYPE_PRESENTITY,
                        COLUMN_OFFLINE, active,
                        COLUMN_HEAP, heap.get (),
                        COLUMN_PRESENTITY, presentity.get (),
                        COLUMN_NAME, presentity->get_name ().c_str (),
                        COLUMN_STATUS, status.c_str (),
                        COLUMN_PRESENCE, presentity->get_presence ().c_str (),
                        COLUMN_ACTIVE, (!active || away) ? "gray" : "black", -1);
    gtk_tree_model_get (GTK_TREE_MODEL (self->priv->store), &iter,
                        COLUMN_TIMEOUT, &timeout,
                        -1);

    g_free (old_presence);
  }

  GtkTreeModel* model = gtk_tree_view_get_model (self->priv->tree_view);
  gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));

  roster_view_gtk_update_groups (self, &heap_iter);

  if (should_emit)
    g_signal_emit (self, signals[SELECTION_CHANGED_SIGNAL], 0);
}