fix #7440 - GTK4 version is now master
[roobuilder] / src / Builder4 / DialogSaveTemplate.bjs
1 {
2  "build_module" : "builder",
3  "items" : [
4   {
5    "# JsRender.Node data" : "",
6    "# Palete.Palete palete" : "",
7    "$ xns" : "Gtk",
8    "bool modal" : true,
9    "default_height" : 200,
10    "default_width" : 400,
11    "items" : [
12     {
13      "$ xns" : "Gtk",
14      "* pack" : " get_content_area().append",
15      "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
16      "items" : [
17       {
18        "$ xns" : "Gtk",
19        "* pack" : "append",
20        "label" : "Name",
21        "xtype" : "Label"
22       },
23       {
24        "$ xns" : "Gtk",
25        "* pack" : "append",
26        "id" : "name",
27        "xtype" : "Entry"
28       }
29      ],
30      "xtype" : "Box"
31     },
32     {
33      "$ xns" : "Gtk",
34      "* pack" : "add_action_widget,0",
35      "label" : "Cancel",
36      "xtype" : "Button"
37     },
38     {
39      "$ xns" : "Gtk",
40      "* pack" : "add_action_widget,1",
41      "label" : "OK",
42      "xtype" : "Button"
43     }
44    ],
45    "listeners" : {
46     "close_request" : [
47      "( ) => {",
48      "",
49      "\t this.el.response(Gtk.ResponseType.CANCEL);",
50      "    return true;",
51      " ",
52      "}",
53      ""
54     ],
55     "response" : [
56      "(response_id) => {",
57      "\t ",
58      "     if (response_id < 1) {",
59      "\t    this.el.hide();",
60      "\t     return;",
61      "\t}",
62      "\t",
63      "\tvar name = _this.name.el.get_text();",
64      "\tif (name.length < 1) {",
65      "\t    Xcls_StandardErrorDialog.singleton().show(",
66      "\t         _this.el,",
67      "\t        \"You must give the template a name. \"",
68      "\t    );",
69      "\t    return;",
70      "\t}",
71      "\tif (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9. ]+$\", name) )",
72      "\t{",
73      "\t    Xcls_StandardErrorDialog.singleton().show(",
74      "\t         _this.el,",
75      "\t        \"Template Name must contain only letters dots\"",
76      "\t    );",
77      "\t    return;",
78      "\t}",
79      "\t",
80      "    this.palete.saveTemplate(name, data);",
81      "    ",
82      "    // now we save it..",
83      "    this.el.hide();",
84      "        ",
85      "",
86      "}",
87      ""
88     ]
89    },
90    "xtype" : "Dialog",
91    "| void showIt" : [
92     " (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {",
93     " ",
94     "    \tthis.palete = palete;",
95     "        this.el.set_transient_for(parent);",
96     "        this.el.modal = true;",
97     "        ",
98     "          this.name.el.set_text(\"\");",
99     "        this.el.show();",
100     "         ",
101     "         ",
102     "  ",
103     "   ",
104     "}",
105     ""
106    ]
107   }
108  ],
109  "modOrder" : "",
110  "name" : "DialogSaveTemplate",
111  "parent" : "",
112  "path" : "/home/alan/gitlive/roobuilder/src/Builder4/DialogSaveTemplate.bjs",
113  "permname" : "",
114  "title" : ""
115 }