Re: #37455 [NEW]: Patch for gtk_selection_data_set_uris/gtk_selection_data_get_uris
| From: | Christian Weiske | Date: | Sat, 10 Jun 2006 11:36:15 +0000 |
| Subject: | Re: #37455 [NEW]: 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-2962@lists.php.net to get a copy of this message | ||
Bump.
cweiske@php.net wrote:
> From: cweiske@php.net
> Operating system: Any
> PHP version: 5.1.4
> PHP Bug Type: PHP-GTK related
> Bug description: Patch for gtk_selection_data_set_uris/gtk_selection_data_get_uris
>
> 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
>
> %%
>
>
--
Regards/MfG,
Christian Weiske
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc