From 1f0da88cffbc248f5d9ddaaf5a00fd5b629b9517 Mon Sep 17 00:00:00 2001 From: Sean Davis Date: Sun, 14 Jul 2013 08:36:12 -0400 Subject: [PATCH] Store additional entries in dconf --- .../glib-2.0/schemas/apps.mugshot.gschema.xml | 20 +++++++++++++++++++ .../schemas/net.launchpad.mugshot.gschema.xml | 10 ---------- mugshot/MugshotWindow.py | 17 +++++++++++++++- mugshot_lib/Window.py | 2 +- 4 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 data/glib-2.0/schemas/apps.mugshot.gschema.xml delete mode 100644 data/glib-2.0/schemas/net.launchpad.mugshot.gschema.xml diff --git a/data/glib-2.0/schemas/apps.mugshot.gschema.xml b/data/glib-2.0/schemas/apps.mugshot.gschema.xml new file mode 100644 index 0000000..c86a42b --- /dev/null +++ b/data/glib-2.0/schemas/apps.mugshot.gschema.xml @@ -0,0 +1,20 @@ + + + + + '' + Initials + Initials representing the user's name. + + + '' + Email Address + The user's email address. + + + '' + Fax + The user's fax number. + + + diff --git a/data/glib-2.0/schemas/net.launchpad.mugshot.gschema.xml b/data/glib-2.0/schemas/net.launchpad.mugshot.gschema.xml deleted file mode 100644 index 285bcb0..0000000 --- a/data/glib-2.0/schemas/net.launchpad.mugshot.gschema.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - '' - Sample setting - Longer description of this sample setting. Talk about allowed values and what it does. - - - diff --git a/mugshot/MugshotWindow.py b/mugshot/MugshotWindow.py index 51a6848..39dee76 100644 --- a/mugshot/MugshotWindow.py +++ b/mugshot/MugshotWindow.py @@ -100,7 +100,6 @@ class MugshotWindow(Window): # Populate all of the widgets. self.init_user_details() - print self.get_libreoffice_data() def init_user_details(self): """Initialize the user details entries and variables.""" @@ -134,6 +133,12 @@ class MugshotWindow(Window): # If the variables are defined as 'none', use blank for cleanliness. if home_phone == 'none': home_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 self.first_name = first_name @@ -148,6 +153,8 @@ class MugshotWindow(Window): self.initials_entry.set_text(self.initials) self.office_phone_entry.set_text(self.office_phone) self.home_phone_entry.set_text(self.home_phone) + self.email_entry.set_text(email) + self.fax_entry.set_text(fax) # = Mugshot Window ======================================================= # def set_user_image(self, filename=None): @@ -177,6 +184,14 @@ class MugshotWindow(Window): if self.updated_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): """When the window cancel button is clicked, close the program.""" self.destroy() diff --git a/mugshot_lib/Window.py b/mugshot_lib/Window.py index f21be44..60e65b6 100644 --- a/mugshot_lib/Window.py +++ b/mugshot_lib/Window.py @@ -62,7 +62,7 @@ class Window(Gtk.Window): self.preferences_dialog = None # instance 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) # Optional application indicator support