ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/gtk2-perl-xs.patch
(Generate patch)

Comparing kgsueme/gtk2-perl-xs.patch (file contents):
Revision 1.1 by pcg, Sun Jun 1 06:07:11 2003 UTC vs.
Revision 1.4 by pcg, Mon Jun 2 14:33:20 2003 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines