2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include <cairo-dock.h>
23
#include "applet-utils.h"
26
void env_backend_logout (void)
28
// since Gnome 3, gnome-session-save has been replaced by gnome-session-quit
29
gchar *cResult = cairo_dock_launch_command_sync ("which gnome-session-quit");
30
if (cResult != NULL && *cResult == '/')
31
cairo_dock_launch_command ("gnome-session-quit --logout");
33
cairo_dock_launch_command ("gnome-session-save --kill --gui");
37
void env_backend_shutdown (void)
39
// since Gnome 3, gnome-session-save has been replaced by gnome-session-quit
40
gchar *cResult = cairo_dock_launch_command_sync ("which gnome-session-quit");
41
if (cResult != NULL && *cResult == '/')
42
cairo_dock_launch_command ("gnome-session-quit --power-off");
44
cairo_dock_launch_command ("gnome-session-save --shutdown-dialog");
48
void env_backend_lock_screen (void)
50
cairo_dock_launch_command (MY_APPLET_SHARE_DATA_DIR"/../shared-files/scripts/lock-screen.sh");
53
void env_backend_setup_time (void)
55
static gboolean bChecked = FALSE;
56
static const gchar *cCmd = NULL;
60
gchar *cResult = cairo_dock_launch_command_sync ("which gnome-control-center"); // Gnome3
61
if (cResult != NULL && *cResult == '/')
63
cCmd = "gnome-control-center datetime";
68
cResult = cairo_dock_launch_command_sync ("which time-admin"); // Gnome2
69
if (cResult != NULL && *cResult == '/')
70
cCmd = "time-admin"; // it uses PolicyKit => no gksudo.
75
cairo_dock_launch_command (cCmd);
77
cd_warning ("couldn't guess what program to use to setup the time and date.");
80
void env_backend_show_system_monitor (void)
82
cairo_dock_launch_command ("gnome-system-monitor");