3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
10 console = imports.console;
11 XObject = imports.XObject.XObject;
12 DialogTemplateSelect=new XObject({
15 delete_event : function (self, event) {
23 show : function(node) {
25 var pal = this.get('/Window.LeftTree').getPaleteProvider();
26 var opts = pal.listTemplates(node);
35 dopts.push({ path: '' , name :'Just add Element' });
40 var project = this.get('/Window.LeftTree').getActiveFile().project;
41 var m = project.dbcon ? project.dbcon + '_' : false;
46 opts.forEach(function(p) {
47 // if we have a dbname - ignore _ named.
48 if (m && p.name.match(/_/) &&
49 p.name.substring(0, m.length) != m) {
57 this.get('combo.model').loadData(dopts);
58 this.get('combo').el.set_active(0);
63 var ix = this.get('combo').el.get_active();
68 return pal.loadTemplate(dopts[ix].path)
74 pack : function(p,e) {
75 p.el.get_content_area().add(e.el)
80 pack : "pack_start,false,false,0",
84 label : "Select Template : ",
85 pack : "pack_start,false,false"
92 XObject.prototype.init.call(this);
93 this.el.add_attribute(this.items[0].el , 'markup', 1 );
97 xtype: Gtk.CellRendererText,
101 xtype: Gtk.ListStore,
105 XObject.prototype.init.call(this);
106 this.el.set_column_types ( 2, [
107 GObject.TYPE_STRING, // real key
108 GObject.TYPE_STRING // real type
113 loadData : function (data) {
116 var project = this.get('/Window.LeftTree').getActiveFile().project;
117 var m = project.dbcon ? project.dbcon + '_' : false;
120 //print (project.fn);
122 data.forEach(function(p) {
123 // if we have a dbname - ignore _ named.
124 if (m && p.name.match(/_/) &&
125 p.name.substring(0, m.length) != m) {
134 el.set_value(iret.iter, 0, ''+ p.path);
135 el.set_value(iret.iter, 1, ''+ p.name);
151 pack : "add_action_widget,0"
155 DialogTemplateSelect.init();
156 XObject.cache['/DialogTemplateSelect'] = DialogTemplateSelect;