summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Patrick Griffis <tingping@tingping.se>2015-12-26 22:24:14 -0500
committerGravatar Patrick Griffis <tingping@tingping.se>2016-01-19 19:35:10 -0500
commit3f1418a0f987990b41fdb7b0a1f004fe03dea1eb (patch)
treebb997acabe77e09f825a81a84940ea04d25feb81
parent6859636f60259eee7bf8293eb0434c54cb250880 (diff)
Move desktop file to data and translate
-rw-r--r--configure.ac1
-rw-r--r--data/Makefile.am7
-rw-r--r--data/transmission-remote-gtk.desktop.in (renamed from src/transmission-remote-gtk.desktop.in)7
-rw-r--r--m4/desktop.m4102
-rw-r--r--po/POTFILES.in2
-rw-r--r--src/Makefile.am12
6 files changed, 119 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 858c4e8..4d9606b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,6 +39,7 @@ LT_PREREQ([2.2.0])
LT_INIT
IT_PROG_INTLTOOL([0.50.1])
PKG_PROG_PKG_CONFIG([0.28])
+DESKTOP_FILE
GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
diff --git a/data/Makefile.am b/data/Makefile.am
index 61a1a63..50ece12 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1 +1,8 @@
SUBDIRS = icons
+
+desktop_in_files = transmission-remote-gtk.desktop.in
+desktop_FILES = $(desktop_in_files:.desktop.in=.desktop)
+@INTLTOOL_DESKTOP_RULE@
+@DESKTOP_FILE_RULES@
+
+EXTRA_DIST = $(desktop_in_files)
diff --git a/src/transmission-remote-gtk.desktop.in b/data/transmission-remote-gtk.desktop.in
index 501a4ea..776a6f7 100644
--- a/src/transmission-remote-gtk.desktop.in
+++ b/data/transmission-remote-gtk.desktop.in
@@ -1,10 +1,9 @@
[Desktop Entry]
-Name=Transmission Remote
-Comment=Remotely manage the Transmission BitTorrent client
-Exec=@bindir@/transmission-remote-gtk %U
+_Name=Transmission Remote
+_Comment=Remotely manage the Transmission BitTorrent client
+Exec=transmission-remote-gtk %U
Icon=transmission-remote-gtk
Terminal=false
-TryExec=transmission-remote-gtk
Type=Application
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Categories=Network;FileTransfer;P2P;GTK;
diff --git a/m4/desktop.m4 b/m4/desktop.m4
new file mode 100644
index 0000000..18292ad
--- /dev/null
+++ b/m4/desktop.m4
@@ -0,0 +1,102 @@
+# desktop.m4
+#
+# serial 4
+
+dnl DESKTOP_VALIDATE
+dnl Validates and installs desktop files.
+dnl
+dnl To use:
+dnl 1. Call DESKTOP_FILE in configure.ac to check for the desktop-file-utils tools.
+dnl 2. Add @DESKTOP_FILE_RULES@ to a Makefile.am to substitute the make rules.
+dnl 3. Add .desktop files to desktop_FILES in Makefile.am and they will be validated
+dnl at make check time and installed on make install.
+dnl 4. Add --enable-desktop-validate to DISTCHECK_CONFIGURE_FLAGS
+dnl in Makefile.am to require valid desktop file when doing a distcheck.
+dnl
+dnl On installation desktop-file-install will be used when available which also
+dnl rebuilds the mime info cache. After install update-desktop-database is called.
+dnl
+dnl Author: TingPing <tingping@tingping.se>
+dnl Based upon appdata-xml.m4
+
+AC_DEFUN([DESKTOP_FILE],
+[
+ m4_pattern_allow([AM_V_GEN])
+ AC_ARG_ENABLE([desktop-validate],
+ [AS_HELP_STRING([--disable-desktop-validate],
+ [Disable validating desktop files during check phase])])
+
+ AS_IF([test "x$enable_desktop_validate" != "xno"],
+ [AC_PATH_PROG([DESKTOP_FILE_VALIDATE], [desktop-file-validate])
+ AS_IF([test "x$DESKTOP_FILE_VALIDATE" = "x"],
+ [have_desktop_validate=no],
+ [have_desktop_validate=yes
+ AC_SUBST([DESKTOP_FILE_VALIDATE])])],
+ [have_desktop_validate=no])
+
+ AC_PATH_PROG([UPDATE_DESKTOP_DATABASE], [update-desktop-database])
+ AS_IF([test "x$UPDATE_DESKTOP_DATABASE" != "x"], [AC_SUBST([UPDATE_DESKTOP_DATABASE])])
+
+ AC_PATH_PROG([DESKTOP_FILE_INSTALL], [desktop-file-install])
+ AS_IF([test "x$DESKTOP_FILE_INSTALL" != "x"], [AC_SUBST([DESKTOP_FILE_INSTALL])])
+
+ AS_IF([test "x$have_desktop_validate" != "xno"],
+ [desktop_validate=yes],
+ [desktop_validate=no
+ AS_IF([test "x$enable_desktop_validate" = "xyes"],
+ [AC_MSG_ERROR([Desktop validation was requested but desktop-file-validate was not found])])])
+
+ AC_SUBST([desktopfiledir], [${datadir}/applications])
+
+ DESKTOP_FILE_RULES='
+.PHONY : uninstall-desktop-file install-desktop-file clean-desktop-file
+
+mostlyclean-am: clean-desktop-file
+
+%.desktop.valid: %.desktop
+ $(AM_V_GEN) if test -f "$<"; then d=; else d="$(srcdir)/"; fi; \
+ if test -n "$(DESKTOP_FILE_VALIDATE)"; \
+ then $(DESKTOP_FILE_VALIDATE) $${d}$<; fi \
+ && touch [$]@
+
+check-am: $(desktop_FILES:.desktop=.desktop.valid)
+uninstall-am: uninstall-desktop-file
+install-data-am: install-desktop-file
+
+.SECONDARY: $(desktop_FILES)
+
+install-desktop-file: $(desktop_FILES)
+ @$(NORMAL_INSTALL)
+ if test -n "$^"; then \
+ test -z "$(desktopfiledir)" || $(MKDIR_P) "$(DESTDIR)$(desktopfiledir)"; \
+ if test -n "$(DESKTOP_FILE_INSTALL)"; then \
+ $(DESKTOP_FILE_INSTALL) --dir="$(DESTDIR)$(desktopfiledir)" --mode=644 --rebuild-mime-info-cache $^; \
+ else \
+ $(INSTALL_DATA) $^ "$(DESTDIR)$(desktopfiledir)"; \
+ fi; \
+ test -z "$(UPDATE_DESKTOP_DATABASE)" || $(UPDATE_DESKTOP_DATABASE) -q "$(DESTDIR)$(desktopfiledir)"; \
+ fi
+
+uninstall-desktop-file:
+ @$(NORMAL_UNINSTALL)
+ @list='\''$(desktop_FILES)'\''; test -n "$(desktopfiledir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e '\''s|^.*/||'\''`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '\''$(DESTDIR)$(desktopfiledir)'\'' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(desktopfiledir)" && rm -f $$files; \
+ test -z "$(UPDATE_DESKTOP_DATABASE)" || $(UPDATE_DESKTOP_DATABASE) -q "$(DESTDIR)$(desktopfiledir)"
+
+clean-desktop-file:
+ rm -f $(desktop_FILES:.desktop=.desktop.valid)
+'
+ _DESKTOP_FILE_SUBST(DESKTOP_FILE_RULES)
+])
+
+dnl _DESKTOP_FILE_SUBST(VARIABLE)
+dnl Abstract macro to do either _AM_SUBST_NOTMAKE or AC_SUBST
+AC_DEFUN([_DESKTOP_FILE_SUBST],
+[
+AC_SUBST([$1])
+m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([$1])])
+]
+) \ No newline at end of file
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 306c34d..6bd2a6e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,3 +1,4 @@
+[type: gettext/ini]data/transmission-remote-gtk.desktop.in
src/bencode.c
src/hig.c
src/json.c
@@ -21,6 +22,7 @@ src/trg-file-parser.c
src/trg-files-model.c
src/trg-files-tree-view.c
src/trg-general-panel.c
+src/trg-gtk-app.c
src/trg-json-widgets.c
src/trg-main-window.c
src/trg-menu-bar.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 2874f70..43306fa 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,13 +18,12 @@
#
if !WIN32
-EXTRA_DIST = transmission-remote-gtk.desktop.in transmission-remote-gtk.pod transmission-remote-gtk.appdata.xml
-CLEANFILES = transmission-remote-gtk.desktop transmission-remote-gtk.1
+EXTRA_DIST = transmission-remote-gtk.pod transmission-remote-gtk.appdata.xml
+CLEANFILES = transmission-remote-gtk.1
man_MANS = transmission-remote-gtk.1
-desktopdir = $(datadir)/applications
-desktop_DATA = transmission-remote-gtk.desktop
+
appdatadir = $(datadir)/appdata
appdata_DATA = transmission-remote-gtk.appdata.xml
@@ -32,7 +31,7 @@ endif
bin_PROGRAMS = transmission-remote-gtk
AM_CFLAGS = -DLOCALEDIR=\""$(localedir)"\" $(libcurl_CFLAGS) $(jsonglib_CFLAGS) $(gthread_CFLAGS) $(gtk_CFLAGS) $(gio_CFLAGS) $(notify_CFLAGS) $(libproxy_CFLAGS) $(libappindicator_CFLAGS) $(mrss_CFLAGS) -I$(top_srcdir)/extern
-
+
transmission_remote_gtk_SOURCES = \
trg-cell-renderer-speed.c \
trg-cell-renderer-counter.c \
@@ -118,6 +117,3 @@ else
pod2man --release="" --center="Transmission Remote GTK" $< > $@
endif
-
-transmission-remote-gtk.desktop: transmission-remote-gtk.desktop.in
- sed -e 's,@bindir\@,$(bindir),g' <transmission-remote-gtk.desktop.in > $@