1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- 2 * 3 * Copyright (C) 2005-2011 Richard Hughes <richard@hughsie.com> 4 * 5 * Licensed under the GNU General Public License Version 2 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 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 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 20 */ 21 22 #ifndef __GPMCOMMON_H 23 #define __GPMCOMMON_H 24 25 #include <glib.h> 26 #include <libupower-glib/upower.h> 27 28 G_BEGIN_DECLS 29 30 /* UPower helpers */ 31 gchar *gpm_get_timestring (guint time); 32 33 /* Power helpers */ 34 gboolean gsd_power_is_hardware_a_vm (void); 35 guint gsd_power_enable_screensaver_watchdog (void); 36 void reset_idletime (void); 37 38 /* Backlight helpers */ 39 40 /* on ACPI machines we have 4-16 levels, on others it's ~150 */ 41 #define BRIGHTNESS_STEP_AMOUNT(max) ((max) < 20 ? 1 : (max) / 20) 42 43 #define ABS_TO_PERCENTAGE(min, max, value) gsd_power_backlight_abs_to_percentage(min, max, value) 44 #define PERCENTAGE_TO_ABS(min, max, value) gsd_power_backlight_percentage_to_abs(min, max, value) 45 46 int gsd_power_backlight_abs_to_percentage (int min, int max, int value); 47 int gsd_power_backlight_percentage_to_abs (int min, int max, int value); 48 49 /* RandR helpers */ 50 void watch_external_monitor (GnomeRRScreen *screen); 51 gboolean external_monitor_is_connected (GnomeRRScreen *screen); 52 53 /* Sound helpers */ 54 void play_loop_start (guint *id); 55 void play_loop_stop (guint *id); 56 57 G_END_DECLS 58 59 #endif /* __GPMCOMMON_H */ 60