empathy r1346 - trunk/src
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r1346 - trunk/src
- Date: Mon, 18 Aug 2008 21:36:50 +0000 (UTC)
Author: xclaesse
Date: Mon Aug 18 21:36:49 2008
New Revision: 1346
URL: http://svn.gnome.org/viewvc/empathy?rev=1346&view=rev
Log:
If adding a an account that is already in the treeview, simply update values. That happens when an account becomes valid
Modified:
trunk/src/empathy-accounts-dialog.c
Modified: trunk/src/empathy-accounts-dialog.c
==============================================================================
--- trunk/src/empathy-accounts-dialog.c (original)
+++ trunk/src/empathy-accounts-dialog.c Mon Aug 18 21:36:49 2008
@@ -114,7 +114,7 @@
static gboolean accounts_dialog_model_remove_selected (EmpathyAccountsDialog *dialog);
static void accounts_dialog_model_selection_changed (GtkTreeSelection *selection,
EmpathyAccountsDialog *dialog);
-static void accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
+static void accounts_dialog_add_or_update_account (EmpathyAccountsDialog *dialog,
McAccount *account);
static void accounts_dialog_account_added_cb (McAccountMonitor *monitor,
gchar *unique_name,
@@ -596,8 +596,8 @@
}
static void
-accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
- McAccount *account)
+accounts_dialog_add_or_update_account (EmpathyAccountsDialog *dialog,
+ McAccount *account)
{
GtkTreeModel *model;
GtkTreeIter iter;
@@ -605,26 +605,23 @@
const gchar *name;
gboolean enabled;
- if (accounts_dialog_get_account_iter (dialog, account, &iter)) {
- return;
- }
-
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview));
status = mission_control_get_connection_status (dialog->mc, account, NULL);
name = mc_account_get_display_name (account);
enabled = mc_account_is_enabled (account);
- g_return_if_fail (name != NULL);
+ if (!accounts_dialog_get_account_iter (dialog, account, &iter)) {
+ DEBUG ("Adding new account");
+ gtk_list_store_append (GTK_LIST_STORE (model), &iter);
+ }
- DEBUG ("Adding new account: %s", name);
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ COL_ENABLED, enabled,
+ COL_NAME, name,
+ COL_STATUS, status,
+ COL_ACCOUNT_POINTER, account,
+ -1);
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (dialog->treeview));
- gtk_list_store_insert_with_values (GTK_LIST_STORE (model), &iter,
- -1,
- COL_ENABLED, enabled,
- COL_NAME, name,
- COL_STATUS, status,
- COL_ACCOUNT_POINTER, account,
- -1);
accounts_dialog_status_changed_cb (dialog->mc,
status,
MC_PRESENCE_UNSET,
@@ -641,7 +638,7 @@
McAccount *account;
account = mc_account_lookup (unique_name);
- accounts_dialog_add_account (dialog, account);
+ accounts_dialog_add_or_update_account (dialog, account);
g_object_unref (account);
}
@@ -811,7 +808,7 @@
}
}
- accounts_dialog_add_account (dialog, account);
+ accounts_dialog_add_or_update_account (dialog, account);
accounts_dialog_model_set_selected (dialog, account);
g_object_unref (account);
@@ -1077,7 +1074,7 @@
/* Add existing accounts */
accounts = mc_accounts_list ();
for (l = accounts; l; l = l->next) {
- accounts_dialog_add_account (dialog, l->data);
+ accounts_dialog_add_or_update_account (dialog, l->data);
g_object_unref (l->data);
}
g_list_free (accounts);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]