gtk2 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,6 +32,13 @@
32
32
  # include <st.h>
33
33
  #endif
34
34
 
35
+ #undef RG_DEF_METHOD
36
+ #define RG_DEF_METHOD(method, argc) \
37
+ rb_define_method(RG_TARGET_NAMESPACE, #method, rg_ ## method, argc)
38
+ #undef RG_DEF_SMETHOD
39
+ #define RG_DEF_SMETHOD(method, argc) \
40
+ rb_define_singleton_method(RG_TARGET_NAMESPACE, #method, rg_s_ ## method, argc)
41
+
35
42
  #ifndef HAVE_RB_ERRINFO
36
43
  # define rb_errinfo() (ruby_errinfo)
37
44
  #endif
@@ -176,6 +183,7 @@ G_GNUC_INTERNAL void Init_gtk_image_menu_item(VALUE mGtk);
176
183
  G_GNUC_INTERNAL void Init_gtk_imcontext(VALUE mGtk);
177
184
  G_GNUC_INTERNAL void Init_gtk_imcontext_simple(VALUE mGtk);
178
185
  G_GNUC_INTERNAL void Init_gtk_im_multicontext(VALUE mGtk);
186
+ G_GNUC_INTERNAL void Init_gtk_infobar(VALUE mGtk);
179
187
  G_GNUC_INTERNAL void Init_gtk_input_dialog(VALUE mGtk);
180
188
  G_GNUC_INTERNAL void Init_gtk_invisible(VALUE mGtk);
181
189
  G_GNUC_INTERNAL void Init_gtk_item(VALUE mGtk);
@@ -166,6 +166,7 @@ Init_gtk2(void)
166
166
  Init_gtk_imcontext(mGtk);
167
167
  Init_gtk_imcontext_simple(mGtk);
168
168
  Init_gtk_im_multicontext(mGtk);
169
+ Init_gtk_infobar(mGtk);
169
170
  Init_gtk_input_dialog(mGtk);
170
171
  Init_gtk_invisible(mGtk);
171
172
  Init_gtk_item(mGtk);
@@ -36,13 +36,15 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
36
36
  return Qnil;
37
37
  }
38
38
 
39
- void
39
+ void
40
40
  Init_gtk_color_selection_dialog(VALUE mGtk)
41
41
  {
42
42
  VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_COLOR_SELECTION_DIALOG,
43
43
  "ColorSelectionDialog", mGtk);
44
44
 
45
45
  RG_DEF_METHOD(initialize, -1);
46
+ #if GTK_CHECK_VERSION(2, 14, 0)
46
47
  /* NOTE: Backward compatibility */
47
48
  RG_DEF_ALIAS("colorsel", "color_selection");
49
+ #endif
48
50
  }
@@ -89,6 +89,10 @@ Init_gtk_const(VALUE mGtk)
89
89
  G_DEF_CLASS(GTK_TYPE_JUSTIFICATION, "Justification", mGtk);
90
90
  G_DEF_CONSTANTS(mGtk, GTK_TYPE_JUSTIFICATION, "GTK_");
91
91
 
92
+ /* GtkMessageType */
93
+ G_DEF_CLASS(GTK_TYPE_MESSAGE_TYPE, "MessageType", mGtk);
94
+ G_DEF_CONSTANTS(mGtk, GTK_TYPE_MESSAGE_TYPE, "GTK_MESSAGE_");
95
+
92
96
  /* GtkMetricType */
93
97
  G_DEF_CLASS(GTK_TYPE_METRIC_TYPE, "MetricType", mGtk);
94
98
  G_DEF_CONSTANTS(mGtk, GTK_TYPE_METRIC_TYPE, "GTK_");
@@ -129,6 +133,10 @@ Init_gtk_const(VALUE mGtk)
129
133
  G_DEF_CLASS(GTK_TYPE_RESIZE_MODE, "ResizeMode", mGtk);
130
134
  G_DEF_CONSTANTS(mGtk, GTK_TYPE_RESIZE_MODE, "GTK_");
131
135
 
136
+ /* GtkResponseType */
137
+ G_DEF_CLASS(GTK_TYPE_RESPONSE_TYPE, "ResponseType", mGtk);
138
+ G_DEF_CONSTANTS(mGtk, GTK_TYPE_RESPONSE_TYPE, "GTK_");
139
+
132
140
  /* GtkScrollStep */
133
141
  #if GTK_CHECK_VERSION(2,4,0)
134
142
  G_DEF_CLASS(GTK_TYPE_SCROLL_STEP, "ScrollStep", mGtk);
@@ -0,0 +1,147 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 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 "global.h"
22
+
23
+ #if GTK_CHECK_VERSION(2,18,0)
24
+ #define RG_TARGET_NAMESPACE cInfoBar
25
+ #define _SELF(self) (GTK_INFO_BAR(RVAL2GOBJ(self)))
26
+
27
+ static VALUE
28
+ rg_initialize(int argc, VALUE *argv, VALUE self)
29
+ {
30
+ if (argc == 0){
31
+ RBGTK_INITIALIZE(self, gtk_info_bar_new ());
32
+ } else if (argc > 0){
33
+ //TODO gtk_info_bar_new_with_buttons
34
+ rb_raise(rb_eArgError, "method does not yet supported adding buttons");
35
+ } else {
36
+ rb_raise(rb_eArgError, "invalid argument number");
37
+ }
38
+ return Qnil;
39
+ }
40
+
41
+ static VALUE
42
+ rg_get_action_area(VALUE self)
43
+ {
44
+ return GOBJ2RVAL(gtk_info_bar_get_action_area(_SELF(self)));
45
+ }
46
+
47
+ static VALUE
48
+ rg_get_content_area(VALUE self)
49
+ {
50
+ return GOBJ2RVAL(gtk_info_bar_get_content_area(_SELF(self)));
51
+ }
52
+
53
+ static VALUE
54
+ rg_get_message_type(VALUE self)
55
+ {
56
+ return GENUM2RVAL(gtk_info_bar_get_message_type(_SELF(self)),
57
+ GTK_TYPE_MESSAGE_TYPE);
58
+ }
59
+
60
+ static VALUE
61
+ rg_set_message_type(VALUE self, VALUE type)
62
+ {
63
+ gtk_info_bar_set_message_type(_SELF(self),
64
+ RVAL2GENUM(type, GTK_TYPE_MESSAGE_TYPE));
65
+ return self;
66
+ }
67
+
68
+ static VALUE
69
+ rg_set_default_response(VALUE self, VALUE response_id)
70
+ {
71
+ gtk_info_bar_set_default_response(_SELF(self),
72
+ RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE));
73
+ return self;
74
+ }
75
+
76
+ static VALUE
77
+ rg_add_action_widget(VALUE self, VALUE widget, VALUE response_id)
78
+ {
79
+ gtk_info_bar_add_action_widget(_SELF(self),
80
+ GTK_WIDGET(RVAL2GOBJ(widget)),
81
+ RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE));
82
+ return self;
83
+ }
84
+
85
+ static VALUE
86
+ rg_add_button(VALUE self, VALUE button_text, VALUE response_id)
87
+ {
88
+ const gchar *name;
89
+ if (SYMBOL_P(button_text)) {
90
+ name = rb_id2name(SYM2ID(button_text));
91
+ } else {
92
+ name = RVAL2CSTR(button_text);
93
+ }
94
+ return GOBJ2RVAL(gtk_info_bar_add_button(_SELF(self), name,
95
+ RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE)));
96
+ }
97
+
98
+ /*
99
+ static VALUE
100
+ rg_add_buttons(int argc, VALUE *argv, VALUE self)
101
+ {
102
+ }
103
+ */
104
+
105
+ static VALUE
106
+ rg_set_response_sensitive(VALUE self, VALUE response_id, VALUE sensitive)
107
+ {
108
+ gtk_info_bar_set_response_sensitive(_SELF(self),
109
+ RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE),
110
+ RVAL2CBOOL(sensitive));
111
+ return self;
112
+ }
113
+
114
+ static VALUE
115
+ rg_response(VALUE self, VALUE response_id)
116
+ {
117
+ gtk_info_bar_response(_SELF(self), RVAL2GENUM(response_id, GTK_TYPE_RESPONSE_TYPE));
118
+ return self;
119
+ }
120
+ #endif
121
+
122
+ void
123
+ Init_gtk_infobar(VALUE mGtk)
124
+ {
125
+ #if GTK_CHECK_VERSION(2,18,0)
126
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GTK_TYPE_INFO_BAR, "InfoBar", mGtk);
127
+
128
+ RG_DEF_METHOD(initialize, -1);
129
+ RG_DEF_METHOD(get_action_area, 0);
130
+ RG_DEF_ALIAS("action_area", "get_action_area");
131
+ RG_DEF_METHOD(get_content_area, 0);
132
+ RG_DEF_ALIAS("content_area", "get_content_area");
133
+ RG_DEF_METHOD(get_message_type, 0);
134
+ RG_DEF_ALIAS("message_type", "get_message_type");
135
+ RG_DEF_METHOD(set_message_type, 1);
136
+ G_DEF_SETTER(RG_TARGET_NAMESPACE, "message_type");
137
+ RG_DEF_METHOD(set_default_response, 1);
138
+ RG_DEF_METHOD(add_action_widget, 2);
139
+ RG_DEF_METHOD(add_button, 2);
140
+ /*
141
+ RG_DEF_METHOD(add_buttons, -1);
142
+ */
143
+ RG_DEF_METHOD(set_response_sensitive, 2);
144
+ RG_DEF_METHOD(response, 1);
145
+ #endif
146
+ }
147
+
@@ -58,7 +58,7 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
58
58
  }
59
59
  #else
60
60
  static VALUE
61
- ps_initialize(VALUE self)
61
+ rg_initialize(VALUE self)
62
62
  {
63
63
  G_INITIALIZE(self, gtk_print_settings_new());
64
64
  return Qnil;
@@ -246,6 +246,21 @@ rg_tree_view(VALUE self)
246
246
  }
247
247
  #endif
248
248
 
249
+ #if !GTK_CHECK_VERSION(2,18,0)
250
+ static VALUE
251
+ rg_sort_column_id(VALUE self)
252
+ {
253
+ return INT2NUM(gtk_tree_view_column_get_sort_column_id(_SELF(self)));
254
+ }
255
+
256
+ static VALUE
257
+ rg_set_sort_column_id(VALUE self, VALUE id)
258
+ {
259
+ gtk_tree_view_column_set_sort_column_id(_SELF(self), NUM2INT(id));
260
+ return self;
261
+ }
262
+ #endif
263
+
249
264
  void
250
265
  Init_gtk_treeviewcolumn(VALUE mGtk)
251
266
  {
@@ -272,6 +287,11 @@ Init_gtk_treeviewcolumn(VALUE mGtk)
272
287
  #endif
273
288
  #if GTK_CHECK_VERSION(2,12,0)
274
289
  RG_DEF_METHOD(tree_view, 0);
290
+ #endif
291
+ #if !GTK_CHECK_VERSION(2,18,0)
292
+ RG_DEF_METHOD(sort_column_id, 0);
293
+ RG_DEF_METHOD(set_sort_column_id, 1);
294
+ RG_DEF_ALIAS("sort_column_id=", "set_sort_column_id");
275
295
  #endif
276
296
  /* GtkTreeViewColumnSizing */
277
297
  G_DEF_CLASS(GTK_TYPE_TREE_VIEW_COLUMN_SIZING, "Sizing", RG_TARGET_NAMESPACE);
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'gtk2'
4
+
5
+ label=Gtk::Label.new.show
6
+
7
+ info=Gtk::InfoBar.new
8
+ info.no_show_all=true
9
+ info.content_area.add(label)
10
+ info.add_button(Gtk::Stock::OK, Gtk::ResponseType::OK)
11
+ info.signal_connect('response'){|info, response| info.hide}
12
+
13
+ w=Gtk::Window.new
14
+ w.add(info)
15
+ w.show_all
16
+ w.signal_connect("delete_event"){Gtk.main_quit}
17
+
18
+ GLib::Timeout.add_seconds(1){
19
+ label.text='ERROR'
20
+ info.message_type=Gtk::MessageType::ERROR
21
+ info.show
22
+ false
23
+ }
24
+ Gtk.main
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 2
10
- version: 1.1.2
9
+ - 3
10
+ version: 1.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - The Ruby-GNOME2 Project Team
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-15 00:00:00 Z
18
+ date: 2012-04-08 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: atk
@@ -25,12 +25,12 @@ dependencies:
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- hash: 23
28
+ hash: 21
29
29
  segments:
30
30
  - 1
31
31
  - 1
32
- - 2
33
- version: 1.1.2
32
+ - 3
33
+ version: 1.1.3
34
34
  type: :runtime
35
35
  version_requirements: *id001
36
36
  - !ruby/object:Gem::Dependency
@@ -41,12 +41,12 @@ dependencies:
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- hash: 23
44
+ hash: 21
45
45
  segments:
46
46
  - 1
47
47
  - 1
48
- - 2
49
- version: 1.1.2
48
+ - 3
49
+ version: 1.1.3
50
50
  type: :runtime
51
51
  version_requirements: *id002
52
52
  - !ruby/object:Gem::Dependency
@@ -57,12 +57,12 @@ dependencies:
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- hash: 23
60
+ hash: 21
61
61
  segments:
62
62
  - 1
63
63
  - 1
64
- - 2
65
- version: 1.1.2
64
+ - 3
65
+ version: 1.1.3
66
66
  type: :runtime
67
67
  version_requirements: *id003
68
68
  description: Ruby/GTK2 is a Ruby binding of GTK+-2.x.
@@ -133,6 +133,7 @@ files:
133
133
  - ext/gtk2/rbgtkfilechooser.c
134
134
  - ext/gtk2/rbgdkatom.c
135
135
  - ext/gtk2/rbgtkvbox.c
136
+ - ext/gtk2/rbgtkinfobar.c
136
137
  - ext/gtk2/rbgdkcolor.c
137
138
  - ext/gtk2/rbgtktreemodel.c
138
139
  - ext/gtk2/rbgtkcurve.c
@@ -433,6 +434,7 @@ files:
433
434
  - sample/misc/linkbutton.rb
434
435
  - sample/misc/dndtreeview.rb
435
436
  - sample/misc/scalebutton.rb
437
+ - sample/misc/infobar.rb
436
438
  - sample/misc/combo_check.rb
437
439
  - sample/misc/stock.rb
438
440
  - sample/misc/xbm_cursor.rb
@@ -567,7 +569,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
567
569
  requirements: []
568
570
 
569
571
  rubyforge_project:
570
- rubygems_version: 1.8.12
572
+ rubygems_version: 1.8.15
571
573
  signing_key:
572
574
  specification_version: 3
573
575
  summary: Ruby/GTK2 is a Ruby binding of GTK+-2.x.