From 88a0d1ff032093f93233c6faacef2689a989c2bc Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Wed, 24 Jul 2002 18:28:56 +0000 Subject: [PATCH] look for themes in ~/.themes/NAME/metacity-1/ and 2002-07-24 Havoc Pennington * src/theme-parser.c (meta_theme_load): look for themes in ~/.themes/NAME/metacity-1/ and datadir/themes/NAME/metacity-1 instead of the old locations. * src/themes/Makefile.am: install themes to datadir/themes/NAME/metacity-1/ to match how GTK works, breaking third-party themes yet again! woot! --- ChangeLog | 10 ++++++++++ src/Makefile.am | 2 +- src/frames.c | 2 -- src/menu.c | 1 + src/theme-parser.c | 41 +++++++++++++++-------------------------- src/themes/Makefile.am | 22 ++++++++++++---------- 6 files changed, 39 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index aaf8d4f36..5ff84d2e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-07-24 Havoc Pennington + + * src/theme-parser.c (meta_theme_load): look for themes in + ~/.themes/NAME/metacity-1/ and datadir/themes/NAME/metacity-1 + instead of the old locations. + + * src/themes/Makefile.am: install themes to + datadir/themes/NAME/metacity-1/ to match how GTK works, breaking + third-party themes yet again! woot! + 2002-07-20 Havoc Pennington * src/display.c (meta_display_open): grab display across managing diff --git a/src/Makefile.am b/src/Makefile.am index 97fed80fe..af558b339 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS=wm-tester tools themes -INCLUDES=@METACITY_CFLAGS@ -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMETACITY_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMETACITY_PKGDATADIR=\"$(pkgdatadir)\" +INCLUDES=@METACITY_CFLAGS@ -DMETACITY_LIBEXECDIR=\"$(libexecdir)\" -DHOST_ALIAS=\"@HOST_ALIAS@\" -DMETACITY_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\" -DMETACITY_PKGDATADIR=\"$(pkgdatadir)\" -DMETACITY_DATADIR=\"$(datadir)\" EGGFILES= \ eggaccelerators.c \ diff --git a/src/frames.c b/src/frames.c index 7580f7078..fffdcfc57 100644 --- a/src/frames.c +++ b/src/frames.c @@ -1872,8 +1872,6 @@ get_control (MetaFrames *frames, return META_FRAME_CONTROL_RESIZE_E; } } - - noresize: return META_FRAME_CONTROL_NONE; } diff --git a/src/menu.c b/src/menu.c index 07d2b9ea6..a5429fe7f 100644 --- a/src/menu.c +++ b/src/menu.c @@ -21,6 +21,7 @@ #include #include +#include #include "menu.h" #include "main.h" #include "util.h" diff --git a/src/theme-parser.c b/src/theme-parser.c index 0518afbf9..54ffe2752 100644 --- a/src/theme-parser.c +++ b/src/theme-parser.c @@ -4181,9 +4181,14 @@ text_handler (GMarkupParseContext *context, /* We change the filename when we break the format, * so themes can work with various metacity versions + * (note, this is obsolete now because we are versioning + * the directory this file is inside, so oh well) */ #define THEME_FILENAME "metacity-theme-1.xml" +/* now this is versioned, /usr/share/themes/NAME/THEME_SUBDIR/THEME_FILENAME */ +#define THEME_SUBDIR "metacity-1" + MetaTheme* meta_theme_load (const char *theme_name, GError **err) @@ -4206,6 +4211,7 @@ meta_theme_load (const char *theme_name, if (meta_is_debugging ()) { + /* Try in themes in our source tree */ theme_dir = g_build_filename ("./themes", theme_name, NULL); theme_file = g_build_filename (theme_dir, @@ -4227,34 +4233,15 @@ meta_theme_load (const char *theme_name, } } - /* We try in current dir, then home dir, then system dir for themes */ - if (text == NULL) - { - theme_dir = g_build_filename ("./", theme_name, NULL); - - theme_file = g_build_filename (theme_dir, - THEME_FILENAME, - NULL); - - error = NULL; - if (!g_file_get_contents (theme_file, - &text, - &length, - &error)) - { - meta_topic (META_DEBUG_THEMES, "Failed to read theme from file %s: %s\n", - theme_file, error->message); - g_error_free (error); - g_free (theme_dir); - g_free (theme_file); - theme_file = NULL; - } - } + /* We try in home dir, then system dir for themes */ if (text == NULL) { theme_dir = g_build_filename (g_get_home_dir (), - ".metacity/themes/", theme_name, NULL); + ".themes", + theme_name, + THEME_SUBDIR, + NULL); theme_file = g_build_filename (theme_dir, THEME_FILENAME, @@ -4277,9 +4264,11 @@ meta_theme_load (const char *theme_name, if (text == NULL) { - theme_dir = g_build_filename (METACITY_PKGDATADIR, + theme_dir = g_build_filename (METACITY_DATADIR, "themes", - theme_name, NULL); + theme_name, + THEME_SUBDIR, + NULL); theme_file = g_build_filename (theme_dir, THEME_FILENAME, diff --git a/src/themes/Makefile.am b/src/themes/Makefile.am index 6e5845fda..2dcf3449d 100644 --- a/src/themes/Makefile.am +++ b/src/themes/Makefile.am @@ -5,18 +5,20 @@ THEMES= \ Esco \ Gorilla -THEME_DIR=$(pkgdatadir)/themes +THEME_DIR=$(datadir)/themes +THEME_SUBDIR=metacity-1 install-data-local: - $(mkinstalldirs) $(DESTDIR)$(THEME_DIR); \ - for THEME in $(THEMES); do \ - echo '-- Installing theme '$$THEME; \ - $(mkinstalldirs) $(DESTDIR)$(THEME_DIR)/$$THEME; \ - (installfiles=`find $(srcdir)/$$THEME -name "*.png" -o -name "*.xml"`; \ - for i in $$installfiles; do \ - echo '-- Installing '$$i ; \ - $(INSTALL_DATA) $$i $(DESTDIR)$(THEME_DIR)/$$THEME; \ - done) \ + $(mkinstalldirs) $(DESTDIR)$(THEME_DIR); \ + for THEME in $(THEMES); do \ + echo '-- Installing theme '$$THEME; \ + $(mkinstalldirs) $(DESTDIR)$(THEME_DIR)/$$THEME; \ + $(mkinstalldirs) $(DESTDIR)$(THEME_DIR)/$$THEME/$(THEME_SUBDIR); \ + (installfiles=`find $(srcdir)/$$THEME -name "*.png" -o -name "*.xml"`; \ + for i in $$installfiles; do \ + echo '-- Installing '$$i ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(THEME_DIR)/$$THEME/$(THEME_SUBDIR) ; \ + done) \ done dist-hook: