[Goodies-commits] r6991 - in xfce4-power-manager/tags/0.6.5: . po src

Ali Abdallah aliov at xfce.org
Tue Mar 24 19:05:31 CET 2009


Author: aliov
Date: 2009-03-24 18:05:31 +0000 (Tue, 24 Mar 2009)
New Revision: 6991

Added:
   xfce4-power-manager/tags/0.6.5/src/org.freedesktop.PowerManagement.Inhibit.xml
   xfce4-power-manager/tags/0.6.5/src/xfce4-power-manager-settings.desktop.in
   xfce4-power-manager/tags/0.6.5/src/xfpm-inhibit.c
   xfce4-power-manager/tags/0.6.5/src/xfpm-inhibit.h
   xfce4-power-manager/tags/0.6.5/src/xfpm-screen-saver.c
   xfce4-power-manager/tags/0.6.5/src/xfpm-screen-saver.h
Modified:
   xfce4-power-manager/tags/0.6.5/ChangeLog
   xfce4-power-manager/tags/0.6.5/INSTALL
   xfce4-power-manager/tags/0.6.5/configure.ac.in
   xfce4-power-manager/tags/0.6.5/po/POTFILES.in
   xfce4-power-manager/tags/0.6.5/src/Makefile.am
   xfce4-power-manager/tags/0.6.5/src/org.xfce.Power.Manager.xml
   xfce4-power-manager/tags/0.6.5/src/xfce4-power-manager.desktop.in
   xfce4-power-manager/tags/0.6.5/src/xfpm-dpms.c
   xfce4-power-manager/tags/0.6.5/src/xfpm-driver.c
   xfce4-power-manager/tags/0.6.5/src/xfpm-lcd-brightness.c
   xfce4-power-manager/tags/0.6.5/src/xfpm-main.c
Log:
Commit changed made for 0.6.5

Modified: xfce4-power-manager/tags/0.6.5/ChangeLog
===================================================================
--- xfce4-power-manager/tags/0.6.5/ChangeLog	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/ChangeLog	2009-03-24 18:05:31 UTC (rev 6991)
@@ -1,3 +1,6 @@
+
+2009-03-24 19:05 Ali aliov at xfce.org 
+	 * : Commit changed made for 0.6.5
 2009-03-02 14:30 Ali
 	
 	*: Tag 0.6.4, removed the panel plugin for now

Modified: xfce4-power-manager/tags/0.6.5/INSTALL
===================================================================
--- xfce4-power-manager/tags/0.6.5/INSTALL	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/INSTALL	2009-03-24 18:05:31 UTC (rev 6991)
@@ -2,15 +2,15 @@
 *************************
 
 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007 Free Software Foundation, Inc.
+2006, 2007, 2008 Free Software Foundation, Inc.
 
-This file is free documentation; the Free Software Foundation gives
+   This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
 
 Basic Installation
 ==================
 
-Briefly, the shell commands `./configure; make; make install' should
+   Briefly, the shell commands `./configure; make; make install' should
 configure, build, and install this package.  The following
 more-detailed instructions are generic; see the `README' file for
 instructions specific to this package.
@@ -73,9 +73,9 @@
 Compilers and Options
 =====================
 
-Some systems require unusual options for compilation or linking that the
-`configure' script does not know about.  Run `./configure --help' for
-details on some of the pertinent environment variables.
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
 
    You can give `configure' initial values for configuration parameters
 by setting variables in the command line or in the environment.  Here
@@ -88,7 +88,7 @@
 Compiling For Multiple Architectures
 ====================================
 
-You can compile the package for more than one kind of computer at the
+   You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
 own directory.  To do this, you can use GNU `make'.  `cd' to the
 directory where you want the object files and executables to go and run
@@ -100,10 +100,24 @@
 installed the package for one architecture, use `make distclean' before
 reconfiguring for another architecture.
 
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
 Installation Names
 ==================
 
-By default, `make install' installs the package's commands under
+   By default, `make install' installs the package's commands under
 `/usr/local/bin', include files under `/usr/local/include', etc.  You
 can specify an installation prefix other than `/usr/local' by giving
 `configure' the option `--prefix=PREFIX'.
@@ -126,7 +140,7 @@
 Optional Features
 =================
 
-Some packages pay attention to `--enable-FEATURE' options to
+   Some packages pay attention to `--enable-FEATURE' options to
 `configure', where FEATURE indicates an optional part of the package.
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 is something like `gnu-as' or `x' (for the X Window System).  The
@@ -138,14 +152,36 @@
 you can use the `configure' options `--x-includes=DIR' and
 `--x-libraries=DIR' to specify their locations.
 
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
 Specifying the System Type
 ==========================
 
-There may be some features `configure' cannot figure out automatically,
-but needs to determine by the type of machine the package will run on.
-Usually, assuming the package is built to be run on the _same_
-architectures, `configure' can figure that out, but if it prints a
-message saying it cannot guess the machine type, give it the
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
 `--build=TYPE' option.  TYPE can either be a short name for the system
 type, such as `sun4', or a canonical name which has the form:
 
@@ -171,9 +207,9 @@
 Sharing Defaults
 ================
 
-If you want to set default values for `configure' scripts to share, you
-can create a site shell script called `config.site' that gives default
-values for variables like `CC', `cache_file', and `prefix'.
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
 `configure' looks for `PREFIX/share/config.site' if it exists, then
 `PREFIX/etc/config.site' if it exists.  Or, you can set the
 `CONFIG_SITE' environment variable to the location of the site script.
@@ -182,7 +218,7 @@
 Defining Variables
 ==================
 
-Variables not defined in a site shell script can be set in the
+   Variables not defined in a site shell script can be set in the
 environment passed to `configure'.  However, some packages may run
 configure again during the build, and the customized values of these
 variables may be lost.  In order to avoid this problem, you should set
@@ -201,12 +237,20 @@
 `configure' Invocation
 ======================
 
-`configure' recognizes the following options to control how it operates.
+   `configure' recognizes the following options to control how it
+operates.
 
 `--help'
 `-h'
-     Print a summary of the options to `configure', and exit.
+     Print a summary of all of the options to `configure', and exit.
 
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
 `--version'
 `-V'
      Print the version of Autoconf used to generate the `configure'
@@ -232,6 +276,16 @@
      Look for the package's source code in directory DIR.  Usually
      `configure' can determine that directory automatically.
 
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *Note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
 `configure' also accepts some other, not widely useful, options.  Run
 `configure --help' for more details.
 

Modified: xfce4-power-manager/tags/0.6.5/configure.ac.in
===================================================================
--- xfce4-power-manager/tags/0.6.5/configure.ac.in	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/configure.ac.in	2009-03-24 18:05:31 UTC (rev 6991)
@@ -1,7 +1,7 @@
-m4_define([intltool_minimum_version], [0.31])
+m4_define([intltool_minimum_version], [0.35])
 m4_define([xfpm_version_major],  [0])
 m4_define([xfpm_version_minor],  [6])
-m4_define([xfpm_version_micro],  [4])
+m4_define([xfpm_version_micro],  [5])
 m4_define([xfpm_version_build],  [r at REVISION@])
 m4_define([xfpm_version_tag],[])
 m4_define([xfpm_version], [xfpm_version_major().xfpm_version_minor().xfpm_version_micro()ifelse(xfpm_version_tag(), [svn], [xfpm_version_tag().xfpm_version_build()], [xfpm_version_tag()])])

Modified: xfce4-power-manager/tags/0.6.5/po/POTFILES.in
===================================================================
--- xfce4-power-manager/tags/0.6.5/po/POTFILES.in	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/po/POTFILES.in	2009-03-24 18:05:31 UTC (rev 6991)
@@ -9,4 +9,6 @@
 src/xfpm-hal.c
 src/xfpm-dbus-messages.c
 src/xfpm-settings-main.c
+src/xfpm-inhibit.c
 src/xfce4-power-manager.desktop.in
+src/xfce4-power-manager-settings.desktop.in

Modified: xfce4-power-manager/tags/0.6.5/src/Makefile.am
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/Makefile.am	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/src/Makefile.am	2009-03-24 18:05:31 UTC (rev 6991)
@@ -10,6 +10,7 @@
 
 xfce4_power_manager_SOURCES = 			\
 	$(generated_files)			\
+	org.freedesktop.PowerManagement.Inhibit.h\
 	xfce-power-manager-dbus-server.h	\
 	xfce-power-manager-dbus-client.h	\
 	xfpm-main.c				\
@@ -34,6 +35,10 @@
 	xfpm-battery-icon.h			\
 	xfpm-dpms.c				\
 	xfpm-dpms.h				\
+	xfpm-inhibit.c				\
+	xfpm-inhibit.h				\
+	xfpm-screen-saver.c			\
+	xfpm-screen-saver.h			\
 	xfpm-popups.c           		\
 	xfpm-popups.h           		\
 	xfpm-notify.c				\
@@ -70,7 +75,6 @@
 	$(LIBNOTIFY_LIBS)			\
 	$(DPMS_LIBS)		
 
-
 xfce4_power_manager_settings_SOURCES =		\
 	xfpm-marshal.c				\
 	xfpm-marshal.h				\
@@ -123,6 +127,7 @@
 BUILT_SOURCES = 				\
 	xfce-power-manager-dbus-server.h	\
 	xfce-power-manager-dbus-client.h	\
+	org.freedesktop.PowerManagement.Inhibit.h\
 	xfpm-marshal.c				\
 	xfpm-marshal.h				\
 	xfpm-enum-types.c			\
@@ -168,21 +173,31 @@
 xfce-power-manager-dbus-client.h: $(srcdir)/org.xfce.Power.Manager.xml
 	dbus-binding-tool --mode=glib-client --prefix=xfpm_client $< >$@
 
+org.freedesktop.PowerManagement.Inhibit.h: $(srcdir)/org.freedesktop.PowerManagement.Inhibit.xml
+	dbus-binding-tool --mode=glib-server --prefix=xfpm_inhibit $< >$@
+
 endif
 
 #
-# .desktop file
+# .desktop files
 #
-desktop_in_files = xfce4-power-manager.desktop.in
+ at INTLTOOL_DESKTOP_RULE@
 desktopdir = $(datadir)/applications
+desktop_in_files = xfce4-power-manager-settings.desktop.in
 desktop_DATA =	$(desktop_in_files:.desktop.in=.desktop)
 
 @INTLTOOL_DESKTOP_RULE@
+autostartdir = $(sysconfdir)/xdg/autostart
+autostart_in_files = xfce4-power-manager.desktop.in
+autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
 
+
 EXTRA_DIST = 					\
 	xfpm-marshal.list			\
-	$(desktop_in_files)
+	$(desktop_in_files)			\
+	$(autostart_in_files)
 
 DISTCLEANFILES =				\
 	$(BUILT_SOURCES)			\
-	$(desktop_DATA)
\ No newline at end of file
+	xfce4-power-manager.desktop		\
+	xfce4-power-manager-settings.desktop
\ No newline at end of file

Added: xfce4-power-manager/tags/0.6.5/src/org.freedesktop.PowerManagement.Inhibit.xml
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/org.freedesktop.PowerManagement.Inhibit.xml	                        (rev 0)
+++ xfce4-power-manager/tags/0.6.5/src/org.freedesktop.PowerManagement.Inhibit.xml	2009-03-24 18:05:31 UTC (rev 6991)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<node name="/org/freedesktop/PowerManagement/Inhibit">
+    <interface name="org.freedesktop.PowerManagement.Inhibit">
+        <annotation name="org.freedesktop.DBus.GLib.CSymbol"
+                    value="xfpm_inhibit_dbus"/>
+        <annotation name="org.freedesktop.DBus.GLib.ClientCSymbol"
+                    value="xfpm_inhibit_dbus_client"/>   
+
+    <method name="Inhibit">
+      <arg type="s" name="application" direction="in"/>
+      <arg type="s" name="reason" direction="in"/>
+      <arg type="u" name="cookie" direction="out"/>
+    </method>
+    
+    <method name="UnInhibit">
+      <arg type="u" name="cookie" direction="in"/>
+    </method>
+    
+    <method name="HasInhibit">
+      <arg type="b" name="has_inhibit" direction="out"/>
+    </method>
+    
+    <signal name="HasInhibitChanged">
+      <arg type="b" name="has_inhibit_changed" direction="out"/>
+    </signal>
+    
+    </interface>
+    
+</node>

Modified: xfce4-power-manager/tags/0.6.5/src/org.xfce.Power.Manager.xml
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/org.xfce.Power.Manager.xml	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/src/org.xfce.Power.Manager.xml	2009-03-24 18:05:31 UTC (rev 6991)
@@ -26,5 +26,8 @@
         <arg direction="out" name="vendor" type="s"/>
     </method>
 	
+    <method name="Reload">
+    </method>
+	
     </interface>
 </node>

Added: xfce4-power-manager/tags/0.6.5/src/xfce4-power-manager-settings.desktop.in
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfce4-power-manager-settings.desktop.in	                        (rev 0)
+++ xfce4-power-manager/tags/0.6.5/src/xfce4-power-manager-settings.desktop.in	2009-03-24 18:05:31 UTC (rev 6991)
@@ -0,0 +1,16 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+_Name=Xfce 4 Power Manager
+_GenericName=Power Manager
+_X-XfceSettingsName=Power
+_Comment=Settings for the Xfce 4 Power Manager
+Exec=xfce4-power-manager-settings
+Icon=gpm-ac-adapter
+Terminal=false
+Type=Application
+Categories=X-XFCE;Settings;DesktopSettings;X-XfceSettingsDialog;
+OnlyShowIn=XFCE;
+StartupNotify=true
+X-XfcePluggable=true
+X-XfceHelpFile=xfce4-power-manager.html

Modified: xfce4-power-manager/tags/0.6.5/src/xfce4-power-manager.desktop.in
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfce4-power-manager.desktop.in	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/src/xfce4-power-manager.desktop.in	2009-03-24 18:05:31 UTC (rev 6991)
@@ -1,16 +1,9 @@
 [Desktop Entry]
-Version=1.0
-Encoding=UTF-8
-_Name=Xfce 4 Power Manager
-_GenericName=Power Manager
-_X-XfceSettingsName=Power
-_Comment=Settings for the Xfce 4 Power Manager
-Exec=xfce4-power-manager-settings
+_Name=Xfce Power Manager
+_Comment=Power management for the Xfce desktop
 Icon=gpm-ac-adapter
+Exec=xfce4-power-manager
 Terminal=false
 Type=Application
-Categories=X-XFCE;Settings;DesktopSettings;X-XfceSettingsDialog;
 OnlyShowIn=XFCE;
-StartupNotify=true
-X-XfcePluggable=true
-X-XfceHelpFile=xfce4-power-manager.html
+StartupNotify=false
\ No newline at end of file

Modified: xfce4-power-manager/tags/0.6.5/src/xfpm-dpms.c
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfpm-dpms.c	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/src/xfpm-dpms.c	2009-03-24 18:05:31 UTC (rev 6991)
@@ -56,6 +56,7 @@
 
 #include "xfpm-common.h"
 #include "xfpm-debug.h"
+#include "xfpm-inhibit.h"
 
 #ifndef _
 #define _(x) x
@@ -85,9 +86,14 @@
 static void xfpm_dpms_notify_cb        (GObject *object,
                                         GParamSpec *arg1,
                                         gpointer data);  
+					
+static void xfpm_dpms_inhibit_changed_cb (XfpmInhibit *inhibit, gboolean inhibited, XfpmDpms *dpms);
+
 struct XfpmDpmsPrivate
 {
+    XfpmInhibit *inhibit;
     gboolean dpms_capable;
+    gboolean inhibited;
 };
 
 G_DEFINE_TYPE(XfpmDpms,xfpm_dpms,G_TYPE_OBJECT)
@@ -134,7 +140,12 @@
     priv = XFPM_DPMS_GET_PRIVATE(dpms);
     
     priv->dpms_capable = DPMSCapable(GDK_DISPLAY());
+    priv->inhibit = xfpm_inhibit_new ();
+    priv->inhibited = FALSE;
     
+    g_signal_connect (priv->inhibit, "has_inhibit_changed", 
+		      G_CALLBACK (xfpm_dpms_inhibit_changed_cb), dpms);
+    
     xfpm_dpms_load_config(dpms);
     
     g_signal_connect(G_OBJECT(dpms),"notify",G_CALLBACK(xfpm_dpms_notify_cb),NULL);
@@ -205,6 +216,8 @@
     dpms = XFPM_DPMS(object);
     dpms->priv = XFPM_DPMS_GET_PRIVATE(dpms);
     
+    g_object_unref (dpms->priv->inhibit);
+    
     G_OBJECT_CLASS(xfpm_dpms_parent_class)->finalize(object);
     
 }
@@ -278,8 +291,13 @@
     
     DPMSInfo(GDK_DISPLAY(),&state,&on_off);
 
-    if ( !on_off && dpms->dpms_enabled )
+    if ( priv->inhibited )
     {
+	XFPM_DEBUG("DPMS is inhibited, disabling it\n");
+	DPMSDisable (GDK_DISPLAY());
+    }
+    else if ( !on_off && dpms->dpms_enabled )
+    {
         XFPM_DEBUG("DPMS is disabled, enabling it: user settings\n");
         DPMSEnable(GDK_DISPLAY());
         g_object_notify(G_OBJECT(dpms),"dpms");
@@ -296,7 +314,17 @@
 static void
 xfpm_dpms_set_timeouts(XfpmDpms *dpms)
 {
+    XfpmDpmsPrivate *priv;
+    priv = XFPM_DPMS_GET_PRIVATE (dpms);
+    
+    if ( priv->inhibited )
+    {
+	XFPM_DEBUG("Not settings timeouts, dpms is currently inhibited\b");
+	return;
+    }
+	
     CARD16 x_standby = 0 ,x_suspend = 0,x_off = 0;
+    
     DPMSGetTimeouts(GDK_DISPLAY(),&x_standby,&x_suspend,&x_off);
     
     if ( dpms->ac_adapter_present )
@@ -324,6 +352,16 @@
     }
 }
 
+static void xfpm_dpms_inhibit_changed_cb (XfpmInhibit *inhibit, gboolean inhibited, XfpmDpms *dpms)
+{
+    XfpmDpmsPrivate *priv;
+    priv = XFPM_DPMS_GET_PRIVATE (dpms);
+    
+    priv->inhibited = inhibited;
+    xfpm_dpms_set_dpms_mode (dpms);
+    xfpm_dpms_set_timeouts (dpms);
+}
+
 static void
 xfpm_dpms_notify_cb(GObject *object,GParamSpec *arg1,gpointer data)
 {

Modified: xfce4-power-manager/tags/0.6.5/src/xfpm-driver.c
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfpm-driver.c	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/src/xfpm-driver.c	2009-03-24 18:05:31 UTC (rev 6991)
@@ -1024,6 +1024,8 @@
     XfpmDriverPrivate *priv = XFPM_DRIVER_GET_PRIVATE(drv);
     
     xfpm_dbus_release_name(dbus_g_connection_get_connection(priv->bus), "org.xfce.PowerManager");
+    xfpm_dbus_release_name(dbus_g_connection_get_connection(priv->bus), "org.freedesktop.PowerManagement");
+    xfpm_dbus_release_name(dbus_g_connection_get_connection(priv->bus), "org.freedesktop.PowerManagement.Inhibit");
     
     g_main_loop_quit(priv->loop);
     g_object_unref(drv);
@@ -1062,6 +1064,7 @@
     }
     
     GError *g_error = NULL;
+    
     if ( !xfconf_init(&g_error) )
     {
         g_critical("xfconf init failed: %s using default settings\n",g_error->message);
@@ -1078,6 +1081,8 @@
     }
     
     xfpm_dbus_register_name(dbus_g_connection_get_connection(priv->bus), "org.xfce.PowerManager");
+    xfpm_dbus_register_name(dbus_g_connection_get_connection(priv->bus), "org.freedesktop.PowerManagement");
+    xfpm_dbus_register_name(dbus_g_connection_get_connection(priv->bus), "org.freedesktop.PowerManagement.Inhibit");
     
     xfpm_driver_load_config(drv);    
     _get_system_form_factor(priv);
@@ -1117,6 +1122,8 @@
 					    gchar **OUT_vendor,
 					    GError **error);
 
+static gboolean  xfpm_driver_dbus_reload (XfpmDriver *driver, GError **error);
+
 #include "xfce-power-manager-dbus-server.h"
 
 static void
@@ -1206,3 +1213,16 @@
     
     return TRUE;
 }
+
+static gboolean 
+xfpm_driver_dbus_reload (XfpmDriver *driver, GError **error)
+{
+    XFPM_DEBUG("Reload message received\n");
+    
+    xfpm_driver_quit (driver);
+    /*Stupid, but the way 0.6 is is hard to have a clean reload*/
+    g_spawn_command_line_async ("xfce4-power-manager", NULL);
+    
+    
+    return TRUE;
+}

Added: xfce4-power-manager/tags/0.6.5/src/xfpm-inhibit.c
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfpm-inhibit.c	                        (rev 0)
+++ xfce4-power-manager/tags/0.6.5/src/xfpm-inhibit.c	2009-03-24 18:05:31 UTC (rev 6991)
@@ -0,0 +1,314 @@
+/*
+ * * Copyright (C) 2008-2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#include <glib.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "xfpm-inhibit.h"
+#include "xfpm-screen-saver.h"
+
+/* Init */
+static void xfpm_inhibit_class_init (XfpmInhibitClass *klass);
+static void xfpm_inhibit_init       (XfpmInhibit *inhibit);
+static void xfpm_inhibit_finalize   (GObject *object);
+
+static void xfpm_inhibit_dbus_class_init  (XfpmInhibitClass *klass);
+static void xfpm_inhibit_dbus_init	  (XfpmInhibit *inhibit);
+
+#define XFPM_INHIBIT_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_INHIBIT, XfpmInhibitPrivate))
+
+GQuark
+xfpm_inhibit_get_error_quark (void)
+{
+    static GQuark quark = 0;
+    if (!quark)
+	quark = g_quark_from_static_string ("Xfce Power Manager inhibit");
+	
+    return quark;
+}
+
+GType
+xfpm_inhibit_error_get_type (void)
+{
+    static GType type = 0;
+    
+    if (!type)
+    {
+	static const GEnumValue values[] = {
+	    { XFPM_INHIBIT_ERROR_UNKNOWN, "XFPM_INHIBIT_ERROR_UNKNOWN", "Unknown" },
+	    { XFPM_INHIBIT_ERROR_INVALID_COOKIE, "XFPM_INHIBIT_ERROR_INVALID_COOKIE", "InvalidCookie" },
+	    { 0, NULL, NULL }
+	};
+	
+	type = g_enum_register_static ("XfpmInhibitError", values);
+    }
+    
+    return type;
+}
+
+struct XfpmInhibitPrivate
+{
+    XfpmScreenSaver *srv;
+    GHashTable      *hash;
+    gboolean         inhibited;
+};
+
+enum
+{
+    HAS_INHIBIT_CHANGED,
+    LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static gpointer xfpm_inhibit_object = NULL;
+
+G_DEFINE_TYPE (XfpmInhibit, xfpm_inhibit, G_TYPE_OBJECT)
+
+static void
+xfpm_inhibit_screen_saver_inhibited_cb (XfpmScreenSaver *srv, gboolean is_inhibited, XfpmInhibit *inhibit)
+{
+    inhibit->priv->inhibited = is_inhibited;
+    g_signal_emit (G_OBJECT(inhibit), signals[HAS_INHIBIT_CHANGED], 0, is_inhibited);
+}
+
+static void
+xfpm_inhibit_class_init(XfpmInhibitClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
+
+    signals[HAS_INHIBIT_CHANGED] =
+	    g_signal_new("has-inhibit-changed",
+			 XFPM_TYPE_INHIBIT,
+			 G_SIGNAL_RUN_LAST,
+			 G_STRUCT_OFFSET(XfpmInhibitClass, has_inhibit_changed),
+			 NULL, NULL,
+			 g_cclosure_marshal_VOID__BOOLEAN,
+			 G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+    object_class->finalize = xfpm_inhibit_finalize;
+
+    g_type_class_add_private(klass,sizeof(XfpmInhibitPrivate));
+    
+    xfpm_inhibit_dbus_class_init (klass);
+}
+
+static void
+xfpm_inhibit_init(XfpmInhibit *inhibit)
+{
+    inhibit->priv = XFPM_INHIBIT_GET_PRIVATE(inhibit);
+    
+    inhibit->priv->hash = g_hash_table_new_full (NULL, NULL, NULL, g_free);
+    
+    inhibit->priv->srv = xfpm_screen_saver_new ();
+    
+    g_signal_connect (inhibit->priv->srv, "screen-saver-inhibited",
+		      G_CALLBACK(xfpm_inhibit_screen_saver_inhibited_cb), inhibit);
+		      
+    xfpm_inhibit_dbus_init (inhibit);
+}
+
+static void
+xfpm_inhibit_finalize(GObject *object)
+{
+    XfpmInhibit *inhibit;
+
+    inhibit = XFPM_INHIBIT(object);
+    
+    if ( inhibit->priv->srv)
+	g_object_unref (inhibit->priv->srv);
+	
+    g_hash_table_destroy (inhibit->priv->hash);
+
+    G_OBJECT_CLASS(xfpm_inhibit_parent_class)->finalize(object);
+}
+
+static guint
+xfpm_inhibit_get_cookie (XfpmInhibit *inhibit)
+{
+    GList *list;
+    guint cookie;
+    guint max = 0;
+    guint hash_cookie;
+    gint i;
+    
+    list = g_hash_table_get_keys (inhibit->priv->hash);
+
+    for ( i = 0; i < g_list_length (list); i++)
+    {
+	hash_cookie = GPOINTER_TO_INT ((gpointer) g_list_nth_data(list, i));
+	max = MAX(max, hash_cookie);
+    }
+	
+    if ( list )
+	g_list_free (list);
+	
+    /*
+     * Should work in all the cases as we will not have thounsands of applications inhibiting us
+     */
+    cookie = (guint) g_random_int_range ( max + 1, max + 40);
+    
+    return cookie;
+}
+
+static guint
+xfpm_inhibit_add_application (XfpmInhibit *inhibit, const gchar *app_name)
+{
+    guint cookie = xfpm_inhibit_get_cookie (inhibit);
+    g_hash_table_insert (inhibit->priv->hash, 
+			 GINT_TO_POINTER(cookie),
+			 g_strdup (app_name));
+    return cookie;
+}
+
+static gboolean
+xfpm_inhibit_remove_application (XfpmInhibit *inhibit, guint cookie)
+{
+    return g_hash_table_remove (inhibit->priv->hash, GINT_TO_POINTER(cookie));
+}
+
+XfpmInhibit *
+xfpm_inhibit_new(void)
+{
+    if ( xfpm_inhibit_object != NULL )
+    {
+	g_object_ref (xfpm_inhibit_object);
+    }
+    else
+    {
+	xfpm_inhibit_object = g_object_new (XFPM_TYPE_INHIBIT, NULL);
+	g_object_add_weak_pointer (xfpm_inhibit_object, &xfpm_inhibit_object);
+    }
+    return XFPM_INHIBIT (xfpm_inhibit_object);
+}
+
+/*
+ * 
+ * DBus server implementation for org.freedesktop.PowerManagement.Inhibit
+ * 
+ */
+static gboolean xfpm_inhibit_dbus_inhibit  	(XfpmInhibit *inhibit,
+						 const gchar *IN_appname,
+						 const gchar *IN_reason,
+						 guint       *OUT_cookie,
+						 GError     **error);
+
+static gboolean xfpm_inhibit_dbus_un_inhibit    (XfpmInhibit *inhibit,
+						 guint        IN_cookie,
+						 GError     **error);
+
+static gboolean xfpm_inhibit_dbus_has_inhibit   (XfpmInhibit *inhibit,
+						 gboolean    *OUT_has_inhibit,
+						 GError     **error);
+
+#include "org.freedesktop.PowerManagement.Inhibit.h"
+
+static void xfpm_inhibit_dbus_class_init  (XfpmInhibitClass *klass)
+{
+    dbus_g_object_type_install_info(G_TYPE_FROM_CLASS(klass),
+				    &dbus_glib_xfpm_inhibit_object_info);
+				    
+    dbus_g_error_domain_register (XFPM_INHIBIT_ERROR, 
+				  "org.freedesktop.PowerManagement.Inhibit",
+				  XFPM_TYPE_INHIBIT_ERROR);
+}
+
+static void xfpm_inhibit_dbus_init	  (XfpmInhibit *inhibit)
+{
+    DBusGConnection *bus = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
+    
+    dbus_g_connection_register_g_object (bus,
+					 "/org/freedesktop/PowerManagement/Inhibit",
+					 G_OBJECT(inhibit));
+}
+
+static gboolean xfpm_inhibit_dbus_inhibit  	(XfpmInhibit *inhibit,
+						 const gchar *IN_appname,
+						 const gchar *IN_reason,
+						 guint       *OUT_cookie,
+						 GError     **error)
+{
+    guint cookie = xfpm_inhibit_add_application (inhibit, IN_appname);
+    
+    TRACE("Inhibit send application name=%s reason=%s", IN_appname, IN_reason);
+    
+    if ( !inhibit->priv->inhibited )
+    {
+	inhibit->priv->inhibited = TRUE;
+	g_signal_emit (G_OBJECT(inhibit), signals[HAS_INHIBIT_CHANGED], 0, inhibit->priv->inhibited);
+    }
+    
+    *OUT_cookie = cookie;
+    
+    return TRUE;
+}
+
+static gboolean xfpm_inhibit_dbus_un_inhibit    (XfpmInhibit *inhibit,
+						 guint        IN_cookie,
+						 GError     **error)
+{
+    TRACE("UnHibit message received");
+    
+    if (!xfpm_inhibit_remove_application (inhibit, IN_cookie))
+    {
+	g_set_error (error, XFPM_INHIBIT_ERROR, XFPM_INHIBIT_ERROR_INVALID_COOKIE, _("Invalid cookie"));
+	return FALSE;
+    }
+    
+    if ( g_hash_table_size (inhibit->priv->hash) == 0)
+    {
+	TRACE("Inhibit removed");
+	inhibit->priv->inhibited = FALSE;
+	g_signal_emit (G_OBJECT(inhibit), signals[HAS_INHIBIT_CHANGED], 0, inhibit->priv->inhibited);
+    }
+    
+    return TRUE;
+}
+
+static gboolean xfpm_inhibit_dbus_has_inhibit   (XfpmInhibit *inhibit,
+						 gboolean    *OUT_has_inhibit,
+						 GError     **error)
+{
+    TRACE("Has Inhibit message received");
+    
+    *OUT_has_inhibit = inhibit->priv->inhibited;
+    
+    return TRUE;
+}

Added: xfce4-power-manager/tags/0.6.5/src/xfpm-inhibit.h
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfpm-inhibit.h	                        (rev 0)
+++ xfce4-power-manager/tags/0.6.5/src/xfpm-inhibit.h	2009-03-24 18:05:31 UTC (rev 6991)
@@ -0,0 +1,68 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __XFPM_INHIBIT_H
+#define __XFPM_INHIBIT_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define XFPM_TYPE_INHIBIT        (xfpm_inhibit_get_type () )
+#define XFPM_INHIBIT(o)          (G_TYPE_CHECK_INSTANCE_CAST((o), XFPM_TYPE_INHIBIT, XfpmInhibit))
+#define XFPM_IS_INHIBIT(o)       (G_TYPE_CHECK_INSTANCE_TYPE((o), XFPM_TYPE_INHIBIT))
+
+#define XFPM_TYPE_INHIBIT_ERROR  (xfpm_inhibit_error_get_type ())
+#define XFPM_INHIBIT_ERROR       (xfpm_inhibit_get_error_quark ())
+
+typedef enum
+{
+    XFPM_INHIBIT_ERROR_UNKNOWN = 0,
+    XFPM_INHIBIT_ERROR_INVALID_COOKIE
+    
+} XfpmInhibitError;
+
+typedef struct XfpmInhibitPrivate XfpmInhibitPrivate;
+
+typedef struct
+{
+    GObject		  parent;
+    XfpmInhibitPrivate	 *priv;
+	
+} XfpmInhibit;
+
+typedef struct
+{
+    GObjectClass 	  parent_class;
+    
+    void                  (*has_inhibit_changed)       (XfpmInhibit *inhibit,
+							gboolean is_inhibit);
+    
+} XfpmInhibitClass;
+
+GType        		  xfpm_inhibit_get_type        (void) G_GNUC_CONST;
+GType                     xfpm_inhibit_error_get_type  (void) G_GNUC_CONST;
+GQuark                    xfpm_inhibit_get_error_quark ();
+
+XfpmInhibit              *xfpm_inhibit_new             (void);
+
+G_END_DECLS
+
+#endif /* __XFPM_INHIBIT_H */

Modified: xfce4-power-manager/tags/0.6.5/src/xfpm-lcd-brightness.c
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfpm-lcd-brightness.c	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/src/xfpm-lcd-brightness.c	2009-03-24 18:05:31 UTC (rev 6991)
@@ -48,6 +48,7 @@
 #include "xfpm-debug.h"
 #include "xfpm-common.h"
 #include "xfpm-string.h"
+#include "xfpm-inhibit.h"
 
 #define XFPM_LCD_BRIGHTNESS_GET_PRIVATE(o) \
 (G_TYPE_INSTANCE_GET_PRIVATE(o,XFPM_TYPE_LCD_BRIGHTNESS,XfpmLcdBrightnessPrivate))
@@ -79,6 +80,7 @@
                                                            const gchar *condition_name,
                                                            const gchar *condition_detail,
                                                            XfpmLcdBrightness *lcd);
+
 static void xfpm_lcd_brightness_notify_cb(GObject *object,
                                           GParamSpec *arg1,
                                           gpointer data);
@@ -87,8 +89,11 @@
 {
     
     XfpmHal *hal;
+    XfpmInhibit *inhibit;
+    
     gboolean device_exists;
     gboolean brightness_in_hardware;
+    gboolean inhibited;
     gchar *udi;
     gint max_brightness;
     gint step;
@@ -132,6 +137,16 @@
 
 }
 
+static void
+xfpm_lcd_brightness_inhibit_changed_cb (XfpmInhibit *inhibit, gboolean inhibited, XfpmLcdBrightness *lcd)
+{
+    XfpmLcdBrightnessPrivate *priv;
+    priv = XFPM_LCD_BRIGHTNESS_GET_PRIVATE(lcd);
+    
+    priv->inhibited = inhibited;
+    xfpm_lcd_brightness_set_level(lcd);
+}
+
 static void xfpm_lcd_brightness_init(XfpmLcdBrightness *lcd)
 {
     XfpmLcdBrightnessPrivate *priv;
@@ -143,7 +158,10 @@
     priv->udi = NULL;
     priv->max_brightness = -1;
     priv->step = 0;
+    priv->inhibited = FALSE;
     
+    priv->inhibit = xfpm_inhibit_new ();
+    
     xfpm_lcd_brightness_load_config(lcd);
     xfpm_lcd_brightness_get_device(lcd);
     
@@ -158,7 +176,9 @@
                 g_signal_connect(priv->hal,"xfpm-device-condition",
                             G_CALLBACK(xfpm_lcd_brightness_handle_device_condition_cb),lcd);
             }
-        }                 
+        } 
+	g_signal_connect (priv->inhibit, "has_inhibit_changed", 
+			  G_CALLBACK (xfpm_lcd_brightness_inhibit_changed_cb), lcd);
     }
     
 }
@@ -178,6 +198,8 @@
         g_free(lcd->priv->udi);
     }
     
+    g_object_unref (lcd->priv->inhibit);
+    
     G_OBJECT_CLASS(xfpm_lcd_brightness_parent_class)->finalize(object);
 }
 
@@ -247,6 +269,9 @@
 {
     XfpmLcdBrightnessPrivate *priv;
     priv = XFPM_LCD_BRIGHTNESS_GET_PRIVATE(lcd);
+
+    if ( priv->inhibited )
+	return;
     
     GError *error = NULL;
     gint32 level =
@@ -477,9 +502,11 @@
 static void
 xfpm_lcd_brightness_notify_cb(GObject *object,GParamSpec *arg1,gpointer data)
 {
+    XfpmLcdBrightnessPrivate *priv;
     XfpmLcdBrightness *lcd;
     
     lcd = XFPM_LCD_BRIGHTNESS(object);
+    priv = XFPM_LCD_BRIGHTNESS_GET_PRIVATE (lcd);
     
     XFPM_DEBUG("brightness callback\n");
     
@@ -489,6 +516,12 @@
         return;
     }
     
+    if ( priv->inhibited )
+    {
+	XFPM_DEBUG("Brightness is currenctly inhibited");
+	return;
+    }
+    
     xfpm_lcd_brightness_set_level(lcd);    
 }
 

Modified: xfce4-power-manager/tags/0.6.5/src/xfpm-main.c
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfpm-main.c	2009-03-24 17:58:11 UTC (rev 6990)
+++ xfce4-power-manager/tags/0.6.5/src/xfpm-main.c	2009-03-24 18:05:31 UTC (rev 6991)
@@ -59,9 +59,11 @@
 static gboolean quit    = FALSE;
 static gboolean config  = FALSE;
 static gboolean version = FALSE;
+static gboolean reload  = FALSE;
 
 static GOptionEntry option_entries[] = {
     { "run",'r', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE,&run,NULL,NULL },
+    { "reload",'\0', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &reload, NULL, NULL},
 	{ "customize", 'c', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &config, N_("Show the configuration dialog"), NULL },
 	{ "quit", 'q', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &quit, N_("Quit any running xfce power manager"), NULL },
     { "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version, N_("Version information"), NULL },
@@ -78,81 +80,6 @@
              "Licensed under the GNU GPL.\n\n"), VERSION);
 }			 
 	
-static void
-autostart()
-{
-    const gchar *home;
-    
-    if ( ( home = getenv("HOME")) == NULL )
-    {
-        xfpm_popup_message(_("Xfce Power Manager"),
-                           _("Unable to read your home directory environment variable,"\
-						    " autostart option may not work"),
-                           GTK_MESSAGE_INFO);
-        g_warning("Unable to read HOME environment variable, autostart will not work\n");
-        return;
-    }
-    
-    gchar *dir_file;
-    
-    dir_file = g_strdup_printf("%s/.config/autostart", home);
-    
-    if ( !g_file_test(dir_file,G_FILE_TEST_IS_DIR) )
-    {
-        g_mkdir_with_parents(dir_file, 0700);
-    }
-    
-    gchar *file;
-    file = g_strdup_printf("%s/xfce4-power-manager.desktop",dir_file);
-    g_free(dir_file);
-    
-    if ( g_file_test(file,G_FILE_TEST_EXISTS) )
-    {
-        XFPM_DEBUG("xfce4 power manager autostart.desktop file already exists\n");
-        g_free(file);
-        return;
-    }
-    
-    GKeyFile *key;
-    GError *error = NULL;
-    
-    key = g_key_file_new();
-    
-    g_key_file_set_value(key,"Desktop Entry","Version","1.0");
-    g_key_file_set_string(key,"Desktop Entry","Type","Application");    
-    g_key_file_set_string(key,"Desktop Entry","Name","Xfce4 Power Manager"); 
-    g_key_file_set_string(key,"Desktop Entry","Icon","gpm-ac-adapter"); 
-    g_key_file_set_string(key,"Desktop Entry","Exec","xfce4-power-manager"); 
-    g_key_file_set_boolean(key,"Desktop Entry","StartupNotify",FALSE); 
-    g_key_file_set_boolean(key,"Desktop Entry","Terminal",FALSE); 
-    g_key_file_set_boolean(key,"Desktop Entry","Hidden",FALSE); 
-    
-    gchar *content = g_key_file_to_data(key,NULL,&error);
-    
-    if ( error )
-    {
-        g_critical("%s\n",error->message);
-        g_error_free(error);
-        g_free(file);
-        g_key_file_free(key);
-        return;
-    }
-    
-    g_file_set_contents(file,content,-1,&error);
-    
-    if ( error )
-    {
-        g_critical("Unable to set content for the autostart desktop file%s\n",error->message);
-        g_error_free(error);
-        g_free(file);
-        g_key_file_free(key);
-        return;
-    }
-    
-    g_free(file);
-    g_key_file_free(key);
-}
-
 int main(int argc,char **argv) 
 {
     xfce_textdomain (GETTEXT_PACKAGE, LOCALEDIR, "UTF-8");
@@ -267,10 +194,44 @@
         }
     }    
     
+    if ( reload )
+    {
+        if (!xfpm_dbus_name_has_owner(dbus_g_connection_get_connection(bus),  "org.xfce.PowerManager"))
+        {
+            g_print(_("Xfce power manager is not running"));
+	    g_print("\n");
+            return EXIT_SUCCESS;
+	}
+	GError *error = NULL;
+	DBusGProxy *proxy = dbus_g_proxy_new_for_name(bus, 
+						      "org.xfce.PowerManager",
+						      "/org/xfce/PowerManager",
+						      "org.xfce.Power.Manager");
+						      
+	if ( !proxy ) 
+	{
+	    g_critical ("Failed to get proxy");
+	    dbus_g_connection_unref(bus);
+	    return EXIT_SUCCESS;
+	}
+	
+	xfpm_driver_dbus_client_reload (proxy , &error);
+	
+	if ( error )
+	{
+	    g_critical("Failed to sent reload message %s", error->message);
+	    g_error_free(error);
+	}
+	
+	g_object_unref(proxy);
+	dbus_g_connection_unref(bus);
+	return EXIT_SUCCESS;
+	
+    }
+    
     if (!xfpm_dbus_name_has_owner(dbus_g_connection_get_connection(bus),  "org.xfce.PowerManager") )
     {
         XfpmDriver *driver = xfpm_driver_new(bus);
-        autostart();
         if (!xfpm_driver_monitor(driver)) 
         {
             xfpm_popup_message(_("Xfce power manager"),

Added: xfce4-power-manager/tags/0.6.5/src/xfpm-screen-saver.c
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfpm-screen-saver.c	                        (rev 0)
+++ xfce4-power-manager/tags/0.6.5/src/xfpm-screen-saver.c	2009-03-24 18:05:31 UTC (rev 6991)
@@ -0,0 +1,204 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#include <glib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "xfpm-dbus-messages.h"
+
+#include "xfpm-screen-saver.h"
+
+/* Init */
+static void xfpm_screen_saver_class_init (XfpmScreenSaverClass *klass);
+static void xfpm_screen_saver_init       (XfpmScreenSaver *srv);
+static void xfpm_screen_saver_finalize   (GObject *object);
+
+#define XFPM_SCREEN_SAVER_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_SCREEN_SAVER, XfpmScreenSaverPrivate))
+
+struct XfpmScreenSaverPrivate
+{
+    DBusConnection *bus;
+};
+
+enum
+{
+    SCREEN_SAVER_INHIBITED,
+    LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static gpointer xfpm_screen_saver_object = NULL;
+
+G_DEFINE_TYPE(XfpmScreenSaver, xfpm_screen_saver, G_TYPE_OBJECT)
+
+static DBusHandlerResult 
+xfpm_screen_saver_filter (DBusConnection *connection, DBusMessage *message, void *data)
+{
+    XfpmScreenSaver *srv = ( XfpmScreenSaver *)data;
+    
+    if ( dbus_message_is_method_call (message, "org.gnome.ScreenSaver", "Inhibit") )
+    {
+	g_signal_emit (G_OBJECT(srv), signals[SCREEN_SAVER_INHIBITED], 0, TRUE);
+	return DBUS_HANDLER_RESULT_HANDLED;
+    }
+    else if ( dbus_message_is_method_call (message, "org.gnome.ScreenSaver", "UnInhibit") )
+    {
+	g_signal_emit (G_OBJECT(srv), signals[SCREEN_SAVER_INHIBITED], 0, FALSE);
+	return DBUS_HANDLER_RESULT_HANDLED;
+    }
+    else if ( dbus_message_is_method_call (message, "org.freedesktop.ScreenSaver", "Inhibit") )
+    {
+	g_signal_emit (G_OBJECT(srv), signals[SCREEN_SAVER_INHIBITED], 0, TRUE);
+	return DBUS_HANDLER_RESULT_HANDLED;
+    }
+    else if ( dbus_message_is_method_call (message, "org.freedesktop.ScreenSaver", "UnInhibit") )
+    {
+	g_signal_emit (G_OBJECT(srv), signals[SCREEN_SAVER_INHIBITED], 0, FALSE);
+	return DBUS_HANDLER_RESULT_HANDLED;
+    }
+    
+    return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static void
+xfpm_screen_saver_class_init(XfpmScreenSaverClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
+
+     signals[SCREEN_SAVER_INHIBITED] =
+	    g_signal_new("screen-saver-inhibited",
+			 XFPM_TYPE_SCREEN_SAVER,
+			 G_SIGNAL_RUN_LAST,
+			 G_STRUCT_OFFSET(XfpmScreenSaverClass, screen_saver_inhibited),
+			 NULL, NULL,
+			 g_cclosure_marshal_VOID__BOOLEAN,
+			 G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+    object_class->finalize = xfpm_screen_saver_finalize;
+    
+    g_type_class_add_private(klass,sizeof(XfpmScreenSaverPrivate));
+}
+
+static void
+xfpm_screen_saver_init(XfpmScreenSaver *srv)
+{
+    DBusError error;
+    dbus_error_init (&error);
+    
+    srv->priv = XFPM_SCREEN_SAVER_GET_PRIVATE(srv);
+    
+    srv->priv->bus = dbus_bus_get (DBUS_BUS_SESSION, &error);
+    
+    if ( dbus_error_is_set (&error) )
+    {
+	g_critical ("Unable to get session bus: %s", error.message);
+	dbus_error_free (&error);
+	goto out;
+    }
+    
+    dbus_bus_add_match (srv->priv->bus, 
+			"type='method_call',interface='org.gnome.ScreenSaver'",
+			&error);
+			
+    if ( dbus_error_is_set (&error) )
+    {
+	g_warning ("Failed to add match for interface org.gnome.ScreenSaver: %s", error.message);
+	dbus_error_free (&error);
+    }
+	
+    dbus_error_init (&error);
+    
+    dbus_bus_add_match (srv->priv->bus, 
+			"type='method_call',interface='org.freedesktop.ScreenSaver'",
+			&error);
+			
+    if ( dbus_error_is_set (&error) )
+    {
+	g_warning ("Failed to add match for interface org.freedesktop.ScreenSaver: %s", error.message);
+	dbus_error_free (&error);
+    }
+	
+    if (!dbus_connection_add_filter (srv->priv->bus, xfpm_screen_saver_filter, srv, NULL) )
+    {
+	g_warning ("Couldn't add filter");
+    }
+out:
+    ;
+}
+
+static void
+xfpm_screen_saver_finalize(GObject *object)
+{
+    XfpmScreenSaver *srv;
+
+    srv = XFPM_SCREEN_SAVER(object);
+    
+    dbus_bus_remove_match (srv->priv->bus,
+			  "type='method_call',interface='org.gnome.ScreenSaver'", 
+			  NULL);
+    
+    dbus_bus_remove_match (srv->priv->bus,
+			  "type='method_call',interface='org.freedesktop.ScreenSaver'", 
+			  NULL);
+
+    dbus_connection_unref (srv->priv->bus);
+
+    G_OBJECT_CLASS(xfpm_screen_saver_parent_class)->finalize(object);
+}
+
+XfpmScreenSaver *
+xfpm_screen_saver_new(void)
+{
+    if ( xfpm_screen_saver_object != NULL )
+    {
+	g_object_ref (xfpm_screen_saver_object);
+    }
+    else
+    {
+	xfpm_screen_saver_object = g_object_new (XFPM_TYPE_SCREEN_SAVER, NULL);
+	g_object_add_weak_pointer (xfpm_screen_saver_object, &xfpm_screen_saver_object);
+    }
+    return XFPM_SCREEN_SAVER (xfpm_screen_saver_object);
+}

Added: xfce4-power-manager/tags/0.6.5/src/xfpm-screen-saver.h
===================================================================
--- xfce4-power-manager/tags/0.6.5/src/xfpm-screen-saver.h	                        (rev 0)
+++ xfce4-power-manager/tags/0.6.5/src/xfpm-screen-saver.h	2009-03-24 18:05:31 UTC (rev 6991)
@@ -0,0 +1,55 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef __XFPM_SCREEN_SAVER_H
+#define __XFPM_SCREEN_SAVER_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define XFPM_TYPE_SCREEN_SAVER        (xfpm_screen_saver_get_type () )
+#define XFPM_SCREEN_SAVER(o)          (G_TYPE_CHECK_INSTANCE_CAST((o), XFPM_TYPE_SCREEN_SAVER, XfpmScreenSaver))
+#define XFPM_IS_SCREEN_SAVER(o)       (G_TYPE_CHECK_INSTANCE_TYPE((o), XFPM_TYPE_SCREEN_SAVER))
+
+typedef struct XfpmScreenSaverPrivate XfpmScreenSaverPrivate;
+
+typedef struct
+{
+    GObject		 	  parent;
+    XfpmScreenSaverPrivate	 *priv;
+	
+} XfpmScreenSaver;
+
+typedef struct
+{
+    GObjectClass 		  parent_class;
+    
+    void                          (*screen_saver_inhibited)	    (XfpmScreenSaver *srv,
+								     gboolean is_inhibited);
+	
+} XfpmScreenSaverClass;
+
+GType        			  xfpm_screen_saver_get_type        (void) G_GNUC_CONST;
+XfpmScreenSaver       	 	 *xfpm_screen_saver_new             (void);
+
+G_END_DECLS
+
+#endif /* __XFPM_SCREEN_SAVER_H */




More information about the Goodies-commits mailing list