mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add default filename and divelist font to prefs structure
.. and add the usual logic to not save the default values. This also simplifies the initial system-specific setup of both of these: since we have defaults for all the preferences that get set up at startup, we can just initialize those defaults to the system-specific fonts then and there. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
954290c70b
commit
6a10700ca5
11 changed files with 84 additions and 89 deletions
35
windows.c
35
windows.c
|
|
@ -4,7 +4,8 @@
|
|||
#include "display-gtk.h"
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#define DIVELIST_DEFAULT_FONT "Sans 8"
|
||||
|
||||
const char system_divelist_default_font[] = "Sans 8";
|
||||
|
||||
static HKEY hkey;
|
||||
|
||||
|
|
@ -208,26 +209,22 @@ const char *subsurface_icon_name()
|
|||
return "subsurface.ico";
|
||||
}
|
||||
|
||||
const char *subsurface_default_filename()
|
||||
const char *system_default_filename(void)
|
||||
{
|
||||
if (default_filename) {
|
||||
return strdup(default_filename);
|
||||
} else {
|
||||
char datapath[MAX_PATH];
|
||||
const char *user;
|
||||
char *buffer;
|
||||
int len;
|
||||
char datapath[MAX_PATH];
|
||||
const char *user;
|
||||
char *buffer;
|
||||
int len;
|
||||
|
||||
user = g_get_user_name();
|
||||
if (! SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, datapath))) {
|
||||
datapath[0] = '.';
|
||||
datapath[1] = '\0';
|
||||
}
|
||||
len = strlen(datapath) + strlen(user) + 17;
|
||||
buffer = malloc(len);
|
||||
snprintf(buffer, len, "%s\\Subsurface\\%s.xml", datapath, user);
|
||||
return buffer;
|
||||
user = g_get_user_name();
|
||||
if (! SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, datapath))) {
|
||||
datapath[0] = '.';
|
||||
datapath[1] = '\0';
|
||||
}
|
||||
len = strlen(datapath) + strlen(user) + 17;
|
||||
buffer = malloc(len);
|
||||
snprintf(buffer, len, "%s\\Subsurface\\%s.xml", datapath, user);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char *subsurface_gettext_domainpath(char *argv0)
|
||||
|
|
@ -244,8 +241,6 @@ const char *subsurface_gettext_domainpath(char *argv0)
|
|||
void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
||||
GtkWidget *vbox, GtkUIManager *ui_manager)
|
||||
{
|
||||
if (!divelist_font)
|
||||
divelist_font = strdup(DIVELIST_DEFAULT_FONT);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue