tools
[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     modal : true,
29     listeners : {
30         response : function (self, response_id) {
31            this.el.hide();
32         print("RESPOSE: " + response_id);
33             if (response_id == -8) { //yes!
34            print("CALL SUCCES?")
35               this.success();
36             }
37         },
38         delete_event : function (self, event) {
39             this.el.hide();
40             return true;
41         }
42     }
43 });
44 DialogConfirm.init();
45 XObject.cache['/DialogConfirm'] = DialogConfirm;