wmclockmon: update change-log
[dockapps.git] / wmclockmon / wmclockmon-config / main.c
blobc7e5b89a74e1336356bf4d44160f086f39dbe093
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"
16 int backlight;
17 int switch_authorized;
18 int h12;
19 int use_locale;
20 int showcal;
21 int calalrms;
22 char *style_name;
23 char *style_dir;
24 char *config_file;
25 char *light_color;
26 char *command;
27 Alarm *alarms;
29 void Usage (void) {
30 printf("Usage: "PACKAGE"-config [-h] [-v] [-f filename]\n"
31 " -h : short usage help\n"
32 " -v : show version\n"
33 " -f filename : edit filename\n\n");
34 exit(1);
38 void app_init(int argc, char *argv[]) {
39 int ind = 1;
41 backlight = 0;
42 style_name = NULL;
43 style_dir = NULL;
44 switch_authorized = 1;
45 h12 = 0;
46 use_locale = 1;
47 config_file = NULL;
48 light_color = NULL;
49 command = NULL;
50 alarms = NULL;
51 showcal = 0;
52 calalrms = 0;
54 while (ind < argc) {
55 if (argv[ind][0] == '-') {
56 switch (argv[ind][1]) {
57 case 'h' :
58 printf(PACKAGE"-config by Thomas Nemeth - v "VERSION"\n");
59 Usage();
60 break;
61 case 'v' :
62 printf(PACKAGE"-config by Thomas Nemeth - v "VERSION"\n");
63 exit(1);
64 break;
65 case 'f' :
66 ind++;
67 config_file = xstrdup(argv[ind]);
68 break;
69 default:
70 printf("Unknown option: %s\n", argv[ind]);
71 Usage();
72 break;
74 } else {
75 fprintf(stderr, "Unknown option: %s\n", argv[ind]);
76 Usage();
78 ind++;
80 if (! config_file) {
81 char *Home = robust_home();
82 config_file = xmalloc(strlen(Home) + strlen(DEFAULT_CFGFILE) + 3);
83 sprintf(config_file, "%s/%s", Home, DEFAULT_CFGFILE);
88 int main(int argc, char *argv[]) {
90 gtk_init(&argc, &argv);
91 app_init(argc, argv);
92 load_cfgfile();
93 create_mainwindow();
94 set_values();
96 gtk_main();
98 return 0;