1
0
mirror of https://gitlab.gnome.org/GNOME/evince synced 2024-07-05 00:59:07 +00:00

Initial revision

This commit is contained in:
Marco Pesenti Gritti 2004-12-21 17:41:03 +00:00
parent 4c2778e571
commit 69d92c409d
41 changed files with 16518 additions and 0 deletions

0
AUTHORS Normal file
View File

340
COPYING Normal file
View File

@ -0,0 +1,340 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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.
This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

9077
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

229
INSTALL Normal file
View File

@ -0,0 +1,229 @@
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. Run `./configure --help'
for details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out
automatically, but needs to determine by the type of machine the package
will run on. Usually, assuming the package is built to be run on the
_same_ architectures, `configure' can figure that out, but if it prints
a message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is
overridden in the site shell script).
`configure' Invocation
======================
`configure' recognizes the following options to control how it
operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

5
Makefile.am Normal file
View File

@ -0,0 +1,5 @@
SUBDIRS = cut-n-paste data lib shell viewer po
intltool_extra = intltool-extract.in intltool-merge.in intltool-update.in
EXTRA_DIST = $(intltool_extra)

0
NEWS Normal file
View File

0
README Normal file
View File

20
autogen.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="evince"
(test -f $srcdir/configure.ac) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from the GNOME CVS"
exit 1
}
USE_COMMON_DOC_BUILD=yes REQUIRED_AUTOMAKE_VERSION=1.8 USE_GNOME2_MACROS=1 . gnome-autogen.sh

121
configure.ac Normal file
View File

@ -0,0 +1,121 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(evince, 0.1.0)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
dnl make sure we keep ACLOCAL_FLAGS around for maintainer builds to work
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS")
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
AM_PROG_LIBTOOL
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_PROG_CXX
AC_STDC_HEADERS
AC_PROG_RANLIB
AC_PROG_INTLTOOL
ALL_LINGUAS="de"
AM_GLIB_GNU_GETTEXT
GETTEXT_PACKAGE=AC_PACKAGE_NAME
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package.])
PKG_CHECK_MODULES(LIBEVPRIVATE, gtk+-2.0 >= 2.4.0)
PKG_CHECK_MODULES(RECENT_FILES, gtk+-2.0 >= 2.4.0 libgnomeui-2.0 >= 2.4.0 libbonobo-2.0)
PKG_CHECK_MODULES(SHELL, gtk+-2.0 >= 2.5.0 libgnomeui-2.0 gnome-vfs-2.0 libbonoboui-2.0 libgnomeprint-2.2 libgnomeprintui-2.2 libglade-2.0)
dnl Compile with disable-deprecated switches
AC_ARG_ENABLE(deprecated,
AC_HELP_STRING([--disable-deprecated],
[Don't allow any deprecated GTK+/etc. features.]),
set_enable_deprecated="$enableval",[
if test -f $srcdir/autogen.sh; then
is_cvs_version=true
set_enable_deprecated=no
else
set_enable_deprecated=yes
fi
])
AC_MSG_CHECKING([whether to disable deprecated glib/gtk+/etc. features])
if test "$set_enable_deprecated" != "yes"; then
AC_MSG_RESULT(yes)
EVINCE_DISABLE_DEPRECATED="-DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED -DBONOBO_DISABLE_DEPRECATED"
else
AC_MSG_RESULT(no)
EVINCE_DISABLE_DEPRECATED=""
fi
AC_SUBST(EVINCE_DISABLE_DEPRECATED)
dnl Turn on the additional warnings last, so -Werror doesn't affect other tests.
dnl stolen from nautilus and gnome-common
AC_ARG_ENABLE(more-warnings,
[ --enable-more-warnings Maximum compiler warnings],
set_more_warnings="$enableval",[
if test -f $srcdir/autogen.sh; then
is_cvs_version=true
set_more_warnings=yes
else
set_more_warnings=no
fi
])
AC_MSG_CHECKING(for more warnings, including -Werror)
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
AC_MSG_RESULT([yes, using gcc])
CFLAGS="\
-Wall \
-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
-Wnested-externs -Wpointer-arith \
-Wcast-align -Wsign-compare \
-Werror \
$CFLAGS"
dnl case " $CFLAGS " in
dnl *[\ \ ]-ansi[\ \ ]*) ;;
dnl *) CFLAGS="$CFLAGS -ansi" ;;
dnl esac
dnl case " $CFLAGS " in
dnl *[\ \ ]-pedantic[\ \ ]*) ;;
dnl *) CFLAGS="$CFLAGS -pedantic" ;;
dnl esac
for option in -Wno-strict-aliasing -Wno-sign-compare; do
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $option"
AC_MSG_CHECKING([whether gcc understands $option])
AC_TRY_COMPILE([], [],
has_option=yes,
has_option=no,)
if test $has_option = no; then
CFLAGS="$SAVE_CFLAGS"
fi
AC_MSG_RESULT($has_option)
unset has_option
unset SAVE_CFLAGS
done
unset option
else
AC_MSG_RESULT(no)
fi
dnl ==========================================================================
AC_OUTPUT([
Makefile
cut-n-paste/Makefile
cut-n-paste/recent-files/Makefile
data/Makefile
po/Makefile.in
shell/Makefile
viewer/Makefile
])

1
cut-n-paste/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = recent-files

View File

@ -0,0 +1,32 @@
NULL =
INCLUDES = \
$(RECENT_FILES_CFLAGS) \
$(NULL)
# Uses the deprecated GnomeIconTheme
# $(EVINCE_DISABLE_DEPRECATED)
EGG_FILES = \
egg-recent-model.c \
egg-recent-model.h \
egg-recent-item.c \
egg-recent-item.h \
egg-recent-view.c \
egg-recent-view.h \
egg-recent-view-bonobo.c \
egg-recent-view-bonobo.h \
egg-recent-view-gtk.c \
egg-recent-view-gtk.h \
egg-recent-util.c \
egg-recent-util.h
noinst_LIBRARIES = librecent.a
librecent_a_SOURCES = $(EGG_FILES)
EXTRA_DIST = update-from-egg.sh
EGGDIR=$(srcdir)/../../../libegg/libegg/recent-files
regenerate-built-sources:
EGGFILES="$(EGG_FILES)" EGGDIR="$(EGGDIR)" $(srcdir)/update-from-egg.sh

View File

@ -0,0 +1,440 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* This program 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.
*
* This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* James Willcox <jwillcox@cs.indiana.edu>
*/
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include <libgnomevfs/gnome-vfs.h>
#include <libgnomevfs/gnome-vfs-mime-utils.h>
#include "egg-recent-item.h"
EggRecentItem *
egg_recent_item_new (void)
{
EggRecentItem *item;
item = g_new (EggRecentItem, 1);
item->groups = NULL;
item->private_data = FALSE;
item->uri = NULL;
item->mime_type = NULL;
item->refcount = 1;
return item;
}
static void
egg_recent_item_free (EggRecentItem *item)
{
if (item->uri)
g_free (item->uri);
if (item->mime_type)
g_free (item->mime_type);
if (item->groups) {
g_list_foreach (item->groups, (GFunc)g_free, NULL);
g_list_free (item->groups);
item->groups = NULL;
}
g_free (item);
}
EggRecentItem *
egg_recent_item_ref (EggRecentItem *item)
{
item->refcount++;
return item;
}
EggRecentItem *
egg_recent_item_unref (EggRecentItem *item)
{
item->refcount--;
if (item->refcount == 0) {
egg_recent_item_free (item);
}
return item;
}
EggRecentItem *
egg_recent_item_new_from_uri (const gchar *uri)
{
EggRecentItem *item;
g_return_val_if_fail (uri != NULL, NULL);
item = egg_recent_item_new ();
if (!egg_recent_item_set_uri (item ,uri)) {
egg_recent_item_free (item);
return NULL;
}
item->mime_type = gnome_vfs_get_mime_type (item->uri);
if (!item->mime_type)
item->mime_type = g_strdup (GNOME_VFS_MIME_TYPE_UNKNOWN);
return item;
}
/*
static GList *
egg_recent_item_copy_groups (const GList *list)
{
GList *newlist = NULL;
while (list) {
gchar *group = (gchar *)list->data;
newlist = g_list_prepend (newlist, g_strdup (group));
list = list->next;
}
return newlist;
}
EggRecentItem *
egg_recent_item_copy (const EggRecentItem *item)
{
EggRecentItem *newitem;
newitem = egg_recent_item_new ();
newitem->uri = g_strdup (item->uri);
if (item->mime_type)
newitem->mime_type = g_strdup (item->mime_type);
newitem->timestamp = item->timestamp;
newitem->private_data = item->private_data;
newitem->groups = egg_recent_item_copy_groups (item->groups);
return newitem;
}
*/
/*
EggRecentItem *
egg_recent_item_new_valist (const gchar *uri, va_list args)
{
EggRecentItem *item;
EggRecentArg arg;
gchar *str1;
gchar *str2;
gboolean priv;
item = egg_recent_item_new ();
arg = va_arg (args, EggRecentArg);
while (arg != EGG_RECENT_ARG_NONE) {
switch (arg) {
case EGG_RECENT_ARG_MIME_TYPE:
str1 = va_arg (args, gchar*);
egg_recent_item_set_mime_type (item, str1);
break;
case EGG_RECENT_ARG_GROUP:
str1 = va_arg (args, gchar*);
egg_recent_item_add_group (item, str1);
break;
case EGG_RECENT_ARG_PRIVATE:
priv = va_arg (args, gboolean);
egg_recent_item_set_private (item, priv);
break;
default:
break;
}
arg = va_arg (args, EggRecentArg);
}
return item;
}
*/
gboolean
egg_recent_item_set_uri (EggRecentItem *item, const gchar *uri)
{
gchar *utf8_uri;
/* if G_BROKEN_FILENAMES is not set, this should succede */
if (g_utf8_validate (uri, -1, NULL)) {
item->uri = gnome_vfs_make_uri_from_input (uri);
} else {
utf8_uri = g_filename_to_utf8 (uri, -1, NULL, NULL, NULL);
if (utf8_uri == NULL) {
g_warning ("Couldn't convert URI to UTF-8");
return FALSE;
}
if (g_utf8_validate (utf8_uri, -1, NULL)) {
item->uri = gnome_vfs_make_uri_from_input (utf8_uri);
} else {
g_free (utf8_uri);
return FALSE;
}
g_free (utf8_uri);
}
return TRUE;
}
gchar *
egg_recent_item_get_uri (const EggRecentItem *item)
{
return g_strdup (item->uri);
}
G_CONST_RETURN gchar *
egg_recent_item_peek_uri (const EggRecentItem *item)
{
return item->uri;
}
gchar *
egg_recent_item_get_uri_utf8 (const EggRecentItem *item)
{
/* this could fail, but it's not likely, since we've already done it
* once in set_uri()
*/
return g_filename_to_utf8 (item->uri, -1, NULL, NULL, NULL);
}
gchar *
egg_recent_item_get_uri_for_display (const EggRecentItem *item)
{
return gnome_vfs_format_uri_for_display (item->uri);
}
/* Stolen from gnome_vfs_make_valid_utf8() */
static char *
make_valid_utf8 (const char *name)
{
GString *string;
const char *remainder, *invalid;
int remaining_bytes, valid_bytes;
string = NULL;
remainder = name;
remaining_bytes = strlen (name);
while (remaining_bytes != 0) {
if (g_utf8_validate (remainder, remaining_bytes, &invalid))
break;
valid_bytes = invalid - remainder;
if (string == NULL)
string = g_string_sized_new (remaining_bytes);
g_string_append_len (string, remainder, valid_bytes);
g_string_append_c (string, '?');
remaining_bytes -= valid_bytes + 1;
remainder = invalid + 1;
}
if (string == NULL)
return g_strdup (name);
g_string_append (string, remainder);
/* g_string_append (string, _(" (invalid file name)")); */
g_assert (g_utf8_validate (string->str, -1, NULL));
return g_string_free (string, FALSE);
}
/**
* egg_recent_item_get_short_name:
* @item: an #EggRecentItem
*
* Computes a valid UTF-8 string that can be used as the name of the item in a
* menu or list. For example, calling this function on an item that refers to
* "file:///foo/bar.txt" will yield "bar.txt".
*
* Return value: A newly-allocated string in UTF-8 encoding; free it with
* g_free().
**/
gchar *
egg_recent_item_get_short_name (const EggRecentItem *item)
{
GnomeVFSURI *uri;
char *short_name;
gboolean valid;
g_return_val_if_fail (item != NULL, NULL);
if (item->uri == NULL)
return NULL;
uri = gnome_vfs_uri_new (item->uri);
if (uri == NULL)
return NULL;
short_name = gnome_vfs_uri_extract_short_name (uri);
valid = FALSE;
if (strcmp (gnome_vfs_uri_get_scheme (uri), "file") == 0) {
char *tmp;
tmp = g_filename_to_utf8 (short_name, -1, NULL, NULL, NULL);
if (tmp) {
g_free (short_name);
short_name = tmp;
valid = TRUE;
}
}
if (!valid) {
char *tmp;
tmp = make_valid_utf8 (short_name);
g_assert (tmp != NULL);
g_free (short_name);
short_name = tmp;
}
gnome_vfs_uri_unref (uri);
return short_name;
}
void
egg_recent_item_set_mime_type (EggRecentItem *item, const gchar *mime)
{
item->mime_type = g_strdup (mime);
}
gchar *
egg_recent_item_get_mime_type (const EggRecentItem *item)
{
return g_strdup (item->mime_type);
}
void
egg_recent_item_set_timestamp (EggRecentItem *item, time_t timestamp)
{
if (timestamp == (time_t) -1)
time (&timestamp);
item->timestamp = timestamp;
}
time_t
egg_recent_item_get_timestamp (const EggRecentItem *item)
{
return item->timestamp;
}
G_CONST_RETURN GList *
egg_recent_item_get_groups (const EggRecentItem *item)
{
return item->groups;
}
gboolean
egg_recent_item_in_group (const EggRecentItem *item, const gchar *group_name)
{
GList *tmp;
tmp = item->groups;
while (tmp != NULL) {
gchar *val = (gchar *)tmp->data;
if (strcmp (group_name, val) == 0)
return TRUE;
tmp = tmp->next;
}
return FALSE;
}
void
egg_recent_item_add_group (EggRecentItem *item, const gchar *group_name)
{
g_return_if_fail (group_name != NULL);
if (!egg_recent_item_in_group (item, group_name))
item->groups = g_list_append (item->groups, g_strdup (group_name));
}
void
egg_recent_item_remove_group (EggRecentItem *item, const gchar *group_name)
{
GList *tmp;
g_return_if_fail (group_name != NULL);
tmp = item->groups;
while (tmp != NULL) {
gchar *val = (gchar *)tmp->data;
if (strcmp (group_name, val) == 0) {
item->groups = g_list_remove (item->groups,
val);
g_free (val);
break;
}
tmp = tmp->next;
}
}
void
egg_recent_item_set_private (EggRecentItem *item, gboolean priv)
{
item->private_data = priv;
}
gboolean
egg_recent_item_get_private (const EggRecentItem *item)
{
return item->private_data;
}
GType
egg_recent_item_get_type (void)
{
static GType boxed_type = 0;
if (!boxed_type) {
boxed_type = g_boxed_type_register_static ("EggRecentItem",
(GBoxedCopyFunc)egg_recent_item_ref,
(GBoxedFreeFunc)egg_recent_item_unref);
}
return boxed_type;
}

View File

@ -0,0 +1,78 @@
#ifndef __EGG_RECENT_ITEM_H__
#define __EGG_RECENT_ITEM_H__
#include <time.h>
#include <glib.h>
#include <glib-object.h>
G_BEGIN_DECLS
#define EGG_TYPE_RECENT_ITEM (egg_recent_item_get_type ())
#define EGG_RECENT_ITEM_LIST_UNREF(list) \
g_list_foreach (list, (GFunc)egg_recent_item_unref, NULL); \
g_list_free (list);
typedef struct _EggRecentItem EggRecentItem;
struct _EggRecentItem {
/* do not access any of these directly */
gchar *uri;
gchar *mime_type;
time_t timestamp;
gboolean private_data;
GList *groups;
int refcount;
};
GType egg_recent_item_get_type (void) G_GNUC_CONST;
/* constructors */
EggRecentItem * egg_recent_item_new (void);
EggRecentItem * egg_recent_item_ref (EggRecentItem *item);
EggRecentItem * egg_recent_item_unref (EggRecentItem *item);
/* automatically fetches the mime type, etc */
EggRecentItem * egg_recent_item_new_from_uri (const gchar *uri);
gboolean egg_recent_item_set_uri (EggRecentItem *item, const gchar *uri);
gchar * egg_recent_item_get_uri (const EggRecentItem *item);
gchar * egg_recent_item_get_uri_utf8 (const EggRecentItem *item);
gchar * egg_recent_item_get_uri_for_display (const EggRecentItem *item);
gchar * egg_recent_item_get_short_name (const EggRecentItem *item);
void egg_recent_item_set_mime_type (EggRecentItem *item, const gchar *mime);
gchar * egg_recent_item_get_mime_type (const EggRecentItem *item);
void egg_recent_item_set_timestamp (EggRecentItem *item, time_t timestamp);
time_t egg_recent_item_get_timestamp (const EggRecentItem *item);
G_CONST_RETURN gchar *egg_recent_item_peek_uri (const EggRecentItem *item);
/* groups */
G_CONST_RETURN GList * egg_recent_item_get_groups (const EggRecentItem *item);
gboolean egg_recent_item_in_group (const EggRecentItem *item,
const gchar *group_name);
void egg_recent_item_add_group (EggRecentItem *item,
const gchar *group_name);
void egg_recent_item_remove_group (EggRecentItem *item,
const gchar *group_name);
void egg_recent_item_set_private (EggRecentItem *item,
gboolean priv);
gboolean egg_recent_item_get_private (const EggRecentItem *item);
G_END_DECLS
#endif /* __EGG_RECENT_ITEM_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __EGG_RECENT_MODEL_H__
#define __EGG_RECENT_MODEL_H__
#include "egg-recent-item.h"
G_BEGIN_DECLS
#define EGG_TYPE_RECENT_MODEL (egg_recent_model_get_type ())
#define EGG_RECENT_MODEL(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, EGG_TYPE_RECENT_MODEL, EggRecentModel)
#define EGG_RECENT_MODEL_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, EGG_TYPE_RECENT_MODEL, EggRecentModelClass)
#define EGG_IS_RECENT_MODEL(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, egg_recent_model_get_type ())
typedef struct _EggRecentModel EggRecentModel;
typedef struct _EggRecentModelPrivate EggRecentModelPrivate;
typedef struct _EggRecentModelClass EggRecentModelClass;
struct _EggRecentModel {
GObject parent_instance;
EggRecentModelPrivate *priv;
};
struct _EggRecentModelClass {
GObjectClass parent_class;
void (*changed) (EggRecentModel *model, GList *list);
};
typedef enum {
EGG_RECENT_MODEL_SORT_MRU,
EGG_RECENT_MODEL_SORT_LRU,
EGG_RECENT_MODEL_SORT_NONE
} EggRecentModelSort;
/* Standard group names */
#define EGG_RECENT_GROUP_LAUNCHERS "Launchers"
GType egg_recent_model_get_type (void);
/* constructors */
EggRecentModel * egg_recent_model_new (EggRecentModelSort sort);
/* public methods */
void egg_recent_model_set_filter_mime_types (EggRecentModel *model,
...);
void egg_recent_model_set_filter_groups (EggRecentModel *model, ...);
void egg_recent_model_set_filter_uri_schemes (EggRecentModel *model,
...);
void egg_recent_model_set_sort (EggRecentModel *model,
EggRecentModelSort sort);
gboolean egg_recent_model_add_full (EggRecentModel *model,
EggRecentItem *item);
gboolean egg_recent_model_add (EggRecentModel *model,
const gchar *uri);
gboolean egg_recent_model_delete (EggRecentModel *model,
const gchar *uri);
void egg_recent_model_clear (EggRecentModel *model);
GList * egg_recent_model_get_list (EggRecentModel *model);
void egg_recent_model_changed (EggRecentModel *model);
void egg_recent_model_set_limit (EggRecentModel *model, int limit);
int egg_recent_model_get_limit (EggRecentModel *model);
void egg_recent_model_remove_expired (EggRecentModel *model);
G_END_DECLS
#endif /* __EGG_RECENT_MODEL_H__ */

View File

@ -0,0 +1,158 @@
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
#ifndef USE_STABLE_LIBGNOMEUI
#include <libgnomeui/gnome-icon-theme.h>
#include <libgnomeui/gnome-icon-lookup.h>
#endif
#include <math.h>
#include "egg-recent-util.h"
#define EGG_RECENT_UTIL_HOSTNAME_SIZE 512
/* ripped out of gedit2 */
gchar*
egg_recent_util_escape_underlines (const gchar* text)
{
GString *str;
gint length;
const gchar *p;
const gchar *end;
g_return_val_if_fail (text != NULL, NULL);
length = strlen (text);
str = g_string_new ("");
p = text;
end = text + length;
while (p != end)
{
const gchar *next;
next = g_utf8_next_char (p);
switch (*p)
{
case '_':
g_string_append (str, "__");
break;
default:
g_string_append_len (str, p, next - p);
break;
}
p = next;
}
return g_string_free (str, FALSE);
}
#ifndef USE_STABLE_LIBGNOMEUI
static GdkPixbuf *
scale_icon (GdkPixbuf *pixbuf,
double *scale)
{
guint width, height;
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
width = floor (width * *scale + 0.5);
height = floor (height * *scale + 0.5);
return gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
}
static GdkPixbuf *
load_icon_file (char *filename,
guint base_size,
guint nominal_size)
{
GdkPixbuf *pixbuf, *scaled_pixbuf;
guint width, height, size;
double scale;
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
if (pixbuf == NULL) {
return NULL;
}
if (base_size == 0) {
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
size = MAX (width, height);
if (size > nominal_size) {
base_size = size;
} else {
/* Don't scale up small icons */
base_size = nominal_size;
}
}
if (base_size != nominal_size) {
scale = (double)nominal_size/base_size;
scaled_pixbuf = scale_icon (pixbuf, &scale);
g_object_unref (pixbuf);
pixbuf = scaled_pixbuf;
}
return pixbuf;
}
GdkPixbuf *
egg_recent_util_get_icon (GnomeIconTheme *theme, const gchar *uri,
const gchar *mime_type, int size)
{
gchar *icon;
gchar *filename;
const GnomeIconData *icon_data;
int base_size;
GdkPixbuf *pixbuf;
icon = gnome_icon_lookup (theme, NULL, uri, NULL, NULL,
mime_type, 0, NULL);
g_return_val_if_fail (icon != NULL, NULL);
filename = gnome_icon_theme_lookup_icon (theme, icon,
size,
&icon_data,
&base_size);
g_free (icon);
if (filename == NULL) {
return NULL;
}
pixbuf = load_icon_file (filename, base_size, size);
g_free (filename);
return pixbuf;
}
#endif /* !USE_STABLE_LIBGNOMEUI */
gchar *
egg_recent_util_get_unique_id (void)
{
char hostname[EGG_RECENT_UTIL_HOSTNAME_SIZE];
time_t the_time;
guint32 rand;
int pid;
gethostname (hostname, EGG_RECENT_UTIL_HOSTNAME_SIZE);
time (&the_time);
rand = g_random_int ();
pid = getpid ();
return g_strdup_printf ("%s-%d-%d-%d", hostname, (int)time, (int)rand, (int)pid);
}

View File

@ -0,0 +1,23 @@
#ifndef __EGG_RECENT_UTIL__
#define __EGG_RECENT_UTIL__
#include <gtk/gtk.h>
#ifndef USE_STABLE_LIBGNOMEUI
#include <libgnomeui/gnome-icon-theme.h>
#endif
G_BEGIN_DECLS
gchar * egg_recent_util_escape_underlines (const gchar *uri);
gchar * egg_recent_util_get_unique_id (void);
#ifndef USE_STABLE_LIBGNOMEUI
GdkPixbuf * egg_recent_util_get_icon (GnomeIconTheme *theme,
const gchar *uri,
const gchar *mime_type,
int size);
#endif
G_END_DECLS
#endif /* __EGG_RECENT_UTIL__ */

View File

@ -0,0 +1,714 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* This program 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.
*
* This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* James Willcox <jwillcox@cs.indiana.edu>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <libbonoboui.h>
#include <libgnomevfs/gnome-vfs.h>
#ifndef USE_STABLE_LIBGNOMEUI
#include <libgnomeui/gnome-icon-theme.h>
#endif
#include <gconf/gconf-client.h>
#include "egg-recent-model.h"
#include "egg-recent-view.h"
#include "egg-recent-view-bonobo.h"
#include "egg-recent-util.h"
#include "egg-recent-item.h"
struct _EggRecentViewBonobo {
GObject parent_instance; /* We emit signals */
BonoboUIComponent *uic;
gchar *path; /* The menu path where our stuff
* will go
*/
gulong changed_cb_id;
gchar *uid; /* unique id used for the verb name */
gboolean show_icons;
gboolean show_numbers;
#ifndef USE_STABLE_LIBGNOMEUI
GnomeIconTheme *theme;
#endif
EggRecentViewBonoboTooltipFunc tooltip_func;
gpointer tooltip_func_data;
EggRecentModel *model;
GConfClient *client;
GtkIconSize icon_size;
};
struct _EggRecentViewBonoboMenuData {
EggRecentViewBonobo *view;
EggRecentItem *item;
};
typedef struct _EggRecentViewBonoboMenuData EggRecentViewBonoboMenuData;
enum {
ACTIVATE,
LAST_SIGNAL
};
/* GObject properties */
enum {
PROP_BOGUS,
PROP_UI_COMPONENT,
PROP_MENU_PATH,
PROP_SHOW_ICONS,
PROP_SHOW_NUMBERS
};
static guint egg_recent_view_bonobo_signals[LAST_SIGNAL] = { 0 };
static void
egg_recent_view_bonobo_clear (EggRecentViewBonobo *view)
{
gint i=1;
gboolean done=FALSE;
EggRecentModel *model;
g_return_if_fail (view->uic);
model = egg_recent_view_get_model (EGG_RECENT_VIEW (view));
while (!done)
{
gchar *verb_name = g_strdup_printf ("%s-%d", view->uid, i);
gchar *item_path = g_strconcat (view->path, "/", verb_name, NULL);
if (bonobo_ui_component_path_exists (view->uic, item_path, NULL))
bonobo_ui_component_rm (view->uic, item_path, NULL);
else
done=TRUE;
g_free (item_path);
g_free (verb_name);
i++;
}
}
static void
egg_recent_view_bonobo_menu_cb (BonoboUIComponent *uic, gpointer data, const char *cname)
{
EggRecentViewBonoboMenuData *md = (EggRecentViewBonoboMenuData *) data;
EggRecentItem *item;
g_return_if_fail (md);
g_return_if_fail (md->item);
g_return_if_fail (md->view);
g_return_if_fail (EGG_IS_RECENT_VIEW_BONOBO (md->view));
item = md->item;
egg_recent_item_ref (item);
g_signal_emit (G_OBJECT(md->view),
egg_recent_view_bonobo_signals[ACTIVATE], 0,
item);
egg_recent_item_unref (item);
}
static void
egg_recent_view_bonobo_menu_data_destroy_cb (gpointer data, GClosure *closure)
{
EggRecentViewBonoboMenuData *md = data;
egg_recent_item_unref (md->item);
g_free (md);
}
static void
egg_recent_view_bonobo_set_list (EggRecentViewBonobo *view, GList *list)
{
BonoboUIComponent* ui_component;
unsigned int i;
gchar *label = NULL;
gchar *verb_name = NULL;
gchar *tip = NULL;
gchar *escaped_name = NULL;
gchar *item_path = NULL;
gchar *base_uri;
gchar *utf8_uri;
gchar *cmd;
gchar *xml_escaped_name;
EggRecentViewBonoboMenuData *md;
EggRecentModel *model;
GClosure *closure;
g_return_if_fail (view);
ui_component = view->uic;
g_return_if_fail (BONOBO_IS_UI_COMPONENT (ui_component));
model = egg_recent_view_get_model (EGG_RECENT_VIEW (view));
egg_recent_view_bonobo_clear (view);
bonobo_ui_component_freeze (ui_component, NULL);
for (i = 1; i <= g_list_length (list); ++i)
{
EggRecentItem *item = (EggRecentItem *)g_list_nth_data (list, i-1);
utf8_uri = egg_recent_item_get_uri_for_display (item);
if (utf8_uri == NULL)
continue;
/* this is what gets passed to our private "activate" callback */
md = (EggRecentViewBonoboMenuData *)g_malloc (sizeof (EggRecentViewBonoboMenuData));
md->view = view;
md->item = item;
egg_recent_item_ref (md->item);
base_uri = g_path_get_basename (utf8_uri);
xml_escaped_name = g_markup_escape_text (base_uri,
strlen (base_uri));
escaped_name = egg_recent_util_escape_underlines (xml_escaped_name);
g_free (xml_escaped_name);
tip = NULL;
if (view->tooltip_func != NULL) {
gchar *tmp_tip;
tip = view->tooltip_func (item,
view->tooltip_func_data);
tmp_tip = g_markup_escape_text (tip, strlen (tip));
g_free (tip);
tip = tmp_tip;
}
if (tip == NULL)
tip = g_strdup ("");
verb_name = g_strdup_printf ("%s-%d", view->uid, i);
if (view->show_icons) {
GdkPixbuf *pixbuf;
gchar *mime_type;
gchar *uri;
mime_type = egg_recent_item_get_mime_type (item);
uri = egg_recent_item_get_uri (item);
#ifndef USE_STABLE_LIBGNOMEUI
{
int width, height;
gtk_icon_size_lookup_for_settings
(gtk_settings_get_default (),
view->icon_size,
&width, &height);
pixbuf = egg_recent_util_get_icon
(view->theme,
uri, mime_type,
height);
}
#else
pixbuf = NULL;
#endif
if (pixbuf != NULL) {
gchar *pixbuf_xml;
/* Riiiiight.... */
pixbuf_xml = bonobo_ui_util_pixbuf_to_xml (pixbuf);
cmd = g_strdup_printf ("<cmd name=\"%s\" pixtype=\"pixbuf\" pixname=\"%s\"/>", verb_name, pixbuf_xml);
g_free (pixbuf_xml);
g_object_unref (pixbuf);
} else {
cmd = g_strdup_printf ("<cmd name=\"%s\"/> ",
verb_name);
}
g_free (mime_type);
g_free (uri);
} else
cmd = g_strdup_printf ("<cmd name=\"%s\"/> ",
verb_name);
bonobo_ui_component_set_translate (ui_component, "/commands/", cmd, NULL);
closure = g_cclosure_new (G_CALLBACK (egg_recent_view_bonobo_menu_cb),
md, egg_recent_view_bonobo_menu_data_destroy_cb);
bonobo_ui_component_add_verb_full (ui_component, verb_name,
closure);
if (view->show_numbers) {
if (i < 10)
label = g_strdup_printf ("_%d. %s", i,
escaped_name);
else
label = g_strdup_printf ("%d. %s", i, escaped_name);
} else {
label = g_strdup (escaped_name);
}
item_path = g_strconcat (view->path, "/", verb_name, NULL);
if (bonobo_ui_component_path_exists (ui_component, item_path, NULL))
{
bonobo_ui_component_set_prop (ui_component, item_path,
"label", label, NULL);
bonobo_ui_component_set_prop (ui_component, item_path,
"tip", tip, NULL);
}
else
{
gchar *xml;
xml = g_strdup_printf ("<menuitem name=\"%s\" "
"verb=\"%s\""
" _label=\"%s\" _tip=\"%s\" "
"hidden=\"0\" />",
verb_name, verb_name, label,
tip);
bonobo_ui_component_set_translate (ui_component, view->path, xml, NULL);
g_free (xml);
}
g_free (label);
g_free (verb_name);
g_free (tip);
g_free (escaped_name);
g_free (item_path);
g_free (utf8_uri);
g_free (base_uri);
g_free (cmd);
}
bonobo_ui_component_thaw (ui_component, NULL);
}
static void
model_changed_cb (EggRecentModel *model, GList *list, EggRecentViewBonobo *view)
{
if (list != NULL)
egg_recent_view_bonobo_set_list (view, list);
else
egg_recent_view_bonobo_clear (view);
}
static EggRecentModel *
egg_recent_view_bonobo_get_model (EggRecentView *view_parent)
{
EggRecentViewBonobo *view;
g_return_val_if_fail (view_parent, NULL);
view = EGG_RECENT_VIEW_BONOBO (view_parent);
return view->model;
}
static void
egg_recent_view_bonobo_set_model (EggRecentView *view_parent, EggRecentModel *model)
{
EggRecentViewBonobo *view;
g_return_if_fail (view_parent);
view = EGG_RECENT_VIEW_BONOBO (view_parent);
if (view->model)
g_signal_handler_disconnect (G_OBJECT (view->model),
view->changed_cb_id);
view->model = model;
g_object_ref (view->model);
view->changed_cb_id = g_signal_connect_object (G_OBJECT (model),
"changed",
G_CALLBACK (model_changed_cb),
view, 0);
egg_recent_model_changed (view->model);
}
static void
egg_recent_view_bonobo_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EggRecentViewBonobo *view = EGG_RECENT_VIEW_BONOBO (object);
switch (prop_id)
{
case PROP_UI_COMPONENT:
egg_recent_view_bonobo_set_ui_component (EGG_RECENT_VIEW_BONOBO (view),
BONOBO_UI_COMPONENT (g_value_get_object (value)));
break;
case PROP_MENU_PATH:
view->path = g_strdup (g_value_get_string (value));
break;
case PROP_SHOW_ICONS:
egg_recent_view_bonobo_show_icons (view,
g_value_get_boolean (value));
default:
case PROP_SHOW_NUMBERS:
egg_recent_view_bonobo_show_numbers (view,
g_value_get_boolean (value));
break;
break;
}
}
static void
egg_recent_view_bonobo_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EggRecentViewBonobo *view = EGG_RECENT_VIEW_BONOBO (object);
switch (prop_id)
{
case PROP_UI_COMPONENT:
g_value_set_pointer (value, view->uic);
break;
case PROP_MENU_PATH:
g_value_set_string (value, g_strdup (view->path));
break;
case PROP_SHOW_ICONS:
g_value_set_boolean (value, view->show_icons);
break;
case PROP_SHOW_NUMBERS:
g_value_set_boolean (value, view->show_numbers);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
egg_recent_view_bonobo_finalize (GObject *object)
{
EggRecentViewBonobo *view = EGG_RECENT_VIEW_BONOBO (object);
g_free (view->path);
g_free (view->uid);
g_object_unref (view->model);
g_object_unref (view->uic);
#ifndef USE_STABLE_LIBGNOMEUI
g_object_unref (view->theme);
#endif
g_object_unref (view->client);
}
static void
egg_recent_view_bonobo_class_init (EggRecentViewBonoboClass * klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
object_class->set_property = egg_recent_view_bonobo_set_property;
object_class->get_property = egg_recent_view_bonobo_get_property;
object_class->finalize = egg_recent_view_bonobo_finalize;
egg_recent_view_bonobo_signals[ACTIVATE] = g_signal_new ("activate",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EggRecentViewBonoboClass, activate),
NULL, NULL,
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
EGG_TYPE_RECENT_ITEM);
g_object_class_install_property (object_class,
PROP_UI_COMPONENT,
g_param_spec_object ("ui-component",
"UI Component",
"BonoboUIComponent for menus.",
bonobo_ui_component_get_type(),
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_MENU_PATH,
g_param_spec_string ("ui-path",
"Path",
"The path to put the menu items.",
"/menus/File/EggRecentDocuments",
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SHOW_ICONS,
g_param_spec_boolean ("show-icons",
"Show Icons",
"Whether or not to show icons",
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SHOW_NUMBERS,
g_param_spec_boolean ("show-numbers",
"Show Numbers",
"Whether or not to show numbers",
TRUE,
G_PARAM_READWRITE));
klass->activate = NULL;
}
static void
egg_recent_view_init (EggRecentViewClass *iface)
{
iface->do_get_model = egg_recent_view_bonobo_get_model;
iface->do_set_model = egg_recent_view_bonobo_set_model;
}
static void
show_menus_changed_cb (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
EggRecentViewBonobo *view)
{
GConfValue *value;
value = gconf_entry_get_value (entry);
g_return_if_fail (value->type == GCONF_VALUE_BOOL);
egg_recent_view_bonobo_show_icons (view,
gconf_value_get_bool (value));
}
#ifndef USE_STABLE_LIBGNOMEUI
static void
theme_changed_cb (GnomeIconTheme *theme, EggRecentViewBonobo *view)
{
if (view->model != NULL)
egg_recent_model_changed (view->model);
}
#endif
static void
egg_recent_view_bonobo_init (EggRecentViewBonobo *view)
{
view->uid = egg_recent_util_get_unique_id ();
#ifndef USE_STABLE_LIBGNOMEUI
view->theme = gnome_icon_theme_new ();
gnome_icon_theme_set_allow_svg (view->theme, TRUE);
g_signal_connect_object (view->theme, "changed",
G_CALLBACK (theme_changed_cb), view, 0);
#endif
view->client = gconf_client_get_default ();
view->show_icons =
gconf_client_get_bool (view->client,
"/desktop/gnome/interface/menus_have_icons",
NULL);
gconf_client_add_dir (view->client, "/desktop/gnome/interface",
GCONF_CLIENT_PRELOAD_NONE,
NULL);
gconf_client_notify_add (view->client,
"/desktop/gnome/interface/menus_have_icons",
(GConfClientNotifyFunc)show_menus_changed_cb,
view, NULL, NULL);
view->tooltip_func = NULL;
view->tooltip_func_data = NULL;
view->icon_size = GTK_ICON_SIZE_MENU;
}
void
egg_recent_view_bonobo_set_icon_size (EggRecentViewBonobo *view,
GtkIconSize icon_size)
{
if (view->icon_size != icon_size) {
view->icon_size = icon_size;
egg_recent_model_changed (view->model);
} else {
view->icon_size = icon_size;
}
}
GtkIconSize
egg_recent_view_bonobo_get_icon_size (EggRecentViewBonobo *view)
{
return view->icon_size;
}
void
egg_recent_view_bonobo_show_icons (EggRecentViewBonobo *view, gboolean show)
{
view->show_icons = show;
if (view->model)
egg_recent_model_changed (view->model);
}
void
egg_recent_view_bonobo_show_numbers (EggRecentViewBonobo *view, gboolean show)
{
view->show_numbers = show;
if (view->model)
egg_recent_model_changed (view->model);
}
void
egg_recent_view_bonobo_set_ui_component (EggRecentViewBonobo *view, BonoboUIComponent *uic)
{
g_return_if_fail (view);
g_return_if_fail (uic);
view->uic = uic;
g_object_ref (view->uic);
}
void
egg_recent_view_bonobo_set_ui_path (EggRecentViewBonobo *view, const gchar *path)
{
g_return_if_fail (view);
g_return_if_fail (path);
view->path = g_strdup (path);
}
const BonoboUIComponent *
egg_recent_view_bonobo_get_ui_component (EggRecentViewBonobo *view)
{
g_return_val_if_fail (view, NULL);
return view->uic;
}
gchar *
egg_recent_view_bonobo_get_ui_path (EggRecentViewBonobo *view)
{
g_return_val_if_fail (view, NULL);
return g_strdup (view->path);
}
void
egg_recent_view_bonobo_set_tooltip_func (EggRecentViewBonobo *view,
EggRecentViewBonoboTooltipFunc func,
gpointer user_data)
{
view->tooltip_func = func;
view->tooltip_func_data = user_data;
if (view->model)
egg_recent_model_changed (view->model);
}
/**
* egg_recent_view_bonobo_new:
* @appname: The name of your application.
* @limit: The maximum number of items allowed.
*
* This creates a new EggRecentViewBonobo object.
*
* Returns: a EggRecentViewBonobo object
*/
EggRecentViewBonobo *
egg_recent_view_bonobo_new (BonoboUIComponent *uic, const gchar *path)
{
EggRecentViewBonobo *view;
g_return_val_if_fail (uic, NULL);
g_return_val_if_fail (path, NULL);
view = EGG_RECENT_VIEW_BONOBO (g_object_new (egg_recent_view_bonobo_get_type (),
"ui-path", path,
"ui-component", uic,
"show-icons", FALSE,
"show-numbers", TRUE, NULL));
g_return_val_if_fail (view, NULL);
return view;
}
/**
* egg_recent_view_bonobo_get_type:
* @:
*
* This returns a GType representing a EggRecentViewBonobo object.
*
* Returns: a GType
*/
GType
egg_recent_view_bonobo_get_type (void)
{
static GType egg_recent_view_bonobo_type = 0;
if(!egg_recent_view_bonobo_type) {
static const GTypeInfo egg_recent_view_bonobo_info = {
sizeof (EggRecentViewBonoboClass),
NULL, /* base init */
NULL, /* base finalize */
(GClassInitFunc)egg_recent_view_bonobo_class_init, /* class init */
NULL, /* class finalize */
NULL, /* class data */
sizeof (EggRecentViewBonobo),
0,
(GInstanceInitFunc) egg_recent_view_bonobo_init
};
static const GInterfaceInfo view_info =
{
(GInterfaceInitFunc) egg_recent_view_init,
NULL,
NULL
};
egg_recent_view_bonobo_type = g_type_register_static (G_TYPE_OBJECT,
"EggRecentViewBonobo",
&egg_recent_view_bonobo_info, 0);
g_type_add_interface_static (egg_recent_view_bonobo_type,
EGG_TYPE_RECENT_VIEW,
&view_info);
}
return egg_recent_view_bonobo_type;
}

View File

@ -0,0 +1,58 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __EGG_RECENT_VIEW_BONOBO_H__
#define __EGG_RECENT_VIEW_BONOBO_H__
#include <libbonoboui.h>
G_BEGIN_DECLS
#define EGG_RECENT_VIEW_BONOBO(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, egg_recent_view_bonobo_get_type (), EggRecentViewBonobo)
#define EGG_RECENT_VIEW_BONOBO_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, egg_recent_view_bonobo_get_type (), EggRecentViewBonoboClass)
#define EGG_IS_RECENT_VIEW_BONOBO(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, egg_recent_view_bonobo_get_type ())
typedef char *(*EggRecentViewBonoboTooltipFunc) (EggRecentItem *item,
gpointer user_data);
typedef struct _EggRecentViewBonobo EggRecentViewBonobo;
typedef struct _EggRecentViewBonoboClass EggRecentViewBonoboClass;
struct _EggRecentViewBonoboClass {
GObjectClass parent_class;
void (*activate) (EggRecentViewBonobo *view, EggRecentItem *item);
};
GType egg_recent_view_bonobo_get_type (void);
EggRecentViewBonobo * egg_recent_view_bonobo_new (BonoboUIComponent *uic,
const gchar *path);
void egg_recent_view_bonobo_set_ui_component (EggRecentViewBonobo *view,
BonoboUIComponent *uic);
void egg_recent_view_bonobo_set_ui_path (EggRecentViewBonobo *view,
const gchar *path);
gchar * egg_recent_view_bonobo_get_ui_path (EggRecentViewBonobo *view);
const BonoboUIComponent *egg_recent_view_bonobo_get_ui_component (EggRecentViewBonobo *view);
void egg_recent_view_bonobo_show_icons (EggRecentViewBonobo *view,
gboolean show);
void egg_recent_view_bonobo_show_numbers (EggRecentViewBonobo *view,
gboolean show);
void egg_recent_view_bonobo_set_tooltip_func (EggRecentViewBonobo *view,
EggRecentViewBonoboTooltipFunc func,
gpointer user_data);
void egg_recent_view_bonobo_set_icon_size (EggRecentViewBonobo *view,
GtkIconSize icon_size);
GtkIconSize egg_recent_view_bonobo_get_icon_size (EggRecentViewBonobo *view);
G_END_DECLS
#endif /* __EGG_RECENT_VIEW_BONOBO_H__ */

View File

@ -0,0 +1,817 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* This program 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.
*
* This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* James Willcox <jwillcox@cs.indiana.edu>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include <libgnomevfs/gnome-vfs.h>
#ifndef USE_STABLE_LIBGNOMEUI
#include <libgnomeui/gnome-icon-theme.h>
#endif
#include <gconf/gconf-client.h>
#include "egg-recent-model.h"
#include "egg-recent-view.h"
#include "egg-recent-view-gtk.h"
#include "egg-recent-util.h"
#include "egg-recent-item.h"
struct _EggRecentViewGtk {
GObject parent_instance; /* We emit signals */
GtkWidget *menu;
GtkWidget *start_menu_item;
gboolean leading_sep;
gboolean trailing_sep;
gulong changed_cb_id;
gchar *uid;
gboolean show_icons;
gboolean show_numbers;
#ifndef USE_STABLE_LIBGNOMEUI
GnomeIconTheme *theme;
#endif
GtkTooltips *tooltips;
EggRecentViewGtkTooltipFunc tooltip_func;
gpointer tooltip_func_data;
EggRecentModel *model;
GConfClient *client;
GtkIconSize icon_size;
};
struct _EggRecentViewGtkMenuData {
EggRecentViewGtk *view;
EggRecentItem *item;
};
typedef struct _EggRecentViewGtkMenuData EggRecentViewGtkMenuData;
enum {
ACTIVATE,
LAST_SIGNAL
};
/* GObject properties */
enum {
PROP_BOGUS,
PROP_MENU,
PROP_START_MENU_ITEM,
PROP_SHOW_ICONS,
PROP_SHOW_NUMBERS
};
static guint view_signals[LAST_SIGNAL] = { 0 };
static void
egg_recent_view_gtk_clear (EggRecentViewGtk *view)
{
GList *menu_children;
GList *p;
GObject *menu_item;
gint *menu_data=NULL;
g_return_if_fail (view->menu != NULL);
menu_children = gtk_container_get_children (GTK_CONTAINER (view->menu));
p = menu_children;
while (p != NULL) {
menu_item = (GObject *)p->data;
menu_data = (gint *)g_object_get_data (menu_item,
view->uid);
if (menu_data) {
gtk_container_remove (GTK_CONTAINER (view->menu),
GTK_WIDGET (menu_item));
}
p = p->next;
}
}
static gint
egg_recent_view_gtk_find_menu_offset (EggRecentViewGtk *view)
{
gint i;
GList *menu_children;
GList *p;
GtkWidget *menu_item;
gint menu_loc=-1;
g_return_val_if_fail (view, 0);
menu_children = GTK_MENU_SHELL (view->menu)->children;
i = 0;
p = menu_children;
while (p != NULL) {
menu_item = (GtkWidget *)p->data;
if (menu_item == view->start_menu_item) {
menu_loc = i;
break;
}
p = p->next;
i++;
}
return menu_loc;
}
static void
egg_recent_view_gtk_menu_cb (GtkWidget *menu, gpointer data)
{
EggRecentViewGtkMenuData *md = (EggRecentViewGtkMenuData *) data;
EggRecentItem *item;
g_return_if_fail (md);
g_return_if_fail (md->item);
g_return_if_fail (md->view);
g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (md->view));
item = md->item;
egg_recent_item_ref (item);
g_signal_emit (G_OBJECT(md->view), view_signals[ACTIVATE], 0,
item);
egg_recent_item_unref (item);
}
static void
egg_recent_view_gtk_destroy_cb (gpointer data, GClosure *closure)
{
EggRecentViewGtkMenuData *md = data;
egg_recent_item_unref (md->item);
g_free (md);
}
static GtkWidget *
egg_recent_view_gtk_new_separator (EggRecentViewGtk *view)
{
GtkWidget *retval;
g_return_val_if_fail (view, NULL);
retval = gtk_separator_menu_item_new ();
/**
* this is a tag so we can distinguish our menu items
* from others that may be in the menu.
*/
g_object_set_data (G_OBJECT (retval),
view->uid,
GINT_TO_POINTER (1));
gtk_widget_show (retval);
return retval;
}
static GtkWidget *
egg_recent_view_gtk_new_menu_item (EggRecentViewGtk *view,
EggRecentItem *item,
gint index)
{
GtkWidget *menu_item;
EggRecentViewGtkMenuData *md;
gchar *mime_type;
GtkWidget *image;
GdkPixbuf *pixbuf;
gchar *text;
gchar *short_name;
gchar *escaped;
g_return_val_if_fail (view, NULL);
g_return_val_if_fail (item, NULL);
short_name = egg_recent_item_get_short_name (item);
if (!short_name)
return NULL;
escaped = egg_recent_util_escape_underlines (short_name);
g_free (short_name);
if (view->show_numbers) {
/* avoid having conflicting mnemonics */
if (index >= 10)
text = g_strdup_printf ("%d. %s", index,
escaped);
else
text = g_strdup_printf ("_%d. %s", index,
escaped);
g_free (escaped);
} else {
text = escaped;
}
mime_type = egg_recent_item_get_mime_type (item);
#ifndef USE_STABLE_LIBGNOMEUI
{
int width, height;
gchar *uri;
gtk_icon_size_lookup_for_settings
(gtk_widget_get_settings (view->menu),
view->icon_size,
&width, &height);
uri = egg_recent_item_get_uri (item);
pixbuf = egg_recent_util_get_icon (view->theme, uri,
mime_type,
height);
g_free (uri);
}
#else
pixbuf = NULL;
#endif
image = gtk_image_new_from_pixbuf (pixbuf);
if (pixbuf)
g_object_unref (pixbuf);
if (view->show_icons)
gtk_widget_show (image);
menu_item = gtk_image_menu_item_new_with_mnemonic (text);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item),
image);
md = g_new0 (EggRecentViewGtkMenuData, 1);
md->view = view;
md->item = egg_recent_item_ref (item);
g_signal_connect_data (G_OBJECT (menu_item), "activate",
G_CALLBACK (egg_recent_view_gtk_menu_cb),
md,
(GClosureNotify)egg_recent_view_gtk_destroy_cb,
0);
g_free (mime_type);
g_free (text);
/**
* this is a tag so we can distinguish our menu items
* from others that may be in the menu.
*/
g_object_set_data (G_OBJECT (menu_item),
view->uid,
GINT_TO_POINTER (1));
gtk_widget_show (menu_item);
return menu_item;
}
static void
egg_recent_view_gtk_add_to_menu (EggRecentViewGtk *view,
EggRecentItem *item,
gint display,
gint index)
{
GtkWidget *menu_item;
gint menu_offset;
g_return_if_fail (view);
g_return_if_fail (view->menu);
menu_offset = egg_recent_view_gtk_find_menu_offset (view);
if (item != NULL)
menu_item = egg_recent_view_gtk_new_menu_item (view, item, display);
else
menu_item = egg_recent_view_gtk_new_separator (view);
if (view->tooltip_func != NULL && menu_item != NULL) {
view->tooltip_func (view->tooltips, menu_item,
item, view->tooltip_func_data);
}
if (menu_item)
gtk_menu_shell_insert (GTK_MENU_SHELL (view->menu), menu_item,
menu_offset+index);
}
static void
egg_recent_view_gtk_set_list (EggRecentViewGtk *view, GList *list)
{
EggRecentItem *item;
GList *p;
gint display=1;
gint index=1;
g_return_if_fail (view);
egg_recent_view_gtk_clear (view);
if (view->leading_sep) {
egg_recent_view_gtk_add_to_menu (view, NULL, display, index);
index++;
}
p = list;
while (p != NULL) {
item = (EggRecentItem *)p->data;
egg_recent_view_gtk_add_to_menu (view, item, display, index);
p = p->next;
display++;
index++;
}
if (view->trailing_sep)
egg_recent_view_gtk_add_to_menu (view, NULL, display, index);
}
static void
model_changed_cb (EggRecentModel *model, GList *list, EggRecentViewGtk *view)
{
if (list != NULL)
egg_recent_view_gtk_set_list (view, list);
else
egg_recent_view_gtk_clear (view);
}
static EggRecentModel *
egg_recent_view_gtk_get_model (EggRecentView *view_parent)
{
EggRecentViewGtk *view;
g_return_val_if_fail (view_parent != NULL, NULL);
view = EGG_RECENT_VIEW_GTK (view_parent);
return view->model;
}
static void
egg_recent_view_gtk_set_model (EggRecentView *view_parent,
EggRecentModel *model)
{
EggRecentViewGtk *view;
g_return_if_fail (view_parent != NULL);
view = EGG_RECENT_VIEW_GTK (view_parent);
if (view->model != NULL) {
g_object_unref (view->model);
g_signal_handler_disconnect (G_OBJECT (model),
view->changed_cb_id);
}
view->model = model;
g_object_ref (view->model);
view->changed_cb_id = g_signal_connect_object (G_OBJECT (model),
"changed",
G_CALLBACK (model_changed_cb),
view, 0);
egg_recent_model_changed (view->model);
}
void
egg_recent_view_gtk_set_leading_sep (EggRecentViewGtk *view, gboolean val)
{
view->leading_sep = val;
egg_recent_view_gtk_clear (view);
if (view->model)
egg_recent_model_changed (view->model);
}
void
egg_recent_view_gtk_set_trailing_sep (EggRecentViewGtk *view, gboolean val)
{
view->trailing_sep = val;
egg_recent_view_gtk_clear (view);
if (view->model)
egg_recent_model_changed (view->model);
}
static void
egg_recent_view_gtk_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
switch (prop_id)
{
case PROP_MENU:
egg_recent_view_gtk_set_menu (view,
GTK_WIDGET (g_value_get_object (value)));
break;
case PROP_START_MENU_ITEM:
egg_recent_view_gtk_set_start_menu_item (view,
g_value_get_object (value));
break;
case PROP_SHOW_ICONS:
egg_recent_view_gtk_show_icons (view,
g_value_get_boolean (value));
break;
case PROP_SHOW_NUMBERS:
egg_recent_view_gtk_show_numbers (view,
g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
egg_recent_view_gtk_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
switch (prop_id)
{
case PROP_MENU:
g_value_set_object (value, view->menu);
break;
case PROP_START_MENU_ITEM:
g_value_set_object (value, view->start_menu_item);
break;
case PROP_SHOW_ICONS:
g_value_set_boolean (value, view->show_icons);
break;
case PROP_SHOW_NUMBERS:
g_value_set_boolean (value, view->show_numbers);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
egg_recent_view_gtk_finalize (GObject *object)
{
EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
g_signal_handler_disconnect (G_OBJECT (view->model),
view->changed_cb_id);
g_free (view->uid);
g_object_unref (view->menu);
g_object_unref (view->model);
#ifndef USE_STABLE_LIBGNOMEUI
g_object_unref (view->theme);
#endif
g_object_unref (view->client);
g_object_unref (view->tooltips);
}
static void
egg_recent_view_gtk_class_init (EggRecentViewGtkClass * klass)
{
GObjectClass *object_class;
object_class = G_OBJECT_CLASS (klass);
object_class->set_property = egg_recent_view_gtk_set_property;
object_class->get_property = egg_recent_view_gtk_get_property;
object_class->finalize = egg_recent_view_gtk_finalize;
view_signals[ACTIVATE] = g_signal_new ("activate",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EggRecentViewGtkClass, activate),
NULL, NULL,
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
EGG_TYPE_RECENT_ITEM);
g_object_class_install_property (object_class,
PROP_MENU,
g_param_spec_object ("menu",
"Menu",
"The GtkMenuShell this object will update.",
gtk_menu_get_type(),
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_START_MENU_ITEM,
g_param_spec_object ("start-menu-item",
"Start Menu Item",
"The menu item that precedes where are menu items will go",
gtk_menu_item_get_type (),
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SHOW_ICONS,
g_param_spec_boolean ("show-icons",
"Show Icons",
"Whether or not to show icons",
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class,
PROP_SHOW_NUMBERS,
g_param_spec_boolean ("show-numbers",
"Show Numbers",
"Whether or not to show numbers",
TRUE,
G_PARAM_READWRITE));
klass->activate = NULL;
}
static void
egg_recent_view_init (EggRecentViewClass *iface)
{
iface->do_get_model = egg_recent_view_gtk_get_model;
iface->do_set_model = egg_recent_view_gtk_set_model;
}
static void
show_menus_changed_cb (GConfClient *client,
guint cnxn_id,
GConfEntry *entry,
EggRecentViewGtk *view)
{
GConfValue *value;
value = gconf_entry_get_value (entry);
g_return_if_fail (value->type == GCONF_VALUE_BOOL);
egg_recent_view_gtk_show_icons (view,
gconf_value_get_bool (value));
}
#ifndef USE_STABLE_LIBGNOMEUI
static void
theme_changed_cb (GnomeIconTheme *theme, EggRecentViewGtk *view)
{
if (view->model != NULL)
egg_recent_model_changed (view->model);
}
#endif
static void
egg_recent_view_gtk_init (EggRecentViewGtk * view)
{
view->client = gconf_client_get_default ();
view->show_icons =
gconf_client_get_bool (view->client,
"/desktop/gnome/interface/menus_have_icons",
NULL);
gconf_client_add_dir (view->client, "/desktop/gnome/interface",
GCONF_CLIENT_PRELOAD_NONE,
NULL);
gconf_client_notify_add (view->client,
"/desktop/gnome/interface/menus_have_icons",
(GConfClientNotifyFunc)show_menus_changed_cb,
view, NULL, NULL);
view->leading_sep = FALSE;
view->trailing_sep = FALSE;
view->uid = egg_recent_util_get_unique_id ();
#ifndef USE_STABLE_LIBGNOMEUI
view->theme = gnome_icon_theme_new ();
gnome_icon_theme_set_allow_svg (view->theme, TRUE);
g_signal_connect_object (view->theme, "changed",
G_CALLBACK (theme_changed_cb), view, 0);
#endif
view->tooltips = gtk_tooltips_new ();
g_object_ref (view->tooltips);
gtk_object_sink (GTK_OBJECT (view->tooltips));
view->tooltip_func = NULL;
view->tooltip_func_data = NULL;
view->icon_size = GTK_ICON_SIZE_MENU;
}
void
egg_recent_view_gtk_set_icon_size (EggRecentViewGtk *view,
GtkIconSize icon_size)
{
if (view->icon_size != icon_size) {
view->icon_size = icon_size;
egg_recent_model_changed (view->model);
} else {
view->icon_size = icon_size;
}
}
GtkIconSize
egg_recent_view_gtk_get_icon_size (EggRecentViewGtk *view)
{
return view->icon_size;
}
void
egg_recent_view_gtk_show_icons (EggRecentViewGtk *view, gboolean show)
{
view->show_icons = show;
if (view->model)
egg_recent_model_changed (view->model);
}
void
egg_recent_view_gtk_show_numbers (EggRecentViewGtk *view, gboolean show)
{
view->show_numbers = show;
if (view->model)
egg_recent_model_changed (view->model);
}
void
egg_recent_view_gtk_set_tooltip_func (EggRecentViewGtk *view,
EggRecentViewGtkTooltipFunc func,
gpointer user_data)
{
view->tooltip_func = func;
view->tooltip_func_data = user_data;
if (view->model)
egg_recent_model_changed (view->model);
}
/**
* egg_recent_view_gtk_set_menu:
* @view: A EggRecentViewGtk object.
* @menu: The GtkMenuShell to put the menu items in.
*
* Use this function to change the GtkMenuShell that the recent
* documents appear in.
*
*/
void
egg_recent_view_gtk_set_menu (EggRecentViewGtk *view,
GtkWidget *menu)
{
g_return_if_fail (view);
g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (view));
g_return_if_fail (menu);
if (view->menu != NULL)
g_object_unref (view->menu);
view->menu = menu;
g_object_ref (view->menu);
}
/**
* egg_recent_view_gtk_set_start_menu_item:
* @view: A EggRecentViewGtk object.
* @start_menu_item: The menu item that appears just before where our menu
* items should appear
*
*/
void
egg_recent_view_gtk_set_start_menu_item (EggRecentViewGtk *view,
GtkWidget *menu_item)
{
g_return_if_fail (view);
g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (view));
view->start_menu_item = menu_item;
}
/**
* egg_recent_view_gtk_get_menu:
* @view: A EggRecentViewGtk object.
*
*/
GtkWidget *
egg_recent_view_gtk_get_menu (EggRecentViewGtk *view)
{
return view->menu;
}
/**
* egg_recent_view_gtk_get_start_menu_item
* @view: A EggRecentViewGtk object.
*
*/
GtkWidget *
egg_recent_view_gtk_get_start_menu_item (EggRecentViewGtk *view)
{
return view->start_menu_item;
}
/**
* egg_recent_view_gtk_new:
* @appname: The name of your application.
* @limit: The maximum number of items allowed.
*
* This creates a new EggRecentViewGtk object.
*
* Returns: a EggRecentViewGtk object
*/
EggRecentViewGtk *
egg_recent_view_gtk_new (GtkWidget *menu, GtkWidget *start_menu_item)
{
EggRecentViewGtk *view;
g_return_val_if_fail (menu, NULL);
view = EGG_RECENT_VIEW_GTK (g_object_new (egg_recent_view_gtk_get_type (),
"start-menu-item",
start_menu_item,
"menu", menu,
"show-numbers", TRUE, NULL));
g_return_val_if_fail (view, NULL);
return view;
}
/**
* egg_recent_view_gtk_get_type:
* @:
*
* This returns a GType representing a EggRecentViewGtk object.
*
* Returns: a GType
*/
GType
egg_recent_view_gtk_get_type (void)
{
static GType egg_recent_view_gtk_type = 0;
if(!egg_recent_view_gtk_type) {
static const GTypeInfo egg_recent_view_gtk_info = {
sizeof (EggRecentViewGtkClass),
NULL, /* base init */
NULL, /* base finalize */
(GClassInitFunc)egg_recent_view_gtk_class_init, /* class init */
NULL, /* class finalize */
NULL, /* class data */
sizeof (EggRecentViewGtk),
0,
(GInstanceInitFunc) egg_recent_view_gtk_init
};
static const GInterfaceInfo view_info =
{
(GInterfaceInitFunc) egg_recent_view_init,
NULL,
NULL
};
egg_recent_view_gtk_type = g_type_register_static (G_TYPE_OBJECT,
"EggRecentViewGtk",
&egg_recent_view_gtk_info, 0);
g_type_add_interface_static (egg_recent_view_gtk_type,
EGG_TYPE_RECENT_VIEW,
&view_info);
}
return egg_recent_view_gtk_type;
}

View File

@ -0,0 +1,64 @@
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef __EGG_RECENT_VIEW_GTK_H__
#define __EGG_RECENT_VIEW_GTK_H__
G_BEGIN_DECLS
#include <gtk/gtk.h>
#include "egg-recent-item.h"
#define EGG_RECENT_VIEW_GTK(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, egg_recent_view_gtk_get_type (), EggRecentViewGtk)
#define EGG_RECENT_VIEW_GTK_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, egg_recent_view_gtk_get_type (), EggRecentViewGtkClass)
#define EGG_IS_RECENT_VIEW_GTK(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, egg_recent_view_gtk_get_type ())
typedef void (*EggRecentViewGtkTooltipFunc) (GtkTooltips *tooltips,
GtkWidget *menu,
EggRecentItem *item,
gpointer user_data);
typedef struct _EggRecentViewGtk EggRecentViewGtk;
typedef struct _EggRecentViewGtkClass EggRecentViewGtkClass;
struct _EggRecentViewGtkClass {
GObjectClass parent_class;
void (*activate) (EggRecentViewGtk *view, EggRecentItem *item);
};
GType egg_recent_view_gtk_get_type (void);
EggRecentViewGtk * egg_recent_view_gtk_new (GtkWidget *menu,
GtkWidget *start_menu_item);
void egg_recent_view_gtk_set_menu (EggRecentViewGtk *view,
GtkWidget *menu);
GtkWidget * egg_recent_view_gtk_get_menu (EggRecentViewGtk *view);
void egg_recent_view_gtk_set_start_menu_item (EggRecentViewGtk *view,
GtkWidget *menu_item);
GtkWidget *egg_recent_view_gtk_get_start_menu_item (EggRecentViewGtk *view);
void egg_recent_view_gtk_set_leading_sep (EggRecentViewGtk *view,
gboolean val);
void egg_recent_view_gtk_set_trailing_sep (EggRecentViewGtk *view,
gboolean val);
void egg_recent_view_gtk_show_icons (EggRecentViewGtk *view,
gboolean show);
void egg_recent_view_gtk_show_numbers (EggRecentViewGtk *view,
gboolean show);
void egg_recent_view_gtk_set_tooltip_func (EggRecentViewGtk *view,
EggRecentViewGtkTooltipFunc func,
gpointer user_data);
void egg_recent_view_gtk_set_icon_size (EggRecentViewGtk *view,
GtkIconSize icon_size);
GtkIconSize egg_recent_view_gtk_get_icon_size (EggRecentViewGtk *view);
G_END_DECLS
#endif /* __EGG_RECENT_VIEW_GTK_H__ */

View File

@ -0,0 +1,68 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* This program 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.
*
* This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* James Willcox <jwillcox@cs.indiana.edu>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <gtk/gtk.h>
#include "egg-recent-view.h"
GtkType
egg_recent_view_get_type (void)
{
static GtkType view_type = 0;
if (!view_type)
{
static const GTypeInfo view_info =
{
sizeof (EggRecentViewClass), /* class_size */
NULL, /* base_init */
NULL, /* base_finalize */
};
view_type = g_type_register_static (G_TYPE_INTERFACE,
"EggRecentView",
&view_info, 0);
}
return view_type;
}
EggRecentModel *
egg_recent_view_get_model (EggRecentView *view)
{
g_return_val_if_fail (view, NULL);
return EGG_RECENT_VIEW_GET_CLASS (view)->do_get_model (view);
}
void
egg_recent_view_set_model (EggRecentView *view, EggRecentModel *model)
{
g_return_if_fail (view);
g_return_if_fail (model);
EGG_RECENT_VIEW_GET_CLASS (view)->do_set_model (view, model);
}

View File

@ -0,0 +1,43 @@
#ifndef __EGG_RECENT_VIEW_H__
#define __EGG_RECENT_VIEW_H__
#include <gdk/gdk.h>
#include <gtk/gtkwidget.h>
#include "egg-recent-model.h"
#include "egg-recent-item.h"
G_BEGIN_DECLS
#define EGG_TYPE_RECENT_VIEW (egg_recent_view_get_type ())
#define EGG_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_RECENT_VIEW, EggRecentView))
#define EGG_RECENT_VIEW_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), EGG_TYPE_RECENT_VIEW, EggRecentViewClass))
#define EGG_IS_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EGG_TYPE_RECENT_VIEW))
#define EGG_IS_RECENT_VIEW_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), EGG_TYPE_RECENT_VIEW))
#define EGG_RECENT_VIEW_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EGG_TYPE_RECENT_VIEW, EggRecentViewClass))
typedef struct _EggRecentView EggRecentView;
typedef struct _EggRecentViewClass EggRecentViewClass;
struct _EggRecentViewClass
{
GTypeInterface base_iface;
/* vtable, not signals */
void (* do_set_model) (EggRecentView *view,
EggRecentModel *model);
EggRecentModel * (* do_get_model) (EggRecentView *view);
};
GtkType egg_recent_view_get_type (void) G_GNUC_CONST;
void egg_recent_view_set_list (EggRecentView *view,
GSList *list);
void egg_recent_view_clear (EggRecentView *view);
EggRecentModel *egg_recent_view_get_model (EggRecentView *view);
void egg_recent_view_set_model (EggRecentView *view,
EggRecentModel *model);
G_END_DECLS
#endif /* __EGG_RECENT_VIEW_H__ */

View File

@ -0,0 +1,25 @@
#!/bin/sh
function die() {
echo $*
exit 1
}
if test -z "$EGGDIR"; then
echo "Must set EGGDIR"
exit 1
fi
if test -z "$EGGFILES"; then
echo "Must set EGGFILES"
exit 1
fi
for FILE in $EGGFILES; do
if cmp -s $EGGDIR/$FILE $FILE; then
echo "File $FILE is unchanged"
else
cp $EGGDIR/$FILE $FILE || die "Could not move $EGGDIR/$FILE to $FILE"
echo "Updated $FILE"
fi
done

10
data/Makefile.am Normal file
View File

@ -0,0 +1,10 @@
NULL =
uidir = $(pkgdatadir)
ui_DATA = \
evince-ui.xml \
$(NULL)
EXTRA_DIST = \
$(ui_DATA) \
$(NULL)

22
data/evince-ui.xml Normal file
View File

@ -0,0 +1,22 @@
<ui>
<menubar name="MainMenu">
<menu name="FileMenu" action="File">
<menuitem name="FileOpenMenu" action="FileOpen"/>
<separator name="FileSep1"/>
<menuitem name="FileCloseWindowMenu" action="FileCloseWindow"/>
</menu>
<menu name="ViewMenu" action="View">
<menuitem name="ViewToolbarMenu" action="ViewToolbar"/>
<menuitem name="ViewStatusbarMenu" action="ViewStatusbar"/>
</menu>
<menu name="HelpMenu" action="Help">
<menuitem name="HelpAboutMenu" action="HelpAbout"/>
</menu>
</menubar>
<toolbar name="ToolBar">
<toolitem action="FileOpen"/>
</toolbar>
</ui>

1
po/ChangeLog Normal file
View File

@ -0,0 +1 @@

8
po/POTFILES.in Normal file
View File

@ -0,0 +1,8 @@
[encoding: UTF-8]
gs-renderer/GNOME_GGV.server.in.in
gs-renderer/ggv-control-ui.xml
gs-renderer/ggv-postscript-view-ui.xml
gs-renderer/ggv-postscript-view.c
gs-renderer/ggv-sidebar.c
shell/ev-application.c
shell/ev-window.c

596
po/de.po Normal file
View File

@ -0,0 +1,596 @@
# Copyright (C) Martin Kretzschmar
# This file is distributed under the same license as the Evince package.
# Martin Kretzschmar <martink@gnome.org>, 2004.
#
msgid ""
msgstr ""
"Project-Id-Version: Evince 0.1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2004-11-09 22:24+0100\n"
"PO-Revision-Date: 2004-10-24\n"
"Last-Translator: Martin Kretzschmar <martink@gnome.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: gs-renderer/GNOME_GGV.server.in.in.h:1
#, fuzzy
msgid "GGV PostScript Document Control"
msgstr "PostScript-Dokumente"
#: gs-renderer/GNOME_GGV.server.in.in.h:2
#, fuzzy
msgid "GGV PostScript View"
msgstr "PostScript-Dokumente"
#: gs-renderer/GNOME_GGV.server.in.in.h:3
msgid "GGV PostScript viewer factory"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:2
#, no-c-format
msgid "15_0%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:3
msgid "1:1"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:5
#, no-c-format
msgid "25%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:6
msgid "Change zoom factor to default"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:7
msgid "Decrease zoom factor"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:8
msgid "Fit"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:9
msgid "Fit Width"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:10
msgid "Fit _Width"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:11
msgid "Fit to Page _Size"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:12
msgid "Fit to Page _Width"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:13
msgid "In"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:14
msgid "Increase zoom factor"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:15
msgid "Other"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:16
msgid "Out"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:17
msgid "Zoom _In"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:18
msgid "Zoom _Out"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:19
msgid "Zoom the page to be as wide as the window"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:20
msgid "Zoom the page to fit in the window"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:22
#, no-c-format
msgid "_100%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:24
#, no-c-format
msgid "_200%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:26
#, no-c-format
msgid "_400%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:28
#, no-c-format
msgid "_50%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:30
#, no-c-format
msgid "_75%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:31
msgid "_Auto-fit"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:32
msgid "_Default Zoom"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:33
msgid "_Fit Window"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:34
msgid "_No Auto-fit"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:35
msgid "_Zoom"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:1
msgid "10x14"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:2
msgid "A0"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:3
msgid "A1"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:4
msgid "A2"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:5
msgid "A3"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:6
msgid "A4"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:7
msgid "A5"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:8
msgid "B4"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:9
msgid "B5"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:10
msgid "BBox"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:11
msgid "Executive"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:12
msgid "First"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:13
msgid "Folio"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:14
msgid "Go to first page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:15
msgid "Go to last page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:16
msgid "Go to next page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:17
msgid "Go to previous page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:18
msgid "Last"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:19
msgid "Ledger"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:20
msgid "Legal"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:21
msgid "Letter"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:22
msgid "Next"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:23
msgid "Open the preferences dialog"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:24
msgid "Post_Script Viewer Preferences"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:25
msgid "Prev"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:26
msgid "Print"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:27
msgid "Print marked pages"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:28
msgid "Print the whole document"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:29
msgid "Quarto"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:30
msgid "Save marked pages to a file"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:31
msgid "Statement"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:32
msgid "Tabloid"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:33
msgid "_Document Orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:34
msgid "_Document Size"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:35
msgid "_Edit"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:36 shell/ev-window.c:458
msgid "_File"
msgstr "_Datei"
#: gs-renderer/ggv-postscript-view-ui.xml.h:37
msgid "_First page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:38
msgid "_Go"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:39
msgid "_Landscape"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:40
msgid "_Last page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:41
msgid "_Next page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:42
msgid "_Orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:43
msgid "_Portrait"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:44
msgid "_Previous page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:45
#, fuzzy
msgid "_Print document"
msgstr "Dokument öffnen"
#: gs-renderer/ggv-postscript-view-ui.xml.h:46
msgid "_Print marked pages"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:47
msgid "_Save marked pages"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:48
msgid "_Seascape"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:49
#, fuzzy
msgid "_Size"
msgstr "_Ansicht"
#: gs-renderer/ggv-postscript-view-ui.xml.h:50
msgid "_Upside down"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:51 shell/ev-window.c:459
msgid "_View"
msgstr "_Ansicht"
#: gs-renderer/ggv-postscript-view.c:815
#, c-format
msgid ""
"Unable to execute print command:\n"
"%s"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:876
msgid ""
"No pages have been marked.\n"
"Do you want to save the whole document?"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:905
msgid "Select a file to save pages as"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:913 shell/ev-application.c:140
msgid "PostScript Documents"
msgstr "PostScript-Dokumente"
#: gs-renderer/ggv-postscript-view.c:919 shell/ev-application.c:150
msgid "All Files"
msgstr "Alle Dateien"
#: gs-renderer/ggv-postscript-view.c:958
msgid ""
"A file with this name already exists.\n"
"Do you want to overwrite it?"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:1003
msgid ""
"No pages have been marked.\n"
"Do you want to print the whole document?"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2021
#, fuzzy
msgid "GhostScript output"
msgstr "PostScript-Dokumente"
#: gs-renderer/ggv-postscript-view.c:2053
msgid "Document title"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2057
msgid "GGV control status"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2061
msgid "Number of pages"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2065
msgid "Page names"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2069
msgid "Current page number"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2073
msgid "Document width"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2077
msgid "Document height"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2081
msgid "Document orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2085
msgid "Default orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2089
msgid "Default size"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2093
msgid "Override document orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2097
#, fuzzy
msgid "Override document size"
msgstr "Dokument öffnen"
#: gs-renderer/ggv-postscript-view.c:2101
msgid "Respect EOF comment"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2105
msgid "Antialiasing"
msgstr ""
#: gs-renderer/ggv-sidebar.c:331
msgid "Toggle marked state of all pages"
msgstr ""
#: gs-renderer/ggv-sidebar.c:332
msgid ""
"Toggle marked state of all pages: previously marked pages will be unmarked "
"and unmarked ones will become marked."
msgstr ""
#: gs-renderer/ggv-sidebar.c:344
msgid "Toggle marked state of odd pages"
msgstr ""
#: gs-renderer/ggv-sidebar.c:345
msgid ""
"Toggle marked state of odd pages: previously marked odd pages will be "
"unmarked and unmarked ones will become marked."
msgstr ""
#: gs-renderer/ggv-sidebar.c:358
msgid "Toggle marked state of even pages"
msgstr ""
#: gs-renderer/ggv-sidebar.c:359
msgid ""
"Toggle marked state of even pages: previously marked even pages will be "
"unmarked and unmarked ones will become marked."
msgstr ""
#: gs-renderer/ggv-sidebar.c:372
msgid "Clear marked state of all pages"
msgstr ""
#: gs-renderer/ggv-sidebar.c:373
msgid "Clear marked state of all pages: all pages will be unmarked."
msgstr ""
#: shell/ev-application.c:124
msgid "Open document"
msgstr "Dokument öffnen"
#: shell/ev-application.c:134
msgid "PostScript and PDF Documents"
msgstr "PostScript- und PDF-Dokumente"
#: shell/ev-application.c:145
msgid "PDF Documents"
msgstr "PDF-Dokumente"
#: shell/ev-window.c:260
msgid "Many..."
msgstr "Viele..."
#: shell/ev-window.c:265
msgid "Not so many..."
msgstr "Nicht so viele..."
#: shell/ev-window.c:270
msgid ""
"Evince is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 2 of the License, or\n"
"(at your option) any later version.\n"
msgstr ""
#: shell/ev-window.c:274
msgid ""
"Evince is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n"
msgstr ""
#: shell/ev-window.c:278
msgid ""
"You should have received a copy of the GNU General Public License\n"
"along with Evince; if not, write to the Free Software Foundation, Inc.,\n"
"59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"
msgstr ""
#: shell/ev-window.c:300 shell/ev-window.c:498
msgid "Evince"
msgstr "Evince"
#: shell/ev-window.c:303
msgid "© 1996-2004 The Evince authors"
msgstr "© 1996-2004 Die Evince-Autoren"
#: shell/ev-window.c:306
msgid "PostScript and PDF File Viewer."
msgstr "PostScript- und PDF-Betrachter"
#: shell/ev-window.c:309
msgid "translator-credits"
msgstr "Martin Kretzschmar <martink@gnome.org>"
#: shell/ev-window.c:460
msgid "_Help"
msgstr "_Hilfe"
#. File menu
#: shell/ev-window.c:463
msgid "_Open"
msgstr "Ö_ffnen"
#: shell/ev-window.c:464
msgid "Open a file"
msgstr "Eine Datei öffnen"
#: shell/ev-window.c:466
msgid "_Close"
msgstr "S_chließen"
#: shell/ev-window.c:467
msgid "Close this window"
msgstr "Dieses Fenster schließen"
#. Help menu
#: shell/ev-window.c:471
msgid "_About"
msgstr "_Info"
#: shell/ev-window.c:472
msgid "Display credits for the document viewer creators"
msgstr "Die am Programm Mitwirkenden anzeigen"
#. View Menu
#: shell/ev-window.c:479
msgid "_Toolbar"
msgstr "_Werkzeugleiste"
#: shell/ev-window.c:480
msgid "Show or hide toolbar"
msgstr "Werkzeugleiste anzeigen/verbergen"
#: shell/ev-window.c:482
msgid "_Statusbar"
msgstr "_Statusleiste"
#: shell/ev-window.c:483
msgid "Show or hide statusbar"
msgstr "Statusleiste anzeigen/verbergen"

593
po/evince.pot Normal file
View File

@ -0,0 +1,593 @@
# 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 <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2004-11-09 22:24+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: gs-renderer/GNOME_GGV.server.in.in.h:1
msgid "GGV PostScript Document Control"
msgstr ""
#: gs-renderer/GNOME_GGV.server.in.in.h:2
msgid "GGV PostScript View"
msgstr ""
#: gs-renderer/GNOME_GGV.server.in.in.h:3
msgid "GGV PostScript viewer factory"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:2
#, no-c-format
msgid "15_0%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:3
msgid "1:1"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:5
#, no-c-format
msgid "25%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:6
msgid "Change zoom factor to default"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:7
msgid "Decrease zoom factor"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:8
msgid "Fit"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:9
msgid "Fit Width"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:10
msgid "Fit _Width"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:11
msgid "Fit to Page _Size"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:12
msgid "Fit to Page _Width"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:13
msgid "In"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:14
msgid "Increase zoom factor"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:15
msgid "Other"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:16
msgid "Out"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:17
msgid "Zoom _In"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:18
msgid "Zoom _Out"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:19
msgid "Zoom the page to be as wide as the window"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:20
msgid "Zoom the page to fit in the window"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:22
#, no-c-format
msgid "_100%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:24
#, no-c-format
msgid "_200%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:26
#, no-c-format
msgid "_400%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:28
#, no-c-format
msgid "_50%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:30
#, no-c-format
msgid "_75%"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:31
msgid "_Auto-fit"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:32
msgid "_Default Zoom"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:33
msgid "_Fit Window"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:34
msgid "_No Auto-fit"
msgstr ""
#: gs-renderer/ggv-control-ui.xml.h:35
msgid "_Zoom"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:1
msgid "10x14"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:2
msgid "A0"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:3
msgid "A1"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:4
msgid "A2"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:5
msgid "A3"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:6
msgid "A4"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:7
msgid "A5"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:8
msgid "B4"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:9
msgid "B5"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:10
msgid "BBox"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:11
msgid "Executive"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:12
msgid "First"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:13
msgid "Folio"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:14
msgid "Go to first page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:15
msgid "Go to last page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:16
msgid "Go to next page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:17
msgid "Go to previous page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:18
msgid "Last"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:19
msgid "Ledger"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:20
msgid "Legal"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:21
msgid "Letter"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:22
msgid "Next"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:23
msgid "Open the preferences dialog"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:24
msgid "Post_Script Viewer Preferences"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:25
msgid "Prev"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:26
msgid "Print"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:27
msgid "Print marked pages"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:28
msgid "Print the whole document"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:29
msgid "Quarto"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:30
msgid "Save marked pages to a file"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:31
msgid "Statement"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:32
msgid "Tabloid"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:33
msgid "_Document Orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:34
msgid "_Document Size"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:35
msgid "_Edit"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:36 shell/ev-window.c:458
msgid "_File"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:37
msgid "_First page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:38
msgid "_Go"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:39
msgid "_Landscape"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:40
msgid "_Last page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:41
msgid "_Next page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:42
msgid "_Orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:43
msgid "_Portrait"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:44
msgid "_Previous page"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:45
msgid "_Print document"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:46
msgid "_Print marked pages"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:47
msgid "_Save marked pages"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:48
msgid "_Seascape"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:49
msgid "_Size"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:50
msgid "_Upside down"
msgstr ""
#: gs-renderer/ggv-postscript-view-ui.xml.h:51 shell/ev-window.c:459
msgid "_View"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:815
#, c-format
msgid ""
"Unable to execute print command:\n"
"%s"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:876
msgid ""
"No pages have been marked.\n"
"Do you want to save the whole document?"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:905
msgid "Select a file to save pages as"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:913 shell/ev-application.c:140
msgid "PostScript Documents"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:919 shell/ev-application.c:150
msgid "All Files"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:958
msgid ""
"A file with this name already exists.\n"
"Do you want to overwrite it?"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:1003
msgid ""
"No pages have been marked.\n"
"Do you want to print the whole document?"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2021
msgid "GhostScript output"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2053
msgid "Document title"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2057
msgid "GGV control status"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2061
msgid "Number of pages"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2065
msgid "Page names"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2069
msgid "Current page number"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2073
msgid "Document width"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2077
msgid "Document height"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2081
msgid "Document orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2085
msgid "Default orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2089
msgid "Default size"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2093
msgid "Override document orientation"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2097
msgid "Override document size"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2101
msgid "Respect EOF comment"
msgstr ""
#: gs-renderer/ggv-postscript-view.c:2105
msgid "Antialiasing"
msgstr ""
#: gs-renderer/ggv-sidebar.c:331
msgid "Toggle marked state of all pages"
msgstr ""
#: gs-renderer/ggv-sidebar.c:332
msgid ""
"Toggle marked state of all pages: previously marked pages will be unmarked "
"and unmarked ones will become marked."
msgstr ""
#: gs-renderer/ggv-sidebar.c:344
msgid "Toggle marked state of odd pages"
msgstr ""
#: gs-renderer/ggv-sidebar.c:345
msgid ""
"Toggle marked state of odd pages: previously marked odd pages will be "
"unmarked and unmarked ones will become marked."
msgstr ""
#: gs-renderer/ggv-sidebar.c:358
msgid "Toggle marked state of even pages"
msgstr ""
#: gs-renderer/ggv-sidebar.c:359
msgid ""
"Toggle marked state of even pages: previously marked even pages will be "
"unmarked and unmarked ones will become marked."
msgstr ""
#: gs-renderer/ggv-sidebar.c:372
msgid "Clear marked state of all pages"
msgstr ""
#: gs-renderer/ggv-sidebar.c:373
msgid "Clear marked state of all pages: all pages will be unmarked."
msgstr ""
#: shell/ev-application.c:124
msgid "Open document"
msgstr ""
#: shell/ev-application.c:134
msgid "PostScript and PDF Documents"
msgstr ""
#: shell/ev-application.c:145
msgid "PDF Documents"
msgstr ""
#: shell/ev-window.c:260
msgid "Many..."
msgstr ""
#: shell/ev-window.c:265
msgid "Not so many..."
msgstr ""
#: shell/ev-window.c:270
msgid ""
"Evince is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 2 of the License, or\n"
"(at your option) any later version.\n"
msgstr ""
#: shell/ev-window.c:274
msgid ""
"Evince is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n"
msgstr ""
#: shell/ev-window.c:278
msgid ""
"You should have received a copy of the GNU General Public License\n"
"along with Evince; if not, write to the Free Software Foundation, Inc.,\n"
"59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"
msgstr ""
#: shell/ev-window.c:300 shell/ev-window.c:498
msgid "Evince"
msgstr ""
#: shell/ev-window.c:303
msgid "© 1996-2004 The Evince authors"
msgstr ""
#: shell/ev-window.c:306
msgid "PostScript and PDF File Viewer."
msgstr ""
#: shell/ev-window.c:309
msgid "translator-credits"
msgstr ""
#: shell/ev-window.c:460
msgid "_Help"
msgstr ""
#. File menu
#: shell/ev-window.c:463
msgid "_Open"
msgstr ""
#: shell/ev-window.c:464
msgid "Open a file"
msgstr ""
#: shell/ev-window.c:466
msgid "_Close"
msgstr ""
#: shell/ev-window.c:467
msgid "Close this window"
msgstr ""
#. Help menu
#: shell/ev-window.c:471
msgid "_About"
msgstr ""
#: shell/ev-window.c:472
msgid "Display credits for the document viewer creators"
msgstr ""
#. View Menu
#: shell/ev-window.c:479
msgid "_Toolbar"
msgstr ""
#: shell/ev-window.c:480
msgid "Show or hide toolbar"
msgstr ""
#: shell/ev-window.c:482
msgid "_Statusbar"
msgstr ""
#: shell/ev-window.c:483
msgid "Show or hide statusbar"
msgstr ""

24
shell/Makefile.am Normal file
View File

@ -0,0 +1,24 @@
NULL=
INCLUDES= \
-DDATADIR=\"$(pkgdatadir)\" \
-I$(top_srcdir)/lib \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
$(SHELL_CFLAGS) \
$(EVINCE_DISABLE_DEPRECATED) \
$(NULL)
bin_PROGRAMS=evince
evince_SOURCES= \
ev-application.c \
ev-application.h \
ev-window.c \
ev-window.h \
main.c \
$(NULL)
evince_LDADD= \
$(SHELL_LIBS) \
$(top_builddir)/lib/libevprivate.a \
$(NULL)

196
shell/ev-application.c Normal file
View File

@ -0,0 +1,196 @@
/* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2004 Martin Kretzschmar
*
* Author:
* Martin Kretzschmar <martink@gnome.org>
*
* Evince 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.
*
* Evince 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include "ev-application.h"
#include <glib.h>
#include <glib/gi18n.h>
#include <glib-object.h>
#include <gtk/gtkfilechooserdialog.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkwidget.h>
#include <bonobo/bonobo-main.h>
#include <ev-macros.h>
#include <ev-window.h>
struct _EvApplicationPrivate {
GList *windows;
};
G_DEFINE_TYPE (EvApplication, ev_application, G_TYPE_OBJECT);
#define EV_APPLICATION_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_APPLICATION, EvApplicationPrivate))
EvApplication *
ev_application_get_instance (void)
{
static EvApplication *instance;
if (!instance)
instance = EV_APPLICATION (
g_object_new (EV_TYPE_APPLICATION, NULL));
return instance;
}
static void
window_destroy_cb (GtkObject *object, gpointer user_data)
{
EvApplication *application;
g_return_if_fail (EV_IS_WINDOW (object));
g_return_if_fail (EV_IS_APPLICATION (user_data));
application = EV_APPLICATION (user_data);
application->priv->windows =
g_list_remove (application->priv->windows, object);
if (application->priv->windows == NULL)
bonobo_main_quit ();
}
EvWindow *
ev_application_new_window (EvApplication *application)
{
EvWindow *ev_window;
ev_window = EV_WINDOW (g_object_new (EV_TYPE_WINDOW,
"type", GTK_WINDOW_TOPLEVEL,
"default-height", 600,
"default-width", 600,
NULL));
application->priv->windows =
g_list_prepend (application->priv->windows, ev_window);
g_signal_connect (G_OBJECT (ev_window), "destroy",
G_CALLBACK (window_destroy_cb), application);
return ev_window;
}
static int
is_window_empty (const EvWindow *ev_window, gconstpointer dummy)
{
g_return_val_if_fail (EV_IS_WINDOW (ev_window), 0);
return ev_window_is_empty (ev_window)
? 0
: -1;
}
static EvWindow *
ev_application_get_empty_window (EvApplication *application)
{
GList *node;
node = g_list_find_custom (application->priv->windows, NULL,
(GCompareFunc)is_window_empty);
return node && node->data
? EV_WINDOW (node->data)
: ev_application_new_window (application);
}
void
ev_application_open (EvApplication *application, GError *err)
{
EvWindow *ev_window;
GtkWidget *chooser;
GtkFileFilter *both_filter, *pdf_filter, *ps_filter, *all_filter;
ev_window = ev_application_get_empty_window (application);
chooser = gtk_file_chooser_dialog_new (_("Open document"),
GTK_WINDOW (ev_window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
NULL);
both_filter = gtk_file_filter_new ();
gtk_file_filter_set_name (both_filter,
_("PostScript and PDF Documents"));
gtk_file_filter_add_mime_type (both_filter, "application/postscript");
gtk_file_filter_add_mime_type (both_filter, "application/pdf");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), both_filter);
ps_filter = gtk_file_filter_new ();
gtk_file_filter_set_name (ps_filter, _("PostScript Documents"));
gtk_file_filter_add_mime_type (ps_filter, "application/postscript");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), ps_filter);
pdf_filter = gtk_file_filter_new ();
gtk_file_filter_set_name (pdf_filter, _("PDF Documents"));
gtk_file_filter_add_mime_type (pdf_filter, "application/pdf");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), pdf_filter);
all_filter = gtk_file_filter_new ();
gtk_file_filter_set_name (all_filter, _("All Files"));
gtk_file_filter_add_pattern (all_filter, "*");
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), all_filter);
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (chooser), both_filter);
if (gtk_dialog_run (GTK_DIALOG (chooser)) == GTK_RESPONSE_OK) {
char *uri;
uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (chooser));
ev_window_open (ev_window, uri);
gtk_widget_show (GTK_WIDGET (ev_window));
g_free (uri);
}
gtk_widget_destroy (GTK_WIDGET (chooser));
}
static void
ev_application_finalize (GObject *object)
{
g_return_if_fail (object != NULL && EV_IS_APPLICATION (object));
EV_APPLICATION (object)->priv = NULL;
EV_CALL_VIRTUAL (
G_OBJECT_CLASS (ev_application_parent_class), finalize, (object));
}
static void
ev_application_class_init (EvApplicationClass *ev_application_class)
{
GObjectClass *g_object_class;
g_object_class = G_OBJECT_CLASS (ev_application_class);
g_object_class->finalize = ev_application_finalize;
g_type_class_add_private (g_object_class,
sizeof (EvApplicationPrivate));
}
static void
ev_application_init (EvApplication *ev_application)
{
ev_application->priv = EV_APPLICATION_GET_PRIVATE (ev_application);
}

63
shell/ev-application.h Normal file
View File

@ -0,0 +1,63 @@
/* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2004 Martin Kretzschmar
*
* Author:
* Martin Kretzschmar <martink@gnome.org>
*
* Evince 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.
*
* Evince 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef EV_APPLICATION_H
#define EV_APPLICATION_H
#include <glib/gerror.h>
#include <glib-object.h>
#include "ev-window.h"
G_BEGIN_DECLS
typedef struct _EvApplication EvApplication;
typedef struct _EvApplicationClass EvApplicationClass;
typedef struct _EvApplicationPrivate EvApplicationPrivate;
#define EV_TYPE_APPLICATION (ev_application_get_type ())
#define EV_APPLICATION(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_APPLICATION, EvApplication))
#define EV_APPLICATION_CLASS(klass) (G_TYPE_CHACK_CLASS_CAST((klass), EV_TYPE_APPLICATION, EvApplicationClass))
#define EV_IS_APPLICATION(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_APPLICATION))
#define EV_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_APPLICATION))
#define EV_APPLICATION_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_APPLICATION, EvApplicationClass))
#define EV_APP (ev_application_get_instance ())
struct _EvApplication {
GObject base_instance;
EvApplicationPrivate *priv;
};
struct _EvApplicationClass {
GObjectClass base_class;
};
GType ev_application_get_type (void);
EvApplication *ev_application_get_instance (void);
void ev_application_open (EvApplication *application, GError *err);
EvWindow *ev_application_new_window (EvApplication *application);
G_END_DECLS
#endif /* !EV_APPLICATION_H */

509
shell/ev-window.c Normal file
View File

@ -0,0 +1,509 @@
/* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2004 Martin Kretzschmar
*
* Author:
* Martin Kretzschmar <martink@gnome.org>
*
* Evince 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.
*
* Evince 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "ev-window.h"
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n.h>
#include <gtk/gtkaboutdialog.h>
#include <gtk/gtkaccelgroup.h>
#include <gtk/gtkactiongroup.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkstatusbar.h>
#include <gtk/gtkstock.h>
#include <gtk/gtktoggleaction.h>
#include <gtk/gtkuimanager.h>
#include <gtk/gtkvbox.h>
#include <libbonoboui.h>
#include <libgnomevfs/gnome-vfs-mime-utils.h>
#include <string.h>
#include <ev-macros.h>
#include <ev-stock-icons.h>
#include "ev-application.h"
enum {
PROP_0,
PROP_ATTRIBUTE
};
enum {
SIGNAL,
N_SIGNALS
};
struct _EvWindowPrivate {
GtkWidget *main_box;
GtkWidget *bonobo_widget;
GtkUIManager *ui_manager;
GtkWidget *statusbar;
guint help_message_cid;
};
#if 0
/* enable these to add support for signals */
static guint ev_window_signals [N_SIGNALS] = { 0 };
#endif
G_DEFINE_TYPE (EvWindow, ev_window, GTK_TYPE_WINDOW)
#define EV_WINDOW_GET_PRIVATE(object) \
(G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_WINDOW, EvWindowPrivate))
#if 0
const char *
ev_window_get_attribute (EvWindow *self)
{
g_return_val_if_fail (self != NULL && EV_IS_WINDOW (self), NULL);
return self->priv->attribute;
}
void
ev_window_set_attribute (EvWindow* self, const char *attribute)
{
g_assert (self != NULL && EV_IS_WINDOW (self));
g_assert (attribute != NULL);
if (self->priv->attribute != NULL) {
g_free (self->priv->attribute);
}
self->priv->attribute = g_strdup (attribute);
g_object_notify (G_OBJECT (self), "attribute");
}
static void
ev_window_get_property (GObject *object, guint prop_id, GValue *value,
GParamSpec *param_spec)
{
EvWindow *self;
self = EV_WINDOW (object);
switch (prop_id) {
case PROP_ATTRIBUTE:
g_value_set_string (value, self->priv->attribute);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
prop_id,
param_spec);
break;
}
}
static void
ev_window_set_property (GObject *object, guint prop_id, const GValue *value,
GParamSpec *param_spec)
{
EvWindow *self;
self = EV_WINDOW (object);
switch (prop_id) {
case PROP_ATTRIBUTE:
ev_window_set_attribute (self, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
prop_id,
param_spec);
break;
}
}
#endif
gboolean
ev_window_is_empty (const EvWindow *ev_window)
{
g_return_val_if_fail (EV_IS_WINDOW (ev_window), FALSE);
return ev_window->priv->bonobo_widget == NULL;
}
void
ev_window_open (EvWindow *ev_window, const char *uri)
{
#if 0
char *mime_type;
BonoboObject *bonobo_control;
CORBA_Environment ev;
Bonobo_PersistFile pf;
mime_type = gnome_vfs_get_mime_type (uri);
g_return_if_fail (mime_type != NULL); /* FIXME set error */
if (!strcmp (mime_type, "application/pdf")) {
bonobo_control = create_gpdf_control ();
} else if (!strcmp (mime_type, "application/postscript")) {
bonobo_control = create_ggv_control ();
} else if (!strcmp (mime_type, "application/x-gzip")) {
g_message ("Cannot open gzip-compressed file %s.", uri);
goto finally;
} else if (!strcmp (mime_type, "application/x-bzip")) {
g_message ("Cannot open bzip2-compressed file %s.", uri);
goto finally;
} else {
g_warning ("Don't know how to open %s file %s.",
mime_type, uri); /* FIXME set error */
goto finally;
}
ev_window->priv->bonobo_widget = bonobo_widget_new_control_from_objref (
bonobo_object_corba_objref (bonobo_control), CORBA_OBJECT_NIL);
gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box),
ev_window->priv->bonobo_widget,
TRUE, TRUE, 0);
CORBA_exception_init (&ev);
pf = bonobo_object_query_interface (
bonobo_control, "IDL:Bonobo/PersistFile:1.0", &ev);
Bonobo_PersistFile_load (pf, uri, &ev);
gtk_widget_show (ev_window->priv->bonobo_widget);
bonobo_object_release_unref (pf, &ev);
bonobo_object_unref (bonobo_control);
CORBA_exception_free (&ev);
finally:
g_free (mime_type);
#endif
}
static void
ev_window_cmd_file_open (GtkAction *action, EvWindow *ev_window)
{
ev_application_open (EV_APP, NULL);
}
static void
ev_window_cmd_file_close_window (GtkAction *action, EvWindow *ev_window)
{
g_return_if_fail (EV_IS_WINDOW (ev_window));
gtk_widget_destroy (GTK_WIDGET (ev_window));
}
static void
ev_window_cmd_help_about (GtkAction *action, EvWindow *ev_window)
{
const char *authors[] = {
N_("Many..."),
NULL
};
const char *documenters[] = {
N_("Not so many..."),
NULL
};
const char *license[] = {
N_("Evince is free software; you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation; either version 2 of the License, or\n"
"(at your option) any later version.\n"),
N_("Evince is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n"),
N_("You should have received a copy of the GNU General Public License\n"
"along with Evince; if not, write to the Free Software Foundation, Inc.,\n"
"59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n")
};
char *license_trans;
#ifdef ENABLE_NLS
const char **p;
for (p = authors; *p; ++p)
*p = _(*p);
for (p = documenters; *p; ++p)
*p = _(*p);
#endif
license_trans = g_strconcat (_(license[0]), "\n", _(license[1]), "\n",
_(license[2]), "\n", NULL);
gtk_show_about_dialog (
GTK_WINDOW (ev_window),
"name", _("Evince"),
"version", VERSION,
"copyright",
_("\xc2\xa9 1996-2004 The Evince authors"),
"license", license_trans,
"website", "http://www.gnome.org/projects/evince",
"comments", _("PostScript and PDF File Viewer."),
"authors", authors,
"documenters", documenters,
"translator-credits", _("translator-credits"),
NULL);
g_free (license_trans);
}
static void
ev_window_view_toolbar_cb (GtkAction *action, EvWindow *ev_window)
{
g_object_set (
G_OBJECT (gtk_ui_manager_get_widget (
ev_window->priv->ui_manager,
"/ToolBar")),
"visible",
gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)),
NULL);
}
static void
ev_window_view_statusbar_cb (GtkAction *action, EvWindow *ev_window)
{
g_object_set (
ev_window->priv->statusbar,
"visible",
gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)),
NULL);
}
static void
menu_item_select_cb (GtkMenuItem *proxy, EvWindow *ev_window)
{
GtkAction *action;
char *message;
action = g_object_get_data (G_OBJECT (proxy), "gtk-action");
g_return_if_fail (action != NULL);
g_object_get (G_OBJECT (action), "tooltip", &message, NULL);
if (message) {
gtk_statusbar_push (GTK_STATUSBAR (ev_window->priv->statusbar),
ev_window->priv->help_message_cid, message);
g_free (message);
}
}
static void
menu_item_deselect_cb (GtkMenuItem *proxy, EvWindow *ev_window)
{
gtk_statusbar_pop (GTK_STATUSBAR (ev_window->priv->statusbar),
ev_window->priv->help_message_cid);
}
static void
connect_proxy_cb (GtkUIManager *ui_manager, GtkAction *action,
GtkWidget *proxy, EvWindow *ev_window)
{
if (GTK_IS_MENU_ITEM (proxy)) {
g_signal_connect (proxy, "select",
G_CALLBACK (menu_item_select_cb), ev_window);
g_signal_connect (proxy, "deselect",
G_CALLBACK (menu_item_deselect_cb),
ev_window);
}
}
static void
disconnect_proxy_cb (GtkUIManager *ui_manager, GtkAction *action,
GtkWidget *proxy, EvWindow *ev_window)
{
if (GTK_IS_MENU_ITEM (proxy)) {
g_signal_handlers_disconnect_by_func
(proxy, G_CALLBACK (menu_item_select_cb), ev_window);
g_signal_handlers_disconnect_by_func
(proxy, G_CALLBACK (menu_item_deselect_cb), ev_window);
}
}
static void
ev_window_dispose (GObject *object)
{
EvWindowPrivate *priv;
g_return_if_fail (object != NULL && EV_IS_WINDOW (object));
priv = EV_WINDOW (object)->priv;
EV_UNREF (priv->ui_manager);
EV_CALL_VIRTUAL (
G_OBJECT_CLASS (ev_window_parent_class), dispose, (object));
}
static void
ev_window_finalize (GObject *object)
{
g_return_if_fail (object != NULL && EV_IS_WINDOW (object));
EV_WINDOW (object)->priv = NULL;
EV_CALL_VIRTUAL (
G_OBJECT_CLASS (ev_window_parent_class), finalize, (object));
}
static void
ev_window_class_init (EvWindowClass *ev_window_class)
{
GObjectClass *g_object_class;
g_object_class = G_OBJECT_CLASS (ev_window_class);
g_object_class->dispose = ev_window_dispose;
g_object_class->finalize = ev_window_finalize;
g_type_class_add_private (g_object_class, sizeof (EvWindowPrivate));
#if 0
/* setting up signal system */
ev_window_class->signal = ev_window_signal;
ev_window_signals [SIGNAL] = g_signal_new (
"signal",
EV_TYPE_WINDOW,
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EvWindowClass,
signal),
NULL,
NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE,
0);
/* setting up property system */
g_object_class->set_property = ev_window_set_property;
g_object_class->get_property = ev_window_get_property;
g_object_class_install_property (
g_object_class,
PROP_ATTRIBUTE,
g_param_spec_string ("attribute",
"Attribute",
"A simple unneccessary attribute that "
"does nothing special except being a "
"demonstration for the correct implem"
"entation of a GObject property",
"default_value",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
#endif
}
/* Normal items */
static GtkActionEntry entries[] = {
{ "File", NULL, N_("_File") },
{ "View", NULL, N_("_View") },
{ "Help", NULL, N_("_Help") },
/* File menu */
{ "FileOpen", GTK_STOCK_OPEN, N_("_Open"), "<control>O",
N_("Open a file"),
G_CALLBACK (ev_window_cmd_file_open) },
{ "FileCloseWindow", GTK_STOCK_CLOSE, N_("_Close"), "<control>W",
N_("Close this window"),
G_CALLBACK (ev_window_cmd_file_close_window) },
/* Help menu */
{ "HelpAbout", STOCK_ABOUT, N_("_About"), NULL,
N_("Display credits for the document viewer creators"),
G_CALLBACK (ev_window_cmd_help_about) },
};
/* Toggle items */
static GtkToggleActionEntry toggle_entries[] = {
/* View Menu */
{ "ViewToolbar", NULL, N_("_Toolbar"), "<shift><control>T",
N_("Show or hide toolbar"),
G_CALLBACK (ev_window_view_toolbar_cb), TRUE },
{ "ViewStatusbar", NULL, N_("_Statusbar"), NULL,
N_("Show or hide statusbar"),
G_CALLBACK (ev_window_view_statusbar_cb), TRUE },
};
static void
ev_window_init (EvWindow *ev_window)
{
GtkActionGroup *action_group;
GtkAccelGroup *accel_group;
GError *error = NULL;
GtkWidget *menubar;
GtkWidget *toolbar;
ev_window->priv = EV_WINDOW_GET_PRIVATE (ev_window);
gtk_window_set_title (GTK_WINDOW (ev_window), _("Evince"));
ev_window->priv->main_box = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (ev_window), ev_window->priv->main_box);
gtk_widget_show (ev_window->priv->main_box);
action_group = gtk_action_group_new ("MenuActions");
gtk_action_group_set_translation_domain (action_group, NULL);
gtk_action_group_add_actions (action_group, entries,
G_N_ELEMENTS (entries), ev_window);
gtk_action_group_add_toggle_actions (action_group, toggle_entries,
G_N_ELEMENTS (toggle_entries),
ev_window);
ev_window->priv->ui_manager = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (ev_window->priv->ui_manager,
action_group, 0);
accel_group =
gtk_ui_manager_get_accel_group (ev_window->priv->ui_manager);
gtk_window_add_accel_group (GTK_WINDOW (ev_window), accel_group);
g_signal_connect (ev_window->priv->ui_manager, "connect_proxy",
G_CALLBACK (connect_proxy_cb), ev_window);
g_signal_connect (ev_window->priv->ui_manager, "disconnect_proxy",
G_CALLBACK (disconnect_proxy_cb), ev_window);
if (!gtk_ui_manager_add_ui_from_file (ev_window->priv->ui_manager,
DATADIR"/evince-ui.xml",
&error)) {
g_message ("building menus failed: %s", error->message);
g_error_free (error);
}
menubar = gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
"/MainMenu");
gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box), menubar,
FALSE, FALSE, 0);
toolbar = gtk_ui_manager_get_widget (ev_window->priv->ui_manager,
"/ToolBar");
gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box), toolbar,
FALSE, FALSE, 0);
ev_window->priv->statusbar = gtk_statusbar_new ();
gtk_widget_show (ev_window->priv->statusbar);
gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),
ev_window->priv->statusbar,
FALSE, TRUE, 0);
ev_window->priv->help_message_cid = gtk_statusbar_get_context_id
(GTK_STATUSBAR (ev_window->priv->statusbar), "help_message");
}

62
shell/ev-window.h Normal file
View File

@ -0,0 +1,62 @@
/* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2004 Martin Kretzschmar
*
* Author:
* Martin Kretzschmar <martink@gnome.org>
*
* Evince 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.
*
* Evince 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef EV_WINDOW_H
#define EV_WINDOW_H
#include <glib-object.h>
#include <gtk/gtkwindow.h>
G_BEGIN_DECLS
typedef struct _EvWindow EvWindow;
typedef struct _EvWindowClass EvWindowClass;
typedef struct _EvWindowPrivate EvWindowPrivate;
#define EV_TYPE_WINDOW (ev_window_get_type())
#define EV_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_WINDOW, EvWindow))
#define EV_WINDOW_CLASS(klass) (G_TYPE_CHACK_CLASS_CAST((klass), EV_TYPE_WINDOW, EvWindowClass))
#define EV_IS_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_WINDOW))
#define EV_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_WINDOW))
#define EV_WINDOW_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_WINDOW, EvWindowClass))
struct _EvWindow {
GtkWindow base_instance;
EvWindowPrivate *priv;
};
struct _EvWindowClass {
GtkWindowClass base_class;
/* signals */
void (*signal) (EvWindow *self,
const char *string);
};
GType ev_window_get_type (void);
void ev_window_open (EvWindow *ev_window, const char *uri);
gboolean ev_window_is_empty (const EvWindow *ev_window);
G_END_DECLS
#endif /* !EV_WINDOW_H */

36
shell/global-params.cc Normal file
View File

@ -0,0 +1,36 @@
/* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2004 Martin Kretzschmar
*
* Author:
* Martin Kretzschmar <martink@gnome.org>
*
* Evince 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.
*
* Evince 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include "global-params.h"
#include <GlobalParams.h>
void
global_params_init (const char *cfg_filename)
{
globalParams = new GlobalParams (const_cast<char *> (cfg_filename));
}
void
global_params_destroy (void)
{
delete globalParams;
}

36
shell/global-params.h Normal file
View File

@ -0,0 +1,36 @@
/* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2004 Martin Kretzschmar
*
* Author:
* Martin Kretzschmar <martink@gnome.org>
*
* Evince 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.
*
* Evince 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef GLOBAL_PARAMS_H
#define GLOBAL_PARAMS_H
#include <glib/gmacros.h>
G_BEGIN_DECLS
void global_params_init (const char *cfg_filename);
void global_params_destroy (void);
G_END_DECLS
#endif /* GLOBAL_PARAMS_H */

66
shell/main.c Normal file
View File

@ -0,0 +1,66 @@
/*
* Copyright (C) 2004 Marco Pesenti Gritti
*
* This program 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, or (at your option)
* any later version.
*
* This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtkmain.h>
#include <libgnome/gnome-program.h>
#include <libgnomeui/gnome-ui-init.h>
static struct poptOption popt_options[] =
{
{ NULL, 0, 0, NULL, 0, NULL, NULL }
};
int
main (int argc, char *argv[])
{
poptContext context;
GValue context_as_value = { 0 };
GnomeProgram *program;
#ifdef ENABLE_NLS
/* Initialize the i18n stuff */
bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
#endif
program = gnome_program_init (PACKAGE, VERSION,
LIBGNOMEUI_MODULE, argc, argv,
GNOME_PARAM_POPT_TABLE, popt_options,
GNOME_PARAM_HUMAN_READABLE_NAME, _("Evince"),
GNOME_PARAM_APP_DATADIR, DATADIR,
NULL);
g_set_application_name (_("Epiphany Web Browser"));
g_object_get_property (G_OBJECT (program),
GNOME_PARAM_POPT_CONTEXT,
g_value_init (&context_as_value, G_TYPE_POINTER));
context = g_value_get_pointer (&context_as_value);
gtk_main ();
poptFreeContext (context);
return 0;
}

15
viewer/Makefile.am Normal file
View File

@ -0,0 +1,15 @@
NULL=
INCLUDES= \
-DEVINCE_UIDIR=\"$(pkgdatadir)\" \
-DGNOMELOCALEDIR=\"$(datadir)/locale\" \
$(SHELL_CFLAGS) \
$(EVINCE_DISABLE_DEPRECATED) \
$(NULL)
noinst_LTLIBRARIES = libevviewer.la
libevviewer_la_SOURCES= \
ev-viewer.c \
ev-viewer.h \
$(NULL)

58
viewer/ev-viewer.c Normal file
View File

@ -0,0 +1,58 @@
/*
* Copyright (C) 2004 Marco Pesenti Gritti
*
* This program 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, or (at your option)
* any later version.
*
* This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include "config.h"
#include "ev-viewer.h"
static void ev_viewer_base_init (gpointer g_class);
GType
ev_viewer_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY (type == 0))
{
static const GTypeInfo our_info =
{
sizeof (EvViewerIface),
ev_viewer_base_init,
NULL,
};
type = g_type_register_static (G_TYPE_INTERFACE,
"EvViewer",
&our_info, (GTypeFlags)0);
}
return type;
}
static void
ev_viewer_base_init (gpointer g_class)
{
}
void
ev_viewer_load (EvViewer *embed, const char *uri)
{
EvViewerIface *iface = EV_VIEWER_GET_IFACE (embed);
iface->load (embed, uri);
}

55
viewer/ev-viewer.h Normal file
View File

@ -0,0 +1,55 @@
/*
* Copyright (C) 2000-2003 Marco Pesenti Gritti
*
* This program 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, or (at your option)
* any later version.
*
* This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
#ifndef EV_VIEWER_H
#define EV_VIEWER_H
#include <glib-object.h>
#include <glib.h>
G_BEGIN_DECLS
#define EV_TYPE_VIEWER (ev_viewer_get_type ())
#define EV_VIEWER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_VIEWER, EvViewer))
#define EV_VIEWER_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_VIEWER, EvViewerIface))
#define EV_IS_VIEWER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_VIEWER))
#define EV_IS_VIEWER_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_VIEWER))
#define EV_VIEWER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_VIEWER, EvViewerIface))
typedef struct _EvViewer EvViewer;
typedef struct _EvViewerIface EvViewerIface;
struct _EvViewerIface
{
GTypeInterface base_iface;
/* Methods */
void (* load) (EvViewer *embed,
const char *uri);
};
GType ev_viewer_get_type (void);
void ev_viewer_load (EvViewer *embed,
const char *uri);
G_END_DECLS
#endif