mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Added a function to check if specific OS features are available
linux.c, macos.c, windows.c now contain subsurface_os_feature_available() that can accept an enum type os_feature_t defined in dive.h. The function can be useful to check if a specific global feature is available on a certain OS version. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a75b04473f
commit
5b3e480be3
4 changed files with 31 additions and 0 deletions
6
dive.h
6
dive.h
|
@ -437,10 +437,16 @@ const char *monthname(int mon);
|
|||
#define FIVE_STARS UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR
|
||||
extern const char *star_strings[];
|
||||
|
||||
/* enum holding list of OS features */
|
||||
typedef enum {
|
||||
UTF8_FONT_WITH_STARS
|
||||
} os_feature_t;
|
||||
|
||||
extern const char *default_filename;
|
||||
extern const char *existing_filename;
|
||||
extern const char *subsurface_default_filename(void);
|
||||
extern const char *subsurface_gettext_domainpath(char *);
|
||||
extern gboolean subsurface_os_feature_available(os_feature_t);
|
||||
extern void subsurface_command_line_init(gint *, gchar ***);
|
||||
extern void subsurface_command_line_exit(gint *, gchar ***);
|
||||
#define AIR_PERMILLE 209
|
||||
|
|
5
linux.c
5
linux.c
|
@ -112,3 +112,8 @@ void subsurface_command_line_exit(gint *argc, gchar ***argv)
|
|||
{
|
||||
/* this is a no-op */
|
||||
}
|
||||
|
||||
gboolean subsurface_os_feature_available(os_feature_t f)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
|
5
macos.c
5
macos.c
|
@ -172,3 +172,8 @@ void subsurface_command_line_exit(gint *argc, gchar ***argv)
|
|||
{
|
||||
/* this is a no-op */
|
||||
}
|
||||
|
||||
gboolean subsurface_os_feature_available(os_feature_t f)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
|
15
windows.c
15
windows.c
|
@ -223,3 +223,18 @@ void subsurface_command_line_exit(gint *argc, gchar ***argv)
|
|||
g_free((*argv)[i]);
|
||||
g_free(*argv);
|
||||
}
|
||||
|
||||
/* check if we are running a newer OS version */
|
||||
gboolean subsurface_os_feature_available(os_feature_t f)
|
||||
{
|
||||
switch (f) {
|
||||
case UTF8_FONT_WITH_STARS:
|
||||
if ((GetVersion() & 0xff) < 6)
|
||||
return FALSE; /* version less than Vista */
|
||||
else
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue