]> git.datanom.net - lensdb.git/blob - src/main.c
Ready for release
[lensdb.git] / src / main.c
1 /*
2 * main.c
3 *
4 * Copyright 2024 Michael Rasmussen <mir@datanom.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 *
21 *
22 */
23
24 #ifdef HAVE_CONFIG_H
25 # include <config.h>
26 #endif
27 #include <gtk/gtk.h>
28 #include <glib.h>
29 #include <glib-object.h>
30 #include <stdio.h>
31 #include "sqlite-storage.h"
32 #include "gui.h"
33 #include "lib/scanner.h"
34
35 gint main(gint argc, gchar** argv) {
36 gint status = 0;
37
38 // Scanner_t* sc = scanner_create("/home/mir/Pictures/Pictures/20211019_0012.jpg");
39 // Scanner_t* sc = scanner_create("/home/mir/Pictures/Pictures/2024/09/14/Lndskrona Foto Festival/Lndskrona Foto Festival-8.ORF");
40 // Scanner_t* sc = scanner_create("/home/mir/Pictures/Pictures/2024/08/21/Fototur til Hejresøen/Fototur til Hejresøen-6.NEF");
41 // gchar* response = get_lens_maker(sc);
42 // fprintf(stderr, "Maker: %s\n", response);
43 // g_free(response);
44 // response = get_lens_info(sc);
45 // fprintf(stderr, "Name: %s\n", response);
46 // g_free(response);
47 // response = get_lens_serial_number(sc);
48 // fprintf(stderr, "SN: %s\n", response);
49 // g_free(response);
50 // scanner_destroy(sc);
51
52 gchar* path = g_path_get_dirname(argv[0]);
53 if ((status = init_storage(path)) > 0) {
54 fprintf(stderr, "%s: Failed to open DB\n", path);
55 } else {
56 gtk_init(&argc, &argv);
57 if (init_gui()) {
58 gchar* err = g_strdup_printf("Failed initializing GUI\n");
59 fprintf(stderr, err);
60 show_err_msg(GTK_MESSAGE_ERROR, err);
61 g_free(err);
62 return EXIT_FAILURE;
63 }
64 }
65 g_free(path);
66 close_storage();
67
68 return status;
69 }
This page took 0.626885 seconds and 6 git commands to generate.