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         "destroy_event":function (self, event) {
30             this.el.hide();
31             return true;
32         },
33         "response":function (self, response_id) {
34             if (response_id > 0) {
35               this.success();
36             }
37         }
38     }
39 });
40 DialogConfirm.init();
41 XObject.cache['/DialogConfirm'] = DialogConfirm;