aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gtk-redshift/defs.py.in21
-rwxr-xr-xsrc/gtk-redshift/gtk-redshift.py (renamed from src/gtk-redshift/gtk-redshift)6
-rw-r--r--src/redshift.c33
3 files changed, 40 insertions, 20 deletions
diff --git a/src/gtk-redshift/defs.py.in b/src/gtk-redshift/defs.py.in
new file mode 100644
index 0000000..91eccf9
--- /dev/null
+++ b/src/gtk-redshift/defs.py.in
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# defs.py -- GTK+ redshift local definitions
+# This file is part of Redshift.
+
+# Redshift 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.
+
+# Redshift 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 Redshift. If not, see <http://www.gnu.org/licenses/>.
+
+# Copyright (c) 2010 Jon Lund Steffensen <jonlst@gmail.com>
+
+
+LOCALEDIR = '@localedir@'
diff --git a/src/gtk-redshift/gtk-redshift b/src/gtk-redshift/gtk-redshift.py
index cdb4ebe..a737154 100755
--- a/src/gtk-redshift/gtk-redshift
+++ b/src/gtk-redshift/gtk-redshift.py
@@ -27,11 +27,13 @@ pygtk.require("2.0")
import gtk, glib
+import defs
+
if __name__ == '__main__':
# Internationalisation
- gettext.bindtextdomain('gtk-redshift')
- gettext.textdomain('gtk-redshift')
+ gettext.bindtextdomain('redshift', defs.LOCALEDIR)
+ gettext.textdomain('redshift')
_ = gettext.gettext
# Start redshift with arguments from the command line
diff --git a/src/redshift.c b/src/redshift.c
index c022224..9c3f404 100644
--- a/src/redshift.c
+++ b/src/redshift.c
@@ -190,7 +190,7 @@ calculate_temp(double elevation, int temp_day, int temp_night,
static void
print_help(const char *program_name)
{
- /* TRANSLATORS: --help output 1
+ /* TRANSLATORS: help output 1
LAT is latitude, LON is longitude,
DAY is temperature at daytime,
NIGHT is temperature at night
@@ -199,19 +199,19 @@ print_help(const char *program_name)
program_name);
fputs("\n", stdout);
- /* TRANSLATORS: --help output 2
+ /* TRANSLATORS: help output 2
no-wrap */
fputs(_("Set color temperature of display"
" according to time of day.\n"), stdout);
fputs("\n", stdout);
- /* TRANSLATORS: --help output 3
+ /* TRANSLATORS: help output 3
no-wrap */
fputs(_(" -h\t\tDisplay this help message\n"
" -v\t\tVerbose output\n"), stdout);
fputs("\n", stdout);
- /* TRANSLATORS: --help output 4
+ /* TRANSLATORS: help output 4
no-wrap */
fputs(_(" -g R:G:B\tAdditional gamma correction to apply\n"
" -l LAT:LON\tYour current location\n"
@@ -225,7 +225,7 @@ print_help(const char *program_name)
stdout);
fputs("\n", stdout);
- /* TRANSLATORS: --help output 5 */
+ /* TRANSLATORS: help output 5 */
printf("Please report bugs to <%s>\n", PACKAGE_BUGREPORT);
}
@@ -241,8 +241,8 @@ main(int argc, char *argv[])
#ifdef ENABLE_NLS
/* Internationalisation */
- bindtextdomain("redshift", "/usr/share/locale");
- textdomain("redshift");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
#endif
/* Initialize to defaults */
@@ -277,7 +277,7 @@ main(int argc, char *argv[])
if (s == NULL) {
fputs(_("Malformed gamma argument.\n"),
stderr);
- fputs(_("Try `--help' for more"
+ fputs(_("Try `-h' for more"
" information.\n"), stderr);
exit(EXIT_FAILURE);
}
@@ -296,8 +296,8 @@ main(int argc, char *argv[])
if (s == NULL) {
fputs(_("Malformed location argument.\n"),
stderr);
- fputs(_("Try `--help' for more"
- " information.\n"), stderr);
+ fputs(_("Try `-h' for more information.\n"),
+ stderr);
exit(EXIT_FAILURE);
}
*(s++) = '\0';
@@ -347,8 +347,8 @@ main(int argc, char *argv[])
if (s == NULL) {
fputs(_("Malformed temperature argument.\n"),
stderr);
- fputs(_("Try `--help' for more"
- " information.\n"), stderr);
+ fputs(_("Try `-h' for more information.\n"),
+ stderr);
exit(EXIT_FAILURE);
}
*(s++) = '\0';
@@ -358,10 +358,8 @@ main(int argc, char *argv[])
case 'v':
verbose = 1;
break;
- default:
- fprintf(stderr, _("Unknown parameter `%c'.\n"), opt);
- fputs(_("Try `--help' for more"
- " information.\n"), stderr);
+ case '?':
+ fputs(_("Try `-h' for more information.\n"), stderr);
exit(EXIT_FAILURE);
break;
}
@@ -370,8 +368,7 @@ main(int argc, char *argv[])
/* Latitude and longitude must be set */
if (isnan(lat) || isnan(lon)) {
fputs(_("Latitude and longitude must be set.\n"), stderr);
- fputs(_("Try `--help' for more"
- " information.\n"), stderr);
+ fputs(_("Try `-h' for more information.\n"), stderr);
exit(EXIT_FAILURE);
}