On Thu,  2 Feb 2012 at 14:53:59 -0800, Doug Barton wrote:
> On 02/02/2012 04:51, Carlos R. Mafra wrote:
> > I think we need to _fix_ getstyle to save the theme like it used
> > to with -t filename.
> 
> Agreed ... I think that after years of no new releases a new release
> that significantly changes how the various tools work would not be very
> well received. :)

Although "significantly" and "various tools" seem to be an exaggeration,
it made me feel guilty enough. So here's a patch.

---8<---
>From b65d03d374f7d4f7b91db86df172093eae564d7e Mon Sep 17 00:00:00 2001
From: Carlos R. Mafra <[email protected]>
Date: Fri, 3 Feb 2012 01:15:05 +0000
Subject: [PATCH] Fix getstyle, again

It used to be the case that

getstyle -t ~/GNUstep/Library/WindowMaker/Themes/somefile

would save the current theme, and all old menus (WMRootMenu) were relying
on this.

The problem was that the following piece (from commit 6bf79945)

        if (style_file && !make_pack)
                print_help(0, 1);

would allow a style_file to be specified and saved to only with the
option -p (which implies make_pack), therefore saving a theme with
-t like the root menu used to do no longer worked.

Now things work fine:

[mafra@Pilar:~]$ ls GNUstep/
Applications/  Apps/  Defaults/  Library/
[mafra@Pilar:~]$ getstyle -t ~/GNUstep/theme
[mafra@Pilar:~]$ ls GNUstep/
Applications/  Apps/  Defaults/  Library/  theme

But also note that trying to save a theme outside of GNUstep/
is not allowed and it prints no error message - perhaps it should...

Signed-off-by: Carlos R. Mafra <[email protected]>
---
 util/getstyle.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/util/getstyle.c b/util/getstyle.c
index feb0277..bde802d 100644
--- a/util/getstyle.c
+++ b/util/getstyle.c
@@ -277,7 +277,7 @@ void makeThemePack(WMPropList * style, char *themeName)
 int main(int argc, char **argv)
 {
        WMPropList *prop, *style, *key, *val;
-       char *path, *p;
+       char *path;
        int i, ch, theme_too = 0, make_pack = 0;
        char *style_file = NULL;
 
@@ -315,15 +315,8 @@ int main(int argc, char **argv)
        if (argc - optind > 1)
                print_help(0, 1);
 
-       if (argc - optind == 1) {
+       if (argc - optind == 1)
                style_file = argv[argc - 1];
-               while ((p = strchr(style_file, '/')) != NULL)
-                       *p = '_';
-       }
-
-       /* A theme name was given but the option to create it (-p) was not */
-       if (style_file && !make_pack)
-               print_help(0, 1);
 
        if (make_pack && !style_file) {
                printf("%s: you must supply a name for the theme pack\n", 
__progname);
-- 
1.7.3.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to