#37455 [Opn->Csd]: Patch for gtk_selection_data_set_uris/gtk_selection_data_get_uris

From: Date: Sun, 30 Jul 2006 18:37:27 +0000
Subject: #37455 [Opn->Csd]: Patch for gtk_selection_data_set_uris/gtk_selection_data_get_uris
References: 1  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-3342@lists.php.net to get a copy of this message
ID: 37455 Updated by: andrei@php.net Reported By: cweiske@php.net -Status: Open +Status: Closed Bug Type: PHP-GTK related Operating System: Any PHP Version: 5.1.4 New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2006-05-16 04:32:47] cweiske@php.net Description: ------------ Attached is a patch for gtk_selection_data_set_uris/gtk_selection_data_get_uris. It can be found at http://xml.cweiske.de/selectiondata.diff Reproduce code: --------------- --- ext/gtk+/gtk.overrides2006-05-16 06:28:22.000000000 +0200 +++ ../gtk.overrides2006-05-16 06:28:03.000000000 +0200 @@ -750,6 +750,13 @@ } %% +add-arginfo GtkAboutDialog set_artists +static +ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) + ZEND_ARG_INFO(0, artists) +ZEND_END_ARG_INFO(); + +%% override gtk_about_dialog_set_artists PHP_METHOD { @@ -780,6 +787,13 @@ } %% +add-arginfo GtkAboutDialog set_authors +static +ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) + ZEND_ARG_INFO(0, authors) +ZEND_END_ARG_INFO(); + +%% override gtk_about_dialog_set_authors PHP_METHOD { @@ -810,6 +824,13 @@ } %% +add-arginfo GtkAboutDialog set_documenters +static +ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) + ZEND_ARG_INFO(0, documenters) +ZEND_END_ARG_INFO(); + +%% override gtk_about_dialog_set_documenters PHP_METHOD { @@ -2879,6 +2900,83 @@ %% }}} + +%% {{{ GtkSelectionData + +%% +override gtk_selection_data_get_uris +PHP_METHOD +{ + gchar **ret; + gchar *cp_str; + gsize cp_len; + zend_bool free_cp_str; + GtkSelectionData *selection_data = NULL; + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")) + return; + + selection_data = (GtkSelectionData *) PHPG_GBOXED(this_ptr); + ret = gtk_selection_data_get_uris(selection_data); + if (ret) { + array_init(return_value); + while (*ret) { + cp_str = phpg_from_utf8(*ret, strlen(*ret), &cp_len, &free_cp_str TSRMLS_CC); + if (cp_str) { + add_next_index_stringl(return_value, cp_str, cp_len, !free_cp_str); + } else { + zval_dtor(return_value); + RETURN_NULL(); + } + *ret++; + } +// g_strfreev(*ret); + } else { + RETURN_NULL(); + } +} + +%% +add-arginfo GtkSelectionData set_uris +static +ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0) + ZEND_ARG_INFO(0, uris) +ZEND_END_ARG_INFO(); + +%% +override gtk_selection_data_set_uris +PHP_METHOD +{ + gchar **uris; + zval *arr = NULL; + zval **data; + int i, arr_count; + GtkSelectionData *selection_data = NULL; + + if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "a", &arr)) { + return; + } + + arr_count = zend_hash_num_elements(Z_ARRVAL_P(arr)); + uris = safe_emalloc(arr_count+1, sizeof (gchar *), 0); + + for (i=0, zend_hash_internal_pointer_reset(Z_ARRVAL_P(arr)); + zend_hash_get_current_data(Z_ARRVAL_P(arr), (void **)&data) == SUCCESS; + zend_hash_move_forward(Z_ARRVAL_P(arr))) { + + convert_to_string_ex(data); + uris[i++] = Z_STRVAL_PP(data); + + } + + uris[i] = NULL; + selection_data = (GtkSelectionData *) PHPG_GBOXED(this_ptr); + gtk_selection_data_set_uris(selection_data, (gchar **)uris); + efree(uris); +} + +%% }}} + %% {{{ GtkSpinButton %% ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37455&edit=1

« previous php.gtk.dev (#3342) next »