X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;ds=inline;f=src%2Frb_edje_main.c;h=eef4cfbd0b43c21dfcef5e460dcad8ac7504b878;hb=00a4c037d60430de9f496f26804474949dceebad;hp=f9c37bc6c54930ebaec15bceb6a6925428c84eef;hpb=e677d2b2bc8c9bbe883278a0f5b63e16a14820cf;p=ruby-edje.git
diff --git a/src/rb_edje_main.c b/src/rb_edje_main.c
index f9c37bc..eef4cfb 100644
--- a/src/rb_edje_main.c
+++ b/src/rb_edje_main.c
@@ -1,6 +1,4 @@
/*
- * $Id: rb_edje_main.c 17 2004-06-22 19:37:54Z tilman $
- *
* Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
*
* This library is free software; you can redistribute it and/or
@@ -24,60 +22,109 @@
#include "rb_edje_main.h"
#include "rb_edje.h"
+#include "rb_part.h"
-static VALUE m_init (VALUE self)
-{
- return INT2FIX (edje_init ());
-}
-
-static VALUE m_shutdown (VALUE self)
-{
- rb_gc_start ();
-
- return INT2FIX (edje_shutdown ());
-}
-
+/*
+ * call-seq:
+ * Edje.freeze => nil
+ *
+ * Freezes all Edje::Edje
objects.
+ */
static VALUE m_freeze (VALUE self)
{
+ edje_init ();
edje_freeze ();
+ edje_shutdown ();
return Qnil;
}
+/*
+ * call-seq:
+ * Edje.thaw => nil
+ *
+ * Thaws all Edje::Edje
objects.
+ */
static VALUE m_thaw (VALUE self)
{
+ edje_init ();
edje_thaw ();
+ edje_shutdown ();
return Qnil;
}
+/*
+ * call-seq:
+ * Edje.frametime => float
+ *
+ * Returns the frametime (1 / fps) for the Edje library.
+ */
static VALUE m_frametime_get (VALUE self)
{
- return rb_float_new (edje_frametime_get ());
+ VALUE ret;
+
+ edje_init ();
+ ret = rb_float_new (edje_frametime_get ());
+ edje_shutdown ();
+
+ return ret;
}
+/*
+ * call-seq:
+ * Edje.frametime(float)
+ *
+ * Sets the frametime (1 / fps) for the Edje library.
+ */
static VALUE m_frametime_set (VALUE self, VALUE val)
{
Check_Type (val, T_FLOAT);
+ edje_init ();
edje_frametime_set (NUM2DBL (val));
+ edje_shutdown ();
return Qnil;
}
+static VALUE m_collections_get (VALUE self, VALUE file)
+{
+ VALUE ary;
+ Evas_List *list, *l;
+
+ Check_Type (file, T_STRING);
+
+ ary = rb_ary_new ();
+
+ edje_init ();
+
+ list = edje_file_collection_list (StringValuePtr (file));
+ if (list) {
+ for (l = list; l; l = l->next)
+ rb_ary_push (ary, rb_str_new2 (l->data));
+
+ edje_file_collection_list_free (list);
+ }
+
+ edje_shutdown ();
+
+ return ary;
+}
+
void Init_edje (void)
{
rb_require ("evas");
mEdje = rb_define_module ("Edje");
- rb_define_module_function (mEdje, "init", m_init, 0);
- rb_define_module_function (mEdje, "shutdown", m_shutdown, 0);
rb_define_module_function (mEdje, "freeze", m_freeze, 0);
rb_define_module_function (mEdje, "thaw", m_thaw, 0);
rb_define_module_function (mEdje, "frametime", m_frametime_get, 0);
rb_define_module_function (mEdje, "frametime=", m_frametime_set, 1);
+ rb_define_module_function (mEdje, "collections", m_collections_get, 1);
Init_Edje ();
+ Init_Part ();
}