static void update_account_list (DialogData *data) { int current_account_idx; OAuthAccount *current_account; int idx; GList *scan; GtkTreeIter iter; gtk_list_store_clear (GTK_LIST_STORE (GET_WIDGET ("account_liststore"))); current_account_idx = 0; current_account = web_service_get_current_account (WEB_SERVICE (data->service)); for (scan = web_service_get_accounts (WEB_SERVICE (data->service)), idx = 0; scan; scan = scan->next, idx++) { OAuthAccount *account = scan->data; if ((current_account != NULL) && (g_strcmp0 (current_account->id, account->id) == 0)) current_account_idx = idx; gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter); gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter, ACCOUNT_DATA_COLUMN, account, ACCOUNT_NAME_COLUMN, account->name, -1); } gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("account_combobox")), current_account_idx); }
static void update_account_list (DialogData *data) { int current_account_idx; OAuthAccount *current_account; int idx; GList *scan; GtkTreeIter iter; char *free_space; gtk_list_store_clear (GTK_LIST_STORE (GET_WIDGET ("account_liststore"))); current_account_idx = 0; current_account = web_service_get_current_account (WEB_SERVICE (data->service)); for (scan = web_service_get_accounts (WEB_SERVICE (data->service)), idx = 0; scan; scan = scan->next, idx++) { OAuthAccount *account = scan->data; if (oauth_account_cmp (current_account, account) == 0) current_account_idx = idx; gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter); gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter, ACCOUNT_DATA_COLUMN, account, ACCOUNT_NAME_COLUMN, account->name, -1); } gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("account_combobox")), current_account_idx); free_space = g_format_size (FLICKR_ACCOUNT (current_account)->max_bandwidth - FLICKR_ACCOUNT (current_account)->used_bandwidth); gtk_label_set_text (GTK_LABEL (GET_WIDGET ("free_space_label")), free_space); g_free (free_space); }