4 gboolean
GN_glade_init(int arity
, ei_x_buff
*XBUF
, char *B
, int *I
){
7 if ( ! gn_check_arity(XBUF
, 1, arity
) )
9 if ( ! gn_get_arg_gchar(XBUF
, B
, I
, &xml_filename
) )
10 return FALSE
; /* free */
12 if ( gn_glade_init(xml_filename
) ) {
17 gn_enc_1_error(XBUF
, "glade_init_failed");
23 gboolean
GN_new_gvalue(int arity
, ei_x_buff
*XBUF
, char *B
, int *I
){
24 gchar name
[MAXATOMLEN
+1];
25 gchar gtype
[MAXATOMLEN
+1];
26 char key
[200] = "GValue-";
30 if ( ! gn_check_arity(XBUF
, 2, arity
) ) return FALSE
;
31 if ( ! gn_get_arg_gchar_fix(XBUF
, B
, I
, name
) ) return FALSE
;
32 if ( ! gn_get_arg_gchar_fix(XBUF
, B
, I
, gtype
) ) return FALSE
;
35 if ( hash_lookup(key
) ) {
36 gn_enc_2_error(XBUF
, "already_exists");
37 ei_x_encode_atom(XBUF
, key
);
41 if( ! (gtyp
= gn_GType_from_name(gtype
)) || ! G_TYPE_IS_VALUE_TYPE(gtyp
) ) {
42 gn_enc_2_error(XBUF
, "not_value_type");
43 ei_x_encode_atom(XBUF
, gtype
);
47 gval
= g_new0(GValue
,1);
48 hash_insert(key
, (void*)gval
);
49 g_value_init(gval
, gtyp
);
54 gboolean
GN_pango_layout_set_text(int ARI
, ei_x_buff
*XBUF
, char *B
, int *I
){
58 PangoFontDescription
* descr
;
62 if ( ! gn_check_arity(XBUF
, 3, ARI
) )
64 if ( ! gn_get_arg_struct(XBUF
, B
, I
, "PangoLayout", (void**)&layout
) )
66 if ( ! gn_get_arg_gchar(XBUF
, B
, I
, &text
) ) /* free */
68 if ( ! gn_get_arg_gchar(XBUF
, B
, I
, &descr_str
) ) { /* free */
73 descr
= pango_font_description_from_string(descr_str
);
74 pango_layout_set_font_description(layout
, descr
);
75 pango_layout_set_text(layout
,text
,(int)strlen(text
));
76 pango_font_description_free(descr
);
84 gboolean
GN_widget_get_attr(int ARI
, ei_x_buff
*XBUF
, char *B
, int *I
) {
85 gchar attr
[MAXATOMLEN
+1];
88 if ( ! gn_check_arity(XBUF
, 2, ARI
) ) return FALSE
;
89 if ( ! gn_get_arg_object(XBUF
, B
, I
, GTK_TYPE_WIDGET
, (GObject
**)&widget
) )
91 if ( ! gn_get_arg_gchar_fix(XBUF
, B
, I
, attr
) ) return FALSE
;
93 if ( strcmp("window",attr
) == 0 ){
94 gn_put_object(XBUF
,(GObject
*) widget
->window
);
95 }else if ( strcmp("x",attr
) == 0 ) {
96 gn_put_longlong(XBUF
,(long long)widget
->allocation
.x
);
97 }else if ( strcmp("y",attr
) == 0 ) {
98 gn_put_longlong(XBUF
,(long long)widget
->allocation
.y
);
99 }else if ( strcmp("width",attr
) == 0 ) {
100 gn_put_longlong(XBUF
,(long long)widget
->allocation
.width
);
101 }else if ( strcmp("height",attr
) == 0 ) {
102 gn_put_longlong(XBUF
,(long long)widget
->allocation
.height
);
104 gn_enc_2_error(XBUF
, "no_such_attr");
105 ei_x_encode_atom(XBUF
, attr
);