Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move display specific config options to display.h
MCE_GCONF_DISPLAY_PATH was defined in two places. Possibly due to
moving option names away from display.h after separate als brightness
filtering plugin was created - long time ago.

Define all constants derived from MCE_GCONF_DISPLAY_PATH in display.h
and adjust naming of the values to match style used in display.h.
  • Loading branch information
spiiroin committed Jan 27, 2015
1 parent f859e54 commit f02a416
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .depend
Expand Up @@ -549,6 +549,7 @@ modules/filter-brightness-als.o:\
mce-log.h\
mce-sensorfw.h\
mce.h\
modules/display.h\
modules/filter-brightness-als.h\

modules/filter-brightness-als.pic.o:\
Expand All @@ -562,6 +563,7 @@ modules/filter-brightness-als.pic.o:\
mce-log.h\
mce-sensorfw.h\
mce.h\
modules/display.h\
modules/filter-brightness-als.h\

modules/filter-brightness-simple.o:\
Expand Down
4 changes: 2 additions & 2 deletions builtin-gconf.c
Expand Up @@ -1077,13 +1077,13 @@ static const setting_t gconf_defaults[] =
.def = "10,20,30,40,50",
},
{
// MCE_GCONF_DISPLAY_ALS_ENABLED_PATH @ modules/filter-brightness-als.h
// MCE_GCONF_DISPLAY_ALS_ENABLED @ modules/display.h
.key = "/system/osso/dsm/display/als_enabled",
.type = "b",
.def = "true",
},
{
// MCE_GCONF_DISPLAY_COLOR_PROFILE_PATH @ modules/filter-brightness-als.h
// MCE_GCONF_DISPLAY_COLOR_PROFILE @ modules/display.h
.key = "/system/osso/dsm/display/color_profile",
.type = "s",
.def = "",
Expand Down
10 changes: 7 additions & 3 deletions modules/display.h
Expand Up @@ -99,10 +99,14 @@
/** Path to the framebuffer device */
#define FB_DEVICE "/dev/fb0"

#ifndef MCE_GCONF_DISPLAY_PATH
/** Path to the GConf settings for the display */
# define MCE_GCONF_DISPLAY_PATH "/system/osso/dsm/display"
#endif
#define MCE_GCONF_DISPLAY_PATH "/system/osso/dsm/display"

/** Path to the ALS enabled GConf setting */
#define MCE_GCONF_DISPLAY_ALS_ENABLED MCE_GCONF_DISPLAY_PATH "/als_enabled"

/** Path to the color profile GConf setting */
#define MCE_GCONF_DISPLAY_COLOR_PROFILE MCE_GCONF_DISPLAY_PATH "/color_profile"

/** Display brightness GConf setting */
#define MCE_GCONF_DISPLAY_BRIGHTNESS MCE_GCONF_DISPLAY_PATH "/display_brightness"
Expand Down
11 changes: 6 additions & 5 deletions modules/filter-brightness-als.c
Expand Up @@ -24,6 +24,7 @@
*/

#include "filter-brightness-als.h"
#include "display.h"

#include "../mce.h"
#include "../mce-log.h"
Expand Down Expand Up @@ -1013,7 +1014,7 @@ static gboolean save_color_profile(const gchar *id)
goto EXIT;
}

status = mce_gconf_set_string(MCE_GCONF_DISPLAY_COLOR_PROFILE_PATH, id);
status = mce_gconf_set_string(MCE_GCONF_DISPLAY_COLOR_PROFILE, id);

EXIT:
return status;
Expand All @@ -1039,7 +1040,7 @@ static gchar *read_default_color_profile(void)
static gchar *read_current_color_profile(void)
{
gchar *retval = NULL;
(void)mce_gconf_get_string(MCE_GCONF_DISPLAY_COLOR_PROFILE_PATH,
(void)mce_gconf_get_string(MCE_GCONF_DISPLAY_COLOR_PROFILE,
&retval);

/* Treat empty string as NULL */
Expand Down Expand Up @@ -1198,16 +1199,16 @@ const gchar *g_module_check_init(GModule *module)

/* ALS enabled setting */
mce_gconf_notifier_add(MCE_GCONF_DISPLAY_PATH,
MCE_GCONF_DISPLAY_ALS_ENABLED_PATH,
MCE_GCONF_DISPLAY_ALS_ENABLED,
use_als_gconf_cb,
&use_als_gconf_id);

mce_gconf_get_bool(MCE_GCONF_DISPLAY_ALS_ENABLED_PATH,
mce_gconf_get_bool(MCE_GCONF_DISPLAY_ALS_ENABLED,
&use_als_flag);

/* Color profile setting */
mce_gconf_notifier_add(MCE_GCONF_DISPLAY_PATH,
MCE_GCONF_DISPLAY_COLOR_PROFILE_PATH,
MCE_GCONF_DISPLAY_COLOR_PROFILE,
color_profile_gconf_cb,
&color_profile_gconf_id);
if( init_color_profiles() )
Expand Down
11 changes: 0 additions & 11 deletions modules/filter-brightness-als.h
Expand Up @@ -138,17 +138,6 @@ struct dipro_als {
/** Path to the second calibration point for the TSL2562 ALS */
#define ALS_CALIB1_PATH_TSL2562 ALS_PATH_TSL2562 "/calib1"

#ifndef MCE_GCONF_DISPLAY_PATH
/** Path to the GConf settings for the display */
# define MCE_GCONF_DISPLAY_PATH "/system/osso/dsm/display"
#endif

/** Path to the ALS enabled GConf setting */
#define MCE_GCONF_DISPLAY_ALS_ENABLED_PATH MCE_GCONF_DISPLAY_PATH "/als_enabled"

/** Path to the color profile GConf setting */
#define MCE_GCONF_DISPLAY_COLOR_PROFILE_PATH MCE_GCONF_DISPLAY_PATH "/color_profile"

/** Default ALS polling frequency when the display is on */
#define ALS_DISPLAY_ON_POLL_FREQ 1500 /* Milliseconds */

Expand Down
4 changes: 2 additions & 2 deletions tools/mcetool.c
Expand Up @@ -2430,7 +2430,7 @@ static bool xmce_set_als_mode(const char *args)
{
debugf("%s(%s)\n", __FUNCTION__, args);
gboolean val = xmce_parse_enabled(args);
mcetool_gconf_set_bool(MCE_GCONF_DISPLAY_ALS_ENABLED_PATH, val);
mcetool_gconf_set_bool(MCE_GCONF_DISPLAY_ALS_ENABLED, val);
return true;
}

Expand All @@ -2441,7 +2441,7 @@ static void xmce_get_als_mode(void)
gboolean val = 0;
char txt[32] = "unknown";

if( mcetool_gconf_get_bool(MCE_GCONF_DISPLAY_ALS_ENABLED_PATH, &val) )
if( mcetool_gconf_get_bool(MCE_GCONF_DISPLAY_ALS_ENABLED, &val) )
snprintf(txt, sizeof txt, "%s", val ? "enabled" : "disabled");
printf("%-"PAD1"s %s\n", "Use als mode:", txt);
}
Expand Down

0 comments on commit f02a416

Please sign in to comment.