mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Get icons working correctly under Windows
With this we are able to include both a separate .ico file that the program can load at runtime and a .res file (that is created from the .rc file, both in the packaging/windows directory) that is linked into the executable and makes the Windows Explorer show the correct icon for subsurface. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2101f37c1b
commit
7f0c866f48
5 changed files with 32 additions and 2 deletions
3
Makefile
3
Makefile
|
@ -34,6 +34,7 @@ ifeq ($(CC), i686-w64-mingw32-gcc)
|
||||||
LIBDIVECOMPUTERDIR = /usr/i686-w64-mingw32/sys-root/mingw/include/libdivecomputer
|
LIBDIVECOMPUTERDIR = /usr/i686-w64-mingw32/sys-root/mingw/include/libdivecomputer
|
||||||
LIBDIVECOMPUTERINCLUDES = `$(PKGCONFIG) --cflags libdivecomputer`
|
LIBDIVECOMPUTERINCLUDES = `$(PKGCONFIG) --cflags libdivecomputer`
|
||||||
LIBDIVECOMPUTERARCHIVE = `$(PKGCONFIG) --libs libdivecomputer`
|
LIBDIVECOMPUTERARCHIVE = `$(PKGCONFIG) --libs libdivecomputer`
|
||||||
|
RESFILE = packaging/windows/subsurface.res
|
||||||
else
|
else
|
||||||
|
|
||||||
libdc-local := $(wildcard /usr/local/lib/libdivecomputer.a)
|
libdc-local := $(wildcard /usr/local/lib/libdivecomputer.a)
|
||||||
|
@ -76,7 +77,7 @@ LIBS = $(LIBXML2) $(LIBGTK) $(LIBDIVECOMPUTER) -lpthread
|
||||||
|
|
||||||
OBJS = main.o dive.o profile.o info.o equipment.o divelist.o \
|
OBJS = main.o dive.o profile.o info.o equipment.o divelist.o \
|
||||||
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
|
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
|
||||||
gtk-gui.o
|
gtk-gui.o $(RESFILE)
|
||||||
|
|
||||||
$(NAME): $(OBJS)
|
$(NAME): $(OBJS)
|
||||||
$(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
|
$(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
|
||||||
|
|
|
@ -552,7 +552,11 @@ static void about_dialog(GtkWidget *w, gpointer data)
|
||||||
GdkPixbuf *logo = NULL;
|
GdkPixbuf *logo = NULL;
|
||||||
|
|
||||||
if (need_icon) {
|
if (need_icon) {
|
||||||
|
#ifndef WIN32
|
||||||
GtkWidget *image = gtk_image_new_from_file("subsurface.svg");
|
GtkWidget *image = gtk_image_new_from_file("subsurface.svg");
|
||||||
|
#else
|
||||||
|
GtkWidget *image = gtk_image_new_from_file("subsurface.ico");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (image) {
|
if (image) {
|
||||||
logo = gtk_image_get_pixbuf(GTK_IMAGE(image));
|
logo = gtk_image_get_pixbuf(GTK_IMAGE(image));
|
||||||
|
@ -823,7 +827,7 @@ void init_ui(int argc, char **argv)
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
gtk_window_set_icon_from_file(GTK_WINDOW(win), "subsurface.svg", NULL);
|
gtk_window_set_icon_from_file(GTK_WINDOW(win), "subsurface.svg", NULL);
|
||||||
#else
|
#else
|
||||||
gtk_window_set_icon_from_file(GTK_WINDOW(win), "subsurface.bmp", NULL);
|
gtk_window_set_icon_from_file(GTK_WINDOW(win), "subsurface.ico", NULL);
|
||||||
#endif
|
#endif
|
||||||
g_signal_connect(G_OBJECT(win), "delete-event", G_CALLBACK(on_delete), NULL);
|
g_signal_connect(G_OBJECT(win), "delete-event", G_CALLBACK(on_delete), NULL);
|
||||||
g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(on_destroy), NULL);
|
g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(on_destroy), NULL);
|
||||||
|
|
BIN
packaging/windows/subsurface.ico
Normal file
BIN
packaging/windows/subsurface.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
25
packaging/windows/subsurface.rc
Normal file
25
packaging/windows/subsurface.rc
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
1 VERSIONINFO
|
||||||
|
FILEVERSION 1,1,0,0
|
||||||
|
PRODUCTVERSION 1,1,0,0
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "080904E4"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "subsurface team"
|
||||||
|
VALUE "FileDescription", "subsurface dive log"
|
||||||
|
VALUE "FileVersion", "1.1"
|
||||||
|
VALUE "InternalName", "subsurface"
|
||||||
|
VALUE "LegalCopyright", "Linus Torvalds, Dirk Hohndel and others"
|
||||||
|
VALUE "OriginalFilename", "subsurface.exe"
|
||||||
|
VALUE "ProductName", "subsurface"
|
||||||
|
VALUE "ProductVersion", "1.1"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x809, 1252
|
||||||
|
END
|
||||||
|
END
|
||||||
|
ID ICON "subsurface.ico"
|
BIN
packaging/windows/subsurface.res
Normal file
BIN
packaging/windows/subsurface.res
Normal file
Binary file not shown.
Loading…
Reference in a new issue