gyrus r337 - in branches/gyrus-python: . data data/glade data/images po src src/glade src/images src/locale src/po



Author: csaavedra
Date: Fri Mar 14 16:54:42 2008
New Revision: 337
URL: http://svn.gnome.org/viewvc/gyrus?rev=337&view=rev

Log:
2008-03-14  Claudio Saavedra  <csaavedra alumnos utalca cl>

	* INSTALL: Updated.
	* Makefile.am: New.
	* autogen.sh: New.
	* configure.ac: New.
	* data/Makefile.am: New.
	* data/glade/Makefile.am: New.
	* data/images/Makefile.am: New.
	* gyrus.in: New template for executable script.
	* po/ChangeLog: New.
	* po/POTFILES.in: New.
	* setup.py: Deleted.
	* src/Makefile.am: New.
	* src/config.py.in: Configuration template file.
	* src/glade/create_mailbox.glade: Moved to data/glade.
	* src/glade/find.glade: Moved to data/glade.
	* src/glade/page.glade: Moved to data/glade.
	* src/glade/preferences.glade: Moved to data/glade.
	* src/glade/report.glade: Moved to data/glade.
	* src/glade/sessions.glade: Moved to data/glade.
	* src/gyrus.py: Updated to fit new layout.
	* src/gyrus_admin_mailbox.py: Updated to fit new layout.
	* src/gyrus_constant.py: Updated to fit new layout.
	* src/gyrus_find.py: Updated to fit new layout.
	* src/gyrus_session.py: Updated to fit new layout.
	* src/po/README: Deleted.
	* src/po/es_ES.po: Moved to po/es.po
	* src/po/gyrus.pot: Deleted.

	Switch from distutils.setup to autotools. Fixes bug #520863.



Added:
   branches/gyrus-python/Makefile.am
   branches/gyrus-python/autogen.sh
   branches/gyrus-python/configure.ac
   branches/gyrus-python/data/
   branches/gyrus-python/data/Makefile.am
   branches/gyrus-python/data/glade/
   branches/gyrus-python/data/glade/Makefile.am
   branches/gyrus-python/data/glade/create_mailbox.glade
      - copied unchanged from r336, /branches/gyrus-python/src/glade/create_mailbox.glade
   branches/gyrus-python/data/glade/find.glade
      - copied unchanged from r336, /branches/gyrus-python/src/glade/find.glade
   branches/gyrus-python/data/glade/page.glade
      - copied unchanged from r336, /branches/gyrus-python/src/glade/page.glade
   branches/gyrus-python/data/glade/preferences.glade
      - copied unchanged from r336, /branches/gyrus-python/src/glade/preferences.glade
   branches/gyrus-python/data/glade/report.glade
      - copied unchanged from r336, /branches/gyrus-python/src/glade/report.glade
   branches/gyrus-python/data/glade/sessions.glade
      - copied unchanged from r336, /branches/gyrus-python/src/glade/sessions.glade
   branches/gyrus-python/data/images/
   branches/gyrus-python/data/images/Makefile.am
   branches/gyrus-python/data/images/gyrus.png
      - copied unchanged from r336, /branches/gyrus-python/src/images/gyrus.png
   branches/gyrus-python/data/images/gyrus.xcf
      - copied unchanged from r336, /branches/gyrus-python/src/images/gyrus.xcf
   branches/gyrus-python/gyrus.in
   branches/gyrus-python/po/
   branches/gyrus-python/po/ChangeLog
   branches/gyrus-python/po/POTFILES.in
   branches/gyrus-python/po/es.po
      - copied unchanged from r336, /branches/gyrus-python/src/po/es_ES.po
   branches/gyrus-python/src/Makefile.am
   branches/gyrus-python/src/__init__.py
   branches/gyrus-python/src/config.py.in
Removed:
   branches/gyrus-python/setup.py
   branches/gyrus-python/src/glade/
   branches/gyrus-python/src/images/
   branches/gyrus-python/src/locale/
   branches/gyrus-python/src/po/
Modified:
   branches/gyrus-python/ChangeLog
   branches/gyrus-python/INSTALL
   branches/gyrus-python/src/gyrus.py
   branches/gyrus-python/src/gyrus_admin_mailbox.py
   branches/gyrus-python/src/gyrus_constant.py
   branches/gyrus-python/src/gyrus_find.py
   branches/gyrus-python/src/gyrus_session.py

Modified: branches/gyrus-python/INSTALL
==============================================================================
--- branches/gyrus-python/INSTALL	(original)
+++ branches/gyrus-python/INSTALL	Fri Mar 14 16:54:42 2008
@@ -1,10 +1,237 @@
-To install run (root user):
+Installation Instructions
+*************************
 
-  python setup.py install
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007 Free Software Foundation, Inc.
 
-or
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
 
-  python setup.py install --prefix=path
+Basic Installation
+==================
 
-to install in other directory.
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+   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 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.
+
+     Running `configure' might take a while.  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.
+
+  6. Often, you can also type `make uninstall' to remove the installed
+     files again.
+
+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=c99 CFLAGS=-g 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 can use 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 `..'.
+
+   With a non-GNU `make', it is safer 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' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' 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 option `--target=TYPE' 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
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`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.
 

Added: branches/gyrus-python/Makefile.am
==============================================================================
--- (empty file)
+++ branches/gyrus-python/Makefile.am	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,43 @@
+
+SUBDIRS = data po src
+
+.PHONY: force-run
+
+force-run:
+
+EXTRA_DIST = autogen.sh
+DISTCLEANFILES =
+
+
+#
+# Executable to be installed
+#
+bin_SCRIPTS = gyrus
+
+gyrus: gyrus.in Makefile
+	sed \
+		-e s!\ pyexecdir\@! pyexecdir@! \
+		-e s!\ PYTHON\@! PYTHON@! \
+		< $< \
+		> $@
+	chmod a+x $@
+
+EXTRA_DIST += gyrus.in
+
+CLEANFILES= gyrus
+
+
+#
+# i18n build foo
+#
+
+EXTRA_DIST += \
+	intltool-extract.in \
+	intltool-merge.in \
+	intltool-update.in
+
+DISTCLEANFILES += \
+	intltool-extract \
+	intltool-merge \
+	intltool-update
+

Added: branches/gyrus-python/autogen.sh
==============================================================================
--- (empty file)
+++ branches/gyrus-python/autogen.sh	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+PKG_NAME="gyrus"
+REQUIRED_AUTOCONF_VERSION=2.53
+REQUIRED_AUTOMAKE_VERSION=1.7.2
+
+(test -f $srcdir/configure.ac \
+  && test -f $srcdir/src/gyrus.py) || {
+    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 the gnome-common module and make"
+    echo "sure the gnome-autogen.sh script is in your \$PATH."
+    exit 1
+}
+
+USE_GNOME2_MACROS=1 . gnome-autogen.sh

Added: branches/gyrus-python/configure.ac
==============================================================================
--- (empty file)
+++ branches/gyrus-python/configure.ac	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,34 @@
+# Initialization
+AC_INIT([gyrus], [0.4.0])
+AC_CONFIG_SRCDIR(src/gyrus.py)
+AM_INIT_AUTOMAKE([1.7])
+AM_MAINTAINER_MODE
+
+# Python (Note: Python module availability checks should be done run-time!)
+AM_PATH_PYTHON
+
+# GConf
+PKG_CHECK_MODULES(gconf, gconf-2.0)
+AM_GCONF_SOURCE_2
+AC_PATH_PROG([GCONFTOOL], [gconftool-2], [no])
+if test "$GCONFTOOL" = "no"; then
+	AC_MSG_ERROR([gconftool-2 not found])
+fi
+
+# i18n
+GETTEXT_PACKAGE=gyrus
+AC_SUBST([GETTEXT_PACKAGE])
+AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [Gettext package])
+AM_GLIB_GNU_GETTEXT
+IT_PROG_INTLTOOL([0.35.0])
+
+# Create output
+AC_CONFIG_FILES([
+	Makefile
+	data/Makefile
+	data/glade/Makefile
+	data/images/Makefile
+	po/Makefile.in
+	src/Makefile
+])
+AC_OUTPUT

Added: branches/gyrus-python/data/Makefile.am
==============================================================================
--- (empty file)
+++ branches/gyrus-python/data/Makefile.am	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,2 @@
+SUBDIRS = glade images
+

Added: branches/gyrus-python/data/glade/Makefile.am
==============================================================================
--- (empty file)
+++ branches/gyrus-python/data/glade/Makefile.am	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,14 @@
+#
+# Glade files
+#
+
+gladedir   = $(pkgdatadir)/glade
+glade_DATA = \
+	create_mailbox.glade \
+	find.glade \
+	page.glade \
+	preferences.glade \
+	report.glade \
+	sessions.glade
+
+EXTRA_DIST = $(glade_DATA)

Added: branches/gyrus-python/data/images/Makefile.am
==============================================================================
--- (empty file)
+++ branches/gyrus-python/data/images/Makefile.am	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,7 @@
+#
+# Artwork
+#
+
+artdir = $(pkgdatadir)/images
+art_DATA = gyrus.png
+EXTRA_DIST = $(art_DATA)

Added: branches/gyrus-python/gyrus.in
==============================================================================
--- (empty file)
+++ branches/gyrus-python/gyrus.in	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,35 @@
+#! PYTHON@
+
+# gyrus -- IMAP administrator
+#
+# Template inspired from gnome-specimen.
+#
+# Copyright (C) 2006--2007  Wouter Bolsterlee <wbolster gnome org>
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+
+import sys
+
+if not "@pyexecdir@" in sys.path:
+    # Append the directory to the end of sys.path, because inserting at the
+    # front (which seems to be common) breaks running modified versions from
+    # the source directory.
+    sys.path.append ("@pyexecdir@")
+
+from gyrus import gyrus
+
+gyrus = gyrus.Gyrus()
+gyrus.main()

Added: branches/gyrus-python/po/POTFILES.in
==============================================================================
--- (empty file)
+++ branches/gyrus-python/po/POTFILES.in	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,11 @@
+data/glade/create_mailbox.glade
+data/glade/find.glade
+data/glade/page.glade
+data/glade/preferences.glade
+data/glade/report.glade
+data/glade/sessions.glade
+src/gyrus.py
+src/gyrus_acl.py
+src/gyrus_find.py
+src/gyrus_print.py
+src/gyrus_session.py

Added: branches/gyrus-python/src/Makefile.am
==============================================================================
--- (empty file)
+++ branches/gyrus-python/src/Makefile.am	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,36 @@
+
+appdir = $(pyexecdir)/gyrus
+
+all-local: config.py
+
+app_PYTHON = \
+	__init__.py \
+	config.py \
+	gyrus_acl.py \
+	gyrus_admin_mailbox.py \
+	gyrus_constant.py \
+	gyrus_find.py \
+	gyrus_print.py \
+	gyrus.py \
+	gyrus_session.py
+
+nodist_app_PYTHON = config.py
+
+EXTRA_DIST = \
+	config.py.in
+
+CLEANFILES = \
+	config.py
+
+config.py: config.py.in Makefile
+	sed \
+		-e s!\ LOCALEDIR\@!$(datadir)/locale! \
+		-e s!\ DATADIR\@!$(datadir)! \
+		-e s!\ PKGDATADIR\@!$(pkgdatadir)! \
+		-e s!\ GLADEDIR\@!$(pkgdatadir)/glade! \
+		-e s!\ ARTDIR\@!$(pkgdatadir)/images! \
+		-e s!\ PACKAGE_NAME\@!$(PACKAGE_NAME)! \
+		-e s!\ PACKAGE_VERSION\@!$(PACKAGE_VERSION)! \
+		< $< \
+		> $@
+

Added: branches/gyrus-python/src/__init__.py
==============================================================================

Added: branches/gyrus-python/src/config.py.in
==============================================================================
--- (empty file)
+++ branches/gyrus-python/src/config.py.in	Fri Mar 14 16:54:42 2008
@@ -0,0 +1,46 @@
+# gyrus -- IMAP administrator for GNOME
+#
+# This template was inspired from gnome-specimen.
+#
+# Copyright (C) 2006--2007  Wouter Bolsterlee <wbolster gnome org>
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+
+from os.path import join, exists, dirname, realpath
+
+PACKAGE     = "@PACKAGE_NAME@"
+VERSION     = "@PACKAGE_VERSION@"
+
+# Don't bother using translations from the source directory (too much hassle,
+# if not impossible because of the $LANG/LC_MESSAGES directories)
+LOCALEDIR   = "@LOCALEDIR@"
+
+# Allow to run uninstalled by detecting gnome-specimen.in
+if exists(join(dirname(__file__), '../gyrus.in')):
+    print "Running from source directory; not using installation paths!"
+
+    source_datadir = realpath(join(dirname(__file__), '../data'))
+
+    DATADIR     = source_datadir
+    PKGDATADIR  = source_datadir
+    GLADEDIR    = join (source_datadir, "glade")
+    ARTDIR	= join (source_datadir, "images")
+# Normal situation: use installation paths from ./configure
+else:
+    DATADIR     = "@DATADIR@"
+    PKGDATADIR  = "@PKGDATADIR@"
+    GLADEDIR    = "@GLADEDIR@"
+    ARTDIR	= "@ARTDIR@"
\ No newline at end of file

Modified: branches/gyrus-python/src/gyrus.py
==============================================================================
--- branches/gyrus-python/src/gyrus.py	(original)
+++ branches/gyrus-python/src/gyrus.py	Fri Mar 14 16:54:42 2008
@@ -6,9 +6,13 @@
 import gettext
 import gnome
 import gobject
+import os
 import re
 from imaplib import *
 
+from gettext import gettext as _
+
+import config
 from gyrus_constant import *
 
 import gyrus_session
@@ -17,13 +21,63 @@
 import gyrus_find
 import gyrus_print
 
-gettext.bindtextdomain(APPNAME,DIRLOCALE)
-gettext.textdomain(APPNAME)
+# width and high of main window
+DEFAULT_WIDTH = 750
+DEFAULT_HIGH = 550
+
+UI = '''<ui>
+  <menubar name="MainMenu">
+    <menu action="FileMenu">
+      <menuitem action="OpenSession"/>
+      <separator/>
+      <menuitem action="Report"/>
+      <separator/>
+      <menuitem action="Quit"/>
+    </menu>
+    <menu action="EditMenu">
+      <menuitem action="Find"/>
+      <menuitem action="AddMailbox"/>
+      <menuitem action="RemoveMailbox"/>
+    </menu>
+    <menu action="AclMenu">
+      <menuitem action="EntryNew"/>
+      <menuitem action="EntryRename"/>
+      <menuitem action="EntryDelete"/>
+    </menu>
+    <menu action="ViewMenu">
+      <menuitem action="Refresh"/>
+      <separator/>
+    </menu>
+    <menu action="HelpMenu">
+      <menuitem action="About"/>
+    </menu>
+  </menubar>
+  <toolbar name="MainToolbar">
+    <placeholder name="placeholder1">
+      <toolitem action="OpenSession" />
+      <separator/>
+      <toolitem action="AddMailbox" />
+      <toolitem action="RemoveMailbox" />
+      <toolitem action="Find" />
+      <separator/>
+      <toolitem action="Refresh"/>
+      <separator/>
+      <toolitem action="Report"/>
+      <separator/>
+      <toolitem action="Quit"/>
+    </placeholder>
+  </toolbar>
+</ui>'''
+
+
+gettext.bindtextdomain(config.PACKAGE,config.LOCALEDIR)
+gettext.textdomain(config.PACKAGE)
 _ = gettext.gettext
 
-gtk.glade.bindtextdomain(APPNAME,DIRLOCALE)
-gtk.glade.textdomain(APPNAME)
+gtk.glade.bindtextdomain(config.PACKAGE,config.LOCALEDIR)
+gtk.glade.textdomain(config.PACKAGE)
 
+LOGO = os.path.join (config.ARTDIR, "gyrus.png")
 
 perm = [None,
 	_("lookup"),
@@ -80,7 +134,7 @@
 		window = gtk.Window()
 		window.set_position(1)
 		window.set_default_size(DEFAULT_WIDTH,DEFAULT_HIGH)
-		window.set_title (APPNAME)
+		window.set_title (config.PACKAGE)
 		window.set_icon (gtk.gdk.pixbuf_new_from_file(LOGO))
 		window.connect ("delete_event",self.quit_program)
 
@@ -186,8 +240,8 @@
                 logo =  gtk.gdk.pixbuf_new_from_file (LOGO)
 
                 ad = gtk.AboutDialog()
-                ad.set_name(APPNAME)
-                ad.set_version(VERSION)
+                ad.set_name(config.PACKAGE)
+                ad.set_version(config.VERSION)
                 ad.set_authors(authors)
                 ad.set_translator_credits(translator_credits)
                 ad.set_logo(logo)
@@ -468,7 +522,7 @@
 
 
 	def load_table_page (self):
-		glade_file = gtk.glade.XML (os.path.join (DIRGYRUS, "glade", "page.glade"),"table_page",None)
+		glade_file = gtk.glade.XML (os.path.join (config.GLADEDIR, "page.glade"),"table_page",None)
 
 		admin = GyrusAdmin()
 
@@ -625,7 +679,7 @@
 
 
 	def load_dialog_password (self):
-		glade_file = gtk.glade.XML (os.path.join (DIRGYRUS, "glade", "page.glade"),"dialog_password",None)
+		glade_file = gtk.glade.XML (os.path.join (config.GLADEDIR, "page.glade"),"dialog_password",None)
 
 		dialog_password = glade_file.get_widget ("dialog_password")
 		entry_password = glade_file.get_widget ("entry_password")
@@ -690,7 +744,7 @@
 
 
 	def load_dialog_edit_mailbox (self,admin):
-		glade_file = gtk.glade.XML (os.path.join (DIRGYRUS, "glade", "create_mailbox.glade"),None,None)
+		glade_file = gtk.glade.XML (os.path.join (config.GLADEDIR, "create_mailbox.glade"),None,None)
 
 		dialog = glade_file.get_widget ("dialog_create_mailbox")
 		checkbutton_quota = glade_file.get_widget ("checkbutton_quota")
@@ -738,6 +792,6 @@
 
 
 if __name__ == "__main__":
-	gnome.init(APPNAME,VERSION)	
+	gnome.init(config.PACKAGE,config.VERSION)	
 	gyrus = Gyrus()
 	gyrus.main()

Modified: branches/gyrus-python/src/gyrus_admin_mailbox.py
==============================================================================
--- branches/gyrus-python/src/gyrus_admin_mailbox.py	(original)
+++ branches/gyrus-python/src/gyrus_admin_mailbox.py	Fri Mar 14 16:54:42 2008
@@ -7,13 +7,7 @@
 
 from gyrus_constant import *
 
-gettext.bindtextdomain(APPNAME,DIRLOCALE)
-gettext.textdomain(APPNAME)
-_ = gettext.gettext
-
-gtk.glade.bindtextdomain(APPNAME,DIRLOCALE)
-gtk.glade.textdomain(APPNAME)
-
+import config
 
 def remove_mailbox (admin,mailbox):
 	response = admin.cnx.delete(NAMESPACE + mailbox)
@@ -63,7 +57,7 @@
 	
 
 	if not data[0] == None:
-
+		icon = os.path.join (config.ARTDIR, "gyrus.png")
 		token = None
 		num_users = 0
 		for mailbox in data:
@@ -82,7 +76,7 @@
 					res,msg,free,quota = get_quota_of_mailbox (admin,name_mailbox)
 
 					lstore.set (iter,COLUMN_MAILBOX_ICON, 
-							gtk.gdk.pixbuf_new_from_file_at_size (DIRGYRUS + "images/gyrus.png",15,15),
+							gtk.gdk.pixbuf_new_from_file_at_size (icon,15,15),
 							COLUMN_MAILBOX,name_mailbox,
 							COLUMN_FREE,free,
 							COLUMN_QUOTA_ASSIGNED,quota)

Modified: branches/gyrus-python/src/gyrus_constant.py
==============================================================================
--- branches/gyrus-python/src/gyrus_constant.py	(original)
+++ branches/gyrus-python/src/gyrus_constant.py	Fri Mar 14 16:54:42 2008
@@ -14,19 +14,21 @@
 APPNAME ="gyrus"
 VERSION = "0.4.1"
 
-# width and high of main window
-DEFAULT_WIDTH = 750
-DEFAULT_HIGH = 550
-
 # for printing
 WIDTH_LINE = 1
 
-# for model of sessions
-COLUMN_NAME = 0  
-COLUMN_IP = 1
-COLUMN_PORT = 2
-COLUMN_USER = 3
-COLUMN_TLS  = 4
+
+NAMESPACE = "user."
+
+# REMOVE ALL THIS CRAP FROM HERE, IT'S A HORRIBLE DESIGN!!!!!!
+
+# for model of mailbox
+(
+	COLUMN_MAILBOX_ICON,
+	COLUMN_MAILBOX,
+	COLUMN_QUOTA_ASSIGNED,
+	COLUMN_FREE
+) = range (4)
 
 # for model of ACLs
 COLUMN_IDENTIFIER = 0
@@ -48,55 +50,3 @@
 	COLUMN_QUOTA_ASSIGNED,
 	COLUMN_FREE
 ) = range (4)
-
-NAMESPACE = "user."
-
-# for gconf
-PATH_KEY =  "/apps/gyrus/"
-PATH_SESSIONS = "/apps/gyrus/sessions/"
-
-LOGO = join (DIRGYRUS, "images", "gyrus.png")
-
-UI = '''<ui>
-  <menubar name="MainMenu">
-    <menu action="FileMenu">
-      <menuitem action="OpenSession"/>
-      <separator/>
-      <menuitem action="Report"/>
-      <separator/>
-      <menuitem action="Quit"/>
-    </menu>
-    <menu action="EditMenu">
-      <menuitem action="Find"/>
-      <menuitem action="AddMailbox"/>
-      <menuitem action="RemoveMailbox"/>
-    </menu>
-    <menu action="AclMenu">
-      <menuitem action="EntryNew"/>
-      <menuitem action="EntryRename"/>
-      <menuitem action="EntryDelete"/>
-    </menu>
-    <menu action="ViewMenu">
-      <menuitem action="Refresh"/>
-      <separator/>
-    </menu>
-    <menu action="HelpMenu">
-      <menuitem action="About"/>
-    </menu>
-  </menubar>
-  <toolbar name="MainToolbar">
-    <placeholder name="placeholder1">
-      <toolitem action="OpenSession" />
-      <separator/>
-      <toolitem action="AddMailbox" />
-      <toolitem action="RemoveMailbox" />
-      <toolitem action="Find" />
-      <separator/>
-      <toolitem action="Refresh"/>
-      <separator/>
-      <toolitem action="Report"/>
-      <separator/>
-      <toolitem action="Quit"/>
-    </placeholder>
-  </toolbar>
-</ui>'''

Modified: branches/gyrus-python/src/gyrus_find.py
==============================================================================
--- branches/gyrus-python/src/gyrus_find.py	(original)
+++ branches/gyrus-python/src/gyrus_find.py	Fri Mar 14 16:54:42 2008
@@ -3,21 +3,16 @@
 pygtk.require('2.0')
 import gtk
 import gtk.glade
-import gettext
+import os
 import gnome
 
-from gyrus_constant import *
-
-gettext.bindtextdomain(APPNAME,DIRLOCALE)
-gettext.textdomain(APPNAME)
-_ = gettext.gettext
-
-gtk.glade.bindtextdomain(APPNAME,DIRLOCALE)
-gtk.glade.textdomain(APPNAME)
+from gettext import gettext as _
 
+import config
+from gyrus_constant import *
 
 def load_page_find (self):
-	glade_file = gtk.glade.XML (os.path.join (DIRGYRUS,"glade","find.glade"),None,None)
+	glade_file = gtk.glade.XML (os.path.join (config.GLADEDIR,"find.glade"),None,None)
 
 	self.dialog_find = glade_file.get_widget ("dialog_find")
 	self.comboboxentry_mailbox = glade_file.get_widget ("comboboxentry_mailbox")

Modified: branches/gyrus-python/src/gyrus_session.py
==============================================================================
--- branches/gyrus-python/src/gyrus_session.py	(original)
+++ branches/gyrus-python/src/gyrus_session.py	Fri Mar 14 16:54:42 2008
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 import pygtk
 pygtk.require('2.0')
+import os
 import gtk
 import gtk.glade
 import gettext
@@ -8,15 +9,19 @@
 import gobject
 import gconf
 
-from gyrus_constant import *
+from gettext import gettext as _
 
-gettext.bindtextdomain(APPNAME,DIRLOCALE)
-gettext.textdomain(APPNAME)
-_ = gettext.gettext
+import config
 
-gtk.glade.bindtextdomain(APPNAME,DIRLOCALE)
-gtk.glade.textdomain(APPNAME)
+PATH_KEY =  "/apps/gyrus/"
+PATH_SESSIONS = "/apps/gyrus/sessions/"
 
+# for model of sessions
+COLUMN_NAME = 0  
+COLUMN_IP = 1
+COLUMN_PORT = 2
+COLUMN_USER = 3
+COLUMN_TLS  = 4
 
 class Session:
 	def __init__ (self):
@@ -28,7 +33,7 @@
 		
 
 def load_interface (widget,self):
-	glade_file = gtk.glade.XML (os.path.join (DIRGYRUS, "glade", "sessions.glade"),"dialog_sessions",None)
+	glade_file = gtk.glade.XML (os.path.join (config.GLADEDIR, "sessions.glade"),"dialog_sessions",None)
 
 	self.window_dialog = glade_file.get_widget ("dialog_sessions")
 	self.treeview_sessions = glade_file.get_widget ("treeview_sessions")
@@ -56,7 +61,7 @@
 	col.add_attribute (cell,"text",COLUMN_NAME)
 
 def load_interface_edit_session(self):
-	glade_file = gtk.glade.XML (os.path.join (DIRGYRUS, "glade", "sessions.glade"),"dialog_session_edit",None)
+	glade_file = gtk.glade.XML (os.path.join (config.GLADEDIR,"sessions.glade"),"dialog_session_edit",None)
 
 	self.window_dialog_session_edit = glade_file.get_widget ("dialog_session_edit")
 	self.checkbutton_secure = glade_file.get_widget ("checkbutton_secure")



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]