~mefrio-g/+junk/dynamic-tabs-fixes

« back to all changes in this revision

Viewing changes to dynamic-tabs.vala

  • Committer: Mario Guerriero
  • Date: 2012-02-07 16:00:19 UTC
  • Revision ID: mefrio.g@gmail.com-20120207160019-1seriz0kwy1mmsj6
now the added signal is called page_added, as in Gtk API, and is similar to it. I just added an extra argument to the signal to get easily also the tab and not only the page

Show diffs side-by-side

added added

removed removed

Lines of Context:
471
471
         * A new tab was added by the plus sign. You should call tab.set_active when you're finished setting
472
472
         * @param Tab a reference to the tab that was added
473
473
         **/
474
 
        public signal void added  (tab tab);
 
474
        public signal void page_added  (Gtk.Widget page, tab tab, uint page_num);
475
475
        /**
476
476
         * A tab was duplicated
477
477
         * @param tab the copy of the tab
490
490
         **/
491
491
        public signal void new_window (tab tab);
492
492
        /**
493
 
         *mSignal for the tab switching
 
493
         * Signal for the tab switching
494
494
         */
495
495
        public signal void switch_page (tab tab, Gtk.Widget page, uint page_num);
496
496
        
596
596
            menu.show_all ();
597
597
            new_t.activate.connect ( () => {
598
598
                var t = this.append_page ("", null);
599
 
                this.added (t);
 
599
                var page_num = (int)(_active.x / _active.width) % (int)_active.tabs.tabs.length ();
 
600
                this.page_added (_active.page, _active, page_num);
600
601
            });
601
602
            recover.activate.connect ( () => {
602
603
                this.stage.add_actor (last_deleted);
623
624
                    case 1:
624
625
                        if (e.type == Gdk.EventType.2BUTTON_PRESS){
625
626
                            var t = this.append_page ("", null);
626
 
                            this.added (t);
 
627
                            var page_num = (int)(_active.x / _active.width) % (int)_active.tabs.tabs.length ();
 
628
                            this.page_added (_active.page, _active, page_num);
627
629
                        }else if (this.allow_window_move){
628
630
                            ((Gtk.Window)this.get_toplevel ()).begin_move_drag (
629
631
                                (int)e.button, (int)e.x_root, (int)e.y_root, e.time);
647
649
            });
648
650
            eplus.button_press_event.connect ( (e) => {
649
651
                var t = this.append_page ("", null);
650
 
                this.added (t);
 
652
                var page_num = (int)(_active.x / _active.width) % (int)_active.tabs.tabs.length ();
 
653
                this.page_added (_active.page, _active, page_num);
651
654
                return true;
652
655
            });
653
656
            ((Gtk.Bin)this.plus.get_widget ()).add (eplus);
699
702
                            this.active.close ();
700
703
                            return true;
701
704
                        case 116: //ctrl+t
702
 
                            this.added (this.append_page ("", null));
 
705
                            this.append_page ("", null);
 
706
                            var page_num = (int)(_active.x / _active.width) % (int)_active.tabs.tabs.length ();
 
707
                            this.page_added (_active.page, _active, page_num);
703
708
                            return true;
704
709
                        case 49: //ctrl+[1-8]
705
710
                        case 50:
840
845
    
841
846
    d.downwards = false;
842
847
    
843
 
    d.added.connect ( (t) => {
 
848
    d.page_added.connect ( (p, t, n) => {
844
849
        t.page = new Gtk.Button.from_stock (Gtk.Stock.ADD);
845
850
        t.icon = new Gtk.Image.from_icon_name ("facebook", Gtk.IconSize.MENU);
846
851
        t.page.margin = 20;