Comparar commits
6 Commits
d34bd8f72e
...
1.0.1
Autor | SHA1 | Fecha | |
---|---|---|---|
8e5ddc62e7
|
|||
a1225763d6
|
|||
23051f4a8c
|
|||
e82ccf5e82
|
|||
9baa4b2881
|
|||
b9822af312
|
1
.gitignore
vendido
Archivo normal
1
.gitignore
vendido
Archivo normal
@@ -0,0 +1 @@
|
||||
build
|
2
README.md
Archivo normal
2
README.md
Archivo normal
@@ -0,0 +1,2 @@
|
||||
# addtax
|
||||
This application allows the calculation of a price by adding the 10% taxes for boletas in Chile.
|
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: addtax\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-09-13 10:09-0300\n"
|
||||
"POT-Creation-Date: 2018-09-24 16:16-0300\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -17,7 +17,7 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: src/addtax.c:58 src/addtax.c:71
|
||||
#: src/addtax.c:51 src/addtax.c:65
|
||||
#, c-format
|
||||
msgid "Usage: %s [prices...]\n"
|
||||
msgstr ""
|
||||
|
4
po/es.po
4
po/es.po
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: addtax\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-09-13 10:09-0300\n"
|
||||
"POT-Creation-Date: 2018-09-24 16:16-0300\n"
|
||||
"PO-Revision-Date: 2018-09-13 10:10-0300\n"
|
||||
"Last-Translator: Chris Cromer <chris@cromer.cl>\n"
|
||||
"Language-Team: none\n"
|
||||
@@ -18,7 +18,7 @@ msgstr ""
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"X-Generator: Poedit 2.0.6\n"
|
||||
|
||||
#: src/addtax.c:58 src/addtax.c:71
|
||||
#: src/addtax.c:51 src/addtax.c:65
|
||||
#, c-format
|
||||
msgid "Usage: %s [prices...]\n"
|
||||
msgstr "Uso: %s [precios...]\n"
|
||||
|
28
src/addtax.c
28
src/addtax.c
@@ -3,10 +3,12 @@
|
||||
#include <libintl.h>
|
||||
#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"
|
||||
|
||||
GtkLabel *calculated_value = NULL;
|
||||
|
||||
@@ -27,25 +29,34 @@ void calculate_tax(GtkWidget *entry) {
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int opt;
|
||||
|
||||
float money;
|
||||
int long_index = 0;
|
||||
static struct option long_options[] = {
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain("addtax", "/usr/share/locale/");
|
||||
textdomain("addtax");
|
||||
|
||||
if (argc > 1) {
|
||||
while ((opt = getopt(argc, argv, "")) != -1) {
|
||||
// Process options
|
||||
while ((opt = getopt_long(argc, argv,"v", long_options, &long_index)) != -1) {
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
printf("%s %s\n", argv[0], VERSION);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, _("Usage: %s [prices...]\n"), argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (opt = 1; opt < argc; opt++) {
|
||||
money = atof(argv[opt]);
|
||||
if (is_float(argv[opt], money)) {
|
||||
// Process arguments that are not options
|
||||
while (optind < argc) {
|
||||
money = atof(argv[optind]);
|
||||
if (is_float(argv[optind++], money)) {
|
||||
printf("$%d * %f = ", (int) round(money), TAX);
|
||||
money = money * TAX;
|
||||
printf("$%d\n", (int) round(money));
|
||||
@@ -60,11 +71,16 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *window;
|
||||
GError *error = NULL;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
builder = gtk_builder_new();
|
||||
gtk_builder_add_from_resource(builder, "/cl/cromer/addtax/window_main.glade", NULL);
|
||||
gtk_builder_add_from_resource(builder, "/cl/cromer/addtax/window_main.glade", &error);
|
||||
if (error != NULL) {
|
||||
fprintf(stderr, "Error: %s\n", error->message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
window = GTK_WIDGET(gtk_builder_get_object(builder, "window_main"));
|
||||
gtk_builder_connect_signals(builder, NULL);
|
||||
|
Referencia en una nueva incidencia
Block a user