~lightdm-gtk-greeter-team/lightdm-gtk-greeter-settings/trunk

« back to all changes in this revision

Viewing changes to lightdm_gtk_greeter_settings/GtkGreeterSettingsWindow.py

  • Committer: Andrew P.
  • Date: 2015-03-25 10:57:49 UTC
  • Revision ID: pan.pav.7c5@gmail.com-20150325105749-noqv9ntej87t1mlv
Using -key= form to reset key value

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
from gi.repository import (
29
29
    Gdk,
30
 
    GLib,
31
30
    Gtk)
32
31
from gi.repository import Pango
33
32
from gi.repository.GObject import markup_escape_text as escape_markup
139
138
            group.entry_added.connect(self.on_entry_added)
140
139
            group.entry_removed.connect(self.on_entry_removed)
141
140
 
142
 
        config_pathes = []
143
 
        config_pathes.extend(os.path.join(p, 'lightdm-gtk-greeter.conf.d')
144
 
                             for p in GLib.get_system_data_dirs())
145
 
        config_pathes.extend(os.path.join(p, 'lightdm-gtk-greeter.conf.d')
146
 
                             for p in GLib.get_system_config_dirs())
147
 
        config_pathes.append(os.path.join(os.path.dirname(helpers.get_config_path()),
148
 
                                          'lightdm-gtk-greeter.conf.d'))
149
 
 
150
 
        self._config = Config.Config(config_pathes, helpers.get_config_path())
151
 
 
152
 
        self._allow_edit = self._has_access_to_write(helpers.get_config_path())
 
141
        self._config = Config.Config()
 
142
 
 
143
        self._allow_edit = self._config.is_writable()
153
144
        self._widgets.apply.props.visible = self._allow_edit
154
145
 
155
146
        if not self._allow_edit:
188
179
 
189
180
        self._read()
190
181
 
191
 
    def _has_access_to_write(self, path):
192
 
        if os.path.exists(path) and os.access(helpers.get_config_path(), os.W_OK):
193
 
            return True
194
 
        return os.access(os.path.dirname(helpers.get_config_path()), os.W_OK | os.X_OK)
195
 
 
196
182
    def _set_message(self, message, type_=Gtk.MessageType.INFO):
197
183
        if not message:
198
184
            self._widgets.infobar.hide()
215
201
 
216
202
    def _write(self):
217
203
        for group in self._groups:
218
 
            group.write(self._config)
 
204
            group.write(self._config, self._changed_entries.__contains__)
219
205
 
220
206
        if self.mode != WindowMode.Embedded:
221
207
            for entry in self._changed_entries: