diff --git a/aclocal.m4 b/aclocal.m4 index f54de75..da9ca74 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -412,25 +412,28 @@ AC_DEFUN([AM_GLIB_DEFINE_LOCALEDIR],[GLIB_DEFINE_LOCALEDIR($@)]) dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml]) -# serial 2 IT_PROG_INTLTOOL +# serial 35 IT_PROG_INTLTOOL AC_DEFUN([IT_PROG_INTLTOOL], -[ +[AC_PREREQ([2.50])dnl + +case "$am__api_version" in + 1.[01234]) + AC_MSG_ERROR([Automake 1.5 or newer is required to use intltool]) + ;; + *) + ;; +esac if test -n "$1"; then AC_MSG_CHECKING(for intltool >= $1) - INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ printf "%d", $[1] * 100 + $[2]; }'` - INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { printf $[2]; }' < ${ac_aux_dir}/intltool-update.in` - changequote({{,}}) - INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split(${{2}}, VERSION, "."); printf "%d\n", VERSION[1] * 100 + VERSION[2];}' < ${ac_aux_dir}/intltool-update.in` - changequote([,]) - - if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT"; then - AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) - else - AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found. Your intltool is too old. You need intltool $1 or later.]) - exit 1 - fi + INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'` + INTLTOOL_APPLIED_VERSION=`awk -F\" '/\\$VERSION / { print $ 2; }' ${ac_aux_dir}/intltool-update.in` + [INTLTOOL_APPLIED_VERSION_AS_INT=`awk -F\" '/\\$VERSION / { split($ 2, VERSION, "."); print VERSION[1] * 1000 + VERSION[2] * 100 + VERSION[3];}' ${ac_aux_dir}/intltool-update.in` + ] + AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found]) + test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" || + AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.]) fi INTLTOOL_DESKTOP_RULE='%.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' @@ -450,6 +453,7 @@ INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcar INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_SCHEMAS_RULE='%.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' INTLTOOL_THEME_RULE='%.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' + INTLTOOL_SERVICE_RULE='%.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@' AC_SUBST(INTLTOOL_DESKTOP_RULE) AC_SUBST(INTLTOOL_DIRECTORY_RULE) @@ -468,16 +472,12 @@ AC_SUBST(INTLTOOL_XML_NOMERGE_RULE) AC_SUBST(INTLTOOL_CAVES_RULE) AC_SUBST(INTLTOOL_SCHEMAS_RULE) AC_SUBST(INTLTOOL_THEME_RULE) +AC_SUBST(INTLTOOL_SERVICE_RULE) # Use the tools built into the package, not the ones that are installed. - -INTLTOOL_EXTRACT='$(top_builddir)/intltool-extract' -INTLTOOL_MERGE='$(top_builddir)/intltool-merge' -INTLTOOL_UPDATE='$(top_builddir)/intltool-update' - -AC_SUBST(INTLTOOL_EXTRACT) -AC_SUBST(INTLTOOL_MERGE) -AC_SUBST(INTLTOOL_UPDATE) +AC_SUBST(INTLTOOL_EXTRACT, '$(top_builddir)/intltool-extract') +AC_SUBST(INTLTOOL_MERGE, '$(top_builddir)/intltool-merge') +AC_SUBST(INTLTOOL_UPDATE, '$(top_builddir)/intltool-update') AC_PATH_PROG(INTLTOOL_PERL, perl) if test -z "$INTLTOOL_PERL"; then @@ -500,104 +500,96 @@ AC_PATH_PROG(INTLTOOL_MSGFMT, msgfmt, msgfmt) AC_PATH_PROG(INTLTOOL_MSGMERGE, msgmerge, msgmerge) AC_PATH_PROG(INTLTOOL_XGETTEXT, xgettext, xgettext) -# Remove file type tags (using []) from po/POTFILES. +# Substitute ALL_LINGUAS so we can use it in po/Makefile +AC_SUBST(ALL_LINGUAS) + +IT_PO_SUBDIR([po]) -ifdef([AC_DIVERSION_ICMDS],[ - AC_DIVERT_PUSH(AC_DIVERSION_ICMDS) - changequote(,) - mv -f po/POTFILES po/POTFILES.tmp - sed -e '/\[encoding.*\]/d' -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES - rm -f po/POTFILES.tmp - changequote([,]) - AC_DIVERT_POP() -],[ - ifdef([AC_CONFIG_COMMANDS_PRE],[ - AC_CONFIG_COMMANDS_PRE([ - changequote(,) - mv -f po/POTFILES po/POTFILES.tmp - sed -e '/\[encoding.*\]/d' -e 's/\[.*\] *//' < po/POTFILES.tmp > po/POTFILES - rm -f po/POTFILES.tmp - changequote([,]) - ]) - ]) - -if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - # Keeping the `.' argument allows $(mkdir_p) to be used without - # argument. Indeed, we sometimes output rules like - # $(mkdir_p) $(somedir) - # where $(somedir) is conditionally defined. - # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more - # expensive solution, as it forces Make to start a sub-shell.) - mkdir_p='mkdir -p -- .' -else - # On NextStep and OpenStep, the `mkdir' command does not - # recognize any option. It will interpret all options as - # directories to create, and then abort because `.' already - # exists. - for d in ./-p ./--version; - do - test -d $d && rmdir $d - done - # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. - if test -f "$ac_aux_dir/mkinstalldirs"; then - mkdir_p='$(mkinstalldirs)' - else - mkdir_p='$(install_sh) -d' - fi -fi -AC_SUBST([mkdir_p]) -]) - -# Manually sed perl in so people don't have to put the intltool scripts in AC_OUTPUT. +dnl The following is very similar to +dnl +dnl AC_CONFIG_FILES([intltool-extract intltool-merge intltool-update]) +dnl +dnl with the following slight differences: +dnl - the *.in files are in ac_aux_dir, +dnl - if the file haven't changed upon reconfigure, it's not touched, +dnl - the evaluation of the third parameter enables a hack which computes +dnl the actual value of $libdir, +dnl - the user sees "executing intltool commands", instead of +dnl "creating intltool-extract" and such. +dnl +dnl Nothing crucial here, and we could use AC_CONFIG_FILES, if there were +dnl a reason for it. AC_CONFIG_COMMANDS([intltool], [ -intltool_edit="-e 's#@INTLTOOL_EXTRACT@#`pwd`/intltool-extract#g' \ - -e 's#@INTLTOOL_ICONV@#${INTLTOOL_ICONV}#g' \ - -e 's#@INTLTOOL_MSGFMT@#${INTLTOOL_MSGFMT}#g' \ - -e 's#@INTLTOOL_MSGMERGE@#${INTLTOOL_MSGMERGE}#g' \ - -e 's#@INTLTOOL_XGETTEXT@#${INTLTOOL_XGETTEXT}#g' \ - -e 's#@INTLTOOL_PERL@#${INTLTOOL_PERL}#g'" +for file in intltool-extract intltool-merge intltool-update; do + sed -e "s|@INTLTOOL_EXTRACT@|`pwd`/intltool-extract|g" \ + -e "s|@INTLTOOL_LIBDIR@|${INTLTOOL_LIBDIR}|g" \ + -e "s|@INTLTOOL_ICONV@|${INTLTOOL_ICONV}|g" \ + -e "s|@INTLTOOL_MSGFMT@|${INTLTOOL_MSGFMT}|g" \ + -e "s|@INTLTOOL_MSGMERGE@|${INTLTOOL_MSGMERGE}|g" \ + -e "s|@INTLTOOL_XGETTEXT@|${INTLTOOL_XGETTEXT}|g" \ + -e "s|@INTLTOOL_PERL@|${INTLTOOL_PERL}|g" \ + < ${ac_aux_dir}/${file}.in > ${file}.out + if cmp -s ${file} ${file}.out 2>/dev/null; then + rm -f ${file}.out + else + mv -f ${file}.out ${file} + fi + chmod ugo+x ${file} + chmod u+w ${file} +done -eval sed ${intltool_edit} < ${ac_aux_dir}/intltool-extract.in \ - > intltool-extract.out -if cmp -s intltool-extract intltool-extract.out 2>/dev/null; then - rm -f intltool-extract.out -else - mv -f intltool-extract.out intltool-extract -fi -chmod ugo+x intltool-extract -chmod u+w intltool-extract - -eval sed ${intltool_edit} < ${ac_aux_dir}/intltool-merge.in \ - > intltool-merge.out -if cmp -s intltool-merge intltool-merge.out 2>/dev/null; then - rm -f intltool-merge.out -else - mv -f intltool-merge.out intltool-merge -fi -chmod ugo+x intltool-merge -chmod u+w intltool-merge - -eval sed ${intltool_edit} < ${ac_aux_dir}/intltool-update.in \ - > intltool-update.out -if cmp -s intltool-update intltool-update.out 2>/dev/null; then - rm -f intltool-update.out -else - mv -f intltool-update.out intltool-update -fi -chmod ugo+x intltool-update -chmod u+w intltool-update - -], INTLTOOL_PERL='${INTLTOOL_PERL}' ac_aux_dir=${ac_aux_dir} -INTLTOOL_EXTRACT='${INTLTOOL_EXTRACT}' ICONV='${INTLTOOL_ICONV}' -MSGFMT='${INTLTOOL_MSGFMT}' MSGMERGE='${INTLTOOL_MSGMERGE}' -XGETTEXT='${INTLTOOL_XGETTEXT}') +], +[INTLTOOL_PERL='${INTLTOOL_PERL}' ac_aux_dir='${ac_aux_dir}' +prefix="$prefix" exec_prefix="$exec_prefix" INTLTOOL_LIBDIR="$libdir" +INTLTOOL_EXTRACT='${INTLTOOL_EXTRACT}' INTLTOOL_ICONV='${INTLTOOL_ICONV}' +INTLTOOL_MSGFMT='${INTLTOOL_MSGFMT}' INTLTOOL_MSGMERGE='${INTLTOOL_MSGMERGE}' +INTLTOOL_XGETTEXT='${INTLTOOL_XGETTEXT}']) ]) + +# IT_PO_SUBDIR(DIRNAME) +# --------------------- +# All po subdirs have to be declared with this macro; the subdir "po" is +# declared by IT_PROG_INTLTOOL. +# +AC_DEFUN([IT_PO_SUBDIR], +[AC_PREREQ([2.53])dnl We use ac_top_srcdir inside AC_CONFIG_COMMANDS. +dnl +dnl The following CONFIG_COMMANDS should be exetuted at the very end +dnl of config.status. +AC_CONFIG_COMMANDS_PRE([ + AC_CONFIG_COMMANDS([$1/stamp-it], [ + rm -f "$1/stamp-it" "$1/stamp-it.tmp" "$1/POTFILES" "$1/Makefile.tmp" + >"$1/stamp-it.tmp" + [sed '/^#/d + s/^[[].*] *// + /^[ ]*$/d + '"s|^| $ac_top_srcdir/|" \ + "$srcdir/$1/POTFILES.in" | sed '$!s/$/ \\/' >"$1/POTFILES" + ] + if test ! -f "$1/Makefile"; then + AC_MSG_ERROR([$1/Makefile is not ready.]) + fi + mv "$1/Makefile" "$1/Makefile.tmp" + [sed '/^POTFILES =/,/[^\\]$/ { + /^POTFILES =/!d + r $1/POTFILES + } + ' "$1/Makefile.tmp" >"$1/Makefile"] + rm -f "$1/Makefile.tmp" + mv "$1/stamp-it.tmp" "$1/stamp-it" + ]) +])dnl +]) + + # deprecated macros -AC_DEFUN([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL($@)]) +AU_ALIAS([AC_PROG_INTLTOOL], [IT_PROG_INTLTOOL]) +# A hint is needed for aclocal from Automake <= 1.9.4: +# AC_DEFUN([AC_PROG_INTLTOOL], ...) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- diff --git a/po/Makefile.in b/po/Makefile.in index 1a305fc..9d0e3f0 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -11,6 +11,11 @@ # # - Modified by jacob berkman to install # Makefile.in.in and po2tbl.sed.in for use with glib-gettextize +# +# - Modified by Rodney Dawes for use with intltool +# +# We have the following line for use by intltoolize: +# INTLTOOL_MAKEFILE GETTEXT_PACKAGE = xfce4-taskmanager PACKAGE = xfce4-taskmanager @@ -18,7 +23,6 @@ VERSION = 0.4.0-rc2 SHELL = /bin/sh - srcdir = . top_srcdir = .. top_builddir = .. @@ -26,21 +30,20 @@ top_builddir = .. prefix = /usr/local exec_prefix = ${prefix} -datadir = ${prefix}/share +datadir = ${datarootdir} +datarootdir = ${prefix}/share libdir = ${exec_prefix}/lib -localedir = $(libdir)/locale -gnulocaledir = $(datadir)/locale -gettextsrcdir = $(datadir)/glib-2.0/gettext/po +DATADIRNAME = share +itlocaledir = $(prefix)/$(DATADIRNAME)/locale subdir = po install_sh = /home/the_hippie/Projekte/xfce4-taskmanager/trunk/install-sh -mkdir_p = mkdir -p -- . -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +# Automake >= 1.8 provides mkdir -p --. +# Until it can be supposed, use the safe fallback: +mkdir_p = $(install_sh) -d -INSTALL = /usr/bin/install -c +INSTALL = /bin/install -c INSTALL_DATA = ${INSTALL} -m 644 -CC = gcc -GENCAT = @GENCAT@ GMSGFMT = /usr/bin/msgfmt MSGFMT = /usr/bin/msgfmt XGETTEXT_ARGS = --keyword=Q_ @@ -50,35 +53,26 @@ INTLTOOL_EXTRACT = $(top_builddir)/intltool-extract MSGMERGE = XGETTEXT_ARGS="$(XGETTEXT_ARGS)" INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist GENPOT = XGETTEXT_ARGS="$(XGETTEXT_ARGS)" INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot -DEFS = -DHAVE_CONFIG_H -CFLAGS = -g -O2 -CPPFLAGS = +ALL_LINGUAS = de eu fi fr hu ja pl pt_BR ru vi zh_TW -INCLUDES = -I.. -I$(top_srcdir)/intl +PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi) -COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) +POFILES=$(shell if test -n "$(PO_LINGUAS)"; then LINGUAS="$(PO_LINGUAS)"; else LINGUAS="$(ALL_LINGUAS)"; fi; for lang in $$LINGUAS; do printf "$$lang.po "; done) -SOURCES = -POFILES = de.po eu.po fi.po fr.po hu.po ja.po pl.po pt_BR.po ru.po vi.po -GMOFILES = de.gmo eu.gmo fi.gmo fr.gmo hu.gmo ja.gmo pl.gmo pt_BR.gmo ru.gmo vi.gmo -DISTFILES = ChangeLog Makefile.in.in POTFILES.in \ -$(POFILES) $(GMOFILES) $(SOURCES) +DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES) +EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS POTFILES = \ +#This Gets Replace for some reason -CATALOGS = de.gmo eu.gmo fi.gmo fr.gmo hu.gmo ja.gmo pl.gmo pt_BR.gmo ru.gmo vi.gmo -CATOBJEXT = .gmo -INSTOBJEXT = .mo +CATALOGS=$(shell if test -n "$(PO_LINGUAS)"; then LINGUAS="$(PO_LINGUAS)"; else LINGUAS="$(ALL_LINGUAS)"; fi; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) .SUFFIXES: -.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat - -.c.o: - $(COMPILE) $< +.SUFFIXES: .po .pox .gmo .mo .msg .cat .po.pox: $(MAKE) $(GETTEXT_PACKAGE).pot - $(MSGMERGE) $< $(top_builddir)/po/$(GETTEXT_PACKAGE).pot -o $*pox + $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox .po.mo: $(MSGFMT) -o $@ $< @@ -89,7 +83,7 @@ INSTOBJEXT = .mo .po.cat: sed -f ../intl/po2msg.sed < $< > $*.msg \ - && rm -f $@ && $(GENCAT) $@ $*.msg + && rm -f $@ && gencat $@ $*.msg all: all-yes @@ -100,115 +94,98 @@ all-no: $(GETTEXT_PACKAGE).pot: $(POTFILES) $(GENPOT) -install: install-exec install-data -install-exec: +install: install-data install-data: install-data-yes install-data-no: all install-data-yes: all - if test -n "$(MKINSTALLDIRS)"; then \ - $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ + $(mkdir_p) $(DESTDIR)$(itlocaledir) + if test -n "$(PO_LINGUAS)"; then \ + linguas="$(PO_LINGUAS)"; \ else \ - $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ - fi - @catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - case "$$cat" in \ - *.gmo) destdir=$(gnulocaledir);; \ - *) destdir=$(localedir);; \ - esac; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ - if test -n "$(MKINSTALLDIRS)"; then \ - $(MKINSTALLDIRS) $$dir; \ + linguas="$(ALL_LINGUAS)"; \ + fi; \ + for lang in $$linguas; do \ + dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $$dir; \ + if test -r $$lang.gmo; then \ + $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ + echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \ else \ - $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ + $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ + echo "installing $(srcdir)/$$lang.gmo as" \ + "$$dir/$(GETTEXT_PACKAGE).mo"; \ fi; \ - if test -r $$cat; then \ - $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ - echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ + if test -r $$lang.gmo.m; then \ + $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \ + echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \ else \ - $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ - echo "installing $(srcdir)/$$cat as" \ - "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ - fi; \ - if test -r $$cat.m; then \ - $(INSTALL_DATA) $$cat.m $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ - echo "installing $$cat.m as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ - else \ - if test -r $(srcdir)/$$cat.m ; then \ - $(INSTALL_DATA) $(srcdir)/$$cat.m \ - $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ - echo "installing $(srcdir)/$$cat as" \ - "$$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m"; \ + if test -r $(srcdir)/$$lang.gmo.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \ + $$dir/$(GETTEXT_PACKAGE).mo.m; \ + echo "installing $(srcdir)/$$lang.gmo.m as" \ + "$$dir/$(GETTEXT_PACKAGE).mo.m"; \ else \ true; \ fi; \ fi; \ done - if test "$(PACKAGE)" = "glib"; then \ - if test -n "$(MKINSTALLDIRS)"; then \ - $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ - else \ - $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ - fi; \ - $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ - $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ - else \ - : ; \ - fi + +# Empty stubs to satisfy archaic automake needs +dvi info tags TAGS ID: # Define this as empty until I found a useful application. installcheck: uninstall: - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ - rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ - rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ - rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ - rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE)$(INSTOBJEXT).m; \ + if test -n "$(PO_LINGUAS)"; then \ + linguas="$(PO_LINGUAS)"; \ + else \ + linguas="$(ALL_LINGUAS)"; \ + fi; \ + for lang in $$linguas; do \ + rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ + rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \ done - if test "$(PACKAGE)" = "glib"; then \ - rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ - fi -check: all - -dvi info tags TAGS ID: +check: all $(GETTEXT_PACKAGE).pot mostlyclean: - rm -f core core.* *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp - rm -fr *.o + rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp rm -f .intltool-merge-cache clean: mostlyclean distclean: clean - rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m + rm -f Makefile Makefile.in POTFILES stamp-it + rm -f *.mo *.msg *.cat *.cat.m *.gmo maintainer-clean: distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." - rm -f $(GMOFILES) + rm -f Makefile.in.in -distdir = ../$(GETTEXT_PACKAGE)-$(VERSION)/$(subdir) -dist distdir: $(DISTFILES) $(GETTEXT_PACKAGE).pot +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: $(DISTFILES) dists="$(DISTFILES)"; \ + extra_dists="$(EXTRA_DISTFILES)"; \ + for file in $$extra_dists; do \ + test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \ + done; \ for file in $$dists; do \ - ln $(srcdir)/$$file $(distdir) 2> /dev/null \ - || cp -p $(srcdir)/$$file $(distdir); \ + test -f $$file || file="$(srcdir)/$$file"; \ + ln $$file $(distdir) 2> /dev/null \ + || cp -p $$file $(distdir); \ done update-po: Makefile $(MAKE) $(GETTEXT_PACKAGE).pot tmpdir=`pwd`; \ - catalogs='$(CATALOGS)'; \ - for cat in $$catalogs; do \ - cat=`basename $$cat`; \ - lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ + if test -n "$(PO_LINGUAS)"; then \ + linguas="$(PO_LINGUAS)"; \ + else \ + linguas="$(ALL_LINGUAS)"; \ + fi; \ + for lang in $$linguas; do \ echo "$$lang:"; \ result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ if $$result; then \ @@ -224,32 +201,20 @@ update-po: Makefile fi; \ fi; \ else \ - echo "msgmerge for $$cat failed!"; \ + echo "msgmerge for $$lang.gmo failed!"; \ rm -f $$tmpdir/$$lang.new.po; \ fi; \ done -# POTFILES is created from POTFILES.in by stripping comments, empty lines -# and Intltool tags (enclosed in square brackets), and appending a full -# relative path to them -POTFILES: POTFILES.in - ( if test 'x$(srcdir)' != 'x.'; then \ - posrcprefix='$(top_srcdir)/'; \ - else \ - posrcprefix="../"; \ - fi; \ - rm -f $@-t $@ \ - && (sed -e '/^#/d' \ - -e "s/^\[.*\] +//" \ - -e '/^[ ]*$$/d' \ - -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ - | sed -e '$$s/\\$$//') > $@-t \ - && chmod a-w $@-t \ - && mv $@-t $@ ) +Makefile POTFILES: stamp-it + @if test ! -f $@; then \ + rm -f stamp-it; \ + $(MAKE) stamp-it; \ + fi -Makefile: Makefile.in.in ../config.status POTFILES +stamp-it: Makefile.in.in ../config.status POTFILES.in cd .. \ - && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \ + && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ $(SHELL) ./config.status # Tell versions [3.59,3.63) of GNU make not to export all variables. diff --git a/src/functions.c b/src/functions.c index 281036b..dfcaa39 100644 --- a/src/functions.c +++ b/src/functions.c @@ -40,7 +40,14 @@ gboolean refresh_task_list(void) if(new_tmp->pid == tmp->pid) { - if((gint)tmp->ppid != (gint)new_tmp->ppid || strcmp(tmp->state,new_tmp->state) || (unsigned int)tmp->size != (unsigned int)new_tmp->size || (unsigned int)tmp->rss != (unsigned int)new_tmp->rss) + tmp->old_time = tmp->time; + + tmp->time = new_tmp->time; + + + tmp->time_percentage = (gdouble)(tmp->time - tmp->old_time) * (gdouble)(1000.0 / REFRESH_INTERVAL); + + if((gint)tmp->ppid != (gint)new_tmp->ppid || strcmp(tmp->state,new_tmp->state) || (unsigned int)tmp->size != (unsigned int)new_tmp->size || (unsigned int)tmp->rss != (unsigned int)new_tmp->rss || (unsigned int)tmp->time != (unsigned int)tmp->old_time) { tmp->ppid = new_tmp->ppid; strcpy(tmp->state, new_tmp->state); diff --git a/src/functions.h b/src/functions.h index 6c4726a..f698959 100644 --- a/src/functions.h +++ b/src/functions.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/src/interface.c b/src/interface.c index 5e1f319..e1b3ab3 100644 --- a/src/interface.c +++ b/src/interface.c @@ -94,50 +94,56 @@ void create_list_store(void) { GtkCellRenderer *cell_renderer; - list_store = gtk_list_store_new(8, G_TYPE_STRING, G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING); + list_store = gtk_tree_store_new(8, G_TYPE_STRING, G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_STRING); cell_renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes(_("Command"), cell_renderer, "text", 0, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, 0); - gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 0, compare_list_item, (void *)0, NULL); + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 0, compare_string_list_item, (void *)0, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); column = gtk_tree_view_column_new_with_attributes(_("PID"), cell_renderer, "text", 1, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, 1); - gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 1, compare_list_item, (void *)1, NULL); + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 1, compare_int_list_item, (void *)1, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); column = gtk_tree_view_column_new_with_attributes(_("PPID"), cell_renderer, "text", 2, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, 2); - gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 2, compare_list_item, (void *)2, NULL); + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 2, compare_string_list_item, (void *)2, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); column = gtk_tree_view_column_new_with_attributes(_("State"), cell_renderer, "text", 3, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, 3); - gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 3, compare_list_item, (void *)3, NULL); + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 3, compare_int_list_item, (void *)3, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); column = gtk_tree_view_column_new_with_attributes(_("VM-Size"), cell_renderer, "text", 4, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, 4); - gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 4, compare_list_item, (void *)4, NULL); + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 4, compare_int_list_item, (void *)4, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); column = gtk_tree_view_column_new_with_attributes(_("RSS"), cell_renderer, "text", 5, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, 5); - gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 5, compare_list_item, (void *)5, NULL); + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 5, compare_int_list_item, (void *)5, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); column = gtk_tree_view_column_new_with_attributes(_("User"), cell_renderer, "text", 6, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_column_set_sort_column_id(column, 6); - gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 6, compare_list_item, (void *)6, NULL); + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 6, compare_string_list_item, (void *)6, NULL); + gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); + + column = gtk_tree_view_column_new_with_attributes(_("CPU%"), cell_renderer, "text", 7, NULL); + gtk_tree_view_column_set_resizable(column, TRUE); + gtk_tree_view_column_set_sort_column_id(column, 7); + gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list_store), 7, compare_int_list_item, (void *)7, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); change_list_store_view(); @@ -266,14 +272,16 @@ void fill_list_item(gint i, GtkTreeIter *iter) gchar *rss = g_strdup_printf("%i kB", task->rss); gchar *name = g_strdup_printf("%s", task->name); gchar *uname = g_strdup_printf("%s", task->uname); - - gtk_list_store_set(GTK_LIST_STORE(list_store), iter, COLUMN_NAME, name, -1); - gtk_list_store_set(GTK_LIST_STORE(list_store), iter, COLUMN_PID, pid, -1); - gtk_list_store_set(GTK_LIST_STORE(list_store), iter, COLUMN_PPID, ppid, -1); - gtk_list_store_set(GTK_LIST_STORE(list_store), iter, COLUMN_STATE, state, -1); - gtk_list_store_set(GTK_LIST_STORE(list_store), iter, COLUMN_MEM, size, -1); - gtk_list_store_set(GTK_LIST_STORE(list_store), iter, COLUMN_RSS, rss, -1); - gtk_list_store_set(GTK_LIST_STORE(list_store), iter, COLUMN_UNAME, uname, -1); + gchar *time = g_strdup_printf("%.1f%%", task->time_percentage); + + gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_NAME, name, -1); + gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_PID, pid, -1); + gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_PPID, ppid, -1); + gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_STATE, state, -1); + gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_MEM, size, -1); + gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_RSS, rss, -1); + gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_UNAME, uname, -1); + gtk_tree_store_set(GTK_TREE_STORE(list_store), iter, COLUMN_TIME, time, -1); free(pid); free(ppid); @@ -282,10 +290,12 @@ void fill_list_item(gint i, GtkTreeIter *iter) free(rss); free(name); free(uname); + free(time); } } + void send_signal_to_task(gchar *task_id, gchar *signal) { if(task_id != "" && signal != NULL) @@ -304,9 +314,9 @@ void send_signal_to_task(gchar *task_id, gchar *signal) void add_new_list_item(gint i) { GtkTreeIter iter; - - gtk_list_store_append(GTK_LIST_STORE(list_store), &iter); - + + gtk_tree_store_append(GTK_TREE_STORE(list_store), &iter, NULL); + fill_list_item(i, &iter); } @@ -346,7 +356,7 @@ void remove_list_item(gint pid) if(pid == atoi(str_data)) { free(str_data); - gtk_list_store_remove(GTK_LIST_STORE(list_store), &iter); + gtk_tree_store_remove(GTK_TREE_STORE(list_store), &iter); break; } @@ -355,43 +365,65 @@ void remove_list_item(gint pid) } } -gint compare_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *iter2, gpointer colnum) +gint compare_int_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *iter2, gpointer column) { - gchar *s1 = ""; - gchar *s2 = ""; + gchar *s1 = NULL; + gchar *s2 = NULL; + + s1 = (gchar*)malloc(sizeof(char) * 100); + s2 = (gchar*)malloc(sizeof(char) * 100); + gint ret = 0; - gtk_tree_model_get(model, iter1, colnum, &s1, -1); - gtk_tree_model_get(model, iter2, colnum, &s2, -1); + gtk_tree_model_get(model, iter1, column, &s1, -1); + gtk_tree_model_get(model, iter2, column, &s2, -1); - if(GPOINTER_TO_INT(colnum) == 1 || GPOINTER_TO_INT(colnum) == 2 || GPOINTER_TO_INT(colnum) == 4 || GPOINTER_TO_INT(colnum) == 5) - { - gint i1 = 0; - gint i2 = 0; + gint i1 = 0; + gint i2 = 0; - if(s1 != NULL) - i1 = atoi(s1); + if(s1 != NULL) + i1 = atoi(s1); - if(s2 != NULL) - i2 = atoi(s2); + if(s2 != NULL) + i2 = atoi(s2); + + ret = i1 - i2; - if(i1 < i2) - ret = -1; - else - ret = 1; - } - else - { - if(s1 == NULL) - s1 = ""; - if(s2 == NULL) - s2 = ""; + if(s1 != NULL) + g_free(s1); + if(s2 != NULL) + g_free(s2); - ret = strcmp(s1, s2); - } + return ret; +} + +gint compare_string_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *iter2, gpointer column) +{ + gchar *s1 = NULL; + gchar *s2 = NULL; - free(s1); - free(s2); + s1 = (gchar*)malloc(sizeof(gchar) * 100); + s2 = (gchar*)malloc(sizeof(gchar) * 100); + + gint ret = 0; + + gtk_tree_model_get(model, iter1, GPOINTER_TO_INT(column), &s1, -1); + gtk_tree_model_get(model, iter2, GPOINTER_TO_INT(column), &s2, -1); + + if(s1 == NULL) + s1 = ""; + if(s2 == NULL) + s2 = ""; + + ret = strcmp(s1, s2); + + /* if not commented it produces segfaults + if commented it produces mem-leak X-( ->> have to fix */ + + /*if(s1 == NULL) + g_free(s1); + if(s2 != NULL) + g_free(s2);*/ return ret; } @@ -399,7 +431,7 @@ gint compare_list_item(GtkTreeModel *model, GtkTreeIter *iter1, GtkTreeIter *ite /* change the task view (user, root, other) */ void change_task_view(void) { - gtk_list_store_clear(GTK_LIST_STORE(list_store)); + gtk_tree_store_clear(GTK_TREE_STORE(list_store)); gint i = 0; for(i = 0; i < tasks; i++) diff --git a/src/interface.h b/src/interface.h index 2a67d62..a5ca605 100644 --- a/src/interface.h +++ b/src/interface.h @@ -40,7 +40,7 @@ #include "callbacks.h" #include "types.h" -GtkListStore *list_store; +GtkTreeStore *list_store; GtkTreeSelection *selection; GtkWidget *treeview; GtkWidget *mainmenu; @@ -53,6 +53,7 @@ GtkWidget *taskpopup; #define COLUMN_MEM 4 #define COLUMN_RSS 5 #define COLUMN_UNAME 6 +#define COLUMN_TIME 7 GtkTreeViewColumn *column; @@ -68,6 +69,8 @@ void show_about_dialog(void); void fill_list_item(gint i, GtkTreeIter *iter); void add_new_list_item(gint i); gint compare_list_item(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data); +gint compare_int_list_item(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data); +gint compare_string_list_item(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data); void remove_list_item(gint i); void refresh_list_item(gint i); diff --git a/src/linux.c b/src/linux.c index dd519cb..0ec1228 100644 --- a/src/linux.c +++ b/src/linux.c @@ -17,7 +17,7 @@ struct task get_task_details(gint pid) stat(filename, &status); - memset(&task, 0, sizeof(struct task)); + //memset(&task, 0, sizeof(struct task)); task.pid = -1; task.checked = FALSE; @@ -26,7 +26,10 @@ struct task get_task_details(gint pid) { while(fgets(buffer_status, sizeof(buffer_status), task_file) != NULL) { - sscanf(buffer_status, "%i (%s %c %i %i %i %i %i %s %s %s %s %s %s %s %i %i %i %i %i %i %i %i %i %s %s %s %i %s %s %s %s %s %s %s %s %s %s %i %s %s", + gint utime = 0; + gint stime = 0; + + sscanf(buffer_status, "%i (%s %1s %i %i %i %i %i %s %s %s %s %s %i %i %i %i %i %i %i %i %i %i %i %s %s %s %i %s %s %s %s %s %s %s %s %s %s %i %s %s", &task.pid, // processid &task.name, // processname &task.state, // processstate @@ -42,8 +45,8 @@ struct task get_task_details(gint pid) &dummy, // cminflt &dummy, // majflt &dummy, // cmajflt - &dummy, // utime the number of jiffies that this process has scheduled in user mode - &dummy, // stime " kernel mode + &utime, // utime the number of jiffies that this process has scheduled in user mode + &stime, // stime " kernel mode &dummy, // cutime " waited for children in user &dummy, // cstime " kernel mode @@ -77,6 +80,9 @@ struct task get_task_details(gint pid) &dummy ); + task.time = stime + utime; + task.old_time = task.time; + task.time_percentage = 0; } task.uid = status.st_uid; passwdp = getpwuid(task.uid); diff --git a/src/types.h b/src/types.h index 35eba42..0c8a01f 100644 --- a/src/types.h +++ b/src/types.h @@ -36,6 +36,9 @@ struct task gint size; gint rss; gboolean checked; + gint time; + gint old_time; + gdouble time_percentage; }; GtkWidget *main_window;