summaryrefslogtreecommitdiff
path: root/plugins/datetime
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/datetime')
-rw-r--r--plugins/datetime/msd-datetime-mechanism-main.c1
-rw-r--r--plugins/datetime/msd-datetime-mechanism.c35
-rw-r--r--plugins/datetime/msd-datetime-mechanism.h2
-rw-r--r--plugins/datetime/system-timezone.c5
-rw-r--r--plugins/datetime/system-timezone.h2
5 files changed, 23 insertions, 22 deletions
diff --git a/plugins/datetime/msd-datetime-mechanism-main.c b/plugins/datetime/msd-datetime-mechanism-main.c
index a199744..981d8ea 100644
--- a/plugins/datetime/msd-datetime-mechanism-main.c
+++ b/plugins/datetime/msd-datetime-mechanism-main.c
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 David Zeuthen <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/plugins/datetime/msd-datetime-mechanism.c b/plugins/datetime/msd-datetime-mechanism.c
index 8fabe28..3d4bf6b 100644
--- a/plugins/datetime/msd-datetime-mechanism.c
+++ b/plugins/datetime/msd-datetime-mechanism.c
@@ -2,6 +2,7 @@
* vim: set ts=8 sts=8 sw=8 expandtab:
*
* Copyright (C) 2007 David Zeuthen <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -105,13 +106,16 @@ G_DEFINE_TYPE_WITH_PRIVATE (MsdDatetimeMechanism, msd_datetime_mechanism, G_TYPE
static gboolean
do_exit (gpointer user_data)
{
+ GMainLoop *loop;
+
+ loop = (GMainLoop*)user_data;
g_debug ("Exiting due to inactivity");
- exit (1);
+ g_main_loop_quit (loop);
return FALSE;
}
static void
-reset_killtimer (void)
+reset_killtimer (GMainLoop *loop)
{
static guint timer_id = 0;
@@ -119,7 +123,7 @@ reset_killtimer (void)
g_source_remove (timer_id);
}
g_debug ("Setting killtimer to 30 seconds...");
- timer_id = g_timeout_add_seconds (30, do_exit, NULL);
+ timer_id = g_timeout_add_seconds (30, do_exit, loop);
}
GQuark
@@ -134,7 +138,6 @@ msd_datetime_mechanism_error_quark (void)
return ret;
}
-
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
GType
@@ -173,7 +176,7 @@ msd_datetime_mechanism_adjust_time_handler (MateSettingsDateTimeMechanism *objec
mechanism = MSD_DATETIME_MECHANISM (user_data);
- reset_killtimer ();
+ reset_killtimer (mechanism->priv->loop);
g_debug ("AdjustTime(%ld) called", seconds_to_add);
if (gettimeofday (&tv, NULL) != 0) {
@@ -200,7 +203,7 @@ msd_datetime_mechanism_adjust_time_handler (MateSettingsDateTimeMechanism *objec
g_dbus_method_invocation_return_gerror (invocation, error);
g_error_free (error);
} else {
- mate_settings_date_time_mechanism_complete_adjust_time ( object, invocation);
+ mate_settings_date_time_mechanism_complete_adjust_time (object, invocation);
}
return ret;
@@ -360,13 +363,16 @@ msd_datetime_mechanism_get_timezone_handler (MateSettingsDateTimeMechanism *obje
GDBusMethodInvocation *invocation,
gpointer user_data G_GNUC_UNUSED)
{
- gchar *timezone;
+ gchar *tz;
+ MsdDatetimeMechanism *mechanism;
+
+ mechanism = MSD_DATETIME_MECHANISM (user_data);
- reset_killtimer ();
+ reset_killtimer (mechanism->priv->loop);
- timezone = system_timezone_find ();
+ tz = system_timezone_find ();
- mate_settings_date_time_mechanism_complete_get_timezone (object, invocation, timezone);
+ mate_settings_date_time_mechanism_complete_get_timezone (object, invocation, tz);
return TRUE;
}
@@ -440,7 +446,7 @@ msd_datetime_mechanism_set_time_handler (MateSettingsDateTimeMechanism *object,
mechanism = MSD_DATETIME_MECHANISM (user_data);
- reset_killtimer ();
+ reset_killtimer (mechanism->priv->loop);
g_debug ("SetTime(%ld) called", arg_seconds_since_epoch);
if (!_check_polkit_for_action (mechanism,
@@ -475,7 +481,7 @@ msd_datetime_mechanism_set_timezone_handler (MateSettingsDateTimeMechanism *obje
MsdDatetimeMechanism *mechanism;
mechanism = MSD_DATETIME_MECHANISM (user_data);
- reset_killtimer ();
+ reset_killtimer (mechanism->priv->loop);
g_debug ("SetTimezone('%s') called", zonefile);
if (!_check_polkit_for_action (mechanism,
@@ -692,7 +698,7 @@ register_mechanism (MsdDatetimeMechanism *mechanism)
goto error;
}
- reset_killtimer ();
+ reset_killtimer (mechanism->priv->loop);
return TRUE;
@@ -700,7 +706,6 @@ error:
return FALSE;
}
-
MsdDatetimeMechanism *
msd_datetime_mechanism_new (GMainLoop *loop)
{
@@ -729,7 +734,6 @@ _check_polkit_for_action (MsdDatetimeMechanism *mechanism,
/* Check that caller is privileged */
subject = polkit_system_bus_name_new (sender);
-
result = polkit_authority_check_authorization_sync (mechanism->priv->auth,
subject,
action,
@@ -756,7 +760,6 @@ _check_polkit_for_action (MsdDatetimeMechanism *mechanism,
return TRUE;
}
-
static gboolean
_set_time (MsdDatetimeMechanism *mechanism G_GNUC_UNUSED,
const struct timeval *tv,
diff --git a/plugins/datetime/msd-datetime-mechanism.h b/plugins/datetime/msd-datetime-mechanism.h
index 5385aec..e15ca95 100644
--- a/plugins/datetime/msd-datetime-mechanism.h
+++ b/plugins/datetime/msd-datetime-mechanism.h
@@ -1,6 +1,7 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
* Copyright (C) 2007 David Zeuthen <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -58,7 +59,6 @@ typedef enum
GType msd_datetime_mechanism_error_get_type (void);
#define MSD_DATETIME_MECHANISM_TYPE_ERROR (msd_datetime_mechanism_error_get_type ())
-
GQuark msd_datetime_mechanism_error_quark (void);
GType msd_datetime_mechanism_get_type (void);
MsdDatetimeMechanism *msd_datetime_mechanism_new (GMainLoop *loop);
diff --git a/plugins/datetime/system-timezone.c b/plugins/datetime/system-timezone.c
index f9fab7a..0672e3b 100644
--- a/plugins/datetime/system-timezone.c
+++ b/plugins/datetime/system-timezone.c
@@ -3,6 +3,7 @@
* Copyright (C) 2008 Novell, Inc.
*
* Authors: Vincent Untz <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -280,7 +281,6 @@ system_timezone_monitor_changed (GFileMonitor *handle G_GNUC_UNUSED,
g_free (new_tz);
}
-
/*
* Code to deal with the system timezone on all distros.
* There's no dependency on the SystemTimezone GObject here.
@@ -369,7 +369,6 @@ system_timezone_write_etc_timezone (const char *tz,
return retval;
}
-
/* Read a file that looks like a key-file (but there's no need for groups)
* and get the last value for a specific key */
static char *
@@ -695,7 +694,6 @@ recursive_compare (struct stat *localtime_stat,
return NULL;
}
-
static gboolean
files_are_identical_inode (struct stat *a_stat,
struct stat *b_stat,
@@ -706,7 +704,6 @@ files_are_identical_inode (struct stat *a_stat,
return (a_stat->st_ino == b_stat->st_ino);
}
-
/* Determine if /etc/localtime is a hard link to some file, by looking at
* the inodes */
static char *
diff --git a/plugins/datetime/system-timezone.h b/plugins/datetime/system-timezone.h
index c801348..233f997 100644
--- a/plugins/datetime/system-timezone.h
+++ b/plugins/datetime/system-timezone.h
@@ -3,6 +3,7 @@
* Copyright (C) 2008 Novell, Inc.
*
* Authors: Vincent Untz <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,7 +36,6 @@ extern "C" {
#define SYSTEM_ZONEINFODIR "/usr/share/zoneinfo"
#endif
-
#define SYSTEM_TIMEZONE_TYPE (system_timezone_get_type ())
#define SYSTEM_TIMEZONE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SYSTEM_TIMEZONE_TYPE, SystemTimezone))
#define SYSTEM_TIMEZONE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), SYSTEM_TIMEZONE_TYPE, SystemTimezoneClass))