Exemplo n.º 1
0
static void
on_account_updated (Ekiga::AccountPtr account,
                    gpointer data)
{
  g_return_if_fail (EKIGA_IS_WINDOW (data));

  EkigaWindow *self = EKIGA_WINDOW (data);
  gchar *msg = NULL;

  switch (account->get_state ()) {
  case Ekiga::Account::RegistrationFailed:
  case Ekiga::Account::UnregistrationFailed:
    msg = g_strdup_printf ("%s: %s",
                           account->get_name ().c_str (),
                           account->get_status ().c_str ());

    gm_info_bar_push_message (GM_INFO_BAR (self->priv->info_bar),
                              GTK_MESSAGE_ERROR, msg);

    g_free (msg);
    break;

  case Ekiga::Account::Processing:
  case Ekiga::Account::Registered:
  case Ekiga::Account::Unregistered:
  default:
    break;
  }
}
Exemplo n.º 2
0
void
gm_accounts_window_update_account (GtkWidget *accounts_window,
                                   Ekiga::AccountPtr account)
{
  std::string presence_icon;
  GtkTreeModel *model = NULL;
  GtkTreeSelection *selection = NULL;

  GtkTreeIter iter;
  Ekiga::Account *caccount = NULL;

  g_return_if_fail (accounts_window != NULL);
  AccountsWindow *self = ACCOUNTS_WINDOW (accounts_window);

  /* on the one end we update the view */
  model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->accounts_list));

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

    do {

      gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
			  COLUMN_ACCOUNT, &caccount, -1);

      if (caccount == account.get ()) {

        presence_icon =  account->is_enabled () ? ("user-" + self->priv->presence) : "user-offline";
        gtk_list_store_set (GTK_LIST_STORE (model), &iter,
                            COLUMN_ACCOUNT, account.get (),
                            COLUMN_ACCOUNT_ICON, presence_icon.c_str (),
			    COLUMN_ACCOUNT_IS_ENABLED, account->is_enabled (),
                            COLUMN_ACCOUNT_WEIGHT, account->is_enabled () ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
                            COLUMN_ACCOUNT_ACCOUNT_NAME, account->get_name ().c_str (),
			    COLUMN_ACCOUNT_STATUS, account->get_status ().c_str (),
                            -1);
        break;
      }
    } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
  }

  /* on the other end, if the updated account is the one which is selected,
   * we update the actions on it
   */
  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->accounts_list));
  if (gtk_tree_selection_get_selected (selection, &model, &iter)) {

    gtk_tree_model_get (model, &iter,
                        COLUMN_ACCOUNT, &caccount,
                        -1);

    if (caccount == account.get ()) {

      self->priv->toolbar.reset ();
      account->populate_menu (self->priv->toolbar);
      populate_menu (accounts_window);
    }
  }
}
Exemplo n.º 3
0
void
gm_accounts_window_remove_account (GtkWidget *accounts_window,
                                   Ekiga::AccountPtr account)
{
  Ekiga::Account *caccount = NULL;

  GtkTreeModel *model = NULL;

  GtkTreeIter iter;

  g_return_if_fail (accounts_window != NULL);
  AccountsWindow *self = ACCOUNTS_WINDOW (accounts_window);

  model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->accounts_list));

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

    do {

      gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
			  COLUMN_ACCOUNT, &caccount, -1);

      if (caccount == account.get ()) {

        gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
        break;
      }
    } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
  }
}
Exemplo n.º 4
0
static void
gm_accounts_window_add_account (GtkWidget *window,
                                Ekiga::AccountPtr account)
{
  std::string presence_icon;
  GtkTreeModel *model = NULL;

  GtkTreeIter iter;

  g_return_if_fail (window != NULL);
  AccountsWindow *self = ACCOUNTS_WINDOW (window);

  model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->accounts_list));

  presence_icon =  account->is_enabled () ? ("user-" + self->priv->presence) : "user-offline";
  gtk_list_store_append (GTK_LIST_STORE (model), &iter);
  gtk_list_store_set (GTK_LIST_STORE (model), &iter,
                      COLUMN_ACCOUNT, account.get (),
		      COLUMN_ACCOUNT_ICON, presence_icon.c_str (),
		      COLUMN_ACCOUNT_IS_ENABLED, account->is_enabled (),
                      COLUMN_ACCOUNT_WEIGHT, account->is_enabled () ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL,
                      COLUMN_ACCOUNT_ACCOUNT_NAME, account->get_name ().c_str (),
                      -1);
}