[libpeas/proxys: 23/24] New function peas_method_get_info().
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas/proxys: 23/24] New function peas_method_get_info().
- Date: Sun, 23 May 2010 14:02:21 +0000 (UTC)
commit 6efcf4aee6c2338a4daddda5a6b0caf11a260884
Author: Steve Frécinaux <code istique net>
Date: Sat May 22 01:23:49 2010 +0200
New function peas_method_get_info().
libpeas/Makefile.am | 2 +-
libpeas/peas-introspection.c | 45 ++++++++++++++++++++++++-----------------
libpeas/peas-introspection.h | 5 ++++
3 files changed, 32 insertions(+), 20 deletions(-)
---
diff --git a/libpeas/Makefile.am b/libpeas/Makefile.am
index 247d431..9aabf02 100644
--- a/libpeas/Makefile.am
+++ b/libpeas/Makefile.am
@@ -75,7 +75,7 @@ if HAVE_INTROSPECTION
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS = Peas-2.0.gir
- introspection_sources = $(libpeas_2_0_la_SOURCES)
+ introspection_sources = $(INST_H_FILES) $(C_FILES)
Peas-2.0.gir: libpeas-2.0.la
Peas_2_0_gir_INCLUDES = GObject-2.0 Gtk-2.0 GModule-2.0
diff --git a/libpeas/peas-introspection.c b/libpeas/peas-introspection.c
index 05ef072..2fdfe74 100644
--- a/libpeas/peas-introspection.c
+++ b/libpeas/peas-introspection.c
@@ -121,26 +121,18 @@ read_next_argument (GArgument *cur_arg,
}
}
-gboolean
-peas_method_apply_valist (GObject *instance,
- GType iface_type,
- const gchar *method_name,
- va_list args)
+GICallableInfo *
+peas_method_get_info (GType iface_type,
+ const gchar *method_name)
{
GIRepository *repo;
GIBaseInfo *iface_info;
GIFunctionInfo *func_info;
- guint n_args, n_in_args, n_out_args;
- GArgument *in_args, *out_args;
- GArgument retval;
- guint i;
- gboolean ret;
- GError *error = NULL;
repo = g_irepository_get_default ();
iface_info = g_irepository_find_by_gtype (repo, iface_type);
if (iface_info == NULL)
- return FALSE;
+ return NULL;
switch (g_base_info_get_type (iface_info))
{
@@ -156,13 +148,29 @@ peas_method_apply_valist (GObject *instance,
func_info = NULL;
}
+ g_base_info_unref (iface_info);
+ return (GICallableInfo *) func_info;
+}
+
+gboolean
+peas_method_apply_valist (GObject *instance,
+ GType iface_type,
+ const gchar *method_name,
+ va_list args)
+{
+ GICallableInfo *func_info;
+ guint n_args, n_in_args, n_out_args;
+ GArgument *in_args, *out_args;
+ GArgument retval;
+ guint i;
+ gboolean ret;
+ GError *error = NULL;
+
+ func_info = peas_method_get_info (iface_type, method_name);
if (func_info == NULL)
- {
- g_base_info_unref (iface_info);
- return FALSE;
- }
+ return FALSE;
- n_args = g_callable_info_get_n_args ((GICallableInfo *) func_info);
+ n_args = g_callable_info_get_n_args (func_info);
n_in_args = 0;
n_out_args = 0;
@@ -177,7 +185,7 @@ peas_method_apply_valist (GObject *instance,
GIArgInfo *arg_info;
GITypeInfo *arg_type_info;
- arg_info = g_callable_info_get_arg ((GICallableInfo *) func_info, i);
+ arg_info = g_callable_info_get_arg (func_info, i);
arg_type_info = g_arg_info_get_type (arg_info);
switch (g_arg_info_get_direction (arg_info))
@@ -208,7 +216,6 @@ peas_method_apply_valist (GObject *instance,
g_free (in_args);
g_free (out_args);
g_base_info_unref ((GIBaseInfo *) func_info);
- g_base_info_unref (iface_info);
return ret;
}
diff --git a/libpeas/peas-introspection.h b/libpeas/peas-introspection.h
index e7f907c..46f121c 100644
--- a/libpeas/peas-introspection.h
+++ b/libpeas/peas-introspection.h
@@ -23,9 +23,14 @@
#define __PEAS_INTROSPECTION_H__
#include <glib-object.h>
+#include <girepository.h>
G_BEGIN_DECLS
+GICallableInfo
+ *peas_method_get_info (GType iface_type,
+ const gchar *method_name);
+
gboolean peas_method_apply_valist (GObject *instance,
GType iface_type,
const gchar *method_name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]