[Dextrose] [PATCH][sugar] check for empty cursor_theme

Bernie Innocenti bernie at codewiz.org
Wed Mar 9 18:41:52 EST 2011


On Wed, 2011-03-09 at 13:15 -0300, Martin Abente wrote:

> diff --git a/bin/sugar.in b/bin/sugar.in
> index bd6e95e..73af03c 100644
> --- a/bin/sugar.in
> +++ b/bin/sugar.in
> @@ -80,10 +80,12 @@ fi
>  # Set cursor theme
>  gconftool-2 --dir-exists=/desktop/sugar/peripherals/mouse
>  EXIST_SUGAR_CURSOR_THEME=$(echo $?)
> +CURSOR_THEME="sugar"
>  if [[ $EXIST_SUGAR_CURSOR_THEME == 0 ]]; then
> -    CURSOR_THEME=$(gconftool-2 --get /desktop/sugar/peripherals/mouse/cursor_theme);
> -else
> -    CURSOR_THEME="sugar"
> +    STORED_CURSOR_THEME=$(gconftool-2 --get /desktop/sugar/peripherals/mouse/cursor_theme);
> +    if [[ $STORED_CURSOR_THEME != "" ]]; then
> +        CURSOR_THEME=$STORED_CURSOR_THEME
> +    fi
>  fi

There should be quoting around expansions of $STORED_CURSOR_THEME, for
the case when it's empty.

Also, the above code could be optimized down to:

  CURSOR_THEME=$(gconftool-2 --get /desktop/sugar/peripherals/mouse/cursor_theme)
  if [ -z "$CURSOR_THEME" ]; then
      CURSOR_THEME=sugar
  fi

Why isn't there a sensible default value in the gconf schema for cursor_theme?

-- 
   // Bernie Innocenti - http://codewiz.org/
 \X/  Sugar Labs       - http://sugarlabs.org/




More information about the Dextrose mailing list