Don't try to convert NULL into a String.
[ruby-ecore.git] / src / ecore_x / rb_window.c
index 417ba0581eac877e6914b3deb2a4c894198fe603..f5af7c78d9a168fc17db7e565b846624866db2ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_window.c 93 2004-08-23 08:57:10Z tilman $
+ * $Id: rb_window.c 97 2004-08-23 18:30:28Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -144,10 +144,16 @@ static VALUE c_delete (VALUE self)
 {
        GET_OBJ (self, RbWindow, win);
 
-       if (win->real) {
-               ecore_x_window_del (win->real);
-               win->real = 0;
-       }
+       ecore_x_window_del (win->real);
+
+       return Qnil;
+}
+
+static VALUE c_send_delete_request (VALUE self)
+{
+       GET_OBJ (self, RbWindow, win);
+
+       ecore_x_window_delete_request_send (win->real);
 
        return Qnil;
 }
@@ -266,9 +272,13 @@ static VALUE c_parent_get (VALUE self)
 
 static VALUE c_title_get (VALUE self)
 {
+       char *s;
+
        GET_OBJ (self, RbWindow, win);
 
-       return rb_str_new2 (ecore_x_window_prop_title_get (win->real));
+       s = ecore_x_window_prop_title_get (win->real);
+
+       return s ? rb_str_new2 (s) : Qnil;
 }
 
 static VALUE c_title_set (VALUE self, VALUE val)
@@ -407,6 +417,8 @@ void Init_Window (void)
        rb_define_method (cWindow, "hide", c_hide, 0);
        rb_define_method (cWindow, "visible?", c_visible_get, 0);
        rb_define_method (cWindow, "delete", c_delete, 0);
+       rb_define_method (cWindow, "send_delete_request",
+                         c_send_delete_request, 0);
        rb_define_method (cWindow, "raise", c_raise, 0);
        rb_define_method (cWindow, "lower", c_lower, 0);
        rb_define_method (cWindow, "reparent", c_reparent, 3);