[gnome-color-manager] Abstract out the logic for detemining a LCD panel type from the output name
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Abstract out the logic for detemining a LCD panel type from the output name
- Date: Wed, 4 Nov 2009 10:00:39 +0000 (UTC)
commit 895f5a212dc3951cdb1fc74143174a21eef1cb5f
Author: Richard Hughes <richard hughsie com>
Date: Wed Nov 4 09:49:23 2009 +0000
Abstract out the logic for detemining a LCD panel type from the output name
src/gcm-calibrate.c | 5 +++--
src/gcm-utils.c | 37 ++++++++++++++++++++++++++++++++++++-
src/gcm-utils.h | 2 ++
3 files changed, 41 insertions(+), 3 deletions(-)
---
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index fb8b974..97a0250 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -704,11 +704,12 @@ gcm_calibrate_get_property (GObject *object, guint prop_id, GValue *value, GPara
static void
gcm_calibrate_guess_type (GcmCalibrate *calibrate)
{
+ gboolean ret;
GcmCalibratePrivate *priv = calibrate->priv;
/* guess based on the output name */
- if (strstr (priv->output_name, "DVI") != NULL ||
- strstr (priv->output_name, "LVDS") != NULL) {
+ ret = gcm_utils_output_is_lcd (priv->output_name);
+ if (ret) {
priv->is_lcd = TRUE;
priv->is_crt = FALSE;
} else {
diff --git a/src/gcm-utils.c b/src/gcm-utils.c
index da242d3..c011a15 100644
--- a/src/gcm-utils.c
+++ b/src/gcm-utils.c
@@ -31,6 +31,40 @@
#include "egg-debug.h"
/**
+ * gcm_utils_output_is_lcd_internal:
+ * @output_name: the output name
+ *
+ * Return value: %TRUE is the output is an internal LCD panel
+ **/
+gboolean
+gcm_utils_output_is_lcd_internal (const gchar *output_name)
+{
+ if (g_strstr_len (output_name, -1, "LVDS") != NULL)
+ return TRUE;
+ if (g_strstr_len (output_name, -1, "lvds") != NULL)
+ return TRUE;
+ return FALSE;
+}
+
+/**
+ * gcm_utils_output_is_lcd:
+ * @output_name: the output name
+ *
+ * Return value: %TRUE is the output is an internal or external LCD panel
+ **/
+gboolean
+gcm_utils_output_is_lcd (const gchar *output_name)
+{
+ if (gcm_utils_output_is_lcd_internal (output_name))
+ return TRUE;
+ if (g_strstr_len (output_name, -1, "DVI") != NULL)
+ return TRUE;
+ if (g_strstr_len (output_name, -1, "dvi") != NULL)
+ return TRUE;
+ return FALSE;
+}
+
+/**
* gcm_utils_get_output_name:
*
* Return value: the output name, free with g_free().
@@ -73,7 +107,8 @@ out:
/* fallback to the output name */
if (name == NULL) {
output_name = gnome_rr_output_get_name (output);
- if (g_strstr_len (output_name, -1, "LVDS") != NULL)
+ ret = gcm_utils_output_is_lcd_internal (output_name);
+ if (ret)
output_name = _("Internal LCD");
name = g_strdup (output_name);
}
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index 10549ce..44e3625 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -62,6 +62,8 @@ gboolean gcm_utils_set_x11_icc_profile_data (guint id,
gboolean gcm_utils_set_x11_icc_profile (guint id,
const gchar *filename,
GError **error);
+gboolean gcm_utils_output_is_lcd_internal (const gchar *output_name);
+gboolean gcm_utils_output_is_lcd (const gchar *output_name);
#endif /* __GCM_UTILS_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]