How Destroy current Window using GladeXML or gtype?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How Destroy current Window using GladeXML or gtype?

macm
Hi

I am beginner  in PHP-GTK2.

So I have my main class:

class Index {
....

/* So I construct my glade file */
...
$glade = new GladeXML($gladeFile);
...
/* And connect my Signals and open the main window */
...
Gtk::main();
....
}

And Works, I can get my signals, open new windows...

I prefer dont add all methods inside the main class "index".

so In:

class Login {
...
activatefromMenu() { // because I created signal from Index
...
$glade = new GladeXML($gladeFile,'MyWindowLogin');
....
}
...

}

...and when this method is call I create Signals of this class like
clickedCancel,clickedOk ...

Works fine, But I cant destroy the window.

So I though, if I create a private static attribute I could transfer the
object from activatefromMenu to the method clickedCancel()

$glade = Login::instance();

And works,

I get my object there. So now How can I destroy this "MyWindowLogin"?

Something tell me that ["gtype"] is the key.

object(GladeXML)#59 (2) {
  ["filename"]=>
  string(69) "..Login.glade"
  ["gtype"]=>
  int(48371312)

I tried a lot of similar

$glade->signal_connect( $glade->gtype, array( 'GObject', 'delete-event'));
$glade->signal_connect( 'MyWindowLogin', array( 'GObject', 'delete-event'));
GtkWidget::destroy('MyWindowLogin');
GtkWindow::destroy('MyWindowLogin');


And if I use
Gtk::main_quit(); I quit all windows but like I said I want quit from
current window ("MyWindowLogin").

I am using PHP-GTK2 / PHP5.2.6 (compile by myself) / Glade3 / Linux Fedora 8
64

Ideas?

Regards

macm