com gtk/php-gtk: GtkIconView constructor reflection info GtkIconView::selected_foreach(callback), even w ithout any leaks :): ext/gtk+/gtk.overrides

[email protected] (David Soria Parra)
Newsgroups php.gtk.cvs
Message-ID <[email protected]>
Commit:    7f756337219f09eff43e30afe3057bcef92b7cfb
Author:    Christian Weiske <[email protected]>         Tue, 13 Jun 2006 19:21:45 +0000
Parents:   6a8db9659d4822da146ef11dc6b47e376005e7b5
Branches:  master

Link:       http://git.php.net/?p=gtk/php-gtk.git;a=commitdiff;h=7f756337219f09eff43e30afe3057bcef92b7cfb

Log:
GtkIconView constructor reflection info
GtkIconView::selected_foreach(callback), even without any leaks :)

Changed paths:
  M  ext/gtk+/gtk.overrides


Diff:
7f756337219f09eff43e30afe3057bcef92b7cfb
diff --git a/ext/gtk+/gtk.overrides b/ext/gtk+/gtk.overrides
index 677dd4d..83914c5 100644
--- a/ext/gtk+/gtk.overrides
+++ b/ext/gtk+/gtk.overrides
@@ -5,6 +5,7 @@ headers
 #include "ext/standard/file.h"
 static void phpg_about_dialog_activate_link_func_marshal (GtkAboutDialog *about, const gchar *link, gpointer data);
 static gboolean phpg_tree_view_row_separator_func_marshal (GtkTreeModel *model, GtkTreeIter *iter, gpointer data);
+static void phpg_icon_view_foreach_func_marshal (GtkIconView *icon_view, GtkTreePath *path, gpointer data);
 
 #undef GDK_DISPLAY
 #define GDK_DISPLAY(object) (GDK_DISPLAY_OBJECT(object))
@@ -2155,6 +2156,13 @@ PHP_METHOD
 %% {{{ GtkIconView
 
 %%
+add-arginfo GtkIconView __construct
+static
+ZEND_BEGIN_ARG_INFO_EX(ARGINFO_NAME, 0, 0, 0)
+    ZEND_ARG_OBJ_INFO(0, model, GtkTreeModel, 0)
+ZEND_END_ARG_INFO();
+
+%%
 override gtk_icon_view_new
 PHP_METHOD
 {
@@ -2204,6 +2212,73 @@ PHP_METHOD
     }
 }
 
+%%
+add-arginfo GtkIconView selected_foreach
+static
+ZEND_BEGIN_ARG_INFO(ARGINFO_NAME, 0)
+    ZEND_ARG_INFO(0, callback)
+ZEND_END_ARG_INFO();
+
+%%
+override gtk_icon_view_selected_foreach
+static void phpg_icon_view_foreach_func_marshal(GtkIconView *icon_view, GtkTreePath *path, gpointer data)
+{
+    phpg_cb_data_t *cbd = (phpg_cb_data_t *) data;
+    zval *retval = NULL;
+    zval ***args = NULL;
+    int n_args = 0;
+    char *callback_name;
+    zval *php_icon_view = NULL, *php_path = NULL;
+
+    TSRMLS_FETCH();
+
+    if (!zend_is_callable(cbd->callback, 0, &callback_name)) {
+        php_error(E_WARNING, "Unable to invoke callback '%s' specified in %s on line %ld", callback_name, cbd->src_filename, cbd->src_lineno);
+        efree(callback_name);
+        return;
+    }
+
+    phpg_gobject_new(&php_icon_view,       (GObject*)icon_view       TSRMLS_CC);
+    phpg_tree_path_to_zval(path, &php_path TSRMLS_CC);
+
+    args = php_gtk_hash_as_array_offset(cbd->user_args, 2, &n_args);
+    args[0] = &php_icon_view;
+    args[1] = &php_path;
+
+    call_user_function_ex(EG(function_table), NULL, cbd->callback, &retval, n_args, args, 0, NULL TSRMLS_CC);
+
+    zval_ptr_dtor(&php_icon_view);
+    zval_ptr_dtor(&php_path);
+
+    if (retval) {
+        zval_ptr_dtor(&retval);
+    }
+
+    phpg_handle_marshaller_exception(TSRMLS_C);
+
+    efree(callback_name);
+    efree(args);
+}
+
+PHP_METHOD
+{
+    zval *php_callback, *extra;
+    phpg_cb_data_t *cb_data;
+    GtkIconViewForeachFunc callback;
+
+    NOT_STATIC_METHOD();
+
+    if (!php_gtk_parse_varargs(ZEND_NUM_ARGS(), 1, &extra, "V", &php_callback))
+        return;
+
+    zval_add_ref(&php_callback);
+    cb_data  = phpg_cb_data_new(php_callback, extra TSRMLS_CC);
+    callback = (GtkIconViewForeachFunc)phpg_icon_view_foreach_func_marshal;
+
+    gtk_icon_view_selected_foreach(GTK_ICON_VIEW(PHPG_GOBJECT(this_ptr)), callback, cb_data);
+    phpg_cb_data_destroy(cb_data);
+}
+
 %% }}}
 
 %% {{{ GtkImageMenuItem
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.