gtksourceview3 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,143 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbgtksourceview3private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cGutterRenderer
24
+ #define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERER(self))
25
+
26
+ static VALUE
27
+ rg_end(VALUE self)
28
+ {
29
+ gtk_source_gutter_renderer_end(_SELF(self));
30
+
31
+ return self;
32
+ }
33
+
34
+ static VALUE
35
+ rg_begin(VALUE self, VALUE cr, VALUE background_area, VALUE cell_area, VALUE start, VALUE end)
36
+ {
37
+ gtk_source_gutter_renderer_begin(_SELF(self),
38
+ RVAL2CRCONTEXT(cr),
39
+ RVAL2GDKRECTANGLE(background_area),
40
+ RVAL2GDKRECTANGLE(cell_area),
41
+ RVAL2GTKTEXTITER(start),
42
+ RVAL2GTKTEXTITER(end));
43
+ if (rb_block_given_p())
44
+ rb_ensure(rb_yield, self, rg_end, self);
45
+
46
+ return self;
47
+ }
48
+
49
+ static VALUE
50
+ rg_draw(VALUE self, VALUE cr, VALUE background_area, VALUE cell_area, VALUE start, VALUE end, VALUE state)
51
+ {
52
+ gtk_source_gutter_renderer_draw(_SELF(self),
53
+ RVAL2CRCONTEXT(cr),
54
+ RVAL2GDKRECTANGLE(background_area),
55
+ RVAL2GDKRECTANGLE(cell_area),
56
+ RVAL2GTKTEXTITER(start),
57
+ RVAL2GTKTEXTITER(end),
58
+ RVAL2GTKSOURCEGUTTERRENDERERSTATE(state));
59
+
60
+ return self;
61
+ }
62
+
63
+ static VALUE
64
+ rg_alignment(VALUE self)
65
+ {
66
+ gfloat xalign, yalign;
67
+
68
+ gtk_source_gutter_renderer_get_alignment(_SELF(self), &xalign, &yalign);
69
+
70
+ return rb_ary_new3(2, xalign, yalign);
71
+ }
72
+
73
+ static VALUE
74
+ rg_background(VALUE self)
75
+ {
76
+ GdkRGBA color;
77
+ gboolean result;
78
+
79
+ result = gtk_source_gutter_renderer_get_background(_SELF(self), &color);
80
+
81
+ return result ? GDKRGBA2RVAL(&color) : Qnil;
82
+ }
83
+
84
+ static VALUE
85
+ rg_padding(VALUE self)
86
+ {
87
+ gint xpad, ypad;
88
+
89
+ gtk_source_gutter_renderer_get_padding(_SELF(self), &xpad, &ypad);
90
+
91
+ return rb_ary_new3(2, INT2NUM(xpad), INT2NUM(ypad));
92
+ }
93
+
94
+ static VALUE
95
+ rg_queue_draw(VALUE self)
96
+ {
97
+ gtk_source_gutter_renderer_queue_draw(_SELF(self));
98
+
99
+ return self;
100
+ }
101
+
102
+ static VALUE
103
+ rg_set_alignment(VALUE self, VALUE xalign, VALUE yalign)
104
+ {
105
+ gtk_source_gutter_renderer_set_alignment(_SELF(self), NUM2DBL(xalign), NUM2DBL(yalign));
106
+
107
+ return self;
108
+ }
109
+
110
+ static VALUE
111
+ rg_set_background(VALUE self, VALUE color)
112
+ {
113
+ gtk_source_gutter_renderer_set_background(_SELF(self), RVAL2GDKRGBA(color));
114
+
115
+ return self;
116
+ }
117
+
118
+ static VALUE
119
+ rg_set_padding(VALUE self, VALUE xpad, VALUE ypad)
120
+ {
121
+ gtk_source_gutter_renderer_set_padding(_SELF(self), NUM2INT(xpad), NUM2INT(ypad));
122
+
123
+ return self;
124
+ }
125
+
126
+ void
127
+ Init_gtksource_gutterrenderer(VALUE mGtkSource)
128
+ {
129
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER, "GutterRenderer", mGtkSource);
130
+ G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_ALIGNMENT_MODE, "AlignmentMode", RG_TARGET_NAMESPACE);
131
+ G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_STATE, "State", RG_TARGET_NAMESPACE);
132
+
133
+ RG_DEF_METHOD(alignment, 0);
134
+ RG_DEF_METHOD(background, 0);
135
+ RG_DEF_METHOD(begin, 5);
136
+ RG_DEF_METHOD(draw, 6);
137
+ RG_DEF_METHOD(end, 0);
138
+ RG_DEF_METHOD(padding, 0);
139
+ RG_DEF_METHOD(queue_draw, 0);
140
+ RG_DEF_METHOD(set_alignment, 2);
141
+ RG_DEF_METHOD(set_background, 1);
142
+ RG_DEF_METHOD(set_padding, 2);
143
+ }
@@ -0,0 +1,42 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbgtksourceview3private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cGutterRendererPixbuf
24
+ #define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERERPIXBUF(self))
25
+
26
+ static VALUE
27
+ rg_initialize(VALUE self)
28
+ {
29
+ G_INITIALIZE(self, gtk_source_gutter_renderer_pixbuf_new());
30
+
31
+ return Qnil;
32
+ }
33
+
34
+ void
35
+ Init_gtksource_gutterrendererpixbuf(VALUE mGtkSource)
36
+ {
37
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_PIXBUF, "GutterRendererPixbuf", mGtkSource);
38
+
39
+ RG_DEF_METHOD(initialize, 0);
40
+
41
+ RG_REG_GLIBID_SETTER("stock-id");
42
+ }
@@ -0,0 +1,64 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbgtksourceview3private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cGutterRendererText
24
+ #define _SELF(self) (RVAL2GTKSOURCEGUTTERRENDERERTEXT(self))
25
+
26
+ static VALUE
27
+ rg_initialize(VALUE self)
28
+ {
29
+ G_INITIALIZE(self, gtk_source_gutter_renderer_text_new());
30
+
31
+ return Qnil;
32
+ }
33
+
34
+ static VALUE
35
+ rg_set_markup(VALUE self, VALUE markup)
36
+ {
37
+ StringValue(markup);
38
+ gtk_source_gutter_renderer_text_set_markup(_SELF(self),
39
+ RSTRING_PTR(markup),
40
+ RSTRING_LEN(markup));
41
+
42
+ return self;
43
+ }
44
+
45
+ static VALUE
46
+ rg_set_text(VALUE self, VALUE text)
47
+ {
48
+ StringValue(text);
49
+ gtk_source_gutter_renderer_text_set_text(_SELF(self),
50
+ RSTRING_PTR(text),
51
+ RSTRING_LEN(text));
52
+
53
+ return self;
54
+ }
55
+
56
+ void
57
+ Init_gtksource_gutterrenderertext(VALUE mGtkSource)
58
+ {
59
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_GUTTER_RENDERER_TEXT, "GutterRendererText", mGtkSource);
60
+
61
+ RG_DEF_METHOD(initialize, 0);
62
+ RG_DEF_METHOD(set_markup, 1);
63
+ RG_DEF_METHOD(set_text, 1);
64
+ }
@@ -0,0 +1,124 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2004 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301 USA
21
+ */
22
+
23
+ #include "rbgtksourceview3private.h"
24
+
25
+ /* Class: Gtk::SourceLanguage
26
+ * Source language.
27
+ */
28
+
29
+ #define RG_TARGET_NAMESPACE cLanguage
30
+ #define _SELF(self) (RVAL2GTKSOURCELANGUAGE(self))
31
+
32
+ /* Method: get_metadata(name)
33
+ * name: the metadata property name (string)
34
+ * Returns: the localized metadata for the given name.
35
+ */
36
+ static VALUE
37
+ rg_get_metadata(VALUE self, VALUE name)
38
+ {
39
+ return
40
+ CSTR2RVAL (gtk_source_language_get_metadata
41
+ (_SELF (self), RVAL2CSTR(name)));
42
+ }
43
+
44
+ /* Method: mime_types
45
+ * Returns: a list of mime types for the given language, as an array of strings.
46
+ */
47
+ static VALUE
48
+ rg_mime_types(VALUE self)
49
+ {
50
+ VALUE ary;
51
+ char **types = gtk_source_language_get_mime_types (_SELF (self));
52
+ if (!types)
53
+ return Qnil;
54
+
55
+ ary = rb_ary_new();
56
+ while (*types){
57
+ rb_ary_push(ary, CSTR2RVAL(*types));
58
+ types++;
59
+ }
60
+ return ary;
61
+ }
62
+
63
+ /* Method: globs
64
+ * Returns: a list of globs for the given language, as an array of strings.
65
+ */
66
+ static VALUE
67
+ rg_globs(VALUE self)
68
+ {
69
+ VALUE ary;
70
+ char **globs = gtk_source_language_get_globs (_SELF (self));
71
+ if (!globs)
72
+ return Qnil;
73
+
74
+ ary = rb_ary_new();
75
+ while (*globs){
76
+ rb_ary_push(ary, CSTR2RVAL(*globs));
77
+ globs++;
78
+ }
79
+ return ary;
80
+ }
81
+
82
+ /* Method: get_style_name(style_id)
83
+ * style_id: the style id (string)
84
+ * Returns: the localized style name of the given id.
85
+ */
86
+ static VALUE
87
+ rg_get_style_name(VALUE self, VALUE style_id)
88
+ {
89
+ return
90
+ CSTR2RVAL (gtk_source_language_get_style_name
91
+ (_SELF (self), RVAL2CSTR(style_id)));
92
+ }
93
+
94
+ /* Method: style_id
95
+ * Returns: the styles defined by the language.
96
+ */
97
+ static VALUE
98
+ rg_style_ids(VALUE self)
99
+ {
100
+ VALUE ary;
101
+ gchar **ids = gtk_source_language_get_style_ids (_SELF (self));
102
+ if (!ids)
103
+ return Qnil;
104
+
105
+ ary = rb_ary_new();
106
+ while (*ids){
107
+ rb_ary_push(ary, CSTR2RVAL(*ids));
108
+ ids++;
109
+ }
110
+ return ary;
111
+ }
112
+
113
+ void
114
+ Init_gtksource_language (VALUE mGtkSource)
115
+ {
116
+ VALUE RG_TARGET_NAMESPACE =
117
+ G_DEF_CLASS (GTK_SOURCE_TYPE_LANGUAGE, "Language", mGtkSource);
118
+
119
+ RG_DEF_METHOD(get_metadata, 1);
120
+ RG_DEF_METHOD(mime_types, 0);
121
+ RG_DEF_METHOD(globs, 0);
122
+ RG_DEF_METHOD(get_style_name, 1);
123
+ RG_DEF_METHOD(style_ids, 0);
124
+ }
@@ -0,0 +1,114 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2004 Ruby-GNOME2 Project Team
5
+ * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
+ * MA 02110-1301 USA
21
+ */
22
+
23
+ #include "rbgtksourceview3private.h"
24
+
25
+ /* Class: Gtk::SourceLanguageManager
26
+ * A class to manage source language.
27
+ */
28
+
29
+ #define RG_TARGET_NAMESPACE cLanguageManager
30
+ #define _SELF(self) (RVAL2GTKSOURCELANGUAGEMANAGER(self))
31
+
32
+ static VALUE rb_mGtkSource;
33
+
34
+ /* Class method: new
35
+ * Returns: a newly created Gtk::SourceLanguageManager object.
36
+ */
37
+ static VALUE
38
+ rg_initialize(VALUE self)
39
+ {
40
+ G_INITIALIZE (self, gtk_source_language_manager_new ());
41
+ return Qnil;
42
+ }
43
+
44
+ /* Class method: default
45
+ *
46
+ * Gets the default language manager.
47
+ *
48
+ * Returns: a Gtk::SourceLanguageManager
49
+ */
50
+ static VALUE
51
+ rg_s_default(G_GNUC_UNUSED VALUE self)
52
+ {
53
+ GtkSourceLanguageManager* slm = gtk_source_language_manager_get_default();
54
+ GType gtype = G_TYPE_FROM_INSTANCE(slm);
55
+
56
+ gchar *gtypename = (gchar *) g_type_name (gtype);
57
+ if (strncmp (gtypename, "GtkSource", 9) == 0)
58
+ gtypename += 9;
59
+ if (!rb_const_defined_at (rb_mGtkSource, rb_intern (gtypename)))
60
+ G_DEF_CLASS (gtype, gtypename, rb_mGtkSource);
61
+
62
+ return GOBJ2RVAL(slm);
63
+ }
64
+
65
+ /*
66
+ * Method: get_language(id)
67
+ * id: a language id (as a string).
68
+ *
69
+ * Gets the Gtk::SourceLanguage which is associated with the given id
70
+ * in the language manager.
71
+ *
72
+ * Returns: a Gtk::SourceLanguage, or nil if there is no language associated
73
+ * with the given id.
74
+ */
75
+ static VALUE
76
+ rg_get_language(VALUE self, VALUE id)
77
+ {
78
+ return
79
+ GOBJ2RVAL (gtk_source_language_manager_get_language
80
+ (_SELF (self), RVAL2CSTR (id)));
81
+ }
82
+
83
+ /*
84
+ * Method: guess_language(filename, content_type)
85
+ * filename: a file name (as a string), or nil.
86
+ * content_type: content type (as a string), or nil.
87
+ *
88
+ * Guesses the Gtk::SourceLanguage for the given file name and content type.
89
+ *
90
+ * Returns: a Gtk::SourceLanguage, or nil if there is no language associated
91
+ * with the given filename or content_type.
92
+ */
93
+ static VALUE
94
+ rg_guess_language(VALUE self, VALUE filename, VALUE content_type)
95
+ {
96
+ return GOBJ2RVAL (gtk_source_language_manager_guess_language
97
+ (_SELF (self),
98
+ RVAL2CSTR_ACCEPT_NIL (filename),
99
+ RVAL2CSTR_ACCEPT_NIL (content_type)));
100
+ }
101
+
102
+ void
103
+ Init_gtksource_languagemanager (VALUE mGtkSource)
104
+ {
105
+ rb_mGtkSource = mGtkSource;
106
+ VALUE RG_TARGET_NAMESPACE =
107
+ G_DEF_CLASS (GTK_SOURCE_TYPE_LANGUAGE_MANAGER,
108
+ "LanguageManager", mGtkSource);
109
+
110
+ RG_DEF_METHOD(initialize, 0);
111
+ RG_DEF_METHOD(get_language, 1);
112
+ RG_DEF_METHOD(guess_language, 2);
113
+ RG_DEF_SMETHOD(default, 0);
114
+ }
@@ -0,0 +1,85 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003 Geoff Youngs, based on gtktextview.c by Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbgtksourceview3private.h"
23
+
24
+ /* Class: Gtk::SourceMark
25
+ * A source mark.
26
+ */
27
+
28
+ #define RG_TARGET_NAMESPACE cMark
29
+ #define _SELF(self) (RVAL2GTKSOURCEMARK(self))
30
+
31
+ /* Class method: new(name, category)
32
+ * name: mark name (string)
33
+ * category: marker category (string)
34
+ *
35
+ * Returns: a newly created Gtk::SourceMark object.
36
+ */
37
+ static VALUE
38
+ rg_initialize(VALUE self, VALUE name, VALUE category)
39
+ {
40
+ G_INITIALIZE (self,
41
+ gtk_source_mark_new (RVAL2CSTR(name), RVAL2CSTR_ACCEPT_SYMBOL(category)));
42
+ return Qnil;
43
+ }
44
+
45
+ /* Method: next(category=nil)
46
+ * category: the category (string), or nil.
47
+ *
48
+ * Returns: the next Gtk::SourceMark after the mark.
49
+ */
50
+ static VALUE
51
+ rg_next(int argc, VALUE *argv, VALUE self)
52
+ {
53
+ VALUE category;
54
+
55
+ rb_scan_args (argc, argv, "01", &category);
56
+
57
+ return GOBJ2RVAL (gtk_source_mark_next (_SELF (self),
58
+ RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category)));
59
+ }
60
+
61
+ /* Method: prev(category=nil)
62
+ * category: the category (string), or nil.
63
+ *
64
+ * Returns: the previous Gtk::SourceMark before the mark.
65
+ */
66
+ static VALUE
67
+ rg_prev(int argc, VALUE *argv, VALUE self)
68
+ {
69
+ VALUE category;
70
+
71
+ rb_scan_args (argc, argv, "01", &category);
72
+
73
+ return GOBJ2RVAL (gtk_source_mark_prev (_SELF (self),
74
+ RVAL2CSTR_ACCEPT_SYMBOL_ACCEPT_NIL(category)));
75
+ }
76
+
77
+ void
78
+ Init_gtksource_mark (VALUE mGtkSource)
79
+ {
80
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS (GTK_SOURCE_TYPE_MARK, "Mark", mGtkSource);
81
+
82
+ RG_DEF_METHOD(initialize, 2);
83
+ RG_DEF_METHOD(next, -1);
84
+ RG_DEF_METHOD(prev, -1);
85
+ }
@@ -0,0 +1,77 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbgtksourceview3private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cMarkAttributes
24
+ #define _SELF(self) (RVAL2GTKSOURCEMARKATTRIBUTES(self))
25
+
26
+ static VALUE
27
+ rg_initialize(VALUE self)
28
+ {
29
+ G_INITIALIZE(self, gtk_source_mark_attributes_new());
30
+
31
+ return Qnil;
32
+ }
33
+
34
+ static VALUE
35
+ rg_get_tooltip_markup(VALUE self, VALUE mark)
36
+ {
37
+ gchar *markup;
38
+
39
+ markup = gtk_source_mark_attributes_get_tooltip_markup(_SELF(self),
40
+ RVAL2GTKSOURCEMARK(mark));
41
+
42
+ return CSTR2RVAL_FREE(markup);
43
+ }
44
+
45
+ static VALUE
46
+ rg_get_tooltip_text(VALUE self, VALUE mark)
47
+ {
48
+ gchar *text;
49
+
50
+ text = gtk_source_mark_attributes_get_tooltip_text(_SELF(self),
51
+ RVAL2GTKSOURCEMARK(mark));
52
+
53
+ return CSTR2RVAL_FREE(text);
54
+ }
55
+
56
+ static VALUE
57
+ rg_render_icon(VALUE self, VALUE widget, VALUE size)
58
+ {
59
+ GdkPixbuf *icon;
60
+
61
+ icon = gtk_source_mark_attributes_render_icon(_SELF(self),
62
+ RVAL2GTKWIDGET(widget),
63
+ NUM2INT(size));
64
+
65
+ return GOBJ2RVAL(icon);
66
+ }
67
+
68
+ void
69
+ Init_gtksource_markattributes(VALUE mGtkSource)
70
+ {
71
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_SOURCE_TYPE_MARK_ATTRIBUTES, "MarkAttributes", mGtkSource);
72
+
73
+ RG_DEF_METHOD(initialize, 0);
74
+ RG_DEF_METHOD(get_tooltip_markup, 1);
75
+ RG_DEF_METHOD(get_tooltip_text, 1);
76
+ RG_DEF_METHOD(render_icon, 2);
77
+ }