gio2 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/gio2/rbgiosocket.c +28 -8
- data/ext/gio2/rbgiosocketclient.c +2 -2
- metadata +8 -8
    
        data/ext/gio2/rbgiosocket.c
    CHANGED
    
    | @@ -24,6 +24,8 @@ | |
| 24 24 | 
             
            #define RG_TARGET_NAMESPACE cSocket
         | 
| 25 25 | 
             
            #define _SELF(value) RVAL2GSOCKET(value)
         | 
| 26 26 |  | 
| 27 | 
            +
            static ID id_call;
         | 
| 28 | 
            +
             | 
| 27 29 | 
             
            static VALUE
         | 
| 28 30 | 
             
            rg_initialize(int argc, VALUE *argv, VALUE self)
         | 
| 29 31 | 
             
            {
         | 
| @@ -261,16 +263,32 @@ rg_connected_p(VALUE self) | |
| 261 263 | 
             
                    return (g_socket_is_connected(_SELF(self)));
         | 
| 262 264 | 
             
            }
         | 
| 263 265 |  | 
| 266 | 
            +
            static gboolean
         | 
| 267 | 
            +
            source_func(GSocket *socket, GIOCondition condition, gpointer user_data)
         | 
| 268 | 
            +
            {
         | 
| 269 | 
            +
                    VALUE callback = GPOINTER_TO_UINT(user_data);
         | 
| 270 | 
            +
                    return RVAL2CBOOL(rb_funcall(callback, id_call, 2,
         | 
| 271 | 
            +
                                                 GOBJ2RVAL(socket),
         | 
| 272 | 
            +
                                                 GIOCONDITION2RVAL(condition)));
         | 
| 273 | 
            +
            }
         | 
| 274 | 
            +
             | 
| 264 275 | 
             
            static VALUE
         | 
| 265 276 | 
             
            rg_create_source(int argc, VALUE *argv, VALUE self)
         | 
| 266 277 | 
             
            {
         | 
| 267 | 
            -
                    VALUE condition, cancellable;
         | 
| 268 | 
            -
             | 
| 269 | 
            -
             | 
| 270 | 
            -
             | 
| 271 | 
            -
             | 
| 272 | 
            -
             | 
| 273 | 
            -
             | 
| 278 | 
            +
                    VALUE condition, cancellable, callback;
         | 
| 279 | 
            +
                    GSource *source;
         | 
| 280 | 
            +
             | 
| 281 | 
            +
                    rb_scan_args(argc, argv, "11&", &condition, &cancellable, &callback);
         | 
| 282 | 
            +
             | 
| 283 | 
            +
                    source = g_socket_create_source(_SELF(self),
         | 
| 284 | 
            +
                                                    RVAL2GIOCONDITION(condition),
         | 
| 285 | 
            +
                                                    RVAL2GCANCELLABLE(cancellable));
         | 
| 286 | 
            +
                    G_RELATIVE(self, callback);
         | 
| 287 | 
            +
                    g_source_set_callback(source,
         | 
| 288 | 
            +
                                          (GSourceFunc)source_func,
         | 
| 289 | 
            +
                                          GUINT_TO_POINTER(callback),
         | 
| 290 | 
            +
                                          NULL);
         | 
| 291 | 
            +
                    return GSOURCE2RVAL(source);
         | 
| 274 292 | 
             
            }
         | 
| 275 293 |  | 
| 276 294 | 
             
            static VALUE
         | 
| @@ -333,6 +351,8 @@ Init_gsocket(VALUE mGio) | |
| 333 351 | 
             
            {
         | 
| 334 352 | 
             
                    VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_SOCKET, "Socket", mGio);
         | 
| 335 353 |  | 
| 354 | 
            +
                    id_call = rb_intern("call");
         | 
| 355 | 
            +
             | 
| 336 356 | 
             
                    G_DEF_CLASS(G_TYPE_SOCKET_FAMILY, "Family", RG_TARGET_NAMESPACE);
         | 
| 337 357 | 
             
                    G_DEF_CONSTANTS(RG_TARGET_NAMESPACE, G_TYPE_SOCKET_FAMILY, "G_SOCKET_");
         | 
| 338 358 |  | 
| @@ -357,7 +377,7 @@ Init_gsocket(VALUE mGio) | |
| 357 377 | 
             
                    RG_DEF_METHOD(receive_from, -1);
         | 
| 358 378 | 
             
                    RG_DEF_METHOD(send, -1);
         | 
| 359 379 | 
             
                    RG_DEF_METHOD(send_to, -1);
         | 
| 360 | 
            -
                    RG_DEF_METHOD(close,  | 
| 380 | 
            +
                    RG_DEF_METHOD(close, 0);
         | 
| 361 381 | 
             
                    RG_DEF_METHOD_P(closed, 0);
         | 
| 362 382 | 
             
                    RG_DEF_METHOD(shutdown, 2);
         | 
| 363 383 | 
             
                    RG_DEF_METHOD_P(connected, 0);
         | 
| @@ -109,7 +109,7 @@ rg_connect_to_host(int argc, VALUE *argv, VALUE self) | |
| 109 109 | 
             
                    if (connection == NULL)
         | 
| 110 110 | 
             
                            rbgio_raise_error(error);
         | 
| 111 111 |  | 
| 112 | 
            -
                    return  | 
| 112 | 
            +
                    return GOBJ2RVAL_UNREF(connection);
         | 
| 113 113 | 
             
            }
         | 
| 114 114 |  | 
| 115 115 | 
             
            static VALUE
         | 
| @@ -157,7 +157,7 @@ rg_connect_to_service(int argc, VALUE *argv, VALUE self) | |
| 157 157 | 
             
                    if (connection == NULL)
         | 
| 158 158 | 
             
                            rbgio_raise_error(error);
         | 
| 159 159 |  | 
| 160 | 
            -
                    return  | 
| 160 | 
            +
                    return GOBJ2RVAL_UNREF(connection);
         | 
| 161 161 | 
             
            }
         | 
| 162 162 |  | 
| 163 163 | 
             
            static VALUE
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: gio2
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 27
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 1
         | 
| 8 8 | 
             
              - 1
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 1.1. | 
| 9 | 
            +
              - 4
         | 
| 10 | 
            +
              version: 1.1.4
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - The Ruby-GNOME2 Project Team
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2012- | 
| 18 | 
            +
            date: 2012-07-21 00:00:00 Z
         | 
| 19 19 | 
             
            dependencies: 
         | 
| 20 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 21 21 | 
             
              name: glib2
         | 
| @@ -25,12 +25,12 @@ dependencies: | |
| 25 25 | 
             
                requirements: 
         | 
| 26 26 | 
             
                - - ">="
         | 
| 27 27 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 28 | 
            -
                    hash:  | 
| 28 | 
            +
                    hash: 27
         | 
| 29 29 | 
             
                    segments: 
         | 
| 30 30 | 
             
                    - 1
         | 
| 31 31 | 
             
                    - 1
         | 
| 32 | 
            -
                    -  | 
| 33 | 
            -
                    version: 1.1. | 
| 32 | 
            +
                    - 4
         | 
| 33 | 
            +
                    version: 1.1.4
         | 
| 34 34 | 
             
              type: :runtime
         | 
| 35 35 | 
             
              version_requirements: *id001
         | 
| 36 36 | 
             
            description: Ruby/GIO2 is a Ruby binding of gio-2.x.
         | 
| @@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 181 181 | 
             
            requirements: []
         | 
| 182 182 |  | 
| 183 183 | 
             
            rubyforge_project: 
         | 
| 184 | 
            -
            rubygems_version: 1.8. | 
| 184 | 
            +
            rubygems_version: 1.8.24
         | 
| 185 185 | 
             
            signing_key: 
         | 
| 186 186 | 
             
            specification_version: 3
         | 
| 187 187 | 
             
            summary: Ruby/GIO2 is a Ruby binding of gio-2.x.
         |