Add desktop and icon files and install into the correct place

Remove 48x48 icon; use 256x256 icon only.
Remove icons from the executable.
No need to call gtk_window_set_default_icon_name() anymore.
Add desktop file.
Add install and uninstall Makefile targets.
Update USAGE.md with installation instructions.
Thanks to @szszoke for figuring this one out!

Fixes #2.
This commit is contained in:
Geoffrey D. Bennett
2022-03-15 01:24:03 +10:30
parent 5b1f4f2b61
commit 8257949e5d
8 changed files with 51 additions and 9 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@
.gdb_history
alsa-scarlett-gui
alsa-scarlett-gui-resources.c
vu.b4.alsa-scarlett-gui.desktop

View File

@@ -71,6 +71,19 @@ To run:
./alsa-scarlett-gui
```
You can install it into `/usr/local` (binary, desktop file, and icon)
with:
```
sudo make install
```
And uninstall with:
```
sudo make uninstall
```
## No interface connected
If no interface is detected (usually because there isnt one

View File

@@ -32,13 +32,14 @@ XML_OBJ := $(patsubst %.xml,%.c,$(XML_SRC))
SRCS := $(sort $(wildcard *.c) $(XML_OBJ))
OBJS := $(patsubst %.c,%.o,$(SRCS))
TARGET := alsa-scarlett-gui
DESKTOP_FILE := vu.b4.$(TARGET).desktop
GLIB_COMPILE_RESOURCES := $(shell $(PKG_CONFIG) --variable=glib_compile_resources gio-2.0)
all: $(TARGET)
all: $(TARGET) $(DESKTOP_FILE)
clean:
rm -f $(TARGET) $(OBJS) $(XML_OBJ)
rm -f $(TARGET) $(DESKTOP_FILE) $(OBJS) $(XML_OBJ)
depclean:
rm -rf $(DEPDIR)
@@ -52,3 +53,28 @@ include $(wildcard $(DEPFILES))
$(TARGET): $(OBJS)
cc ${LDFLAGS} -lm -o $(TARGET) $(OBJS)
ifeq ($(PREFIX),)
PREFIX := /usr/local
endif
BINDIR := $(DESTDIR)$(PREFIX)/bin
ICONTOP := $(DESTDIR)$(PREFIX)/share/icons/hicolor
ICONDIR := $(ICONTOP)/256x256/apps
DESKTOPDIR := $(DESTDIR)$(PREFIX)/share/applications
$(DESKTOP_FILE): $(DESKTOP_FILE).template
sed 's_PREFIX_$(PREFIX)_' < $< > $@
install: all
install -d $(BINDIR)
install -m 755 $(TARGET) $(BINDIR)
install -d $(ICONDIR)
install -m 644 img/$(TARGET).png $(ICONDIR)
install -d $(DESKTOPDIR)
install -m 644 $(DESKTOP_FILE) $(DESKTOPDIR)
uninstall:
rm -f $(BINDIR)/$(TARGET)
rm -f $(ICONDIR)/$(TARGET).png
rm -f $(DESKTOPDIR)/$(DESKTOP_FILE)

View File

@@ -4,12 +4,6 @@
<file alias="alsa-scarlett-gui-logo.png">img/alsa-scarlett-gui-logo.png</file>
<file alias="socket.svg">img/socket.svg</file>
</gresource>
<gresource prefix="/vu/b4/alsa-scarlett-gui/icons/48x48/apps">
<file alias="alsa-scarlett-gui.png">img/alsa-scarlett-gui-48.png</file>
</gresource>
<gresource prefix="/vu/b4/alsa-scarlett-gui/icons/256x256/apps">
<file alias="alsa-scarlett-gui.png">img/alsa-scarlett-gui-256.png</file>
</gresource>
<gresource prefix="/vu/b4/alsa-scarlett-gui">
<file>alsa-scarlett-gui.css</file>
</gresource>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

@@ -30,7 +30,6 @@ static void load_css(void) {
// gtk init
static void startup(GtkApplication *app, gpointer user_data) {
gtk_window_set_default_icon_name("alsa-scarlett-gui");
gtk_application_set_menubar(app, G_MENU_MODEL(create_app_menu(app)));
alsa_inotify_init();

View File

@@ -0,0 +1,9 @@
[Desktop Entry]
Encoding=UTF-8
Value=1.5
Type=Application
Name=ALSA Scarlett Gen 2/3 Control Panel
Icon=alsa-scarlett-gui
Exec=PREFIX/bin/alsa-scarlett-gui
Categories=GTK;AudioVideo;Audio;Mixer;