diff options
-rw-r--r-- | .build.yml | 195 | ||||
-rw-r--r-- | .github/dependabot.yml | 8 | ||||
-rwxr-xr-x | .github/workflows/archlinux.sh | 49 | ||||
-rwxr-xr-x | .github/workflows/builds.sh | 65 | ||||
-rw-r--r-- | .github/workflows/builds.yml | 94 | ||||
-rwxr-xr-x | .github/workflows/debian.sh | 47 | ||||
-rwxr-xr-x | .github/workflows/fedora.sh | 40 | ||||
-rwxr-xr-x | .github/workflows/mate-desktop.sh | 146 | ||||
-rw-r--r-- | .github/workflows/release.yml | 39 | ||||
-rwxr-xr-x | .github/workflows/ubuntu.sh | 49 | ||||
-rw-r--r-- | .travis.yml | 86 | ||||
-rw-r--r-- | pluma/pluma-app.c | 15 | ||||
-rw-r--r-- | pluma/pluma-encodings-combo-box.c | 36 | ||||
-rw-r--r-- | pluma/pluma-window.c | 36 | ||||
-rw-r--r-- | pluma/pluma-window.h | 3 |
15 files changed, 573 insertions, 335 deletions
diff --git a/.build.yml b/.build.yml deleted file mode 100644 index 68da3d73..00000000 --- a/.build.yml +++ /dev/null @@ -1,195 +0,0 @@ -########################################################## -# THE FOLLOWING LINES IS USED BY docker-build -########################################################## -requires: - archlinux: - # Useful URL: https://git.archlinux.org/svntogit/community.git/tree/pluma - - appstream-glib - - autoconf-archive - - clang - - enchant - - file - - gcc - - git - - gobject-introspection - - gtksourceview4 - - iso-codes - - itstool - - libpeas - - libsm - - make - - mate-common - - python3 - - which - - yelp-tools - # mate-desktop dependencies - - dconf - - iso-codes - - debian: - # Useful URL: https://github.com/mate-desktop/debian-packages - # Useful URL: https://salsa.debian.org/debian-mate-team/pluma - - autopoint - - autoconf-archive - - clang - - clang-tools - - cppcheck - - gcc - - git - - gobject-introspection - - gtk-doc-tools - - iso-codes - - libenchant-2-dev - - libgirepository1.0-dev - - libglib2.0-dev - - libgtk-3-dev - - libgtksourceview-4-dev - - libpeas-dev - - libsm-dev - - libx11-dev - - libxml2-dev - - make - - mate-common - - python3-dev - - python3-lxml - - yelp-tools - # mate-desktop dependencies - - iso-codes - - libdconf-dev - - fedora: - # Useful URL: https://src.fedoraproject.org/cgit/rpms/pluma.git - - autoconf-archive - - clang - - clang-analyzer - - cppcheck-htmlreport - - desktop-file-utils - - enchant2-devel - - gcc - - git - - gtk3-devel - - gtksourceview4-devel - - iso-codes-devel - - libappstream-glib-devel - - libSM-devel - - libpeas1-devel - - make - - mate-common - - python3-devel - - python3-lxml - - redhat-rpm-config - # mate-desktop dependencies - - dconf-devel - - gobject-introspection-devel - - iso-codes-devel - - ubuntu: - - autopoint - - autoconf-archive - - clang - - clang-tools - - git - - gobject-introspection - - gtk-doc-tools - - iso-codes - - libenchant-2-dev - - libgirepository1.0-dev - - libglib2.0-dev - - libgtk-3-dev - - libgtksourceview-4-dev - - libpeas-dev - - libsm-dev - - libx11-dev - - libxml2-dev - - make - - mate-common - - python3-dev - - python3-lxml - - yelp-tools - # mate-desktop dependencies - - iso-codes - - libdconf-dev - -variables: - - 'CHECKERS=" - -enable-checker deadcode.DeadStores - -enable-checker alpha.deadcode.UnreachableCode - -enable-checker alpha.core.CastSize - -enable-checker alpha.core.CastToStruct - -enable-checker alpha.core.IdenticalExpr - -enable-checker alpha.core.SizeofPtr - -enable-checker alpha.security.ArrayBoundV2 - -enable-checker alpha.security.MallocOverflow - -enable-checker alpha.security.ReturnPtrRange - -enable-checker alpha.unix.SimpleStream - -enable-checker alpha.unix.cstring.BufferOverlap - -enable-checker alpha.unix.cstring.NotNullTerminated - -enable-checker alpha.unix.cstring.OutOfBounds - -enable-checker alpha.core.FixedAddr - -enable-checker security.insecureAPI.strcpy"' - - MATE_DESKTOP_VERSION=1.27.1 - -before_scripts: - - cd ${START_DIR} - - if [ ! -f mate-desktop-${MATE_DESKTOP_VERSION}.tar.xz ];then - - curl -Ls -o mate-desktop-${MATE_DESKTOP_VERSION}.tar.xz https://github.com/mate-desktop/mate-desktop/releases/download/v${MATE_DESKTOP_VERSION}/mate-desktop-${MATE_DESKTOP_VERSION}.tar.xz - - fi - - tar xf mate-desktop-${MATE_DESKTOP_VERSION}.tar.xz - - cd mate-desktop-${MATE_DESKTOP_VERSION} - - if [ ${DISTRO_NAME} == "debian" -o ${DISTRO_NAME} == "ubuntu" ];then - - ./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu - - else - - ./autogen.sh --prefix=/usr - - fi - - if [ ${TRAVIS} == "false" ]; then - - make clean - - fi - - make - - make install - - - cd ${START_DIR} - - curl -Ls -o /usr/bin/gla11y https://github.com/hypra/gla11y/raw/v0.3/gla11y - - chmod +x /usr/bin/gla11y - -build_scripts: - - if [ ${DISTRO_NAME} == "debian" ];then - - export CFLAGS+=" -Wsign-compare" - - cppcheck --enable=warning,style,performance,portability,information,missingInclude . - - fi - - - NOCONFIGURE=1 ./autogen.sh - - scan-build $CHECKERS ./configure --enable-compile-warnings=maximum - - if [ $CPU_COUNT -gt 1 ]; then - - if [ ${DISTRO_NAME} == "debian" ];then - - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make -j $CPU_COUNT - - make clean - - fi - - scan-build $CHECKERS --keep-cc -o html-report make -j $CPU_COUNT - - else - - if [ ${DISTRO_NAME} == "debian" ];then - - scan-build $CHECKERS --keep-cc --use-cc=clang --use-c++=clang++ -o html-report make - - make clean - - fi - - scan-build $CHECKERS --keep-cc -o html-report make - - fi - -after_scripts: - - if [ ${DISTRO_NAME} == "fedora" ];then - - cppcheck --xml --output-file=cppcheck.xml --enable=warning,style,performance,portability,information,missingInclude . - - cppcheck-htmlreport --title=${REPO_NAME} --file=cppcheck.xml --report-dir=cppcheck-htmlreport - - ./gen-index -l 20 -i https://github.com/${OWNER_NAME}/mate-icon-theme/raw/master/mate/16x16/apps/accessories-text-editor.png - - fi - - make distcheck - -releases: - draft: false - prerelease: false - checksum: true - file_glob: true - files: pluma-*.tar.xz - github_release: - tags: true - overwrite: true - base_version: 1.20.0 - notify_servers: - - https://release.mate-desktop.org/release diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..80851cd3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +# Enable dependabot to keep our GHA pins automatically +# updated, so we don't fall too far behind in the future +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/archlinux.sh b/.github/workflows/archlinux.sh new file mode 100755 index 00000000..7d12dd36 --- /dev/null +++ b/.github/workflows/archlinux.sh @@ -0,0 +1,49 @@ +#!/usr/bin/bash + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Archlinux +requires=( + ccache # Use ccache to speed up build + clang # Build with clang on Archlinux + meson # Used for meson build +) + +# https://gitlab.archlinux.org/archlinux/packaging/packages/pluma +requires+=( + appstream-glib + autoconf-archive + clang + dconf + enchant + file + gcc + git + glib2-devel + gobject-introspection + gtksourceview4 + iso-codes + itstool + libpeas + libsm + libx11 + make + mate-common + python + which + yelp-tools +) + +infobegin "Update system" +pacman --noconfirm -Syu +infoend + +infobegin "Install dependency packages" +pacman --noconfirm -S ${requires[@]} +infoend diff --git a/.github/workflows/builds.sh b/.github/workflows/builds.sh new file mode 100755 index 00000000..8338709a --- /dev/null +++ b/.github/workflows/builds.sh @@ -0,0 +1,65 @@ +#!/usr/bin/bash + +set -e +set -o pipefail + +CPUS=$(grep processor /proc/cpuinfo | wc -l) + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Run meson first, then run autotools +# Because meson dist requires a clean git workspace +# Autotools will modify some files (such as po, etc.), making them dirty. +if [ -f meson.build ]; then + + infobegin "Configure (meson)" + meson setup _build --prefix=/usr + infoend + + infobegin "Build (meson)" + meson compile -C _build + infoend + + infobegin "Test (meson)" + ninja -C _build test + infoend + + infobegin "Dist (meson)" + # Git safedirectory stop ninja dist + # https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9 + # https://git-scm.com/docs/git-config/2.35.2#Documentation/git-config.txt-safedirectory + git config --global --add safe.directory ${PWD} + ninja -C _build dist + infoend +fi + +if [ -f autogen.sh ]; then + infobegin "Configure (autotools)" + NOCONFIGURE=1 ./autogen.sh + ./configure --prefix=/usr --enable-compile-warnings=maximum || { + cat config.log + exit 1 + } + infoend + + infobegin "Build (autotools)" + make -j ${CPUS} + infoend + + infobegin "Check (autotools)" + make -j ${CPUS} check || { + # Settings schema 'org.mate.pluma' is not installed + true + } + infoend + + infobegin "Distcheck (autotools)" + make -j ${CPUS} distcheck + infoend +fi diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml new file mode 100644 index 00000000..4387c97c --- /dev/null +++ b/.github/workflows/builds.yml @@ -0,0 +1,94 @@ +name: CI Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: + +# cancel already running builds of the same branch or pull request +concurrency: + group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.head_ref || github.sha }} + cancel-in-progress: true + +env: + MATE_DESKTOP_VERSION: 1.28.2 + CACHE_PATH: /tmp/.cache + +jobs: + build: + name: Build on ${{matrix.container}} (using ${{matrix.cc}}) + runs-on: ubuntu-latest + container: + image: ${{matrix.container}} + volumes: + - /tmp/.cache + - /var/cache/apt + + strategy: + fail-fast: false # don't cancel other jobs in the matrix if one fails + matrix: + container: + [ + "debian:testing", + "fedora:latest", + "ubuntu:rolling", + "archlinux:latest", + ] + cc: ["gcc"] + cxx: ["g++"] + include: + - container: "archlinux:latest" + cc: "clang" + cxx: "clang++" + + env: + # Speed up build with ccache + CC: ccache ${{ matrix.cc }} + CXX: ccache ${{ matrix.cxx }} + CONTAINER: ${{ matrix.container }} + + steps: + - name: Setup environment variables + id: distro-name + shell: bash + run: | + split=(${CONTAINER//:/ }) + distro=${split[0]} + short_sha=${SHA:0:8} + echo "DISTRO=$distro" | tee -a $GITHUB_ENV + - name: Install git command + shell: bash + run: | + echo "::group::Install git ..." + apt-get update -qq && apt-get install --assume-yes git || true + dnf update -y && dnf install -y git || true + pacman --noconfirm -Sy git || true + echo "::endgroup::" + - name: Repository checkout + uses: actions/checkout@v4 + with: + submodules: "true" + - name: Install dependency packages + run: .github/workflows/${{ env.DISTRO }}.sh + - name: Enable ccache to speed up builds + uses: hendrikmuhs/[email protected] + with: + key: ${{ env.DISTRO }}-${{ matrix.cc }} + + # INFO: M-C-C depends mate-desktop 1.27.1+, so we should install it from source. + - name: Cache mate-desktop binary packages + uses: actions/cache@v3 + id: cache-mate-desktop + with: + path: ${{ env.CACHE_PATH }} + key: ${{ env.DISTRO }}-build-mate-desktop-${{env.MATE_DESKTOP_VERSION}} + - name: Built and install mate-desktop from source + run: .github/workflows/mate-desktop.sh ${{env.MATE_DESKTOP_VERSION}} ${{ env.CACHE_PATH }} + # INFO: M-C-C depends mate-desktop 1.27.1+, install finished. + + - name: Build the source code + run: .github/workflows/builds.sh diff --git a/.github/workflows/debian.sh b/.github/workflows/debian.sh new file mode 100755 index 00000000..100e8eda --- /dev/null +++ b/.github/workflows/debian.sh @@ -0,0 +1,47 @@ +#!/usr/bin/bash + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Debian +requires=( + ccache # Use ccache to speed up build + meson # Used for meson build +) + +# https://salsa.debian.org/debian-mate-team/pluma +requires+=( + autopoint + autoconf-archive + gobject-introspection + gtk-doc-tools + gettext + gla11y + iso-codes + libenchant-2-dev + libgirepository1.0-dev + libglib2.0-dev + libgtk-3-dev + libgtksourceview-4-dev + libpeas-dev + libsm-dev + libx11-dev + libxml2-dev + mate-common + yelp-tools +) + +infobegin "Update system" +apt-get update -qq +infoend + +infobegin "Install dependency packages" +env DEBIAN_FRONTEND=noninteractive \ + apt-get install --assume-yes \ + ${requires[@]} +infoend diff --git a/.github/workflows/fedora.sh b/.github/workflows/fedora.sh new file mode 100755 index 00000000..a433fc07 --- /dev/null +++ b/.github/workflows/fedora.sh @@ -0,0 +1,40 @@ +#!/usr/bin/bash + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Fedora +requires=( + ccache # Use ccache to speed up build + meson # Used for meson build +) + +# https://src.fedoraproject.org/cgit/rpms/pluma.git +requires+=( + desktop-file-utils + enchant-devel + gtk3-devel + gtksourceview4-devel + iso-codes-devel + libSM-devel + libpeas1-devel + make + mate-common + mate-desktop-devel + python3-devel + python3-gobject-base + python3-setuptools +) + +infobegin "Update system" +dnf update -y +infoend + +infobegin "Install dependency packages" +dnf install -y ${requires[@]} +infoend diff --git a/.github/workflows/mate-desktop.sh b/.github/workflows/mate-desktop.sh new file mode 100755 index 00000000..f4b5fe62 --- /dev/null +++ b/.github/workflows/mate-desktop.sh @@ -0,0 +1,146 @@ +#!/usr/bin/bash + +set -e +set -o pipefail + +NAME="mate-desktop" +TEMP_DIR=$(mktemp -d) +OS=$(cat /etc/os-release | grep ^ID | head -n 1 | awk -F= '{ print $2}') +TAG=$1 +CACHE_DIR=$2 + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages to build mate-desktop +# https://gitlab.archlinux.org/archlinux/packaging/packages/mate-desktop +arch_requires=( + autoconf-archive + gobject-introspection + mate-common + intltool +) + +# https://salsa.debian.org/debian-mate-team/mate-desktop/-/blob/master/debian/control +debian_requires=( + autoconf-archive + gobject-introspection + gtk-doc-tools + intltool + iso-codes + libdconf-dev + libgdk-pixbuf-2.0-dev + libgirepository1.0-dev + libglib2.0-dev + libglib2.0-doc + libgtk-3-dev + libgtk-3-doc + librsvg2-bin + libstartup-notification0-dev + libx11-dev + libxml2-dev + libxrandr-dev + mate-common +) + +# https://src.fedoraproject.org/rpms/mate-desktop/blob/rawhide/f/mate-desktop.spec +fedora_requires=( + dconf-devel + desktop-file-utils + gobject-introspection-devel + make + mate-common + startup-notification-devel + gtk3-devel + iso-codes-devel + gobject-introspection-devel + cairo-gobject-devel +) + +# https://git.launchpad.net/ubuntu/+source/mate-desktop/tree/debian/control +ubuntu_requires=( + autoconf-archive + gobject-introspection + gtk-doc-tools + intltool + iso-codes + libdconf-dev + libgdk-pixbuf-2.0-dev + libgirepository1.0-dev + libglib2.0-dev + libglib2.0-doc + libgtk-3-dev + libgtk-3-doc + librsvg2-bin + libstartup-notification0-dev + libx11-dev + libxml2-dev + libxrandr-dev + mate-common +) + +requires=$(eval echo '${'"${OS}_requires[@]}") + +infobegin "Install Depends for mate-desktop" +case ${OS} in +arch) + pacman --noconfirm -Syu + pacman --noconfirm -S ${requires[@]} + ;; +debian | ubuntu) + apt-get update -qq + env DEBIAN_FRONTEND=noninteractive \ + apt-get install --assume-yes --no-install-recommends ${requires[@]} + ;; +fedora) + dnf update -y + dnf install -y ${requires[@]} + ;; +esac +infoend + +# Use cached packages first +if [ -f $CACHE_DIR/${NAME}-${TAG}.tar.xz ]; then + echo "Found cache package, reuse it" + tar -C / -Jxf $CACHE_DIR/${NAME}-${TAG}.tar.xz +else + git clone --recurse-submodules https://github.com/mate-desktop/${NAME} + + # Foldable output information + infobegin "Configure" + cd ${NAME} + git checkout v${TAG} + if [[ ${OS} == "debian" || ${OS} == "ubuntu" ]]; then + ./autogen.sh --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu || { + cat config.log + exit 1 + } + else + ./autogen.sh --prefix=/usr || { + cat config.log + exit 1 + } + fi + infoend + + infobegin "Build" + make -j ${JOBS} + infoend + + infobegin "Install" + make install + infoend + + # Cache this package version + infobegin "Cache" + [ -d ${CACHE_DIR} ] || mkdir -p ${CACHE_DIR} + make install DESTDIR=${TEMP_DIR} + cd $TEMP_DIR + tar -J -cf $CACHE_DIR/${NAME}-${TAG}.tar.xz * + infoend +fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..615534ed --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release Version +on: + push: + tags: + - "v*.*.*" + +env: + MATE_DESKTOP_VERSION: 1.28.2 + CACHE_PATH: /tmp/.cache + +jobs: + release: + name: Release New Version + runs-on: ubuntu-latest + steps: + - name: Repository checkout + uses: actions/checkout@v4 + with: + submodules: "true" + + - name: Install dependency packages + run: sudo .github/workflows/ubuntu.sh + + - name: Install higher version Mate component packages + run: sudo .github/workflows/mate-desktop.sh ${{env.MATE_DESKTOP_VERSION}} ${{ env.CACHE_PATH }} + + - name: Build the source code + run: .github/workflows/builds.sh autotools + + - name: Install GH CLI + uses: dev-hanz-ops/[email protected] + with: + gh-cli-version: 2.72.0 + + - name: Create github release + run: | + gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes pluma*.tar.xz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ubuntu.sh b/.github/workflows/ubuntu.sh new file mode 100755 index 00000000..cb35281d --- /dev/null +++ b/.github/workflows/ubuntu.sh @@ -0,0 +1,49 @@ +#!/usr/bin/bash + +# Use grouped output messages +infobegin() { + echo "::group::${1}" +} +infoend() { + echo "::endgroup::" +} + +# Required packages on Ubuntu +requires=( + ccache # Use ccache to speed up build + meson # Used for meson build +) + +# https://git.launchpad.net/ubuntu/+source/pluma/tree/debian/control +requires+=( + autopoint + autoconf-archive + git + gobject-introspection + gtk-doc-tools + iso-codes + libenchant-2-dev + libgirepository1.0-dev + libglib2.0-dev + libgtk-3-dev + libgtksourceview-4-dev + libpeas-dev + libsm-dev + libx11-dev + libxml2-dev + make + mate-common + python3-dev + python3-lxml + yelp-tools +) + +infobegin "Update system" +apt-get update -y +infoend + +infobegin "Install dependency packages" +env DEBIAN_FRONTEND=noninteractive \ + apt-get install --assume-yes \ + ${requires[@]} +infoend diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3d3a2376..00000000 --- a/.travis.yml +++ /dev/null @@ -1,86 +0,0 @@ -# vim: set ts=2 sts=2 sw=2 expandtab : -dist: jammy -language: shell -os: linux -services: - - docker -addons: - apt: - packages: - - python3-pip - - python3-setuptools - -branches: - except: - - gh-pages - -before_install: - - curl -Ls -o docker-build https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/docker-build - - curl -Ls -o gen-index https://github.com/mate-desktop/mate-dev-scripts/raw/master/travis/gen-index.sh - - chmod +x docker-build gen-index - -install: - - sudo apt-get install -y python3-pip python3-setuptools - - sudo pip3 install --upgrade pip - - sudo pip3 install PyGithub - - ./docker-build --name ${DISTRO} --config .build.yml --install - -script: - - ./docker-build --name ${DISTRO} --verbose --config .build.yml --build scripts - -notifications: - irc: - if: branch = master AND - repo = mate-desktop/pluma - channels: - - "irc.libera.chat#mate-dev" - template: - - "[%{repository_name}] %{author}: %{commit_subject}" - - "[%{branch}] %{commit} %{message} %{build_url}" - on_success: never - on_failure: always - -before_deploy: - - yes | gem update --system --force - - gem install bundler - - gem install faraday-net_http -v '3.3.0' - - gem install uri - - gem install logger - -deploy: - - provider: pages - edge: - branch: v2.0.5 - token: $GITHUB_TOKEN - keep_history: false - committer_from_gh: true - target_branch: gh-pages - local_dir: html-report - strategy: git - on: - all_branches: true - condition: ${DISTRO} =~ ^fedora.*$ - - provider: script - edge: - branch: v2.0.5 - script: ./docker-build --verbose --config .build.yml --release github - on: - tags: true - condition: "${TRAVIS_TAG} =~ ^v.*$ && ${DISTRO} =~ ^fedora.*$" - -after_success: - - 'if [[ "$TRAVIS_SECURE_ENV_VARS" == "true" && "$TRAVIS_PULL_REQUEST" != "false" && ${DISTRO} =~ ^fedora.*$ ]]; then - REPO_SLUG_ARRAY=(${TRAVIS_REPO_SLUG//\// }); - REPO_NAME=${REPO_SLUG_ARRAY[1]}; - URL="https://${REPO_NAME}.mate-desktop.dev"; - COMMENT="Code analysis completed"; - curl -H "Authorization: token $GITHUB_TOKEN" -X POST - -d "{\"state\": \"success\", \"description\": \"$COMMENT\", \"context\":\"scan-build\", \"target_url\": \"$URL\"}" - https://api.github.com/repos/${TRAVIS_REPO_SLUG}/statuses/${TRAVIS_PULL_REQUEST_SHA}; - fi' - -env: -# - DISTRO="archlinux:latest" - - DISTRO="debian:testing" - - DISTRO="fedora:latest" -# - DISTRO="ubuntu:rolling" diff --git a/pluma/pluma-app.c b/pluma/pluma-app.c index 53de32e1..5060ec97 100644 --- a/pluma/pluma-app.c +++ b/pluma/pluma-app.c @@ -552,23 +552,18 @@ pluma_app_create_window_real (PlumaApp *app, GdkWindowState state; gint w, h; + g_settings_get (app->priv->window_settings, + PLUMA_SETTINGS_WINDOW_SIZE, + "(ii)", &w, &h); + gtk_window_set_default_size (GTK_WINDOW (window), w, h); + state = g_settings_get_int (app->priv->window_settings, PLUMA_SETTINGS_WINDOW_STATE); if ((state & GDK_WINDOW_STATE_MAXIMIZED) != 0) - { - _pluma_window_get_default_size (&w, &h); - gtk_window_set_default_size (GTK_WINDOW (window), w, h); gtk_window_maximize (GTK_WINDOW (window)); - } else - { - g_settings_get (app->priv->window_settings, - PLUMA_SETTINGS_WINDOW_SIZE, - "(ii)", &w, &h); - gtk_window_set_default_size (GTK_WINDOW (window), w, h); gtk_window_unmaximize (GTK_WINDOW (window)); - } if ((state & GDK_WINDOW_STATE_STICKY ) != 0) gtk_window_stick (GTK_WINDOW (window)); diff --git a/pluma/pluma-encodings-combo-box.c b/pluma/pluma-encodings-combo-box.c index ca26aa68..d28f1696 100644 --- a/pluma/pluma-encodings-combo-box.c +++ b/pluma/pluma-encodings-combo-box.c @@ -133,10 +133,33 @@ pluma_encodings_combo_box_dispose (GObject *object) } static void +pluma_encodings_combo_box_constructed (GObject *object) +{ + PlumaEncodingsComboBox *combo = PLUMA_ENCODINGS_COMBO_BOX (object); + GtkCellRenderer *text_renderer; + + G_OBJECT_CLASS (pluma_encodings_combo_box_parent_class)->constructed (object); + + /* Setup up the cells */ + text_renderer = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (combo), + text_renderer, TRUE); + + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), + text_renderer, + "text", + NAME_COLUMN, + NULL); + + update_menu (combo); +} + +static void pluma_encodings_combo_box_class_init (PlumaEncodingsComboBoxClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->constructed = pluma_encodings_combo_box_constructed; object_class->set_property = pluma_encodings_combo_box_set_property; object_class->get_property = pluma_encodings_combo_box_get_property; object_class->dispose = pluma_encodings_combo_box_dispose; @@ -367,8 +390,6 @@ update_menu (PlumaEncodingsComboBox *menu) static void pluma_encodings_combo_box_init (PlumaEncodingsComboBox *menu) { - GtkCellRenderer *text_renderer; - menu->priv = pluma_encodings_combo_box_get_instance_private (menu); menu->priv->enc_settings = g_settings_new (PLUMA_SCHEMA_ID); @@ -378,17 +399,6 @@ pluma_encodings_combo_box_init (PlumaEncodingsComboBox *menu) G_TYPE_POINTER, G_TYPE_BOOLEAN); - /* Setup up the cells */ - text_renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_end (GTK_CELL_LAYOUT (menu), - text_renderer, TRUE); - - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (menu), - text_renderer, - "text", - NAME_COLUMN, - NULL); - gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (menu), separator_func, NULL, NULL); diff --git a/pluma/pluma-window.c b/pluma/pluma-window.c index a8e4be81..f141ccb9 100644 --- a/pluma/pluma-window.c +++ b/pluma/pluma-window.c @@ -68,9 +68,6 @@ #define LANGUAGE_DATA "PlumaWindowLanguageData" #define FULLSCREEN_ANIMATION_SPEED 4 -#define PLUMA_WINDOW_DEFAULT_WIDTH 650 -#define PLUMA_WINDOW_DEFAULT_HEIGHT 500 - /* Local variables */ static gboolean cansave = TRUE; @@ -130,8 +127,9 @@ save_panes_state (PlumaWindow *window) pluma_debug (DEBUG_WINDOW); - g_settings_set (window->priv->editor_settings, PLUMA_SETTINGS_WINDOW_SIZE, - "(ii)", window->priv->width, window->priv->height); + if ((window->priv->window_state & GDK_WINDOW_STATE_MAXIMIZED) == 0) + g_settings_set (window->priv->editor_settings, PLUMA_SETTINGS_WINDOW_SIZE, + "(ii)", window->priv->width, window->priv->height); g_settings_set_int (window->priv->editor_settings, PLUMA_SETTINGS_WINDOW_STATE, window->priv->window_state); @@ -291,8 +289,7 @@ pluma_window_configure_event (GtkWidget *widget, { PlumaWindow *window = PLUMA_WINDOW (widget); - window->priv->width = event->width; - window->priv->height = event->height; + gtk_window_get_size(GTK_WINDOW (widget), &window->priv->width, &window->priv->height); return GTK_WIDGET_CLASS (pluma_window_parent_class)->configure_event (widget, event); } @@ -2077,22 +2074,14 @@ clone_window (PlumaWindow *origin) screen = gtk_window_get_screen (GTK_WINDOW (origin)); window = pluma_app_create_window (app, screen); - if ((origin->priv->window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0) - { - gint w, h; + gtk_window_set_default_size (GTK_WINDOW (window), + origin->priv->width, + origin->priv->height); - _pluma_window_get_default_size (&w, &h); - gtk_window_set_default_size (GTK_WINDOW (window), w, h); + if ((origin->priv->window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0) gtk_window_maximize (GTK_WINDOW (window)); - } else - { - gtk_window_set_default_size (GTK_WINDOW (window), - origin->priv->width, - origin->priv->height); - gtk_window_unmaximize (GTK_WINDOW (window)); - } if ((origin->priv->window_state & GDK_WINDOW_STATE_STICKY ) != 0) gtk_window_stick (GTK_WINDOW (window)); @@ -4804,12 +4793,3 @@ pluma_window_get_message_bus (PlumaWindow *window) return window->priv->message_bus; } -void -_pluma_window_get_default_size (gint *width, gint *height) -{ - g_return_if_fail (width != NULL && height != NULL); - - *width = PLUMA_WINDOW_DEFAULT_WIDTH; - *height = PLUMA_WINDOW_DEFAULT_HEIGHT; -} - diff --git a/pluma/pluma-window.h b/pluma/pluma-window.h index 55479d0a..c7133c5f 100644 --- a/pluma/pluma-window.h +++ b/pluma/pluma-window.h @@ -188,9 +188,6 @@ void _pluma_recent_add (PlumaWindow *window, void _pluma_recent_remove (PlumaWindow *window, const gchar *uri); -void _pluma_window_get_default_size (gint *width, - gint *height); - G_END_DECLS #endif /* __PLUMA_WINDOW_H__ */ |