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



_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to