diff options
-rw-r--r-- | src/brightness.c | 22 | ||||
-rw-r--r-- | src/service.c | 8 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/brightness.c b/src/brightness.c index 070305e..89613ab 100644 --- a/src/brightness.c +++ b/src/brightness.c @@ -201,12 +201,12 @@ on_powerd_brightness_params_ready(GObject * source, &p->powerd_max, &p->powerd_dflt, &p->powerd_ab_supported); - g_message("powerd brightness settings: dim=%d, min=%d, max=%d, dflt=%d, ab_supported=%d", - p->powerd_dim, - p->powerd_min, - p->powerd_max, - p->powerd_dflt, - (int)p->powerd_ab_supported); + g_debug("powerd brightness settings: dim=%d, min=%d, max=%d, dflt=%d, ab_supported=%d", + p->powerd_dim, + p->powerd_min, + p->powerd_max, + p->powerd_dflt, + (int)p->powerd_ab_supported); /* uscreen doesn't have a get_brightness() function, so the only way to know the value is to initialize it ourselves @@ -302,7 +302,7 @@ set_uscreen_user_brightness(IndicatorPowerBrightness * self, "/com/canonical/Unity/Screen", "com.canonical.Unity.Screen", "setUserBrightness", - g_variant_new_int32(value), + g_variant_new("(i)", value), NULL, /* no return args */ G_DBUS_CALL_FLAGS_NONE, -1, /* default timeout */ @@ -346,8 +346,8 @@ indicator_power_brightness_class_init (IndicatorPowerBrightnessClass * klass) properties[PROP_PERCENTAGE] = g_param_spec_double("percentage", "Percentage", "Brightness percentage", - 0.1, /* don't allow completely black */ - 1.0, /* brightest */ + 0.0, /* minimum */ + 1.0, /* maximum */ 0.8, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS); @@ -375,6 +375,10 @@ indicator_power_brightness_set_percentage(IndicatorPowerBrightness * self, g_return_if_fail(INDICATOR_IS_POWER_BRIGHTNESS(self)); p = get_priv(self); + + g_debug("%s called; current value is %.2f, desired value is %.2f", + G_STRFUNC, p->percentage, percentage); + if ((int)(p->percentage*100) != (int)(percentage*100)) { set_uscreen_user_brightness(self, percentage_to_brightness(self, percentage)); diff --git a/src/service.c b/src/service.c index 35be231..0415881 100644 --- a/src/service.c +++ b/src/service.c @@ -464,7 +464,7 @@ create_brightness_menu_item(void) item = g_menu_item_new(NULL, "indicator.brightness"); g_menu_item_set_attribute(item, "x-canonical-type", "s", "com.canonical.unity.slider"); - g_menu_item_set_attribute(item, "min-value", "d", 0.1); + g_menu_item_set_attribute(item, "min-value", "d", 0.0); g_menu_item_set_attribute(item, "max-value", "d", 1.0); g_menu_item_set_attribute(item, "min-icon", "s", "torch-off" ); g_menu_item_set_attribute(item, "max-icon", "s", "torch-on" ); @@ -476,9 +476,7 @@ static GVariant * action_state_for_brightness (IndicatorPowerService * self) { IndicatorPowerBrightness * b = self->priv->brightness; - GVariant * v = g_variant_new_double(indicator_power_brightness_get_percentage(b)); - g_message("new brightness action state: %s", g_variant_print(v, TRUE)); - return v; + return g_variant_new_double(indicator_power_brightness_get_percentage(b)); } static void @@ -1015,7 +1013,7 @@ indicator_power_service_init (IndicatorPowerService * self) p->notifier = indicator_power_notifier_new (); p->brightness = indicator_power_brightness_new(); - g_signal_connect_swapped(p->brightness, "notify::perentage", + g_signal_connect_swapped(p->brightness, "notify::percentage", G_CALLBACK(update_brightness_action_state), self); init_gactions (self); |