Store additional entries in dconf
This commit is contained in:
parent
4a2519e7ef
commit
1f0da88cff
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<schemalist gettext-domain="mugshot">
|
||||||
|
<schema id="apps.mugshot" path="/apps/mugshot/">
|
||||||
|
<key name="initials" type="s">
|
||||||
|
<default>''</default>
|
||||||
|
<summary>Initials</summary>
|
||||||
|
<description>Initials representing the user's name.</description>
|
||||||
|
</key>
|
||||||
|
<key name="email" type="s">
|
||||||
|
<default>''</default>
|
||||||
|
<summary>Email Address</summary>
|
||||||
|
<description>The user's email address.</description>
|
||||||
|
</key>
|
||||||
|
<key name="fax" type="s">
|
||||||
|
<default>''</default>
|
||||||
|
<summary>Fax</summary>
|
||||||
|
<description>The user's fax number.</description>
|
||||||
|
</key>
|
||||||
|
</schema>
|
||||||
|
</schemalist>
|
|
@ -1,10 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<schemalist gettext-domain="mugshot">
|
|
||||||
<schema id="net.launchpad.mugshot" path="/net/launchpad/mugshot/">
|
|
||||||
<key name="example" type="s">
|
|
||||||
<default>''</default>
|
|
||||||
<summary>Sample setting</summary>
|
|
||||||
<description>Longer description of this sample setting. Talk about allowed values and what it does.</description>
|
|
||||||
</key>
|
|
||||||
</schema>
|
|
||||||
</schemalist>
|
|
|
@ -100,7 +100,6 @@ class MugshotWindow(Window):
|
||||||
|
|
||||||
# Populate all of the widgets.
|
# Populate all of the widgets.
|
||||||
self.init_user_details()
|
self.init_user_details()
|
||||||
print self.get_libreoffice_data()
|
|
||||||
|
|
||||||
def init_user_details(self):
|
def init_user_details(self):
|
||||||
"""Initialize the user details entries and variables."""
|
"""Initialize the user details entries and variables."""
|
||||||
|
@ -135,6 +134,12 @@ class MugshotWindow(Window):
|
||||||
if home_phone == 'none': home_phone = ''
|
if home_phone == 'none': home_phone = ''
|
||||||
if office_phone == 'none': office_phone = ''
|
if office_phone == 'none': office_phone = ''
|
||||||
|
|
||||||
|
# Get dconf settings
|
||||||
|
if self.settings['initials'] != '':
|
||||||
|
initials = self.settings['initials']
|
||||||
|
email = self.settings['email']
|
||||||
|
fax = self.settings['fax']
|
||||||
|
|
||||||
# Set the class variables
|
# Set the class variables
|
||||||
self.first_name = first_name
|
self.first_name = first_name
|
||||||
self.last_name = last_name
|
self.last_name = last_name
|
||||||
|
@ -148,6 +153,8 @@ class MugshotWindow(Window):
|
||||||
self.initials_entry.set_text(self.initials)
|
self.initials_entry.set_text(self.initials)
|
||||||
self.office_phone_entry.set_text(self.office_phone)
|
self.office_phone_entry.set_text(self.office_phone)
|
||||||
self.home_phone_entry.set_text(self.home_phone)
|
self.home_phone_entry.set_text(self.home_phone)
|
||||||
|
self.email_entry.set_text(email)
|
||||||
|
self.fax_entry.set_text(fax)
|
||||||
|
|
||||||
# = Mugshot Window ======================================================= #
|
# = Mugshot Window ======================================================= #
|
||||||
def set_user_image(self, filename=None):
|
def set_user_image(self, filename=None):
|
||||||
|
@ -177,6 +184,14 @@ class MugshotWindow(Window):
|
||||||
if self.updated_image:
|
if self.updated_image:
|
||||||
self.save_image()
|
self.save_image()
|
||||||
|
|
||||||
|
self.save_gsettings()
|
||||||
|
|
||||||
|
def save_gsettings(self):
|
||||||
|
"""Save details to dconf (the ones not tracked by /etc/passwd)"""
|
||||||
|
self.settings.set_string('initials', get_entry_value(self.initials_entry))
|
||||||
|
self.settings.set_string('email', get_entry_value(self.email_entry))
|
||||||
|
self.settings.set_string('fax', get_entry_value(self.fax_entry))
|
||||||
|
|
||||||
def on_cancel_button_clicked(self, widget):
|
def on_cancel_button_clicked(self, widget):
|
||||||
"""When the window cancel button is clicked, close the program."""
|
"""When the window cancel button is clicked, close the program."""
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Window(Gtk.Window):
|
||||||
self.preferences_dialog = None # instance
|
self.preferences_dialog = None # instance
|
||||||
self.AboutDialog = None # class
|
self.AboutDialog = None # class
|
||||||
|
|
||||||
self.settings = Gio.Settings("net.launchpad.mugshot")
|
self.settings = Gio.Settings("apps.mugshot")
|
||||||
self.settings.connect('changed', self.on_preferences_changed)
|
self.settings.connect('changed', self.on_preferences_changed)
|
||||||
|
|
||||||
# Optional application indicator support
|
# Optional application indicator support
|
||||||
|
|
Loading…
Reference in New Issue