diff options
| author | Joakim Verona | 2013-04-08 22:02:38 +0200 |
|---|---|---|
| committer | Joakim Verona | 2013-04-08 22:02:38 +0200 |
| commit | ec741a19c38e9be9455c917b4951f0e967583a51 (patch) | |
| tree | b9c6c33d69b1925658101efe1943b4c853168135 /src | |
| parent | c1a5b51f2bb636d87d2315a68a074da113d82177 (diff) | |
| download | emacs-ec741a19c38e9be9455c917b4951f0e967583a51.tar.gz emacs-ec741a19c38e9be9455c917b4951f0e967583a51.zip | |
xwgir work
Diffstat (limited to 'src')
| -rw-r--r-- | src/xwidget.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/src/xwidget.c b/src/xwidget.c index 8a88a596163..77e3b00dae8 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -758,7 +758,43 @@ xwgir_convert_lisp_to_gir_arg(GIArgument* giarg, | |||
| 758 | return 0; | 758 | return 0; |
| 759 | } | 759 | } |
| 760 | 760 | ||
| 761 | DEFUN ("xwgir-call-method", Fxwgir_call_method, Sxwgir_call_method, 3, 3, 0, | 761 | |
| 762 | void | ||
| 763 | refactor_attempt(){ | ||
| 764 | //this methhod should be called from xwgir-xwidget-call-method and from xwgir xwidget construction | ||
| 765 | char* class = SDATA(Fcar(Fcdr(Fget(xw->type, Qcxwgir_class)))); | ||
| 766 | |||
| 767 | GIObjectInfo* obj_info = g_irepository_find_by_name(girepository, namespace, class); | ||
| 768 | GIFunctionInfo* f_info = g_object_info_find_method (obj_info, SDATA(method)); | ||
| 769 | |||
| 770 | //loop over args, convert from lisp to primitive type, given arg introspection data | ||
| 771 | //TODO g_callable_info_get_n_args(f_info) should match | ||
| 772 | int argscount = XFASTINT(Flength(arguments)); | ||
| 773 | if(argscount != g_callable_info_get_n_args(f_info)){ | ||
| 774 | printf("xwgir call method arg count doesn match! \n"); | ||
| 775 | return Qnil; | ||
| 776 | } | ||
| 777 | int i; | ||
| 778 | for (i = 1; i < argscount + 1; ++i) | ||
| 779 | { | ||
| 780 | xwgir_convert_lisp_to_gir_arg(&in_args[i], g_callable_info_get_arg(f_info, i - 1), Fnth(i - 1, arguments)); | ||
| 781 | } | ||
| 782 | |||
| 783 | in_args[0].v_pointer = widget; | ||
| 784 | if(g_function_info_invoke(f_info, | ||
| 785 | in_args, argscount + 1, | ||
| 786 | NULL, 0, | ||
| 787 | &return_value, | ||
| 788 | &error)) { | ||
| 789 | //g_error("ERROR: %s\n", error->message); | ||
| 790 | printf("invokation error\n"); | ||
| 791 | return Qnil; | ||
| 792 | } | ||
| 793 | return Qt; | ||
| 794 | } | ||
| 795 | |||
| 796 | |||
| 797 | DEFUN ("xwgir-xwidget-call-method", Fxwgir_xwidget_call_method, Sxwgir_xwidget_call_method, 3, 3, 0, | ||
| 762 | doc: /* call xwidget object method.*/) | 798 | doc: /* call xwidget object method.*/) |
| 763 | (Lisp_Object xwidget, Lisp_Object method, Lisp_Object arguments) | 799 | (Lisp_Object xwidget, Lisp_Object method, Lisp_Object arguments) |
| 764 | { | 800 | { |
| @@ -1562,7 +1598,7 @@ syms_of_xwidget (void) | |||
| 1562 | DEFSYM (Qwebkit_osr ,"webkit-osr"); | 1598 | DEFSYM (Qwebkit_osr ,"webkit-osr"); |
| 1563 | #endif | 1599 | #endif |
| 1564 | 1600 | ||
| 1565 | defsubr (&Sxwgir_call_method ); | 1601 | defsubr (&Sxwgir_xwidget_call_method ); |
| 1566 | defsubr (&Sxwgir_require_namespace); | 1602 | defsubr (&Sxwgir_require_namespace); |
| 1567 | defsubr (&Sxwidget_size_request ); | 1603 | defsubr (&Sxwidget_size_request ); |
| 1568 | defsubr (&Sxwidget_delete_zombies); | 1604 | defsubr (&Sxwidget_delete_zombies); |