diff --git a/ChangeLog b/ChangeLog index 4633dc0..cd7306c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,22 +1,3 @@ -2006-03-22 Bernhard Walle - - * applied patch from Debian: don't use libgtop any more, so remove it - from the Makefile (thanks to Rudy Godoy and Martin Michlmayr - -2005-11-02 Bernhard Walle - * added Portuguese (Brazil) translation - -2005-10-18 Bernhard Walle - * added Spanish translation, thanks to Rudy Godoy - * changed some fileds in the translation files because the new tool - version in SUSE 10.0 require non-standard fields (and changing them - was faster than finding out the parameter to change this) - * replaced autogen.sh by one using Xfce Deveopement tools - -2005-10-04 Bernhard Walle - * removed generated files and use Xfce Deveopement tools - * added Russian translation, thanks to Fedoseev Sergey - 2005-08-21 Bernhard Walle * Fixed memory leak (thanks to Brian J. Tarricone) * Custom bar colors now also work with special Gtk theme engine where diff --git a/Makefile.am b/Makefile.am index 911f8ed..c0d1aaf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,9 +2,23 @@ SUBDIRS = panel-plugin po -EXTRA_DIST = \ - README - distclean-local: rm -rf *.cache *~ +dist-bz2: dist + zcat $(PACKAGE)-$(VERSION).tar.gz | bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2 + +distcheck-bz2: distcheck + zcat $(PACKAGE)-$(VERSION).tar.gz | bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2 + +EXTRA_DIST = \ + README \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in + +DISTCLEANFILES = \ + intltool-extract \ + intltool-merge \ + intltool-update + diff --git a/compile b/compile index 1b1d232..80b645b 100755 --- a/compile +++ b/compile @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand `-c -o'. -scriptversion=2005-05-14.22 +scriptversion=2004-09-10.20 -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify @@ -18,7 +18,7 @@ scriptversion=2005-05-14.22 # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -47,11 +47,11 @@ right script to run: please start by reading the file `INSTALL'. Report bugs to . EOF - exit $? + exit 0 ;; -v | --v*) echo "compile $scriptversion" - exit $? + exit 0 ;; esac @@ -125,8 +125,6 @@ ret=$? if test -f "$cofile"; then mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" diff --git a/configure.ac b/configure.ac index 8c99832..4c353f0 100644 --- a/configure.ac +++ b/configure.ac @@ -5,18 +5,21 @@ dnl dnl 2003 Benedikt Meurer dnl -AC_INIT([panel-plugin/netload.c]) +m4_define([netload_version],[0.4.0]) +AC_INIT([xfce4-netload-plugin], [netload_version()], + [xfce-goodies-dev@lists.berlios.de]) + +NETLOAD_VERSION=netload_version() +AM_INIT_AUTOMAKE([xfce4-netload-plugin], [$NETLOAD_VERSION]) AM_CONFIG_HEADER([config.h]) -AM_INIT_AUTOMAKE([xfce4-netload-plugin], [0.3.3]) - AM_MAINTAINER_MODE dnl Check for basic programs AC_PROG_CC AC_PROG_INSTALL -AC_PROG_LIBTOOL +AC_PROG_INTLTOOL dnl Check for standard header files AC_HEADER_STDC @@ -48,14 +51,14 @@ AC_CHECK_LIB(kstat, kstat_open, SOLLIBS="-lkstat -lsocket", SOLLIBS="") AC_CHECK_LIB(nsl, kstat_open, SOLLIBS="$SOLLIBS -linet_ntop", SOLLIBS="$SOLLIBS") AC_SUBST(SOLLIBS) -dnl Check for i18n support -BM_I18N([xfce4-netload], [ca de es eu fr hu ko lt pl pt_BR uk ru vi]) - dnl configure the panel plugin -XFCE_PANEL_PLUGIN([XFCE4_PANEL], [4.0.0]) +XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.20]) + +dnl Check for i18n support +XDT_I18N([ca de fr ko lt pl uk]) dnl Check for debugging support -BM_DEBUG_SUPPORT +XDT_FEATURE_DEBUG() AC_OUTPUT([ Makefile @@ -63,5 +66,3 @@ panel-plugin/Makefile po/Makefile.in ]) - - diff --git a/intltool-extract.in b/intltool-extract.in new file mode 100644 index 0000000..adfa971 --- /dev/null +++ b/intltool-extract.in @@ -0,0 +1,839 @@ +#!@INTLTOOL_PERL@ -w +# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +# +# The Intltool Message Extractor +# +# Copyright (C) 2000-2001, 2003 Free Software Foundation. +# +# Intltool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# Intltool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# Authors: Kenneth Christiansen +# Darin Adler +# + +## Release information +my $PROGRAM = "intltool-extract"; +my $PACKAGE = "intltool"; +my $VERSION = "0.34.1"; + +## Loaded modules +use strict; +use File::Basename; +use Getopt::Long; + +## Scalars used by the option stuff +my $TYPE_ARG = "0"; +my $LOCAL_ARG = "0"; +my $HELP_ARG = "0"; +my $VERSION_ARG = "0"; +my $UPDATE_ARG = "0"; +my $QUIET_ARG = "0"; +my $SRCDIR_ARG = "."; + +my $FILE; +my $OUTFILE; + +my $gettext_type = ""; +my $input; +my %messages = (); +my %loc = (); +my %count = (); +my %comments = (); +my $strcount = 0; + +my $XMLCOMMENT = ""; + +## Use this instead of \w for XML files to handle more possible characters. +my $w = "[-A-Za-z0-9._:]"; + +## Always print first +$| = 1; + +## Handle options +GetOptions ( + "type=s" => \$TYPE_ARG, + "local|l" => \$LOCAL_ARG, + "help|h" => \$HELP_ARG, + "version|v" => \$VERSION_ARG, + "update" => \$UPDATE_ARG, + "quiet|q" => \$QUIET_ARG, + "srcdir=s" => \$SRCDIR_ARG, + ) or &error; + +&split_on_argument; + + +## Check for options. +## This section will check for the different options. + +sub split_on_argument { + + if ($VERSION_ARG) { + &version; + + } elsif ($HELP_ARG) { + &help; + + } elsif ($LOCAL_ARG) { + &place_local; + &extract; + + } elsif ($UPDATE_ARG) { + &place_normal; + &extract; + + } elsif (@ARGV > 0) { + &place_normal; + &message; + &extract; + + } else { + &help; + + } +} + +sub place_normal { + $FILE = $ARGV[0]; + $OUTFILE = "$FILE.h"; +} + +sub place_local { + $FILE = $ARGV[0]; + $OUTFILE = fileparse($FILE, ()); + if (!-e "tmp/") { + system("mkdir tmp/"); + } + $OUTFILE = "./tmp/$OUTFILE.h" +} + +sub determine_type { + if ($TYPE_ARG =~ /^gettext\/(.*)/) { + $gettext_type=$1 + } +} + +## Sub for printing release information +sub version{ + print <<_EOF_; +${PROGRAM} (${PACKAGE}) $VERSION +Copyright (C) 2000, 2003 Free Software Foundation, Inc. +Written by Kenneth Christiansen, 2000. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOF_ + exit; +} + +## Sub for printing usage information +sub help { + print <<_EOF_; +Usage: ${PROGRAM} [OPTION]... [FILENAME] +Generates a header file from an XML source file. + +It grabs all strings between <_translatable_node> and its end tag in +XML files. Read manpage (man ${PROGRAM}) for more info. + + --type=TYPE Specify the file type of FILENAME. Currently supports: + "gettext/glade", "gettext/ini", "gettext/keys" + "gettext/rfc822deb", "gettext/schemas", + "gettext/scheme", "gettext/xml" + -l, --local Writes output into current working directory + (conflicts with --update) + --update Writes output into the same directory the source file + reside (conflicts with --local) + --srcdir Root of the source tree + -v, --version Output version information and exit + -h, --help Display this help and exit + -q, --quiet Quiet mode + +Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") +or send email to . +_EOF_ + exit; +} + +## Sub for printing error messages +sub error{ + print STDERR "Try `${PROGRAM} --help' for more information.\n"; + exit; +} + +sub message { + print "Generating C format header file for translation.\n" unless $QUIET_ARG; +} + +sub extract { + &determine_type; + + &convert; + + open OUT, ">$OUTFILE"; + binmode (OUT) if $^O eq 'MSWin32'; + &msg_write; + close OUT; + + print "Wrote $OUTFILE\n" unless $QUIET_ARG; +} + +sub convert { + + ## Reading the file + { + local (*IN); + local $/; #slurp mode + open (IN, "<$SRCDIR_ARG/$FILE") || die "can't open $SRCDIR_ARG/$FILE: $!"; + $input = ; + } + + &type_ini if $gettext_type eq "ini"; + &type_keys if $gettext_type eq "keys"; + &type_xml if $gettext_type eq "xml"; + &type_glade if $gettext_type eq "glade"; + &type_scheme if $gettext_type eq "scheme"; + &type_schemas if $gettext_type eq "schemas"; + &type_rfc822deb if $gettext_type eq "rfc822deb"; +} + +sub entity_decode_minimal +{ + local ($_) = @_; + + s/'/'/g; # ' + s/"/"/g; # " + s/&/&/g; + + return $_; +} + +sub entity_decode +{ + local ($_) = @_; + + s/'/'/g; # ' + s/"/"/g; # " + s/&/&/g; + s/<//g; + + return $_; +} + +sub escape_char +{ + return '\"' if $_ eq '"'; + return '\n' if $_ eq "\n"; + return '\\' if $_ eq '\\'; + + return $_; +} + +sub escape +{ + my ($string) = @_; + return join "", map &escape_char, split //, $string; +} + +sub type_ini { + ### For generic translatable desktop files ### + while ($input =~ /^_.*=(.*)$/mg) { + $messages{$1} = []; + } +} + +sub type_keys { + ### For generic translatable mime/keys files ### + while ($input =~ /^\s*_\w+=(.*)$/mg) { + $messages{$1} = []; + } +} + +sub type_xml { + ### For generic translatable XML files ### + my $tree = readXml($input); + parseTree(0, $tree); +} + +sub print_var { + my $var = shift; + my $vartype = ref $var; + + if ($vartype =~ /ARRAY/) { + my @arr = @{$var}; + print "[ "; + foreach my $el (@arr) { + print_var($el); + print ", "; + } + print "] "; + } elsif ($vartype =~ /HASH/) { + my %hash = %{$var}; + print "{ "; + foreach my $key (keys %hash) { + print "$key => "; + print_var($hash{$key}); + print ", "; + } + print "} "; + } else { + print $var; + } +} + +# Same syntax as getAttributeString in intltool-merge.in.in, similar logic (look for ## differences comment) +sub getAttributeString +{ + my $sub = shift; + my $do_translate = shift || 1; + my $language = shift || ""; + my $translate = shift; + my $result = ""; + foreach my $e (reverse(sort(keys %{ $sub }))) { + my $key = $e; + my $string = $sub->{$e}; + my $quote = '"'; + + $string =~ s/^[\s]+//; + $string =~ s/[\s]+$//; + + if ($string =~ /^'.*'$/) + { + $quote = "'"; + } + $string =~ s/^['"]//g; + $string =~ s/['"]$//g; + + ## differences from intltool-merge.in.in + if ($key =~ /^_/) { + $comments{entity_decode($string)} = $XMLCOMMENT if $XMLCOMMENT; + $messages{entity_decode($string)} = []; + $$translate = 2; + } + ## differences end here from intltool-merge.in.in + $result .= " $key=$quote$string$quote"; + } + return $result; +} + +# Verbatim copy from intltool-merge.in.in +sub getXMLstring +{ + my $ref = shift; + my $spacepreserve = shift || 0; + my @list = @{ $ref }; + my $result = ""; + + my $count = scalar(@list); + my $attrs = $list[0]; + my $index = 1; + + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); + + while ($index < $count) { + my $type = $list[$index]; + my $content = $list[$index+1]; + if (! $type ) { + # We've got CDATA + if ($content) { + # lets strip the whitespace here, and *ONLY* here + $content =~ s/\s+/ /gs if (!$spacepreserve); + $result .= $content; + } + } elsif ( "$type" ne "1" ) { + # We've got another element + $result .= "<$type"; + $result .= getAttributeString(@{$content}[0], 0); # no nested translatable elements + if ($content) { + my $subresult = getXMLstring($content, $spacepreserve); + if ($subresult) { + $result .= ">".$subresult . ""; + } else { + $result .= "/>"; + } + } else { + $result .= "/>"; + } + } + $index += 2; + } + return $result; +} + +# Verbatim copy from intltool-merge.in.in, except for MULTIPLE_OUTPUT handling removed +# Translate list of nodes if necessary +sub translate_subnodes +{ + my $fh = shift; + my $content = shift; + my $language = shift || ""; + my $singlelang = shift || 0; + my $spacepreserve = shift || 0; + + my @nodes = @{ $content }; + + my $count = scalar(@nodes); + my $index = 0; + while ($index < $count) { + my $type = $nodes[$index]; + my $rest = $nodes[$index+1]; + traverse($fh, $type, $rest, $language, $spacepreserve); + $index += 2; + } +} + +# Based on traverse() in intltool-merge.in.in +sub traverse +{ + my $fh = shift; # unused, to allow us to sync code between -merge and -extract + my $nodename = shift; + my $content = shift; + my $language = shift || ""; + my $spacepreserve = shift || 0; + + if ($nodename && "$nodename" eq "1") { + $XMLCOMMENT = $content; + } elsif ($nodename) { + # element + my @all = @{ $content }; + my $attrs = shift @all; + my $translate = 0; + my $outattr = getAttributeString($attrs, 1, $language, \$translate); + + if ($nodename =~ /^_/) { + $translate = 1; + $nodename =~ s/^_//; + } + my $lookup = ''; + + $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + + if ($translate) { + $lookup = getXMLstring($content, $spacepreserve); + if (!$spacepreserve) { + $lookup =~ s/^\s+//s; + $lookup =~ s/\s+$//s; + } + + if ($lookup && $translate != 2) { + $comments{$lookup} = $XMLCOMMENT if $XMLCOMMENT; + $messages{$lookup} = []; + } elsif ($translate == 2) { + translate_subnodes($fh, \@all, $language, 1, $spacepreserve); + } + } else { + $XMLCOMMENT = ""; + my $count = scalar(@all); + if ($count > 0) { + my $index = 0; + while ($index < $count) { + my $type = $all[$index]; + my $rest = $all[$index+1]; + traverse($fh, $type, $rest, $language, $spacepreserve); + $index += 2; + } + } + } + $XMLCOMMENT = ""; + } +} + + +# Verbatim copy from intltool-merge.in.in, $fh for compatibility +sub parseTree +{ + my $fh = shift; + my $ref = shift; + my $language = shift || ""; + + my $name = shift @{ $ref }; + my $cont = shift @{ $ref }; + + while (!$name || "$name" eq "1") { + $name = shift @{ $ref }; + $cont = shift @{ $ref }; + } + + my $spacepreserve = 0; + my $attrs = @{$cont}[0]; + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + + traverse($fh, $name, $cont, $language, $spacepreserve); +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_comment +{ + my $expat = shift; + my $data = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + push @$clist, 1 => $data; +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_cdatastart +{ + my $expat = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + push @$clist, 0 => $expat->original_string(); +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_cdataend +{ + my $expat = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + $clist->[$pos] .= $expat->original_string(); +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_char +{ + my $expat = shift; + my $text = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + # Use original_string so that we retain escaped entities + # in CDATA sections. + # + if ($pos > 0 and $clist->[$pos - 1] eq '0') { + $clist->[$pos] .= $expat->original_string(); + } else { + push @$clist, 0 => $expat->original_string(); + } +} + +# Verbatim copy from intltool-merge.in.in +sub intltool_tree_start +{ + my $expat = shift; + my $tag = shift; + my @origlist = (); + + # Use original_string so that we retain escaped entities + # in attribute values. We must convert the string to an + # @origlist array to conform to the structure of the Tree + # Style. + # + my @original_array = split /\x/, $expat->original_string(); + my $source = $expat->original_string(); + + # Remove leading tag. + # + $source =~ s|^\s*<\s*(\S+)||s; + + # Grab attribute key/value pairs and push onto @origlist array. + # + while ($source) + { + if ($source =~ /^\s*([\w:-]+)\s*[=]\s*["]/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*["]([^"]*)["]||s; + push @origlist, $1; + push @origlist, '"' . $2 . '"'; + } + elsif ($source =~ /^\s*([\w:-]+)\s*[=]\s*[']/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*[']([^']*)[']||s; + push @origlist, $1; + push @origlist, "'" . $2 . "'"; + } + else + { + last; + } + } + + my $ol = [ { @origlist } ]; + + push @{ $expat->{Lists} }, $expat->{Curlist}; + push @{ $expat->{Curlist} }, $tag => $ol; + $expat->{Curlist} = $ol; +} + +# Copied from intltool-merge.in.in and added comment handler. +sub readXml +{ + my $xmldoc = shift || return; + my $ret = eval 'require XML::Parser'; + if(!$ret) { + die "You must have XML::Parser installed to run $0\n\n"; + } + my $xp = new XML::Parser(Style => 'Tree'); + $xp->setHandlers(Char => \&intltool_tree_char); + $xp->setHandlers(Start => \&intltool_tree_start); + $xp->setHandlers(CdataStart => \&intltool_tree_cdatastart); + $xp->setHandlers(CdataEnd => \&intltool_tree_cdataend); + + ## differences from intltool-merge.in.in + $xp->setHandlers(Comment => \&intltool_tree_comment); + ## differences end here from intltool-merge.in.in + + my $tree = $xp->parse($xmldoc); + #print_var($tree); + +# Hello thereHowdydo +# would be: +# [foo, [{}, 1, "comment", head, [{id => "a"}, 0, "Hello ", em, [{}, 0, "there"]], bar, +# [{}, 0, "Howdy", ref, [{}]], 0, "do" ] ] + + return $tree; +} + +sub type_schemas { + ### For schemas XML files ### + + # FIXME: We should handle escaped < (less than) + while ($input =~ / + \s* + (\s*(?:\s*)?(.*?)\s*<\/default>\s*)? + (\s*(?:\s*)?(.*?)\s*<\/short>\s*)? + (\s*(?:\s*)?(.*?)\s*<\/long>\s*)? + <\/locale> + /sgx) { + my @totranslate = ($3,$6,$9); + my @eachcomment = ($2,$5,$8); + foreach (@totranslate) { + my $currentcomment = shift @eachcomment; + next if !$_; + s/\s+/ /g; + $messages{entity_decode_minimal($_)} = []; + $comments{entity_decode_minimal($_)} = $currentcomment if (defined($currentcomment)); + } + } +} + +sub type_rfc822deb { + ### For rfc822-style Debian configuration files ### + + my $lineno = 1; + my $type = ''; + while ($input =~ /\G(.*?)(^|\n)(_+)([^:]+):[ \t]*(.*?)(?=\n\S|$)/sg) + { + my ($pre, $newline, $underscore, $tag, $text) = ($1, $2, $3, $4, $5); + while ($pre =~ m/\n/g) + { + $lineno ++; + } + $lineno += length($newline); + my @str_list = rfc822deb_split(length($underscore), $text); + for my $str (@str_list) + { + $strcount++; + $messages{$str} = []; + $loc{$str} = $lineno; + $count{$str} = $strcount; + my $usercomment = ''; + while($pre =~ s/(^|\n)#([^\n]*)$//s) + { + $usercomment = "\n" . $2 . $usercomment; + } + $comments{$str} = $tag . $usercomment; + } + $lineno += ($text =~ s/\n//g); + } +} + +sub rfc822deb_split { + # Debian defines a special way to deal with rfc822-style files: + # when a value contain newlines, it consists of + # 1. a short form (first line) + # 2. a long description, all lines begin with a space, + # and paragraphs are separated by a single dot on a line + # This routine returns an array of all paragraphs, and reformat + # them. + # When first argument is 2, the string is a comma separated list of + # values. + my $type = shift; + my $text = shift; + $text =~ s/^[ \t]//mg; + return (split(/, */, $text, 0)) if $type ne 1; + return ($text) if $text !~ /\n/; + + $text =~ s/([^\n]*)\n//; + my @list = ($1); + my $str = ''; + for my $line (split (/\n/, $text)) + { + chomp $line; + if ($line =~ /^\.\s*$/) + { + # New paragraph + $str =~ s/\s*$//; + push(@list, $str); + $str = ''; + } + elsif ($line =~ /^\s/) + { + # Line which must not be reformatted + $str .= "\n" if length ($str) && $str !~ /\n$/; + $line =~ s/\s+$//; + $str .= $line."\n"; + } + else + { + # Continuation line, remove newline + $str .= " " if length ($str) && $str !~ /\n$/; + $str .= $line; + } + } + $str =~ s/\s*$//; + push(@list, $str) if length ($str); + return @list; +} + +sub type_glade { + ### For translatable Glade XML files ### + + my $tags = "label|title|text|format|copyright|comments|preview_text|tooltip|message"; + + while ($input =~ /<($tags)>([^<]+)<\/($tags)>/sg) { + # Glade sometimes uses tags that normally mark translatable things for + # little bits of non-translatable content. We work around this by not + # translating strings that only includes something like label4 or window1. + $messages{entity_decode($2)} = [] unless $2 =~ /^(window|label|dialog)[0-9]+$/; + } + + while ($input =~ /(..[^<]*)<\/items>/sg) { + for my $item (split (/\n/, $1)) { + $messages{entity_decode($item)} = []; + } + } + + ## handle new glade files + while ($input =~ /<(property|atkproperty)\s+[^>]*translatable\s*=\s*"yes"(?:\s+[^>]*comments\s*=\s*"([^"]*)")?[^>]*>([^<]+)<\/\1>/sg) { + $messages{entity_decode($3)} = [] unless $3 =~ /^(window|label)[0-9]+$/; + if (defined($2) and !($3 =~ /^(window|label)[0-9]+$/)) { + $comments{entity_decode($3)} = entity_decode($2) ; + } + } + while ($input =~ /]*)"\s+description="([^>]+)"\/>/sg) { + $messages{entity_decode_minimal($2)} = []; + } +} + +sub type_scheme { + my ($line, $i, $state, $str, $trcomment, $char); + for $line (split(/\n/, $input)) { + $i = 0; + $state = 0; # 0 - nothing, 1 - string, 2 - translatable string + while ($i < length($line)) { + if (substr($line,$i,1) eq "\"") { + if ($state == 2) { + $comments{$str} = $trcomment if ($trcomment); + $messages{$str} = []; + $str = ''; + $state = 0; $trcomment = ""; + } elsif ($state == 1) { + $str = ''; + $state = 0; $trcomment = ""; + } else { + $state = 1; + $str = ''; + if ($i>0 && substr($line,$i-1,1) eq '_') { + $state = 2; + } + } + } elsif (!$state) { + if (substr($line,$i,1) eq ";") { + $trcomment = substr($line,$i+1); + $trcomment =~ s/^;*\s*//; + $i = length($line); + } elsif ($trcomment && substr($line,$i,1) !~ /\s|\(|\)|_/) { + $trcomment = ""; + } + } else { + if (substr($line,$i,1) eq "\\") { + $char = substr($line,$i+1,1); + if ($char ne "\"" && $char ne "\\") { + $str = $str . "\\"; + } + $i++; + } + $str = $str . substr($line,$i,1); + } + $i++; + } + } +} + +sub msg_write { + my @msgids; + if (%count) + { + @msgids = sort { $count{$a} <=> $count{$b} } keys %count; + } + else + { + @msgids = sort keys %messages; + } + for my $message (@msgids) + { + my $offsetlines = 1; + $offsetlines++ if $message =~ /%/; + if (defined ($comments{$message})) + { + while ($comments{$message} =~ m/\n/g) + { + $offsetlines++; + } + } + print OUT "# ".($loc{$message} - $offsetlines). " \"$FILE\"\n" + if defined $loc{$message}; + print OUT "/* ".$comments{$message}." */\n" + if defined $comments{$message}; + print OUT "/* xgettext:no-c-format */\n" if $message =~ /%/; + + my @lines = split (/\n/, $message, -1); + for (my $n = 0; $n < @lines; $n++) + { + if ($n == 0) + { + print OUT "char *s = N_(\""; + } + else + { + print OUT " \""; + } + + print OUT escape($lines[$n]); + + if ($n < @lines - 1) + { + print OUT "\\n\"\n"; + } + else + { + print OUT "\");\n"; + } + } + } +} + diff --git a/intltool-merge.in b/intltool-merge.in new file mode 100644 index 0000000..9b3a539 --- /dev/null +++ b/intltool-merge.in @@ -0,0 +1,1356 @@ +#!@INTLTOOL_PERL@ -w +# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +# +# The Intltool Message Merger +# +# Copyright (C) 2000, 2003 Free Software Foundation. +# Copyright (C) 2000, 2001 Eazel, Inc +# +# Intltool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 published by the Free Software Foundation. +# +# Intltool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# Authors: Maciej Stachowiak +# Kenneth Christiansen +# Darin Adler +# +# Proper XML UTF-8'ification written by Cyrille Chepelov +# + +## Release information +my $PROGRAM = "intltool-merge"; +my $PACKAGE = "intltool"; +my $VERSION = "0.34.1"; + +## Loaded modules +use strict; +use Getopt::Long; +use Text::Wrap; +use File::Basename; + +my $must_end_tag = -1; +my $last_depth = -1; +my $translation_depth = -1; +my @tag_stack = (); +my @entered_tag = (); +my @translation_strings = (); +my $leading_space = ""; + +## Scalars used by the option stuff +my $HELP_ARG = 0; +my $VERSION_ARG = 0; +my $BA_STYLE_ARG = 0; +my $XML_STYLE_ARG = 0; +my $KEYS_STYLE_ARG = 0; +my $DESKTOP_STYLE_ARG = 0; +my $SCHEMAS_STYLE_ARG = 0; +my $RFC822DEB_STYLE_ARG = 0; +my $QUIET_ARG = 0; +my $PASS_THROUGH_ARG = 0; +my $UTF8_ARG = 0; +my $MULTIPLE_OUTPUT = 0; +my $cache_file; + +## Handle options +GetOptions +( + "help" => \$HELP_ARG, + "version" => \$VERSION_ARG, + "quiet|q" => \$QUIET_ARG, + "oaf-style|o" => \$BA_STYLE_ARG, ## for compatibility + "ba-style|b" => \$BA_STYLE_ARG, + "xml-style|x" => \$XML_STYLE_ARG, + "keys-style|k" => \$KEYS_STYLE_ARG, + "desktop-style|d" => \$DESKTOP_STYLE_ARG, + "schemas-style|s" => \$SCHEMAS_STYLE_ARG, + "rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG, + "pass-through|p" => \$PASS_THROUGH_ARG, + "utf8|u" => \$UTF8_ARG, + "multiple-output|m" => \$MULTIPLE_OUTPUT, + "cache|c=s" => \$cache_file + ) or &error; + +my $PO_DIR; +my $FILE; +my $OUTFILE; + +my %po_files_by_lang = (); +my %translations = (); +my $iconv = $ENV{"ICONV"} || $ENV{"INTLTOOL_ICONV"} || "/usr/bin/iconv"; +my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null'); + +# Use this instead of \w for XML files to handle more possible characters. +my $w = "[-A-Za-z0-9._:]"; + +# XML quoted string contents +my $q = "[^\\\"]*"; + +## Check for options. + +if ($VERSION_ARG) +{ + &print_version; +} +elsif ($HELP_ARG) +{ + &print_help; +} +elsif ($BA_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &ba_merge_translations; + &finalize; +} +elsif ($XML_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &xml_merge_output; + &finalize; +} +elsif ($KEYS_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &keys_merge_translations; + &finalize; +} +elsif ($DESKTOP_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &desktop_merge_translations; + &finalize; +} +elsif ($SCHEMAS_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &schemas_merge_translations; + &finalize; +} +elsif ($RFC822DEB_STYLE_ARG && @ARGV > 2) +{ + &preparation; + &print_message; + &rfc822deb_merge_translations; + &finalize; +} +else +{ + &print_help; +} + +exit; + +## Sub for printing release information +sub print_version +{ + print <<_EOF_; +${PROGRAM} (${PACKAGE}) ${VERSION} +Written by Maciej Stachowiak, Darin Adler and Kenneth Christiansen. + +Copyright (C) 2000-2003 Free Software Foundation, Inc. +Copyright (C) 2000-2001 Eazel, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOF_ + exit; +} + +## Sub for printing usage information +sub print_help +{ + print <<_EOF_; +Usage: ${PROGRAM} [OPTION]... PO_DIRECTORY FILENAME OUTPUT_FILE +Generates an output file that includes some localized attributes from an +untranslated source file. + +Mandatory options: (exactly one must be specified) + -b, --ba-style includes translations in the bonobo-activation style + -d, --desktop-style includes translations in the desktop style + -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 + -x, --xml-style includes translations in the standard xml style + +Other options: + -u, --utf8 convert all strings to UTF-8 before merging + (default for everything except RFC822 style) + -p, --pass-through deprecated, does nothing and issues a warning + -m, --multiple-output output one localized file per locale, instead of + a single file containing all localized elements + -c, --cache=FILE specify cache file name + (usually \$top_builddir/po/.intltool-merge-cache) + -q, --quiet suppress most messages + --help display this help and exit + --version output version information and exit + +Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") +or send email to . +_EOF_ + exit; +} + + +## Sub for printing error messages +sub print_error +{ + print STDERR "Try `${PROGRAM} --help' for more information.\n"; + exit; +} + + +sub print_message +{ + print "Merging translations into $OUTFILE.\n" unless $QUIET_ARG; +} + + +sub preparation +{ + $PO_DIR = $ARGV[0]; + $FILE = $ARGV[1]; + $OUTFILE = $ARGV[2]; + + &gather_po_files; + &get_translation_database; +} + +# General-purpose code for looking up translations in .po files + +sub po_file2lang +{ + my ($tmp) = @_; + $tmp =~ s/^.*\/(.*)\.po$/$1/; + return $tmp; +} + +sub gather_po_files +{ + for my $po_file (glob "$PO_DIR/*.po") { + $po_files_by_lang{po_file2lang($po_file)} = $po_file; + } +} + +sub get_local_charset +{ + my ($encoding) = @_; + my $alias_file = $ENV{"G_CHARSET_ALIAS"} || "/usr/lib/charset.alias"; + + # seek character encoding aliases in charset.alias (glib) + + if (open CHARSET_ALIAS, $alias_file) + { + while () + { + next if /^\#/; + return $1 if (/^\s*([-._a-zA-Z0-9]+)\s+$encoding\b/i) + } + + close CHARSET_ALIAS; + } + + # if not found, return input string + + return $encoding; +} + +sub get_po_encoding +{ + my ($in_po_file) = @_; + my $encoding = ""; + + open IN_PO_FILE, $in_po_file or die; + while () + { + ## example: "Content-Type: text/plain; charset=ISO-8859-1\n" + if (/Content-Type\:.*charset=([-a-zA-Z0-9]+)\\n/) + { + $encoding = $1; + last; + } + } + close IN_PO_FILE; + + if (!$encoding) + { + print STDERR "Warning: no encoding found in $in_po_file. Assuming ISO-8859-1\n" unless $QUIET_ARG; + $encoding = "ISO-8859-1"; + } + + system ("$iconv -f $encoding -t UTF-8 <$devnull 2>$devnull"); + if ($?) { + $encoding = get_local_charset($encoding); + } + + return $encoding +} + +sub utf8_sanity_check +{ + print STDERR "Warning: option --pass-through has been removed.\n" if $PASS_THROUGH_ARG; + $UTF8_ARG = 1; +} + +sub get_translation_database +{ + if ($cache_file) { + &get_cached_translation_database; + } else { + &create_translation_database; + } +} + +sub get_newest_po_age +{ + my $newest_age; + + foreach my $file (values %po_files_by_lang) + { + my $file_age = -M $file; + $newest_age = $file_age if !$newest_age || $file_age < $newest_age; + } + + $newest_age = 0 if !$newest_age; + + return $newest_age; +} + +sub create_cache +{ + print "Generating and caching the translation database\n" unless $QUIET_ARG; + + &create_translation_database; + + open CACHE, ">$cache_file" || die; + print CACHE join "\x01", %translations; + close CACHE; +} + +sub load_cache +{ + print "Found cached translation database\n" unless $QUIET_ARG; + + my $contents; + open CACHE, "<$cache_file" || die; + { + local $/; + $contents = ; + } + close CACHE; + %translations = split "\x01", $contents; +} + +sub get_cached_translation_database +{ + my $cache_file_age = -M $cache_file; + if (defined $cache_file_age) + { + if ($cache_file_age <= &get_newest_po_age) + { + &load_cache; + return; + } + print "Found too-old cached translation database\n" unless $QUIET_ARG; + } + + &create_cache; +} + +sub create_translation_database +{ + for my $lang (keys %po_files_by_lang) + { + my $po_file = $po_files_by_lang{$lang}; + + if ($UTF8_ARG) + { + my $encoding = get_po_encoding ($po_file); + + if (lc $encoding eq "utf-8") + { + open PO_FILE, "<$po_file"; + } + else + { + print STDERR "WARNING: $po_file is not in UTF-8 but $encoding, converting...\n" unless $QUIET_ARG;; + + open PO_FILE, "$iconv -f $encoding -t UTF-8 $po_file|"; + } + } + else + { + open PO_FILE, "<$po_file"; + } + + my $nextfuzzy = 0; + my $inmsgid = 0; + my $inmsgstr = 0; + my $msgid = ""; + my $msgstr = ""; + + while () + { + $nextfuzzy = 1 if /^#, fuzzy/; + + if (/^msgid "((\\.|[^\\])*)"/ ) + { + $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; + $msgid = ""; + $msgstr = ""; + + if ($nextfuzzy) { + $inmsgid = 0; + } else { + $msgid = unescape_po_string($1); + $inmsgid = 1; + } + $inmsgstr = 0; + $nextfuzzy = 0; + } + + if (/^msgstr "((\\.|[^\\])*)"/) + { + $msgstr = unescape_po_string($1); + $inmsgstr = 1; + $inmsgid = 0; + } + + if (/^"((\\.|[^\\])*)"/) + { + $msgid .= unescape_po_string($1) if $inmsgid; + $msgstr .= unescape_po_string($1) if $inmsgstr; + } + } + $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; + } +} + +sub finalize +{ +} + +sub unescape_one_sequence +{ + my ($sequence) = @_; + + return "\\" if $sequence eq "\\\\"; + return "\"" if $sequence eq "\\\""; + return "\n" if $sequence eq "\\n"; + return "\r" if $sequence eq "\\r"; + return "\t" if $sequence eq "\\t"; + return "\b" if $sequence eq "\\b"; + return "\f" if $sequence eq "\\f"; + return "\a" if $sequence eq "\\a"; + return chr(11) if $sequence eq "\\v"; # vertical tab, see ascii(7) + + return chr(hex($1)) if ($sequence =~ /\\x([0-9a-fA-F]{2})/); + return chr(oct($1)) if ($sequence =~ /\\([0-7]{3})/); + + # FIXME: Is \0 supported as well? Kenneth and Rodney don't want it, see bug #48489 + + return $sequence; +} + +sub unescape_po_string +{ + my ($string) = @_; + + $string =~ s/(\\x[0-9a-fA-F]{2}|\\[0-7]{3}|\\.)/unescape_one_sequence($1)/eg; + + 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/</; + close INPUT; + } + + open OUTPUT, ">$OUTFILE" or die "can't open $OUTFILE: $!"; + # Binmode so that selftest works ok if using a native Win32 Perl... + binmode (OUTPUT) if $^O eq 'MSWin32'; + + while ($source =~ s|^(.*?)([ \t]*<\s*$w+\s+($w+\s*=\s*"$q"\s*)+/?>)([ \t]*\n)?||s) + { + print OUTPUT $1; + + my $node = $2 . "\n"; + + my @strings = (); + $_ = $node; + while (s/(\s)_($w+\s*=\s*"($q)")/$1$2/s) { + push @strings, entity_decode($3); + } + print OUTPUT; + + my %langs; + for my $string (@strings) + { + for my $lang (keys %po_files_by_lang) + { + $langs{$lang} = 1 if $translations{$lang, $string}; + } + } + + for my $lang (sort keys %langs) + { + $_ = $node; + s/(\sname\s*=\s*)"($q)"/$1"$2-$lang"/s; + s/(\s)_($w+\s*=\s*")($q)"/$1 . $2 . entity_encoded_translation($lang, $3) . '"'/seg; + print OUTPUT; + } + } + + print OUTPUT $source; + + close OUTPUT; +} + + +## XML (non-bonobo-activation) merge code + + +# Process tag attributes +# Only parameter is a HASH containing attributes -> values mapping +sub getAttributeString +{ + my $sub = shift; + my $do_translate = shift || 0; + my $language = shift || ""; + my $result = ""; + my $translate = shift; + foreach my $e (reverse(sort(keys %{ $sub }))) { + my $key = $e; + my $string = $sub->{$e}; + my $quote = '"'; + + $string =~ s/^[\s]+//; + $string =~ s/[\s]+$//; + + if ($string =~ /^'.*'$/) + { + $quote = "'"; + } + $string =~ s/^['"]//g; + $string =~ s/['"]$//g; + + if ($do_translate && $key =~ /^_/) { + $key =~ s|^_||g; + if ($language) { + # Handle translation + my $decode_string = entity_decode($string); + my $translation = $translations{$language, $decode_string}; + if ($translation) { + $translation = entity_encode($translation); + $string = $translation; + } + $$translate = 2; + } else { + $$translate = 2 if ($translate && (!$$translate)); # watch not to "overwrite" $translate + } + } + + $result .= " $key=$quote$string$quote"; + } + return $result; +} + +# Returns a translatable string from XML node, it works on contents of every node in XML::Parser tree +sub getXMLstring +{ + my $ref = shift; + my $spacepreserve = shift || 0; + my @list = @{ $ref }; + my $result = ""; + + my $count = scalar(@list); + my $attrs = $list[0]; + my $index = 1; + + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); + + while ($index < $count) { + my $type = $list[$index]; + my $content = $list[$index+1]; + if (! $type ) { + # We've got CDATA + if ($content) { + # lets strip the whitespace here, and *ONLY* here + $content =~ s/\s+/ /gs if (!$spacepreserve); + $result .= $content; + } + } elsif ( "$type" ne "1" ) { + # We've got another element + $result .= "<$type"; + $result .= getAttributeString(@{$content}[0], 0); # no nested translatable elements + if ($content) { + my $subresult = getXMLstring($content, $spacepreserve); + if ($subresult) { + $result .= ">".$subresult . ""; + } else { + $result .= "/>"; + } + } else { + $result .= "/>"; + } + } + $index += 2; + } + return $result; +} + +# Translate list of nodes if necessary +sub translate_subnodes +{ + my $fh = shift; + my $content = shift; + my $language = shift || ""; + my $singlelang = shift || 0; + my $spacepreserve = shift || 0; + + my @nodes = @{ $content }; + + my $count = scalar(@nodes); + my $index = 0; + while ($index < $count) { + my $type = $nodes[$index]; + my $rest = $nodes[$index+1]; + if ($singlelang) { + my $oldMO = $MULTIPLE_OUTPUT; + $MULTIPLE_OUTPUT = 1; + traverse($fh, $type, $rest, $language, $spacepreserve); + $MULTIPLE_OUTPUT = $oldMO; + } else { + traverse($fh, $type, $rest, $language, $spacepreserve); + } + $index += 2; + } +} + +sub isWellFormedXmlFragment +{ + my $ret = eval 'require XML::Parser'; + if(!$ret) { + die "You must have XML::Parser installed to run $0\n\n"; + } + + my $fragment = shift; + return 0 if (!$fragment); + + $fragment = "$fragment"; + my $xp = new XML::Parser(Style => 'Tree'); + my $tree = 0; + eval { $tree = $xp->parse($fragment); }; + return $tree; +} + +sub traverse +{ + my $fh = shift; + my $nodename = shift; + my $content = shift; + my $language = shift || ""; + my $spacepreserve = shift || 0; + + if (!$nodename) { + if ($content =~ /^[\s]*$/) { + $leading_space .= $content; + } + print $fh $content; + } else { + # element + my @all = @{ $content }; + my $attrs = shift @all; + my $translate = 0; + my $outattr = getAttributeString($attrs, 1, $language, \$translate); + + if ($nodename =~ /^_/) { + $translate = 1; + $nodename =~ s/^_//; + } + my $lookup = ''; + + $spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/)); + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + + print $fh "<$nodename", $outattr; + if ($translate) { + $lookup = getXMLstring($content, $spacepreserve); + if (!$spacepreserve) { + $lookup =~ s/^\s+//s; + $lookup =~ s/\s+$//s; + } + + if ($lookup || $translate == 2) { + my $translation = $translations{$language, $lookup} if isWellFormedXmlFragment($translations{$language, $lookup}); + if ($MULTIPLE_OUTPUT && ($translation || $translate == 2)) { + $translation = $lookup if (!$translation); + print $fh " xml:lang=\"", $language, "\"" if $language; + print $fh ">"; + if ($translate == 2) { + translate_subnodes($fh, \@all, $language, 1, $spacepreserve); + } else { + print $fh $translation; + } + print $fh ""; + + return; # this means there will be no same translation with xml:lang="$language"... + # if we want them both, just remove this "return" + } else { + print $fh ">"; + if ($translate == 2) { + translate_subnodes($fh, \@all, $language, 1, $spacepreserve); + } else { + print $fh $lookup; + } + print $fh ""; + } + } else { + print $fh "/>"; + } + + for my $lang (sort keys %po_files_by_lang) { + if ($MULTIPLE_OUTPUT && $lang ne "$language") { + next; + } + if ($lang) { + # Handle translation + # + my $translate = 0; + my $localattrs = getAttributeString($attrs, 1, $lang, \$translate); + my $translation = $translations{$lang, $lookup} if isWellFormedXmlFragment($translations{$lang, $lookup}); + if ($translate && !$translation) { + $translation = $lookup; + } + + if ($translation || $translate) { + print $fh "\n"; + $leading_space =~ s/.*\n//g; + print $fh $leading_space; + print $fh "<", $nodename, " xml:lang=\"", $lang, "\"", $localattrs, ">"; + if ($translate == 2) { + translate_subnodes($fh, \@all, $lang, 1, $spacepreserve); + } else { + print $fh $translation; + } + print $fh ""; + } + } + } + + } else { + my $count = scalar(@all); + if ($count > 0) { + print $fh ">"; + my $index = 0; + while ($index < $count) { + my $type = $all[$index]; + my $rest = $all[$index+1]; + traverse($fh, $type, $rest, $language, $spacepreserve); + $index += 2; + } + print $fh ""; + } else { + print $fh "/>"; + } + } + } +} + +sub intltool_tree_comment +{ + my $expat = shift; + my $data = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + push @$clist, 1 => $data; +} + +sub intltool_tree_cdatastart +{ + my $expat = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + push @$clist, 0 => $expat->original_string(); +} + +sub intltool_tree_cdataend +{ + my $expat = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + $clist->[$pos] .= $expat->original_string(); +} + +sub intltool_tree_char +{ + my $expat = shift; + my $text = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + # Use original_string so that we retain escaped entities + # in CDATA sections. + # + if ($pos > 0 and $clist->[$pos - 1] eq '0') { + $clist->[$pos] .= $expat->original_string(); + } else { + push @$clist, 0 => $expat->original_string(); + } +} + +sub intltool_tree_start +{ + my $expat = shift; + my $tag = shift; + my @origlist = (); + + # Use original_string so that we retain escaped entities + # in attribute values. We must convert the string to an + # @origlist array to conform to the structure of the Tree + # Style. + # + my @original_array = split /\x/, $expat->original_string(); + my $source = $expat->original_string(); + + # Remove leading tag. + # + $source =~ s|^\s*<\s*(\S+)||s; + + # Grab attribute key/value pairs and push onto @origlist array. + # + while ($source) + { + if ($source =~ /^\s*([\w:-]+)\s*[=]\s*["]/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*["]([^"]*)["]||s; + push @origlist, $1; + push @origlist, '"' . $2 . '"'; + } + elsif ($source =~ /^\s*([\w:-]+)\s*[=]\s*[']/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*[']([^']*)[']||s; + push @origlist, $1; + push @origlist, "'" . $2 . "'"; + } + else + { + last; + } + } + + my $ol = [ { @origlist } ]; + + push @{ $expat->{Lists} }, $expat->{Curlist}; + push @{ $expat->{Curlist} }, $tag => $ol; + $expat->{Curlist} = $ol; +} + +sub readXml +{ + my $filename = shift || return; + if(!-f $filename) { + die "ERROR Cannot find filename: $filename\n"; + } + + my $ret = eval 'require XML::Parser'; + if(!$ret) { + die "You must have XML::Parser installed to run $0\n\n"; + } + my $xp = new XML::Parser(Style => 'Tree'); + $xp->setHandlers(Char => \&intltool_tree_char); + $xp->setHandlers(Start => \&intltool_tree_start); + $xp->setHandlers(CdataStart => \&intltool_tree_cdatastart); + $xp->setHandlers(CdataEnd => \&intltool_tree_cdataend); + my $tree = $xp->parsefile($filename); + +# Hello thereHowdydo +# would be: +# [foo, [{}, head, [{id => "a"}, 0, "Hello ", em, [{}, 0, "there"]], bar, [{}, +# 0, "Howdy", ref, [{}]], 0, "do" ] ] + + return $tree; +} + +sub print_header +{ + my $infile = shift; + my $fh = shift; + my $source; + + if(!-f $infile) { + die "ERROR Cannot find filename: $infile\n"; + } + + print $fh qq{\n}; + { + local $/; + open DOCINPUT, "<${FILE}" or die; + $source = ; + close DOCINPUT; + } + if ($source =~ /()/s) + { + print $fh "$1\n"; + } + elsif ($source =~ /(]*>)/s) + { + print $fh "$1\n"; + } +} + +sub parseTree +{ + my $fh = shift; + my $ref = shift; + my $language = shift || ""; + + my $name = shift @{ $ref }; + my $cont = shift @{ $ref }; + + while (!$name || "$name" eq "1") { + $name = shift @{ $ref }; + $cont = shift @{ $ref }; + } + + my $spacepreserve = 0; + my $attrs = @{$cont}[0]; + $spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/)); + + traverse($fh, $name, $cont, $language, $spacepreserve); +} + +sub xml_merge_output +{ + my $source; + + if ($MULTIPLE_OUTPUT) { + for my $lang (sort keys %po_files_by_lang) { + if ( ! -e $lang ) { + mkdir $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'; + my $tree = readXml($FILE); + print_header($FILE, \*OUTPUT); + parseTree(\*OUTPUT, $tree, $lang); + close OUTPUT; + print "CREATED $lang/$OUTFILE\n" unless $QUIET_ARG; + } + } + open OUTPUT, ">$OUTFILE" or die "Cannot open $OUTFILE: $!\n"; + binmode (OUTPUT) if $^O eq 'MSWin32'; + my $tree = readXml($FILE); + print_header($FILE, \*OUTPUT); + parseTree(\*OUTPUT, $tree); + close OUTPUT; + print "CREATED $OUTFILE\n" unless $QUIET_ARG; +} + +sub keys_merge_translations +{ + open INPUT, "<${FILE}" or die; + open OUTPUT, ">${OUTFILE}" or die; + binmode (OUTPUT) if $^O eq 'MSWin32'; + + while () + { + if (s/^(\s*)_(\w+=(.*))/$1$2/) + { + my $string = $3; + + print OUTPUT; + + my $non_translated_line = $_; + + for my $lang (sort keys %po_files_by_lang) + { + my $translation = $translations{$lang, $string}; + next if !$translation; + + $_ = $non_translated_line; + s/(\w+)=.*/[$lang]$1=$translation/; + print OUTPUT; + } + } + else + { + print OUTPUT; + } + } + + close OUTPUT; + close INPUT; +} + +sub desktop_merge_translations +{ + open INPUT, "<${FILE}" or die; + open OUTPUT, ">${OUTFILE}" or die; + binmode (OUTPUT) if $^O eq 'MSWin32'; + + while () + { + if (s/^(\s*)_(\w+=(.*))/$1$2/) + { + my $string = $3; + + print OUTPUT; + + my $non_translated_line = $_; + + for my $lang (sort keys %po_files_by_lang) + { + my $translation = $translations{$lang, $string}; + next if !$translation; + + $_ = $non_translated_line; + s/(\w+)=.*/${1}[$lang]=$translation/; + print OUTPUT; + } + } + else + { + print OUTPUT; + } + } + + close OUTPUT; + close INPUT; +} + +sub schemas_merge_translations +{ + my $source; + + { + local $/; # slurp mode + open INPUT, "<$FILE" or die "can't open $FILE: $!"; + $source = ; + close INPUT; + } + + open OUTPUT, ">$OUTFILE" or die; + binmode (OUTPUT) if $^O eq 'MSWin32'; + + # FIXME: support attribute translations + + # Empty nodes never need translation, so unmark all of them. + # For example, <_foo/> is just replaced by . + $source =~ s|<\s*_($w+)\s*/>|<$1/>|g; + + while ($source =~ s/ + (.*?) + (\s+)((\s*) + (\s*(?:\s*)?(.*?)\s*<\/default>)?(\s*) + (\s*(?:\s*)?(.*?)\s*<\/short>)?(\s*) + (\s*(?:\s*)?(.*?)\s*<\/long>)?(\s*) + <\/locale>) + //sx) + { + print OUTPUT $1; + + my $locale_start_spaces = $2 ? $2 : ''; + my $default_spaces = $4 ? $4 : ''; + my $short_spaces = $7 ? $7 : ''; + my $long_spaces = $10 ? $10 : ''; + my $locale_end_spaces = $13 ? $13 : ''; + my $c_default_block = $3 ? $3 : ''; + my $default_string = $6 ? $6 : ''; + my $short_string = $9 ? $9 : ''; + my $long_string = $12 ? $12 : ''; + + print OUTPUT "$locale_start_spaces$c_default_block"; + + $default_string =~ s/\s+/ /g; + $default_string = entity_decode($default_string); + $short_string =~ s/\s+/ /g; + $short_string = entity_decode($short_string); + $long_string =~ s/\s+/ /g; + $long_string = entity_decode($long_string); + + for my $lang (sort keys %po_files_by_lang) + { + my $default_translation = $translations{$lang, $default_string}; + my $short_translation = $translations{$lang, $short_string}; + my $long_translation = $translations{$lang, $long_string}; + + next if (!$default_translation && !$short_translation && + !$long_translation); + + print OUTPUT "\n$locale_start_spaces"; + + print OUTPUT "$default_spaces"; + + if ($default_translation) + { + $default_translation = entity_encode($default_translation); + print OUTPUT "$default_translation"; + } + + print OUTPUT "$short_spaces"; + + if ($short_translation) + { + $short_translation = entity_encode($short_translation); + print OUTPUT "$short_translation"; + } + + print OUTPUT "$long_spaces"; + + if ($long_translation) + { + $long_translation = entity_encode($long_translation); + print OUTPUT "$long_translation"; + } + + print OUTPUT "$locale_end_spaces"; + } + } + + print OUTPUT $source; + + close OUTPUT; +} + +sub rfc822deb_merge_translations +{ + my %encodings = (); + for my $lang (keys %po_files_by_lang) { + $encodings{$lang} = ($UTF8_ARG ? 'UTF-8' : get_po_encoding($po_files_by_lang{$lang})); + } + + my $source; + + $Text::Wrap::huge = 'overflow'; + $Text::Wrap::break = qr/\n|\s(?=\S)/; + + { + local $/; # slurp mode + open INPUT, "<$FILE" or die "can't open $FILE: $!"; + $source = ; + close INPUT; + } + + open OUTPUT, ">${OUTFILE}" or die; + binmode (OUTPUT) if $^O eq 'MSWin32'; + + while ($source =~ /(^|\n+)(_*)([^:\s]+)(:[ \t]*)(.*?)(?=\n[\S\n]|$)/sg) + { + my $sep = $1; + my $non_translated_line = $3.$4; + my $string = $5; + my $underscore = length($2); + next if $underscore eq 0 && $non_translated_line =~ /^#/; + # Remove [] dummy strings + my $stripped = $string; + $stripped =~ s/\[\s[^\[\]]*\],/,/g if $underscore eq 2; + $stripped =~ s/\[\s[^\[\]]*\]$//; + $non_translated_line .= $stripped; + + print OUTPUT $sep.$non_translated_line; + + if ($underscore) + { + my @str_list = rfc822deb_split($underscore, $string); + + for my $lang (sort keys %po_files_by_lang) + { + my $is_translated = 1; + my $str_translated = ''; + my $first = 1; + + for my $str (@str_list) + { + my $translation = $translations{$lang, $str}; + + if (!$translation) + { + $is_translated = 0; + last; + } + + # $translation may also contain [] dummy + # strings, mostly to indicate an empty string + $translation =~ s/\[\s[^\[\]]*\]$//; + + if ($first) + { + if ($underscore eq 2) + { + $str_translated .= $translation; + } + else + { + $str_translated .= + Text::Tabs::expand($translation) . + "\n"; + } + } + else + { + if ($underscore eq 2) + { + $str_translated .= ', ' . $translation; + } + else + { + $str_translated .= Text::Tabs::expand( + Text::Wrap::wrap(' ', ' ', $translation)) . + "\n .\n"; + } + } + $first = 0; + + # To fix some problems with Text::Wrap::wrap + $str_translated =~ s/(\n )+\n/\n .\n/g; + } + next unless $is_translated; + + $str_translated =~ s/\n \.\n$//; + $str_translated =~ s/\s+$//; + + $_ = $non_translated_line; + s/^(\w+):\s*.*/$sep${1}-$lang.$encodings{$lang}: $str_translated/s; + print OUTPUT; + } + } + } + print OUTPUT "\n"; + + close OUTPUT; + close INPUT; +} + +sub rfc822deb_split +{ + # Debian defines a special way to deal with rfc822-style files: + # when a value contain newlines, it consists of + # 1. a short form (first line) + # 2. a long description, all lines begin with a space, + # and paragraphs are separated by a single dot on a line + # This routine returns an array of all paragraphs, and reformat + # them. + # When first argument is 2, the string is a comma separated list of + # values. + my $type = shift; + my $text = shift; + $text =~ s/^[ \t]//mg; + return (split(/, */, $text, 0)) if $type ne 1; + return ($text) if $text !~ /\n/; + + $text =~ s/([^\n]*)\n//; + my @list = ($1); + my $str = ''; + + for my $line (split (/\n/, $text)) + { + chomp $line; + if ($line =~ /^\.\s*$/) + { + # New paragraph + $str =~ s/\s*$//; + push(@list, $str); + $str = ''; + } + elsif ($line =~ /^\s/) + { + # Line which must not be reformatted + $str .= "\n" if length ($str) && $str !~ /\n$/; + $line =~ s/\s+$//; + $str .= $line."\n"; + } + else + { + # Continuation line, remove newline + $str .= " " if length ($str) && $str !~ /\n$/; + $str .= $line; + } + } + + $str =~ s/\s*$//; + push(@list, $str) if length ($str); + + return @list; +} + diff --git a/intltool-update.in b/intltool-update.in new file mode 100644 index 0000000..f251956 --- /dev/null +++ b/intltool-update.in @@ -0,0 +1,1065 @@ +#!@INTLTOOL_PERL@ -w +# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +# +# The Intltool Message Updater +# +# Copyright (C) 2000-2003 Free Software Foundation. +# +# Intltool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 published by the Free Software Foundation. +# +# Intltool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# Authors: Kenneth Christiansen +# Maciej Stachowiak +# Darin Adler + +## Release information +my $PROGRAM = "intltool-update"; +my $VERSION = "0.34.1"; +my $PACKAGE = "intltool"; + +## Loaded modules +use strict; +use Getopt::Long; +use Cwd; +use File::Copy; +use File::Find; + +## Scalars used by the option stuff +my $HELP_ARG = 0; +my $VERSION_ARG = 0; +my $DIST_ARG = 0; +my $POT_ARG = 0; +my $HEADERS_ARG = 0; +my $MAINTAIN_ARG = 0; +my $REPORT_ARG = 0; +my $VERBOSE = 0; +my $GETTEXT_PACKAGE = ""; +my $OUTPUT_FILE = ""; + +my @languages; +my %varhash = (); +my %po_files_by_lang = (); + +# Regular expressions to categorize file types. +# FIXME: Please check if the following is correct + +my $xml_support = +"xml(?:\\.in)*|". # http://www.w3.org/XML/ (Note: .in is not required) +"ui|". # Bonobo specific - User Interface desc. files +"lang|". # ? +"glade2?(?:\\.in)*|". # Glade specific - User Interface desc. files (Note: .in is not required) +"scm(?:\\.in)*|". # ? (Note: .in is not required) +"oaf(?:\\.in)+|". # DEPRECATED: Replaces by Bonobo .server files +"etspec|". # ? +"server(?:\\.in)+|". # Bonobo specific +"sheet(?:\\.in)+|". # ? +"schemas(?:\\.in)+|". # GConf specific +"pong(?:\\.in)+|". # DEPRECATED: PONG is not used [by GNOME] any longer. +"kbd(?:\\.in)+"; # GOK specific. + +my $ini_support = +"icon(?:\\.in)+|". # http://www.freedesktop.org/Standards/icon-theme-spec +"desktop(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec +"caves(?:\\.in)+|". # GNOME Games specific +"directory(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec +"soundlist(?:\\.in)+|". # GNOME specific +"keys(?:\\.in)+|". # GNOME Mime database specific +"theme(?:\\.in)+"; # http://www.freedesktop.org/Standards/icon-theme-spec + +my $buildin_gettext_support = +"c|y|cs|cc|cpp|c\\+\\+|h|hh|gob|py"; + +## Always flush buffer when printing +$| = 1; + +## Sometimes the source tree will be rooted somewhere else. +my $SRCDIR = "."; +my $POTFILES_in; + +$SRCDIR = $ENV{"srcdir"} if $ENV{"srcdir"}; +$POTFILES_in = "<$SRCDIR/POTFILES.in"; + +my $devnull = ($^O eq 'MSWin32' ? 'NUL:' : '/dev/null'); + +## Handle options +GetOptions +( + "help" => \$HELP_ARG, + "version" => \$VERSION_ARG, + "dist|d" => \$DIST_ARG, + "pot|p" => \$POT_ARG, + "headers|s" => \$HEADERS_ARG, + "maintain|m" => \$MAINTAIN_ARG, + "report|r" => \$REPORT_ARG, + "verbose|x" => \$VERBOSE, + "gettext-package|g=s" => \$GETTEXT_PACKAGE, + "output-file|o=s" => \$OUTPUT_FILE, + ) or &Console_WriteError_InvalidOption; + +&Console_Write_IntltoolHelp if $HELP_ARG; +&Console_Write_IntltoolVersion if $VERSION_ARG; + +my $arg_count = ($DIST_ARG > 0) + + ($POT_ARG > 0) + + ($HEADERS_ARG > 0) + + ($MAINTAIN_ARG > 0) + + ($REPORT_ARG > 0); + +&Console_Write_IntltoolHelp if $arg_count > 1; + +# --version and --help don't require a module name +my $MODULE = $GETTEXT_PACKAGE || &FindPackageName; + +if ($POT_ARG) +{ + &GenerateHeaders; + &GeneratePOTemplate; +} +elsif ($HEADERS_ARG) +{ + &GenerateHeaders; +} +elsif ($MAINTAIN_ARG) +{ + &FindLeftoutFiles; +} +elsif ($REPORT_ARG) +{ + &GenerateHeaders; + &GeneratePOTemplate; + &Console_Write_CoverageReport; +} +elsif ((defined $ARGV[0]) && $ARGV[0] =~ /^[a-z]/) +{ + my $lang = $ARGV[0]; + + ## Report error if the language file supplied + ## to the command line is non-existent + &Console_WriteError_NotExisting("$SRCDIR/$lang.po") + if ! -s "$SRCDIR/$lang.po"; + + if (!$DIST_ARG) + { + print "Working, please wait..." if $VERBOSE; + &GenerateHeaders; + &GeneratePOTemplate; + } + &POFile_Update ($lang, $OUTPUT_FILE); + &Console_Write_TranslationStatus ($lang, $OUTPUT_FILE); +} +else +{ + &Console_Write_IntltoolHelp; +} + +exit; + +######### + +sub Console_Write_IntltoolVersion +{ + print <<_EOF_; +${PROGRAM} (${PACKAGE}) $VERSION +Written by Kenneth Christiansen, Maciej Stachowiak, and Darin Adler. + +Copyright (C) 2000-2003 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOF_ + exit; +} + +sub Console_Write_IntltoolHelp +{ + print <<_EOF_; +Usage: ${PROGRAM} [OPTION]... LANGCODE +Updates PO template files and merge them with the translations. + +Mode of operation (only one is allowed): + -p, --pot generate the PO template only + -s, --headers generate the header files in POTFILES.in + -m, --maintain search for left out files from POTFILES.in + -r, --report display a status report for the module + -d, --dist merge LANGCODE.po with existing PO template + +Extra options: + -g, --gettext-package=NAME override PO template name, useful with --pot + -o, --output-file=FILE write merged translation to FILE + -x, --verbose display lots of feedback + --help display this help and exit + --version output version information and exit + +Examples of use: +${PROGRAM} --pot just create a new PO template +${PROGRAM} xy create new PO template and merge xy.po with it + +Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") +or send email to . +_EOF_ + exit; +} + +sub echo_n +{ + my $str = shift; + my $ret = `echo "$str"`; + + $ret =~ s/\n$//; # do we need the "s" flag? + + return $ret; +} + +sub POFile_DetermineType ($) +{ + my $type = $_; + my $gettext_type; + + my $xml_regex = "(?:" . $xml_support . ")"; + my $ini_regex = "(?:" . $ini_support . ")"; + my $buildin_regex = "(?:" . $buildin_gettext_support . ")"; + + if ($type =~ /\[type: gettext\/([^\]].*)]/) + { + $gettext_type=$1; + } + elsif ($type =~ /schemas(\.in)+$/) + { + $gettext_type="schemas"; + } + elsif ($type =~ /glade2?(\.in)*$/) + { + $gettext_type="glade"; + } + elsif ($type =~ /scm(\.in)*$/) + { + $gettext_type="scheme"; + } + elsif ($type =~ /keys(\.in)+$/) + { + $gettext_type="keys"; + } + + # bucket types + + elsif ($type =~ /$xml_regex$/) + { + $gettext_type="xml"; + } + elsif ($type =~ /$ini_regex$/) + { + $gettext_type="ini"; + } + elsif ($type =~ /$buildin_regex$/) + { + $gettext_type="buildin"; + } + else + { + $gettext_type="unknown"; + } + + return "gettext\/$gettext_type"; +} + +sub TextFile_DetermineEncoding ($) +{ + my $gettext_code="ASCII"; # All files are ASCII by default + my $filetype=`file $_ | cut -d ' ' -f 2`; + + if ($? eq "0") + { + if ($filetype =~ /^(ISO|UTF)/) + { + chomp ($gettext_code = $filetype); + } + elsif ($filetype =~ /^XML/) + { + $gettext_code="UTF-8"; # We asume that .glade and other .xml files are UTF-8 + } + } + + return $gettext_code; +} + +sub isNotValidMissing +{ + my ($file) = @_; + + return if $file =~ /^\{arch\}\/.*$/; + return if $file =~ /^$varhash{"PACKAGE"}-$varhash{"VERSION"}\/.*$/; +} + +sub FindLeftoutFiles +{ + my (@buf_i18n_plain, + @buf_i18n_xml, + @buf_i18n_xml_unmarked, + @buf_i18n_ini, + @buf_potfiles, + @buf_potfiles_ignore, + @buf_allfiles, + @buf_allfiles_sorted, + @buf_potfiles_sorted + ); + + ## Search and find all translatable files + 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)+)$/; + }, ".."; + + + open POTFILES, $POTFILES_in or die "$PROGRAM: there's no POTFILES.in!\n"; + @buf_potfiles = grep !/^(#|\s*$)/, ; + close POTFILES; + + foreach (@buf_potfiles) { + s/^\[.*]\s*//; + } + + print "Searching for missing translatable files...\n" if $VERBOSE; + + ## Check if we should ignore some found files, when + ## comparing with POTFILES.in + foreach my $ignore ("POTFILES.skip", "POTFILES.ignore") + { + (-s $ignore) or next; + + if ("$ignore" eq "POTFILES.ignore") + { + print "The usage of POTFILES.ignore is deprecated. Please consider moving the\n". + "content of this file to POTFILES.skip.\n"; + } + + print "Found $ignore: Ignoring files...\n" if $VERBOSE; + open FILE, "<$ignore" or die "ERROR: Failed to open $ignore!\n"; + + while () + { + push @buf_potfiles_ignore, $_ unless /^(#|\s*$)/; + } + close FILE; + + @buf_potfiles = (@buf_potfiles_ignore, @buf_potfiles); + } + + foreach my $file (@buf_i18n_plain) + { + my $in_comment = 0; + my $in_macro = 0; + + open FILE, "<$file"; + while () + { + # Handle continued multi-line comment. + if ($in_comment) + { + next unless s-.*\*/--; + $in_comment = 0; + } + + # Handle continued macro. + if ($in_macro) + { + $in_macro = 0 unless /\\$/; + next; + } + + # Handle start of macro (or any preprocessor directive). + if (/^\s*\#/) + { + $in_macro = 1 if /^([^\\]|\\.)*\\$/; + next; + } + + # Handle comments and quoted text. + while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy + { + my $match = $1; + if ($match eq "/*") + { + if (!s-/\*.*?\*/--) + { + s-/\*.*--; + $in_comment = 1; + } + } + elsif ($match eq "//") + { + s-//.*--; + } + else # ' or " + { + if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-) + { + warn "mismatched quotes at line $. in $file\n"; + s-$match.*--; + } + } + } + + if (/\.GetString ?\(QUOTEDTEXT/) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + ## Remove the first 3 chars and add newline + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + last; + } + + if (/_\(QUOTEDTEXT/) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + ## Remove the first 3 chars and add newline + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + last; + } + } + close FILE; + } + + foreach my $file (@buf_i18n_xml) + { + open FILE, "<$file"; + + while () + { + # FIXME: share the pattern matching code with intltool-extract + if (/\s_[-A-Za-z0-9._:]+\s*=\s*\"([^"]+)\"/ || /<_[^>]+>/ || /translatable=\"yes\"/) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + last; + } + } + close FILE; + } + + foreach my $file (@buf_i18n_ini) + { + open FILE, "<$file"; + while () + { + if (/_(.*)=/) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + last; + } + } + close FILE; + } + + foreach my $file (@buf_i18n_xml_unmarked) + { + if (defined isNotValidMissing (unpack("x3 A*", $file))) { + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + } + + + @buf_allfiles_sorted = sort (@buf_allfiles); + @buf_potfiles_sorted = sort (@buf_potfiles); + + my %in2; + foreach (@buf_potfiles_sorted) + { + $in2{$_} = 1; + } + + my @result; + + foreach (@buf_allfiles_sorted) + { + if (!exists($in2{$_})) + { + push @result, $_ + } + } + + my @buf_potfiles_notexist; + + foreach (@buf_potfiles_sorted) + { + chomp (my $dummy = $_); + if ("$dummy" ne "" and ! -f "../$dummy") + { + push @buf_potfiles_notexist, $_; + } + } + + ## Save file with information about the files missing + ## if any, and give information about this procedure. + if (@result + @buf_potfiles_notexist > 0) + { + if (@result) + { + print "\n" if $VERBOSE; + unlink "missing"; + open OUT, ">missing"; + print OUT @result; + close OUT; + warn "\e[1mThe following files contain translations and are currently not in use. Please\e[0m\n". + "\e[1mconsider adding these to the POTFILES.in file, located in the po/ directory.\e[0m\n\n"; + print STDERR @result, "\n"; + warn "If some of these files are left out on purpose then please add them to\n". + "POTFILES.skip instead of POTFILES.in. A file \e[1m'missing'\e[0m containing this list\n". + "of left out files has been written in the current directory.\n"; + } + if (@buf_potfiles_notexist) + { + unlink "notexist"; + open OUT, ">notexist"; + print OUT @buf_potfiles_notexist; + close OUT; + 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". + "containing this list of absent files has been written in the current directory.\n"; + } + } + + ## If there is nothing to complain about, notify the user + else { + print "\nAll files containing translations are present in POTFILES.in.\n" if $VERBOSE; + } +} + +sub Console_WriteError_InvalidOption +{ + ## Handle invalid arguments + print STDERR "Try `${PROGRAM} --help' for more information.\n"; + exit 1; +} + +sub GenerateHeaders +{ + my $EXTRACT = "@INTLTOOL_EXTRACT@"; + chomp $EXTRACT; + + $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} if $ENV{"INTLTOOL_EXTRACT"}; + + ## Generate the .h header files, so we can allow glade and + ## xml translation support + if (! -x "$EXTRACT") + { + print STDERR "\n *** The intltool-extract script wasn't found!" + ."\n *** Without it, intltool-update can not generate files.\n"; + exit; + } + else + { + open (FILE, $POTFILES_in) or die "$PROGRAM: POTFILES.in not found.\n"; + + while () + { + chomp; + next if /^\[\s*encoding/; + + ## Find xml files in POTFILES.in and generate the + ## files with help from the extract script + + my $gettext_type= &POFile_DetermineType ($1); + + if (/\.($xml_support|$ini_support)$/ || /^\[/) + { + s/^\[[^\[].*]\s*//; + + my $filename = "../$_"; + + if ($VERBOSE) + { + system ($EXTRACT, "--update", "--srcdir=$SRCDIR", + "--type=$gettext_type", $filename); + } + else + { + system ($EXTRACT, "--update", "--type=$gettext_type", + "--srcdir=$SRCDIR", "--quiet", $filename); + } + } + } + close FILE; + } +} + +# +# Generate .pot file from POTFILES.in +# +sub GeneratePOTemplate +{ + my $XGETTEXT = $ENV{"XGETTEXT"} || "/usr/bin/xgettext"; + my $XGETTEXT_ARGS = $ENV{"XGETTEXT_ARGS"} || ''; + chomp $XGETTEXT; + + if (! -x $XGETTEXT) + { + print STDERR " *** xgettext is not found on this system!\n". + " *** Without it, intltool-update can not extract strings.\n"; + exit; + } + + print "Building $MODULE.pot...\n" if $VERBOSE; + + open INFILE, $POTFILES_in; + unlink "POTFILES.in.temp"; + open OUTFILE, ">POTFILES.in.temp" or die("Cannot open POTFILES.in.temp for writing"); + + my $gettext_support_nonascii = 0; + + # checks for GNU gettext >= 0.12 + my $dummy = `$XGETTEXT --version --from-code=UTF-8 >$devnull 2>$devnull`; + if ($? == 0) + { + $gettext_support_nonascii = 1; + } + else + { + # urge everybody to upgrade gettext + print STDERR "WARNING: This version of gettext does not support extracting non-ASCII\n". + " strings. That means you should install a version of gettext\n". + " that supports non-ASCII strings (such as GNU gettext >= 0.12),\n". + " or have to let non-ASCII strings untranslated. (If there is any)\n"; + } + + my $encoding = "ASCII"; + my $forced_gettext_code; + my @temp_headers; + my $encoding_problem_is_reported = 0; + + while () + { + next if (/^#/ or /^\s*$/); + + chomp; + + my $gettext_code; + + if (/^\[\s*encoding:\s*(.*)\s*\]/) + { + $forced_gettext_code=$1; + } + elsif (/\.($xml_support|$ini_support)$/ || /^\[/) + { + s/^\[.*]\s*//; + print OUTFILE "../$_.h\n"; + push @temp_headers, "../$_.h"; + $gettext_code = &TextFile_DetermineEncoding ("../$_.h") if ($gettext_support_nonascii and not defined $forced_gettext_code); + } + 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); + } + + next if (! $gettext_support_nonascii); + + if (defined $forced_gettext_code) + { + $encoding=$forced_gettext_code; + } + elsif (defined $gettext_code and "$encoding" ne "$gettext_code") + { + if ($encoding eq "ASCII") + { + $encoding=$gettext_code; + } + elsif ($gettext_code ne "ASCII") + { + # Only report once because the message is quite long + if (! $encoding_problem_is_reported) + { + print STDERR "WARNING: You should use the same file encoding for all your project files,\n". + " but $PROGRAM thinks that most of the source files are in\n". + " $encoding encoding, while \"$_\" is (likely) in\n". + " $gettext_code encoding. If you are sure that all translatable strings\n". + " are in same encoding (say UTF-8), please \e[1m*prepend*\e[0m the following\n". + " line to POTFILES.in:\n\n". + " [encoding: UTF-8]\n\n". + " and make sure that configure.in/ac checks for $PACKAGE >= 0.27 .\n". + "(such warning message will only be reported once.)\n"; + $encoding_problem_is_reported = 1; + } + } + } + } + + close OUTFILE; + close INFILE; + + unlink "$MODULE.pot"; + my @xgettext_argument=("$XGETTEXT", + "--add-comments", + "--directory\=\.", + "--output\=$MODULE\.pot", + "--files-from\=\.\/POTFILES\.in\.temp"); + my $XGETTEXT_KEYWORDS = &FindPOTKeywords; + push @xgettext_argument, $XGETTEXT_KEYWORDS; + push @xgettext_argument, "--from-code\=$encoding" if ($gettext_support_nonascii); + push @xgettext_argument, $XGETTEXT_ARGS if $XGETTEXT_ARGS; + my $xgettext_command = join ' ', @xgettext_argument; + + # intercept xgettext error message + print "Running $xgettext_command\n" if $VERBOSE; + my $xgettext_error_msg = `$xgettext_command 2>\&1`; + my $command_failed = $?; + + unlink "POTFILES.in.temp"; + + print "Removing generated header (.h) files..." if $VERBOSE; + unlink foreach (@temp_headers); + print "done.\n" if $VERBOSE; + + if (! $command_failed) + { + if (! -e "$MODULE.pot") + { + print "None of the files in POTFILES.in contain strings marked for translation.\n" if $VERBOSE; + } + else + { + print "Wrote $MODULE.pot\n" if $VERBOSE; + } + } + else + { + if ($xgettext_error_msg =~ /--from-code/) + { + # replace non-ASCII error message with a more useful one. + print STDERR "ERROR: xgettext failed to generate PO template file because there is non-ASCII\n". + " string marked for translation. Please make sure that all strings marked\n". + " for translation are in uniform encoding (say UTF-8), then \e[1m*prepend*\e[0m the\n". + " following line to POTFILES.in and rerun $PROGRAM:\n\n". + " [encoding: UTF-8]\n\n"; + } + else + { + print STDERR "$xgettext_error_msg"; + if (-e "$MODULE.pot") + { + # is this possible? + print STDERR "ERROR: xgettext failed but still managed to generate PO template file.\n". + " Please consult error message above if there is any.\n"; + } + else + { + print STDERR "ERROR: xgettext failed to generate PO template file. Please consult\n". + " error message above if there is any.\n"; + } + } + exit (1); + } +} + +sub POFile_Update +{ + -f "$MODULE.pot" or die "$PROGRAM: $MODULE.pot does not exist.\n"; + + my $MSGMERGE = $ENV{"MSGMERGE"} || "/usr/bin/msgmerge"; + my ($lang, $outfile) = @_; + + print "Merging $SRCDIR/$lang.po with $MODULE.pot..." if $VERBOSE; + + my $infile = "$SRCDIR/$lang.po"; + $outfile = "$SRCDIR/$lang.po" if ($outfile eq ""); + + # I think msgmerge won't overwrite old file if merge is not successful + system ("$MSGMERGE", "-o", $outfile, $infile, "$MODULE.pot"); +} + +sub Console_WriteError_NotExisting +{ + my ($file) = @_; + + ## Report error if supplied language file is non-existing + print STDERR "$PROGRAM: $file does not exist!\n"; + print STDERR "Try '$PROGRAM --help' for more information.\n"; + exit; +} + +sub GatherPOFiles +{ + my @po_files = glob ("./*.po"); + + @languages = map (&POFile_GetLanguage, @po_files); + + foreach my $lang (@languages) + { + $po_files_by_lang{$lang} = shift (@po_files); + } +} + +sub POFile_GetLanguage ($) +{ + s/^(.*\/)?(.+)\.po$/$2/; + return $_; +} + +sub Console_Write_TranslationStatus +{ + my ($lang, $output_file) = @_; + my $MSGFMT = $ENV{"MSGFMT"} || "/usr/bin/msgfmt"; + + $output_file = "$SRCDIR/$lang.po" if ($output_file eq ""); + + system ("$MSGFMT", "-o", "$devnull", "--verbose", $output_file); +} + +sub Console_Write_CoverageReport +{ + my $MSGFMT = $ENV{"MSGFMT"} || "/usr/bin/msgfmt"; + + &GatherPOFiles; + + foreach my $lang (@languages) + { + print "$lang: "; + &POFile_Update ($lang, ""); + } + + print "\n\n * Current translation support in $MODULE \n\n"; + + foreach my $lang (@languages) + { + print "$lang: "; + system ("$MSGFMT", "-o", "$devnull", "--verbose", "$SRCDIR/$lang.po"); + } +} + +sub SubstituteVariable +{ + my ($str) = @_; + + # always need to rewind file whenever it has been accessed + seek (CONF, 0, 0); + + # cache each variable. varhash is global to we can add + # variables elsewhere. + while () + { + if (/^(\w+)=(.*)$/) + { + ($varhash{$1} = $2) =~ s/^["'](.*)["']$/$1/; + } + } + + if ($str =~ /^(.*)\${?([A-Z_]+)}?(.*)$/) + { + my $rest = $3; + my $untouched = $1; + my $sub = $varhash{$2}; + + return SubstituteVariable ("$untouched$sub$rest"); + } + + # We're using Perl backticks ` and "echo -n" here in order to + # expand any shell escapes (such as backticks themselves) in every variable + return echo_n ($str); +} + +sub CONF_Handle_Open +{ + my $base_dirname = getcwd(); + $base_dirname =~ s@.*/@@; + + my ($conf_in, $src_dir); + + if ($base_dirname =~ /^po(-.+)?$/) + { + if (-f "Makevars") + { + my $makefile_source; + + local (*IN); + open (IN, ") + { + if (/^top_builddir[ \t]*=/) + { + $src_dir = $_; + $src_dir =~ s/^top_builddir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/; + + chomp $src_dir; + if (-f "$src_dir" . "/configure.ac") { + $conf_in = "$src_dir" . "/configure.ac" . "\n"; + } else { + $conf_in = "$src_dir" . "/configure.in" . "\n"; + } + last; + } + } + close IN; + + $conf_in || die "Cannot find top_builddir in Makevars."; + } + elsif (-f "../configure.ac") + { + $conf_in = "../configure.ac"; + } + elsif (-f "../configure.in") + { + $conf_in = "../configure.in"; + } + else + { + my $makefile_source; + + local (*IN); + open (IN, ") + { + if (/^top_srcdir[ \t]*=/) + { + $src_dir = $_; + $src_dir =~ s/^top_srcdir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/; + + chomp $src_dir; + $conf_in = "$src_dir" . "/configure.in" . "\n"; + + last; + } + } + close IN; + + $conf_in || die "Cannot find top_srcdir in Makefile."; + } + + open (CONF, "<$conf_in"); + } + else + { + print STDERR "$PROGRAM: Unable to proceed.\n" . + "Make sure to run this script inside the po directory.\n"; + exit; + } +} + +sub FindPackageName +{ + my $version; + my $domain = &FindMakevarsDomain; + my $name = $domain || "untitled"; + + &CONF_Handle_Open; + + my $conf_source; { + local (*IN); + open (IN, "<&CONF") || return $name; + seek (IN, 0, 0); + local $/; # slurp mode + $conf_source = ; + close IN; + } + + # priority for getting package name: + # 1. GETTEXT_PACKAGE + # 2. first argument of AC_INIT (with >= 2 arguments) + # 3. first argument of AM_INIT_AUTOMAKE (with >= 2 argument) + + # /^AM_INIT_AUTOMAKE\([\s\[]*([^,\)\s\]]+)/m + # the \s makes this not work, why? + if ($conf_source =~ /^AM_INIT_AUTOMAKE\(([^,\)]+),([^,\)]+)/m) + { + ($name, $version) = ($1, $2); + $name =~ s/[\[\]\s]//g; + $version =~ s/[\[\]\s]//g; + $varhash{"AC_PACKAGE_NAME"} = $name; + $varhash{"PACKAGE"} = $name; + $varhash{"AC_PACKAGE_VERSION"} = $version; + $varhash{"VERSION"} = $version; + } + + if ($conf_source =~ /^AC_INIT\(([^,\)]+),([^,\)]+)/m) + { + ($name, $version) = ($1, $2); + $name =~ s/[\[\]\s]//g; + $version =~ s/[\[\]\s]//g; + $varhash{"AC_PACKAGE_NAME"} = $name; + $varhash{"PACKAGE"} = $name; + $varhash{"AC_PACKAGE_VERSION"} = $version; + $varhash{"VERSION"} = $version; + } + + # \s makes this not work, why? + $name = $1 if $conf_source =~ /^GETTEXT_PACKAGE=\[?([^\n\]]+)/m; + + # prepend '$' to auto* internal variables, usually they are + # used in configure.in/ac without the '$' + $name =~ s/AC_/\$AC_/g; + $name =~ s/\$\$/\$/g; + + $name = $domain if $domain; + + $name = SubstituteVariable ($name); + $name =~ s/^["'](.*)["']$/$1/; + + return $name if $name; +} + + +sub FindPOTKeywords +{ + + my $keywords = "--keyword\=\_ --keyword\=N\_ --keyword\=U\_ --keyword\=Q\_"; + my $varname = "XGETTEXT_OPTIONS"; + my $make_source; { + local (*IN); + open (IN, "; + close IN; + } + + $keywords = $1 if $make_source =~ /^$varname[ ]*=\[?([^\n\]]+)/m; + + return $keywords; +} + +sub FindMakevarsDomain +{ + + my $domain = ""; + my $makevars_source; { + local (*IN); + open (IN, "; + close IN; + } + + $domain = $1 if $makevars_source =~ /^DOMAIN[ ]*=\[?([^\n\]\$]+)/m; + $domain =~ s/^\s+//; + $domain =~ s/\s+$//; + + return $domain; +} diff --git a/panel-plugin/Makefile.am b/panel-plugin/Makefile.am index d96a9d5..2e0850b 100644 --- a/panel-plugin/Makefile.am +++ b/panel-plugin/Makefile.am @@ -1,32 +1,50 @@ -plugindir = @XFCE4_PANEL_PLUGINSDIR@ +plugindir = $(libexecdir)/xfce4/panel-plugins +plugin_PROGRAMS = xfce4-netload-plugin + LIBS = @LIBS@ @SOLLIBS@ -EXTRA_DIST = \ - wormulon commandline.c +xfce4_netload_plugin_SOURCES = \ + netload.c \ + utils.c \ + utils.h \ + net.h \ + net.c \ + os.h \ + wormulon.h \ + global.h \ + slurm.h -plugin_LTLIBRARIES = \ - libnetload.la +xfce4_netload_plugin_CFLAGS = \ + -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ + @LIBXFCE4PANEL_CFLAGS@ -libnetload_la_LDFLAGS = \ - -avoid-version \ - -export-dynamic \ - -module +xfce4_netload_plugin_LDFLAGS = \ + @SOLLIBS@ \ + @LIBXFCE4PANEL_LIBS@ -libnetload_la_SOURCES = \ - netload.c \ - utils.c \ - utils.h \ - net.h \ - net.c \ - os.h \ - wormulon.h \ - global.h \ - slurm.h +# .desktop file +# +# Some automake trickery here. Because we cannot use $(libexecdir) in the +# automake stage, we'll use sed to get the full path into the .desktop file. +# We also need to let intltool merge the translated fields, so we add an +# additional level of indirection: a .desktop.in.in file. +# +desktop_in_in_files = netload.desktop.in.in +desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in) + +desktopdir = $(datadir)/xfce4/panel-plugins +desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) +@INTLTOOL_DESKTOP_RULE@ -libnetload_la_CFLAGS = \ - -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ - @XFCE4_PANEL_CFLAGS@ +EXTRA_DIST = \ + wormulon commandline.c \ + $(desktop_in_in_files) + +DISTCLEANFILES = \ + $(desktop_DATA) $(desktop_in_files) + +# get full path into .desktop file +%.desktop.in: %.desktop.in.in + sed -e "s^@PLUGIN_PATH@^$(libexecdir)/xfce4/panel-plugins^" \ + $< > $@ -libnetload_la_LIBADD = \ - @SOLLIBS@ \ - @XFCE4_PANEL_LIBS@ diff --git a/panel-plugin/commandline.c b/panel-plugin/commandline.c index 1e68a4b..def3eb6 100644 --- a/panel-plugin/commandline.c +++ b/panel-plugin/commandline.c @@ -1,5 +1,5 @@ /* - * Id: $Id: commandline.c,v 1.2 2005/02/04 18:12:01 bwalle Exp $ + * Id: $Id$ * ------------------------------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify it under the terms of the diff --git a/panel-plugin/net.h b/panel-plugin/net.h index 2ead7b2..bed7a80 100644 --- a/panel-plugin/net.h +++ b/panel-plugin/net.h @@ -1,5 +1,5 @@ /* - * Id: $Id: net.h,v 1.8 2005/02/04 18:12:01 bwalle Exp $ + * Id: $Id$ * ------------------------------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify it under the terms of the diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index f925e81..1df7259 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -25,19 +25,14 @@ #include -#include -#include -#include -#include +#include +#include +#include -/* for xml: */ -#define MONITOR_ROOT "Netload" - static GtkTooltips *tooltips = NULL; -extern xmlDocPtr xmlconfig; -#define MYDATA(node) xmlNodeListGetString(xmlconfig, node->children, 1) +#define BORDER 8 /* Defaults */ #define DEFAULT_TEXT "Net" @@ -85,7 +80,6 @@ typedef struct GtkWidget *box; GtkWidget *label; GtkWidget *status[SUM]; - GtkWidget *ebox; gulong history[SUM][HISTSIZE_STORE]; gulong net_max[SUM]; @@ -121,6 +115,8 @@ typedef struct typedef struct { + XfcePanelPlugin *plugin; + GtkWidget *ebox; GtkWidget *box; guint timeout_id; @@ -142,8 +138,6 @@ static gboolean update_monitors(t_global_monitor *global) double temp; gint i, j; - XFCE_PANEL_LOCK(); - get_current_netload( &(global->monitor->data), &(net[IN]), &(net[OUT]), &(net[TOT]) ); @@ -225,11 +219,9 @@ static gboolean update_monitors(t_global_monitor *global) "Incoming: %s kByte/s\nOutgoing: %s kByte/s\nTotal: %s kByte/s"), get_name(&(global->monitor->data)), ip ? ip : _("no IP address"), HISTSIZE_CALCULATE, buffer[IN], buffer[OUT], buffer[TOT]); - gtk_tooltips_set_tip(tooltips, GTK_WIDGET(global->monitor->ebox), caption, NULL); + gtk_tooltips_set_tip(tooltips, GTK_WIDGET(global->ebox), caption, NULL); } - XFCE_PANEL_UNLOCK(); - return TRUE; } @@ -252,18 +244,129 @@ static void run_update (t_global_monitor *global) /* ---------------------------------------------------------------------------------------------- */ -static t_global_monitor * monitor_new(void) +static void monitor_set_orientation (XfcePanelPlugin *plugin, GtkOrientation orientation, + t_global_monitor *global) +{ + GtkRcStyle *rc; + gint i; + + if (global->timeout_id) + { + g_source_remove(global->timeout_id); + } + + gtk_widget_hide(GTK_WIDGET(global->ebox)); + if (global->box) + { + gtk_container_remove(GTK_CONTAINER(global->ebox), GTK_WIDGET(global->box)); + } + if (orientation == GTK_ORIENTATION_HORIZONTAL) + { + global->box = gtk_hbox_new(FALSE, 0); + } + else + { + global->box = gtk_vbox_new(FALSE, 0); + } + gtk_widget_show(global->box); + + global->monitor->label = gtk_label_new(global->monitor->options.label_text); + gtk_widget_show(global->monitor->label); + + for (i = 0; i < SUM; i++) + { + global->monitor->status[i] = GTK_WIDGET(gtk_progress_bar_new()); + } + + if (orientation == GTK_ORIENTATION_HORIZONTAL) + { + global->monitor->box = GTK_WIDGET(gtk_hbox_new(FALSE, 0)); + for (i = 0; i < SUM; i++) + { + gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(global->monitor->status[i]), + GTK_PROGRESS_BOTTOM_TO_TOP); + } + } + else + { + global->monitor->box = GTK_WIDGET(gtk_vbox_new(FALSE, 0)); + for (i = 0; i < SUM; i++) + { + gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(global->monitor->status[i]), + GTK_PROGRESS_LEFT_TO_RIGHT); + } + } + + gtk_box_pack_start(GTK_BOX(global->monitor->box), + GTK_WIDGET(global->monitor->label), + FALSE, FALSE, 0); + + gtk_container_set_border_width(GTK_CONTAINER(global->monitor->box), 4); + gtk_widget_show(GTK_WIDGET(global->monitor->box)); + + for (i = 0; i < SUM; i++) + { + rc = gtk_widget_get_modifier_style(GTK_WIDGET(global->monitor->status[i])); + if (!rc) + { + rc = gtk_rc_style_new(); + } + else + { + rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG; + rc->bg[GTK_STATE_PRELIGHT] = + global->monitor->options.color[i]; + } + + gtk_widget_modify_style(GTK_WIDGET(global->monitor->status[i]), rc); + gtk_widget_show(GTK_WIDGET(global->monitor->status[i])); + + gtk_box_pack_start(GTK_BOX(global->monitor->box), + GTK_WIDGET(global->monitor->status[i]), FALSE, FALSE, 0); + } + gtk_box_pack_start(GTK_BOX(global->box), + GTK_WIDGET(global->monitor->box), FALSE, FALSE, 0); + + + gtk_container_add(GTK_CONTAINER(global->ebox), GTK_WIDGET(global->box)); + gtk_widget_show(GTK_WIDGET(global->ebox)); + + run_update( global ); +} + + +/* ---------------------------------------------------------------------------------------------- */ +static void monitor_free(XfcePanelPlugin *plugin, t_global_monitor *global) +{ + if (global->timeout_id) + { + g_source_remove(global->timeout_id); + } + + if (global->monitor->options.label_text) + { + g_free(global->monitor->options.label_text); + } + g_free(global); + + close_netload( &(global->monitor->data) ); +} + + +/* ---------------------------------------------------------------------------------------------- */ +static t_global_monitor * monitor_new(XfcePanelPlugin *plugin) { t_global_monitor *global; - GtkRcStyle *rc; gint i; global = g_new(t_global_monitor, 1); global->timeout_id = 0; global->ebox = gtk_event_box_new(); gtk_widget_show(global->ebox); - global->box = gtk_hbox_new(FALSE, 0); - gtk_widget_show(global->box); + global->box = NULL; + + global->plugin = plugin; + xfce_panel_plugin_add_action_widget (plugin, global->ebox); if (!tooltips) { @@ -291,207 +394,19 @@ static t_global_monitor * monitor_new(void) global->monitor->options.max[i] = INIT_MAX; } - global->monitor->ebox = gtk_event_box_new(); - gtk_widget_show(global->monitor->ebox); - - global->monitor->box = GTK_WIDGET(gtk_hbox_new(FALSE, 0)); - gtk_container_set_border_width(GTK_CONTAINER(global->monitor->box), - border_width); - gtk_widget_show(GTK_WIDGET(global->monitor->box)); - - gtk_container_add(GTK_CONTAINER(global->monitor->ebox), - GTK_WIDGET(global->monitor->box)); - - global->monitor->label = - gtk_label_new(global->monitor->options.label_text); - gtk_widget_show(global->monitor->label); - gtk_box_pack_start(GTK_BOX(global->monitor->box), - GTK_WIDGET(global->monitor->label), - FALSE, FALSE, 0); - - for (i = 0; i < SUM; i++) - { - global->monitor->status[i] = GTK_WIDGET(gtk_progress_bar_new()); - gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(global->monitor->status[i]), - GTK_PROGRESS_BOTTOM_TO_TOP); - - rc = gtk_widget_get_modifier_style(GTK_WIDGET(global->monitor->status[i])); - if (!rc) - { - rc = gtk_rc_style_new(); - } - else - { - rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG; - rc->bg[GTK_STATE_PRELIGHT] = global->monitor->options.color[i]; - } - - gtk_widget_modify_style(GTK_WIDGET(global->monitor->status[i]), rc); - gtk_widget_show(GTK_WIDGET(global->monitor->status[i])); - - gtk_box_pack_start(GTK_BOX(global->monitor->box), - GTK_WIDGET(global->monitor->status[i]), - FALSE, FALSE, 0); - } - - gtk_box_pack_start(GTK_BOX(global->box), - GTK_WIDGET(global->monitor->ebox), - FALSE, FALSE, 0); - - - gtk_container_add(GTK_CONTAINER(global->ebox), GTK_WIDGET(global->box)); + monitor_set_orientation (plugin, xfce_panel_plugin_get_orientation (plugin), global); return global; } -/* ---------------------------------------------------------------------------------------------- */ -static void monitor_set_orientation (Control * ctrl, int orientation) -{ - t_global_monitor *global = ctrl->data; - GtkRcStyle *rc; - gint i; - - if (global->timeout_id) - { - g_source_remove(global->timeout_id); - } - - gtk_widget_hide(GTK_WIDGET(global->ebox)); - gtk_container_remove(GTK_CONTAINER(global->ebox), GTK_WIDGET(global->box)); - if (orientation == HORIZONTAL) - { - global->box = gtk_hbox_new(FALSE, 0); - } - else - { - global->box = gtk_vbox_new(FALSE, 0); - } - gtk_widget_show(global->box); - - global->monitor->label = gtk_label_new(global->monitor->options.label_text); - gtk_widget_show(global->monitor->label); - - for (i = 0; i < SUM; i++) - { - global->monitor->status[i] = GTK_WIDGET(gtk_progress_bar_new()); - } - - if (orientation == HORIZONTAL) - { - global->monitor->box = GTK_WIDGET(gtk_hbox_new(FALSE, 0)); - for (i = 0; i < SUM; i++) - { - gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(global->monitor->status[i]), - GTK_PROGRESS_BOTTOM_TO_TOP); - } - } - else - { - global->monitor->box = GTK_WIDGET(gtk_vbox_new(FALSE, 0)); - for (i = 0; i < SUM; i++) - { - gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(global->monitor->status[i]), - GTK_PROGRESS_LEFT_TO_RIGHT); - } - } - - gtk_box_pack_start(GTK_BOX(global->monitor->box), - GTK_WIDGET(global->monitor->label), - FALSE, FALSE, 0); - - gtk_container_set_border_width(GTK_CONTAINER(global->monitor->box), - border_width); - gtk_widget_show(GTK_WIDGET(global->monitor->box)); - - global->monitor->ebox = gtk_event_box_new(); - gtk_widget_show(global->monitor->ebox); - gtk_container_add(GTK_CONTAINER(global->monitor->ebox), - GTK_WIDGET(global->monitor->box)); - - for (i = 0; i < SUM; i++) - { - rc = gtk_widget_get_modifier_style(GTK_WIDGET(global->monitor->status[i])); - if (!rc) - { - rc = gtk_rc_style_new(); - } - else - { - rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG; - rc->bg[GTK_STATE_PRELIGHT] = - global->monitor->options.color[i]; - } - - gtk_widget_modify_style(GTK_WIDGET(global->monitor->status[i]), rc); - gtk_widget_show(GTK_WIDGET(global->monitor->status[i])); - - gtk_box_pack_start(GTK_BOX(global->monitor->box), - GTK_WIDGET(global->monitor->status[i]), FALSE, FALSE, 0); - } - gtk_box_pack_start(GTK_BOX(global->box), - GTK_WIDGET(global->monitor->ebox), FALSE, FALSE, 0); - - - gtk_container_add(GTK_CONTAINER(global->ebox), GTK_WIDGET(global->box)); - gtk_widget_show(GTK_WIDGET(global->ebox)); - - run_update( global ); -} - - -/* ---------------------------------------------------------------------------------------------- */ -static gboolean monitor_control_new(Control *ctrl) -{ - t_global_monitor *global; - - global = monitor_new(); - - gtk_container_add(GTK_CONTAINER(ctrl->base), GTK_WIDGET(global->ebox)); - - run_update( global ); - - ctrl->data = (gpointer)global; - ctrl->with_popup = FALSE; - - gtk_widget_set_size_request(ctrl->base, -1, -1); - - return TRUE; -} - - -/* ---------------------------------------------------------------------------------------------- */ -static void monitor_free(Control *ctrl) -{ - t_global_monitor *global; - - g_return_if_fail(ctrl != NULL); - g_return_if_fail(ctrl->data != NULL); - - global = (t_global_monitor *)ctrl->data; - - if (global->timeout_id) - { - g_source_remove(global->timeout_id); - } - - if (global->monitor->options.label_text) - { - g_free(global->monitor->options.label_text); - } - g_free(global); - - close_netload( &(global->monitor->data) ); -} - - /* ---------------------------------------------------------------------------------------------- */ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings) { GtkRcStyle *rc; gint i; - gtk_widget_hide(GTK_WIDGET(global->monitor->ebox)); + gtk_widget_hide(GTK_WIDGET(global->monitor->box)); gtk_widget_hide(global->monitor->label); gtk_label_set_text(GTK_LABEL(global->monitor->label), global->monitor->options.label_text); @@ -531,7 +446,7 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings) } } - gtk_widget_show(GTK_WIDGET(global->monitor->ebox)); + gtk_widget_show(GTK_WIDGET(global->monitor->box)); if (global->monitor->options.use_label) { gtk_widget_show(global->monitor->label); @@ -560,178 +475,143 @@ static void setup_monitor(t_global_monitor *global, gboolean supress_warnings) /* ---------------------------------------------------------------------------------------------- */ -static void monitor_read_config(Control *ctrl, xmlNodePtr node) +static void monitor_read_config(XfcePanelPlugin *plugin, t_global_monitor *global) { - xmlChar *value; - t_global_monitor *global; - - global = (t_global_monitor *)ctrl->data; + const char *value; + char *file; + XfceRc *rc; - if (node == NULL || node->children == NULL) - { + if (!(file = xfce_panel_plugin_lookup_rc_file (plugin))) return; + + rc = xfce_rc_simple_open (file, TRUE); + g_free (file); + + if (!rc) + return; + + global->monitor->options.use_label = xfce_rc_read_bool_entry (rc, "Use_Label", TRUE); + + if ((value = xfce_rc_read_entry (rc, "Color_In", NULL)) != NULL) + { + gdk_color_parse(value, + &global->monitor->options.color[IN]); + } + if ((value = xfce_rc_read_entry (rc, "Color_Out", NULL)) != NULL) + { + gdk_color_parse(value, + &global->monitor->options.color[OUT]); + } + if ((value = xfce_rc_read_entry (rc, "Text", NULL)) && *value) + { + if (global->monitor->options.label_text) + g_free(global->monitor->options.label_text); + global->monitor->options.label_text = g_strdup(value); + } + if ((value = xfce_rc_read_entry (rc, "Network_Device", NULL)) && *value) + { + if (global->monitor->options.network_device) + g_free(global->monitor->options.network_device); + global->monitor->options.network_device = g_strdup(value); + } + if ((value = xfce_rc_read_entry (rc, "Max_In", NULL)) != NULL) + { + global->monitor->options.max[IN] = strtol (value, NULL, 0); + } + if ((value = xfce_rc_read_entry (rc, "Max_Out", NULL)) != NULL) + { + global->monitor->options.max[OUT] = strtol (value, NULL, 0); } - for (node = node->children; node; node = node->next) - { - if (xmlStrEqual(node->name, (const xmlChar *)MONITOR_ROOT)) - { - if ((value = xmlGetProp(node, (const xmlChar *)"Use_Label"))) - { - global->monitor->options.use_label = atoi(value); - g_free(value); - } - if ((value = xmlGetProp(node, (const xmlChar *)"Color_In"))) - { - gdk_color_parse(value, - &global->monitor->options.color[IN]); - g_free(value); - } - if ((value = xmlGetProp(node, (const xmlChar *)"Color_Out"))) - { - gdk_color_parse(value, - &global->monitor->options.color[OUT]); - g_free(value); - } - if ((value = xmlGetProp(node, (const xmlChar *) "Text"))) - { - if (global->monitor->options.label_text) - g_free(global->monitor->options.label_text); - global->monitor->options.label_text = - g_strdup((gchar *)value); - g_free(value); - } - if ((value = xmlGetProp(node, (const xmlChar *) "Network_Device"))) - { - if (global->monitor->options.network_device) - g_free(global->monitor->options.network_device); - global->monitor->options.network_device = - g_strdup((gchar *)value); - g_free(value); - } - if ((value = xmlGetProp(node, (const xmlChar *) "Max_In"))) - { - global->monitor->options.max[IN] = atoi( value ); - g_free(value); - } - if ((value = xmlGetProp(node, (const xmlChar *) "Max_Out"))) - { - global->monitor->options.max[OUT] = atol( value ); - g_free(value); - } - if ((value = xmlGetProp(node, (const xmlChar *) "Auto_Max"))) - { - global->monitor->options.auto_max = atol(value); - g_free(value); - } - if ((value = xmlGetProp(node, (const xmlChar *) "Update_Interval"))) - { - global->monitor->options.update_interval = atoi(value); - g_free(value); - } - break; - } - } + global->monitor->options.auto_max = xfce_rc_read_bool_entry (rc, "Auto_Max", TRUE); + + global->monitor->options.update_interval = + xfce_rc_read_int_entry (rc, "Update_Interval", UPDATE_TIMEOUT); + PRINT_DBG("monitor_read_config"); setup_monitor(global, TRUE); + + xfce_rc_close (rc); } /* ---------------------------------------------------------------------------------------------- */ -static void monitor_write_config(Control *ctrl, xmlNodePtr parent) +static void monitor_write_config(XfcePanelPlugin *plugin, t_global_monitor *global) { - xmlNodePtr root; + XfceRc *rc; + char *file; char value[20]; - t_global_monitor *global; - global = (t_global_monitor *)ctrl->data; + if (!(file = xfce_panel_plugin_save_location (plugin, TRUE))) + return; + + rc = xfce_rc_simple_open (file, FALSE); + g_free (file); - root = xmlNewTextChild(parent, NULL, MONITOR_ROOT, NULL); - - g_snprintf(value, 2, "%d", global->monitor->options.use_label); - xmlSetProp(root, "Use_Label", value); + if (!rc) + return; + + xfce_rc_write_bool_entry (rc, "Use_Label", global->monitor->options.use_label); g_snprintf(value, 8, "#%02X%02X%02X", (guint)global->monitor->options.color[IN].red >> 8, (guint)global->monitor->options.color[IN].green >> 8, (guint)global->monitor->options.color[IN].blue >> 8); - - xmlSetProp(root, "Color_In", value); + xfce_rc_write_entry (rc, "Color_In", value); g_snprintf(value, 8, "#%02X%02X%02X", (guint)global->monitor->options.color[OUT].red >> 8, (guint)global->monitor->options.color[OUT].green >> 8, (guint)global->monitor->options.color[OUT].blue >> 8); + xfce_rc_write_entry (rc, "Color_Out", value); - xmlSetProp(root, "Color_Out", value); + xfce_rc_write_entry (rc, "Text", global->monitor->options.label_text ? + global->monitor->options.label_text : ""); - if (global->monitor->options.label_text) - { - xmlSetProp(root, "Text", - global->monitor->options.label_text); - } - - if (global->monitor->options.network_device) - { - xmlSetProp(root, "Network_Device", global->monitor->options.network_device); - } + xfce_rc_write_entry (rc, "Network_Device", global->monitor->options.network_device ? + global->monitor->options.network_device : ""); g_snprintf(value, 20, "%lu", global->monitor->options.max[IN]); - xmlSetProp(root, "Max_In", value); + xfce_rc_write_entry (rc, "Max_In", value); g_snprintf(value, 20, "%lu", global->monitor->options.max[OUT]); - xmlSetProp(root, "Max_Out", value); + xfce_rc_write_entry (rc, "Max_Out", value); - g_snprintf(value, 2, "%d", global->monitor->options.auto_max); - xmlSetProp(root, "Auto_Max", value); + xfce_rc_write_bool_entry (rc, "Auto_Max", global->monitor->options.auto_max); - g_snprintf(value, 20, "%d", global->monitor->options.update_interval); - xmlSetProp(root, "Update_Interval", value); - - root = xmlNewTextChild(parent, NULL, MONITOR_ROOT, NULL); + xfce_rc_write_int_entry (rc, "Update_Interval", global->monitor->options.update_interval); + + xfce_rc_close (rc); } /* ---------------------------------------------------------------------------------------------- */ -static void monitor_attach_callback(Control *ctrl, const gchar *signal, GCallback cb, gpointer data) +static gboolean monitor_set_size(XfcePanelPlugin *plugin, int size, t_global_monitor *global) { - t_global_monitor *global; - - global = (t_global_monitor *)ctrl->data; - g_signal_connect(global->ebox, signal, cb, data); -} - - -/* ---------------------------------------------------------------------------------------------- */ -static void monitor_set_size(Control *ctrl, int size) -{ - /* do the resize */ - t_global_monitor *global; gint i; - global = (t_global_monitor *)ctrl->data; - for (i = 0; i < SUM; i++) { - if (settings.orientation == HORIZONTAL) + if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL) { gtk_widget_set_size_request(GTK_WIDGET(global->monitor->status[i]), - 6 + 2 * size, icon_size[size] - 4); + BORDER, size - 4); } else { gtk_widget_set_size_request(GTK_WIDGET(global->monitor->status[i]), - icon_size[size] - 4, 6 + 2 * size); + size - 4, BORDER); } - gtk_widget_queue_resize(GTK_WIDGET(global->monitor->status[i])); } PRINT_DBG("monitor_set_size"); setup_monitor(global, TRUE); + + return TRUE; } /* ---------------------------------------------------------------------------------------------- */ -static void monitor_apply_options_cb(GtkWidget *button, t_global_monitor *global) +static void monitor_apply_options(t_global_monitor *global) { gint i; @@ -755,9 +635,8 @@ static void monitor_apply_options_cb(GtkWidget *button, t_global_monitor *global for( i = 0; i < SUM; i++ ) { - global->monitor->options.max[i] = strtod( - g_strdup(gtk_entry_get_text(GTK_ENTRY(global->monitor->max_entry[i]))), - NULL ) * 1024; + global->monitor->options.max[i] = + strtol(gtk_entry_get_text(GTK_ENTRY(global->monitor->max_entry[i])), NULL, 0) * 1024; } global->monitor->options.update_interval = @@ -791,9 +670,8 @@ static void max_label_changed(GtkWidget *button, t_global_monitor *global) gint i; for( i = 0; i < SUM; i++ ) { - global->monitor->options.max[i] = strtod( - g_strdup(gtk_entry_get_text(GTK_ENTRY(global->monitor->max_entry[i]))), - NULL ) * 1024; + global->monitor->options.max[i] = + strtol(gtk_entry_get_text(GTK_ENTRY(global->monitor->max_entry[i])), NULL, 0) * 1024; } setup_monitor(global, FALSE); @@ -820,8 +698,7 @@ static void network_changed(GtkWidget *button, t_global_monitor *global) /* ---------------------------------------------------------------------------------------------- */ static void label_toggled(GtkWidget *check_button, t_global_monitor *global) { - global->monitor->options.use_label = - !global->monitor->options.use_label; + global->monitor->options.use_label = !global->monitor->options.use_label; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(global->monitor->opt_use_label), global->monitor->options.use_label); gtk_widget_set_sensitive(GTK_WIDGET(global->monitor->opt_entry), @@ -924,9 +801,19 @@ static void change_color_out(GtkWidget *button, t_global_monitor *global) /* ---------------------------------------------------------------------------------------------- */ -static void monitor_create_options(Control *control, GtkContainer *container, GtkWidget *done) +static void +monitor_dialog_response (GtkWidget *dlg, int response, t_global_monitor *global) { - t_global_monitor *global; + + monitor_apply_options (global); + gtk_widget_destroy (dlg); + xfce_panel_plugin_unblock_menu (global->plugin); + monitor_write_config (global->plugin, global); +} + +static void monitor_create_options(XfcePanelPlugin *plugin, t_global_monitor *global) +{ + GtkWidget *dlg, *header; GtkBox *vbox, *global_vbox, *net_hbox; GtkWidget *device_label, *unit_label[SUM], *max_label[SUM]; GtkWidget *sep1, *sep2; @@ -947,16 +834,35 @@ static void monitor_create_options(Control *control, GtkContainer *container, Gt N_("Maximum (outgoing):") }; + xfce_panel_plugin_block_menu (plugin); + + dlg = gtk_dialog_new_with_buttons (_("Edit Properties"), + GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))), + GTK_DIALOG_DESTROY_WITH_PARENT | + GTK_DIALOG_NO_SEPARATOR, + GTK_STOCK_CLOSE, GTK_RESPONSE_OK, + NULL); + + g_signal_connect (dlg, "response", G_CALLBACK (monitor_dialog_response), + global); + + gtk_container_set_border_width (GTK_CONTAINER (dlg), 2); + + global->opt_dialog = dlg; + + header = xfce_create_header (NULL, _("Network Monitor")); + gtk_widget_set_size_request (GTK_BIN (header)->child, -1, 32); + gtk_container_set_border_width (GTK_CONTAINER (header), BORDER - 2); + gtk_widget_show (header); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), header, FALSE, TRUE, 0); + + global_vbox = GTK_BOX (gtk_vbox_new(FALSE, BORDER)); + gtk_container_set_border_width (GTK_CONTAINER (global_vbox), BORDER - 2); + gtk_widget_show(GTK_WIDGET (global_vbox)); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), GTK_WIDGET (global_vbox), TRUE, TRUE, 0); + sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); - global = (t_global_monitor *)control->data; - global->opt_dialog = gtk_widget_get_toplevel(done); - - global_vbox = GTK_BOX(gtk_vbox_new(FALSE, 5)); - gtk_container_add(GTK_CONTAINER(container), GTK_WIDGET(global_vbox)); - - gtk_widget_show_all(GTK_WIDGET(global_vbox)); - vbox = GTK_BOX(gtk_vbox_new(FALSE, 5)); gtk_widget_show(GTK_WIDGET(vbox)); @@ -1159,29 +1065,36 @@ static void monitor_create_options(Control *control, GtkContainer *container, Gt G_CALLBACK(label_changed), global); g_signal_connect(GTK_WIDGET(global->monitor->net_entry), "activate", G_CALLBACK(network_changed), global); - g_signal_connect(GTK_WIDGET(done), "clicked", - G_CALLBACK(monitor_apply_options_cb), global); + + gtk_widget_show (dlg); } /* ---------------------------------------------------------------------------------------------- */ -G_MODULE_EXPORT void xfce_control_class_init(ControlClass *cc) +static void netload_construct (XfcePanelPlugin *plugin) { + t_global_monitor *global; + xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); + + global = monitor_new(plugin); + + monitor_read_config (plugin, global); - cc->name = "netload"; - cc->caption = _("Netload"); - - cc->create_control = (CreateControlFunc)monitor_control_new; - - cc->free = monitor_free; - cc->read_config = monitor_read_config; - cc->write_config = monitor_write_config; - cc->attach_callback = monitor_attach_callback; - - cc->create_options = monitor_create_options; - - cc->set_size = monitor_set_size; - - cc->set_orientation = monitor_set_orientation; + g_signal_connect (plugin, "free-data", G_CALLBACK (monitor_free), global); + + g_signal_connect (plugin, "save", G_CALLBACK (monitor_write_config), global); + + xfce_panel_plugin_menu_show_configure (plugin); + g_signal_connect (plugin, "configure-plugin", G_CALLBACK (monitor_create_options), global); + + g_signal_connect (plugin, "size-changed", G_CALLBACK (monitor_set_size), global); + + g_signal_connect (plugin, "orientation-changed", G_CALLBACK (monitor_set_orientation), global); + + gtk_container_add(GTK_CONTAINER(plugin), global->ebox); + + run_update( global ); } + +XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL (netload_construct); diff --git a/panel-plugin/netload.desktop.in.in b/panel-plugin/netload.desktop.in.in new file mode 100644 index 0000000..7779785 --- /dev/null +++ b/panel-plugin/netload.desktop.in.in @@ -0,0 +1,8 @@ +[Xfce Panel] +Type=X-XFCE-PanelPlugin +Encoding=UTF-8 +_Name=Network Monitor +_Comment=Show network traffic +Icon=xfce-mouse +X-XFCE-Exec=@PLUGIN_PATH@/xfce4-netload-plugin + diff --git a/panel-plugin/os.h b/panel-plugin/os.h index 45b5583..67b6b05 100644 --- a/panel-plugin/os.h +++ b/panel-plugin/os.h @@ -1,5 +1,5 @@ /* - * Id: $Id: os.h,v 1.4 2005/02/04 18:12:01 bwalle Exp $ + * Id: $Id$ * ------------------------------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify it under the terms of the diff --git a/panel-plugin/utils.c b/panel-plugin/utils.c index 104ed84..b435a9b 100644 --- a/panel-plugin/utils.c +++ b/panel-plugin/utils.c @@ -1,5 +1,5 @@ /* - * Id: $Id: utils.c,v 1.3 2005/02/04 18:12:01 bwalle Exp $ + * Id: $Id$ * ------------------------------------------------------------------------------------------------- * * This program is free software; you can redistribute it and/or modify it under the terms of the diff --git a/panel-plugin/wormulon.h b/panel-plugin/wormulon.h index c4c6c35..b6ef826 100644 --- a/panel-plugin/wormulon.h +++ b/panel-plugin/wormulon.h @@ -5,7 +5,7 @@ * application specific defines. You should never need to tune anything here * ****************************************************************************** - * $Id: wormulon.h,v 1.2 2003/08/25 21:08:58 bwalle Exp $ + * $Id$ *****************************************************************************/ #ifndef _WORMULON_H diff --git a/panel-plugin/wormulon/freebsd.c b/panel-plugin/wormulon/freebsd.c index afb74e8..c8215dd 100644 --- a/panel-plugin/wormulon/freebsd.c +++ b/panel-plugin/wormulon/freebsd.c @@ -1,4 +1,4 @@ -/* $Id: freebsd.c,v 1.3 2003/08/31 12:54:36 bwalle Exp $ */ +/* $Id$ */ /***************************************************************************** diff --git a/panel-plugin/wormulon/hpux.c b/panel-plugin/wormulon/hpux.c index cbb2bfb..666e11f 100644 --- a/panel-plugin/wormulon/hpux.c +++ b/panel-plugin/wormulon/hpux.c @@ -1,7 +1,7 @@ #include #define WAIT_PCKS_COUNTER 15 -/* $Id: hpux.c,v 1.3 2003/08/31 12:54:36 bwalle Exp $ */ +/* $Id$ */ /***************************************************************************** diff --git a/panel-plugin/wormulon/if_media.c b/panel-plugin/wormulon/if_media.c index b569949..89f0982 100644 --- a/panel-plugin/wormulon/if_media.c +++ b/panel-plugin/wormulon/if_media.c @@ -6,7 +6,7 @@ * operating systems. * ***************************************************************************** - * $Id: if_media.c,v 1.3 2003/09/13 12:30:10 bwalle Exp $ + * $Id$ *****************************************************************************/ #if defined (__FreeBSD__) || (__OpenBSD__) || (__NetBSD__) || (__MicroBSD__) || (__APPLE__) diff --git a/panel-plugin/wormulon/linux.c b/panel-plugin/wormulon/linux.c index ccbcc32..e45ff7f 100644 --- a/panel-plugin/wormulon/linux.c +++ b/panel-plugin/wormulon/linux.c @@ -1,4 +1,4 @@ -/* $Id: linux.c,v 1.5 2005/05/17 18:42:52 bwalle Exp $ */ +/* $Id$ */ #include "linux.h" diff --git a/panel-plugin/wormulon/macos.c b/panel-plugin/wormulon/macos.c index a7a043c..c8da6a5 100644 --- a/panel-plugin/wormulon/macos.c +++ b/panel-plugin/wormulon/macos.c @@ -1,4 +1,4 @@ -/* $Id: macos.c,v 1.1 2003/09/13 12:30:10 bwalle Exp $ */ +/* $Id$ */ /***************************************************************************** diff --git a/panel-plugin/wormulon/netbsd.c b/panel-plugin/wormulon/netbsd.c index ebccc48..c8da6a5 100644 --- a/panel-plugin/wormulon/netbsd.c +++ b/panel-plugin/wormulon/netbsd.c @@ -1,4 +1,4 @@ -/* $Id: netbsd.c,v 1.4 2003/08/31 12:54:36 bwalle Exp $ */ +/* $Id$ */ /***************************************************************************** diff --git a/panel-plugin/wormulon/openbsd.c b/panel-plugin/wormulon/openbsd.c index 7bb4bcf..c98243c 100644 --- a/panel-plugin/wormulon/openbsd.c +++ b/panel-plugin/wormulon/openbsd.c @@ -1,4 +1,4 @@ -/* $Id: openbsd.c,v 1.4 2003/08/31 12:54:36 bwalle Exp $ */ +/* $Id$ */ /***************************************************************************** diff --git a/panel-plugin/wormulon/solaris.c b/panel-plugin/wormulon/solaris.c index 68272f5..54002c6 100644 --- a/panel-plugin/wormulon/solaris.c +++ b/panel-plugin/wormulon/solaris.c @@ -1,4 +1,4 @@ -/* $Id: solaris.c,v 1.3 2003/08/31 12:54:36 bwalle Exp $ */ +/* $Id$ */ /***************************************************************************** diff --git a/panel-plugin/wormulon/unsupported.c b/panel-plugin/wormulon/unsupported.c index 0399de0..358b313 100644 --- a/panel-plugin/wormulon/unsupported.c +++ b/panel-plugin/wormulon/unsupported.c @@ -1,4 +1,4 @@ -/* $Id: unsupported.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ */ +/* $Id$ */ /****************************************************************************** * diff --git a/po/ChangeLog b/po/ChangeLog index 772a14d..e69de29 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,195 +0,0 @@ -2006-04-22 Daichi Kawahata - - * ca.po: Updated Catalan translations by Carles Munoz Gorriz - . - -2006-04-08 Daichi Kawahata - - * pl.po: Updated Polish translations by Piotr Malinski - . - * .cvsignore: Removed unnecessary file. - -2005-11-02 Bernhard Walle - - * pt_BR.po: Added pt_BR translation. - -2005-10-24 Daichi Kawahata - - * eu.po: Added Basque translations by Piarres Beobide - . - * ca.po, de.po, es.po, fr.po, ko.po, lt.po, pl.po, ru.po, uk.po: - Updated with the latest sources. Modified initial comments, - headers. - -2005-10-18 Bernhard Walle - - * Makefile.in.in, es.po, fr.po, ko.po, ru.po: added Spanish - translation, thanks to Rudy Godoy. changed some fileds in - the translation files because the new tool version in SUSE - 10.0 require non-standard fields (and changing them was faster - than finding out the parameter to change this) - -2005-10-04 Bernhard Walle - - * ChangeLog: Added ChangeLog in po directory (expected by - autotools) - -2005-10-04 Bernhard Walle - - * Makefile.in.in, fr.po, ru.po: removed generated files and use - Xfce Deveopement tools. added Russian translation, thanks to - Fedoseev Sergey - -2005-06-14 Jean-Francois Wauthy - - * fr.po: update FR translations - -2005-03-04 ByungHyun Choi - - * ko.po: Update KO translatons - -2005-02-13 Jean-Francois Wauthy - - * fr.po: add FR translations - -2005-02-04 Bernhard Walle - - * ko.po: New version - -2005-02-04 Bernhard Walle - - * Makefile.in.in: Removed ChangeLog - -2005-02-04 Bernhard Walle - - * ca.po, de.po, lt.po, pl.po, uk.po, xfce4-netload.pot: New version - -2005-02-04 Bernhard Walle - - * ChangeLog: Makes no sense, we have CVS - -2005-02-04 Bernhard Walle - - * ca.po, de.po, lt.po, pl.po, uk.po, xfce4-netload.pot: New release - -2005-01-25 Jean-Francois Wauthy - - * ko.po: add KO translations - -2005-01-13 Bernhard Walle - - * uk.gmo: Removed generated file - -2004-08-01 Bernhard Walle - - * ca.po, de.po, lt.po, pl.po, uk.gmo, uk.po, xfce4-netload.pot: - New version 0.2.3: Make it thread save for recent developement - versions of Xfce - -2004-06-27 Bernhard Walle - - * ca.po: Update from Carles Munoz Gorriz - -2003-11-03 Jasper Huijsmans - - * uk.gmo, uk.po: Add Ukranian translations - -2003-10-19 Bernhard Walle - - * ChangeLog, pl.po: Added Polish translation - -2003-10-01 Bernhard Walle - - * ca.po, de.po, lt.po, xfce4-netload.pot: New version 0.2.1: - Fixed bug with wrong calculation of total number because of - integer division. Show warning dialog because of initialization - errors only after changes in configuration and not after - startup. - -2003-09-13 Bernhard Walle - - * ca.po, lt.po, xfce4-netload.pot: New version 0.2.0 - -2003-09-13 Bernhard Walle - - * ChangeLog, de.po: Changed the application string to - Xfce4-Netload-Plugin (the translation to "Netzlast" looked a bit - funny) - -2003-09-06 Bernhard Walle - - * ChangeLog, ca.po: Updated Catalan translation, thanks to Carles - Munoz Gorriz - -2003-09-06 Bernhard Walle - - * ChangeLog, ca.po, de.po, lt.po, xfce4-netload.pot: New version - 0.2.0pre6 Added GUI warning if the plugin initialization failed - and corrected "ms" to "s" (seconds) - -2003-08-31 Bernhard Walle - - * ca.po, de.po, lt.po, xfce4-netload.pot: New version 0.2.0pre5 - Fixed problems on all operating systems that require - initialization and removed superfluous call of init_netload() - function. - -2003-08-27 Bernhard Walle - - * ca.po, de.po, lt.po, xfce4-netload.pot: New version 0.2.0pre4 - Fixed compile problem on NetBSD and OpenBSD - -2003-08-27 Bernhard Walle - - * ChangeLog, ca.po: Updated Catalan translation, thanks to Carles - Munoz Gorriz - -2003-08-26 Bernhard Walle - - * ChangeLog, ca.po, de.po, lt.po, xfce4-netload.pot: New version - 0.2.0pre3 Fixed a small bug, implemented configurable update - interval and improved automatic maximum. - -2003-08-25 Bernhard Walle - - * ca.po, de.po, lt.po, xfce4-netload.pot: New version 0.2.0pre2 - Support more than one instance of the plugin - -2003-08-24 Bernhard Walle - - * ChangeLog, ca.po, de.po, lt.po, xfce4-netload.pot: New version - 0.2.0pre1 - -2003-08-17 Bernhard Walle - - * ChangeLog, ca.po, de.po, lt.po, xfce4-netload.pot: Changed - "bit/s" to "byte/s" - -2003-08-15 Bernhard Walle - - * ChangeLog, ca.po: Added Catalan translation. Translator was - Carles Munoz Gorriz . - -2003-08-15 Bernhard Walle - - * .cvsignore: Added .cvsignore file - -2003-08-15 Bernhard Walle - - * ChangeLog: Added lithuanian translation. Translator was Mantas - . - -2003-08-15 Bernhard Walle - - * de.gmo: Removed gmo file - -2003-08-15 Bernhard Walle - - * lt.po: Added lithuanian translation. Translator was Mantas - . - -2003-08-13 Bernhard Walle - - * ChangeLog, Makefile.in.in, POTFILES.in, de.gmo, de.po, - xfce4-netload.pot: Initial revision - diff --git a/po/Makefile.in.in b/po/Makefile.in.in index ec526e8..98b4c12 100644 --- a/po/Makefile.in.in +++ b/po/Makefile.in.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 = @GETTEXT_PACKAGE@ PACKAGE = @PACKAGE@ @@ -21,16 +26,20 @@ SHELL = /bin/sh srcdir = @srcdir@ top_srcdir = @top_srcdir@ +top_builddir = .. VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ datadir = @datadir@ +datarootdir = @datarootdir@ libdir = @libdir@ localedir = $(libdir)/locale gnulocaledir = $(datadir)/locale gettextsrcdir = $(datadir)/glib-2.0/gettext/po subdir = po +install_sh = @install_sh@ +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -41,7 +50,10 @@ GMSGFMT = @GMSGFMT@ MSGFMT = @MSGFMT@ XGETTEXT_ARGS = @XGETTEXT_ARGS@ XGETTEXT = @XGETTEXT@ $(XGETTEXT_ARGS) -MSGMERGE = msgmerge +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_EXTRACT = @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 = @DEFS@ CFLAGS = @CFLAGS@ @@ -54,8 +66,9 @@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS) SOURCES = POFILES = @POFILES@ GMOFILES = @GMOFILES@ -DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(GETTEXT_PACKAGE).pot \ -$(POFILES) $(GMOFILES) $(SOURCES) +DISTFILES = ChangeLog Makefile.in.in POTFILES.in \ +$(POFILES) $(SOURCES) +EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS POTFILES = \ @@ -71,14 +84,14 @@ INSTOBJEXT = @INSTOBJEXT@ .po.pox: $(MAKE) $(GETTEXT_PACKAGE).pot - $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox + $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox .po.mo: $(MSGFMT) -o $@ $< .po.gmo: - file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ - && rm -f $$file && $(GMSGFMT) -c -o $$file $< + file=`echo $* | sed 's,.*/,,'`.gmo \ + && rm -f $$file && $(GMSGFMT) -o $$file $< .po.cat: sed -f ../intl/po2msg.sed < $< > $*.msg \ @@ -90,20 +103,19 @@ all: all-@USE_NLS@ all-yes: $(CATALOGS) all-no: -$(srcdir)/$(GETTEXT_PACKAGE).pot: $(POTFILES) - $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \ - --add-comments --keyword=_ --keyword=N_ \ - --files-from=$(srcdir)/POTFILES.in \ - && test ! -f $(GETTEXT_PACKAGE).po \ - || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \ - && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot ) +$(GETTEXT_PACKAGE).pot: $(POTFILES) + $(GENPOT) install: install-exec install-data install-exec: install-data: install-data-@USE_NLS@ install-data-no: all install-data-yes: all - @mkdir_p@ $(DESTDIR)$(datadir) + if test -n "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ + fi @catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ @@ -113,7 +125,11 @@ install-data-yes: all esac; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ - @mkdir_p@ $$dir; \ + if test -n "$(MKINSTALLDIRS)"; then \ + $(MKINSTALLDIRS) $$dir; \ + else \ + $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \ + fi; \ if test -r $$cat; then \ $(INSTALL_DATA) $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \ echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \ @@ -137,7 +153,11 @@ install-data-yes: all fi; \ done if test "$(PACKAGE)" = "glib"; then \ - @mkdir_p@ $(DESTDIR)$(gettextsrcdir); \ + 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 \ @@ -161,27 +181,33 @@ uninstall: rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ fi -check: all +check: all $(GETTEXT_PACKAGE).pot dvi info tags TAGS ID: mostlyclean: - rm -f core core.* *.pox $(GETTEXT_PACKAGE).po *.old.po cat-id-tbl.tmp + rm -f core core.* *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp rm -fr *.o + 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 + rm -f *.mo *.msg *.cat *.cat.m $(GMOFILES) 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: update-po $(DISTFILES) +dist distdir: $(DISTFILES) dists="$(DISTFILES)"; \ + extra_dists="$(EXTRA_DISTFILES)"; \ + for file in $$extra_dists; do \ + test -f $$file && dists="$$dists $$file"; \ + done; \ for file in $$dists; do \ ln $(srcdir)/$$file $(distdir) 2> /dev/null \ || cp -p $(srcdir)/$$file $(distdir); \ @@ -190,14 +216,14 @@ dist distdir: update-po $(DISTFILES) update-po: Makefile $(MAKE) $(GETTEXT_PACKAGE).pot tmpdir=`pwd`; \ - cd $(srcdir); \ catalogs='$(CATALOGS)'; \ for cat in $$catalogs; do \ cat=`basename $$cat`; \ lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ echo "$$lang:"; \ - if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \ - if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ + if $$result; then \ + if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ rm -f $$tmpdir/$$lang.new.po; \ else \ if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ @@ -218,17 +244,13 @@ update-po: Makefile # 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; \ + ( posrcprefix='$(top_srcdir)/'; \ rm -f $@-t $@ \ - && (sed -e '/^#/d' \ - -e "s/^\[.*\] +//" \ - -e '/^[ ]*$$/d' \ - -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ - | sed -e '$$s/\\$$//') > $@-t \ + && (sed -e '/^#/d' \ + -e 's/^[[].*] *//' \ + -e '/^[ ]*$$/d' \ + -e "s@^@ $$posrcprefix@" $(srcdir)/$@.in \ + | sed -e '$$!s/$$/ \\/') > $@-t \ && chmod a-w $@-t \ && mv $@-t $@ ) diff --git a/po/POTFILES.in b/po/POTFILES.in index 66450b1..ce8851b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1 +1,3 @@ panel-plugin/netload.c +panel-plugin/netload.desktop.in.in + diff --git a/po/ca.po b/po/ca.po index 1867773..d408d5b 100644 --- a/po/ca.po +++ b/po/ca.po @@ -1,43 +1,41 @@ -# xfce4-netload-plugin for the Xfce desktop environment, Catalan +# xfce4-netload-plugin for the Xfce desktop environment, catalan # translation. -# Copyright (C) 2003-2005 Bernhard Walle. -# This file is distributed under the same license as the -# xfce4-netload-plugin package. -# Toni Vall , 2004. -# Carles Muñoz Gorriz , 2003-2005. +# Copyright (C) 2003, 2004 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the +# xfce4-netload-plugin package. +# Carles Muñoz Gorriz , 2003, 2004. +# Toni Vall ,, 2004. # msgid "" msgstr "" -"Project-Id-Version: xfce4-netload-plugin 0.3.3\n" +"Project-Id-Version: xfce4-netload-plugin\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-01-04 18:43+0900\n" -"PO-Revision-Date: 2006-04-17 21:18+0100\n" +"POT-Creation-Date: 2005-02-04 19:20+0100\n" +"PO-Revision-Date: 2004-06-27 12:52+0100\n" "Last-Translator: Carles Muñoz Gorriz \n" -"Language-Team: Catalan \n" +"Language-Team: catal \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: Plural-Forms: nplurals=2; plural=(n > 1);\n" -"X-Poedit-SourceCharset: utf-8\n" -#: panel-plugin/netload.c:62 +#: panel-plugin/netload.c:61 msgid "Xfce4-Netload-Plugin" msgstr "Xfce4-Netload-Plugin" -#: panel-plugin/netload.c:65 +#: panel-plugin/netload.c:64 msgid "Unknown error." msgstr "Error desconegut." -#: panel-plugin/netload.c:66 +#: panel-plugin/netload.c:65 msgid "Linux proc device '/proc/net/dev' not found." msgstr "No s'ha trobat el dispositiu linux «/proc/net/dev»." -#: panel-plugin/netload.c:67 +#: panel-plugin/netload.c:66 msgid "Interface was not found." msgstr "No s'ha trobat la interfície." -#: panel-plugin/netload.c:224 -#, c-format +#: panel-plugin/netload.c:223 +#, fuzzy, c-format msgid "" "<< %s >> (%s)\n" "Average of last %d measures:\n" @@ -45,17 +43,16 @@ msgid "" "Outgoing: %s kByte/s\n" "Total: %s kByte/s" msgstr "" -"«%s» (%s)\n" "Mitjana dels %d últims mesuraments:\n" "Entrada: %s kBytes/s\n" "Sortida: %s kBytes/s\n" "Total: %s kBytes/s" -#: panel-plugin/netload.c:226 +#: panel-plugin/netload.c:225 msgid "no IP address" -msgstr "Cap adreça IP" +msgstr "" -#: panel-plugin/netload.c:543 +#: panel-plugin/netload.c:537 #, c-format msgid "" "%s: Error in initalizing:\n" @@ -64,50 +61,50 @@ msgstr "" "%s: Error d'inicialització:\n" "%s" -#: panel-plugin/netload.c:886 +#: panel-plugin/netload.c:897 msgid "Select color" msgstr "Seleccioneu el color" -#: panel-plugin/netload.c:942 +#: panel-plugin/netload.c:955 msgid "Bar color (incoming):" msgstr "Color de la barra (entrada):" -#: panel-plugin/netload.c:943 +#: panel-plugin/netload.c:956 msgid "Bar color (outgoing):" msgstr "Color de la barra (sortida):" -#: panel-plugin/netload.c:946 +#: panel-plugin/netload.c:959 msgid "Maximum (incoming):" msgstr "Màxim (entrada):" -#: panel-plugin/netload.c:947 +#: panel-plugin/netload.c:960 msgid "Maximum (outgoing):" msgstr "Màxim (sortida):" -#: panel-plugin/netload.c:971 +#: panel-plugin/netload.c:984 msgid "Text to display:" msgstr "Text a mostrar:" -#: panel-plugin/netload.c:1002 +#: panel-plugin/netload.c:1015 msgid "Network device:" msgstr "Dispositiu de xarxa:" -#: panel-plugin/netload.c:1028 +#: panel-plugin/netload.c:1041 msgid "Update interval:" msgstr "Interval d'actualització:" -#: panel-plugin/netload.c:1039 +#: panel-plugin/netload.c:1052 msgid "s" msgstr "s" -#: panel-plugin/netload.c:1052 +#: panel-plugin/netload.c:1065 msgid "Automatic maximum" msgstr "Màxim automàtic" -#: panel-plugin/netload.c:1084 +#: panel-plugin/netload.c:1097 msgid "kByte/s" msgstr "kBytes/s" -#: panel-plugin/netload.c:1173 +#: panel-plugin/netload.c:1186 msgid "Netload" msgstr "Càrrega de xarxa" diff --git a/po/de.po b/po/de.po index 72f1c54..7097157 100644 --- a/po/de.po +++ b/po/de.po @@ -1,39 +1,36 @@ -# German translations for xfce4-netload-plugin package. -# Copyright (C) 2003-2005 Bernhard Walle. -# This file is distributed under the same license as the -# xfce4-netload-plugin package. +# translation of de.po to +# translation of de.po to Deutsch # Bernhard Walle , 2003, 2005. -# msgid "" msgstr "" -"Project-Id-Version: xfce4-netload-plugin 0.3.3\n" +"Project-Id-Version: de\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-24 21:50+0900\n" -"PO-Revision-Date: 2005-10-24 22:06+0900\n" -"Last-Translator: Bernhard Walle \n" -"Language-Team: German \n" +"POT-Creation-Date: 2005-02-04 19:20+0100\n" +"PO-Revision-Date: 2005-02-04 17:04+0100\n" +"Last-Translator: \n" +"Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.9.1\n" -#: panel-plugin/netload.c:62 +#: panel-plugin/netload.c:61 msgid "Xfce4-Netload-Plugin" msgstr "Xfce4-Netload-Plugin" -#: panel-plugin/netload.c:65 +#: panel-plugin/netload.c:64 msgid "Unknown error." msgstr "Unbekannter Fehler." -#: panel-plugin/netload.c:66 +#: panel-plugin/netload.c:65 msgid "Linux proc device '/proc/net/dev' not found." msgstr "Linux Prozessdatei '/proc/net/dev' nicht gefunden." -#: panel-plugin/netload.c:67 +#: panel-plugin/netload.c:66 msgid "Interface was not found." msgstr "Schnittstelle nicht gefunden." -#: panel-plugin/netload.c:224 +#: panel-plugin/netload.c:223 #, c-format msgid "" "<< %s >> (%s)\n" @@ -48,12 +45,12 @@ msgstr "" "Ausgehend: %s kByte/s\n" "Gesamt: %s kByte/s" -#: panel-plugin/netload.c:226 +#: panel-plugin/netload.c:225 #, fuzzy msgid "no IP address" msgstr "keine IP-Adresse" -#: panel-plugin/netload.c:543 +#: panel-plugin/netload.c:537 #, c-format msgid "" "%s: Error in initalizing:\n" @@ -62,50 +59,50 @@ msgstr "" "%s: Fehler beim Initialisieren:\n" "%s" -#: panel-plugin/netload.c:886 +#: panel-plugin/netload.c:897 msgid "Select color" msgstr "Farbe auswählen" -#: panel-plugin/netload.c:942 +#: panel-plugin/netload.c:955 msgid "Bar color (incoming):" msgstr "Balkenfarbe (eingehend):" -#: panel-plugin/netload.c:943 +#: panel-plugin/netload.c:956 msgid "Bar color (outgoing):" msgstr "Balkenfarbe (ausgehend):" -#: panel-plugin/netload.c:946 +#: panel-plugin/netload.c:959 msgid "Maximum (incoming):" msgstr "Maximum (eingehend):" -#: panel-plugin/netload.c:947 +#: panel-plugin/netload.c:960 msgid "Maximum (outgoing):" msgstr "Maximum (ausgehend):" -#: panel-plugin/netload.c:971 +#: panel-plugin/netload.c:984 msgid "Text to display:" msgstr "Angezeigter Text:" -#: panel-plugin/netload.c:1002 +#: panel-plugin/netload.c:1015 msgid "Network device:" msgstr "Netzwerkschnittstelle:" -#: panel-plugin/netload.c:1028 +#: panel-plugin/netload.c:1041 msgid "Update interval:" msgstr "Aktualisierungsintervall:" -#: panel-plugin/netload.c:1039 +#: panel-plugin/netload.c:1052 msgid "s" msgstr "s" -#: panel-plugin/netload.c:1052 +#: panel-plugin/netload.c:1065 msgid "Automatic maximum" msgstr "Automatisches Maximum" -#: panel-plugin/netload.c:1084 +#: panel-plugin/netload.c:1097 msgid "kByte/s" msgstr "kByte/s" -#: panel-plugin/netload.c:1173 +#: panel-plugin/netload.c:1186 msgid "Netload" msgstr "Netzlast" diff --git a/po/fr.po b/po/fr.po index 3bf587a..58f706e 100644 --- a/po/fr.po +++ b/po/fr.po @@ -1,38 +1,37 @@ -# French translation of xfce4-systemload-plugin package. -# Copyright (C) 2003-2005 Bernhard Walle. -# This file is distributed under the same license as the -# xfce4-netload-plugin package. +# French translation of xfce4-systemload-plugin. +# Copyright (C) 2005 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the xfce4-netload-plugin package. # Stephane Roy , 2005. # msgid "" msgstr "" -"Project-Id-Version: xfce4-netload-plugin 0.3.3\n" +"Project-Id-Version: xfce4-netload-plugin 0.2.4\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-24 21:50+0900\n" -"PO-Revision-Date: 2005-10-24 22:05+0900\n" +"POT-Creation-Date: 2005-02-04 19:20+0100\n" +"PO-Revision-Date: 2005-06-13 14:11+0100\n" "Last-Translator: Stephane Roy \n" -"Language-Team: French \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#: panel-plugin/netload.c:62 +#: panel-plugin/netload.c:61 msgid "Xfce4-Netload-Plugin" msgstr "Xfce4-Netload-Plugin" -#: panel-plugin/netload.c:65 +#: panel-plugin/netload.c:64 msgid "Unknown error." msgstr "Erreur inconnue." -#: panel-plugin/netload.c:66 +#: panel-plugin/netload.c:65 msgid "Linux proc device '/proc/net/dev' not found." msgstr "Fichier '/proc/net/dev' non trouvé." -#: panel-plugin/netload.c:67 +#: panel-plugin/netload.c:66 msgid "Interface was not found." msgstr "Interface non trouvée." -#: panel-plugin/netload.c:224 +#: panel-plugin/netload.c:223 #, c-format msgid "" "<< %s >> (%s)\n" @@ -47,11 +46,11 @@ msgstr "" "Sortant : %s kOctet/s\n" "Total : %s kOctet/s" -#: panel-plugin/netload.c:226 +#: panel-plugin/netload.c:225 msgid "no IP address" msgstr "pas d'adresse IP" -#: panel-plugin/netload.c:543 +#: panel-plugin/netload.c:537 #, c-format msgid "" "%s: Error in initalizing:\n" @@ -60,50 +59,51 @@ msgstr "" "%s : Erreur durant l'initialisation :\n" "%s" -#: panel-plugin/netload.c:886 +#: panel-plugin/netload.c:897 msgid "Select color" msgstr "Sélectionner une couleur" -#: panel-plugin/netload.c:942 +#: panel-plugin/netload.c:955 msgid "Bar color (incoming):" msgstr "Couleur de la barre (entrant) :" -#: panel-plugin/netload.c:943 +#: panel-plugin/netload.c:956 msgid "Bar color (outgoing):" msgstr "Couleur de la barre (sortant) :" -#: panel-plugin/netload.c:946 +#: panel-plugin/netload.c:959 msgid "Maximum (incoming):" msgstr "Maximum (entrant) :" -#: panel-plugin/netload.c:947 +#: panel-plugin/netload.c:960 msgid "Maximum (outgoing):" msgstr "Maximum (sortant) :" -#: panel-plugin/netload.c:971 +#: panel-plugin/netload.c:984 msgid "Text to display:" msgstr "Texte à afficher :" -#: panel-plugin/netload.c:1002 +#: panel-plugin/netload.c:1015 msgid "Network device:" msgstr "Périphérique réseau :" -#: panel-plugin/netload.c:1028 +#: panel-plugin/netload.c:1041 msgid "Update interval:" msgstr "Intervalle de mise à jour :" -#: panel-plugin/netload.c:1039 +#: panel-plugin/netload.c:1052 msgid "s" msgstr "s" -#: panel-plugin/netload.c:1052 +#: panel-plugin/netload.c:1065 msgid "Automatic maximum" msgstr "Maximum automatique" -#: panel-plugin/netload.c:1084 +#: panel-plugin/netload.c:1097 msgid "kByte/s" msgstr "kOctet/s" -#: panel-plugin/netload.c:1173 +#: panel-plugin/netload.c:1186 msgid "Netload" msgstr "Moniteur réseau" + diff --git a/po/ko.po b/po/ko.po index 44468c0..e7beeaa 100644 --- a/po/ko.po +++ b/po/ko.po @@ -1,38 +1,38 @@ -# Korean translations for xfce4-netload-plugin package. -# Copyright (C) 2003-2005 Bernhard Walle. -# This file is distributed under the same license as the -# xfce4-netload-plugin package. -# ByungHyun Choi , 2005. +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: xfce4-netload-plugin 0.3.3\n" +"Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-24 21:50+0900\n" -"PO-Revision-Date: 2005-10-24 22:04+0900\n" -"Last-Translator: ByungHyun Choi \n" -"Language-Team: Korean \n" +"POT-Creation-Date: 2005-02-04 19:20+0100\n" +"PO-Revision-Date: 2005-03-05 02:42+0900\n" +"Last-Translator: ByungHyun Choi\n" +"Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: panel-plugin/netload.c:62 +#: panel-plugin/netload.c:61 msgid "Xfce4-Netload-Plugin" msgstr "Xfce4 네트웍 감시" -#: panel-plugin/netload.c:65 +#: panel-plugin/netload.c:64 msgid "Unknown error." msgstr "알 수 없는 오류." -#: panel-plugin/netload.c:66 +#: panel-plugin/netload.c:65 msgid "Linux proc device '/proc/net/dev' not found." msgstr "Linux proc 장치 '/proc/net/dev'를 못 찾겠습니다." -#: panel-plugin/netload.c:67 +#: panel-plugin/netload.c:66 msgid "Interface was not found." msgstr "네트웍 장치를 못 찾겠습니다." -#: panel-plugin/netload.c:224 +#: panel-plugin/netload.c:223 #, c-format msgid "" "<< %s >> (%s)\n" @@ -47,11 +47,11 @@ msgstr "" "나가는 것: %s kByte/s\n" "전부: %s kByte/s" -#: panel-plugin/netload.c:226 +#: panel-plugin/netload.c:225 msgid "no IP address" msgstr "IP 주소가 없습니다." -#: panel-plugin/netload.c:543 +#: panel-plugin/netload.c:537 #, c-format msgid "" "%s: Error in initalizing:\n" @@ -60,50 +60,50 @@ msgstr "" "%s: 초기화 도중 오류 발생:\n" "%s" -#: panel-plugin/netload.c:886 +#: panel-plugin/netload.c:897 msgid "Select color" msgstr "색상을 선택하십시오." -#: panel-plugin/netload.c:942 +#: panel-plugin/netload.c:955 msgid "Bar color (incoming):" msgstr "막대 색(들어오는 것):" -#: panel-plugin/netload.c:943 +#: panel-plugin/netload.c:956 msgid "Bar color (outgoing):" msgstr "막대 색(나가는 것):" -#: panel-plugin/netload.c:946 +#: panel-plugin/netload.c:959 msgid "Maximum (incoming):" msgstr "최대 (들어오는 것):" -#: panel-plugin/netload.c:947 +#: panel-plugin/netload.c:960 msgid "Maximum (outgoing):" msgstr "최대 (나가는 것)" -#: panel-plugin/netload.c:971 +#: panel-plugin/netload.c:984 msgid "Text to display:" msgstr "표시:" -#: panel-plugin/netload.c:1002 +#: panel-plugin/netload.c:1015 msgid "Network device:" msgstr "네트워크 장치:" -#: panel-plugin/netload.c:1028 +#: panel-plugin/netload.c:1041 msgid "Update interval:" msgstr "검사 간격:" -#: panel-plugin/netload.c:1039 +#: panel-plugin/netload.c:1052 msgid "s" msgstr "초" -#: panel-plugin/netload.c:1052 +#: panel-plugin/netload.c:1065 msgid "Automatic maximum" msgstr "최대치 자동 설정" -#: panel-plugin/netload.c:1084 +#: panel-plugin/netload.c:1097 msgid "kByte/s" msgstr "" -#: panel-plugin/netload.c:1173 +#: panel-plugin/netload.c:1186 msgid "Netload" msgstr "네트워크 감시" diff --git a/po/lt.po b/po/lt.po index 9abef55..1179db3 100644 --- a/po/lt.po +++ b/po/lt.po @@ -1,38 +1,37 @@ -# Lithuanian translation of xfce4-netload-plugin package. -# Copyright (C) 2003-2005 Bernhard Walle. -# This file is distributed under the same license as the -# xfce4-netload-plugin package. -# Mantas Zapolskas , 2003. -# +# translation of xfce4-netload. +# Copyright (C) 2003 GPL +# This file is distributed under the same license as the xfce4-netload. +# Mantas , 2003. +# msgid "" msgstr "" -"Project-Id-Version: xfce4-netload-plugin 0.3.3\n" +"Project-Id-Version: xfce4-netload 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-24 21:50+0900\n" -"PO-Revision-Date: 2005-10-24 22:04+0900\n" -"Last-Translator: Mantas Zapolskas \n" -"Language-Team: Lithuanian \n" +"POT-Creation-Date: 2005-02-04 19:20+0100\n" +"PO-Revision-Date: 2003-08-15 11:08+0300\n" +"Last-Translator: Mantas \n" +"Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: panel-plugin/netload.c:62 +#: panel-plugin/netload.c:61 msgid "Xfce4-Netload-Plugin" msgstr "" -#: panel-plugin/netload.c:65 +#: panel-plugin/netload.c:64 msgid "Unknown error." msgstr "" -#: panel-plugin/netload.c:66 +#: panel-plugin/netload.c:65 msgid "Linux proc device '/proc/net/dev' not found." msgstr "" -#: panel-plugin/netload.c:67 +#: panel-plugin/netload.c:66 msgid "Interface was not found." msgstr "" -#: panel-plugin/netload.c:224 +#: panel-plugin/netload.c:223 #, fuzzy, c-format msgid "" "<< %s >> (%s)\n" @@ -45,63 +44,63 @@ msgstr "" "Siunčiami: %lld bitų/s\n" "Viso: %lld bitų/s" -#: panel-plugin/netload.c:226 +#: panel-plugin/netload.c:225 msgid "no IP address" msgstr "" -#: panel-plugin/netload.c:543 +#: panel-plugin/netload.c:537 #, c-format msgid "" "%s: Error in initalizing:\n" "%s" msgstr "" -#: panel-plugin/netload.c:886 +#: panel-plugin/netload.c:897 msgid "Select color" msgstr "Pasirinkite spalvą" -#: panel-plugin/netload.c:942 +#: panel-plugin/netload.c:955 msgid "Bar color (incoming):" msgstr "Juostos spalva (gaunami duomenys)" -#: panel-plugin/netload.c:943 +#: panel-plugin/netload.c:956 msgid "Bar color (outgoing):" msgstr "Juostos spalva (siunčiami duomenys)" -#: panel-plugin/netload.c:946 +#: panel-plugin/netload.c:959 #, fuzzy msgid "Maximum (incoming):" msgstr "Juostos spalva (gaunami duomenys)" -#: panel-plugin/netload.c:947 +#: panel-plugin/netload.c:960 #, fuzzy msgid "Maximum (outgoing):" msgstr "Juostos spalva (siunčiami duomenys)" -#: panel-plugin/netload.c:971 +#: panel-plugin/netload.c:984 msgid "Text to display:" msgstr "Rodomas tekstas:" -#: panel-plugin/netload.c:1002 +#: panel-plugin/netload.c:1015 msgid "Network device:" msgstr "Tinklo įrenginys" -#: panel-plugin/netload.c:1028 +#: panel-plugin/netload.c:1041 msgid "Update interval:" msgstr "" -#: panel-plugin/netload.c:1039 +#: panel-plugin/netload.c:1052 msgid "s" msgstr "" -#: panel-plugin/netload.c:1052 +#: panel-plugin/netload.c:1065 msgid "Automatic maximum" msgstr "" -#: panel-plugin/netload.c:1084 +#: panel-plugin/netload.c:1097 msgid "kByte/s" msgstr "" -#: panel-plugin/netload.c:1173 +#: panel-plugin/netload.c:1186 msgid "Netload" msgstr "Tinklo apkrovimas" diff --git a/po/pl.po b/po/pl.po index 5e870a0..58a9193 100644 --- a/po/pl.po +++ b/po/pl.po @@ -1,39 +1,35 @@ -# Polish translations for xfce4-netload-plugin package. -# Copyright (C) 2003-2005 Bernhard Walle. -# This file is distributed under the same license as the -# xfce4-netload-plugin package. +# Translation of pl.po to polish +# Copyright (C) 2003 GPL # Michał Chruszcz , 2003. -# Piotr Maliński , 2005-2006. -# msgid "" msgstr "" -"Project-Id-Version: xfce4-netload-plugin 0.3.3\n" +"Project-Id-Version: xfce-netload 2.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-24 21:50+0900\n" -"PO-Revision-Date: 2006-04-08 13:11+0900\n" -"Last-Translator: Piotr Maliński \n" -"Language-Team: Polish \n" +"POT-Creation-Date: 2005-02-04 19:20+0100\n" +"PO-Revision-Date: 2003-10-19 10:34+0200\n" +"Last-Translator: Michał Chruszcz \n" +"Language-Team: pl \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: panel-plugin/netload.c:62 +#: panel-plugin/netload.c:61 msgid "Xfce4-Netload-Plugin" msgstr "Wtyczka obciążenia sieci XFce4" -#: panel-plugin/netload.c:65 +#: panel-plugin/netload.c:64 msgid "Unknown error." msgstr "Nieznany błąd." -#: panel-plugin/netload.c:66 +#: panel-plugin/netload.c:65 msgid "Linux proc device '/proc/net/dev' not found." msgstr "Nie znaleziono urządzenia '/proc/net/dev'." -#: panel-plugin/netload.c:67 +#: panel-plugin/netload.c:66 msgid "Interface was not found." msgstr "Interfejs nie został odnaleziony." -#: panel-plugin/netload.c:224 +#: panel-plugin/netload.c:223 #, fuzzy, c-format msgid "" "<< %s >> (%s)\n" @@ -47,11 +43,11 @@ msgstr "" "Wychodzące: %s kB/s\n" "Łącznie: %s kB/s" -#: panel-plugin/netload.c:226 +#: panel-plugin/netload.c:225 msgid "no IP address" -msgstr "brak adresu IP" +msgstr "" -#: panel-plugin/netload.c:543 +#: panel-plugin/netload.c:537 #, c-format msgid "" "%s: Error in initalizing:\n" @@ -60,50 +56,50 @@ msgstr "" "%s: Błąd inicjalizacji:\n" "%s" -#: panel-plugin/netload.c:886 +#: panel-plugin/netload.c:897 msgid "Select color" msgstr "Wybierz kolor" -#: panel-plugin/netload.c:942 +#: panel-plugin/netload.c:955 msgid "Bar color (incoming):" msgstr "Kolor słupka (przychodzące):" -#: panel-plugin/netload.c:943 +#: panel-plugin/netload.c:956 msgid "Bar color (outgoing):" msgstr "Kolor słupka (wychodzące):" -#: panel-plugin/netload.c:946 +#: panel-plugin/netload.c:959 msgid "Maximum (incoming):" msgstr "Maksimum (przychodzące):" -#: panel-plugin/netload.c:947 +#: panel-plugin/netload.c:960 msgid "Maximum (outgoing):" msgstr "Maksimum (wychodzące):" -#: panel-plugin/netload.c:971 +#: panel-plugin/netload.c:984 msgid "Text to display:" msgstr "Tekst do wyświetlenia:" -#: panel-plugin/netload.c:1002 +#: panel-plugin/netload.c:1015 msgid "Network device:" msgstr "Urządzenie sieciowe:" -#: panel-plugin/netload.c:1028 +#: panel-plugin/netload.c:1041 msgid "Update interval:" msgstr "Interwał odświeżania:" -#: panel-plugin/netload.c:1039 -msgid "s" -msgstr "s" - #: panel-plugin/netload.c:1052 +msgid "s" +msgstr "" + +#: panel-plugin/netload.c:1065 msgid "Automatic maximum" msgstr "Automatyczne maksimum" -#: panel-plugin/netload.c:1084 +#: panel-plugin/netload.c:1097 msgid "kByte/s" msgstr "kB/s" -#: panel-plugin/netload.c:1173 +#: panel-plugin/netload.c:1186 msgid "Netload" msgstr "Obciążenie sieci" diff --git a/po/uk.po b/po/uk.po index 6347406..94d0bae 100644 --- a/po/uk.po +++ b/po/uk.po @@ -1,38 +1,38 @@ -# Uktainian translation of xfce4-netload-plugin package. -# Copyright (C) 2003-2005 Bernhard Walle. -# This file is distributed under the same license as the -# xfce4-netload-plugin package. +# Uktainian translation of xfce4-netload-plugin. +# Copyright (C) Free Software Foundation +# This file is distributed under the same license as the xfce4-netload-plugin package. # Maxim Dziumanenko , 2003. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: xfce4-netload-plugin 0.3.3\n" +"Project-Id-Version: xfce4-netload-plugin\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-10-24 21:50+0900\n" -"PO-Revision-Date: 2005-10-24 22:03+0900\n" +"POT-Creation-Date: 2005-02-04 19:20+0100\n" +"PO-Revision-Date: 2003-10-21 12:13+0200\n" "Last-Translator: Maxim Dziumanenko \n" -"Language-Team: Ukrainian \n" +"Language-Team: Ukrainian \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: panel-plugin/netload.c:62 +#: panel-plugin/netload.c:61 msgid "Xfce4-Netload-Plugin" msgstr "Модуль контролю мережі для Xfce4" -#: panel-plugin/netload.c:65 +#: panel-plugin/netload.c:64 msgid "Unknown error." msgstr "Невідома помилка." -#: panel-plugin/netload.c:66 +#: panel-plugin/netload.c:65 msgid "Linux proc device '/proc/net/dev' not found." msgstr "Не знайдено Linux пристрій '/proc/net/dev'." -#: panel-plugin/netload.c:67 +#: panel-plugin/netload.c:66 msgid "Interface was not found." msgstr "Інтерфейс не існує." -#: panel-plugin/netload.c:224 +#: panel-plugin/netload.c:223 #, fuzzy, c-format msgid "" "<< %s >> (%s)\n" @@ -46,11 +46,11 @@ msgstr "" "Трафік на виході: %s кілобайт/с\n" "Загальний трафік: %s кілобайт/с" -#: panel-plugin/netload.c:226 +#: panel-plugin/netload.c:225 msgid "no IP address" msgstr "" -#: panel-plugin/netload.c:543 +#: panel-plugin/netload.c:537 #, c-format msgid "" "%s: Error in initalizing:\n" @@ -59,50 +59,50 @@ msgstr "" "%s: Помилка ініціалізації:\n" "%s" -#: panel-plugin/netload.c:886 +#: panel-plugin/netload.c:897 msgid "Select color" msgstr "Вибір кольору" -#: panel-plugin/netload.c:942 +#: panel-plugin/netload.c:955 msgid "Bar color (incoming):" msgstr "Колір (на вхід):" -#: panel-plugin/netload.c:943 +#: panel-plugin/netload.c:956 msgid "Bar color (outgoing):" msgstr "Колір (на вихід):" -#: panel-plugin/netload.c:946 +#: panel-plugin/netload.c:959 msgid "Maximum (incoming):" msgstr "Максимум (на вхід):" -#: panel-plugin/netload.c:947 +#: panel-plugin/netload.c:960 msgid "Maximum (outgoing):" msgstr "Максимум (на вихід):" -#: panel-plugin/netload.c:971 +#: panel-plugin/netload.c:984 msgid "Text to display:" msgstr "Відображуваний текст:" -#: panel-plugin/netload.c:1002 +#: panel-plugin/netload.c:1015 msgid "Network device:" msgstr "Мережевий пристрій:" -#: panel-plugin/netload.c:1028 +#: panel-plugin/netload.c:1041 msgid "Update interval:" msgstr "Інтервал оновлення:" -#: panel-plugin/netload.c:1039 +#: panel-plugin/netload.c:1052 msgid "s" msgstr "с" -#: panel-plugin/netload.c:1052 +#: panel-plugin/netload.c:1065 msgid "Automatic maximum" msgstr "Автоматичний максимум" -#: panel-plugin/netload.c:1084 +#: panel-plugin/netload.c:1097 msgid "kByte/s" msgstr "кілобайт/с" -#: panel-plugin/netload.c:1173 +#: panel-plugin/netload.c:1186 msgid "Netload" msgstr "Контроль мережі"