KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21573/root/usr/share/devhelp/books/dbus/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21573/root/usr/share/devhelp/books/dbus/api/dbus-timeout_8c-source.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>D-Bus: dbus-timeout.c Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
    <li id="current"><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul></div>
<h1>dbus-timeout.c</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */</span>
<a name="l00002"></a>00002 <span class="comment">/* dbus-timeout.c DBusTimeout implementation</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2003  CodeFactory AB</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * Licensed under the Academic Free License version 2.1</span>
<a name="l00007"></a>00007 <span class="comment"> * </span>
<a name="l00008"></a>00008 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
<a name="l00009"></a>00009 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00010"></a>00010 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00011"></a>00011 <span class="comment"> * (at your option) any later version.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00016"></a>00016 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"> * </span>
<a name="l00018"></a>00018 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00019"></a>00019 <span class="comment"> * along with this program; if not, write to the Free Software</span>
<a name="l00020"></a>00020 <span class="comment"> * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
<a name="l00021"></a>00021 <span class="comment"> *</span>
<a name="l00022"></a>00022 <span class="comment"> */</span>
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="preprocessor">#include "dbus-internals.h"</span>
<a name="l00025"></a>00025 <span class="preprocessor">#include "dbus-timeout.h"</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include "dbus-list.h"</span>
<a name="l00027"></a>00027 
<a name="l00039"></a><a class="code" href="structDBusTimeout.html">00039</a> <span class="keyword">struct </span><a class="code" href="structDBusTimeout.html">DBusTimeout</a>
<a name="l00040"></a>00040 {
<a name="l00041"></a><a class="code" href="structDBusTimeout.html#1b2b2eadd3e162b213384cbd6d1e941e">00041</a>   <span class="keywordtype">int</span> <a class="code" href="structDBusTimeout.html#1b2b2eadd3e162b213384cbd6d1e941e">refcount</a>;                                
<a name="l00042"></a><a class="code" href="structDBusTimeout.html#8772f07a4695be987e7d0fea1b80ba16">00042</a>   <span class="keywordtype">int</span> <a class="code" href="structDBusTimeout.html#8772f07a4695be987e7d0fea1b80ba16">interval</a>;                                
<a name="l00044"></a><a class="code" href="structDBusTimeout.html#362a61722d3fae5c18c93654a57aa377">00044</a>   <a class="code" href="group__DBusTimeoutInternals.html#gd0b4e101391bd7f0a42f951178cdb090">DBusTimeoutHandler</a> <a class="code" href="structDBusTimeout.html#362a61722d3fae5c18c93654a57aa377">handler</a>;                  
<a name="l00045"></a><a class="code" href="structDBusTimeout.html#58a22bfb2f7f0543745c2d56fa9f63a1">00045</a>   <span class="keywordtype">void</span> *<a class="code" href="structDBusTimeout.html#58a22bfb2f7f0543745c2d56fa9f63a1">handler_data</a>;                          
<a name="l00046"></a><a class="code" href="structDBusTimeout.html#add5adfcf8896e0529df439548f351cc">00046</a>   <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> <a class="code" href="structDBusTimeout.html#add5adfcf8896e0529df439548f351cc">free_handler_data_function</a>; 
<a name="l00048"></a><a class="code" href="structDBusTimeout.html#16cb374453e70f3951d02bcba73c1845">00048</a>   <span class="keywordtype">void</span> *<a class="code" href="structDBusTimeout.html#16cb374453e70f3951d02bcba73c1845">data</a>;                                  
<a name="l00049"></a><a class="code" href="structDBusTimeout.html#f7ff88e58a10f4ed49a0838e0c930be0">00049</a>   <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> <a class="code" href="structDBusTimeout.html#f7ff88e58a10f4ed49a0838e0c930be0">free_data_function</a>;         
<a name="l00050"></a><a class="code" href="structDBusTimeout.html#35ac546656105d0fe1929d4e3d224503">00050</a>   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structDBusTimeout.html#35ac546656105d0fe1929d4e3d224503">enabled</a> : 1;                    
<a name="l00051"></a>00051 };
<a name="l00052"></a>00052 
<a name="l00061"></a>00061 <a class="code" href="structDBusTimeout.html">DBusTimeout</a>*
<a name="l00062"></a><a class="code" href="group__DBusTimeoutInternals.html#g3f63abde6bb7ebecf6fa8774ba501a26">00062</a> <a class="code" href="group__DBusTimeoutInternals.html#g3f63abde6bb7ebecf6fa8774ba501a26">_dbus_timeout_new</a> (<span class="keywordtype">int</span>                 interval,
<a name="l00063"></a>00063                    <a class="code" href="group__DBusTimeoutInternals.html#gd0b4e101391bd7f0a42f951178cdb090">DBusTimeoutHandler</a>  handler,
<a name="l00064"></a>00064                    <span class="keywordtype">void</span>               *data,
<a name="l00065"></a>00065                    <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a>    free_data_function)
<a name="l00066"></a>00066 {
<a name="l00067"></a>00067   <a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout;
<a name="l00068"></a>00068 
<a name="l00069"></a>00069   timeout = <a class="code" href="group__DBusMemory.html#gba9d823abda7f4cadbaf5177d3b8b793">dbus_new0</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a>, 1);
<a name="l00070"></a>00070   <span class="keywordflow">if</span> (timeout == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00071"></a>00071     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00072"></a>00072   
<a name="l00073"></a>00073   timeout-&gt;<a class="code" href="structDBusTimeout.html#1b2b2eadd3e162b213384cbd6d1e941e">refcount</a> = 1;
<a name="l00074"></a>00074   timeout-&gt;<a class="code" href="structDBusTimeout.html#8772f07a4695be987e7d0fea1b80ba16">interval</a> = interval;
<a name="l00075"></a>00075 
<a name="l00076"></a>00076   timeout-&gt;<a class="code" href="structDBusTimeout.html#362a61722d3fae5c18c93654a57aa377">handler</a> = handler;
<a name="l00077"></a>00077   timeout-&gt;<a class="code" href="structDBusTimeout.html#58a22bfb2f7f0543745c2d56fa9f63a1">handler_data</a> = data;
<a name="l00078"></a>00078   timeout-&gt;<a class="code" href="structDBusTimeout.html#add5adfcf8896e0529df439548f351cc">free_handler_data_function</a> = free_data_function;
<a name="l00079"></a>00079 
<a name="l00080"></a>00080   timeout-&gt;<a class="code" href="structDBusTimeout.html#35ac546656105d0fe1929d4e3d224503">enabled</a> = <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00081"></a>00081   
<a name="l00082"></a>00082   <span class="keywordflow">return</span> timeout;
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084 
<a name="l00091"></a>00091 <a class="code" href="structDBusTimeout.html">DBusTimeout</a> *
<a name="l00092"></a><a class="code" href="group__DBusTimeoutInternals.html#gdf014caa89efb09ae72c300ae5c4fda5">00092</a> <a class="code" href="group__DBusTimeoutInternals.html#gdf014caa89efb09ae72c300ae5c4fda5">_dbus_timeout_ref</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout)
<a name="l00093"></a>00093 {
<a name="l00094"></a>00094   timeout-&gt;<a class="code" href="structDBusTimeout.html#1b2b2eadd3e162b213384cbd6d1e941e">refcount</a> += 1;
<a name="l00095"></a>00095 
<a name="l00096"></a>00096   <span class="keywordflow">return</span> timeout;
<a name="l00097"></a>00097 }
<a name="l00098"></a>00098 
<a name="l00105"></a>00105 <span class="keywordtype">void</span>
<a name="l00106"></a><a class="code" href="group__DBusTimeoutInternals.html#gea6359793576a2eec42e27267bae7bbd">00106</a> <a class="code" href="group__DBusTimeoutInternals.html#gea6359793576a2eec42e27267bae7bbd">_dbus_timeout_unref</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout)
<a name="l00107"></a>00107 {
<a name="l00108"></a>00108   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (timeout != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00109"></a>00109   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (timeout-&gt;<a class="code" href="structDBusTimeout.html#1b2b2eadd3e162b213384cbd6d1e941e">refcount</a> &gt; 0);
<a name="l00110"></a>00110   
<a name="l00111"></a>00111   timeout-&gt;<a class="code" href="structDBusTimeout.html#1b2b2eadd3e162b213384cbd6d1e941e">refcount</a> -= 1;
<a name="l00112"></a>00112   <span class="keywordflow">if</span> (timeout-&gt;<a class="code" href="structDBusTimeout.html#1b2b2eadd3e162b213384cbd6d1e941e">refcount</a> == 0)
<a name="l00113"></a>00113     {
<a name="l00114"></a>00114       <a class="code" href="group__DBusTimeout.html#g88712006f7772174504a0fba0a0ddd60">dbus_timeout_set_data</a> (timeout, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>); <span class="comment">/* call free_data_function */</span>
<a name="l00115"></a>00115 
<a name="l00116"></a>00116       <span class="keywordflow">if</span> (timeout-&gt;<a class="code" href="structDBusTimeout.html#add5adfcf8896e0529df439548f351cc">free_handler_data_function</a>)
<a name="l00117"></a>00117         (* timeout-&gt;<a class="code" href="structDBusTimeout.html#add5adfcf8896e0529df439548f351cc">free_handler_data_function</a>) (timeout-&gt;<a class="code" href="structDBusTimeout.html#58a22bfb2f7f0543745c2d56fa9f63a1">handler_data</a>);
<a name="l00118"></a>00118       
<a name="l00119"></a>00119       <a class="code" href="group__DBusMemory.html#g488c6b08cc8c1ddf0203243c4b27a13c">dbus_free</a> (timeout);
<a name="l00120"></a>00120     }
<a name="l00121"></a>00121 }
<a name="l00122"></a>00122 
<a name="l00132"></a>00132 <span class="keywordtype">void</span>
<a name="l00133"></a><a class="code" href="group__DBusTimeoutInternals.html#gdbd32136416a555ad737b533c8e713ef">00133</a> <a class="code" href="group__DBusTimeoutInternals.html#gdbd32136416a555ad737b533c8e713ef">_dbus_timeout_set_interval</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout,
<a name="l00134"></a>00134                             <span class="keywordtype">int</span>          interval)
<a name="l00135"></a>00135 {
<a name="l00136"></a>00136   <a class="code" href="group__DBusInternalsUtils.html#g129c6c03f011cdc171934d5d386cc797">_dbus_assert</a> (interval &gt;= 0);
<a name="l00137"></a>00137   
<a name="l00138"></a>00138   timeout-&gt;<a class="code" href="structDBusTimeout.html#8772f07a4695be987e7d0fea1b80ba16">interval</a> = interval;
<a name="l00139"></a>00139 }
<a name="l00140"></a>00140 
<a name="l00151"></a>00151 <span class="keywordtype">void</span>
<a name="l00152"></a><a class="code" href="group__DBusTimeoutInternals.html#g1b85d28ab11e4e2f8916b786e13dbcc4">00152</a> <a class="code" href="group__DBusTimeoutInternals.html#g1b85d28ab11e4e2f8916b786e13dbcc4">_dbus_timeout_set_enabled</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a>  *timeout,
<a name="l00153"></a>00153                            <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>   enabled)
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155   timeout-&gt;<a class="code" href="structDBusTimeout.html#35ac546656105d0fe1929d4e3d224503">enabled</a> = enabled != <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157 
<a name="l00158"></a>00158 
<a name="l00175"></a><a class="code" href="structDBusTimeoutList.html">00175</a> <span class="keyword">struct </span><a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a>
<a name="l00176"></a>00176 {
<a name="l00177"></a><a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">00177</a>   <a class="code" href="structDBusList.html">DBusList</a> *<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>; 
<a name="l00179"></a><a class="code" href="structDBusTimeoutList.html#ab57481c712e47f9157d23bc6731972e">00179</a>   <a class="code" href="group__DBusConnection.html#g0f4e9f850546dfbe3a27edea05e5e590">DBusAddTimeoutFunction</a> <a class="code" href="structDBusTimeoutList.html#ab57481c712e47f9157d23bc6731972e">add_timeout_function</a>;       
<a name="l00180"></a><a class="code" href="structDBusTimeoutList.html#51d25b272b950c3f63b3b71926940a55">00180</a>   <a class="code" href="group__DBusConnection.html#gb11e8c56bd8637deca1439be635f6ca7">DBusRemoveTimeoutFunction</a> <a class="code" href="structDBusTimeoutList.html#51d25b272b950c3f63b3b71926940a55">remove_timeout_function</a>; 
<a name="l00181"></a><a class="code" href="structDBusTimeoutList.html#198efba668450ebafa97e9d5197fcc2e">00181</a>   <a class="code" href="group__DBusConnection.html#g1e98eb88ce848204d419495be5e1d228">DBusTimeoutToggledFunction</a> <a class="code" href="structDBusTimeoutList.html#198efba668450ebafa97e9d5197fcc2e">timeout_toggled_function</a>; 
<a name="l00182"></a><a class="code" href="structDBusTimeoutList.html#f26804f9320628b977e7afeeea3750eb">00182</a>   <span class="keywordtype">void</span> *<a class="code" href="structDBusTimeoutList.html#f26804f9320628b977e7afeeea3750eb">timeout_data</a>;                                
<a name="l00183"></a><a class="code" href="structDBusTimeoutList.html#c93efcdc11b6e68d19f1e57e0bff72f7">00183</a>   <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a> <a class="code" href="structDBusTimeoutList.html#c93efcdc11b6e68d19f1e57e0bff72f7">timeout_free_data_function</a>;       
<a name="l00184"></a>00184 };
<a name="l00185"></a>00185 
<a name="l00192"></a>00192 <a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a>*
<a name="l00193"></a><a class="code" href="group__DBusTimeoutInternals.html#g5b122b35cdb3926b7dc2d084ddff9d62">00193</a> <a class="code" href="group__DBusTimeoutInternals.html#g5b122b35cdb3926b7dc2d084ddff9d62">_dbus_timeout_list_new</a> (<span class="keywordtype">void</span>)
<a name="l00194"></a>00194 {
<a name="l00195"></a>00195   <a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a> *timeout_list;
<a name="l00196"></a>00196 
<a name="l00197"></a>00197   timeout_list = <a class="code" href="group__DBusMemory.html#gba9d823abda7f4cadbaf5177d3b8b793">dbus_new0</a> (<a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a>, 1);
<a name="l00198"></a>00198   <span class="keywordflow">if</span> (timeout_list == <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00199"></a>00199     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>;
<a name="l00200"></a>00200 
<a name="l00201"></a>00201   <span class="keywordflow">return</span> timeout_list;
<a name="l00202"></a>00202 }
<a name="l00203"></a>00203 
<a name="l00209"></a>00209 <span class="keywordtype">void</span>
<a name="l00210"></a><a class="code" href="group__DBusTimeoutInternals.html#g1b399ef2d7f128e59bb32dbb5b590e1b">00210</a> <a class="code" href="group__DBusTimeoutInternals.html#g1b399ef2d7f128e59bb32dbb5b590e1b">_dbus_timeout_list_free</a> (<a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a> *timeout_list)
<a name="l00211"></a>00211 {
<a name="l00212"></a>00212   <span class="comment">/* free timeout_data and remove timeouts as a side effect */</span>
<a name="l00213"></a>00213   <a class="code" href="group__DBusTimeoutInternals.html#g6760d1963b870b45f855501e38b49fd9">_dbus_timeout_list_set_functions</a> (timeout_list,
<a name="l00214"></a>00214                                     <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>, <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00215"></a>00215 
<a name="l00216"></a>00216   <a class="code" href="group__DBusList.html#g8dd69084b53361803a765e6d53d5b9d1">_dbus_list_foreach</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>,
<a name="l00217"></a>00217                       (<a class="code" href="group__DBusInternalsUtils.html#gadf9d45082dd1c9f59d8420d13492669">DBusForeachFunction</a>) <a class="code" href="group__DBusTimeoutInternals.html#gea6359793576a2eec42e27267bae7bbd">_dbus_timeout_unref</a>,
<a name="l00218"></a>00218                       <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>);
<a name="l00219"></a>00219   <a class="code" href="group__DBusList.html#ga36d13444a050a923941c53650b72f9d">_dbus_list_clear</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>);
<a name="l00220"></a>00220 
<a name="l00221"></a>00221   <a class="code" href="group__DBusMemory.html#g488c6b08cc8c1ddf0203243c4b27a13c">dbus_free</a> (timeout_list);
<a name="l00222"></a>00222 }
<a name="l00223"></a>00223 
<a name="l00237"></a>00237 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00238"></a><a class="code" href="group__DBusTimeoutInternals.html#g6760d1963b870b45f855501e38b49fd9">00238</a> <a class="code" href="group__DBusTimeoutInternals.html#g6760d1963b870b45f855501e38b49fd9">_dbus_timeout_list_set_functions</a> (<a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a>           *timeout_list,
<a name="l00239"></a>00239                                   <a class="code" href="group__DBusConnection.html#g0f4e9f850546dfbe3a27edea05e5e590">DBusAddTimeoutFunction</a>     add_function,
<a name="l00240"></a>00240                                   <a class="code" href="group__DBusConnection.html#gb11e8c56bd8637deca1439be635f6ca7">DBusRemoveTimeoutFunction</a>  remove_function,
<a name="l00241"></a>00241                                   <a class="code" href="group__DBusConnection.html#g1e98eb88ce848204d419495be5e1d228">DBusTimeoutToggledFunction</a> toggled_function,
<a name="l00242"></a>00242                                   <span class="keywordtype">void</span>                      *data,
<a name="l00243"></a>00243                                   <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a>           free_data_function)
<a name="l00244"></a>00244 {
<a name="l00245"></a>00245   <span class="comment">/* Add timeouts with the new function, failing on OOM */</span>
<a name="l00246"></a>00246   <span class="keywordflow">if</span> (add_function != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00247"></a>00247     {
<a name="l00248"></a>00248       <a class="code" href="structDBusList.html">DBusList</a> *link;
<a name="l00249"></a>00249       
<a name="l00250"></a>00250       link = <a class="code" href="group__DBusList.html#g1e26ce4fb4acb50593bd5ed2f4eeb3ae">_dbus_list_get_first_link</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>);
<a name="l00251"></a>00251       <span class="keywordflow">while</span> (link != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00252"></a>00252         {
<a name="l00253"></a>00253           <a class="code" href="structDBusList.html">DBusList</a> *next = <a class="code" href="group__DBusList.html#gede4ace46d5ee497d75074bfec4490a2">_dbus_list_get_next_link</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>,
<a name="l00254"></a>00254                                                      link);
<a name="l00255"></a>00255       
<a name="l00256"></a>00256           <span class="keywordflow">if</span> (!(* add_function) (link-&gt;<a class="code" href="structDBusList.html#29ab457bcf9092252bb0c4282c727055">data</a>, data))
<a name="l00257"></a>00257             {
<a name="l00258"></a>00258               <span class="comment">/* remove it all again and return FALSE */</span>
<a name="l00259"></a>00259               <a class="code" href="structDBusList.html">DBusList</a> *link2;
<a name="l00260"></a>00260               
<a name="l00261"></a>00261               link2 = <a class="code" href="group__DBusList.html#g1e26ce4fb4acb50593bd5ed2f4eeb3ae">_dbus_list_get_first_link</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>);
<a name="l00262"></a>00262               <span class="keywordflow">while</span> (link2 != link)
<a name="l00263"></a>00263                 {
<a name="l00264"></a>00264                   <a class="code" href="structDBusList.html">DBusList</a> *next = <a class="code" href="group__DBusList.html#gede4ace46d5ee497d75074bfec4490a2">_dbus_list_get_next_link</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>,
<a name="l00265"></a>00265                                                              link2);
<a name="l00266"></a>00266 
<a name="l00267"></a>00267                   (* remove_function) (link2-&gt;<a class="code" href="structDBusList.html#29ab457bcf9092252bb0c4282c727055">data</a>, data);
<a name="l00268"></a>00268                   
<a name="l00269"></a>00269                   link2 = next;
<a name="l00270"></a>00270                 }
<a name="l00271"></a>00271 
<a name="l00272"></a>00272               <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00273"></a>00273             }
<a name="l00274"></a>00274       
<a name="l00275"></a>00275           link = next;
<a name="l00276"></a>00276         }
<a name="l00277"></a>00277     }
<a name="l00278"></a>00278   
<a name="l00279"></a>00279   <span class="comment">/* Remove all current timeouts from previous timeout handlers */</span>
<a name="l00280"></a>00280 
<a name="l00281"></a>00281   <span class="keywordflow">if</span> (timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#51d25b272b950c3f63b3b71926940a55">remove_timeout_function</a> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00282"></a>00282     {
<a name="l00283"></a>00283       <a class="code" href="group__DBusList.html#g8dd69084b53361803a765e6d53d5b9d1">_dbus_list_foreach</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>,
<a name="l00284"></a>00284                           (<a class="code" href="group__DBusInternalsUtils.html#gadf9d45082dd1c9f59d8420d13492669">DBusForeachFunction</a>) timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#51d25b272b950c3f63b3b71926940a55">remove_timeout_function</a>,
<a name="l00285"></a>00285                           timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#f26804f9320628b977e7afeeea3750eb">timeout_data</a>);
<a name="l00286"></a>00286     }
<a name="l00287"></a>00287 
<a name="l00288"></a>00288   <span class="keywordflow">if</span> (timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#c93efcdc11b6e68d19f1e57e0bff72f7">timeout_free_data_function</a> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00289"></a>00289     (* timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#c93efcdc11b6e68d19f1e57e0bff72f7">timeout_free_data_function</a>) (timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#f26804f9320628b977e7afeeea3750eb">timeout_data</a>);
<a name="l00290"></a>00290 
<a name="l00291"></a>00291   timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#ab57481c712e47f9157d23bc6731972e">add_timeout_function</a> = add_function;
<a name="l00292"></a>00292   timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#51d25b272b950c3f63b3b71926940a55">remove_timeout_function</a> = remove_function;
<a name="l00293"></a>00293   timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#198efba668450ebafa97e9d5197fcc2e">timeout_toggled_function</a> = toggled_function;
<a name="l00294"></a>00294   timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#f26804f9320628b977e7afeeea3750eb">timeout_data</a> = data;
<a name="l00295"></a>00295   timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#c93efcdc11b6e68d19f1e57e0bff72f7">timeout_free_data_function</a> = free_data_function;
<a name="l00296"></a>00296 
<a name="l00297"></a>00297   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00298"></a>00298 }
<a name="l00299"></a>00299 
<a name="l00308"></a>00308 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00309"></a><a class="code" href="group__DBusTimeoutInternals.html#g14955f061551ece122808b9e6ddc0757">00309</a> <a class="code" href="group__DBusTimeoutInternals.html#g14955f061551ece122808b9e6ddc0757">_dbus_timeout_list_add_timeout</a> (<a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a> *timeout_list,
<a name="l00310"></a>00310                                 <a class="code" href="structDBusTimeout.html">DBusTimeout</a>     *timeout)
<a name="l00311"></a>00311 {
<a name="l00312"></a>00312   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusList.html#gd99045e79db46159babe69718f343053">_dbus_list_append</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>, timeout))
<a name="l00313"></a>00313     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00314"></a>00314 
<a name="l00315"></a>00315   <a class="code" href="group__DBusTimeoutInternals.html#gdf014caa89efb09ae72c300ae5c4fda5">_dbus_timeout_ref</a> (timeout);
<a name="l00316"></a>00316 
<a name="l00317"></a>00317   <span class="keywordflow">if</span> (timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#ab57481c712e47f9157d23bc6731972e">add_timeout_function</a> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00318"></a>00318     {
<a name="l00319"></a>00319       <span class="keywordflow">if</span> (!(* timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#ab57481c712e47f9157d23bc6731972e">add_timeout_function</a>) (timeout,
<a name="l00320"></a>00320                                                    timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#f26804f9320628b977e7afeeea3750eb">timeout_data</a>))
<a name="l00321"></a>00321         {
<a name="l00322"></a>00322           <a class="code" href="group__DBusList.html#gd93f1fc853914144e94fc7a7dc0945aa">_dbus_list_remove_last</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>, timeout);
<a name="l00323"></a>00323           <a class="code" href="group__DBusTimeoutInternals.html#gea6359793576a2eec42e27267bae7bbd">_dbus_timeout_unref</a> (timeout);
<a name="l00324"></a>00324           <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga93f0eb578d23995850d61f7d61c55c1">FALSE</a>;
<a name="l00325"></a>00325         }
<a name="l00326"></a>00326     }
<a name="l00327"></a>00327 
<a name="l00328"></a>00328   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#ga8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;
<a name="l00329"></a>00329 }
<a name="l00330"></a>00330 
<a name="l00338"></a>00338 <span class="keywordtype">void</span>
<a name="l00339"></a><a class="code" href="group__DBusTimeoutInternals.html#gec0ffafdcac87f23878a2ddded044822">00339</a> <a class="code" href="group__DBusTimeoutInternals.html#gec0ffafdcac87f23878a2ddded044822">_dbus_timeout_list_remove_timeout</a> (<a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a> *timeout_list,
<a name="l00340"></a>00340                                    <a class="code" href="structDBusTimeout.html">DBusTimeout</a>     *timeout)
<a name="l00341"></a>00341 {
<a name="l00342"></a>00342   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusList.html#g202e6ac8ad3e4a9d4413e0248ffcf3e3">_dbus_list_remove</a> (&amp;timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#56d9070375880b7d931f887564981f80">timeouts</a>, timeout))
<a name="l00343"></a>00343     <a class="code" href="group__DBusInternalsUtils.html#g0c4961ec784874f1b1f3aeccea8d3da1">_dbus_assert_not_reached</a> (<span class="stringliteral">"Nonexistent timeout was removed"</span>);
<a name="l00344"></a>00344 
<a name="l00345"></a>00345   <span class="keywordflow">if</span> (timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#51d25b272b950c3f63b3b71926940a55">remove_timeout_function</a> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00346"></a>00346     (* timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#51d25b272b950c3f63b3b71926940a55">remove_timeout_function</a>) (timeout,
<a name="l00347"></a>00347                                                timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#f26804f9320628b977e7afeeea3750eb">timeout_data</a>);
<a name="l00348"></a>00348 
<a name="l00349"></a>00349   <a class="code" href="group__DBusTimeoutInternals.html#gea6359793576a2eec42e27267bae7bbd">_dbus_timeout_unref</a> (timeout);
<a name="l00350"></a>00350 }
<a name="l00351"></a>00351 
<a name="l00360"></a>00360 <span class="keywordtype">void</span>
<a name="l00361"></a><a class="code" href="group__DBusTimeoutInternals.html#g3d1ee0968a47651c5428ebf48711b217">00361</a> <a class="code" href="group__DBusTimeoutInternals.html#g3d1ee0968a47651c5428ebf48711b217">_dbus_timeout_list_toggle_timeout</a> (<a class="code" href="structDBusTimeoutList.html">DBusTimeoutList</a>           *timeout_list,
<a name="l00362"></a>00362                                    <a class="code" href="structDBusTimeout.html">DBusTimeout</a>               *timeout,
<a name="l00363"></a>00363                                    <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>                enabled)
<a name="l00364"></a>00364 {
<a name="l00365"></a>00365   enabled = !!enabled;
<a name="l00366"></a>00366   
<a name="l00367"></a>00367   <span class="keywordflow">if</span> (enabled == timeout-&gt;<a class="code" href="structDBusTimeout.html#35ac546656105d0fe1929d4e3d224503">enabled</a>)
<a name="l00368"></a>00368     <span class="keywordflow">return</span>;
<a name="l00369"></a>00369 
<a name="l00370"></a>00370   timeout-&gt;<a class="code" href="structDBusTimeout.html#35ac546656105d0fe1929d4e3d224503">enabled</a> = enabled;
<a name="l00371"></a>00371   
<a name="l00372"></a>00372   <span class="keywordflow">if</span> (timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#198efba668450ebafa97e9d5197fcc2e">timeout_toggled_function</a> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00373"></a>00373     (* timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#198efba668450ebafa97e9d5197fcc2e">timeout_toggled_function</a>) (timeout,
<a name="l00374"></a>00374                                                 timeout_list-&gt;<a class="code" href="structDBusTimeoutList.html#f26804f9320628b977e7afeeea3750eb">timeout_data</a>);
<a name="l00375"></a>00375 }
<a name="l00376"></a>00376 
<a name="l00414"></a>00414 <span class="keywordtype">int</span>
<a name="l00415"></a><a class="code" href="group__DBusTimeout.html#g67ba21b6189438875c6007ee79da5e37">00415</a> <a class="code" href="group__DBusTimeout.html#g67ba21b6189438875c6007ee79da5e37">dbus_timeout_get_interval</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout)
<a name="l00416"></a>00416 {
<a name="l00417"></a>00417   <span class="keywordflow">return</span> timeout-&gt;<a class="code" href="structDBusTimeout.html#8772f07a4695be987e7d0fea1b80ba16">interval</a>;
<a name="l00418"></a>00418 }
<a name="l00419"></a>00419 
<a name="l00427"></a>00427 <span class="keywordtype">void</span>*
<a name="l00428"></a><a class="code" href="group__DBusTimeout.html#g7c561ec66daa2f53a274485f10c827c7">00428</a> <a class="code" href="group__DBusTimeout.html#g7c561ec66daa2f53a274485f10c827c7">dbus_timeout_get_data</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout)
<a name="l00429"></a>00429 {
<a name="l00430"></a>00430   <span class="keywordflow">return</span> timeout-&gt;<a class="code" href="structDBusTimeout.html#16cb374453e70f3951d02bcba73c1845">data</a>;
<a name="l00431"></a>00431 }
<a name="l00432"></a>00432 
<a name="l00444"></a>00444 <span class="keywordtype">void</span>
<a name="l00445"></a><a class="code" href="group__DBusTimeout.html#g88712006f7772174504a0fba0a0ddd60">00445</a> <a class="code" href="group__DBusTimeout.html#g88712006f7772174504a0fba0a0ddd60">dbus_timeout_set_data</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a>      *timeout,
<a name="l00446"></a>00446                        <span class="keywordtype">void</span>             *data,
<a name="l00447"></a>00447                        <a class="code" href="group__DBusMemory.html#g8792ec2b2b8626ca28022faf51ec415a">DBusFreeFunction</a>  free_data_function)
<a name="l00448"></a>00448 {
<a name="l00449"></a>00449   <span class="keywordflow">if</span> (timeout-&gt;<a class="code" href="structDBusTimeout.html#f7ff88e58a10f4ed49a0838e0c930be0">free_data_function</a> != <a class="code" href="group__DBusMacros.html#g070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>)
<a name="l00450"></a>00450     (* timeout-&gt;<a class="code" href="structDBusTimeout.html#f7ff88e58a10f4ed49a0838e0c930be0">free_data_function</a>) (timeout-&gt;<a class="code" href="structDBusTimeout.html#16cb374453e70f3951d02bcba73c1845">data</a>);
<a name="l00451"></a>00451 
<a name="l00452"></a>00452   timeout-&gt;<a class="code" href="structDBusTimeout.html#16cb374453e70f3951d02bcba73c1845">data</a> = data;
<a name="l00453"></a>00453   timeout-&gt;<a class="code" href="structDBusTimeout.html#f7ff88e58a10f4ed49a0838e0c930be0">free_data_function</a> = free_data_function;
<a name="l00454"></a>00454 }
<a name="l00455"></a>00455 
<a name="l00470"></a>00470 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00471"></a><a class="code" href="group__DBusTimeout.html#g038b67c8d3db2624a1e4a8bc45f25d12">00471</a> <a class="code" href="group__DBusTimeout.html#g038b67c8d3db2624a1e4a8bc45f25d12">dbus_timeout_handle</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout)
<a name="l00472"></a>00472 {
<a name="l00473"></a>00473   <span class="keywordflow">return</span> (* timeout-&gt;<a class="code" href="structDBusTimeout.html#362a61722d3fae5c18c93654a57aa377">handler</a>) (timeout-&gt;<a class="code" href="structDBusTimeout.html#58a22bfb2f7f0543745c2d56fa9f63a1">handler_data</a>);
<a name="l00474"></a>00474 }
<a name="l00475"></a>00475 
<a name="l00476"></a>00476 
<a name="l00484"></a>00484 <a class="code" href="group__DBusTypes.html#g39c9cb0f3a2a8ad6f55cc4855d035349">dbus_bool_t</a>
<a name="l00485"></a><a class="code" href="group__DBusTimeout.html#g58954b2edb45ec1632529d35525ea45c">00485</a> <a class="code" href="group__DBusTimeout.html#g58954b2edb45ec1632529d35525ea45c">dbus_timeout_get_enabled</a> (<a class="code" href="structDBusTimeout.html">DBusTimeout</a> *timeout)
<a name="l00486"></a>00486 {
<a name="l00487"></a>00487   <span class="keywordflow">return</span> timeout-&gt;<a class="code" href="structDBusTimeout.html#35ac546656105d0fe1929d4e3d224503">enabled</a>;
<a name="l00488"></a>00488 }
<a name="l00489"></a>00489 
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Dec 14 22:26:12 2009 for D-Bus by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
</body>
</html>

Anon7 - 2021