simple function to add a paused_set function to elementary clock.
puts the clock in a paused state (stops timer and flipping)
Index: src/lib/elm_clock.c
===================================================================
--- src/lib/elm_clock.c	(revision 55415)
+++ src/lib/elm_clock.c	(working copy)
@@ -617,6 +617,35 @@
 }
 
 /**
+ * Puts clock in a paused state
+ *
+ * @param obj The clock object
+ * @param paused Bool option for paused state (1 = yes, 0 = no)
+ *
+ * This function puts the clock in a paused state or restore its ticking,
+ * by deleting and restoring timers.
+ *
+ * @ingroup Clock
+ */
+EAPI void
+elm_clock_paused_set(Evas_Object *obj, Eina_Bool paused)
+{
+   ELM_CHECK_WIDTYPE(obj, widtype);
+   Widget_Data *wd = elm_widget_data_get(obj);
+   if (!wd) return ECORE_CALLBACK_CANCEL;
+   if (paused) { 
+     if (wd->ticker) ecore_timer_del(wd->ticker);
+   } else {
+     double t;
+     struct timeval timev;
+     struct tm *tm;
+     time_t tt;
+     t = ((double)(1000000 - timev.tv_usec)) / 1000000.0;
+     wd->ticker = ecore_timer_add(t, _ticker, obj);
+   }
+}
+
+/**
  * Set if the clock settings can be edited
  *
  * @param obj The clock object
------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to