/******************************************************* * csv_export_account_changed_cb * * update account list after selection changed *******************************************************/ static void csv_export_account_changed_cb (GtkTreeSelection *selection, gpointer user_data) { CsvExportInfo *info = user_data; GtkAssistant *assistant = GTK_ASSISTANT(info->window); gint num = gtk_assistant_get_current_page (assistant); GtkWidget *page = gtk_assistant_get_nth_page (assistant, num); GncTreeViewAccount *view; g_return_if_fail(GTK_IS_TREE_SELECTION(selection)); info->csva.num_accounts = update_accounts_tree (info); /* Enable the Forward Assistant Button if we have accounts */ if (info->csva.num_accounts > 0) gtk_assistant_set_page_complete (assistant, page, TRUE); else gtk_assistant_set_page_complete (assistant, page, FALSE); view = GNC_TREE_VIEW_ACCOUNT(info->csva.account_treeview); info->csva.account_list = gnc_tree_view_account_get_selected_accounts (view); }
static void button_clicked (GtkButton *button, GNCSearchAccount *fi) { GNCSearchAccountPrivate *priv; GtkDialog *dialog; GtkWidget *account_tree; GtkWidget *accounts_scroller; GtkWidget *label; char *desc; GtkTreeSelection *selection; /* Create the account tree */ account_tree = GTK_WIDGET(gnc_tree_view_account_new (FALSE)); gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(account_tree), FALSE); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(account_tree)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); /* Select the currently-selected accounts */ priv = _PRIVATE(fi); if (priv->selected_accounts) gnc_tree_view_account_set_selected_accounts (GNC_TREE_VIEW_ACCOUNT(account_tree), priv->selected_accounts, FALSE); /* Create the account scroller and put the tree in it */ accounts_scroller = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(accounts_scroller), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(accounts_scroller), account_tree); gtk_widget_set_size_request(GTK_WIDGET(accounts_scroller), 300, 300); /* Create the label */ label = gtk_label_new (_("Select Accounts to Match")); /* Create the dialog */ dialog = GTK_DIALOG(gtk_dialog_new_with_buttons(_("Select the Accounts to Compare"), NULL, 0, _("_Cancel"), GTK_RESPONSE_CANCEL, _("_OK"), GTK_RESPONSE_OK, NULL)); /* Put the dialog together */ gtk_box_pack_start ((GtkBox *) gtk_dialog_get_content_area (dialog), label, FALSE, FALSE, 3); gtk_box_pack_start ((GtkBox *) gtk_dialog_get_content_area (dialog), accounts_scroller, TRUE, TRUE, 3); gtk_widget_show_all (GTK_WIDGET (dialog)); /* Now run the dialog */ if (gtk_dialog_run (dialog) == GTK_RESPONSE_OK) { if (priv->selected_accounts) g_list_free (priv->selected_accounts); priv->selected_accounts = gnc_tree_view_account_get_selected_accounts (GNC_TREE_VIEW_ACCOUNT (account_tree)); desc = describe_button (fi); gtk_label_set_text (GTK_LABEL (gtk_bin_get_child (GTK_BIN (button))), desc); } gtk_widget_destroy (GTK_WIDGET (dialog)); }