gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GSTheme activation


From: Philippe Roussel
Subject: Re: GSTheme activation
Date: Fri, 13 Jan 2012 00:13:03 +0100

Le jeudi 12 janvier 2012 à 21:49 +0100, Philippe Roussel a écrit :
> Hi,
> 
> Playing with different themes I noticed that when starting an
> application with GnomeTheme the debug log 'Gnome theme initialized'
> appears multiple times.
> 
> I think the following patch is needed :
> 
> --- Source/GSTheme.m  (revision 34503)
> +++ Source/GSTheme.m  (working copy)
> @@ -282,19 +282,22 @@
>  
>  + (void) initialize
>  {
> -  if (themes == nil)
> +  if ([GSTheme class] == self)
>      {
> -      themes = [NSMutableDictionary new];
> -      null = RETAIN([NSNull null]);
> -      defaultTheme = [[self alloc] initWithBundle: nil];
> -      ASSIGN(theTheme, defaultTheme);
> -      ASSIGN(currentThemeName, [defaultTheme name]);
> -      names = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
> -     NSIntMapValueCallBacks, 0);
> +      if (themes == nil)
> +     {
> +       themes = [NSMutableDictionary new];
> +       null = RETAIN([NSNull null]);
> +       defaultTheme = [[self alloc] initWithBundle: nil];
> +       ASSIGN(theTheme, defaultTheme);
> +       ASSIGN(currentThemeName, [defaultTheme name]);
> +       names = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
> +                                NSIntMapValueCallBacks, 0);
> +     }
> +      /* Establish the theme specified by the user defaults (if any);
> +       */
> +      [self defaultsDidChange: nil];
>      }
> -  /* Establish the theme specified by the user defaults (if any);
> -   */
> -  [self defaultsDidChange: nil];
>  }
>  
>  + (GSTheme*) loadThemeNamed: (NSString*)aName
> 
> Or maybe just moving [self defaultsDidChange: nil] at the end of the
> existing condition.

Or maybe (thanks Luiji)

--- Source/GSTheme.m    (revision 34503)
+++ Source/GSTheme.m    (working copy)
@@ -282,7 +282,7 @@
 
 + (void) initialize
 {
-  if (themes == nil)
+  if ([GSTheme class] == self)
     {
       themes = [NSMutableDictionary new];
       null = RETAIN([NSNull null]);
@@ -290,11 +290,11 @@
       ASSIGN(theTheme, defaultTheme);
       ASSIGN(currentThemeName, [defaultTheme name]);
       names = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
-       NSIntMapValueCallBacks, 0);
+                              NSIntMapValueCallBacks, 0);
+      /* Establish the theme specified by the user defaults (if any);
+       */
+      [self defaultsDidChange: nil];
     }
-  /* Establish the theme specified by the user defaults (if any);
-   */
-  [self defaultsDidChange: nil];
 }
 
 + (GSTheme*) loadThemeNamed: (NSString*)aName





reply via email to

[Prev in Thread] Current Thread [Next in Thread]