Re[2]: [PHP-GTK-DEV] GtkUiManager overrides

From: Date: Sun, 16 Oct 2005 14:06:49 +0000
Subject: Re[2]: [PHP-GTK-DEV] GtkUiManager overrides
References: 1 2  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-1833@lists.php.net to get a copy of this message
Hi, Sunday, October 16, 2005, 11:50:22 PM, you wrote: S> Hi Tom, S> This doesn't build for me as-is. I needed to make the const-char* S> declarations const char* to allow it to build at all, and then cast the S> return value as (char *) in both those cases to make it build without S> complaining. S> It works as advertised here following those minor changes. Cute ;) S> - Steph That will teach me for editing gen_gtk.c instead of the overrides :) I actually had it as char *name = NULL; (const gchar*) name = gtk_widget_get_name(toplevels->data); which is what I guess you ended up with more or less. Have included corrected file -- regards, Tom

%% {{{ GtkUIManager %% add-arginfo GtkUIManager add_ui_from_string static ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) ZEND_ARG_INFO(0, text) ZEND_END_ARG_INFO(); %% override gtk_ui_manager_add_ui_from_string PHP_METHOD { zval *items = NULL; zend_bool free_text; char *text; long text_len; GError *error; NOT_STATIC_METHOD(); if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "u#", &text, &text_len, &free_text)) return; gtk_ui_manager_add_ui_from_string(GTK_UI_MANAGER(PHPG_GOBJECT(this_ptr)), text, text_len, &error); if (free_text) g_free(text); } %% add-arginfo GtkUIManager get_toplevels static ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) ZEND_ARG_INFO(0, types) ZEND_END_ARG_INFO(); %% override gtk_ui_manager_get_toplevels static PHP_METHOD(GtkUIManager, get_toplevels) { long types; GSList *toplevels = 0; if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "i", &types)) return; array_init(return_value); for (toplevels = gtk_ui_manager_get_toplevels(GTK_UI_MANAGER(PHPG_GOBJECT(this_ptr)), types); toplevels; toplevels = toplevels->next) { zval *item = NULL; char *name = NULL; (const gchar*) name = gtk_widget_get_name(toplevels->data); phpg_gobject_new(&item, G_OBJECT(toplevels->data) TSRMLS_CC); add_assoc_zval(return_value, name, item); } g_slist_free(toplevels); } %% override gtk_ui_manager_get_action_groups static PHP_METHOD(GtkUIManager, get_action_groups) { GList *action_groups = 0; if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) return; array_init(return_value); for (action_groups = gtk_ui_manager_get_action_groups(GTK_UI_MANAGER(PHPG_GOBJECT(this_ptr))); action_groups; action_groups = action_groups->next) { zval *item = NULL; char *name = NULL; (const gchar*) name = gtk_action_group_get_name(action_groups->data); phpg_gobject_new(&item, G_OBJECT(action_groups->data) TSRMLS_CC); add_assoc_zval(return_value, name, item); } } %% }}}
« previous php.gtk.dev (#1833) next »