diff -u notification-daemon-0.3.7/debian/patches/01_ubuntu_theme.patch notification-daemon-0.3.7/debian/patches/01_ubuntu_theme.patch --- notification-daemon-0.3.7/debian/patches/01_ubuntu_theme.patch +++ notification-daemon-0.3.7/debian/patches/01_ubuntu_theme.patch @@ -30,10 +30,10 @@ +libubuntu_la_LIBADD = $(NOTIFICATION_DAEMON_LIBS) + +INCLUDES = $(NOTIFICATION_DAEMON_CFLAGS) -diff -Nur notification-daemon-0.3.7/src/themes/ubuntu/theme.c notification-daemon-0.3.7.new/src/themes/ubuntu/theme.c ---- notification-daemon-0.3.7/src/themes/ubuntu/theme.c 1970-01-01 01:00:00.000000000 +0100 -+++ notification-daemon-0.3.7.new/src/themes/ubuntu/theme.c 2007-08-07 11:10:54.000000000 +0200 -@@ -0,0 +1,796 @@ +diff -ruN notification-daemon-0.3.7/src/themes/ubuntu/theme.c notification-daemon-0.3.7-new/src/themes/ubuntu/theme.c +--- notification-daemon-0.3.7/src/themes/ubuntu/theme.c 1969-12-31 16:00:00.000000000 -0800 ++++ notification-daemon-0.3.7-new/src/themes/ubuntu/theme.c 2007-08-07 21:39:52.000000000 -0700 +@@ -0,0 +1,798 @@ +#include "config.h" + +#include @@ -238,7 +238,7 @@ + // for the tips) + GtkWidget *fake = gtk_window_new(GTK_WINDOW_POPUP); + gtk_widget_set_name(fake, "gtk-tooltip"); -+ gtk_widget_realize(fake); ++ gtk_widget_ensure_style(fake); + GtkStyle *style = gtk_widget_get_style(fake); + GdkColor bg_color = style->bg[GTK_STATE_NORMAL]; + gtk_widget_destroy(fake); @@ -541,20 +541,20 @@ +countdown_expose_cb(GtkWidget *pie, GdkEventExpose *event, + WindowData *windata) +{ -+ // Cloned from draw_border -+ // get the tooltip bg color and use it for the notifications -+ GtkTooltips *tips = gtk_tooltips_new(); ++ // Cloned from draw_border ++ + // create a "fake" widget here to that we can attach the tips too + // and destory afterwards (to make sure we don't create a mem-leak + // for the tips) -+ GtkWidget *fake = gtk_window_new(GTK_WINDOW_TOPLEVEL); -+ gtk_tooltips_set_tip(tips, fake, "",""); -+ gtk_tooltips_force_window(tips); -+ gtk_widget_realize(tips->tip_window); -+ GtkStyle *style = gtk_widget_get_style(tips->tip_window); -+ GdkGC *bg_gc = style->bg_gc[GTK_STATE_NORMAL]; ++ GtkWidget *fake = gtk_window_new(GTK_WINDOW_POPUP); ++ gtk_widget_set_name(fake, "gtk-tooltip"); ++ gtk_widget_realize(fake); ++ GtkStyle *style = gtk_widget_get_style(fake); + gtk_widget_destroy(fake); + ++ GdkGC *bg_gc = gdk_gc_new(GDK_DRAWABLE(pie->window)); ++ gdk_gc_set_foreground(bg_gc, &style->bg[GTK_STATE_NORMAL]); ++ + gdk_draw_rectangle(GDK_DRAWABLE(pie->window), bg_gc, TRUE, + 0, 0, pie->allocation.width, pie->allocation.height); + @@ -569,6 +569,8 @@ + 90 * 64, pct * 360.0 * 64.0); + } + ++ g_object_unref(bg_gc); ++ + return TRUE; +} + reverted: --- notification-daemon-0.3.7/debian/patches/05_dont_crash_on_critical_warnings.patch +++ notification-daemon-0.3.7.orig/debian/patches/05_dont_crash_on_critical_warnings.patch @@ -1,21 +0,0 @@ -diff -Nur notification-daemon-0.3.7-1ubuntu1/src/daemon/daemon.c.rej notification-daemon-0.3.7-1ubuntu1.new/src/daemon/daemon.c.rej ---- notification-daemon-0.3.7-1ubuntu1/src/daemon/daemon.c.rej 1970-01-01 01:00:00.000000000 +0100 -+++ notification-daemon-0.3.7-1ubuntu1.new/src/daemon/daemon.c.rej 2007-05-25 14:57:01.000000000 +0200 -@@ -0,0 +1,17 @@ -+*************** -+*** 1065,1071 **** -+ GError *error; -+ guint request_name_result; -+ -+- g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); -+ -+ gtk_init(&argc, &argv); -+ gconf_init(argc, argv, NULL); -+--- 1065,1071 ---- -+ GError *error; -+ guint request_name_result; -+ -++ //g_log_set_always_fatal(G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL); -+ -+ gtk_init(&argc, &argv); -+ gconf_init(argc, argv, NULL); diff -u notification-daemon-0.3.7/debian/changelog notification-daemon-0.3.7/debian/changelog --- notification-daemon-0.3.7/debian/changelog +++ notification-daemon-0.3.7/debian/changelog @@ -1,3 +1,13 @@ +notification-daemon (0.3.7-1ubuntu5) gutsy; urgency=low + + * 01_ubuntu_theme.patch: + - Fix countdown notifications too. Closes LP: #129120. + - Use gtk_widget_ensure_style instead of gtk_widget_realize. + * Refreshed intltool. Unbreak the build! + * Removed 05_dont_crash_on_critical_warnings.patch + + -- Scott Robinson Tue, 07 Aug 2007 22:11:21 -0700 + notification-daemon (0.3.7-1ubuntu4) gutsy; urgency=low * debian/patches/01_ubuntu_theme.patch: only in patch2: unchanged: --- notification-daemon-0.3.7.orig/intltool-extract.in +++ notification-daemon-0.3.7/intltool-extract.in @@ -32,7 +32,7 @@ ## Release information my $PROGRAM = "intltool-extract"; my $PACKAGE = "intltool"; -my $VERSION = "0.35.0"; +my $VERSION = "0.36.0"; ## Loaded modules use strict; @@ -114,6 +114,11 @@ sub place_normal { $FILE = $ARGV[0]; $OUTFILE = "$FILE.h"; + + my $dirname = dirname ($OUTFILE); + if (! -d "$dirname" && $dirname ne "") { + system ("mkdir -p $dirname"); + } } sub place_local { @@ -156,7 +161,7 @@ --type=TYPE Specify the file type of FILENAME. Currently supports: "gettext/glade", "gettext/ini", "gettext/keys" "gettext/rfc822deb", "gettext/schemas", - "gettext/scheme", "gettext/xml" + "gettext/scheme", "gettext/xml", "gettext/quoted" -l, --local Writes output into current working directory (conflicts with --update) --update Writes output into the same directory the source file @@ -212,6 +217,7 @@ &type_scheme if $gettext_type eq "scheme"; &type_schemas if $gettext_type eq "schemas"; &type_rfc822deb if $gettext_type eq "rfc822deb"; + &type_quoted if $gettext_type eq "quoted"; } sub entity_decode_minimal @@ -231,9 +237,9 @@ s/'/'/g; # ' s/"/"/g; # " - s/&/&/g; s/<//g; + s/&/&/g; return $_; } @@ -242,7 +248,7 @@ { return '\"' if $_ eq '"'; return '\n' if $_ eq "\n"; - return '\\' if $_ eq '\\'; + return '\\\\' if $_ eq '\\'; return $_; } @@ -255,8 +261,11 @@ sub type_ini { ### For generic translatable desktop files ### - while ($input =~ /^_.*=(.*)$/mg) { - $messages{$1} = []; + while ($input =~ /^(#(.+)\n)?^_.*=(.*)$/mg) { + if (defined($2)) { + $comments{$3} = $2; + } + $messages{$3} = []; } } @@ -711,6 +720,17 @@ return @list; } +sub type_quoted { + while ($input =~ /\"(([^\"]|\\\")*[^\\\"])\"/g) { + my $message = $1; + my $before = $`; + $message =~ s/\\\"/\"/g; + $before =~ s/[^\n]//g; + $messages{$message} = []; + $loc{$message} = length ($before) + 2; + } +} + sub type_glade { ### For translatable Glade XML files ### only in patch2: unchanged: --- notification-daemon-0.3.7.orig/intltool-merge.in +++ notification-daemon-0.3.7/intltool-merge.in @@ -35,7 +35,7 @@ ## Release information my $PROGRAM = "intltool-merge"; my $PACKAGE = "intltool"; -my $VERSION = "0.35.0"; +my $VERSION = "0.36.0"; ## Loaded modules use strict; @@ -60,6 +60,7 @@ my $DESKTOP_STYLE_ARG = 0; my $SCHEMAS_STYLE_ARG = 0; my $RFC822DEB_STYLE_ARG = 0; +my $QUOTED_STYLE_ARG = 0; my $QUIET_ARG = 0; my $PASS_THROUGH_ARG = 0; my $UTF8_ARG = 0; @@ -79,6 +80,7 @@ "desktop-style|d" => \$DESKTOP_STYLE_ARG, "schemas-style|s" => \$SCHEMAS_STYLE_ARG, "rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG, + "quoted-style" => \$QUOTED_STYLE_ARG, "pass-through|p" => \$PASS_THROUGH_ARG, "utf8|u" => \$UTF8_ARG, "multiple-output|m" => \$MULTIPLE_OUTPUT, @@ -91,9 +93,35 @@ my %po_files_by_lang = (); my %translations = (); -my $iconv = $ENV{"ICONV"} || $ENV{"INTLTOOL_ICONV"} || "@INTLTOOL_ICONV@"; +my $iconv = $ENV{"ICONV"} || "iconv"; my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null'); +sub isProgramInPath +{ + my ($file) = @_; + # If either a file exists, or when run it returns 0 exit status + return 1 if ((-x $file) or (system("$file --version >$devnull") == 0)); + return 0; +} + +sub isGNUGettextTool +{ + my ($file) = @_; + # Check that we are using GNU gettext tools + if (isProgramInPath ($file)) { + my $version = `$file --version`; + return 1 if ($version =~ m/.*\(GNU .*\).*/); + } + return 0; +} + +if (! isGNUGettextTool ("$iconv")) +{ + print STDERR " *** GNU iconv is not found on this system!\n". + " *** Without it, intltool-merge can not convert encodings.\n"; + exit; +} + # Use this instead of \w for XML files to handle more possible characters. my $w = "[-A-Za-z0-9._:]"; @@ -157,6 +185,14 @@ &rfc822deb_merge_translations; &finalize; } +elsif ($QUOTED_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + "ed_merge_translations; + &finalize; +} else { &print_help; @@ -193,6 +229,7 @@ -k, --keys-style includes translations in the keys style -s, --schemas-style includes translations in the schemas style -r, --rfc822deb-style includes translations in the RFC822 style + --quoted-style includes translations in the quoted string style -x, --xml-style includes translations in the standard xml style Other options: @@ -415,7 +452,7 @@ { $nextfuzzy = 1 if /^#, fuzzy/; - if (/^msgid "((\\.|[^\\])*)"/ ) + if (/^msgid "((\\.|[^\\]+)*)"/ ) { $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; $msgid = ""; @@ -431,14 +468,14 @@ $nextfuzzy = 0; } - if (/^msgstr "((\\.|[^\\])*)"/) + if (/^msgstr "((\\.|[^\\]+)*)"/) { $msgstr = unescape_po_string($1); $inmsgstr = 1; $inmsgid = 0; } - if (/^"((\\.|[^\\])*)"/) + if (/^"((\\.|[^\\]+)*)"/) { $msgid .= unescape_po_string($1) if $inmsgid; $msgstr .= unescape_po_string($1) if $inmsgstr; @@ -483,16 +520,15 @@ return $string; } -## NOTE: deal with < - < but not > - > because it seems its ok to have -## > in the entity. For further info please look at #84738. sub entity_decode { local ($_) = @_; s/'/'/g; # ' s/"/"/g; # " - s/&/&/g; s/<//g; + s/&/&/g; return $_; } @@ -1006,8 +1042,8 @@ if ($MULTIPLE_OUTPUT) { for my $lang (sort keys %po_files_by_lang) { - if ( ! -e $lang ) { - mkdir $lang or die "Cannot create subdirectory $lang: $!\n"; + if ( ! -d $lang ) { + mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; } open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; binmode (OUTPUT) if $^O eq 'MSWin32'; @@ -1354,3 +1390,39 @@ return @list; } +sub quoted_translation +{ + my ($lang, $string) = @_; + + $string =~ s/\\\"/\"/g; + + my $translation = $translations{$lang, $string}; + $translation = $string if !$translation; + + $translation =~ s/\"/\\\"/g; + return $translation +} + +sub quoted_merge_translations +{ + if (!$MULTIPLE_OUTPUT) { + print "Quoted only supports Multiple Output.\n"; + exit(1); + } + + for my $lang (sort keys %po_files_by_lang) { + if ( ! -d $lang ) { + mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n"; + } + open INPUT, "<${FILE}" or die; + open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; + binmode (OUTPUT) if $^O eq 'MSWin32'; + while () + { + s/\"(([^\"]|\\\")*[^\\\"])\"/"\"" . "ed_translation($lang, $1) . "\""/ge; + print OUTPUT; + } + close OUTPUT; + close INPUT; + } +} only in patch2: unchanged: --- notification-daemon-0.3.7.orig/po/Makefile.in.in +++ notification-daemon-0.3.7/po/Makefile.in.in @@ -25,7 +25,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ -top_builddir = .. +top_builddir = @top_builddir@ VPATH = @srcdir@ prefix = @prefix@ @@ -56,15 +56,19 @@ PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi) -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) +USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS`" -o -n "`echo $$ALINGUAS|grep ' ?$$lang ?'`"; then printf "$$lang "; fi; done; fi) + +USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done) + +POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done) DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES) EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS POTFILES = \ -#This Gets Replace for some reason +# This comment gets stripped out -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) +CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) .SUFFIXES: .SUFFIXES: .po .pox .gmo .mo .msg .cat @@ -98,11 +102,7 @@ install-data-no: all install-data-yes: all $(mkdir_p) $(DESTDIR)$(itlocaledir) - if test -n "$(PO_LINGUAS)"; then \ - linguas="$(PO_LINGUAS)"; \ - else \ - linguas="$(ALL_LINGUAS)"; \ - fi; \ + linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \ $(mkdir_p) $$dir; \ @@ -133,20 +133,21 @@ dvi info tags TAGS ID: # Define this as empty until I found a useful application. -installcheck: +install-exec installcheck: uninstall: - if test -n "$(PO_LINGUAS)"; then \ - linguas="$(PO_LINGUAS)"; \ - else \ - linguas="$(ALL_LINGUAS)"; \ - fi; \ + linguas="$(USE_LINGUAS)"; \ 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 check: all $(GETTEXT_PACKAGE).pot + rm -f missing notexist + srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m + if [ -r missing -o -r notexist ]; then \ + exit 1; \ + fi mostlyclean: rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp @@ -179,11 +180,7 @@ update-po: Makefile $(MAKE) $(GETTEXT_PACKAGE).pot tmpdir=`pwd`; \ - if test -n "$(PO_LINGUAS)"; then \ - linguas="$(PO_LINGUAS)"; \ - else \ - linguas="$(ALL_LINGUAS)"; \ - fi; \ + linguas="$(USE_LINGUAS)"; \ for lang in $$linguas; do \ echo "$$lang:"; \ result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ @@ -211,8 +208,8 @@ $(MAKE) stamp-it; \ fi -stamp-it: Makefile.in.in ../config.status POTFILES.in - cd .. \ +stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in + cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ $(SHELL) ./config.status only in patch2: unchanged: --- notification-daemon-0.3.7.orig/intltool-update.in +++ notification-daemon-0.3.7/intltool-update.in @@ -30,7 +30,7 @@ ## Release information my $PROGRAM = "intltool-update"; -my $VERSION = "0.35.0"; +my $VERSION = "0.36.0"; my $PACKAGE = "intltool"; ## Loaded modules @@ -71,7 +71,8 @@ "sheet(?:\\.in)+|". # ? "schemas(?:\\.in)+|". # GConf specific "pong(?:\\.in)+|". # DEPRECATED: PONG is not used [by GNOME] any longer. -"kbd(?:\\.in)+"; # GOK specific. +"kbd(?:\\.in)+|". # GOK specific. +"policy(?:\\.in)+"; # PolicyKit files my $ini_support = "icon(?:\\.in)+|". # http://www.freedesktop.org/Standards/icon-theme-spec @@ -90,10 +91,9 @@ $| = 1; ## Sometimes the source tree will be rooted somewhere else. -my $SRCDIR = "."; +my $SRCDIR = $ENV{"srcdir"} || "."; my $POTFILES_in; -$SRCDIR = $ENV{"srcdir"} if $ENV{"srcdir"}; $POTFILES_in = "<$SRCDIR/POTFILES.in"; my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null'); @@ -124,8 +124,10 @@ &Console_Write_IntltoolHelp if $arg_count > 1; +my $PKGNAME = FindPackageName (); + # --version and --help don't require a module name -my $MODULE = $GETTEXT_PACKAGE || &FindPackageName || "unknown"; +my $MODULE = $GETTEXT_PACKAGE || $PKGNAME || "unknown"; if ($POT_ARG) { @@ -316,7 +318,8 @@ @buf_potfiles_ignore, @buf_allfiles, @buf_allfiles_sorted, - @buf_potfiles_sorted + @buf_potfiles_sorted, + @buf_potfiles_ignore_sorted ); ## Search and find all translatable files @@ -326,7 +329,12 @@ push @buf_i18n_ini, "$File::Find::name" if /\.($ini_support)$/; push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/; }, ".."; - + find sub { + push @buf_i18n_plain, "$File::Find::name" if /\.($buildin_gettext_support)$/; + push @buf_i18n_xml, "$File::Find::name" if /\.($xml_support)$/; + push @buf_i18n_ini, "$File::Find::name" if /\.($ini_support)$/; + push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/; + }, "$SRCDIR/.."; open POTFILES, $POTFILES_in or die "$PROGRAM: there's no POTFILES.in!\n"; @buf_potfiles = grep !/^(#|\s*$)/, ; @@ -342,7 +350,7 @@ ## comparing with POTFILES.in foreach my $ignore ("POTFILES.skip", "POTFILES.ignore") { - (-s $ignore) or next; + (-s "$SRCDIR/$ignore") or next; if ("$ignore" eq "POTFILES.ignore") { @@ -351,7 +359,7 @@ } print "Found $ignore: Ignoring files...\n" if $VERBOSE; - open FILE, "<$ignore" or die "ERROR: Failed to open $ignore!\n"; + open FILE, "<$SRCDIR/$ignore" or die "ERROR: Failed to open $SRCDIR/$ignore!\n"; while () { @@ -359,7 +367,7 @@ } close FILE; - @buf_potfiles = (@buf_potfiles_ignore, @buf_potfiles); + @buf_potfiles_ignore_sorted = sort (@buf_potfiles_ignore); } foreach my $file (@buf_i18n_plain) @@ -417,7 +425,7 @@ } } - if (/\.GetString ?\(QUOTEDTEXT/) + if (/\w\.GetString *\(QUOTEDTEXT/) { if (defined isNotValidMissing (unpack("x3 A*", $file))) { ## Remove the first 3 chars and add newline @@ -426,7 +434,8 @@ last; } - if (/_\(QUOTEDTEXT/) + ## N_ Q_ and _ are the three macros defined in gi8n.h + if (/[NQ]?_ *\(QUOTEDTEXT/) { if (defined isNotValidMissing (unpack("x3 A*", $file))) { ## Remove the first 3 chars and add newline @@ -486,6 +495,15 @@ my %in2; foreach (@buf_potfiles_sorted) { + s#^$SRCDIR/../##; + s#^$SRCDIR/##; + $in2{$_} = 1; + } + + foreach (@buf_potfiles_ignore_sorted) + { + s#^$SRCDIR/../##; + s#^$SRCDIR/##; $in2{$_} = 1; } @@ -493,9 +511,15 @@ foreach (@buf_allfiles_sorted) { - if (!exists($in2{$_})) + my $dummy = $_; + my $srcdir = $SRCDIR; + + $srcdir =~ s#^../##; + $dummy =~ s#^$srcdir/../##; + $dummy =~ s#^$srcdir/##; + if (!exists($in2{$dummy})) { - push @result, $_ + push @result, $dummy } } @@ -504,7 +528,7 @@ foreach (@buf_potfiles_sorted) { chomp (my $dummy = $_); - if ("$dummy" ne "" and ! -f "../$dummy") + if ("$dummy" ne "" and !(-f "$SRCDIR/../$dummy" or -f "../$dummy")) { push @buf_potfiles_notexist, $_; } @@ -537,7 +561,7 @@ warn "\n" if ($VERBOSE or @result); warn "\e[1mThe following files do not exist anymore:\e[0m\n\n"; warn @buf_potfiles_notexist, "\n"; - warn "Please remove them from POTFILES.in or POTFILES.skip. A file \e[1m'notexist'\e[0m\n". + warn "Please remove them from POTFILES.in. A file \e[1m'notexist'\e[0m\n". "containing this list of absent files has been written in the current directory.\n"; } } @@ -555,16 +579,33 @@ exit 1; } -sub GenerateHeaders +sub isProgramInPath { - my $EXTRACT = "@INTLTOOL_EXTRACT@"; - chomp $EXTRACT; + my ($file) = @_; + # If either a file exists, or when run it returns 0 exit status + return 1 if ((-x $file) or (system("$file --version >$devnull") == 0)); + return 0; +} - $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} if $ENV{"INTLTOOL_EXTRACT"}; +sub isGNUGettextTool +{ + my ($file) = @_; + # Check that we are using GNU gettext tools + if (isProgramInPath ($file)) + { + my $version = `$file --version`; + return 1 if ($version =~ m/.*\(GNU .*\).*/); + } + return 0; +} + +sub GenerateHeaders +{ + my $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} || "intltool-extract"; ## Generate the .h header files, so we can allow glade and ## xml translation support - if (! -x "$EXTRACT") + if (! isProgramInPath ("$EXTRACT")) { print STDERR "\n *** The intltool-extract script wasn't found!" ."\n *** Without it, intltool-update can not generate files.\n"; @@ -611,13 +652,13 @@ # sub GeneratePOTemplate { - my $XGETTEXT = $ENV{"XGETTEXT"} || "@INTLTOOL_XGETTEXT@"; + my $XGETTEXT = $ENV{"XGETTEXT"} || "xgettext"; my $XGETTEXT_ARGS = $ENV{"XGETTEXT_ARGS"} || ''; chomp $XGETTEXT; - if (! -x $XGETTEXT) + if (! isGNUGettextTool ("$XGETTEXT")) { - print STDERR " *** xgettext is not found on this system!\n". + print STDERR " *** GNU xgettext is not found on this system!\n". " *** Without it, intltool-update can not extract strings.\n"; exit; } @@ -671,12 +712,8 @@ } else { - if ($SRCDIR eq ".") { - print OUTFILE "../$_\n"; - } else { - print OUTFILE "$SRCDIR/../$_\n"; - } - $gettext_code = &TextFile_DetermineEncoding ("../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code); + print OUTFILE "$SRCDIR/../$_\n"; + $gettext_code = &TextFile_DetermineEncoding ("$SRCDIR/../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code); } next if (! $gettext_support_nonascii); @@ -717,7 +754,23 @@ unlink "$MODULE.pot"; my @xgettext_argument=("$XGETTEXT", "--add-comments", - "--directory\=\.", + "--directory\=.", + "--default-domain\=$MODULE", + "--flag\=g_strdup_printf:1:c-format", + "--flag\=g_string_printf:2:c-format", + "--flag\=g_string_append_printf:2:c-format", + "--flag\=g_error_new:3:c-format", + "--flag\=g_set_error:4:c-format", + "--flag\=g_markup_printf_escaped:1:c-format", + "--flag\=g_log:3:c-format", + "--flag\=g_print:1:c-format", + "--flag\=g_printerr:1:c-format", + "--flag\=g_printf:1:c-format", + "--flag\=g_fprintf:2:c-format", + "--flag\=g_sprintf:2:c-format", + "--flag\=g_snprintf:3:c-format", + "--flag\=g_scanner_error:2:c-format", + "--flag\=g_scanner_warn:2:c-format", "--output\=$MODULE\.pot", "--files-from\=\.\/POTFILES\.in\.temp"); my $XGETTEXT_KEYWORDS = &FindPOTKeywords; @@ -784,9 +837,16 @@ { -f "$MODULE.pot" or die "$PROGRAM: $MODULE.pot does not exist.\n"; - my $MSGMERGE = $ENV{"MSGMERGE"} || "@INTLTOOL_MSGMERGE@"; + my $MSGMERGE = $ENV{"MSGMERGE"} || "msgmerge"; my ($lang, $outfile) = @_; + if (! isGNUGettextTool ("$MSGMERGE")) + { + print STDERR " *** GNU msgmerge is not found on this system!\n". + " *** Without it, intltool-update can not extract strings.\n"; + exit; + } + print "Merging $SRCDIR/$lang.po with $MODULE.pot..." if $VERBOSE; my $infile = "$SRCDIR/$lang.po"; @@ -827,7 +887,14 @@ sub Console_Write_TranslationStatus { my ($lang, $output_file) = @_; - my $MSGFMT = $ENV{"MSGFMT"} || "@INTLTOOL_MSGFMT@"; + my $MSGFMT = $ENV{"MSGFMT"} || "msgfmt"; + + if (! isGNUGettextTool ("$MSGFMT")) + { + print STDERR " *** GNU msgfmt is not found on this system!\n". + " *** Without it, intltool-update can not extract strings.\n"; + exit; + } $output_file = "$SRCDIR/$lang.po" if ($output_file eq ""); @@ -836,7 +903,14 @@ sub Console_Write_CoverageReport { - my $MSGFMT = $ENV{"MSGFMT"} || "@INTLTOOL_MSGFMT@"; + my $MSGFMT = $ENV{"MSGFMT"} || "msgfmt"; + + if (! isGNUGettextTool ("$MSGFMT")) + { + print STDERR " *** GNU msgfmt is not found on this system!\n". + " *** Without it, intltool-update can not extract strings.\n"; + exit; + } &GatherPOFiles;