[15285] | 1 | /* gnomelib-support.c -- helper functions for GNOME binding |
---|
[18403] | 2 | $Id: gnomelib-support.c,v 1.1.1.2 2003-01-05 00:30:04 ghudson Exp $ */ |
---|
[15285] | 3 | |
---|
| 4 | #include <config.h> |
---|
| 5 | #include <assert.h> |
---|
| 6 | #include <gnome.h> |
---|
| 7 | #include "rep-gtk.h" |
---|
| 8 | #include "rep-gnome.h" |
---|
| 9 | #include <string.h> |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | /* metadata */ |
---|
| 13 | |
---|
[18403] | 14 | #ifdef XXX |
---|
| 15 | |
---|
[15285] | 16 | GnomeMetadataError_t |
---|
| 17 | sgtk_gnome_metadata_set (const char *file, const char *name, repv data) |
---|
| 18 | { |
---|
| 19 | if (rep_STRINGP (data)) |
---|
| 20 | { |
---|
| 21 | return gnome_metadata_set (file, name, |
---|
| 22 | rep_STRING_LEN (data), rep_STR (data)); |
---|
| 23 | } |
---|
| 24 | else |
---|
| 25 | return GNOME_METADATA_NOT_FOUND; |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | repv |
---|
| 29 | sgtk_gnome_metadata_get (const char *file, const char *name) |
---|
| 30 | { |
---|
| 31 | int size; |
---|
| 32 | char *buffer; |
---|
| 33 | if (gnome_metadata_get (file, name, &size, &buffer) == 0) |
---|
| 34 | { |
---|
| 35 | repv ret = rep_string_dupn (buffer, size); |
---|
| 36 | g_free (buffer); |
---|
| 37 | return ret; |
---|
| 38 | } |
---|
| 39 | else |
---|
| 40 | return Qnil; |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | repv |
---|
| 44 | sgtk_gnome_metadata_get_fast (const char *file, const char *name) |
---|
| 45 | { |
---|
| 46 | int size; |
---|
| 47 | char *buffer; |
---|
| 48 | if (gnome_metadata_get_fast (file, name, &size, &buffer) == 0) |
---|
| 49 | { |
---|
| 50 | repv ret = rep_string_dupn (buffer, size); |
---|
| 51 | g_free (buffer); |
---|
| 52 | return ret; |
---|
| 53 | } |
---|
| 54 | else |
---|
| 55 | return Qnil; |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | void |
---|
| 59 | sgtk_gnome_metadata_regex_add (const char *regex, const char *key, repv data) |
---|
| 60 | { |
---|
| 61 | if (rep_STRINGP (data)) |
---|
| 62 | { |
---|
| 63 | gnome_metadata_regex_add (regex, key, |
---|
| 64 | rep_STRING_LEN (data), rep_STR (data)); |
---|
| 65 | } |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | void |
---|
| 69 | sgtk_gnome_metadata_type_add (const char *regex, const char *key, repv data) |
---|
| 70 | { |
---|
| 71 | if (rep_STRINGP (data)) |
---|
| 72 | { |
---|
| 73 | gnome_metadata_type_add (regex, key, |
---|
| 74 | rep_STRING_LEN (data), rep_STR (data)); |
---|
| 75 | } |
---|
| 76 | } |
---|
| 77 | |
---|
[18403] | 78 | #endif /* XXX */ |
---|
| 79 | |
---|
[15285] | 80 | |
---|
| 81 | /* dl hooks / init */ |
---|
| 82 | |
---|
| 83 | repv |
---|
| 84 | rep_dl_init (void) |
---|
| 85 | { |
---|
[18403] | 86 | repv s = rep_push_structure ("gui.gtk-2.gnome-lib"); |
---|
[15285] | 87 | sgtk_gnome_init_gnome_glue (); |
---|
| 88 | return rep_pop_structure (s); |
---|
| 89 | } |
---|