Skip to content

Commit

Permalink
LinGui: fix installation of desktop file
Browse files Browse the repository at this point in the history
Don't install flatpak desktop file when not building a flatpak.
This was causing duplicate icons in some distros.
  • Loading branch information
jstebbins committed Oct 19, 2016
1 parent 19b0ddf commit 1b93f99
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 32 deletions.
6 changes: 6 additions & 0 deletions gtk/configure.ac
Expand Up @@ -52,6 +52,10 @@ else
AC_SUBST(HB_DIR, '$(top_srcdir)/'"..")
fi

AC_ARG_ENABLE(flatpak,
AS_HELP_STRING([--enable-flatpak], [enable QSV encoder]),

This comment has been minimized.

Copy link
@bradleysepos

bradleysepos Oct 20, 2016

Contributor

I need to start counting these. 😆

This comment has been minimized.

Copy link
@jstebbins

jstebbins Oct 20, 2016

Author Contributor

pfft! It's only the help string. so it's functionally correct 😉

use_flatpak=yes, use_flatpak=no)

AC_ARG_ENABLE(dl,
AS_HELP_STRING([--enable-dl], [enable libdl]),
use_libdl=yes, use_libdl=no)
Expand Down Expand Up @@ -183,6 +187,8 @@ case $host in
;;
esac

AM_CONDITIONAL([GHB_FLATPAK], [test "$use_flatpak" = "yes"])

if test "x$use_fdk_aac" = "xyes" ; then
HB_LIBS="$HB_LIBS -lfdk-aac"
fi
Expand Down
4 changes: 4 additions & 0 deletions gtk/module.defs
Expand Up @@ -43,3 +43,7 @@ endif
ifeq (1,$(FEATURE.qsv))
GTK.CONFIGURE.extra += --enable-qsv
endif

ifeq (1,$(FEATURE.flatpak))
GTK.CONFIGURE.extra += --enable-flatpak
endif
50 changes: 18 additions & 32 deletions gtk/src/Makefile.am
Expand Up @@ -3,8 +3,6 @@
icons = \
hb-icon.svg

flatpak_icon = fr.handbrake.ghb.svg

icons_dep = \
hb-icon.svg \
hb-start.svg \
Expand All @@ -19,10 +17,14 @@ icons_dep = \
hb-edit.svg \
hb-complete.svg

if GHB_FLATPAK
icons += fr.handbrake.ghb.svg
hb_menu = fr.handbrake.ghb.desktop
flatpak_appdata = fr.handbrake.ghb.appdata.xml
else
hb_menu = ghb.desktop
flatpak_menu = fr.handbrake.ghb.desktop
endif

flatpak_appdata = fr.handbrake.ghb.appdata.xml

AM_CPPFLAGS = \
-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
Expand Down Expand Up @@ -151,42 +153,25 @@ gtk_update_icon_cache = gtk-update-icon-cache -f -t $(DESTDIR)/$(datadir)/icons/

uninstall-local:
for icon in $(icons); do \
SIZE=`echo $$icon | cut -d. -f2`; \
FILE=`echo $$icon | cut -d. -f1,3`; \
if [ "$$SIZE" = "svg" ]; then \
SIZE="scalable"; \
FILE="$$FILE.svg"; \
else \
SIZE="$${SIZE}x$${SIZE}"; \
fi; \
rm -f $(DESTDIR)/$(datadir)/icons/hicolor/$$SIZE/apps/$$FILE; \
rm -f $(DESTDIR)/$(datadir)/icons/hicolor/scalable/apps/$$icon; \
done
rm -f $(DESTDIR)/$(datadir)/icons/hicolor/scalable/apps/$(flatpak_icon)
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
rm -f $(DESTDIR)/$(datadir)/applications/$(hb_menu); \
rm -f $(DESTDIR)/$(datadir)/applications/$(flatpak_menu) \
rm -f $(DESTDIR)/$(datadir)/appdata/$(flatpak_appdata)
rm -f $(DESTDIR)/$(datadir)/applications/$(hb_menu)
@-if test -n "$(flatpak_appdata)"; then \
rm -f $(DESTDIR)/$(datadir)/appdata/$(flatpak_appdata); \
fi

install-data-local:
for icon in $(icons); do \
SIZE=`echo $$icon | cut -d. -f2`; \
FILE=`echo $$icon | cut -d. -f1,3`; \
if [ "$$SIZE" = "svg" ]; then \
SIZE="scalable"; \
FILE="$$FILE.svg"; \
else \
SIZE="$${SIZE}x$${SIZE}"; \
fi; \
mkdir -p $(DESTDIR)/$(datadir)/icons/hicolor/$$SIZE/apps/; \
$(INSTALL_DATA) $(srcdir)/$$icon $(DESTDIR)/$(datadir)/icons/hicolor/$$SIZE/apps/$$FILE; \
mkdir -p $(DESTDIR)/$(datadir)/icons/hicolor/scalable/apps/; \
$(INSTALL_DATA) $(srcdir)/$$icon $(DESTDIR)/$(datadir)/icons/hicolor/scalable/apps/$$icon; \
done
$(INSTALL_DATA) $(srcdir)/$(flatpak_icon) $(DESTDIR)/$(datadir)/icons/hicolor/scalable/apps/$(flatpak_icon)
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
Expand All @@ -195,7 +180,8 @@ install-data-local:
echo "*** $(gtk_update_icon_cache)"; \
fi
mkdir -p $(DESTDIR)/$(datadir)/applications/; \
mkdir -p $(DESTDIR)/$(datadir)/appdata/; \
$(INSTALL_DATA) $(srcdir)/$(hb_menu) $(DESTDIR)/$(datadir)/applications/$(hb_menu); \
$(INSTALL_DATA) $(srcdir)/$(flatpak_menu) $(DESTDIR)/$(datadir)/applications/$(flatpak_menu); \
$(INSTALL_DATA) $(srcdir)/$(flatpak_appdata) $(DESTDIR)/$(datadir)/appdata/$(flatpak_appdata)
$(INSTALL_DATA) $(srcdir)/$(hb_menu) $(DESTDIR)/$(datadir)/applications/$(hb_menu)
@-if test -n "$(flatpak_appdata)"; then \
mkdir -p $(DESTDIR)/$(datadir)/appdata/; \
$(INSTALL_DATA) $(srcdir)/$(flatpak_appdata) $(DESTDIR)/$(datadir)/appdata/$(flatpak_appdata); \
fi

0 comments on commit 1b93f99

Please sign in to comment.