Sample/DialogConfirm.js
[app.Builder.js] / Sample / DialogConfirm.js
1 Gtk = imports.gi.Gtk;
2 Gdk = imports.gi.Gdk;
3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
5 Gio = imports.gi.Gio;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
9 Vte = imports.gi.Vte;
10 GtkClutter = imports.gi.GtkClutter;
11 Gdl = imports.gi.Gdl;
12 console = imports.console;
13 XObject = imports.XObject.XObject;
14 DialogConfirm=new XObject({
15     xtype: Gtk.MessageDialog,
16     show : function(msg, success) {
17          if (!this.el) {
18                 this.init();
19             }
20          this.success = success;
21             this.el.text =  msg;
22             this.el.show_all();
23     
24     },
25     buttons : Gtk.ButtonsType.YES_NO,
26     title : "Please Confirm",
27     message_type : Gtk.MessageType.QUESTION,
28     use_markup : true,
29     text : "-",
30     modal : true,
31     listeners : {
32         response : function (self, response_id) {
33            this.el.hide();
34         print("RESPOSE: " + response_id);
35             if (response_id == -8) { //yes!
36            print("CALL SUCCES?")
37               this.success();
38             }
39         },
40         delete_event : function (self, event) {
41             this.el.hide();
42             return true;
43         }
44     }
45 });
46 DialogConfirm.init();
47 XObject.cache['/DialogConfirm'] = DialogConfirm;