2008-02-11 20:30:39 +03:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* ELMA, Ede Login MAnager
|
|
|
|
* Part of Equinox Desktop Environment (EDE).
|
|
|
|
* Copyright (c) 2008 EDE Authors.
|
|
|
|
*
|
|
|
|
* This program is licensed under terms of the
|
|
|
|
* GNU General Public License version 2 or newer.
|
|
|
|
* See COPYING for details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2008-02-18 17:46:13 +03:00
|
|
|
|
|
|
|
#if 0
|
2008-02-11 20:30:39 +03:00
|
|
|
#include <string.h>
|
|
|
|
#include <FL/x.h>
|
|
|
|
#include <FL/Fl.h>
|
|
|
|
#include <edelib/String.h>
|
2008-02-18 17:46:13 +03:00
|
|
|
#include <edelib/Config.h>
|
|
|
|
|
2008-02-11 20:30:39 +03:00
|
|
|
#include "Background.h"
|
|
|
|
#include "TextArea.h"
|
|
|
|
#include "ElmaWindow.h"
|
|
|
|
#include "NumLock.h"
|
2008-02-18 17:46:13 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "ElmaService.h"
|
2008-02-11 20:30:39 +03:00
|
|
|
|
|
|
|
#define CHECK_ARGV(argv, pshort, plong) ((strcmp(argv, pshort) == 0) || (strcmp(argv, plong) == 0))
|
|
|
|
|
|
|
|
void help(void) {
|
|
|
|
puts("Usage: elma [OPTIONS]");
|
|
|
|
puts("EDE login manager responsible to log you into X seesion");
|
|
|
|
puts("and initiate EDE startup\n");
|
|
|
|
puts("Options:");
|
|
|
|
puts(" -h, --help this help");
|
|
|
|
puts(" -c, --config [FILE] use FILE as config file");
|
2008-02-18 17:46:13 +03:00
|
|
|
puts(" -d, --daemon daemon mode");
|
2008-02-11 20:30:39 +03:00
|
|
|
puts(" -t, --test test mode for theme preview (assume X server is running)\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* next_param(int curr, char** argv, int argc) {
|
|
|
|
int j = curr + 1;
|
|
|
|
if(j >= argc)
|
|
|
|
return NULL;
|
|
|
|
if(argv[j][0] == '-')
|
|
|
|
return NULL;
|
|
|
|
return argv[j];
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
const char* config_file = NULL;
|
|
|
|
bool test_mode = false;
|
2008-02-18 17:46:13 +03:00
|
|
|
bool daemon_mode = false;
|
2008-02-11 20:30:39 +03:00
|
|
|
|
|
|
|
if(argc > 1) {
|
|
|
|
const char* a;
|
|
|
|
for(int i = 1; i < argc; i++) {
|
|
|
|
a = argv[i];
|
|
|
|
if(CHECK_ARGV(a, "-h", "--help")) {
|
|
|
|
help();
|
|
|
|
return 0;
|
|
|
|
} else if(CHECK_ARGV(a, "-c", "--config")) {
|
|
|
|
config_file = next_param(i, argv, argc);
|
|
|
|
if(!config_file) {
|
|
|
|
puts("Missing configuration filename");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
i++;
|
2008-02-18 17:46:13 +03:00
|
|
|
} else if(CHECK_ARGV(a, "-d", "--daemon")) {
|
|
|
|
daemon_mode = true;
|
2008-02-11 20:30:39 +03:00
|
|
|
} else if(CHECK_ARGV(a, "-t", "--test")) {
|
|
|
|
test_mode = true;
|
|
|
|
} else {
|
|
|
|
printf("Unknown parameter '%s'. Run 'elma -h' for options\n", a);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-18 17:46:13 +03:00
|
|
|
ElmaService* service = ElmaService::instance();
|
2008-02-11 20:30:39 +03:00
|
|
|
|
2008-02-18 17:46:13 +03:00
|
|
|
if(!service->load_config()) {
|
|
|
|
puts("Unable to load config file");
|
2008-02-11 20:30:39 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-02-18 17:46:13 +03:00
|
|
|
if(!service->load_theme()) {
|
|
|
|
puts("Unable to load theme file");
|
|
|
|
return 1;
|
|
|
|
}
|
2008-02-11 20:30:39 +03:00
|
|
|
|
2008-02-18 17:46:13 +03:00
|
|
|
service->display_window();
|
2008-02-11 20:30:39 +03:00
|
|
|
|
2008-02-18 17:46:13 +03:00
|
|
|
return 0;
|
2008-02-11 20:30:39 +03:00
|
|
|
}
|