aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtk-redshift/utils.py
diff options
context:
space:
mode:
authorJon Lund Steffensen <jonlst@gmail.com>2013-03-05 23:17:54 +0100
committerJon Lund Steffensen <jonlst@gmail.com>2013-03-05 23:17:54 +0100
commit30c805f5e7fe79c465077cecd05d0afafe79dc68 (patch)
tree3a7993e925d7910f1c6692b9c961b5a4c79fc3e9 /src/gtk-redshift/utils.py
parentMakefile.am: Fix missing files when generating tarball. (diff)
downloadredshift-ng-30c805f5e7fe79c465077cecd05d0afafe79dc68.tar.gz
redshift-ng-30c805f5e7fe79c465077cecd05d0afafe79dc68.tar.bz2
redshift-ng-30c805f5e7fe79c465077cecd05d0afafe79dc68.tar.xz
Rename gtk-redshift -> redshift-gtk.
This is primarily for improved discovery. Some users report that they didn't know about redshift-gtk, but had it been available on tab completion they would have noticed. Also, I think it is in general good practice that closely related programs have the same prefix.
Diffstat (limited to 'src/gtk-redshift/utils.py')
-rw-r--r--src/gtk-redshift/utils.py64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/gtk-redshift/utils.py b/src/gtk-redshift/utils.py
deleted file mode 100644
index 2fd3b71..0000000
--- a/src/gtk-redshift/utils.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# utils.py -- utility functions source
-# 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 Francesco Marella <francesco.marella@gmail.com>
-# Copyright (c) 2011 Jon Lund Steffensen <jonlst@gmail.com>
-
-import os
-from xdg import BaseDirectory as base
-from xdg import DesktopEntry as desktop
-
-REDSHIFT_DESKTOP = 'gtk-redshift.desktop'
-
-# Keys to set when enabling/disabling autostart.
-# Only first one is checked on "get".
-AUTOSTART_KEYS = (('Hidden', ('true', 'false')),
- ('X-GNOME-Autostart-enabled', ('false', 'true')))
-
-
-def open_autostart_file():
- autostart_dir = base.save_config_path("autostart")
- autostart_file = os.path.join(autostart_dir, REDSHIFT_DESKTOP)
-
- if not os.path.exists(autostart_file):
- desktop_files = list(base.load_data_paths("applications",
- REDSHIFT_DESKTOP))
-
- if not desktop_files:
- raise IOError("Installed redshift desktop file not found!")
-
- desktop_file_path = desktop_files[0]
-
- # Read installed file
- dfile = desktop.DesktopEntry(desktop_file_path)
- for key, values in AUTOSTART_KEYS:
- dfile.set(key, values[False])
- dfile.write(filename=autostart_file)
- else:
- dfile = desktop.DesktopEntry(autostart_file)
-
- return dfile, autostart_file
-
-def get_autostart():
- dfile, path = open_autostart_file()
- check_key, check_values = AUTOSTART_KEYS[0]
- return dfile.get(check_key) == check_values[True]
-
-def set_autostart(active):
- dfile, path = open_autostart_file()
- for key, values in AUTOSTART_KEYS:
- dfile.set(key, values[active])
- dfile.write(filename=path)