ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/gtk2-perl-xs.patch
Revision: 1.3
Committed: Sun Jun 1 20:12:10 2003 UTC (20 years, 11 months ago) by pcg
Branch: MAIN
Changes since 1.2: +74 -4 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 pcg 1.1
2 pcg 1.3 Gtk2
3     * xs/GtkAspectFrame.xs: fixed package name typo.
4     * xs/GtkAspectFrame.xs: renamed ->set to set_param, because ->set is more
5     universal.
6     * xs/GtkTreeSortable.xs: fixed package name typo.
7     * xs/GtkAdjustment.xs: add accors/mutators for struct values.
8    
9     Glib
10     * gperl.h: make it compile even on non-threaded perls (where aTHX is empty).
11     * GObject.xs: ->set and ->get accept more than one property pair/name.
12    
13     Index: Makefile
14     ===================================================================
15     RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Makefile,v
16     retrieving revision 1.2
17     diff -u -p -r1.2 Makefile
18     --- Makefile 17 May 2003 21:28:05 -0000 1.2
19     +++ Makefile 1 Jun 2003 20:11:52 -0000
20     @@ -16,7 +16,7 @@
21     # non-system installed version. If you have any questions send them to the
22     # mailing list -rm
23    
24     -PREFIX=/usr/local
25     +PREFIX=//opt/perl
26    
27     TARGETS=Glib/Makefile Glib.build
28     TARGETS+=Gtk2/Makefile Gtk2.build
29 pcg 1.1 Index: Glib/GObject.xs
30     ===================================================================
31     RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/GObject.xs,v
32     retrieving revision 1.2
33     diff -u -p -r1.2 GObject.xs
34     --- Glib/GObject.xs 22 May 2003 14:23:11 -0000 1.2
35 pcg 1.3 +++ Glib/GObject.xs 1 Jun 2003 20:11:53 -0000
36 pcg 1.1 @@ -390,37 +390,49 @@ g_object_get_data (object, key)
37    
38    
39     SV *
40     -g_object_get (object, name)
41     +g_object_get (object, ...)
42     GObject * object
43     - char * name
44     ALIAS:
45     Glib::Object::get = 0
46     Glib::Object::get_property = 1
47     PREINIT:
48     GValue value = {0,};
49     - CODE:
50     - init_property_value (object, name, &value);
51     - g_object_get_property (object, name, &value);
52     - RETVAL = gperl_sv_from_value (&value);
53     - g_value_unset (&value);
54     - OUTPUT:
55     - RETVAL
56     + PPCODE:
57     + int i;
58     +
59     + EXTEND (SP, items);
60 pcg 1.2 + for (i = 1; i < items; i++) {
61 pcg 1.1 + char *name = SvPV_nolen (ST (i));
62     +
63     + init_property_value (object, name, &value);
64     + g_object_get_property (object, name, &value);
65     + PUSHs (sv_2mortal (gperl_sv_from_value (&value)));
66     + g_value_unset (&value);
67     + }
68    
69     void
70     -g_object_set (object, name, newval)
71     +g_object_set (object, ...)
72     GObject * object
73     - char * name
74     - SV * newval
75     ALIAS:
76     Glib::Object::set = 0
77     Glib::Object::set_property = 1
78     PREINIT:
79     GValue value = {0,};
80     CODE:
81     - init_property_value (object, name, &value);
82     - gperl_value_from_sv (&value, newval);
83     - g_object_set_property (object, name, &value);
84     - g_value_unset (&value);
85     + int i;
86     +
87     + if (!(items % 2))
88     + croak ("set method expects name => value pairs (off number of arguments detected)");
89     +
90     + for (i = 1; i < items; i += 2) {
91     + char *name = SvPV_nolen (ST (i));
92     + SV *newval = ST (i + 1);
93     +
94     + init_property_value (object, name, &value);
95     + gperl_value_from_sv (&value, newval);
96     + g_object_set_property (object, name, &value);
97     + g_value_unset (&value);
98     + }
99    
100    
101     void
102     Index: Glib/gperl.h
103     ===================================================================
104     RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/gperl.h,v
105     retrieving revision 1.4
106     diff -u -p -r1.4 gperl.h
107     --- Glib/gperl.h 31 May 2003 04:00:45 -0000 1.4
108 pcg 1.3 +++ Glib/gperl.h 1 Jun 2003 20:11:54 -0000
109 pcg 1.1 @@ -28,6 +28,11 @@
110    
111     #include <glib-object.h>
112    
113     +#ifndef PERL_IMPLICIT_CONTEXT
114     +# undef aTHX
115     +# define aTHX (void *)0
116     +#endif
117     +
118     /*
119     * miscellaneous
120     */
121 pcg 1.3 Index: Gtk2/xs/GtkAdjustment.xs
122     ===================================================================
123     RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/xs/GtkAdjustment.xs,v
124     retrieving revision 1.3
125     diff -u -p -r1.3 GtkAdjustment.xs
126     --- Gtk2/xs/GtkAdjustment.xs 22 May 2003 14:23:23 -0000 1.3
127     +++ Gtk2/xs/GtkAdjustment.xs 1 Jun 2003 20:11:54 -0000
128     @@ -58,3 +58,35 @@ gtk_adjustment_set_value (adjustment, va
129     GtkAdjustment *adjustment
130     gdouble value
131    
132     +gdouble
133     +value (GtkAdjustment *adjustment, gdouble newval = 0)
134     + ALIAS:
135     + lower = 1
136     + upper = 2
137     + step_incrememt = 3
138     + page_incrememt = 4
139     + page_size = 5
140     + CODE:
141     + switch (ix) {
142     + case 0: RETVAL = adjustment->value;
143     + if (items > 1) adjustment->value = newval;
144     + break;
145     + case 1: RETVAL = adjustment->lower;
146     + if (items > 1) adjustment->lower = newval;
147     + break;
148     + case 2: RETVAL = adjustment->upper;
149     + if (items > 1) adjustment->upper = newval;
150     + break;
151     + case 3: RETVAL = adjustment->step_increment;
152     + if (items > 1) adjustment->step_increment = newval;
153     + break;
154     + case 4: RETVAL = adjustment->page_increment;
155     + if (items > 1) adjustment->page_increment = newval;
156     + break;
157     + case 5: RETVAL = adjustment->page_size;
158     + if (items > 1) adjustment->page_size = newval;
159     + break;
160     + }
161     + OUTPUT:
162     + RETVAL
163     +
164 pcg 1.1 Index: Gtk2/xs/GtkAspectFrame.xs
165     ===================================================================
166     RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/xs/GtkAspectFrame.xs,v
167     retrieving revision 1.3
168     diff -u -p -r1.3 GtkAspectFrame.xs
169     --- Gtk2/xs/GtkAspectFrame.xs 22 May 2003 14:23:23 -0000 1.3
170 pcg 1.3 +++ Gtk2/xs/GtkAspectFrame.xs 1 Jun 2003 20:11:54 -0000
171 pcg 1.1 @@ -21,7 +21,7 @@
172    
173     #include "gtk2perl.h"
174    
175     -MODULE = Gtk2::AspectFrame PACKAGE = Gtk2::AspectFrame PREFIX = gtk_aspectframe_
176     +MODULE = Gtk2::AspectFrame PACKAGE = Gtk2::AspectFrame PREFIX = gtk_aspect_frame_
177    
178     ## GtkWidget* gtk_aspect_frame_new (const gchar *label, gfloat xalign, gfloat yalign, gfloat ratio, gboolean obey_child)
179     GtkWidget *
180     @@ -35,9 +35,10 @@ gtk_aspect_frame_new (class, label, xali
181     C_ARGS:
182     label, xalign, yalign, ratio, obey_child
183    
184     +# renamed to set_params because the existing ->set method is more important
185     ## void gtk_aspect_frame_set (GtkAspectFrame *aspect_frame, gfloat xalign, gfloat yalign, gfloat ratio, gboolean obey_child)
186     void
187     -gtk_aspect_frame_set (aspect_frame, xalign, yalign, ratio, obey_child)
188     +gtk_aspect_frame_set_params (aspect_frame, xalign, yalign, ratio, obey_child)
189     GtkAspectFrame * aspect_frame
190     gfloat xalign
191     gfloat yalign
192     Index: Gtk2/xs/GtkTreeSortable.xs
193     ===================================================================
194     RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/xs/GtkTreeSortable.xs,v
195     retrieving revision 1.3
196     diff -u -p -r1.3 GtkTreeSortable.xs
197     --- Gtk2/xs/GtkTreeSortable.xs 22 May 2003 14:23:24 -0000 1.3
198 pcg 1.3 +++ Gtk2/xs/GtkTreeSortable.xs 1 Jun 2003 20:11:54 -0000
199 pcg 1.1 @@ -23,7 +23,7 @@
200    
201     // typedef gint (* GtkTreeIterCompareFunc) (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data)
202    
203     -MODULE = Gtk2::TreeSortable PACKAGE = Gtk2::TreeSortable PREFIX = gtk_tre_sortable_
204     +MODULE = Gtk2::TreeSortable PACKAGE = Gtk2::TreeSortable PREFIX = gtk_tree_sortable_
205    
206     ## void gtk_tree_sortable_sort_column_changed (GtkTreeSortable *sortable)
207     void