diff options
author | Ali Abdallah <ali.slackware@gmail.com> | 2009-04-07 11:23:27 +0000 |
---|---|---|
committer | Ali Abdallah <ali.slackware@gmail.com> | 2009-04-07 11:23:27 +0000 |
commit | 2feff966fb90ce98c05c4b8c5827c5a3f50454f0 (patch) | |
tree | 7e571ee3e24032aead76fe225b616a5edb9c52ff /src/xfpm-backlight.c | |
parent | 6d6690be78a02d4130368f1fb7a86e1fe4d4d486 (diff) | |
download | ixfce4-power-manager-2feff966fb90ce98c05c4b8c5827c5a3f50454f0.tar.gz |
Implement a clean way to restart HAL related objects when HALD restarts
(Old svn revision: 7130)
Diffstat (limited to 'src/xfpm-backlight.c')
-rw-r--r-- | src/xfpm-backlight.c | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/src/xfpm-backlight.c b/src/xfpm-backlight.c index 2a76f9c0..a60f386d 100644 --- a/src/xfpm-backlight.c +++ b/src/xfpm-backlight.c @@ -66,24 +66,9 @@ xfpm_backlight_brightness_down (XfpmBrightnessHal *brg, guint level, XfpmBacklig } static void -xfpm_backlight_class_init(XfpmBacklightClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS(klass); - - object_class->finalize = xfpm_backlight_finalize; - - g_type_class_add_private(klass,sizeof(XfpmBacklightPrivate)); - - xfpm_backlight_dbus_class_init (klass); -} - -static void -xfpm_backlight_init(XfpmBacklight *bk) +xfpm_backlight_get_device (XfpmBacklight *bk) { guint max_level; - - bk->priv = XFPM_BACKLIGHT_GET_PRIVATE(bk); - bk->priv->br = xfpm_brightness_hal_new (); bk->priv->has_hw = xfpm_brightness_hal_has_hw (bk->priv->br); @@ -103,6 +88,27 @@ xfpm_backlight_init(XfpmBacklight *bk) max_level -1 ); } +} + +static void +xfpm_backlight_class_init(XfpmBacklightClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS(klass); + + object_class->finalize = xfpm_backlight_finalize; + + g_type_class_add_private(klass,sizeof(XfpmBacklightPrivate)); + + xfpm_backlight_dbus_class_init (klass); +} + +static void +xfpm_backlight_init(XfpmBacklight *bk) +{ + bk->priv = XFPM_BACKLIGHT_GET_PRIVATE(bk); + + xfpm_backlight_get_device (bk); + xfpm_backlight_dbus_init (bk); } @@ -175,3 +181,16 @@ gboolean xfpm_backlight_has_hw (XfpmBacklight *bk) return bk->priv->has_hw; } + +void xfpm_backlight_reload (XfpmBacklight *bk) +{ + g_return_if_fail (XFPM_IS_BACKLIGHT (bk)); + + if ( bk->priv->has_hw == TRUE ) + { + g_object_unref (bk->priv->br); + g_object_unref (bk->priv->widget); + } + + xfpm_backlight_get_device (bk); +} |