Desktop

/* $Id: main.c,v 1.3 2010/07/26 17:24:41 khorben Exp $ */
/* Copyright (c) 2010 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Keyboard */
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include "keyboard.h"
/* private */
/* functions */
/* usage */
static int _usage(void)
{
fputs("Usage: keyboard [-f font][-m monitor]\n", stderr);
return 1;
}
/* public */
/* functions */
/* main */
int main(int argc, char * argv[])
{
int o;
Keyboard * keyboard;
KeyboardPrefs prefs;
char * p;
memset(&prefs, 0, sizeof(prefs));
gtk_init(&argc, &argv);
while((o = getopt(argc, argv, "f:m:")) != -1)
switch(o)
{
case 'f':
prefs.font = optarg;
break;
case 'm':
prefs.monitor = strtol(optarg, &p, 10);
if(optarg[0] == '\0' || *p != '\0')
return _usage();
break;
default:
return _usage();
}
if(optind != argc)
return _usage();
keyboard = keyboard_new(&prefs);
gtk_main();
keyboard_delete(keyboard);
return 0;
}