~ubuntu-branches/ubuntu/precise/wmclockmon/precise

« back to all changes in this revision

Viewing changes to wmclockmon-config/main.c

  • Committer: Bazaar Package Importer
  • Author(s): Marc 'HE' Brockschmidt
  • Date: 2004-06-03 20:24:21 UTC
  • Revision ID: james.westby@ubuntu.com-20040603202421-r6p3d4iba4q5quqy
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* WMMaiLoad-Config
 
2
 * Configuration window for wmmaiload dockapp, Thomas Nemeth 2002.
 
3
 */
 
4
 
 
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"
 
15
 
 
16
 
 
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);
 
23
}
 
24
 
 
25
 
 
26
void app_init(int argc, char *argv[]) {
 
27
    int   ind = 1;
 
28
 
 
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;
 
41
 
 
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;
 
61
            }
 
62
        } else {
 
63
            fprintf(stderr, "Unknown option: %s\n", argv[ind]);
 
64
            Usage();
 
65
        }
 
66
        ind++;
 
67
    }
 
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);
 
72
    }
 
73
}
 
74
 
 
75
 
 
76
int main(int argc, char *argv[]) {
 
77
 
 
78
    gtk_init(&argc, &argv);
 
79
    app_init(argc, argv);
 
80
    load_cfgfile();
 
81
    create_mainwindow();
 
82
    set_values();
 
83
 
 
84
    gtk_main();
 
85
 
 
86
    return 0;
 
87
}