[gnome-desktop] idle-monitor: Change _add_watch() API



commit 9d418acf499c638e768005b707f5b880588811f8
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Nov 12 19:11:08 2012 +0100

    idle-monitor: Change _add_watch() API
    
    Return the watch_id as a return value, and zero on failure.

 libgnome-desktop/gnome-idle-monitor.c |   12 ++++++------
 libgnome-desktop/gnome-idle-monitor.h |    5 ++---
 2 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/libgnome-desktop/gnome-idle-monitor.c b/libgnome-desktop/gnome-idle-monitor.c
index 9d0d504..14a62fb 100644
--- a/libgnome-desktop/gnome-idle-monitor.c
+++ b/libgnome-desktop/gnome-idle-monitor.c
@@ -434,7 +434,8 @@ gnome_idle_monitor_new_for_device (GdkDevice *device)
  *     accumulated @interval seconds of idle time.
  * @user_data: (allow-none): The user data to pass to the callback
  * @notify: A #GDestroyNotify
- * @watch_id: (out): The watch ID
+ *
+ * Returns: a watch id
  *
  * Adds a watch for a specific idle time. The callback will be called
  * when the user has accumlated @interval_msec milliseconds of idle time.
@@ -452,17 +453,16 @@ gnome_idle_monitor_new_for_device (GdkDevice *device)
  * negative transitions, connect to the #GnomeIdleMonitor:::became-active
  * signal.
  */
-void
+guint
 gnome_idle_monitor_add_watch (GnomeIdleMonitor	       *monitor,
 			      guint			interval_msec,
 			      GnomeIdleMonitorWatchFunc callback,
 			      gpointer			user_data,
-			      GDestroyNotify		notify,
-			      guint                    *watch_id)
+			      GDestroyNotify		notify)
 {
 	GnomeIdleMonitorWatch *watch;
 
-	g_return_if_fail (GNOME_IS_IDLE_MONITOR (monitor));
+	g_return_val_if_fail (GNOME_IS_IDLE_MONITOR (monitor), 0);
 
 	watch = idle_monitor_watch_new ();
 	watch->display = monitor->priv->display;
@@ -474,7 +474,7 @@ gnome_idle_monitor_add_watch (GnomeIdleMonitor	       *monitor,
 	g_hash_table_insert (monitor->priv->watches,
 			     GUINT_TO_POINTER (watch->id),
 			     watch);
-	*watch_id = watch->id;
+	return watch->id;
 }
 
 /**
diff --git a/libgnome-desktop/gnome-idle-monitor.h b/libgnome-desktop/gnome-idle-monitor.h
index f28e863..534ae20 100644
--- a/libgnome-desktop/gnome-idle-monitor.h
+++ b/libgnome-desktop/gnome-idle-monitor.h
@@ -61,12 +61,11 @@ GType              gnome_idle_monitor_get_type     (void);
 GnomeIdleMonitor * gnome_idle_monitor_new          (void);
 GnomeIdleMonitor * gnome_idle_monitor_new_for_device (GdkDevice *device);
 
-void               gnome_idle_monitor_add_watch    (GnomeIdleMonitor         *monitor,
+guint              gnome_idle_monitor_add_watch    (GnomeIdleMonitor         *monitor,
                                                     guint                     interval_msec,
                                                     GnomeIdleMonitorWatchFunc callback,
                                                     gpointer                  user_data,
-                                                    GDestroyNotify            notify,
-	                                            guint                    *watch_id);
+                                                    GDestroyNotify            notify);
 
 void               gnome_idle_monitor_remove_watch (GnomeIdleMonitor         *monitor,
                                                     guint                     id);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]