[PATCH 2/2] Don't use the unicode characters for stars if the OS is too old

Dirk Hohndel dirk at hohndel.org
Fri Oct 19 13:18:35 PDT 2012


Excellent. Thanks Lubomir for providing these patches.

I guess long term we'd want this "subsurface_check_old_os" function to
have an enum as argument that is called "feature". And then we can have
the function determine on a per-feature basis whether the OS is too old
for this... the first feature being "UTF8_FONT_WITH_STARS" :-)

I rebuilt the Windows installer that's in the download directory.

I'd appreciate more testing - especially Miika - would you give this
another try?

Thanks

/D

"Lubomir I. Ivanov" <neolit123 at gmail.com> writes:

> From: "Lubomir I. Ivanov" <neolit123 at gmail.com>
>
> Mainly affecting older Windows (such as XP), which do not have a more
> fully featured unicode fonts installed, such as Arial Unicode MS.
>
> With this patch we do a runtime check of the OS version in a couple of
> places and if the OS is old we use the asterix character and spaces instead
> of the unicode star characters.
>
> Linux and OSX should be unaffected by this change unless
> subsurface_check_old_os() is set to return TRUE on a certain condition.
>
> Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
> ---
>  divelist.c |  5 +++++
>  gtk-gui.c  |  9 +++++++++
>  info.c     | 12 ++++++------
>  3 files changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/divelist.c b/divelist.c
> index 274773d..8333a28 100644
> --- a/divelist.c
> +++ b/divelist.c
> @@ -2280,6 +2280,11 @@ GtkWidget *dive_list_create(void)
>  	gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_MULTIPLE);
>  	gtk_widget_set_size_request(dive_list.tree_view, 200, 200);
>  
> +	/* check if the OS is old and replace the star symbol in the rating column's
> +	 * header with an asterix */
> +	if (subsurface_check_old_os())
> +		dl_column[3].header = "*";
> +
>  	dive_list.nr = divelist_column(&dive_list, dl_column + DIVE_NR);
>  	dive_list.date = divelist_column(&dive_list, dl_column + DIVE_DATE);
>  	dive_list.stars = divelist_column(&dive_list, dl_column + DIVE_RATING);
> diff --git a/gtk-gui.c b/gtk-gui.c
> index 5fd16d1..8bb1a4f 100644
> --- a/gtk-gui.c
> +++ b/gtk-gui.c
> @@ -1018,6 +1018,15 @@ void init_ui(int *argcp, char ***argvp)
>  	gtk_settings_set_long_property(settings, "gtk-menu-images", 1, "subsurface setting");
>  	gtk_settings_set_long_property(settings, "gtk-button-images", 1, "subsurface setting");
>  
> +	/* check if the OS is old and replace the star symbols with asterix and spaces */
> +	if (subsurface_check_old_os()) {
> +		star_strings[0] = "     ";
> +		star_strings[1] = "*    ";
> +		star_strings[2] = "**   ";
> +		star_strings[3] = "***  ";
> +		star_strings[4] = "**** ";
> +		star_strings[5] = "*****";
> +	}
>  	g_type_init();
>  
>  	subsurface_open_conf();
> diff --git a/info.c b/info.c
> index f6905dc..8380135 100644
> --- a/info.c
> +++ b/info.c
> @@ -924,12 +924,12 @@ GtkWidget *extended_dive_info_widget(void)
>  	people_list = gtk_list_store_new(1, G_TYPE_STRING);
>  	location_list = gtk_list_store_new(1, G_TYPE_STRING);
>  	star_list = gtk_list_store_new(1, G_TYPE_STRING);
> -	add_string_list_entry(ZERO_STARS, star_list);
> -	add_string_list_entry(ONE_STARS, star_list);
> -	add_string_list_entry(TWO_STARS, star_list);
> -	add_string_list_entry(THREE_STARS, star_list);
> -	add_string_list_entry(FOUR_STARS, star_list);
> -	add_string_list_entry(FIVE_STARS, star_list);
> +	add_string_list_entry(star_strings[0], star_list);
> +	add_string_list_entry(star_strings[1], star_list);
> +	add_string_list_entry(star_strings[2], star_list);
> +	add_string_list_entry(star_strings[3], star_list);
> +	add_string_list_entry(star_strings[4], star_list);
> +	add_string_list_entry(star_strings[5], star_list);
>  	suit_list = gtk_list_store_new(1, G_TYPE_STRING);
>  
>  	gtk_container_set_border_width(GTK_CONTAINER(vbox), 6);
> -- 
> 1.7.11.msysgit.0
>
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

-- 
Dirk Hohndel
Intel Open Source Technology Center


More information about the subsurface mailing list