pygobject r911 - in trunk: . gio glib
- From: johan svn gnome org
- To: svn-commits-list gnome org
- Subject: pygobject r911 - in trunk: . gio glib
- Date: Sat, 2 Aug 2008 06:13:46 +0000 (UTC)
Author: johan
Date: Sat Aug 2 06:13:46 2008
New Revision: 911
URL: http://svn.gnome.org/viewvc/pygobject?rev=911&view=rev
Log:
2008-08-02 Johan Dahlin <johan gnome org>
* gio/gfileinfo.override:
* gio/gio.override:
* glib/glibmodule.c (pyglib_get_current_time):
* glib/pyglib.c (pyglib_float_from_timeval):
* glib/pyglib.h:
Add pyglib_float_from_timeval and use it
Modified:
trunk/ChangeLog
trunk/gio/gfileinfo.override
trunk/gio/gio.override
trunk/glib/glibmodule.c
trunk/glib/pyglib.c
trunk/glib/pyglib.h
Modified: trunk/gio/gfileinfo.override
==============================================================================
--- trunk/gio/gfileinfo.override (original)
+++ trunk/gio/gfileinfo.override Sat Aug 2 06:13:46 2008
@@ -56,12 +56,9 @@
_wrap_g_file_info_get_modification_time(PyGObject *self, PyObject *unused)
{
GTimeVal timeval;
- double ret;
g_file_info_get_modification_time(G_FILE_INFO(self->obj), &timeval);
-
- ret = (double)timeval.tv_sec + (double)timeval.tv_usec * 0.000001;
- return PyFloat_FromDouble(ret);
+ return pyglib_float_from_timeval(timeval);
}
/* GFileInfo.get_attribute_data: No ArgType for GFileAttributeType* */
Modified: trunk/gio/gio.override
==============================================================================
--- trunk/gio/gio.override (original)
+++ trunk/gio/gio.override Sat Aug 2 06:13:46 2008
@@ -29,6 +29,7 @@
#include <pygobject.h>
#include <gio/gio.h>
#include "pygio-utils.h"
+#include "pyglib.h"
#define BUFSIZE 8192
Modified: trunk/glib/glibmodule.c
==============================================================================
--- trunk/glib/glibmodule.c (original)
+++ trunk/glib/glibmodule.c Sat Aug 2 06:13:46 2008
@@ -401,11 +401,9 @@
pyglib_get_current_time(PyObject *unused)
{
GTimeVal timeval;
- double ret;
g_get_current_time(&timeval);
- ret = (double)timeval.tv_sec + (double)timeval.tv_usec * 0.000001;
- return PyFloat_FromDouble(ret);
+ return pyglib_float_from_timeval(timeval);
}
static PyObject *
Modified: trunk/glib/pyglib.c
==============================================================================
--- trunk/glib/pyglib.c (original)
+++ trunk/glib/pyglib.c Sat Aug 2 06:13:46 2008
@@ -471,6 +471,22 @@
return (PyObject *)self;
}
+/**
+ * pyglib_option_context_new:
+ * @context: a GTimeVal struct
+ *
+ * Converts a GTimeVal struct to a python float
+ *
+ * Returns: a float representing the timeval
+ */
+PyObject *
+pyglib_float_from_timeval(GTimeVal timeval)
+{
+ double ret;
+ ret = (double)timeval.tv_sec + (double)timeval.tv_usec * 0.000001;
+ return PyFloat_FromDouble(ret);
+}
+
/****** Private *****/
Modified: trunk/glib/pyglib.h
==============================================================================
--- trunk/glib/pyglib.h (original)
+++ trunk/glib/pyglib.h Sat Aug 2 06:13:46 2008
@@ -48,6 +48,7 @@
PyObject * pyglib_option_context_new(GOptionContext *context);
PyObject * pyglib_option_group_new(GOptionGroup *group);
GOptionGroup * pyglib_option_group_transfer_group(PyObject *self);
+PyObject * pyglib_float_from_timeval(GTimeVal timeval);
#define pyglib_begin_allow_threads \
G_STMT_START { \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]