wmclockmon: build against GTK+ 2.0.
[dockapps.git] / wmclockmon / wmclockmon-config / main.c
blob94b0da6f52a13719c2e1dade1e0f089dc2871617
1 /* WMMaiLoad-Config
2 * Configuration window for wmmaiload dockapp, Thomas Nemeth 2002.
3 */
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <gtk/gtk.h>
8 #include <string.h>
9 #include "../config.h"
10 #include "defines.h"
11 #include "variables.h"
12 #include "tools.h"
13 #include "mainwindow.h"
14 #include "actions.h"
17 void Usage () {
18 printf("Usage: "PACKAGE"-config [-h] [-v] [-f filename]\n"
19 " -h : short usage help\n"
20 " -v : show version\n"
21 " -f filename : edit filename\n\n");
22 exit(1);
26 void app_init(int argc, char *argv[]) {
27 int ind = 1;
29 backlight = 0;
30 style_name = NULL;
31 style_dir = NULL;
32 switch_authorized = 1;
33 h12 = 0;
34 use_locale = 1;
35 config_file = NULL;
36 light_color = NULL;
37 command = NULL;
38 alarms = NULL;
39 showcal = 0;
40 calalrms = 0;
42 while (ind < argc) {
43 if (argv[ind][0] == '-') {
44 switch (argv[ind][1]) {
45 case 'h' :
46 printf(PACKAGE"-config by Thomas Nemeth - v "VERSION"\n");
47 Usage();
48 break;
49 case 'v' :
50 printf(PACKAGE"-config by Thomas Nemeth - v "VERSION"\n");
51 exit(1);
52 break;
53 case 'f' :
54 ind++;
55 config_file = xstrdup(argv[ind]);
56 break;
57 default:
58 printf("Unknown option: %s\n", argv[ind]);
59 Usage();
60 break;
62 } else {
63 fprintf(stderr, "Unknown option: %s\n", argv[ind]);
64 Usage();
66 ind++;
68 if (! config_file) {
69 char *Home = robust_home();
70 config_file = xmalloc(strlen(Home) + strlen(DEFAULT_CFGFILE) + 3);
71 sprintf(config_file, "%s/%s", Home, DEFAULT_CFGFILE);
76 int main(int argc, char *argv[]) {
78 gtk_init(&argc, &argv);
79 app_init(argc, argv);
80 load_cfgfile();
81 create_mainwindow();
82 set_values();
84 gtk_main();
86 return 0;