|
|
|
@ -4,11 +4,8 @@
|
|
|
|
|
#include <locale.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <getopt.h>
|
|
|
|
|
#include "misc.h"
|
|
|
|
|
|
|
|
|
|
#define _(STRING) gettext(STRING)
|
|
|
|
|
#define TAX 1.111111111
|
|
|
|
|
#define VERSION "1.0.1"
|
|
|
|
|
#include "include/addtax.h"
|
|
|
|
|
#include "include/misc.h"
|
|
|
|
|
|
|
|
|
|
GtkLabel *calculated_value = NULL;
|
|
|
|
|
|
|
|
|
@ -18,7 +15,7 @@ void calculate_tax(GtkWidget *entry) {
|
|
|
|
|
const gchar *label_text;
|
|
|
|
|
entry_text = (char*) gtk_entry_get_text(GTK_ENTRY(entry));
|
|
|
|
|
money = atof(entry_text);
|
|
|
|
|
if (is_float(entry_text, money)) {
|
|
|
|
|
if (is_float(entry_text)) {
|
|
|
|
|
g_print("$%d * %f = ", (int) round(money), TAX);
|
|
|
|
|
money = money * TAX;
|
|
|
|
|
g_print("$%d\n", (int) round(money));
|
|
|
|
@ -56,7 +53,7 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
// Process arguments that are not options
|
|
|
|
|
while (optind < argc) {
|
|
|
|
|
money = atof(argv[optind]);
|
|
|
|
|
if (is_float(argv[optind++], money)) {
|
|
|
|
|
if (is_float(argv[optind++])) {
|
|
|
|
|
printf("$%d * %f = ", (int) round(money), TAX);
|
|
|
|
|
money = money * TAX;
|
|
|
|
|
printf("$%d\n", (int) round(money));
|
|
|
|
@ -96,7 +93,7 @@ int main(int argc, char *argv[]) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Called when calculate is clicked
|
|
|
|
|
void on_button_calculate_clicked(GtkWidget *button, GtkWidget *entry) {
|
|
|
|
|
void on_button_calculate_clicked(__attribute__((unused)) GtkWidget *button, GtkWidget *entry) {
|
|
|
|
|
calculate_tax(entry);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|