File: gnomelib-support.c

package info (click to toggle)
rep-gtk 0.18.cvs20060518-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,704 kB
  • ctags: 369
  • sloc: sh: 7,421; ansic: 3,833; lisp: 1,140; makefile: 152
file content (89 lines) | stat: -rw-r--r-- 1,729 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/* gnomelib-support.c -- helper functions for GNOME binding
   $Id: gnomelib-support.c,v 1.7 2002/01/30 07:58:36 jsh Exp $ */

#include <config.h>
#include <assert.h>
#include <gnome.h>
#include "rep-gtk.h"
#include "rep-gnome.h"
#include <string.h>


/* metadata */

#ifdef XXX

GnomeMetadataError_t
sgtk_gnome_metadata_set (const char *file, const char *name, repv data)
{
    if (rep_STRINGP (data))
    {
	return gnome_metadata_set (file, name,
				   rep_STRING_LEN (data), rep_STR (data));
    }
    else
	return GNOME_METADATA_NOT_FOUND;
}

repv
sgtk_gnome_metadata_get (const char *file, const char *name)
{
    int size;
    char *buffer;
    if (gnome_metadata_get (file, name, &size, &buffer) == 0)
    {
	repv ret = rep_string_dupn (buffer, size);
	g_free (buffer);
	return ret;
    }
    else
	return Qnil;
}

repv
sgtk_gnome_metadata_get_fast (const char *file, const char *name)
{
    int size;
    char *buffer;
    if (gnome_metadata_get_fast (file, name, &size, &buffer) == 0)
    {
	repv ret = rep_string_dupn (buffer, size);
	g_free (buffer);
	return ret;
    }
    else
	return Qnil;
}

void
sgtk_gnome_metadata_regex_add (const char *regex, const char *key, repv data)
{
    if (rep_STRINGP (data))
    {
	gnome_metadata_regex_add (regex, key,
				  rep_STRING_LEN (data), rep_STR (data));
    }
}

void
sgtk_gnome_metadata_type_add (const char *regex, const char *key, repv data)
{
    if (rep_STRINGP (data))
    {
	gnome_metadata_type_add (regex, key,
				 rep_STRING_LEN (data), rep_STR (data));
    }
}

#endif /* XXX */


/* dl hooks / init */

repv
rep_dl_init (void)
{
    repv s = rep_push_structure ("gui.gtk-2.gnome-lib");
    sgtk_gnome_init_gnome_glue ();
    return rep_pop_structure (s);
}