mirror of
https://github.com/labwc/labwc.git
synced 2026-02-28 01:40:29 -05:00
src/main.c: read themerc specified by rc.xml
This commit is contained in:
parent
c38b3ec770
commit
d7d838d682
4 changed files with 11 additions and 7 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
*.o
|
*.o
|
||||||
xdg-shell-protocol.*
|
xdg-shell-protocol.*
|
||||||
labwc
|
labwc
|
||||||
build/
|
build*/
|
||||||
subprojects/
|
subprojects/
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,6 @@ struct theme {
|
||||||
|
|
||||||
extern struct theme theme;
|
extern struct theme theme;
|
||||||
|
|
||||||
void theme_read(const char *filename);
|
void theme_read(const char *theme_name);
|
||||||
|
|
||||||
#endif /* THEME_H */
|
#endif /* THEME_H */
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ struct rcxml rc = { 0 };
|
||||||
struct theme theme = { 0 };
|
struct theme theme = { 0 };
|
||||||
|
|
||||||
static const char labwc_usage[] =
|
static const char labwc_usage[] =
|
||||||
"Usage: labwc [-h] [-s <startup-command>] [-c <config-file>]\n";
|
"Usage: labwc [-h] [-s <startup-command>] [-c <config-file>]\n";
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
|
|
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
||||||
server_init(&server);
|
server_init(&server);
|
||||||
server_start(&server);
|
server_start(&server);
|
||||||
|
|
||||||
theme_read("data/themerc");
|
theme_read(rc.theme_name);
|
||||||
xbm_load(server.renderer);
|
xbm_load(server.renderer);
|
||||||
|
|
||||||
if (startup_cmd)
|
if (startup_cmd)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
#include "theme/theme-dir.h"
|
||||||
|
|
||||||
static int hex_to_dec(char c)
|
static int hex_to_dec(char c)
|
||||||
{
|
{
|
||||||
|
|
@ -80,15 +81,18 @@ static void process_line(char *line)
|
||||||
entry(key, value);
|
entry(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void theme_read(const char *filename)
|
void theme_read(const char *theme_name)
|
||||||
{
|
{
|
||||||
FILE *stream;
|
FILE *stream;
|
||||||
char *line = NULL;
|
char *line = NULL;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
|
char themerc[4096];
|
||||||
|
|
||||||
stream = fopen(filename, "r");
|
snprintf(themerc, sizeof(themerc), "%s/themerc", theme_dir(theme_name));
|
||||||
|
fprintf(stderr, "info: read themerc (%s)\n", themerc);
|
||||||
|
stream = fopen(themerc, "r");
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
fprintf(stderr, "warn: cannot read '%s'\n", filename);
|
fprintf(stderr, "warn: cannot read (%s)\n", themerc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (getline(&line, &len, stream) != -1) {
|
while (getline(&line, &len, stream) != -1) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue