Clones.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 30 Oct 2018 05:39:20 +0000 (13:39 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 30 Oct 2018 05:39:20 +0000 (13:39 +0800)
Clones.vala

Clones.bjs
Clones.vala

index f2543cf..e4d28b6 100644 (file)
@@ -8,12 +8,8 @@
  "build_module" : "",
  "items" : [
   {
-   "listeners" : {
-    "delete_event" : "(self, event) => {\n    this.el.hide();\n    return true; \n    //test  \n}\n ",
-    "response" : "(self, response_id) =>  { \n \n        this.el.hide();\n  \n}"
-   },
    "default_width" : 600,
-   "| void show" : "(Gtk.Widget button)    {\n\n    this.el.set_deletable(false);\n    this.el.show_all();\n    \t//console.log('show all');\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n\n\tthis.el.set_position(Gtk.PositionType.RIGHT);\n\n\t// window + header?\n\tthis.el.show_all();\n\tthis.el.set_size_request(800,500);\n\tthis.view.el.grab_focus();\n}\n",
+   "| void show" : "(Gtk.StatusIcon icon)    {\n\n    Gdk.Rectangle area;\n    Gdk.Screen screen;\n    Gtk.Orientation ori;\n    \n    icon.get_geometry(out screen, out area, out ori);\n    \n\tthis.el.set_pointing_to(area);\n    \n    \t//console.log('show all');\n\tthis.el.set_modal(true);\n\n\n\tthis.el.set_position(Gtk.PositionType.TOP);\n//\tthis.el.popup();\n\t// window + header?\n\tthis.el.show_all();\n\tthis.el.set_size_request(800,500);\n\n\t//this.view.el.grab_focus();\n}\n",
    "$ deletable" : true,
    "title" : "Manage Clones",
    "xtype" : "Popover",
@@ -24,7 +20,7 @@
    "items" : [
     {
      "xtype" : "Box",
-     "$ pack" : "get_content_area().add ",
+     "$ pack" : "add",
      "$ xns" : "Gtk",
      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
      "items" : [
          ]
         }
        ]
+      },
+      {
+       "label" : "Close",
+       "id" : "ok_button",
+       "* pack" : "add",
+       "xtype" : "Button",
+       "$ xns" : "Gtk"
       }
      ]
-    },
-    {
-     "label" : "Close",
-     "id" : "ok_button",
-     "* pack" : "add_action_widget,1 ",
-     "xtype" : "Button",
-     "$ xns" : "Gtk"
     }
    ]
   }
index 57c2a3f..45caad8 100644 (file)
@@ -43,39 +43,31 @@ public class Clones : Object
         this.el.modal = true;
         var child_0 = new Xcls_Box2( _this );
         child_0.ref();
-        this.el.get_content_area().add (  child_0.el  );
-        var child_1 = new Xcls_ok_button( _this );
-        child_1.ref();
-        this.el.add_action_widget (  child_1.el , 1  );
-
-        //listeners
-        this.el.delete_event.connect( (self, event) => {
-            this.el.hide();
-            return true; 
-            //test  
-        });
-        this.el.response.connect( (self, response_id) =>  { 
-         
-                this.el.hide();
-          
-        });
+        this.el.add (  child_0.el  );
     }
 
     // user defined functions
-    public void show (Gtk.Widget button)    {
+    public void show (Gtk.StatusIcon icon)    {
     
-        this.el.set_deletable(false);
-        this.el.show_all();
+        Gdk.Rectangle area;
+        Gdk.Screen screen;
+        Gtk.Orientation ori;
+        
+        icon.get_geometry(out screen, out area, out ori);
+        
+       this.el.set_pointing_to(area);
+        
                //console.log('show all');
        this.el.set_modal(true);
-       this.el.set_relative_to(btn);
     
-       this.el.set_position(Gtk.PositionType.RIGHT);
     
+       this.el.set_position(Gtk.PositionType.TOP);
+    // this.el.popup();
        // window + header?
        this.el.show_all();
        this.el.set_size_request(800,500);
-       this.view.el.grab_focus();
+    
+       //this.view.el.grab_focus();
     }
     public class Xcls_Box2 : Object
     {
@@ -100,6 +92,9 @@ public class Clones : Object
             var child_1 = new Xcls_ScrolledWindow9( _this );
             child_1.ref();
             this.el.add (  child_1.el  );
+            var child_2 = new Xcls_ok_button( _this );
+            child_2.ref();
+            this.el.add (  child_2.el  );
         }
 
         // user defined functions
@@ -937,7 +932,6 @@ public class Clones : Object
 
 
 
-
     public class Xcls_ok_button : Object
     {
         public Gtk.Button el;
@@ -962,4 +956,5 @@ public class Clones : Object
         // user defined functions
     }
 
+
 }