Tue, 14 Feb 2006 05:43:43 +0000
[gaim-migrate @ 15646]
Always show a vertical scrollbar on conversations imhtmls. This will solve the shrinking conversation window bug. I chose this approach instead of saving the size of the window (as I had previous talked about), as this prevents the contents of the scrollback from rewrapping when the scrollbars appear or disappear. It also just seems to feel like the right thing to do, but maybe that's me being lazy.
| 11660 | 1 | /* |
| 2 | * Mono Plugin Loader | |
| 3 | * | |
| 4 | * -- Thanks to the perl plugin loader for all the great tips ;-) | |
| 5 | * | |
| 6 | * Eoin Coffey | |
| 7 | */ | |
| 8 | ||
| 9 | #ifdef HAVE_CONFIG_H | |
| 10 | #include <config.h> | |
| 11 | #endif | |
| 12 | ||
| 13 | #include <glib.h> | |
| 14 | #include <string.h> | |
| 15 | #include "mono-helper.h" | |
| 16 | #include "mono-glue.h" | |
| 17 | #include "value.h" | |
|
11952
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
18 | #include "debug.h" |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
19 | |
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
20 | static gboolean _runtime_active = FALSE; |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
21 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
22 | gboolean ml_init() |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
23 | { |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
24 | MonoDomain *d; |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
25 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
26 | g_return_val_if_fail(_runtime_active == FALSE, TRUE); |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
27 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
28 | d = mono_jit_init("gaim"); |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
29 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
30 | if (!d) { |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
31 | ml_set_domain(NULL); |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
32 | return FALSE; |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
33 | } |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
34 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
35 | ml_set_domain(d); |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
36 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
37 | ml_init_internal_calls(); |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
38 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
39 | _runtime_active = TRUE; |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
40 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
41 | return TRUE; |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
42 | } |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
43 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
44 | void ml_uninit() |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
45 | { |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
46 | g_return_if_fail(_runtime_active == TRUE); |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
47 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
48 | mono_jit_cleanup(ml_get_domain()); |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
49 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
50 | ml_set_domain(NULL); |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
51 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
52 | _runtime_active = FALSE; |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
53 | } |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
54 | |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
55 | MonoObject* ml_delegate_invoke(MonoObject *method, void **params) |
|
11952
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
56 | { |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
57 | MonoObject *ret, *exception; |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
58 | |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
59 | ret = mono_runtime_delegate_invoke(method, params, &exception); |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
60 | if (exception) { |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
61 | gaim_debug(GAIM_DEBUG_ERROR, "mono", "caught exception: %s\n", mono_class_get_name(mono_object_get_class(exception))); |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
62 | } |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
63 | |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
64 | return ret; |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
65 | } |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
66 | |
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
67 | MonoObject* ml_invoke(MonoMethod *method, void *obj, void **params) |
|
11952
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
68 | { |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
69 | MonoObject *ret, *exception; |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
70 | |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
71 | ret = mono_runtime_invoke(method, obj, params, &exception); |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
72 | if (exception) { |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
73 | gaim_debug(GAIM_DEBUG_ERROR, "mono", "caught exception: %s\n", mono_class_get_name(mono_object_get_class(exception))); |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
74 | } |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
75 | |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
76 | return ret; |
|
9cefc8360bff
[gaim-migrate @ 14243]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11786
diff
changeset
|
77 | } |
| 11660 | 78 | |
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
79 | MonoClass* ml_find_plugin_class(MonoImage *image) |
| 11660 | 80 | { |
| 81 | MonoClass *klass, *pklass = NULL; | |
| 82 | int i, total; | |
| 83 | ||
| 84 | total = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF); | |
| 85 | for (i = 1; i <= total; ++i) { | |
| 86 | klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | i); | |
| 87 | pklass = mono_class_get_parent(klass); | |
| 88 | if (pklass) | |
| 89 | if (strcmp("GaimPlugin", mono_class_get_name(pklass)) == 0) | |
| 90 | return klass; | |
| 91 | } | |
| 92 | ||
| 93 | return NULL; | |
| 94 | } | |
| 95 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
96 | void ml_set_prop_string(MonoObject *obj, char *field, char *data) |
| 11660 | 97 | { |
| 98 | MonoClass *klass; | |
| 99 | MonoProperty *prop; | |
| 100 | MonoString *str; | |
| 101 | gpointer args[1]; | |
| 102 | ||
| 103 | klass = mono_object_get_class(obj); | |
| 104 | ||
| 105 | prop = mono_class_get_property_from_name(klass, field); | |
| 106 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
107 | str = mono_string_new(ml_get_domain(), data); |
| 11660 | 108 | |
| 109 | args[0] = str; | |
| 110 | ||
| 111 | mono_property_set_value(prop, obj, args, NULL); | |
| 112 | } | |
| 113 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
114 | gchar* ml_get_prop_string(MonoObject *obj, char *field) |
| 11660 | 115 | { |
| 116 | MonoClass *klass; | |
| 117 | MonoProperty *prop; | |
| 118 | MonoString *str; | |
| 119 | ||
| 120 | klass = mono_object_get_class(obj); | |
| 121 | ||
| 122 | prop = mono_class_get_property_from_name(klass, field); | |
| 123 | ||
| 124 | str = (MonoString*)mono_property_get_value(prop, obj, NULL, NULL); | |
| 125 | ||
| 126 | return mono_string_to_utf8(str); | |
| 127 | } | |
| 128 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
129 | gboolean ml_is_api_dll(MonoImage *image) |
| 11660 | 130 | { |
| 131 | MonoClass *klass; | |
| 132 | int i, total; | |
| 133 | ||
| 134 | total = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF); | |
| 135 | for (i = 1; i <= total; ++i) { | |
| 136 | klass = mono_class_get (image, MONO_TOKEN_TYPE_DEF | i); | |
| 137 | if (strcmp(mono_class_get_name(klass), "Debug") == 0) | |
| 138 | if (strcmp(mono_class_get_namespace(klass), "Gaim") == 0) { | |
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
139 | ml_set_api_image(image); |
| 11660 | 140 | return TRUE; |
| 141 | } | |
| 142 | } | |
| 143 | ||
| 144 | return FALSE; | |
| 145 | } | |
| 146 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
147 | MonoObject* ml_object_from_gaim_type(GaimType type, gpointer data) |
| 11660 | 148 | { |
| 149 | return NULL; | |
| 150 | } | |
| 151 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
152 | MonoObject* ml_object_from_gaim_subtype(GaimSubType type, gpointer data) |
| 11660 | 153 | { |
|
11776
58fd4b78788a
[gaim-migrate @ 14067]
Gary Kramlich <grim@reaperworld.com>
parents:
11660
diff
changeset
|
154 | MonoObject *obj = NULL; |
| 11660 | 155 | |
| 156 | switch (type) { | |
| 157 | case GAIM_SUBTYPE_BLIST_BUDDY: | |
| 158 | obj = gaim_blist_build_buddy_object(data); | |
| 159 | break; | |
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
160 | case GAIM_SUBTYPE_STATUS: |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
161 | obj = gaim_status_build_status_object(data); |
|
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
162 | break; |
| 11660 | 163 | default: |
| 164 | break; | |
| 165 | } | |
| 166 | ||
| 167 | return obj; | |
| 168 | } | |
| 169 | ||
|
11996
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
170 | MonoObject* ml_create_api_object(char *class_name) |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
171 | { |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
172 | MonoObject *obj = NULL; |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
173 | MonoClass *klass = NULL; |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
174 | |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
175 | klass = mono_class_from_name(ml_get_api_image(), "Gaim", class_name); |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
176 | if (!klass) { |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
177 | gaim_debug(GAIM_DEBUG_FATAL, "mono", "couldn't find the '%s' class\n", class_name); |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
178 | return NULL; |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
179 | } |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
180 | |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
181 | obj = mono_object_new(ml_get_domain(), klass); |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
182 | if (!obj) { |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
183 | gaim_debug(GAIM_DEBUG_FATAL, "mono", "couldn't create the object from class '%s'\n", class_name); |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
184 | return NULL; |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
185 | } |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
186 | |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
187 | mono_runtime_object_init(obj); |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
188 | |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
189 | return obj; |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
190 | } |
|
858bd928831c
[gaim-migrate @ 14289]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11980
diff
changeset
|
191 | |
|
11786
d0067c6e542a
[gaim-migrate @ 14077]
Gary Kramlich <grim@reaperworld.com>
parents:
11776
diff
changeset
|
192 | static MonoDomain *_domain = NULL; |
| 11660 | 193 | |
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
194 | MonoDomain* ml_get_domain(void) |
| 11660 | 195 | { |
| 196 | return _domain; | |
| 197 | } | |
| 198 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
199 | void ml_set_domain(MonoDomain *d) |
| 11660 | 200 | { |
| 201 | _domain = d; | |
| 202 | } | |
| 203 | ||
| 204 | static MonoImage *_api_image = NULL; | |
| 205 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
206 | void ml_set_api_image(MonoImage *image) |
| 11660 | 207 | { |
| 208 | _api_image = image; | |
| 209 | } | |
| 210 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
211 | MonoImage* ml_get_api_image() |
| 11660 | 212 | { |
| 213 | return _api_image; | |
| 214 | } | |
| 215 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
216 | void ml_init_internal_calls(void) |
| 11660 | 217 | { |
| 218 | mono_add_internal_call("Gaim.Debug::_debug", gaim_debug_glue); | |
| 219 | mono_add_internal_call("Gaim.Signal::_connect", gaim_signal_connect_glue); | |
| 220 | mono_add_internal_call("Gaim.BuddyList::_get_handle", gaim_blist_get_handle_glue); | |
| 221 | } | |
| 222 | ||
| 223 | static GHashTable *plugins_hash = NULL; | |
| 224 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
225 | void ml_add_plugin(GaimMonoPlugin *plugin) |
| 11660 | 226 | { |
| 227 | if (!plugins_hash) | |
| 228 | plugins_hash = g_hash_table_new(NULL, NULL); | |
| 229 | ||
| 230 | g_hash_table_insert(plugins_hash, plugin->klass, plugin); | |
| 231 | } | |
| 232 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
233 | gboolean ml_remove_plugin(GaimMonoPlugin *plugin) |
| 11660 | 234 | { |
| 235 | return g_hash_table_remove(plugins_hash, plugin->klass); | |
| 236 | } | |
| 237 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
238 | gpointer ml_find_plugin(GaimMonoPlugin *plugin) |
| 11660 | 239 | { |
| 240 | return g_hash_table_lookup(plugins_hash, plugin->klass); | |
| 241 | } | |
| 242 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
243 | gpointer ml_find_plugin_by_class(MonoClass *klass) |
| 11660 | 244 | { |
| 245 | return g_hash_table_lookup(plugins_hash, klass); | |
| 246 | } | |
| 247 | ||
|
11980
fe5c2c58508c
[gaim-migrate @ 14273]
Eoin Coffey <ecoffey@soc.pidgin.im>
parents:
11952
diff
changeset
|
248 | GHashTable* ml_get_plugin_hash() |
| 11660 | 249 | { |
| 250 | return plugins_hash; | |
| 251 | } |