logo       

cvs: php-gtk /main phpg_gobject.c: msg#00018

Subject: cvs: php-gtk /main phpg_gobject.c
andrei          Fri Feb 25 23:02:49 2005 EDT

  Modified files:              
    /php-gtk/main       phpg_gobject.c 
  Log:
  Implement the rest of connect_*() methods.
  
  
http://cvs.php.net/diff.php/php-gtk/main/phpg_gobject.c?r1=1.20&r2=1.21&ty=u
Index: php-gtk/main/phpg_gobject.c
diff -u php-gtk/main/phpg_gobject.c:1.20 php-gtk/main/phpg_gobject.c:1.21
--- php-gtk/main/phpg_gobject.c:1.20    Thu Feb 24 18:25:49 2005
+++ php-gtk/main/phpg_gobject.c Fri Feb 25 23:02:48 2005
@@ -30,18 +30,9 @@
 static GQuark       gobject_wrapper_key  = 0;
 
 HashTable phpg_prop_info;
-/*
- * TODO: remove?
-HashTable php_gtk_prop_getters;
-HashTable php_gtk_prop_setters;
-HashTable php_gtk_rsrc_hash;
-HashTable php_gtk_type_hash;
-HashTable php_gtk_prop_desc;
-HashTable php_gtk_callback_hash;
-*/
 
-/* {{{ static      phpg_free_object_storage() */
-static inline void phpg_free_object_storage(phpg_gobject_t *object, 
zend_object_handle handle TSRMLS_DC)
+/* {{{ static      phpg_free_gobject_storage() */
+static inline void phpg_free_gobject_storage(phpg_gobject_t *object, 
zend_object_handle handle TSRMLS_DC)
 {
     GSList *tmp;
 
@@ -62,8 +53,8 @@
 }
 /* }}} */
 
-/* {{{ static      phpg_create_object() */
-static zend_object_value phpg_create_object(zend_class_entry *ce TSRMLS_DC)
+/* {{{ static      phpg_create_gobject() */
+static zend_object_value phpg_create_gobject(zend_class_entry *ce TSRMLS_DC)
 {
        zend_object_value zov;
        phpg_gobject_t *object;
@@ -75,7 +66,7 @@
        object->closures = NULL;
 
        zov.handlers = &php_gtk_handlers;
-       zov.handle = zend_objects_store_put(object, (zend_objects_store_dtor_t) 
zend_objects_destroy_object, (zend_objects_free_object_storage_t) 
phpg_free_object_storage, NULL TSRMLS_CC);
+       zov.handle = zend_objects_store_put(object, (zend_objects_store_dtor_t) 
zend_objects_destroy_object, (zend_objects_free_object_storage_t) 
phpg_free_gobject_storage, NULL TSRMLS_CC);
 
        return zov;
 }
@@ -257,7 +248,8 @@
        zend_hash_copy(poh->zobj.properties, &ce->default_properties, 
(copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
 
        /*
-        * Find the nearest internal parent class
+        * Find the nearest internal parent class and use its property handler
+     * information
         */
        prop_ce = ce;
        while (prop_ce->type != ZEND_INTERNAL_CLASS && prop_ce->parent != NULL) 
{
@@ -295,7 +287,7 @@
        if (create_obj_func) {
                ce.create_object = create_obj_func;
        } else {
-               ce.create_object = phpg_create_object;
+               ce.create_object = phpg_create_gobject;
        }
 
        real_ce = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC);
@@ -372,6 +364,7 @@
     g_type_class_unref(eclass);
 }
 /* }}} */
+
 /* {{{ PHP_GTK_API phpg_register_flags() */
 void phpg_register_flags(GType gtype, const char *strip_prefix, 
zend_class_entry *ce)
 {
@@ -496,8 +489,8 @@
 
 PHP_GTK_EXPORT_CE(gobject_ce) = NULL;
 
-/* {{{ GObject::connect */
-static PHP_METHOD(GObject, connect)
+/* {{{ static phpg_signal_connect_impl() */
+static void phpg_signal_connect_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool 
use_signal_object, zend_bool after)
 {
     char *signal = NULL;
     zval *callback;
@@ -526,15 +519,39 @@
     }
 
     extra = php_gtk_func_args_as_hash(ZEND_NUM_ARGS(), 2, ZEND_NUM_ARGS());
-    closure = phpg_closure_new(callback, extra, TRUE TSRMLS_CC);
+    closure = phpg_closure_new(callback, extra, use_signal_object TSRMLS_CC);
     if (extra) {
         zval_ptr_dtor(&extra);
     }
     phpg_gobject_watch_closure(this_ptr, closure);
-    handler_id = g_signal_connect_closure_by_id(obj, signal_id, detail, 
closure, FALSE);
+    handler_id = g_signal_connect_closure_by_id(obj, signal_id, detail, 
closure, after);
     RETURN_LONG(handler_id);
 }
 /* }}} */
+/* {{{ GObject::connect */
+static PHP_METHOD(GObject, connect)
+{
+       phpg_signal_connect_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE, FALSE);
+}
+/* }}} */
+/* {{{ GObject::connect_after */
+static PHP_METHOD(GObject, connect_after)
+{
+       phpg_signal_connect_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, TRUE, TRUE);
+}
+/* }}} */
+/* {{{ GObject::connect_object */
+static PHP_METHOD(GObject, connect_object)
+{
+       phpg_signal_connect_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, FALSE, 
FALSE);
+}
+/* }}} */
+/* {{{ GObject::connect_object_after */
+static PHP_METHOD(GObject, connect_object_after)
+{
+       phpg_signal_connect_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, FALSE, TRUE);
+}
+/* }}} */
 
 /* {{{ GObject::__tostring() */
 static PHP_METHOD(GObject, __tostring)
@@ -555,6 +572,9 @@
 
 static zend_function_entry gobject_methods[] = {
        PHP_ME(GObject, connect, NULL, ZEND_ACC_PUBLIC)
+       PHP_ME(GObject, connect_after, NULL, ZEND_ACC_PUBLIC)
+       PHP_ME(GObject, connect_object, NULL, ZEND_ACC_PUBLIC)
+       PHP_ME(GObject, connect_object_after, NULL, ZEND_ACC_PUBLIC)
        PHP_ME(GObject, __tostring, NULL, ZEND_ACC_PUBLIC)
        {NULL, NULL, NULL}
 };

-- 
PHP-GTK CVS Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe