[gnome-settings-daemon] power: Move the constants to a separate file



commit 28797aa165e30f8c8b27fa8f9597d9f120520a2d
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jan 18 17:16:25 2013 +0100

    power: Move the constants to a separate file

 plugins/power/Makefile.am           |    1 +
 plugins/power/gsd-power-constants.h |   32 ++++++++++++++++++++++++++++++++
 plugins/power/gsd-power-manager.c   |    7 +++----
 3 files changed, 36 insertions(+), 4 deletions(-)
---
diff --git a/plugins/power/Makefile.am b/plugins/power/Makefile.am
index 2b5f79e..fe8cc04 100644
--- a/plugins/power/Makefile.am
+++ b/plugins/power/Makefile.am
@@ -10,6 +10,7 @@ libpower_la_SOURCES = 					\
 	gsd-power-manager.h				\
 	gsm-inhibitor-flag.h				\
 	gsm-presence-flag.h				\
+	gsd-power-constants.h				\
 	gsd-power-plugin.c
 
 libpower_la_CPPFLAGS = \
diff --git a/plugins/power/gsd-power-constants.h b/plugins/power/gsd-power-constants.h
new file mode 100644
index 0000000..67998e3
--- /dev/null
+++ b/plugins/power/gsd-power-constants.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2013 Red Hat Inc.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+/* The blank delay when the screensaver is active */
+#define SCREENSAVER_TIMEOUT_BLANK                       20 /* seconds */
+
+/* The dim delay when dimming on idle is requested but idle-delay
+ * is set to "Never" */
+#define IDLE_DIM_BLANK_DISABLED_MIN                     60 /* seconds */
+
+/* How much smaller than idle-delay the dim delay is */
+#define IDLE_DELAY_TO_IDLE_DIM_FRACTION                  3
+
+/* The dim delay under which we do not bother dimming */
+#define MINIMUM_IDLE_DIM_DELAY                          10 /* seconds */
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 2ce4621..bcbabab 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -36,6 +36,7 @@
 #include <libgnome-desktop/gnome-rr.h>
 #include <libgnome-desktop/gnome-idle-monitor.h>
 
+#include "gsd-power-constants.h"
 #include "gsm-inhibitor-flag.h"
 #include "gsm-presence-flag.h"
 #include "gpm-common.h"
@@ -83,8 +84,6 @@
 /* Keep this in sync with gnome-shell */
 #define SCREENSAVER_FADE_TIME                           10 /* seconds */
 
-#define SCREENSAVER_TIMEOUT_BLANK                       20 /* seconds */
-#define IDLE_DIM_BLANK_DISABLED_MIN                     60 /* seconds */
 
 static const gchar introspection_xml[] =
 "<node>"
@@ -2673,11 +2672,11 @@ idle_configure (GsdPowerManager *manager)
                         if (timeout_dim == 0) {
                                 timeout_dim = IDLE_DIM_BLANK_DISABLED_MIN;
                         } else {
-                                timeout_dim /= 3;
+                                timeout_dim /= IDLE_DELAY_TO_IDLE_DIM_FRACTION;
                                 /* Don't bother dimming if the idle-delay is
                                  * too low, we'll do that when we bring down the
                                  * screen lock */
-                                if (timeout_dim < 10)
+                                if (timeout_dim < MINIMUM_IDLE_DIM_DELAY)
                                         timeout_dim = 0;
                         }
                 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]