int main(int args, char* argv[]){ //printf("%d", args); //printf("first %s second %s",argv[0],argv[1]); if(args==1){ printf("Incorrect number of command line arguments\n"); printf("Correct usage: ./a.out input file\n"); return -1; } Account accounts [MAX_ACCOUNTS]; int number=load_accounts(accounts,argv[1]); print(accounts,number); printf("After sorting:\n"); sort(accounts,number); print(accounts,number); //printf("Enter a rating to search for: "); //int key; //scanf("%d",&key); //Account* accountFound=find_account(accounts,0,2,key); //printf("result is %.2f\n",accountFound->balance); //printf("result is %.2f\n",(*accountFound).balance); run_transactions(accounts,number,argv[2]); printf("Final balance sheet:\n"); print(accounts,number); return 0; }
static void tny_olpc_account_store_get_accounts (TnyAccountStore *self, TnyList *list, TnyGetAccountsRequestType types) { TnyOlpcAccountStorePriv *priv = TNY_OLPC_ACCOUNT_STORE_GET_PRIVATE (self); g_assert (TNY_IS_LIST (list)); if (!priv->accounts) load_accounts (self); if (priv->accounts) { GList *copy = priv->accounts; while (copy) { TnyAccount *account = copy->data; if (types == TNY_ACCOUNT_STORE_BOTH || types == TNY_ACCOUNT_STORE_STORE_ACCOUNTS) { if (TNY_IS_STORE_ACCOUNT (account)) tny_list_prepend (list, (GObject*)account); } if (types == TNY_ACCOUNT_STORE_BOTH || types == TNY_ACCOUNT_STORE_TRANSPORT_ACCOUNTS) { if (TNY_IS_TRANSPORT_ACCOUNT (account)) tny_list_prepend (list, (GObject*)account); } copy = g_list_next (copy); } } return; }
static TnyAccount* tny_olpc_account_store_find_account (TnyAccountStore *self, const gchar *url_string) { TnyOlpcAccountStorePriv *priv = TNY_OLPC_ACCOUNT_STORE_GET_PRIVATE (self); TnyAccount *found = NULL; if (!priv->accounts) load_accounts (self); if (priv->accounts) { GList *copy = priv->accounts; while (copy) { TnyAccount *account = copy->data; if (tny_account_matches_url_string (account, url_string)) { found = TNY_ACCOUNT (g_object_ref (G_OBJECT (account))); break; } copy = g_list_next (copy); } } return found; }
static void mc_startup(MailComponent *mc) { static int started = 0; GConfClient *gconf; if (started) return; started = 1; mc_setup_local_store(mc); load_accounts(mc, mail_config_get_accounts()); gconf = mail_config_get_gconf_client(); if (gconf_client_get_bool (gconf, "/apps/evolution/mail/display/enable_vfolders", NULL)) vfolder_load_storage(); }
/* Callback for OK button */ static void ok_callback(GtkWidget *widget, gpointer data) { FILE *fp; char buff[1024]; LList *saved_acc_info = NULL, *acc_walk = NULL, *to_remove = NULL; if (gtk_entry_get_text(GTK_ENTRY(username)) != NULL && strlen(gtk_entry_get_text(GTK_ENTRY(username))) > 0 && num_accounts == 0) { add_callback(widget, data); } g_snprintf(buff, 1024, "%saccounts", config_dir); fp = fdopen(creat(buff, 0700), "w"); if (num_accounts == 0) { ay_do_error(_("Invalid Account"), _("You didn't define an account.")); return; } eb_sign_off_all(); gtk_tree_model_foreach(GTK_TREE_MODEL(account_list_store), save_accounts, fp); fclose(fp); saved_acc_info = ay_save_account_information(-1); acc_walk = accounts; if (acc_walk) { while (acc_walk != NULL && acc_walk->data != NULL) { if (!l_list_find(existing_accounts, acc_walk->data)) { eb_local_account *removed = (eb_local_account *)(acc_walk->data); /* removed account */ if (removed && removed->connected && RUN_SERVICE(removed)->logout != NULL) RUN_SERVICE(removed)->logout(removed); to_remove = l_list_append(to_remove, acc_walk->data); } acc_walk = acc_walk->next; } for (acc_walk = to_remove; acc_walk && acc_walk->data; acc_walk = acc_walk->next) accounts = l_list_remove(accounts, acc_walk->data); l_list_free(to_remove); } acc_walk = new_accounts; if (acc_walk) { while (acc_walk != NULL) { accounts = l_list_append(accounts, acc_walk->data); acc_walk = acc_walk->next; } } gtk_widget_destroy(account_window); load_accounts(); rebuild_set_status_menu(); set_menu_sensitivity(); ay_restore_account_information(saved_acc_info); l_list_free(saved_acc_info); }