1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Gettings Things Gnome! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2009 - Lionel Dricot & Bertrand Rousseau
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
"""
Getting Things Gnome! A personal organizer for the GNOME desktop
"""
import os
import locale
#Fallback to LANG C if unsupported locale
try:
locale.setlocale(locale.LC_ALL, '')
except:
locale.setlocale(locale.LC_ALL, 'C')
import gettext
try:
from gtk import glade
loaded_glade = glade
except:
#that's not pretty but it looks functional.
loaded_glade = None
try:
from xdg.BaseDirectory import xdg_config_home
config_home = xdg_config_home
except ImportError:
config_home = os.path.dirname(__file__)
LOCAL_ROOTDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
#Translation setup (from pyroom)
GETTEXT_DOMAIN = 'gtg'
LOCALE_PATH = gettext.bindtextdomain(GETTEXT_DOMAIN)
for module in gettext, loaded_glade:
#check if glade is well loaded to avoid error in Fedora build farm
if module:
module.bindtextdomain(GETTEXT_DOMAIN, LOCALE_PATH)
module.textdomain(GETTEXT_DOMAIN)
translation = gettext.translation(GETTEXT_DOMAIN, LOCALE_PATH, fallback=True)
_ = translation.gettext
ngettext = translation.ngettext
#GTG directories setup
if os.path.isdir(os.path.join(LOCAL_ROOTDIR, 'data')):
DATA_DIR = os.path.join(LOCAL_ROOTDIR, 'data')
else:
DATA_DIR = LOCAL_ROOTDIR
#GTG plugin dir setup
PLUGIN_DIR = [os.path.join(LOCAL_ROOTDIR, 'GTG/plugins')]
user_plugins = os.path.join(config_home, 'gtg/plugins')
if os.path.isdir(user_plugins):
PLUGIN_DIR.append(user_plugins)
# FIXME Register GTG URI (temporary, it should be created by a schema upon installing)
# FIXME Uncomment it or even better - install it properly - it breaks build
"""
try:
import gconf
domain = "/desktop/gnome/url-handlers/gtg/"
client = gconf.client_get_default()
#this should work both in debugging mode and in deployed mode
client.set_string(os.path.join(domain, "command"), "gtg %s")
client.set_bool(os.path.join(domain, "enabled"), True)
client.set_bool(os.path.join(domain, "needs_terminal"), False)
except ImportError:
# Ignore it on systems which do not have GConf
pass
"""
|