php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37455 Patch for gtk_selection_data_set_uris/gtk_selection_data_get_uris
Submitted: 2006-05-16 04:32 UTC Modified: 2006-07-30 18:37 UTC
From: cweiske@php.net Assigned:
Status: Closed Package: PHP-GTK related
PHP Version: 5.1.4 OS: Any
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: cweiske@php.net
New email:
PHP Version: OS:

 

 [2006-05-16 04:32 UTC] 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
 
 %%


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-07-30 18:37 UTC] andrei@php.net
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.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 09:01:26 2025 UTC