~gnome-shell-extensions/gnome-shell-extensions/dash-to-dock-head

« back to all changes in this revision

Viewing changes to dash.js

  • Committer: Michele
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2018-12-01 22:03:55 UTC
  • Revision ID: git-v1:421efeed7fb0582e7f4188325aa17d63e5f2b1b0
dash, docking: remove Shell.GenericContainer.

This has been removed upstream, and extending components instead of
compositing them with the delegate pattern is suggested.

Note than at least in GS 3.22, Gobjects name cannot contain period
characters,  thus replace them with underscores.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 * - handle horizontal dash
54
54
 */
55
55
const MyDashActor = new Lang.Class({
56
 
    Name: 'DashToDock.MyDashActor',
 
56
    Name: 'DashToDock_MyDashActor',
 
57
    Extends: St.Widget,
57
58
 
58
59
    _init: function(settings) {
59
60
        // a prefix is required to avoid conflicting with the parent class variable
68
69
            orientation: this._isHorizontal ? Clutter.Orientation.HORIZONTAL : Clutter.Orientation.VERTICAL
69
70
        });
70
71
 
71
 
        this.actor = new Shell.GenericContainer({
 
72
        this.parent({
72
73
            name: 'dash',
73
74
            layout_manager: layout,
74
75
            clip_to_allocation: true
75
76
        });
76
 
        this.actor.connect('get-preferred-width', Lang.bind(this, this._getPreferredWidth));
77
 
        this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
78
 
        this.actor.connect('allocate', Lang.bind(this, this._allocate));
79
 
 
80
 
        this.actor._delegate = this;
81
77
    },
82
78
 
83
 
    _allocate: function(actor, box, flags) {
 
79
    vfunc_allocate: function(box, flags) {
 
80
        this.set_allocation(box, flags);
84
81
        let contentBox = box;
85
82
        let availWidth = contentBox.x2 - contentBox.x1;
86
83
        let availHeight = contentBox.y2 - contentBox.y1;
87
84
 
88
 
        let [appIcons, showAppsButton] = actor.get_children();
 
85
        let [appIcons, showAppsButton] = this.get_children();
89
86
        let [showAppsMinHeight, showAppsNatHeight] = showAppsButton.get_preferred_height(availWidth);
90
87
        let [showAppsMinWidth, showAppsNatWidth] = showAppsButton.get_preferred_width(availHeight);
91
88
 
123
120
        }
124
121
    },
125
122
 
126
 
    _getPreferredWidth: function(actor, forHeight, alloc) {
 
123
    vfunc_get_preferred_width: function(forHeight) {
127
124
        // We want to request the natural height of all our children
128
125
        // as our natural height, so we chain up to StWidget (which
129
126
        // then calls BoxLayout), but we only request the showApps
130
127
        // button as the minimum size
131
128
 
132
 
        let [, natWidth] = this.actor.layout_manager.get_preferred_width(this.actor, forHeight);
 
129
        let [, natWidth] = this.layout_manager.get_preferred_width(this, forHeight);
133
130
 
134
 
        let themeNode = this.actor.get_theme_node();
135
 
        let [, showAppsButton] = this.actor.get_children();
 
131
        let themeNode = this.get_theme_node();
 
132
        let [, showAppsButton] = this.get_children();
136
133
        let [minWidth, ] = showAppsButton.get_preferred_height(forHeight);
137
134
 
138
 
        alloc.min_size = minWidth;
139
 
        alloc.natural_size = natWidth;
 
135
        return [minWidth, natWidth];
140
136
 
141
137
    },
142
138
 
143
 
    _getPreferredHeight: function(actor, forWidth, alloc) {
 
139
    vfunc_get_preferred_height: function(forWidth) {
144
140
        // We want to request the natural height of all our children
145
141
        // as our natural height, so we chain up to StWidget (which
146
142
        // then calls BoxLayout), but we only request the showApps
147
143
        // button as the minimum size
148
144
 
149
 
        let [, natHeight] = this.actor.layout_manager.get_preferred_height(this.actor, forWidth);
 
145
        let [, natHeight] = this.layout_manager.get_preferred_height(this, forWidth);
150
146
 
151
 
        let themeNode = this.actor.get_theme_node();
152
 
        let [, showAppsButton] = this.actor.get_children();
 
147
        let themeNode = this.get_theme_node();
 
148
        let [, showAppsButton] = this.get_children();
153
149
        let [minHeight, ] = showAppsButton.get_preferred_height(forWidth);
154
150
 
155
 
        alloc.min_size = minHeight;
156
 
        alloc.natural_size = natHeight;
 
151
        return [minHeight, natHeight];
157
152
    }
158
153
});
159
154
 
203
198
        this._ensureAppIconVisibilityTimeoutId = 0;
204
199
        this._labelShowing = false;
205
200
 
206
 
        this._containerObject = new MyDashActor(settings);
207
 
        this._container = this._containerObject.actor;
 
201
        this._container = new MyDashActor(settings);
208
202
        this._scrollView = new St.ScrollView({
209
203
            name: 'dashtodockDashScrollview',
210
204
            hscrollbar_policy: Gtk.PolicyType.NEVER,