diff options
-rw-r--r-- | data/org.mate.session.gschema.xml.in.in | 5 | ||||
-rw-r--r-- | mate-session/main.c | 29 |
2 files changed, 34 insertions, 0 deletions
diff --git a/data/org.mate.session.gschema.xml.in.in b/data/org.mate.session.gschema.xml.in.in index a40ca2a..2415c67 100644 --- a/data/org.mate.session.gschema.xml.in.in +++ b/data/org.mate.session.gschema.xml.in.in @@ -1,5 +1,10 @@ <schemalist> <schema id="org.mate.session" path="/org/mate/desktop/session/"> + <key name="session-start" type="i"> + <default>0</default> + <_summary>Current session start time</_summary> + <_description>Unix time of the start of the current session.</_description> + </key> <key name="auto-save-session" type="b"> <default>false</default> <_summary>Save sessions</_summary> diff --git a/mate-session/main.c b/mate-session/main.c index da2a687..4dd8fd1 100644 --- a/mate-session/main.c +++ b/mate-session/main.c @@ -27,6 +27,7 @@ #include <string.h> #include <unistd.h> #include <errno.h> +#include <time.h> #include <glib/gi18n.h> #include <glib.h> @@ -67,6 +68,27 @@ static gboolean failsafe = FALSE; static gboolean show_version = FALSE; static gboolean debug = FALSE; +static gboolean +initialize_gsettings (void) +{ + GSettings* settings; + time_t now = time (0); + gboolean ret; + + settings = g_settings_new (GSM_SCHEMA); + + if (!settings) + return FALSE; + + ret = g_settings_set_int (settings, "session-start", now); + + g_settings_sync (); + + g_object_unref (settings); + + return ret; +} + static void on_bus_name_lost(DBusGProxy* bus_proxy, const char* name, gpointer data) { g_warning("Lost name on bus: %s, exiting", name); @@ -505,6 +527,13 @@ int main(int argc, char** argv) */ gsm_util_setenv("MATE_DESKTOP_SESSION_ID", "this-is-deprecated"); + /* + * Make sure gsettings is set up correctly. If not, then bail. + */ + + if (initialize_gsettings () != TRUE) + exit (1); + client_store = gsm_store_new(); xsmp_server = gsm_xsmp_server_new(client_store); |