mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04: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
|
||||
xdg-shell-protocol.*
|
||||
labwc
|
||||
build/
|
||||
build*/
|
||||
subprojects/
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@ struct theme {
|
|||
|
||||
extern struct theme theme;
|
||||
|
||||
void theme_read(const char *filename);
|
||||
void theme_read(const char *theme_name);
|
||||
|
||||
#endif /* THEME_H */
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ struct rcxml rc = { 0 };
|
|||
struct theme theme = { 0 };
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -51,7 +51,7 @@ int main(int argc, char *argv[])
|
|||
server_init(&server);
|
||||
server_start(&server);
|
||||
|
||||
theme_read("data/themerc");
|
||||
theme_read(rc.theme_name);
|
||||
xbm_load(server.renderer);
|
||||
|
||||
if (startup_cmd)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#include "theme.h"
|
||||
#include "theme/theme-dir.h"
|
||||
|
||||
static int hex_to_dec(char c)
|
||||
{
|
||||
|
|
@ -80,15 +81,18 @@ static void process_line(char *line)
|
|||
entry(key, value);
|
||||
}
|
||||
|
||||
void theme_read(const char *filename)
|
||||
void theme_read(const char *theme_name)
|
||||
{
|
||||
FILE *stream;
|
||||
char *line = NULL;
|
||||
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) {
|
||||
fprintf(stderr, "warn: cannot read '%s'\n", filename);
|
||||
fprintf(stderr, "warn: cannot read (%s)\n", themerc);
|
||||
return;
|
||||
}
|
||||
while (getline(&line, &len, stream) != -1) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue