[glibmm] Fix the build with --enable-warnings=fatal



commit 1ecb31b31a8da5b8d769c2b8ebe63054441e3a47
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Nov 1 23:08:56 2010 +0100

    Fix the build with --enable-warnings=fatal
    
    * glib/glibmm/main.[h|cc]: get_current_time(): undef G_DISABLE_DEPRECATED
    so this can build. Deprecate it to match the C API. Add get_time() which
    replaces it. However, we should replace our use of it, which seems difficult.

 ChangeLog           |    8 ++++++++
 glib/glibmm/main.cc |    9 +++++++++
 glib/glibmm/main.h  |   23 ++++++++++++++++++++++-
 3 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d34994b..e863eed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-11-01  Murray Cumming  <murrayc murrayc com>
+
+	Fix the build with --enable-warnings=fatal
+
+	* glib/glibmm/main.[h|cc]: get_current_time(): undef G_DISABLE_DEPRECATED 
+	so this can build. Deprecate it to match the C API. Add get_time() which 
+	replaces it. However, we should replace our use of it, which seems difficult.
+
 2010-11-01  José Alburquerque  <jaalburqu svn gnome org>
 
 	Application: Re-wrap according to the latest API.
diff --git a/glib/glibmm/main.cc b/glib/glibmm/main.cc
index e1c9a8a..754e642 100644
--- a/glib/glibmm/main.cc
+++ b/glib/glibmm/main.cc
@@ -18,6 +18,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#undef G_DISABLE_DEPRECATED //So we can use newly-deprecated API, to preserve our API.
 #include <glibmm/main.h>
 #include <glibmm/exceptionhandler.h>
 #include <glibmm/thread.h>
@@ -826,10 +827,18 @@ void Source::remove_poll(Glib::PollFD& poll_fd)
   g_source_remove_poll(gobject_, poll_fd.gobj());
 }
 
+#ifndef GLIBMM_DISABLE_DEPRECATED
 void Source::get_current_time(Glib::TimeVal& current_time)
 {
   g_source_get_current_time(gobject_, &current_time);
 }
+#endif //GLIBMM_DISABLE_DEPRECATED
+
+void Source::get_time(TimeSpec& timespec)
+{
+  g_source_get_time(gobject_, &timespec);
+}
+
 
 inline // static
 Source* Source::get_wrapper(GSource* source)
diff --git a/glib/glibmm/main.h b/glib/glibmm/main.h
index 85ba7c4..7dcf93d 100644
--- a/glib/glibmm/main.h
+++ b/glib/glibmm/main.h
@@ -34,6 +34,8 @@ class Cond;
 class Mutex;
 class IOChannel;
 
+typedef GTimeSpec TimeSpec; //TODO: Really wrap this?
+
 /** @defgroup MainLoop The Main Event Loop
  * Manages all available sources of events.
  * @{
@@ -671,10 +673,29 @@ protected:
    */
   void remove_poll(PollFD& poll_fd);
 
+#ifndef GLIBMM_DISABLE_DEPRECATED
   /** Gets the "current time" to be used when checking this source. The advantage of calling this function over calling get_current_time() directly is that when checking multiple sources, GLib can cache a single value instead of having to repeatedly get the system time.
-   * @param current_time Glib::TimeVal in which to store current time
+   * @param current_time Glib::TimeVal in which to store current time.
+   *
+   * @deprecated Use get_time() instead.
    */
   void get_current_time(Glib::TimeVal& current_time);
+#endif //GLIBMM_DISABLE_DEPRECATED
+
+  //TODO: Remove mention of g_get_monotonic time when we wrap it in C++.
+  /** Gets the time to be used when checking this source. The advantage of
+   * calling this function over calling g_get_monotonic_time() directly is
+   * that when checking multiple sources, GLib can cache a single value
+   * instead of having to repeatedly get the system monotonic time.
+   *
+   * The time here is the system monotonic time, if available, or some
+   * other reasonable alternative otherwise.  See g_get_monotonic_time().
+   *
+   * @param A TimeSpec in which to store the time.
+   *
+   * @newin{2,28}
+   */
+  void get_time(TimeSpec& timespec);
 
   virtual bool prepare(int& timeout) = 0;
   virtual bool check() = 0;



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