<commit_before>// Copyright 2016 Endless Mobile, Inc.

/* exported List */

const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;

const Arrangement = imports.app.interfaces.arrangement;
const Module = imports.app.interfaces.module;

const List = new Module.Class({
    Name: 'Arrangement.List',
    Extends: Gtk.Grid,
    Implements: [Arrangement.Arrangement],
    Properties: {
        /**
         * Property: max-rows
         * Maximum number of card rows to be displayed
         *
         * A value of zero means no maximum.
         *
         * Default:
         *   0
         */
        'max-rows': GObject.ParamSpec.uint('max-rows', 'Maximum rows',
            'The maximum number of card rows to be displayed.',
            GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
            0, GLib.MAXUINT16, 0),
    },

    _init: function (props={}) {
        this.parent(props);
        this._size_group = new Gtk.SizeGroup({
            mode: Gtk.SizeGroupMode.BOTH,
        });
    },

    // Arrangement override
    unpack_card: function (widget) {
        this.remove(widget);
        this._size_group.remove_widget(widget);
    },

    // Arrangement override
    pack_card: function (widget, position=-1) {
        this._size_group.add_widget(widget);
        if (position === -1) {
            this.add(widget);
            return;
        }
        this.insert_row(position);
        this.attach(widget, 0, position, 1, 1);
    },

    get_max_cards: function () {
        return this.max_rows > 0 ? this.max_rows : -1;
    },
});<commit_msg>Add homogeneous property to Arrangement.List<commit_after>// Copyright 2016 Endless Mobile, Inc.

/* exported List */

const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;

const Arrangement = imports.app.interfaces.arrangement;
const Module = imports.app.interfaces.module;

const List = new Module.Class({
    Name: 'Arrangement.List',
    Extends: Gtk.Grid,
    Implements: [Arrangement.Arrangement],
    Properties: {
        /**
         * Property: max-rows
         * Maximum number of card rows to be displayed
         *
         * A value of zero means no maximum.
         *
         * Default:
         *   0
         */
        'max-rows': GObject.ParamSpec.uint('max-rows', 'Maximum rows',
            'The maximum number of card rows to be displayed.',
            GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
            0, GLib.MAXUINT16, 0),
        /**
         * Property: homogeneous
         * Whether or not the cards should all be placed in a single size group
         *
         * Default:
         *   true
         */
        'homogeneous': GObject.ParamSpec.boolean('homogeneous', 'Homogeneous',
            'Whether or not the cards should all be placed in a single size group',
            GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
            true),
    },

    _init: function (props={}) {
        this.parent(props);
        this._size_group = new Gtk.SizeGroup({
            mode: Gtk.SizeGroupMode.BOTH,
        });
    },

    // Arrangement override
    unpack_card: function (widget) {
        this.remove(widget);
        if (this.homogeneous)
            this._size_group.remove_widget(widget);
    },

    // Arrangement override
    pack_card: function (widget, position=-1) {
        if (this.homogeneous)
            this._size_group.add_widget(widget);
        if (position === -1) {
            this.add(widget);
            return;
        }
        this.insert_row(position);
        this.attach(widget, 0, position, 1, 1);
    },

    get_max_cards: function () {
        return this.max_rows > 0 ? this.max_rows : -1;
    },
});
{'fraction_non_alphanumeric': 0.11571994715984148, 'fraction_numerical': 0.00845442536327609, 'mean_word_length': 2.0288, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5506056', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1118, 'n_words': 270}