X-Git-Url: http://git.code-monkey.de/?p=ruby-edje.git;a=blobdiff_plain;f=src%2Frb_edje_main.c;h=d11d4565121cf206f3f1a460d18782173f0cd372;hp=7444762d1499f2638368f6529e1f23990aacf3da;hb=9df644ecd3547f65ac0685ce46c6f2f6bb50d089;hpb=0dffe66a476ec9d32291a3f37b7dc196860f22b5 diff --git a/src/rb_edje_main.c b/src/rb_edje_main.c index 7444762..d11d456 100644 --- a/src/rb_edje_main.c +++ b/src/rb_edje_main.c @@ -1,5 +1,5 @@ /* - * $Id: rb_edje_main.c 7 2004-06-19 19:32:33Z tilman $ + * $Id: rb_edje_main.c 330 2005-04-28 15:38:47Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -24,17 +24,79 @@ #include "rb_edje_main.h" #include "rb_edje.h" +#include "rb_part.h" -static VALUE m_init (VALUE self) +/* + * call-seq: + * Edje.freeze => nil + * + * Freezes all Edje::Edje objects. + */ +static VALUE m_freeze (VALUE self) +{ + edje_freeze (); + + return Qnil; +} + +/* + * call-seq: + * Edje.thaw => nil + * + * Thaws all Edje::Edje objects. + */ +static VALUE m_thaw (VALUE self) +{ + edje_thaw (); + + return Qnil; +} + +/* + * call-seq: + * Edje.frametime => float + * + * Returns the frametime (1 / fps) for the Edje library. + */ +static VALUE m_frametime_get (VALUE self) { - return INT2FIX (edje_init ()); + return rb_float_new (edje_frametime_get ()); } -static VALUE m_shutdown (VALUE self) +/* + * call-seq: + * Edje.frametime(float) + * + * Sets the frametime (1 / fps) for the Edje library. + */ +static VALUE m_frametime_set (VALUE self, VALUE val) { - rb_gc_start (); + Check_Type (val, T_FLOAT); + + edje_frametime_set (NUM2DBL (val)); + + 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 (); + + list = edje_file_collection_list (StringValuePtr (file)); + if (!list) + return ary; + + for (l = list; l; l = l->next) + rb_ary_push (ary, rb_str_new2 (l->data)); + + edje_file_collection_list_free (list); - return INT2FIX (edje_shutdown ()); + return ary; } void Init_edje (void) @@ -43,9 +105,13 @@ void Init_edje (void) 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 (); }