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 console = imports.console;
11 XObject = imports.XObject.XObject;
12 DialogConfirm=new XObject({
13     xtype: Gtk.MessageDialog,
14     show : function(msg, success) {
15          if (!this.el) {
16                 this.init();
17             }
18          this.success = success;
19             this.el.text =  msg;
20             this.el.show_all();
21     
22     },
23     buttons : Gtk.ButtonsType.YES_NO,
24     title : "Please Confirm",
25     message_type : Gtk.MessageType.QUESTION,
26     use_markup : true,
27     text : "-",
28     listeners : {
29         "response":function (self, response_id) {
30            this.el.hide();
31         print("RESPOSE: " + response_id);
32             if (response_id == -8) { //yes!
33            print("CALL SUCCES?")
34               this.success();
35             }
36         },
37         "delete_event":function (self, event) {
38             this.el.hide();
39             return true;
40         }
41     }
42 });
43 DialogConfirm.init();
44 XObject.cache['/DialogConfirm'] = DialogConfirm;