gtk3 3.0.7 → 3.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/gtk3/extconf.rb +1 -0
- data/ext/gtk3/rb-gtk3-tree-view.c +4 -0
- data/ext/gtk3/rb-gtk3.c +245 -60
- data/lib/gtk3/box.rb +22 -0
- data/lib/gtk3/builder.rb +50 -29
- data/lib/gtk3/deprecated.rb +7 -0
- data/lib/gtk3/entry-buffer.rb +28 -0
- data/lib/gtk3/list-store.rb +2 -20
- data/lib/gtk3/loader.rb +6 -0
- data/lib/gtk3/menu-item.rb +8 -7
- data/lib/gtk3/tree-iter.rb +25 -1
- data/lib/gtk3/tree-model.rb +41 -0
- data/lib/gtk3/tree-store.rb +7 -6
- data/lib/gtk3/widget.rb +18 -1
- data/sample/gtk-demo/TODO +45 -39
- data/sample/gtk-demo/assistant.rb +123 -0
- data/sample/gtk-demo/builder.rb +75 -38
- data/sample/gtk-demo/button_box.rb +100 -0
- data/sample/gtk-demo/colorsel.rb +49 -65
- data/sample/gtk-demo/css_accordion.rb +33 -55
- data/sample/gtk-demo/css_basics.rb +55 -80
- data/sample/gtk-demo/css_multiplebgs.rb +112 -0
- data/sample/gtk-demo/css_pixbufs.rb +84 -0
- data/sample/gtk-demo/css_shadows.rb +101 -0
- data/sample/gtk-demo/cursors.rb +114 -0
- data/sample/gtk-demo/dialog.rb +105 -115
- data/sample/gtk-demo/entry_buffer.rb +44 -0
- data/sample/gtk-demo/entry_completion.rb +40 -52
- data/sample/gtk-demo/expander.rb +60 -26
- data/sample/gtk-demo/filtermodel.rb +119 -0
- data/sample/gtk-demo/font_features.rb +117 -0
- data/sample/gtk-demo/headerbar.rb +57 -0
- data/sample/gtk-demo/iconview_edit.rb +79 -0
- data/sample/gtk-demo/infobar.rb +75 -59
- data/sample/gtk-demo/links.rb +53 -40
- data/sample/gtk-demo/main.rb +353 -43
- data/sample/gtk-demo/main.ui +9 -9
- data/sample/gtk-demo/markup.rb +46 -0
- data/sample/gtk-demo/menus.rb +111 -162
- data/sample/gtk-demo/modelbutton.rb +47 -0
- data/sample/gtk-demo/overlay.rb +61 -0
- data/sample/gtk-demo/overlay2.rb +75 -0
- data/sample/gtk-demo/panes.rb +114 -133
- data/sample/gtk-demo/pickers.rb +70 -0
- data/sample/gtk-demo/popover.rb +110 -0
- data/sample/gtk-demo/printing.rb +68 -83
- data/sample/gtk-demo/revealer.rb +53 -0
- data/sample/gtk-demo/scale.rb +26 -0
- data/sample/gtk-demo/search_entry2.rb +107 -0
- data/sample/gtk-demo/sidebar.rb +68 -0
- data/sample/gtk-demo/sizegroup.rb +93 -105
- data/sample/gtk-demo/spinner.rb +53 -50
- data/sample/gtk-demo/stack.rb +28 -0
- data/sample/gtk-demo/test_mod.rb +22 -0
- data/sample/gtk-demo/textmask.rb +61 -0
- data/sample/gtk-demo/theming_style_classes.rb +16 -12
- data/sample/misc/app-menu.ui +19 -0
- data/sample/misc/button-menu.ui +19 -0
- data/sample/misc/icons-theme-viewer.rb +65 -0
- data/sample/misc/menu.rb +3 -3
- data/sample/misc/menus_from_resources.gresource.xml +8 -0
- data/sample/misc/menus_from_resources.rb +91 -0
- data/sample/misc/statusicon.rb +1 -1
- data/sample/misc/toolbar-menu.ui +23 -0
- data/sample/misc/treestore.rb +63 -0
- data/sample/tutorial/README.md +368 -6
- data/test/test-gtk-box.rb +13 -0
- data/test/test-gtk-builder.rb +1 -1
- data/test/test-gtk-clipboard.rb +124 -0
- data/test/test-gtk-container.rb +3 -3
- data/test/test-gtk-entry-buffer.rb +32 -0
- data/test/test-gtk-list-store.rb +30 -12
- data/test/test-gtk-menu.rb +32 -0
- data/test/test-gtk-tree-iter.rb +61 -5
- data/test/test-gtk-tree-path.rb +26 -1
- data/test/test-gtk-tree-sortable.rb +35 -0
- data/test/test-gtk-tree-store.rb +34 -0
- data/test/test-gtk-widget.rb +33 -2
- metadata +55 -19
- data/sample/gtk-demo/button-box.rb +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a7abe19144fd779ab738e2a2f755877575864b
|
4
|
+
data.tar.gz: d5f9ab206a3c583f0c12d1f3cd3b4504904a5dd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d435afe30b78995cc55bc8ee8b6b8f8c7502734d3eaf79dce00c36c8fe3b0e6dcbd62a43c4bb97fb7239dbd2314dda5d5286fc18aa4d59f39b18238146e3eda4
|
7
|
+
data.tar.gz: 602cc76363c40fd0bf51306edb00417f136be3b509dd098440767d6826f46dbdf4647dafdf6bae6b6c199272cdced2b099f55f6fd2f5b3becda590fe745733c9
|
data/ext/gtk3/extconf.rb
CHANGED
@@ -26,6 +26,7 @@ rb_gtk3_tree_view_mark(gpointer object)
|
|
26
26
|
GtkTreeView *tree_view = object;
|
27
27
|
GList *node;
|
28
28
|
GList *columns;
|
29
|
+
GtkTreeSelection *selection;
|
29
30
|
|
30
31
|
columns = gtk_tree_view_get_columns(tree_view);
|
31
32
|
for (node = columns; node; node = g_list_next(node)) {
|
@@ -33,6 +34,9 @@ rb_gtk3_tree_view_mark(gpointer object)
|
|
33
34
|
rbgobj_gc_mark_instance(column);
|
34
35
|
}
|
35
36
|
g_list_free(columns);
|
37
|
+
|
38
|
+
selection = gtk_tree_view_get_selection(tree_view);
|
39
|
+
rbgobj_gc_mark_instance(selection);
|
36
40
|
}
|
37
41
|
|
38
42
|
void
|
data/ext/gtk3/rb-gtk3.c
CHANGED
@@ -20,6 +20,9 @@
|
|
20
20
|
|
21
21
|
#include "rb-gtk3-private.h"
|
22
22
|
|
23
|
+
static ID id_call;
|
24
|
+
static VALUE cGdkAtom;
|
25
|
+
|
23
26
|
/*
|
24
27
|
#if GTK_CHECK_VERSION(3, 10, 0)
|
25
28
|
# define RB_GTK_ACTION_IS_DEPRECATED
|
@@ -53,51 +56,11 @@ static void
|
|
53
56
|
rb_gtk3_callback_callback(GtkWidget *widget, gpointer user_data)
|
54
57
|
{
|
55
58
|
RBGICallbackData *callback_data = user_data;
|
56
|
-
ID id_call;
|
57
59
|
|
58
|
-
CONST_ID(id_call, "call");
|
59
60
|
rb_funcall(callback_data->rb_callback, id_call, 1,
|
60
61
|
GOBJ2RVAL(widget));
|
61
62
|
}
|
62
63
|
|
63
|
-
static gint
|
64
|
-
rb_gtk3_assistant_page_func_callback(gint current_page, gpointer user_data)
|
65
|
-
{
|
66
|
-
RBGICallbackData *callback_data = user_data;
|
67
|
-
ID id_call;
|
68
|
-
VALUE rb_next_page;
|
69
|
-
|
70
|
-
CONST_ID(id_call, "call");
|
71
|
-
rb_next_page = rb_funcall(callback_data->rb_callback, id_call, 1,
|
72
|
-
INT2NUM(current_page));
|
73
|
-
return NUM2INT(rb_next_page);
|
74
|
-
}
|
75
|
-
|
76
|
-
static void
|
77
|
-
rb_gtk3_builder_connect_func_callback(GtkBuilder *builder,
|
78
|
-
GObject *object,
|
79
|
-
const gchar *signal_name,
|
80
|
-
const gchar *handler_name,
|
81
|
-
GObject *connect_object,
|
82
|
-
GConnectFlags flags,
|
83
|
-
gpointer user_data)
|
84
|
-
{
|
85
|
-
RBGICallbackData *callback_data = user_data;
|
86
|
-
ID id___connect_signals__;
|
87
|
-
VALUE rb_object;
|
88
|
-
|
89
|
-
CONST_ID(id___connect_signals__, "__connect_signals__");
|
90
|
-
rb_object = GOBJ2RVAL(object);
|
91
|
-
G_RELATIVE(rb_object, callback_data->rb_callback);
|
92
|
-
rb_funcall(GOBJ2RVAL(builder), id___connect_signals__, 6,
|
93
|
-
callback_data->rb_callback,
|
94
|
-
rb_object,
|
95
|
-
CSTR2RVAL(signal_name),
|
96
|
-
CSTR2RVAL(handler_name),
|
97
|
-
GOBJ2RVAL(connect_object),
|
98
|
-
GCONNECTFLAGS2RVAL(flags));
|
99
|
-
}
|
100
|
-
|
101
64
|
static void
|
102
65
|
rb_gtk3_cell_layout_data_func_callback(GtkCellLayout *cell_layout,
|
103
66
|
GtkCellRenderer *cell,
|
@@ -107,7 +70,6 @@ rb_gtk3_cell_layout_data_func_callback(GtkCellLayout *cell_layout,
|
|
107
70
|
{
|
108
71
|
RBGICallbackData *callback_data = user_data;
|
109
72
|
ID id_set_model;
|
110
|
-
ID id_call;
|
111
73
|
VALUE rb_model;
|
112
74
|
VALUE rb_iter;
|
113
75
|
|
@@ -116,7 +78,6 @@ rb_gtk3_cell_layout_data_func_callback(GtkCellLayout *cell_layout,
|
|
116
78
|
rb_iter = BOXED2RVAL(iter, GTK_TYPE_TREE_ITER);
|
117
79
|
rb_funcall(rb_iter, id_set_model, 1, rb_model);
|
118
80
|
|
119
|
-
CONST_ID(id_call, "call");
|
120
81
|
rb_funcall(callback_data->rb_callback,
|
121
82
|
id_call,
|
122
83
|
4,
|
@@ -126,15 +87,179 @@ rb_gtk3_cell_layout_data_func_callback(GtkCellLayout *cell_layout,
|
|
126
87
|
rb_iter);
|
127
88
|
}
|
128
89
|
|
90
|
+
static void
|
91
|
+
rb_gtk3_clipboard_received_func_callback(GtkClipboard *clipboard,
|
92
|
+
GtkSelectionData *selection_data,
|
93
|
+
gpointer user_data)
|
94
|
+
{
|
95
|
+
RBGICallbackData *callback_data = user_data;
|
96
|
+
|
97
|
+
rb_funcall(callback_data->rb_callback,
|
98
|
+
id_call,
|
99
|
+
2,
|
100
|
+
GOBJ2RVAL(clipboard),
|
101
|
+
BOXED2RVAL(selection_data, GTK_TYPE_SELECTION_DATA));
|
102
|
+
}
|
103
|
+
|
104
|
+
static void
|
105
|
+
rb_gtk3_clipboard_rich_text_received_func_callback(GtkClipboard *clipboard,
|
106
|
+
GdkAtom format,
|
107
|
+
const guint *text,
|
108
|
+
G_GNUC_UNUSED gsize length,
|
109
|
+
gpointer user_data)
|
110
|
+
{
|
111
|
+
RBGICallbackData *callback_data = user_data;
|
112
|
+
|
113
|
+
rb_funcall(callback_data->rb_callback,
|
114
|
+
id_call,
|
115
|
+
3,
|
116
|
+
GOBJ2RVAL(clipboard),
|
117
|
+
Data_Wrap_Struct(cGdkAtom, NULL, NULL, format),
|
118
|
+
CSTR2RVAL((const gchar *)text));
|
119
|
+
}
|
120
|
+
|
121
|
+
static void
|
122
|
+
rb_gtk3_clipboard_image_received_func_callback(GtkClipboard *clipboard,
|
123
|
+
GdkPixbuf *pixbuf,
|
124
|
+
gpointer user_data)
|
125
|
+
{
|
126
|
+
RBGICallbackData *callback_data = user_data;
|
127
|
+
|
128
|
+
rb_funcall(callback_data->rb_callback,
|
129
|
+
id_call,
|
130
|
+
2,
|
131
|
+
GOBJ2RVAL(clipboard),
|
132
|
+
GOBJ2RVAL(pixbuf));
|
133
|
+
}
|
134
|
+
|
135
|
+
static void
|
136
|
+
rb_gtk3_clipboard_targets_received_func_callback(GtkClipboard *clipboard,
|
137
|
+
GdkAtom *atoms,
|
138
|
+
gint n_atoms,
|
139
|
+
gpointer user_data)
|
140
|
+
{
|
141
|
+
RBGICallbackData *callback_data = user_data;
|
142
|
+
VALUE rb_atoms;
|
143
|
+
gint i;
|
144
|
+
|
145
|
+
if (!atoms) {
|
146
|
+
rb_atoms = Qnil;
|
147
|
+
} else {
|
148
|
+
rb_atoms = rb_ary_new2(n_atoms);
|
149
|
+
for (i = 0; i < n_atoms; i++) {
|
150
|
+
VALUE rb_atom;
|
151
|
+
rb_atom = Data_Wrap_Struct(cGdkAtom, NULL, NULL, atoms[i]);
|
152
|
+
rb_ary_push(rb_atoms, rb_atom);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
|
156
|
+
rb_funcall(callback_data->rb_callback,
|
157
|
+
id_call,
|
158
|
+
2,
|
159
|
+
GOBJ2RVAL(clipboard),
|
160
|
+
rb_atoms);
|
161
|
+
}
|
162
|
+
|
163
|
+
static void
|
164
|
+
rb_gtk3_clipboard_text_received_func_callback(GtkClipboard *clipboard,
|
165
|
+
const gchar *text,
|
166
|
+
gpointer user_data)
|
167
|
+
{
|
168
|
+
RBGICallbackData *callback_data = user_data;
|
169
|
+
|
170
|
+
rb_funcall(callback_data->rb_callback,
|
171
|
+
id_call,
|
172
|
+
2,
|
173
|
+
GOBJ2RVAL(clipboard),
|
174
|
+
CSTR2RVAL(text));
|
175
|
+
}
|
176
|
+
|
177
|
+
static void
|
178
|
+
rb_gtk3_clipboard_uri_received_func_callback(GtkClipboard *clipboard,
|
179
|
+
gchar **uris,
|
180
|
+
gpointer user_data)
|
181
|
+
{
|
182
|
+
RBGICallbackData *callback_data = user_data;
|
183
|
+
|
184
|
+
rb_funcall(callback_data->rb_callback,
|
185
|
+
id_call,
|
186
|
+
2,
|
187
|
+
GOBJ2RVAL(clipboard),
|
188
|
+
STRV2RVAL((const gchar **)uris));
|
189
|
+
}
|
190
|
+
|
191
|
+
static gboolean
|
192
|
+
rb_gtk3_entry_completion_match_func_callback(GtkEntryCompletion *completion,
|
193
|
+
const gchar *key,
|
194
|
+
GtkTreeIter *iter,
|
195
|
+
gpointer user_data)
|
196
|
+
{
|
197
|
+
RBGICallbackData *callback_data = user_data;
|
198
|
+
ID id_set_model;
|
199
|
+
VALUE rb_model;
|
200
|
+
VALUE rb_iter;
|
201
|
+
GtkTreeModel *model;
|
202
|
+
VALUE rb_match;
|
203
|
+
gboolean match = FALSE;
|
204
|
+
|
205
|
+
model = gtk_entry_completion_get_model(completion);
|
206
|
+
CONST_ID(id_set_model, "model=");
|
207
|
+
rb_model = GOBJ2RVAL(model);
|
208
|
+
rb_iter = BOXED2RVAL(iter, GTK_TYPE_TREE_ITER);
|
209
|
+
rb_funcall(rb_iter, id_set_model, 1, rb_model);
|
210
|
+
|
211
|
+
rb_match = rb_funcall(callback_data->rb_callback,
|
212
|
+
id_call,
|
213
|
+
3,
|
214
|
+
GOBJ2RVAL(completion),
|
215
|
+
CSTR2RVAL(key),
|
216
|
+
rb_iter);
|
217
|
+
|
218
|
+
match = RVAL2CBOOL(rb_match);
|
219
|
+
return match;
|
220
|
+
}
|
221
|
+
|
222
|
+
static void
|
223
|
+
rb_gtk3_menu_position_func_callback(GtkMenu *menu,
|
224
|
+
gint *x,
|
225
|
+
gint *y,
|
226
|
+
gboolean *push_in,
|
227
|
+
gpointer user_data)
|
228
|
+
{
|
229
|
+
RBGICallbackData *callback_data = user_data;
|
230
|
+
VALUE rb_result_raw;
|
231
|
+
VALUE rb_result;
|
232
|
+
|
233
|
+
rb_result_raw = rb_funcall(callback_data->rb_callback,
|
234
|
+
id_call,
|
235
|
+
3,
|
236
|
+
GOBJ2RVAL(menu),
|
237
|
+
INT2NUM(*x),
|
238
|
+
INT2NUM(*y));
|
239
|
+
rb_result = rbg_check_array_type(rb_result_raw);
|
240
|
+
if (NIL_P(rb_result) ||
|
241
|
+
!(RARRAY_LEN(rb_result) == 2 ||
|
242
|
+
RARRAY_LEN(rb_result) == 3)) {
|
243
|
+
/* TODO: Raising an error will abort the program. :< */
|
244
|
+
rb_raise(rb_eArgError,
|
245
|
+
"block should return [x, y, push_in]: %s",
|
246
|
+
RBG_INSPECT(rb_result_raw));
|
247
|
+
}
|
248
|
+
|
249
|
+
*x = NUM2INT(RARRAY_PTR(rb_result)[0]);
|
250
|
+
*y = NUM2INT(RARRAY_PTR(rb_result)[1]);
|
251
|
+
if (RARRAY_LEN(rb_result) == 3) {
|
252
|
+
*push_in = RVAL2CBOOL(RARRAY_PTR(rb_result)[2]);
|
253
|
+
}
|
254
|
+
}
|
255
|
+
|
129
256
|
static const gchar *
|
130
257
|
rb_gtk3_translate_func_callback(const gchar *path,
|
131
258
|
gpointer user_data)
|
132
259
|
{
|
133
260
|
RBGICallbackData *callback_data = user_data;
|
134
|
-
ID id_call;
|
135
261
|
VALUE rb_translated;
|
136
262
|
|
137
|
-
CONST_ID(id_call, "call");
|
138
263
|
rb_translated = rb_funcall(callback_data->rb_callback,
|
139
264
|
id_call,
|
140
265
|
1,
|
@@ -151,7 +276,6 @@ rb_gtk3_tree_cell_data_func_callback(GtkTreeViewColumn *column,
|
|
151
276
|
{
|
152
277
|
RBGICallbackData *callback_data = user_data;
|
153
278
|
ID id_set_model;
|
154
|
-
ID id_call;
|
155
279
|
VALUE rb_model;
|
156
280
|
VALUE rb_iter;
|
157
281
|
|
@@ -160,7 +284,6 @@ rb_gtk3_tree_cell_data_func_callback(GtkTreeViewColumn *column,
|
|
160
284
|
rb_iter = BOXED2RVAL(iter, GTK_TYPE_TREE_ITER);
|
161
285
|
rb_funcall(rb_iter, id_set_model, 1, rb_model);
|
162
286
|
|
163
|
-
CONST_ID(id_call, "call");
|
164
287
|
rb_funcall(callback_data->rb_callback,
|
165
288
|
id_call,
|
166
289
|
4,
|
@@ -170,6 +293,37 @@ rb_gtk3_tree_cell_data_func_callback(GtkTreeViewColumn *column,
|
|
170
293
|
rb_iter);
|
171
294
|
}
|
172
295
|
|
296
|
+
static gint
|
297
|
+
rb_gtk3_tree_iter_compare_func_callback(GtkTreeModel *model,
|
298
|
+
GtkTreeIter *iter1,
|
299
|
+
GtkTreeIter *iter2,
|
300
|
+
gpointer user_data)
|
301
|
+
{
|
302
|
+
RBGICallbackData *callback_data = user_data;
|
303
|
+
ID id_set_model;
|
304
|
+
VALUE rb_model;
|
305
|
+
VALUE rb_iter1;
|
306
|
+
VALUE rb_iter2;
|
307
|
+
VALUE rb_result;
|
308
|
+
|
309
|
+
CONST_ID(id_set_model, "model=");
|
310
|
+
rb_model = GOBJ2RVAL(model);
|
311
|
+
|
312
|
+
rb_iter1 = BOXED2RVAL(iter1, GTK_TYPE_TREE_ITER);
|
313
|
+
rb_funcall(rb_iter1, id_set_model, 1, rb_model);
|
314
|
+
|
315
|
+
rb_iter2 = BOXED2RVAL(iter2, GTK_TYPE_TREE_ITER);
|
316
|
+
rb_funcall(rb_iter2, id_set_model, 1, rb_model);
|
317
|
+
|
318
|
+
rb_result = rb_funcall(callback_data->rb_callback,
|
319
|
+
id_call,
|
320
|
+
3,
|
321
|
+
rb_model,
|
322
|
+
rb_iter1,
|
323
|
+
rb_iter2);
|
324
|
+
return NUM2INT(rb_result);
|
325
|
+
}
|
326
|
+
|
173
327
|
static void
|
174
328
|
rb_gtk3_tree_model_filter_modify_func_callback(GtkTreeModel *model,
|
175
329
|
GtkTreeIter *iter,
|
@@ -179,7 +333,6 @@ rb_gtk3_tree_model_filter_modify_func_callback(GtkTreeModel *model,
|
|
179
333
|
{
|
180
334
|
RBGICallbackData *callback_data = user_data;
|
181
335
|
ID id_set_model;
|
182
|
-
ID id_call;
|
183
336
|
VALUE rb_model;
|
184
337
|
VALUE rb_iter;
|
185
338
|
VALUE rb_value;
|
@@ -191,7 +344,6 @@ rb_gtk3_tree_model_filter_modify_func_callback(GtkTreeModel *model,
|
|
191
344
|
rb_funcall(rb_iter, id_set_model, 1, rb_model);
|
192
345
|
rb_column = INT2NUM(column);
|
193
346
|
|
194
|
-
CONST_ID(id_call, "call");
|
195
347
|
rb_value = rb_funcall(callback_data->rb_callback,
|
196
348
|
id_call,
|
197
349
|
3,
|
@@ -208,7 +360,6 @@ rb_gtk3_tree_model_filter_visible_func_callback(GtkTreeModel *model,
|
|
208
360
|
{
|
209
361
|
RBGICallbackData *callback_data = user_data;
|
210
362
|
ID id_set_model;
|
211
|
-
ID id_call;
|
212
363
|
VALUE rb_model;
|
213
364
|
VALUE rb_iter;
|
214
365
|
VALUE rb_visible;
|
@@ -219,7 +370,6 @@ rb_gtk3_tree_model_filter_visible_func_callback(GtkTreeModel *model,
|
|
219
370
|
rb_iter = BOXED2RVAL(iter, GTK_TYPE_TREE_ITER);
|
220
371
|
rb_funcall(rb_iter, id_set_model, 1, rb_model);
|
221
372
|
|
222
|
-
CONST_ID(id_call, "call");
|
223
373
|
rb_visible = rb_funcall(callback_data->rb_callback,
|
224
374
|
id_call,
|
225
375
|
2,
|
@@ -238,7 +388,6 @@ rb_gtk3_tree_model_foreach_func_callback(GtkTreeModel *model,
|
|
238
388
|
{
|
239
389
|
RBGICallbackData *callback_data = user_data;
|
240
390
|
ID id_set_model;
|
241
|
-
ID id_call;
|
242
391
|
VALUE rb_model;
|
243
392
|
VALUE rb_iter;
|
244
393
|
gboolean stop = FALSE;
|
@@ -248,7 +397,6 @@ rb_gtk3_tree_model_foreach_func_callback(GtkTreeModel *model,
|
|
248
397
|
rb_iter = BOXED2RVAL(iter, GTK_TYPE_TREE_ITER);
|
249
398
|
rb_funcall(rb_iter, id_set_model, 1, rb_model);
|
250
399
|
|
251
|
-
CONST_ID(id_call, "call");
|
252
400
|
rb_funcall(callback_data->rb_callback,
|
253
401
|
id_call,
|
254
402
|
3,
|
@@ -267,7 +415,6 @@ rb_gtk3_tree_selection_foreach_func_callback(GtkTreeModel *model,
|
|
267
415
|
{
|
268
416
|
RBGICallbackData *callback_data = user_data;
|
269
417
|
ID id_set_model;
|
270
|
-
ID id_call;
|
271
418
|
VALUE rb_model;
|
272
419
|
VALUE rb_iter;
|
273
420
|
|
@@ -276,7 +423,6 @@ rb_gtk3_tree_selection_foreach_func_callback(GtkTreeModel *model,
|
|
276
423
|
rb_iter = BOXED2RVAL(iter, GTK_TYPE_TREE_ITER);
|
277
424
|
rb_funcall(rb_iter, id_set_model, 1, rb_model);
|
278
425
|
|
279
|
-
CONST_ID(id_call, "call");
|
280
426
|
rb_funcall(callback_data->rb_callback,
|
281
427
|
id_call,
|
282
428
|
3,
|
@@ -285,15 +431,34 @@ rb_gtk3_tree_selection_foreach_func_callback(GtkTreeModel *model,
|
|
285
431
|
rb_iter);
|
286
432
|
}
|
287
433
|
|
434
|
+
static gboolean
|
435
|
+
rb_gtk3_tree_selection_func_callback(GtkTreeSelection *selection,
|
436
|
+
GtkTreeModel *model,
|
437
|
+
GtkTreePath *path,
|
438
|
+
gboolean path_currently_selected,
|
439
|
+
gpointer data)
|
440
|
+
{
|
441
|
+
RBGICallbackData *callback_data = data;
|
442
|
+
VALUE rb_selection_is_changeable;
|
443
|
+
|
444
|
+
rb_selection_is_changeable =
|
445
|
+
rb_funcall(callback_data->rb_callback,
|
446
|
+
id_call,
|
447
|
+
4,
|
448
|
+
GOBJ2RVAL(selection),
|
449
|
+
GOBJ2RVAL(model),
|
450
|
+
BOXED2RVAL(path, GTK_TYPE_TREE_PATH),
|
451
|
+
CBOOL2RVAL(path_currently_selected));
|
452
|
+
return RVAL2CBOOL(rb_selection_is_changeable);
|
453
|
+
}
|
454
|
+
|
288
455
|
static void
|
289
456
|
rb_gtk3_tree_view_mapping_func_callback(GtkTreeView *tree_view,
|
290
457
|
GtkTreePath *path,
|
291
458
|
gpointer user_data)
|
292
459
|
{
|
293
460
|
RBGICallbackData *callback_data = user_data;
|
294
|
-
ID id_call;
|
295
461
|
|
296
|
-
CONST_ID(id_call, "call");
|
297
462
|
rb_funcall(callback_data->rb_callback,
|
298
463
|
id_call,
|
299
464
|
2,
|
@@ -306,16 +471,30 @@ rb_gtk3_callback_finder(GIArgInfo *info)
|
|
306
471
|
{
|
307
472
|
if (name_equal(info, "Callback")) {
|
308
473
|
return rb_gtk3_callback_callback;
|
309
|
-
} else if (name_equal(info, "AssistantPageFunc")) {
|
310
|
-
return rb_gtk3_assistant_page_func_callback;
|
311
|
-
} else if (name_equal(info, "BuilderConnectFunc")) {
|
312
|
-
return rb_gtk3_builder_connect_func_callback;
|
313
474
|
} else if (name_equal(info, "CellLayoutDataFunc")) {
|
314
475
|
return rb_gtk3_cell_layout_data_func_callback;
|
476
|
+
} else if (name_equal(info, "ClipboardReceivedFunc")) {
|
477
|
+
return rb_gtk3_clipboard_received_func_callback;
|
478
|
+
} else if (name_equal(info, "ClipboardRichTextReceivedFunc")) {
|
479
|
+
return rb_gtk3_clipboard_rich_text_received_func_callback;
|
480
|
+
} else if (name_equal(info, "ClipboardImageReceivedFunc")) {
|
481
|
+
return rb_gtk3_clipboard_image_received_func_callback;
|
482
|
+
} else if (name_equal(info, "ClipboardTargetsReceivedFunc")) {
|
483
|
+
return rb_gtk3_clipboard_targets_received_func_callback;
|
484
|
+
} else if (name_equal(info, "ClipboardTextReceivedFunc")) {
|
485
|
+
return rb_gtk3_clipboard_text_received_func_callback;
|
486
|
+
} else if (name_equal(info, "ClipboardURIReceivedFunc")) {
|
487
|
+
return rb_gtk3_clipboard_uri_received_func_callback;
|
488
|
+
} else if (name_equal(info, "EntryCompletionMatchFunc")) {
|
489
|
+
return rb_gtk3_entry_completion_match_func_callback;
|
490
|
+
} else if (name_equal(info, "MenuPositionFunc")) {
|
491
|
+
return rb_gtk3_menu_position_func_callback;
|
315
492
|
} else if (name_equal(info, "TranslateFunc")) {
|
316
493
|
return rb_gtk3_translate_func_callback;
|
317
494
|
} else if (name_equal(info, "TreeCellDataFunc")) {
|
318
495
|
return rb_gtk3_tree_cell_data_func_callback;
|
496
|
+
} else if (name_equal(info, "TreeIterCompareFunc")) {
|
497
|
+
return rb_gtk3_tree_iter_compare_func_callback;
|
319
498
|
} else if (name_equal(info, "TreeModelFilterModifyFunc")) {
|
320
499
|
return rb_gtk3_tree_model_filter_modify_func_callback;
|
321
500
|
} else if (name_equal(info, "TreeModelFilterVisibleFunc")) {
|
@@ -324,6 +503,8 @@ rb_gtk3_callback_finder(GIArgInfo *info)
|
|
324
503
|
return rb_gtk3_tree_model_foreach_func_callback;
|
325
504
|
} else if (name_equal(info, "TreeSelectionForeachFunc")) {
|
326
505
|
return rb_gtk3_tree_selection_foreach_func_callback;
|
506
|
+
} else if (name_equal(info, "TreeSelectionFunc")) {
|
507
|
+
return rb_gtk3_tree_selection_func_callback;
|
327
508
|
} else if (name_equal(info, "TreeViewMappingFunc")) {
|
328
509
|
return rb_gtk3_tree_view_mapping_func_callback;
|
329
510
|
} else {
|
@@ -417,6 +598,10 @@ rbgtk3_initialize(VALUE self)
|
|
417
598
|
void
|
418
599
|
Init_gtk3(void)
|
419
600
|
{
|
601
|
+
id_call = rb_intern("call");
|
602
|
+
cGdkAtom = rb_const_get(rb_const_get(rb_cObject, rb_intern("Gdk")),
|
603
|
+
rb_intern("Atom"));
|
604
|
+
|
420
605
|
rb_gi_callback_register_finder(rb_gtk3_callback_finder);
|
421
606
|
|
422
607
|
#ifndef RB_GTK_ACTION_IS_DEPRECATED
|