# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_interface.h>
* Module descriptor
*****************************************************************************/
vlc_module_begin();
- set_description( _("Power Management Inhibitor") );
+ set_description( N_("Power Management Inhibitor") );
set_capability( "interface", 0 );
set_callbacks( Activate, Deactivate );
vlc_module_end();
* Inhibit: Notify the power management daemon that it shouldn't suspend
* the computer because of inactivity
*
- * returns VLC_FALSE if Out of memory, else VLC_TRUE
+ * returns false if Out of memory, else true
*****************************************************************************/
static int Inhibit( intf_thread_t *p_intf )
{
p_msg = dbus_message_new_method_call( PM_SERVICE, PM_PATH, PM_INTERFACE,
"Inhibit" );
if( !p_msg )
- return VLC_FALSE;
+ return false;
dbus_message_iter_init_append( p_msg, &args );
{
free( psz_app );
dbus_message_unref( p_msg );
- return VLC_FALSE;
+ return false;
}
free( psz_app );
if( !psz_inhibit_reason )
{
dbus_message_unref( p_msg );
- return VLC_FALSE;
+ return false;
}
if( !dbus_message_iter_append_basic( &args, DBUS_TYPE_STRING,
&psz_inhibit_reason ) )
{
free( psz_inhibit_reason );
dbus_message_unref( p_msg );
- return VLC_FALSE;
+ return false;
}
free( psz_inhibit_reason );
dbus_message_unref( p_msg );
if( p_reply == NULL )
{ /* g-p-m is not active, or too slow. Better luck next time? */
- return VLC_TRUE;
+ return true;
}
/* extract the cookie from the reply */
DBUS_TYPE_UINT32, &i_cookie,
DBUS_TYPE_INVALID ) == FALSE )
{
- return VLC_FALSE;
+ return false;
}
/* Save the cookie */
p_intf->p_sys->i_cookie = i_cookie;
- return VLC_TRUE;
+ return true;
}
/*****************************************************************************
* UnInhibit: Notify the power management daemon that we aren't active anymore
*
- * returns VLC_FALSE if Out of memory, else VLC_TRUE
+ * returns false if Out of memory, else true
*****************************************************************************/
static int UnInhibit( intf_thread_t *p_intf )
{
p_msg = dbus_message_new_method_call( PM_SERVICE, PM_PATH, PM_INTERFACE,
"UnInhibit" );
if( !p_msg )
- return VLC_FALSE;
+ return false;
dbus_message_iter_init_append( p_msg, &args );
if( !dbus_message_iter_append_basic( &args, DBUS_TYPE_UINT32, &i_cookie ) )
{
dbus_message_unref( p_msg );
- return VLC_FALSE;
+ return false;
}
if( !dbus_connection_send( p_conn, p_msg, NULL ) )
- return VLC_FALSE;
+ return false;
dbus_connection_flush( p_conn );
dbus_message_unref( p_msg );
p_intf->p_sys->i_cookie = 0;
- return VLC_TRUE;
+ return true;
}
/*****************************************************************************
static void Run( intf_thread_t *p_intf )
{
vlc_object_lock( p_intf );
- for(;;)
+ while( vlc_object_alive( p_intf ) )
{
input_thread_t *p_input;
/* Check playing state every 30 seconds */
- if( vlc_object_timedwait( p_intf, mdate() + 30000000 ) < 0 )
- break;
+ vlc_object_timedwait( p_intf, mdate() + 30000000 );
p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( p_input )