summaryrefslogtreecommitdiff
path: root/src/linux/up-dock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/linux/up-dock.c')
-rw-r--r--src/linux/up-dock.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/linux/up-dock.c b/src/linux/up-dock.c
index 59475f7..78fb7d3 100644
--- a/src/linux/up-dock.c
+++ b/src/linux/up-dock.c
@@ -106,14 +106,27 @@ up_dock_poll_cb (UpDock *dock)
/**
* up_dock_coldplug:
**/
+void
+up_dock_set_should_poll (UpDock *dock, gboolean should_poll)
+{
+ if (should_poll && dock->priv->poll_id == 0) {
+ dock->priv->poll_id = g_timeout_add_seconds (UP_DOCK_POLL_TIMEOUT,
+ (GSourceFunc) up_dock_poll_cb,
+ dock);
+ } else if (dock->priv->poll_id > 0) {
+ g_source_remove (dock->priv->poll_id);
+ dock->priv->poll_id = 0;
+ }
+}
+
+/**
+ * up_dock_coldplug:
+ **/
gboolean
up_dock_coldplug (UpDock *dock, UpDaemon *daemon)
{
/* save daemon */
dock->priv->daemon = g_object_ref (daemon);
- dock->priv->poll_id = g_timeout_add_seconds (UP_DOCK_POLL_TIMEOUT,
- (GSourceFunc) up_dock_poll_cb,
- dock);
return up_dock_refresh (dock);
}