Compare commits
1 Commits
resizing-f
...
wip/Jehan/
Author | SHA1 | Date | |
---|---|---|---|
|
b24407e51f |
@@ -16,11 +16,11 @@ stages:
|
||||
|
||||
# Common variables
|
||||
variables:
|
||||
COMMON_MESON_FLAGS: "--fatal-meson-warnings -Dgtk:werror=true"
|
||||
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true -Dvulkan=yes"
|
||||
FEATURE_FLAGS: "-Dcloudproviders=true"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v22"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 2
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v17"
|
||||
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
|
||||
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v19"
|
||||
|
||||
@@ -68,11 +68,9 @@ style-check-diff:
|
||||
fedora-x86_64:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
|
||||
script:
|
||||
- meson subprojects update
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
-Dprofiler=true
|
||||
_build
|
||||
@@ -84,38 +82,14 @@ fedora-x86_64:
|
||||
release-build:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
- meson subprojects update
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
|
||||
installed-tests:
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--prefix=/usr --libdir=/usr/lib64 -Dinstall-tests=true"
|
||||
script:
|
||||
- meson subprojects update
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
_build
|
||||
- ninja -C _build
|
||||
- sudo ninja -C _build install
|
||||
- dbus-run-session xvfb-run -a -s "-screen 0 1024x768x24"
|
||||
gnome-desktop-testing-runner
|
||||
--report-directory=_build/installed-tests-report/failed/
|
||||
--parallel=0
|
||||
gtk-4.0
|
||||
artifacts:
|
||||
paths:
|
||||
- "_build/installed-tests-report/"
|
||||
|
||||
|
||||
.mingw-defaults:
|
||||
stage: build
|
||||
tags:
|
||||
@@ -135,7 +109,6 @@ installed-tests:
|
||||
|
||||
msys2-mingw64:
|
||||
extends: .mingw-defaults
|
||||
needs: []
|
||||
variables:
|
||||
MSYSTEM: "MINGW64"
|
||||
CHERE_INVOKING: "yes"
|
||||
@@ -166,44 +139,37 @@ msys2-mingw64:
|
||||
|
||||
flatpak-manual:demo:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
|
||||
flatpak-master:demo:
|
||||
extends: .flatpak-master
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
|
||||
flatpak-manual:widget-factory:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
|
||||
flatpak-master:widget-factory:
|
||||
extends: .flatpak-master
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
|
||||
flatpak-manual:icon-browser:
|
||||
extends: .flatpak-manual
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak-master:icon-browser:
|
||||
extends: .flatpak-master
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
static-scan:
|
||||
image: $FEDORA_IMAGE
|
||||
stage: analysis
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug"
|
||||
script:
|
||||
@@ -214,27 +180,9 @@ static-scan:
|
||||
- _scan_build/meson-logs
|
||||
allow_failure: true
|
||||
|
||||
# Run tests with the address sanitizer. We need to turn off introspection,
|
||||
# since it is incompatible with asan
|
||||
asan-build:
|
||||
image: $FEDORA_IMAGE
|
||||
tags: [ asan ]
|
||||
stage: analysis
|
||||
needs: []
|
||||
variables:
|
||||
script:
|
||||
- CC=clang meson --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=false _build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build wayland
|
||||
artifacts:
|
||||
paths:
|
||||
- _build/meson-logs
|
||||
allow_failure: true
|
||||
|
||||
reference:
|
||||
image: $DOCS_IMAGE
|
||||
stage: docs
|
||||
needs: []
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
@@ -250,7 +198,6 @@ reference:
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
needs: ['reference']
|
||||
script:
|
||||
- mv _reference/ public/
|
||||
artifacts:
|
||||
|
@@ -35,13 +35,4 @@ branch, as well as their available versions.
|
||||
- [ ] Add the new job to `.gitlab-ci.yml` referencing the image
|
||||
- [ ] Open a merge request with your changes and let it run
|
||||
|
||||
### Checklist for Adding a new dependency to a CI image
|
||||
|
||||
Our images are layered, and the base (called fedora-base) contains
|
||||
all the rpm payload. Therefore, adding a new dependency is a 2-step
|
||||
process:
|
||||
|
||||
1. [ ] Build and upload fedora-base:$version+1
|
||||
1. [ ] Build and upload fedora:$version+1 based on fedora-base:version+1
|
||||
|
||||
[registry]: https://gitlab.gnome.org/GNOME/gtk/container_registry
|
||||
|
@@ -29,7 +29,6 @@ RUN dnf -y install \
|
||||
glib2-static \
|
||||
glibc-devel \
|
||||
glibc-headers \
|
||||
gnome-desktop-testing \
|
||||
gobject-introspection-devel \
|
||||
graphene-devel \
|
||||
gstreamer1-devel \
|
||||
@@ -42,14 +41,12 @@ RUN dnf -y install \
|
||||
itstool \
|
||||
json-glib-devel \
|
||||
lcov \
|
||||
libasan \
|
||||
libattr-devel \
|
||||
libepoxy-devel \
|
||||
libffi-devel \
|
||||
libmount-devel \
|
||||
librsvg2 \
|
||||
libselinux-devel \
|
||||
libubsan \
|
||||
libXcomposite-devel \
|
||||
libXcursor-devel \
|
||||
libXcursor-devel \
|
||||
@@ -76,6 +73,7 @@ RUN dnf -y install \
|
||||
python3-wheel \
|
||||
redhat-rpm-config \
|
||||
sassc \
|
||||
sysprof-devel \
|
||||
systemtap-sdt-devel \
|
||||
vulkan-devel \
|
||||
wayland-devel \
|
||||
|
@@ -1,11 +1,8 @@
|
||||
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v21
|
||||
|
||||
# Enable sudo for wheel users
|
||||
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
|
||||
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v19
|
||||
|
||||
ARG HOST_USER_ID=5555
|
||||
ENV HOST_USER_ID ${HOST_USER_ID}
|
||||
RUN useradd -u $HOST_USER_ID -G wheel -ms /bin/bash user
|
||||
RUN useradd -u $HOST_USER_ID -ms /bin/bash user
|
||||
|
||||
USER user
|
||||
WORKDIR /home/user
|
||||
|
@@ -4,15 +4,8 @@ set -e
|
||||
|
||||
# We need to add a new remote for the upstream master, since this script could
|
||||
# be running in a personal fork of the repository which has out of date branches.
|
||||
if [ "${CI_PROJECT_NAMESPACE}" != "GNOME" ]; then
|
||||
echo "Retrieving the current upstream repository from ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}..."
|
||||
git remote add upstream https://gitlab.gnome.org/GNOME/gtk.git
|
||||
git fetch upstream
|
||||
ORIGIN="upstream"
|
||||
else
|
||||
echo "Reusing the existing repository on ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}"
|
||||
ORIGIN="origin"
|
||||
fi
|
||||
git remote add upstream https://gitlab.gnome.org/GNOME/gtk.git
|
||||
git fetch upstream
|
||||
|
||||
# Work out the newest common ancestor between the detached HEAD that this CI job
|
||||
# has checked out, and the upstream target branch (which will typically be
|
||||
@@ -20,7 +13,7 @@ fi
|
||||
#
|
||||
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if we’re running in
|
||||
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise.
|
||||
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "${ORIGIN}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent HEAD) | head -1)
|
||||
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent HEAD) | head -1)
|
||||
git diff -U0 --no-color "${newest_common_ancestor_sha}" | .gitlab-ci/clang-format-diff.py -binary "clang-format" -p1
|
||||
exit_status=$?
|
||||
|
||||
|
@@ -7,17 +7,14 @@ srcdir=$( pwd )
|
||||
builddir=$1
|
||||
backend=$2
|
||||
|
||||
# Ignore memory leaks lower in dependencies
|
||||
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp
|
||||
|
||||
case "${backend}" in
|
||||
x11)
|
||||
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
meson test -C ${builddir} \
|
||||
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y \
|
||||
--no-suite=gsk-compare-broadway
|
||||
|
||||
# Store the exit code for the CI run, but always
|
||||
@@ -33,10 +30,10 @@ case "${backend}" in
|
||||
export WAYLAND_DISPLAY=wayland-5
|
||||
|
||||
meson test -C ${builddir} \
|
||||
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y \
|
||||
--no-suite=gsk-compare-broadway
|
||||
|
||||
exit_code=$?
|
||||
@@ -51,10 +48,10 @@ case "${backend}" in
|
||||
export BROADWAY_DISPLAY=:5
|
||||
|
||||
meson test -C ${builddir} \
|
||||
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y \
|
||||
--no-suite=gsk-compare-opengl
|
||||
|
||||
# don't let Broadway failures fail the run, for now
|
||||
|
@@ -33,29 +33,17 @@ pacman --noconfirm -S --needed \
|
||||
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
|
||||
mingw-w64-$MSYS2_ARCH-shared-mime-info
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/gtk/issues/2243
|
||||
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner-v2/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-git-1.44.7.90.ge48ae523-1-any.pkg.tar.zst"
|
||||
pacman --noconfirm -U "mingw-w64-$MSYS2_ARCH-pango-git-1.44.7.90.ge48ae523-1-any.pkg.tar.zst"
|
||||
|
||||
# https://github.com/msys2/MINGW-packages/pull/6465
|
||||
pacman --noconfirm -S --needed mingw-w64-$MSYS2_ARCH-brotli
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
|
||||
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
|
||||
|
||||
if ! pkg-config --atleast-version=2.65.0 glib-2.0; then
|
||||
git clone https://gitlab.gnome.org/GNOME/glib.git _glib
|
||||
meson setup _glib_build _glib
|
||||
meson compile -C _glib_build
|
||||
meson install -C _glib_build
|
||||
fi
|
||||
pkg-config --modversion glib-2.0
|
||||
|
||||
if ! pkg-config --atleast-version=1.45.4 pango; then
|
||||
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
|
||||
meson setup _pango_build _pango
|
||||
meson compile -C _pango_build
|
||||
meson install -C _pango_build
|
||||
fi
|
||||
pkg-config --modversion pango
|
||||
|
||||
# Build
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
@@ -68,7 +56,7 @@ meson \
|
||||
-Dwin32-backend=true \
|
||||
-Dvulkan=no \
|
||||
-Dintrospection=false \
|
||||
-Dgtk:werror=true \
|
||||
--werror \
|
||||
_build
|
||||
unset CCACHE_DISABLE
|
||||
|
||||
|
139
NEWS
139
NEWS
@@ -1,142 +1,3 @@
|
||||
Overview of Changes in GTK 3.99.1
|
||||
=================================
|
||||
|
||||
* GtkGridLayout: Rename left-/top-attach to column/row
|
||||
|
||||
* Drop GtkAccelLabel - it is no longer used
|
||||
|
||||
* GtkTextView:
|
||||
- Fix redraw issues with selections
|
||||
- Make insert-emoji replace the selection
|
||||
|
||||
* GtkTreeView:
|
||||
- Fix selection handling in cell editables
|
||||
|
||||
* CSS:
|
||||
- Hexadecimal colors can now specify alpha
|
||||
|
||||
* Documentation:
|
||||
- Refresh the widget gallery
|
||||
- Add images for new widgets to the gallery
|
||||
- Fix many cross-references
|
||||
|
||||
* Demos:
|
||||
- Numerous crash- and bug fixes
|
||||
|
||||
* Fix build with cups < 2.3
|
||||
|
||||
* win32:
|
||||
- Default to the GL renderer when we can
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Polish
|
||||
Romanian
|
||||
Spanish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in GTK 3.99.0
|
||||
=================================
|
||||
|
||||
* Remove the old accessibility implementation and
|
||||
add the foundations for a new one that is based
|
||||
on ARIA. The relevant widget api is GtkAccessible,
|
||||
the backend implementations will use GtkATContext.
|
||||
Currently, there is just a nascent test backend.
|
||||
|
||||
* Update the GTK headers to use char *, int, float and
|
||||
double instead of the corresponding GLib types.
|
||||
|
||||
* Add GtkEditableLabel, a label that can be edited
|
||||
|
||||
* Add GtkBookmarkList, a list model for bookmarks
|
||||
|
||||
* Add GtkStringList, a list model for strings
|
||||
|
||||
* Add GtkBitset, and use it for representing selections
|
||||
|
||||
* GtkTreeView:
|
||||
- Make cell editing work again
|
||||
|
||||
* GtkSpinButton:
|
||||
- Make autosizing work again
|
||||
|
||||
* Printing:
|
||||
- Use GtkDropDown in the print dialog
|
||||
|
||||
* GtkApplication
|
||||
- Support opening files on OS X
|
||||
|
||||
* GtkFileChooser:
|
||||
- Fix libcloudproviders support
|
||||
- Turn GtkFileFilter into a GtkFilter
|
||||
- Simplify the api
|
||||
|
||||
* GtkGridView, GtkListView:
|
||||
- Improve scrolling behavior
|
||||
- Autoscroll and autoexpand during DND
|
||||
|
||||
* GtkScrolledWindow:
|
||||
- Make autoscrolling work again
|
||||
|
||||
* GtkFilterListModel:
|
||||
- Add incremental filtering
|
||||
- Add a boolean filter, GtkBoolFilter
|
||||
|
||||
* GtkSortListModel:
|
||||
- Use timsort
|
||||
- Add various tweaks that massively speed up sorting
|
||||
- Add incremental sorting
|
||||
|
||||
* GtkWidget:
|
||||
- Massively speed up action handling
|
||||
|
||||
* GtkEntry:
|
||||
- Make entry completion work again
|
||||
- Drop action support from GtkEntryCompletion
|
||||
|
||||
* Inspector:
|
||||
- Improve list model support
|
||||
- Add direct navigation between objects
|
||||
- Show accessibility information
|
||||
|
||||
* GDK:
|
||||
- Compress scroll events
|
||||
- Keep a scroll history
|
||||
- Clean up GdkDevice api
|
||||
- Drop the master/slave device split
|
||||
- Move axes to GdkDeviceTool
|
||||
- Change monitor workarea to be per-backend API
|
||||
- Improve frame clock accuracy
|
||||
- Add a new macOS backend
|
||||
- Add an ANGLE-based GLES renderer for Windows
|
||||
|
||||
* GSK:
|
||||
- Use GL_ARB_framebuffer_object
|
||||
|
||||
* gtk-demo:
|
||||
- Add incremental refill to the color grid
|
||||
- Improve performance of the color grid
|
||||
- Add an incrementally filtering word list
|
||||
- Improve the sidebar
|
||||
|
||||
* Install print-editor as another demo
|
||||
|
||||
* Translation updates
|
||||
Basque
|
||||
Catalan
|
||||
Chinese
|
||||
Japanese
|
||||
Kazakh
|
||||
Lithuanian
|
||||
Polish
|
||||
Romanian
|
||||
Spanish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in GTK 3.98.5
|
||||
=================================
|
||||
|
||||
|
@@ -56,6 +56,7 @@ building for:
|
||||
- [Pango](https://download.gnome.org/sources/pango)
|
||||
- [Epoxy](https://github.com/anholt/libepoxy)
|
||||
- [Graphene](https://github.com/ebassi/graphene)
|
||||
- [ATK](https://download.gnome.org/sources/atk)
|
||||
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)
|
||||
|
||||
If you are building the X11 backend, you will also need:
|
||||
@@ -69,6 +70,7 @@ If you are building the X11 backend, you will also need:
|
||||
- xcursor
|
||||
- xdamage
|
||||
- xcomposite
|
||||
- [atk-bridge-2.0](https://download.gnome.org/sources/at-spi2-atk)
|
||||
|
||||
If you are building the Wayland backend, you will also need:
|
||||
|
||||
|
@@ -1,38 +1,29 @@
|
||||
{
|
||||
"app-id" : "org.gtk.WidgetFactory4",
|
||||
"runtime" : "org.gnome.Platform",
|
||||
"runtime-version" : "master",
|
||||
"sdk" : "org.gnome.Sdk",
|
||||
"command" : "gtk4-widget-factory",
|
||||
"tags" : [
|
||||
"devel",
|
||||
"development",
|
||||
"nightly"
|
||||
],
|
||||
"desktop-file-name-prefix" : "(Development) ",
|
||||
"finish-args" : [
|
||||
"app-id": "org.gtk.WidgetFactory4",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "master",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"command": "gtk4-widget-factory",
|
||||
"tags": ["devel", "development", "nightly"],
|
||||
"desktop-file-name-prefix": "(Development) ",
|
||||
"finish-args": [
|
||||
"--device=dri",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.gtk.vfs",
|
||||
"--talk-name=org.gtk.vfs.*"
|
||||
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
|
||||
],
|
||||
"cleanup" : [
|
||||
"cleanup": [
|
||||
"/include",
|
||||
"/lib/pkgconfig",
|
||||
"/share/pkgconfig",
|
||||
"/lib/pkgconfig", "/share/pkgconfig",
|
||||
"/share/aclocal",
|
||||
"/man",
|
||||
"/share/man",
|
||||
"/share/gtk-doc",
|
||||
"*.la",
|
||||
".a",
|
||||
"/man", "/share/man", "/share/gtk-doc",
|
||||
"*.la", ".a",
|
||||
"/lib/girepository-1.0",
|
||||
"/share/gir-1.0",
|
||||
"/share/doc"
|
||||
],
|
||||
"modules" : [
|
||||
"modules": [
|
||||
{
|
||||
"name" : "wayland",
|
||||
"buildsystem" : "autotools",
|
||||
@@ -48,18 +39,18 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "graphene",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"name": "graphene",
|
||||
"buildsystem": "meson",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources" : [
|
||||
"sources": [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/ebassi/graphene.git"
|
||||
"type": "git",
|
||||
"url": "https://github.com/ebassi/graphene.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -67,7 +58,7 @@
|
||||
"name" : "libsass",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"config-opts": [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
@@ -82,7 +73,7 @@
|
||||
"name" : "sassc",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"config-opts": [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
@@ -94,23 +85,18 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "gtk",
|
||||
"buildsystem" : "meson",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"name": "gtk",
|
||||
"buildsystem": "meson",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources" : [
|
||||
"sources": [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
"type": "git",
|
||||
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -15,13 +15,7 @@ if 'DESTDIR' not in os.environ:
|
||||
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
|
||||
|
||||
print('Compiling GSettings schemas...')
|
||||
glib_compile_schemas = subprocess.check_output(['pkg-config',
|
||||
'--variable=glib_compile_schemas',
|
||||
'gio-2.0']).strip()
|
||||
if not os.path.exists(glib_compile_schemas):
|
||||
# pkg-config variables only available since GLib 2.62.0.
|
||||
glib_compile_schemas = 'glib-compile-schemas'
|
||||
subprocess.call([glib_compile_schemas,
|
||||
subprocess.call(['glib-compile-schemas',
|
||||
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
|
||||
|
||||
print('Updating icon cache...')
|
||||
@@ -30,14 +24,8 @@ if 'DESTDIR' not in os.environ:
|
||||
|
||||
print('Updating module cache for print backends...')
|
||||
os.makedirs(gtk_printmodule_dir, exist_ok=True)
|
||||
gio_querymodules = subprocess.check_output(['pkg-config',
|
||||
'--variable=gio_querymodules',
|
||||
'gio-2.0']).strip()
|
||||
if not os.path.exists(gio_querymodules):
|
||||
# pkg-config variables only available since GLib 2.62.0.
|
||||
gio_querymodules = 'gio-querymodules'
|
||||
subprocess.call([gio_querymodules, gtk_printmodule_dir])
|
||||
subprocess.call(['gio-querymodules', gtk_printmodule_dir])
|
||||
|
||||
print('Updating module cache for input methods...')
|
||||
os.makedirs(gtk_immodule_dir, exist_ok=True)
|
||||
subprocess.call([gio_querymodules, gtk_immodule_dir])
|
||||
subprocess.call(['gio-querymodules', gtk_immodule_dir])
|
||||
|
@@ -81,11 +81,11 @@ constraint_editor_application_activate (GApplication *app)
|
||||
static void
|
||||
constraint_editor_application_open (GApplication *app,
|
||||
GFile **files,
|
||||
int n_files,
|
||||
const char *hint)
|
||||
gint n_files,
|
||||
const gchar *hint)
|
||||
{
|
||||
ConstraintEditorWindow *win;
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < n_files; i++)
|
||||
{
|
||||
|
@@ -193,7 +193,7 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
|
||||
|
||||
static void
|
||||
open_response_cb (GtkNativeDialog *dialog,
|
||||
int response,
|
||||
gint response,
|
||||
ConstraintEditorWindow *self)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
@@ -285,7 +285,7 @@ serialize_model (GListModel *list)
|
||||
|
||||
static void
|
||||
save_response_cb (GtkNativeDialog *dialog,
|
||||
int response,
|
||||
gint response,
|
||||
ConstraintEditorWindow *self)
|
||||
{
|
||||
gtk_native_dialog_hide (dialog);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
<property name="default-height">768</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">document-open-symbolic</property>
|
||||
|
@@ -13,8 +13,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Target</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -23,8 +23,8 @@
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<signal name="changed" handler="update_button" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -32,8 +32,8 @@
|
||||
<object class="GtkComboBoxText" id="target_attr">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -41,8 +41,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Relation</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -50,8 +50,8 @@
|
||||
<object class="GtkComboBoxText" id="relation">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -59,8 +59,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Source</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -69,8 +69,8 @@
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<signal name="changed" handler="update_button" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -79,8 +79,8 @@
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<signal name="changed" handler="source_attr_changed" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -88,8 +88,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Multiplier</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -97,8 +97,8 @@
|
||||
<object class="GtkEntry" id="multiplier">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -106,8 +106,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Constant</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">5</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -115,8 +115,8 @@
|
||||
<object class="GtkEntry" id="constant">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">5</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -124,16 +124,16 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Strength</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">6</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">6</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="strength">
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">6</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">6</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -141,8 +141,8 @@
|
||||
<object class="GtkLabel" id="preview">
|
||||
<property name="xalign">0</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">7</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">7</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
<attributes>
|
||||
@@ -155,8 +155,8 @@
|
||||
<property name="label">Create</property>
|
||||
<signal name="clicked" handler="create_constraint"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">8</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">8</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -174,25 +174,28 @@ constraint_view_init (ConstraintView *self)
|
||||
manager = gtk_constraint_layout_new ();
|
||||
gtk_widget_set_layout_manager (GTK_WIDGET (self), manager);
|
||||
|
||||
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
|
||||
|
||||
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
|
||||
all_constraints = gtk_constraint_layout_observe_constraints (GTK_CONSTRAINT_LAYOUT (manager));
|
||||
guides = gtk_constraint_layout_observe_guides (GTK_CONSTRAINT_LAYOUT (manager));
|
||||
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
|
||||
constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter);
|
||||
|
||||
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
|
||||
g_object_unref (filter);
|
||||
filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
|
||||
children = (GListModel *)gtk_filter_list_model_new (all_children, filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
list = g_list_store_new (G_TYPE_LIST_MODEL);
|
||||
g_list_store_append (list, children);
|
||||
g_list_store_append (list, guides);
|
||||
g_list_store_append (list, constraints);
|
||||
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_TYPE_OBJECT, G_LIST_MODEL (list)));
|
||||
g_object_unref (children);
|
||||
g_object_unref (guides);
|
||||
g_object_unref (constraints);
|
||||
g_object_unref (all_children);
|
||||
g_object_unref (all_constraints);
|
||||
g_object_unref (list);
|
||||
|
||||
self->model = G_LIST_MODEL (gtk_flatten_list_model_new (G_LIST_MODEL (list)));
|
||||
|
||||
controller = (GtkEventController *)gtk_gesture_drag_new ();
|
||||
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);
|
||||
|
@@ -55,8 +55,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Name</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -64,8 +64,8 @@
|
||||
<object class="GtkEntry" id="name">
|
||||
<property name="max-width-chars">20</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -74,8 +74,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Min Size</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -84,8 +84,8 @@
|
||||
<property name="adjustment">min_width_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -94,8 +94,8 @@
|
||||
<property name="adjustment">min_height_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -103,8 +103,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Nat Size</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -113,8 +113,8 @@
|
||||
<property name="adjustment">nat_width_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -123,8 +123,8 @@
|
||||
<property name="adjustment">nat_height_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -132,8 +132,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Max Size</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -142,8 +142,8 @@
|
||||
<property name="adjustment">max_width_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -152,8 +152,8 @@
|
||||
<property name="adjustment">max_height_adj</property>
|
||||
<property name="max-width-chars">5</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -161,16 +161,16 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Strength</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="strength">
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -180,8 +180,8 @@
|
||||
<property name="label">Create</property>
|
||||
<signal name="clicked" handler="create_guide"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">5</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -34,7 +34,7 @@ static void create_window (GApplication *app, const char *contents);
|
||||
static void
|
||||
show_action_dialog (GSimpleAction *action)
|
||||
{
|
||||
const char *name;
|
||||
const gchar *name;
|
||||
GtkWidget *dialog;
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
@@ -58,9 +58,9 @@ show_action_infobar (GSimpleAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
DemoApplicationWindow *window = data;
|
||||
char *text;
|
||||
const char *name;
|
||||
const char *value;
|
||||
gchar *text;
|
||||
const gchar *name;
|
||||
const gchar *value;
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
value = g_variant_get_string (parameter, NULL);
|
||||
@@ -92,7 +92,7 @@ activate_new (GSimpleAction *action,
|
||||
|
||||
static void
|
||||
open_response_cb (GtkNativeDialog *dialog,
|
||||
int response_id,
|
||||
gint response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFileChooserNative *native = user_data;
|
||||
@@ -185,7 +185,7 @@ activate_about (GSimpleAction *action,
|
||||
{
|
||||
GtkWidget *window = user_data;
|
||||
|
||||
const char *authors[] = {
|
||||
const gchar *authors[] = {
|
||||
"Peter Mattis",
|
||||
"Spencer Kimball",
|
||||
"Josh MacDonald",
|
||||
@@ -193,7 +193,7 @@ activate_about (GSimpleAction *action,
|
||||
NULL
|
||||
};
|
||||
|
||||
const char *documentors[] = {
|
||||
const gchar *documentors[] = {
|
||||
"Owen Taylor",
|
||||
"Tony Gale",
|
||||
"Matthias Clasen <mclasen@redhat.com>",
|
||||
@@ -244,9 +244,9 @@ static void
|
||||
update_statusbar (GtkTextBuffer *buffer,
|
||||
DemoApplicationWindow *window)
|
||||
{
|
||||
char *msg;
|
||||
int row, col;
|
||||
int count;
|
||||
gchar *msg;
|
||||
gint row, col;
|
||||
gint count;
|
||||
GtkTextIter iter;
|
||||
|
||||
/* clear any previous message, underflow is allowed */
|
||||
|
@@ -31,8 +31,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -54,8 +54,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -70,8 +70,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -79,8 +79,8 @@
|
||||
<object class="GtkStatusbar" id="status">
|
||||
<property name="hexpand">1</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -16,8 +16,8 @@ static GtkWidget *placeholder;
|
||||
|
||||
static void
|
||||
on_name_appeared (GDBusConnection *connection,
|
||||
const char *name,
|
||||
const char *name_owner,
|
||||
const gchar *name,
|
||||
const gchar *name_owner,
|
||||
gpointer user_data)
|
||||
{
|
||||
name_seen = TRUE;
|
||||
@@ -25,7 +25,7 @@ on_name_appeared (GDBusConnection *connection,
|
||||
|
||||
static void
|
||||
on_name_vanished (GDBusConnection *connection,
|
||||
const char *name,
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (!name_seen)
|
||||
@@ -55,7 +55,7 @@ do_application_demo (GtkWidget *toplevel)
|
||||
|
||||
if (placeholder == NULL)
|
||||
{
|
||||
const char *command;
|
||||
const gchar *command;
|
||||
GError *error = NULL;
|
||||
|
||||
if (g_file_test ("./gtk4-demo-application" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE))
|
||||
|
@@ -12,7 +12,7 @@ static GtkWidget *progress_bar = NULL;
|
||||
static gboolean
|
||||
apply_changes_gradually (gpointer data)
|
||||
{
|
||||
double fraction;
|
||||
gdouble fraction;
|
||||
|
||||
/* Work, work, work... */
|
||||
fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress_bar));
|
||||
@@ -47,8 +47,8 @@ on_assistant_close_cancel (GtkWidget *widget, gpointer data)
|
||||
static void
|
||||
on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data)
|
||||
{
|
||||
int current_page, n_pages;
|
||||
char *title;
|
||||
gint current_page, n_pages;
|
||||
gchar *title;
|
||||
|
||||
current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget));
|
||||
n_pages = gtk_assistant_get_n_pages (GTK_ASSISTANT (widget));
|
||||
@@ -70,8 +70,8 @@ on_entry_changed (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
GtkAssistant *assistant = GTK_ASSISTANT (data);
|
||||
GtkWidget *current_page;
|
||||
int page_number;
|
||||
const char *text;
|
||||
gint page_number;
|
||||
const gchar *text;
|
||||
|
||||
page_number = gtk_assistant_get_current_page (assistant);
|
||||
current_page = gtk_assistant_get_nth_page (assistant, page_number);
|
||||
|
@@ -18,8 +18,8 @@
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -29,8 +29,8 @@
|
||||
<property name="has-frame">1</property>
|
||||
<property name="min-content-width">150</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -40,8 +40,8 @@
|
||||
<property name="hexpand">1</property>
|
||||
<property name="stack">stack</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -67,8 +67,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Duck</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -76,8 +76,8 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Background</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -87,8 +87,8 @@
|
||||
<class name="duck"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -98,8 +98,8 @@
|
||||
<class name="gradient"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -108,8 +108,8 @@
|
||||
<property name="label" translatable="yes">
|
||||
Blended picture</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -121,8 +121,8 @@ Blended picture</property>
|
||||
<class name="blend0"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -146,8 +146,8 @@ Blended picture</property>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Red</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -155,8 +155,8 @@ Blended picture</property>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Blue</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -166,8 +166,8 @@ Blended picture</property>
|
||||
<class name="red"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -177,8 +177,8 @@ Blended picture</property>
|
||||
<class name="blue"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -187,8 +187,8 @@ Blended picture</property>
|
||||
<property name="label" translatable="yes">
|
||||
Blended picture</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -200,8 +200,8 @@ Blended picture</property>
|
||||
<class name="blend1"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -228,8 +228,8 @@ Blended picture</property>
|
||||
<class name="cyan"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -239,8 +239,8 @@ Blended picture</property>
|
||||
<class name="magenta"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -250,8 +250,8 @@ Blended picture</property>
|
||||
<class name="yellow"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -262,8 +262,8 @@ Blended picture</property>
|
||||
<class name="blend2"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -275,8 +275,8 @@ Blended picture</property>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -288,8 +288,8 @@ Blended picture</property>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -301,8 +301,8 @@ Blended picture</property>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -314,8 +314,8 @@ Blended picture</property>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -324,8 +324,8 @@ Blended picture</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -38,7 +38,7 @@ create_icon_store (void)
|
||||
|
||||
GtkTreeIter iter;
|
||||
GtkListStore *store;
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
|
||||
|
||||
@@ -77,7 +77,7 @@ set_sensitive (GtkCellLayout *cell_layout,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
int *indices;
|
||||
gint *indices;
|
||||
gboolean sensitive;
|
||||
|
||||
path = gtk_tree_model_get_path (tree_model, iter);
|
||||
@@ -175,7 +175,7 @@ create_capital_store (void)
|
||||
|
||||
GtkTreeIter iter, iter2;
|
||||
GtkTreeStore *store;
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
store = gtk_tree_store_new (1, G_TYPE_STRING);
|
||||
|
||||
|
@@ -94,7 +94,7 @@ do_css_basics (GtkWidget *do_widget)
|
||||
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
|
||||
container = gtk_scrolled_window_new ();
|
||||
container = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_window_set_child (GTK_WINDOW (window), container);
|
||||
child = gtk_text_view_new_with_buffer (text);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (container), child);
|
||||
|
@@ -38,14 +38,14 @@ struct {
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
static void
|
||||
update_css_for_blend_mode (GtkCssProvider *provider,
|
||||
const char *blend_mode)
|
||||
const gchar *blend_mode)
|
||||
{
|
||||
GBytes *bytes;
|
||||
char *css;
|
||||
gchar *css;
|
||||
|
||||
bytes = g_resources_lookup_data ("/css_blendmodes/css_blendmodes.css", 0, NULL);
|
||||
|
||||
css = g_strdup_printf ((char *) g_bytes_get_data (bytes, NULL),
|
||||
css = g_strdup_printf ((gchar*) g_bytes_get_data (bytes, NULL),
|
||||
blend_mode,
|
||||
blend_mode,
|
||||
blend_mode);
|
||||
@@ -62,7 +62,7 @@ row_activated (GtkListBox *listbox,
|
||||
GtkListBoxRow *row,
|
||||
GtkCssProvider *provider)
|
||||
{
|
||||
const char *blend_mode;
|
||||
const gchar *blend_mode;
|
||||
|
||||
blend_mode = blend_modes[gtk_list_box_row_get_index (row)].id;
|
||||
|
||||
@@ -75,7 +75,7 @@ setup_listbox (GtkBuilder *builder,
|
||||
{
|
||||
GtkWidget *normal_row;
|
||||
GtkWidget *listbox;
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
normal_row = NULL;
|
||||
listbox = gtk_list_box_new ();
|
||||
|
@@ -132,7 +132,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
|
||||
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_paned_set_end_child (GTK_PANED (paned), sw);
|
||||
child = gtk_text_view_new_with_buffer (text);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), child);
|
||||
|
@@ -101,7 +101,7 @@ do_css_pixbufs (GtkWidget *do_widget)
|
||||
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
|
||||
container = gtk_scrolled_window_new ();
|
||||
container = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_paned_set_end_child (GTK_PANED (paned), container);
|
||||
child = gtk_text_view_new_with_buffer (text);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (container), child);
|
||||
|
@@ -119,7 +119,7 @@ do_css_shadows (GtkWidget *do_widget)
|
||||
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
|
||||
container = gtk_scrolled_window_new ();
|
||||
container = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_paned_set_end_child (GTK_PANED (paned), container);
|
||||
child = gtk_text_view_new_with_buffer (text);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (container), child);
|
||||
|
@@ -140,7 +140,6 @@
|
||||
</gresource>
|
||||
<gresource prefix="/listview_colors">
|
||||
<file compressed="true">color.names.txt</file>
|
||||
<file>listview_colors.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/shortcuts">
|
||||
<file>shortcuts.ui</file>
|
||||
@@ -226,7 +225,6 @@
|
||||
<file>listview_minesweeper.c</file>
|
||||
<file>listview_settings.c</file>
|
||||
<file>listview_weather.c</file>
|
||||
<file>listview_words.c</file>
|
||||
<file>list_store.c</file>
|
||||
<file>markup.c</file>
|
||||
<file>modelbutton.c</file>
|
||||
|
@@ -95,6 +95,9 @@
|
||||
<property name="program-name" translatable="yes">Builder demo</property>
|
||||
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
||||
<property name="modal">True</property>
|
||||
<accessibility>
|
||||
<relation target="window1" type="subwindow-of"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="default-height">250</property>
|
||||
@@ -110,6 +113,11 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="toolbar1">
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-toolbar">
|
||||
<property name="AtkObject::accessible-name">The toolbar</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
@@ -166,6 +174,14 @@
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
<property name="model">liststore1</property>
|
||||
<property name="tooltip-column">3</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="a11y-treeview">
|
||||
<property name="AtkObject::accessible-name">Name list</property>
|
||||
<property name="AtkObject::accessible-description">
|
||||
A list of person with name, surname and age columns
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="column1">
|
||||
<property name="title">Name</property>
|
||||
|
@@ -17,7 +17,7 @@ G_DEFINE_TYPE(DemoImage, demo_image, GTK_TYPE_WIDGET)
|
||||
static GdkPaintable *
|
||||
get_image_paintable (GtkImage *image)
|
||||
{
|
||||
const char *icon_name;
|
||||
const gchar *icon_name;
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkIconPaintable *icon;
|
||||
|
||||
|
@@ -23,12 +23,14 @@
|
||||
#include "demotaggedentry.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk/gtk-a11y.h>
|
||||
|
||||
struct _DemoTaggedEntry
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *text;
|
||||
GtkWidget *box;
|
||||
GtkWidget *entry;
|
||||
};
|
||||
|
||||
struct _DemoTaggedEntryClass
|
||||
@@ -44,10 +46,15 @@ G_DEFINE_TYPE_WITH_CODE (DemoTaggedEntry, demo_tagged_entry, GTK_TYPE_WIDGET,
|
||||
static void
|
||||
demo_tagged_entry_init (DemoTaggedEntry *entry)
|
||||
{
|
||||
entry->text = gtk_text_new ();
|
||||
gtk_widget_set_hexpand (entry->text, TRUE);
|
||||
gtk_widget_set_vexpand (entry->text, TRUE);
|
||||
gtk_widget_set_parent (entry->text, GTK_WIDGET (entry));
|
||||
entry->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_parent (entry->box, GTK_WIDGET (entry));
|
||||
|
||||
entry->entry = gtk_text_new ();
|
||||
gtk_widget_set_hexpand (entry->entry, TRUE);
|
||||
gtk_widget_set_vexpand (entry->entry, TRUE);
|
||||
gtk_widget_set_hexpand (entry->box, FALSE);
|
||||
gtk_widget_set_vexpand (entry->box, FALSE);
|
||||
gtk_box_append (GTK_BOX (entry->box), entry->entry);
|
||||
gtk_editable_init_delegate (GTK_EDITABLE (entry));
|
||||
}
|
||||
|
||||
@@ -55,15 +62,12 @@ static void
|
||||
demo_tagged_entry_dispose (GObject *object)
|
||||
{
|
||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (object);
|
||||
GtkWidget *child;
|
||||
|
||||
if (entry->text)
|
||||
if (entry->entry)
|
||||
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
|
||||
|
||||
while ((child = gtk_widget_get_first_child (GTK_WIDGET (entry))))
|
||||
gtk_widget_unparent (child);
|
||||
|
||||
entry->text = NULL;
|
||||
g_clear_pointer (&entry->entry, gtk_widget_unparent);
|
||||
g_clear_pointer (&entry->box, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (demo_tagged_entry_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -97,7 +101,7 @@ demo_tagged_entry_grab_focus (GtkWidget *widget)
|
||||
{
|
||||
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
|
||||
|
||||
return gtk_widget_grab_focus (entry->text);
|
||||
return gtk_widget_grab_focus (entry->entry);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -114,14 +118,15 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
|
||||
|
||||
gtk_editable_install_properties (object_class, 1);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_ENTRY_ACCESSIBLE);
|
||||
gtk_widget_class_set_css_name (widget_class, "entry");
|
||||
}
|
||||
|
||||
static GtkEditable *
|
||||
demo_tagged_entry_get_delegate (GtkEditable *editable)
|
||||
{
|
||||
return GTK_EDITABLE (DEMO_TAGGED_ENTRY (editable)->text);
|
||||
return GTK_EDITABLE (DEMO_TAGGED_ENTRY (editable)->entry);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -142,7 +147,7 @@ demo_tagged_entry_add_tag (DemoTaggedEntry *entry,
|
||||
{
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
|
||||
|
||||
gtk_widget_set_parent (tag, GTK_WIDGET (entry));
|
||||
gtk_box_append (GTK_BOX (entry->box), tag);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -152,7 +157,10 @@ demo_tagged_entry_insert_tag_after (DemoTaggedEntry *entry,
|
||||
{
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
|
||||
|
||||
gtk_widget_insert_after (tag, GTK_WIDGET (entry), sibling);
|
||||
if (sibling == NULL)
|
||||
gtk_box_append (GTK_BOX (entry->box), tag);
|
||||
else
|
||||
gtk_box_insert_child_after (GTK_BOX (entry->box), tag, sibling);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -161,7 +169,7 @@ demo_tagged_entry_remove_tag (DemoTaggedEntry *entry,
|
||||
{
|
||||
g_return_if_fail (DEMO_IS_TAGGED_ENTRY (entry));
|
||||
|
||||
gtk_widget_unparent (tag);
|
||||
gtk_box_remove (GTK_BOX (entry->box), tag);
|
||||
}
|
||||
|
||||
struct _DemoTaggedEntryTag
|
||||
|
@@ -16,7 +16,7 @@ message_dialog_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
static int i = 1;
|
||||
static gint i = 1;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
|
@@ -597,83 +597,6 @@ css_button_new (const char *class)
|
||||
return button;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
GdkRGBA color;
|
||||
} ColorSwatch;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
} ColorSwatchClass;
|
||||
|
||||
G_DEFINE_TYPE (ColorSwatch, color_swatch, GTK_TYPE_WIDGET)
|
||||
|
||||
static GdkContentProvider *
|
||||
color_swatch_drag_prepare (GtkDragSource *source,
|
||||
double x,
|
||||
double y,
|
||||
ColorSwatch *swatch)
|
||||
{
|
||||
return gdk_content_provider_new_typed (GDK_TYPE_RGBA, &swatch->color);
|
||||
}
|
||||
|
||||
static void
|
||||
color_swatch_init (ColorSwatch *swatch)
|
||||
{
|
||||
GtkDragSource *source = gtk_drag_source_new ();
|
||||
g_signal_connect (source, "prepare", G_CALLBACK (color_swatch_drag_prepare), swatch);
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (source));
|
||||
}
|
||||
|
||||
static void
|
||||
color_swatch_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
ColorSwatch *swatch = (ColorSwatch *)widget;
|
||||
float w = gtk_widget_get_width (widget);
|
||||
float h = gtk_widget_get_height (widget);
|
||||
|
||||
gtk_snapshot_append_color (snapshot, &swatch->color,
|
||||
&GRAPHENE_RECT_INIT(0, 0, w, h));
|
||||
}
|
||||
|
||||
void
|
||||
color_swatch_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum_size,
|
||||
int *natural_size,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
*minimum_size = *natural_size = 48;
|
||||
else
|
||||
*minimum_size = *natural_size = 32;
|
||||
}
|
||||
|
||||
static void
|
||||
color_swatch_class_init (ColorSwatchClass *class)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
widget_class->snapshot = color_swatch_snapshot;
|
||||
widget_class->measure = color_swatch_measure;
|
||||
gtk_widget_class_set_css_name (widget_class, "colorswatch");
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
color_swatch_new (const char *color)
|
||||
{
|
||||
ColorSwatch *swatch = g_object_new (color_swatch_get_type (), NULL);
|
||||
|
||||
gdk_rgba_parse (&swatch->color, color);
|
||||
|
||||
return GTK_WIDGET (swatch);
|
||||
}
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
GtkWidget *
|
||||
@@ -736,7 +659,7 @@ do_dnd (GtkWidget *do_widget)
|
||||
y += 100;
|
||||
}
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_NEVER);
|
||||
@@ -747,7 +670,18 @@ do_dnd (GtkWidget *do_widget)
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
|
||||
|
||||
for (i = 0; colors[i]; i++)
|
||||
gtk_box_append (GTK_BOX (box3), color_swatch_new (colors[i]));
|
||||
{
|
||||
GdkRGBA rgba;
|
||||
GtkWidget *swatch;
|
||||
|
||||
gdk_rgba_parse (&rgba, colors[i]);
|
||||
|
||||
swatch = g_object_new (g_type_from_name ("GtkColorSwatch"),
|
||||
"rgba", &rgba,
|
||||
"selectable", FALSE,
|
||||
NULL);
|
||||
gtk_box_append (GTK_BOX (box3), swatch);
|
||||
}
|
||||
|
||||
gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow1"));
|
||||
gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow2"));
|
||||
|
@@ -64,8 +64,8 @@ scribble_draw (GtkDrawingArea *da,
|
||||
/* Draw a rectangle on the screen */
|
||||
static void
|
||||
draw_brush (GtkWidget *widget,
|
||||
double x,
|
||||
double y)
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GdkRectangle update_rect;
|
||||
cairo_t *cr;
|
||||
|
@@ -92,7 +92,7 @@ strings_setup_item_full (GtkSignalListItemFactory *factory,
|
||||
gtk_label_set_xalign (GTK_LABEL (title), 0.0);
|
||||
description = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (description), 0.0);
|
||||
gtk_widget_add_css_class (description, "dim-label");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (description), "dim-label");
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
||||
@@ -254,7 +254,7 @@ do_dropdown (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_bottom (box, 10);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
button = gtk_drop_down_new (NULL, NULL);
|
||||
button = gtk_drop_down_new ();
|
||||
|
||||
model = G_LIST_MODEL (pango_cairo_font_map_get_default ());
|
||||
gtk_drop_down_set_model (GTK_DROP_DOWN (button), model);
|
||||
|
@@ -16,9 +16,9 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int number;
|
||||
char *product;
|
||||
int yummy;
|
||||
gint number;
|
||||
gchar *product;
|
||||
gint yummy;
|
||||
}
|
||||
Item;
|
||||
|
||||
@@ -74,7 +74,7 @@ add_items (void)
|
||||
static GtkTreeModel *
|
||||
create_items_model (void)
|
||||
{
|
||||
int i = 0;
|
||||
gint i = 0;
|
||||
GtkListStore *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
@@ -109,7 +109,7 @@ static GtkTreeModel *
|
||||
create_numbers_model (void)
|
||||
{
|
||||
#define N_NUMBERS 10
|
||||
int i = 0;
|
||||
gint i = 0;
|
||||
GtkListStore *model;
|
||||
GtkTreeIter iter;
|
||||
|
||||
@@ -192,7 +192,7 @@ remove_item (GtkWidget *widget, gpointer data)
|
||||
|
||||
if (gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
{
|
||||
int i;
|
||||
gint i;
|
||||
GtkTreePath *path;
|
||||
|
||||
path = gtk_tree_model_get_path (model, &iter);
|
||||
@@ -211,7 +211,7 @@ separator_row (GtkTreeModel *model,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
int idx;
|
||||
gint idx;
|
||||
|
||||
path = gtk_tree_model_get_path (model, iter);
|
||||
idx = gtk_tree_path_get_indices (path)[0];
|
||||
@@ -224,7 +224,7 @@ separator_row (GtkTreeModel *model,
|
||||
static void
|
||||
editing_started (GtkCellRenderer *cell,
|
||||
GtkCellEditable *editable,
|
||||
const char *path,
|
||||
const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable),
|
||||
@@ -233,15 +233,15 @@ editing_started (GtkCellRenderer *cell,
|
||||
|
||||
static void
|
||||
cell_edited (GtkCellRendererText *cell,
|
||||
const char *path_string,
|
||||
const char *new_text,
|
||||
const gchar *path_string,
|
||||
const gchar *new_text,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeModel *model = (GtkTreeModel *)data;
|
||||
GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
|
||||
GtkTreeIter iter;
|
||||
|
||||
int column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
|
||||
gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
|
||||
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
|
||||
@@ -249,7 +249,7 @@ cell_edited (GtkCellRendererText *cell,
|
||||
{
|
||||
case COLUMN_ITEM_NUMBER:
|
||||
{
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
i = gtk_tree_path_get_indices (path)[0];
|
||||
g_array_index (articles, Item, i).number = atoi (new_text);
|
||||
@@ -261,8 +261,8 @@ cell_edited (GtkCellRendererText *cell,
|
||||
|
||||
case COLUMN_ITEM_PRODUCT:
|
||||
{
|
||||
int i;
|
||||
char *old_text;
|
||||
gint i;
|
||||
gchar *old_text;
|
||||
|
||||
gtk_tree_model_get (model, &iter, column, &old_text, -1);
|
||||
g_free (old_text);
|
||||
@@ -364,7 +364,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
gtk_box_append (GTK_BOX (vbox),
|
||||
gtk_label_new ("Shopping list (you can edit the cells!)"));
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
|
@@ -12,48 +12,22 @@
|
||||
static GtkTreeModel *
|
||||
create_completion_model (void)
|
||||
{
|
||||
const char *strings[] = {
|
||||
"GNOME",
|
||||
"gnominious",
|
||||
"Gnomonic projection",
|
||||
"Gnosophy",
|
||||
"total",
|
||||
"totally",
|
||||
"toto",
|
||||
"tottery",
|
||||
"totterer",
|
||||
"Totten trust",
|
||||
"Tottenham hotspurs",
|
||||
"totipotent",
|
||||
"totipotency",
|
||||
"totemism",
|
||||
"totem pole",
|
||||
"Totara",
|
||||
"totalizer",
|
||||
"totalizator",
|
||||
"totalitarianism",
|
||||
"total parenteral nutrition",
|
||||
"total eclipse",
|
||||
"Totipresence",
|
||||
"Totipalmi",
|
||||
"zombie",
|
||||
"aæx",
|
||||
"aæy",
|
||||
"aæz",
|
||||
NULL
|
||||
};
|
||||
int i;
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
|
||||
store = gtk_list_store_new (1, G_TYPE_STRING);
|
||||
|
||||
for (i = 0; strings[i]; i++)
|
||||
{
|
||||
/* Append one word */
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter, 0, strings[i], -1);
|
||||
}
|
||||
/* Append one word */
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter, 0, "GNOME", -1);
|
||||
|
||||
/* Append another word */
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter, 0, "total", -1);
|
||||
|
||||
/* And another word */
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter, 0, "totally", -1);
|
||||
|
||||
return GTK_TREE_MODEL (store);
|
||||
}
|
||||
@@ -107,9 +81,6 @@ do_entry_completion (GtkWidget *do_widget)
|
||||
|
||||
/* Use model column 0 as the text column */
|
||||
gtk_entry_completion_set_text_column (completion, 0);
|
||||
|
||||
gtk_entry_completion_set_inline_completion (completion, TRUE);
|
||||
gtk_entry_completion_set_inline_selection (completion, TRUE);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -13,7 +13,7 @@
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static void
|
||||
response_cb (GtkDialog *dialog, int response_id)
|
||||
response_cb (GtkDialog *dialog, gint response_id)
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
window = NULL;
|
||||
@@ -57,7 +57,7 @@ do_expander (GtkWidget *do_widget)
|
||||
|
||||
expander = gtk_expander_new ("Details:");
|
||||
gtk_widget_set_vexpand (expander, TRUE);
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 100);
|
||||
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
|
@@ -22,8 +22,8 @@ format_number (GtkTreeViewColumn *col,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
int num;
|
||||
char *text;
|
||||
gint num;
|
||||
gchar *text;
|
||||
|
||||
gtk_tree_model_get (model, iter, GPOINTER_TO_INT (data), &num, -1);
|
||||
text = g_strdup_printf ("%d", num);
|
||||
@@ -35,11 +35,11 @@ static void
|
||||
filter_modify_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
GValue *value,
|
||||
int column,
|
||||
gint column,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeModelFilter *filter_model = GTK_TREE_MODEL_FILTER (model);
|
||||
int width, height;
|
||||
gint width, height;
|
||||
GtkTreeModel *child_model;
|
||||
GtkTreeIter child_iter;
|
||||
|
||||
@@ -75,7 +75,7 @@ visible_func (GtkTreeModel *model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
int width;
|
||||
gint width;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
WIDTH_COLUMN, &width,
|
||||
|
@@ -45,9 +45,12 @@
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -80,9 +83,12 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -127,9 +133,12 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -140,9 +149,12 @@
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -153,9 +165,12 @@
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -182,9 +197,12 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -209,7 +209,7 @@ set_widget_type (GtkFishbowl *fishbowl,
|
||||
widget_types[selected_widget_type].name);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
void
|
||||
fishbowl_next_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -224,7 +224,7 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
void
|
||||
fishbowl_prev_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -239,7 +239,7 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
void
|
||||
fishbowl_changes_toggled_cb (GtkToggleButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ fishbowl_changes_toggled_cb (GtkToggleButton *button,
|
||||
gtk_button_set_icon_name (GTK_BUTTON (button), "changes-allow");
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT char *
|
||||
char *
|
||||
format_header_cb (GObject *object,
|
||||
guint count,
|
||||
double fps)
|
||||
|
@@ -6,6 +6,7 @@
|
||||
<property name="default-height">400</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
|
@@ -130,7 +130,7 @@ create_demo_window (GtkWidget *do_widget)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
|
||||
fixed = gtk_fixed_new ();
|
||||
|
@@ -29,7 +29,7 @@ draw_color (GtkDrawingArea *drawingarea,
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
color_swatch_new (const char *color)
|
||||
color_swatch_new (const gchar *color)
|
||||
{
|
||||
GtkWidget *button, *area;
|
||||
|
||||
@@ -48,7 +48,7 @@ do_flowbox (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *scrolled, *flowbox;
|
||||
const char *colors[] = {
|
||||
const gchar *colors[] = {
|
||||
"AliceBlue",
|
||||
"AntiqueWhite",
|
||||
"AntiqueWhite1",
|
||||
@@ -716,7 +716,7 @@ do_flowbox (GtkWidget *do_widget)
|
||||
"YellowGreen",
|
||||
NULL
|
||||
};
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
@@ -727,7 +727,7 @@ do_flowbox (GtkWidget *do_widget)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
scrolled = gtk_scrolled_window_new ();
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
flowbox = gtk_flow_box_new ();
|
||||
gtk_widget_set_valign (flowbox, GTK_ALIGN_START);
|
||||
|
@@ -7,6 +7,7 @@
|
||||
<property name="title">Font Explorer</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset">
|
||||
<property name="receives-default">1</property>
|
||||
|
@@ -130,10 +130,6 @@ static const char *
|
||||
get_feature_display_name (unsigned int tag)
|
||||
{
|
||||
int i;
|
||||
static char buf[5] = { 0, };
|
||||
|
||||
if (tag == MAKE_TAG ('x', 'x', 'x', 'x'))
|
||||
return _("Default");
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (open_type_layout_features); i++)
|
||||
{
|
||||
@@ -141,10 +137,7 @@ get_feature_display_name (unsigned int tag)
|
||||
return g_dpgettext2 (NULL, "OpenType layout", open_type_layout_features[i].name);
|
||||
}
|
||||
|
||||
hb_tag_to_string (tag, buf);
|
||||
g_warning ("unknown OpenType layout feature tag: %s", buf);
|
||||
|
||||
return buf;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void update_display (void);
|
||||
@@ -302,7 +295,7 @@ update_display (void)
|
||||
GList *l;
|
||||
PangoAttrList *attrs;
|
||||
PangoAttribute *attr;
|
||||
int ins, bound;
|
||||
gint ins, bound;
|
||||
guint start, end;
|
||||
PangoLanguage *lang;
|
||||
char *font_desc;
|
||||
@@ -486,7 +479,7 @@ update_script_combo (void)
|
||||
{
|
||||
GtkListStore *store;
|
||||
hb_font_t *hb_font;
|
||||
int i, j, k;
|
||||
gint i, j, k;
|
||||
PangoFont *pango_font;
|
||||
GHashTable *tags;
|
||||
GHashTableIter iter;
|
||||
@@ -600,7 +593,7 @@ update_script_combo (void)
|
||||
static void
|
||||
update_features (void)
|
||||
{
|
||||
int i, j;
|
||||
gint i, j;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
guint script_index, lang_index;
|
||||
@@ -735,8 +728,8 @@ static void
|
||||
entry_activated (GtkEntry *entry,
|
||||
GtkAdjustment *adjustment)
|
||||
{
|
||||
double value;
|
||||
char *err = NULL;
|
||||
gdouble value;
|
||||
gchar *err = NULL;
|
||||
|
||||
value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err);
|
||||
if (err != NULL)
|
||||
@@ -946,7 +939,7 @@ instance_changed (GtkComboBox *combo)
|
||||
{
|
||||
Axis *axis;
|
||||
Axis akey;
|
||||
double value;
|
||||
gdouble value;
|
||||
|
||||
value = coords[ai[i].axis_index];
|
||||
|
||||
@@ -1292,7 +1285,8 @@ do_font_features (GtkWidget *do_widget)
|
||||
"palt",
|
||||
"twid",
|
||||
"qwid", NULL });
|
||||
add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss01",
|
||||
add_check_group (feature_list, _("Alternative Stylistic Sets"), (const char *[]){ "ss00",
|
||||
"ss01",
|
||||
"ss02",
|
||||
"ss03",
|
||||
"ss04",
|
||||
|
@@ -36,11 +36,11 @@ adjustment_get_normalized_value (GtkAdjustment *adj)
|
||||
|
||||
static void
|
||||
val_to_xy (GtkFontPlane *plane,
|
||||
int *x,
|
||||
int *y)
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
double u, v;
|
||||
int width, height;
|
||||
gdouble u, v;
|
||||
gint width, height;
|
||||
|
||||
width = gtk_widget_get_allocated_width (GTK_WIDGET (plane));
|
||||
height = gtk_widget_get_allocated_height (GTK_WIDGET (plane));
|
||||
@@ -57,8 +57,8 @@ plane_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkFontPlane *plane = GTK_FONT_PLANE (widget);
|
||||
int x, y;
|
||||
int width, height;
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
cairo_t *cr;
|
||||
|
||||
val_to_xy (plane, &x, &y);
|
||||
@@ -125,11 +125,11 @@ adjustment_set_normalized_value (GtkAdjustment *adj,
|
||||
|
||||
static void
|
||||
update_value (GtkFontPlane *plane,
|
||||
int x,
|
||||
int y)
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (plane);
|
||||
double u, v;
|
||||
gdouble u, v;
|
||||
|
||||
u = CLAMP (x * (1.0 / gtk_widget_get_allocated_width (widget)), 0, 1);
|
||||
v = CLAMP (1 - y * (1.0 / gtk_widget_get_allocated_height (widget)), 0, 1);
|
||||
@@ -142,8 +142,8 @@ update_value (GtkFontPlane *plane,
|
||||
|
||||
static void
|
||||
plane_drag_gesture_begin (GtkGestureDrag *gesture,
|
||||
double start_x,
|
||||
double start_y,
|
||||
gdouble start_x,
|
||||
gdouble start_y,
|
||||
GtkFontPlane *plane)
|
||||
{
|
||||
guint button;
|
||||
@@ -164,11 +164,11 @@ plane_drag_gesture_begin (GtkGestureDrag *gesture,
|
||||
|
||||
static void
|
||||
plane_drag_gesture_update (GtkGestureDrag *gesture,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
gdouble offset_x,
|
||||
gdouble offset_y,
|
||||
GtkFontPlane *plane)
|
||||
{
|
||||
double start_x, start_y;
|
||||
gdouble start_x, start_y;
|
||||
|
||||
gtk_gesture_drag_get_start_point (GTK_GESTURE_DRAG (gesture),
|
||||
&start_x, &start_y);
|
||||
@@ -177,8 +177,8 @@ plane_drag_gesture_update (GtkGestureDrag *gesture,
|
||||
|
||||
static void
|
||||
plane_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
double offset_x,
|
||||
double offset_y,
|
||||
gdouble offset_x,
|
||||
gdouble offset_y,
|
||||
GtkFontPlane *plane)
|
||||
{
|
||||
set_cross_cursor (GTK_WIDGET (plane), FALSE);
|
||||
|
@@ -21,6 +21,12 @@ static PangoContext *context;
|
||||
|
||||
static int scale = 10;
|
||||
|
||||
static void
|
||||
on_destroy (gpointer data)
|
||||
{
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
update_image (void)
|
||||
{
|
||||
@@ -245,7 +251,9 @@ do_fontrendering (GtkWidget *do_widget)
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (on_destroy), NULL);
|
||||
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
|
||||
font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
|
||||
up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button"));
|
||||
down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button"));
|
||||
@@ -268,8 +276,6 @@ do_fontrendering (GtkWidget *do_widget)
|
||||
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
|
||||
update_image ();
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -28,7 +28,7 @@
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="text">Fonts render</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -41,16 +41,16 @@
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font_button">
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -62,7 +62,7 @@
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="left-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -77,7 +77,7 @@
|
||||
<item translatable="yes" id="full">Full</item>
|
||||
</items>
|
||||
<layout>
|
||||
<property name="column">3</property>
|
||||
<property name="left-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -92,8 +92,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">3</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -109,8 +109,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -126,8 +126,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -138,8 +138,8 @@
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">5</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -150,8 +150,8 @@
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">5</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -159,7 +159,7 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="hexpand">1</property>
|
||||
<layout>
|
||||
<property name="column">6</property>
|
||||
<property name="left-attach">6</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -184,8 +184,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column-span">7</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -204,8 +204,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">4</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="column-span">7</property>
|
||||
</layout>
|
||||
</object>
|
||||
|
@@ -9,8 +9,8 @@
|
||||
|
||||
static GtkGesture *rotate = NULL;
|
||||
static GtkGesture *zoom = NULL;
|
||||
static double swipe_x = 0;
|
||||
static double swipe_y = 0;
|
||||
static gdouble swipe_x = 0;
|
||||
static gdouble swipe_y = 0;
|
||||
static gboolean long_pressed = FALSE;
|
||||
|
||||
static gboolean
|
||||
@@ -26,8 +26,8 @@ touchpad_swipe_gesture_begin (GtkGesture *gesture,
|
||||
|
||||
static void
|
||||
swipe_gesture_swept (GtkGestureSwipe *gesture,
|
||||
double velocity_x,
|
||||
double velocity_y,
|
||||
gdouble velocity_x,
|
||||
gdouble velocity_y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
swipe_x = velocity_x / 10;
|
||||
@@ -37,8 +37,8 @@ swipe_gesture_swept (GtkGestureSwipe *gesture,
|
||||
|
||||
static void
|
||||
long_press_gesture_pressed (GtkGestureLongPress *gesture,
|
||||
double x,
|
||||
double y,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
long_pressed = TRUE;
|
||||
@@ -56,8 +56,8 @@ long_press_gesture_end (GtkGesture *gesture,
|
||||
|
||||
static void
|
||||
rotation_angle_changed (GtkGestureRotate *gesture,
|
||||
double angle,
|
||||
double delta,
|
||||
gdouble angle,
|
||||
gdouble delta,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_queue_draw (widget);
|
||||
@@ -65,7 +65,7 @@ rotation_angle_changed (GtkGestureRotate *gesture,
|
||||
|
||||
static void
|
||||
zoom_scale_changed (GtkGestureZoom *gesture,
|
||||
double scale,
|
||||
gdouble scale,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_queue_draw (widget);
|
||||
@@ -93,8 +93,8 @@ drawing_area_draw (GtkDrawingArea *area,
|
||||
{
|
||||
cairo_pattern_t *pat;
|
||||
cairo_matrix_t matrix;
|
||||
double angle, scale;
|
||||
double x_center, y_center;
|
||||
gdouble angle, scale;
|
||||
gdouble x_center, y_center;
|
||||
|
||||
gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center);
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
precision highp float;
|
||||
|
||||
void main() {
|
||||
float lerpVal = gl_FragCoord.y / 500.0;
|
||||
float lerpVal = gl_FragCoord.y / 500.0f;
|
||||
|
||||
gl_FragColor = mix(vec4(1.0, 0.85, 0.35, 1.0), vec4(0.2, 0.2, 0.2, 1.0), lerpVal);
|
||||
gl_FragColor = mix(vec4(1.0f, 0.85f, 0.35f, 1.0f), vec4(0.2f, 0.2f, 0.2f, 1.0f), lerpVal);
|
||||
}
|
||||
|
@@ -98,7 +98,7 @@ gtk_fishbowl_measure (GtkWidget *widget,
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
GtkFishbowlChild *child;
|
||||
int child_min, child_nat;
|
||||
gint child_min, child_nat;
|
||||
|
||||
*minimum = 0;
|
||||
*natural = 0;
|
||||
|
@@ -30,6 +30,7 @@ do_headerbar (GtkWidget *do_widget)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
|
||||
button = gtk_button_new ();
|
||||
icon = g_themed_icon_new ("mail-send-receive-symbolic");
|
||||
|
@@ -18,7 +18,7 @@ static void
|
||||
insert_link (GtkTextBuffer *buffer,
|
||||
GtkTextIter *iter,
|
||||
const char *text,
|
||||
int page)
|
||||
gint page)
|
||||
{
|
||||
GtkTextTag *tag;
|
||||
|
||||
@@ -35,7 +35,7 @@ insert_link (GtkTextBuffer *buffer,
|
||||
*/
|
||||
static void
|
||||
show_page (GtkTextBuffer *buffer,
|
||||
int page)
|
||||
gint page)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
|
||||
@@ -91,7 +91,7 @@ follow_if_link (GtkWidget *text_view,
|
||||
for (tagp = tags; tagp != NULL; tagp = tagp->next)
|
||||
{
|
||||
GtkTextTag *tag = tagp->data;
|
||||
int page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
|
||||
gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
|
||||
|
||||
if (page != 0)
|
||||
{
|
||||
@@ -134,14 +134,14 @@ key_pressed (GtkEventController *controller,
|
||||
}
|
||||
|
||||
static void set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
int x,
|
||||
int y);
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
static void
|
||||
released_cb (GtkGestureClick *gesture,
|
||||
guint n_press,
|
||||
double x,
|
||||
double y,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GtkWidget *text_view)
|
||||
{
|
||||
GtkTextIter start, end, iter;
|
||||
@@ -168,8 +168,8 @@ released_cb (GtkGestureClick *gesture,
|
||||
|
||||
static void
|
||||
motion_cb (GtkEventControllerMotion *controller,
|
||||
double x,
|
||||
double y,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GtkTextView *text_view)
|
||||
{
|
||||
set_cursor_if_appropriate (text_view, x, y);
|
||||
@@ -183,8 +183,8 @@ static gboolean hovering_over_link = FALSE;
|
||||
*/
|
||||
static void
|
||||
set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
int x,
|
||||
int y)
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GSList *tags = NULL, *tagp = NULL;
|
||||
GtkTextIter iter;
|
||||
@@ -196,7 +196,7 @@ set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
for (tagp = tags; tagp != NULL; tagp = tagp->next)
|
||||
{
|
||||
GtkTextTag *tag = tagp->data;
|
||||
int page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
|
||||
gint page = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "page"));
|
||||
|
||||
if (page != 0)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ do_hypertext (GtkWidget *do_widget)
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
gtk_text_buffer_set_enable_undo (buffer, TRUE);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
@@ -220,7 +220,7 @@ set_widget_type (int type)
|
||||
tick_cb = gtk_widget_add_tick_callback (window, scroll_cb, NULL, NULL);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
void
|
||||
iconscroll_next_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -235,7 +235,7 @@ iconscroll_next_clicked_cb (GtkButton *source,
|
||||
set_widget_type (new_index);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
void
|
||||
iconscroll_prev_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ iconscroll_prev_clicked_cb (GtkButton *source,
|
||||
set_widget_type (new_index);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT GtkWidget *
|
||||
GtkWidget *
|
||||
do_iconscroll (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
|
@@ -6,6 +6,7 @@
|
||||
<property name="default-height">500</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
|
@@ -25,7 +25,7 @@ enum
|
||||
|
||||
|
||||
static GdkPixbuf *file_pixbuf, *folder_pixbuf;
|
||||
char *parent;
|
||||
gchar *parent;
|
||||
GtkWidget *up_button;
|
||||
|
||||
/* Loads the images for the demo and returns whether the operation succeeded */
|
||||
@@ -47,7 +47,7 @@ static void
|
||||
fill_store (GtkListStore *store)
|
||||
{
|
||||
GDir *dir;
|
||||
const char *name;
|
||||
const gchar *name;
|
||||
GtkTreeIter iter;
|
||||
|
||||
/* First clear the store */
|
||||
@@ -62,7 +62,7 @@ fill_store (GtkListStore *store)
|
||||
name = g_dir_read_name (dir);
|
||||
while (name != NULL)
|
||||
{
|
||||
char *path, *display_name;
|
||||
gchar *path, *display_name;
|
||||
gboolean is_dir;
|
||||
|
||||
/* We ignore hidden files that start with a '.' */
|
||||
@@ -90,14 +90,14 @@ fill_store (GtkListStore *store)
|
||||
g_dir_close (dir);
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
sort_func (GtkTreeModel *model,
|
||||
GtkTreeIter *a,
|
||||
GtkTreeIter *b,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean is_dir_a, is_dir_b;
|
||||
char *name_a, *name_b;
|
||||
gchar *name_a, *name_b;
|
||||
int ret;
|
||||
|
||||
/* We need this function because we want to sort
|
||||
@@ -158,7 +158,7 @@ item_activated (GtkIconView *icon_view,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkListStore *store;
|
||||
char *path;
|
||||
gchar *path;
|
||||
GtkTreeIter iter;
|
||||
gboolean is_dir;
|
||||
|
||||
@@ -192,7 +192,7 @@ up_clicked (GtkButton *item,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkListStore *store;
|
||||
char *dir_name;
|
||||
gchar *dir_name;
|
||||
|
||||
store = GTK_LIST_STORE (user_data);
|
||||
|
||||
@@ -276,7 +276,7 @@ do_iconview (GtkWidget *do_widget)
|
||||
gtk_box_append (GTK_BOX (tool_bar), home_button);
|
||||
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
|
@@ -19,8 +19,8 @@ static void
|
||||
fill_store (GtkListStore *store)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
const char *text[] = { "Red", "Green", "Blue", "Yellow" };
|
||||
int i;
|
||||
const gchar *text[] = { "Red", "Green", "Blue", "Yellow" };
|
||||
gint i;
|
||||
|
||||
/* First clear the store */
|
||||
gtk_list_store_clear (store);
|
||||
@@ -49,7 +49,7 @@ set_cell_color (GtkCellLayout *cell_layout,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
char *text;
|
||||
gchar *text;
|
||||
GdkRGBA color;
|
||||
guint32 pixel = 0;
|
||||
GdkPixbuf *pixbuf;
|
||||
@@ -60,10 +60,10 @@ set_cell_color (GtkCellLayout *cell_layout,
|
||||
|
||||
if (gdk_rgba_parse (&color, text))
|
||||
pixel =
|
||||
((int)(color.red * 255)) << 24 |
|
||||
((int)(color.green * 255)) << 16 |
|
||||
((int)(color.blue * 255)) << 8 |
|
||||
((int)(color.alpha * 255));
|
||||
((gint)(color.red * 255)) << 24 |
|
||||
((gint)(color.green * 255)) << 16 |
|
||||
((gint)(color.blue * 255)) << 8 |
|
||||
((gint)(color.alpha * 255));
|
||||
|
||||
g_free (text);
|
||||
|
||||
@@ -77,8 +77,8 @@ set_cell_color (GtkCellLayout *cell_layout,
|
||||
|
||||
static void
|
||||
edited (GtkCellRendererText *cell,
|
||||
char *path_string,
|
||||
char *text,
|
||||
gchar *path_string,
|
||||
gchar *text,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
|
@@ -43,10 +43,10 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
|
||||
static void
|
||||
progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
@@ -58,7 +58,7 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
progressive_timeout (gpointer data)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
static void
|
||||
on_bar_response (GtkInfoBar *info_bar,
|
||||
int response_id,
|
||||
gint response_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
static void
|
||||
response_cb (GtkWidget *dialog,
|
||||
int response_id,
|
||||
gint response_id,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
@@ -17,7 +17,7 @@ response_cb (GtkWidget *dialog,
|
||||
|
||||
static gboolean
|
||||
activate_link (GtkWidget *label,
|
||||
const char *uri,
|
||||
const gchar *uri,
|
||||
gpointer data)
|
||||
{
|
||||
if (g_strcmp0 (uri, "keynav") == 0)
|
||||
|
@@ -81,7 +81,7 @@ spinner_timeout (gpointer data)
|
||||
static GtkTreeModel *
|
||||
create_model (void)
|
||||
{
|
||||
int i = 0;
|
||||
gint i = 0;
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
|
||||
@@ -269,7 +269,7 @@ do_list_store (GtkWidget *do_widget)
|
||||
label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
|
@@ -358,7 +358,7 @@ do_listbox (GtkWidget *do_widget)
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
label = gtk_label_new ("Messages from GTK and friends");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
scrolled = gtk_scrolled_window_new ();
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
gtk_box_append (GTK_BOX (vbox), scrolled);
|
||||
|
@@ -26,8 +26,8 @@
|
||||
<property name="margin-end">8</property>
|
||||
<property name="icon-name">image-missing</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="row-span">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
@@ -71,8 +71,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -84,9 +84,12 @@
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="0">Message</property>
|
||||
<property name="wrap">1</property>
|
||||
<accessibility>
|
||||
<role type="static"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -111,8 +114,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -165,8 +168,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -181,17 +184,27 @@
|
||||
<property name="margin-bottom">2</property>
|
||||
<property name="spacing">8</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="n_reshares_label">
|
||||
<property name="label" translatable="0"><b>2</b>
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<child>
|
||||
<object class="GtkLabel" id="n_reshares_label">
|
||||
<property name="label" translatable="0"><b>2</b>
|
||||
Reshares</property>
|
||||
<property name="use-markup">1</property>
|
||||
<property name="use-markup">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label_item"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="n_favorites_label">
|
||||
<property name="label" translatable="0"><b>2</b>
|
||||
<object class="GtkFrame" id="frame2">
|
||||
<child>
|
||||
<object class="GtkLabel" id="n_favorites_label">
|
||||
<property name="label" translatable="0"><b>2</b>
|
||||
FAVORITES</property>
|
||||
<property name="use-markup">1</property>
|
||||
<property name="use-markup">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label_item"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -221,8 +234,8 @@ FAVORITES</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">4</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -166,6 +166,14 @@ do_listview_applauncher (GtkWidget *do_widget)
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_listitem_cb), NULL);
|
||||
|
||||
/* Create the list widget here.
|
||||
*/
|
||||
list = gtk_list_view_new_with_factory (factory);
|
||||
/* We connect the activate signal here. It's the function we defined
|
||||
* above for launching the selected application.
|
||||
*/
|
||||
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
|
||||
|
||||
/* And of course we need to set the data model. Here we call the function
|
||||
* we wrote above that gives us the list of applications. Then we set
|
||||
* it on the list widget.
|
||||
@@ -173,21 +181,14 @@ do_listview_applauncher (GtkWidget *do_widget)
|
||||
* to create as many listitems as it needs to show itself to the user.
|
||||
*/
|
||||
model = create_application_list ();
|
||||
|
||||
/* Create the list widget here.
|
||||
*/
|
||||
list = gtk_list_view_new_with_factory (model, factory);
|
||||
|
||||
/* We connect the activate signal here. It's the function we defined
|
||||
* above for launching the selected application.
|
||||
*/
|
||||
g_signal_connect (list, "activate", G_CALLBACK (activate_cb), NULL);
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (list), model);
|
||||
g_object_unref (model);
|
||||
|
||||
/* List widgets should always be contained in a #GtkScrolledWindow,
|
||||
* because otherwise they might get too large or they might not
|
||||
* be scrollable.
|
||||
*/
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), list);
|
||||
}
|
||||
|
@@ -323,16 +323,16 @@ gtk_clock_init (GtkClock *self)
|
||||
|
||||
static GtkClock *
|
||||
gtk_clock_new (const char *location,
|
||||
GTimeZone *_tz)
|
||||
GTimeZone *_timezone)
|
||||
{
|
||||
GtkClock *result;
|
||||
|
||||
result = g_object_new (GTK_TYPE_CLOCK,
|
||||
"location", location,
|
||||
"timezone", _tz,
|
||||
"timezone", _timezone,
|
||||
NULL);
|
||||
|
||||
g_clear_pointer (&_tz, g_time_zone_unref);
|
||||
g_clear_pointer (&_timezone, g_time_zone_unref);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -463,6 +463,7 @@ do_listview_clocks (GtkWidget *do_widget)
|
||||
GtkWidget *gridview, *sw;
|
||||
GtkListItemFactory *factory;
|
||||
GListModel *model;
|
||||
GtkNoSelection *selection;
|
||||
|
||||
/* This is the normal window setup code every demo does */
|
||||
window = gtk_window_new ();
|
||||
@@ -473,7 +474,7 @@ do_listview_clocks (GtkWidget *do_widget)
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
|
||||
|
||||
/* List widgets go into a scrolled window. Always. */
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
|
||||
/* Create the factory that creates the listitems. Because we
|
||||
@@ -484,12 +485,16 @@ do_listview_clocks (GtkWidget *do_widget)
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_listitem_cb), NULL);
|
||||
|
||||
model = G_LIST_MODEL (gtk_no_selection_new (create_clocks_model ()));
|
||||
gridview = gtk_grid_view_new_with_factory (model, factory);
|
||||
gridview = gtk_grid_view_new_with_factory (factory);
|
||||
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||
|
||||
model = create_clocks_model ();
|
||||
selection = gtk_no_selection_new (model);
|
||||
gtk_grid_view_set_model (GTK_GRID_VIEW (gridview), G_LIST_MODEL (selection));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), gridview);
|
||||
g_object_unref (selection);
|
||||
g_object_unref (model);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -1,17 +1,12 @@
|
||||
/* Lists/Colors
|
||||
*
|
||||
* This demo displays a grid of colors.
|
||||
* This demo displays a list of named colors.
|
||||
*
|
||||
* It is using a GtkGridView, and shows how to display
|
||||
* and sort the data in various ways. The controls for
|
||||
* this are implemented using GtkDropDown.
|
||||
*
|
||||
* The dataset used here has up to 16 777 216 items.
|
||||
*
|
||||
* Note that this demo also functions as a performance
|
||||
* test for some of the list model machinery, and the
|
||||
* biggest sizes here can lock up the application for
|
||||
* extended times when used with sorting.
|
||||
* The dataset used here has 9 283 items.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -30,6 +25,7 @@ struct _GtkColor
|
||||
char *name;
|
||||
GdkRGBA color;
|
||||
int h, s, v;
|
||||
gboolean selected;
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -42,6 +38,7 @@ enum {
|
||||
PROP_HUE,
|
||||
PROP_SATURATION,
|
||||
PROP_VALUE,
|
||||
PROP_SELECTED,
|
||||
|
||||
N_COLOR_PROPS
|
||||
};
|
||||
@@ -89,14 +86,14 @@ static GParamSpec *color_properties[N_COLOR_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
rgb_to_hsv (GdkRGBA *rgba,
|
||||
double *h_out,
|
||||
double *s_out,
|
||||
double *v_out)
|
||||
gdouble *h_out,
|
||||
gdouble *s_out,
|
||||
gdouble *v_out)
|
||||
{
|
||||
double red, green, blue;
|
||||
double h, s, v;
|
||||
double min, max;
|
||||
double delta;
|
||||
gdouble red, green, blue;
|
||||
gdouble h, s, v;
|
||||
gdouble min, max;
|
||||
gdouble delta;
|
||||
|
||||
red = rgba->red;
|
||||
green = rgba->green;
|
||||
@@ -204,6 +201,10 @@ gtk_color_get_property (GObject *object,
|
||||
g_value_set_int (value, self->v);
|
||||
break;
|
||||
|
||||
case PROP_SELECTED:
|
||||
g_value_set_boolean (value, self->selected);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@@ -226,13 +227,17 @@ gtk_color_set_property (GObject *object,
|
||||
break;
|
||||
|
||||
case PROP_COLOR:
|
||||
self->color = *(GdkRGBA *) g_value_get_boxed (value);
|
||||
self->color = *(GdkRGBA *) g_value_dup_boxed (value);
|
||||
rgb_to_hsv (&self->color, &h, &s, &v);
|
||||
self->h = round (360 * h);
|
||||
self->s = round (100 * s);
|
||||
self->v = round (100 * v);
|
||||
break;
|
||||
|
||||
case PROP_SELECTED:
|
||||
self->selected = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
@@ -274,6 +279,8 @@ gtk_color_class_init (GtkColorClass *klass)
|
||||
g_param_spec_int ("saturation", NULL, NULL, 0, 100, 0, G_PARAM_READABLE);
|
||||
color_properties[PROP_VALUE] =
|
||||
g_param_spec_int ("value", NULL, NULL, 0, 100, 0, G_PARAM_READABLE);
|
||||
color_properties[PROP_SELECTED] =
|
||||
g_param_spec_boolean ("selected", NULL, NULL, FALSE, G_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_COLOR_PROPS, color_properties);
|
||||
}
|
||||
@@ -627,23 +634,6 @@ setup_listitem_cb (GtkListItemFactory *factory,
|
||||
gtk_expression_unref (color_expression);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_selection_listitem_cb (GtkListItemFactory *factory,
|
||||
GtkListItem *list_item)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
GtkExpression *color_expression, *expression;
|
||||
|
||||
expression = gtk_constant_expression_new (GTK_TYPE_LIST_ITEM, list_item);
|
||||
color_expression = gtk_property_expression_new (GTK_TYPE_LIST_ITEM, expression, "item");
|
||||
|
||||
picture = gtk_picture_new ();
|
||||
gtk_widget_set_size_request (picture, 8, 8);
|
||||
gtk_expression_bind (color_expression, picture, "paintable", NULL);
|
||||
|
||||
gtk_list_item_set_child (list_item, picture);
|
||||
}
|
||||
|
||||
static void
|
||||
set_title (gpointer item,
|
||||
const char *title)
|
||||
@@ -662,8 +652,9 @@ create_color_grid (void)
|
||||
{
|
||||
GtkWidget *gridview;
|
||||
GtkListItemFactory *factory;
|
||||
GListModel *model, *selection;
|
||||
|
||||
gridview = gtk_grid_view_new (NULL);
|
||||
gridview = gtk_grid_view_new ();
|
||||
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
|
||||
|
||||
@@ -675,6 +666,13 @@ create_color_grid (void)
|
||||
gtk_grid_view_set_max_columns (GTK_GRID_VIEW (gridview), 24);
|
||||
gtk_grid_view_set_enable_rubberband (GTK_GRID_VIEW (gridview), TRUE);
|
||||
|
||||
model = G_LIST_MODEL (gtk_sort_list_model_new (gtk_color_list_new (0), NULL));
|
||||
|
||||
selection = G_LIST_MODEL (gtk_property_selection_new (model, "selected"));
|
||||
gtk_grid_view_set_model (GTK_GRID_VIEW (gridview), selection);
|
||||
g_object_unref (selection);
|
||||
g_object_unref (model);
|
||||
|
||||
return gridview;
|
||||
}
|
||||
|
||||
@@ -724,17 +722,16 @@ limit_changed_cb2 (GtkDropDown *dropdown,
|
||||
GParamSpec *pspec,
|
||||
GtkLabel *label)
|
||||
{
|
||||
gpointer item;
|
||||
char *string;
|
||||
int len;
|
||||
guint limit;
|
||||
|
||||
limit = 1 << (3 * (gtk_drop_down_get_selected (dropdown) + 1));
|
||||
|
||||
string = g_strdup_printf ("%'u", limit);
|
||||
item = gtk_drop_down_get_selected_item (dropdown);
|
||||
g_object_get (item, "string", &string, NULL);
|
||||
len = g_utf8_strlen (string, -1);
|
||||
g_free (string);
|
||||
|
||||
gtk_label_set_width_chars (label, len + 2); /* for " /" */
|
||||
gtk_label_set_max_width_chars (label, len + 2); /* for " /" */
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -747,101 +744,11 @@ items_changed_cb (GListModel *model,
|
||||
guint n = g_list_model_get_n_items (model);
|
||||
char *text;
|
||||
|
||||
text = g_strdup_printf ("%'u /", n);
|
||||
text = g_strdup_printf ("%u /", n);
|
||||
gtk_label_set_label (GTK_LABEL (label), text);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_number_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkWidget *label;
|
||||
PangoAttrList *attrs;
|
||||
|
||||
label = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 1);
|
||||
|
||||
attrs = pango_attr_list_new ();
|
||||
pango_attr_list_insert (attrs, pango_attr_font_features_new ("tnum"));
|
||||
gtk_label_set_attributes (GTK_LABEL (label), attrs);
|
||||
pango_attr_list_unref (attrs);
|
||||
|
||||
gtk_list_item_set_child (item, label);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_number_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkWidget *label;
|
||||
guint limit;
|
||||
char *string;
|
||||
|
||||
label = gtk_list_item_get_child (item);
|
||||
|
||||
limit = 1 << (3 * (gtk_list_item_get_position (item) + 1));
|
||||
string = g_strdup_printf ("%'u", limit);
|
||||
gtk_label_set_label (GTK_LABEL (label), string);
|
||||
g_free (string);
|
||||
}
|
||||
|
||||
static void
|
||||
update_selection_count (GListModel *model,
|
||||
guint position,
|
||||
guint removed,
|
||||
guint added,
|
||||
gpointer data)
|
||||
{
|
||||
char *text;
|
||||
text = g_strdup_printf ("%u", g_list_model_get_n_items (model));
|
||||
gtk_label_set_label (GTK_LABEL (data), text);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
update_selection_average (GListModel *model,
|
||||
guint position,
|
||||
guint removed,
|
||||
guint added,
|
||||
gpointer data)
|
||||
{
|
||||
guint n = g_list_model_get_n_items (model);
|
||||
GdkRGBA c = { 0, 0, 0, 1 };
|
||||
guint i;
|
||||
GtkColor *color;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
color = g_list_model_get_item (model, i);
|
||||
|
||||
c.red += color->color.red;
|
||||
c.green += color->color.green;
|
||||
c.blue += color->color.blue;
|
||||
|
||||
g_object_unref (color);
|
||||
}
|
||||
|
||||
color = gtk_color_new ("", c.red / n, c.green / n, c.blue / n);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (data), GDK_PAINTABLE (color));
|
||||
g_object_unref (color);
|
||||
}
|
||||
|
||||
static void
|
||||
update_progress_cb (GtkSortListModel *model,
|
||||
GParamSpec *pspec,
|
||||
GtkProgressBar *progress)
|
||||
{
|
||||
guint total;
|
||||
guint pending;
|
||||
|
||||
total = g_list_model_get_n_items (G_LIST_MODEL (model));
|
||||
total = MAX (total, 1); /* avoid div by 0 below */
|
||||
pending = gtk_sort_list_model_get_pending (model);
|
||||
|
||||
gtk_widget_set_visible (GTK_WIDGET (progress), pending != 0);
|
||||
gtk_progress_bar_set_fraction (progress, (total - pending) / (double) total);
|
||||
}
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
@@ -850,11 +757,10 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
{
|
||||
if (window == NULL)
|
||||
{
|
||||
GtkMultiSelection *selection;
|
||||
GtkSortListModel *sort_model;
|
||||
GtkWidget *header, *overlay, *gridview, *sw, *box, *dropdown;
|
||||
GtkWidget *header, *gridview, *sw, *box, *dropdown;
|
||||
GtkListItemFactory *factory;
|
||||
GListStore *factories;
|
||||
GListModel *model;
|
||||
GtkSorter *sorter;
|
||||
GtkSorter *multi_sorter;
|
||||
GListStore *sorters;
|
||||
@@ -862,33 +768,11 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
GtkWidget *button;
|
||||
GtkWidget *label;
|
||||
PangoAttrList *attrs;
|
||||
char *string;
|
||||
guint len;
|
||||
GtkWidget *selection_view;
|
||||
GListModel *selection_filter;
|
||||
GListModel *no_selection;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *selection_size_label;
|
||||
GtkWidget *selection_average_picture;
|
||||
GtkWidget *selection_info_toggle;
|
||||
GtkWidget *selection_info_revealer;
|
||||
GtkWidget *progress;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/listview_colors/listview_colors.css");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
g_object_unref (provider);
|
||||
|
||||
sort_model = gtk_sort_list_model_new (gtk_color_list_new (0), NULL);
|
||||
gtk_sort_list_model_set_incremental (sort_model, TRUE);
|
||||
selection = gtk_multi_selection_new (G_LIST_MODEL (sort_model));
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Colors");
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
@@ -896,95 +780,18 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer*)&window);
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
gtk_window_set_child (GTK_WINDOW (window), overlay);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), box);
|
||||
|
||||
progress = gtk_progress_bar_new ();
|
||||
gtk_widget_set_hexpand (progress, TRUE);
|
||||
gtk_widget_set_valign (progress, GTK_ALIGN_START);
|
||||
g_signal_connect (sort_model, "notify::pending", G_CALLBACK (update_progress_cb), progress);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), progress);
|
||||
|
||||
selection_info_revealer = gtk_revealer_new ();
|
||||
gtk_box_append (GTK_BOX (box), selection_info_revealer);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_revealer_set_child (GTK_REVEALER (selection_info_revealer), grid);
|
||||
gtk_widget_set_margin_start (grid, 10);
|
||||
gtk_widget_set_margin_end (grid, 10);
|
||||
gtk_widget_set_margin_top (grid, 10);
|
||||
gtk_widget_set_margin_bottom (grid, 10);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
|
||||
|
||||
label = gtk_label_new ("Selection");
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_widget_add_css_class (label, "title-3");
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 5, 1);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Size:"), 0, 2, 1, 1);
|
||||
|
||||
selection_size_label = gtk_label_new ("0");
|
||||
gtk_grid_attach (GTK_GRID (grid), selection_size_label, 1, 2, 1, 1);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), gtk_label_new ("Average:"), 2, 2, 1, 1);
|
||||
|
||||
selection_average_picture = gtk_picture_new ();
|
||||
gtk_widget_set_size_request (selection_average_picture, 32, 32);
|
||||
gtk_grid_attach (GTK_GRID (grid), selection_average_picture, 3, 2, 1, 1);
|
||||
|
||||
label = gtk_label_new ("");
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_grid_attach (GTK_GRID (grid), label, 4, 2, 1, 1);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_widget_set_hexpand (sw, TRUE);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), sw, 0, 1, 5, 1);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_selection_listitem_cb), NULL);
|
||||
selection_view = gtk_grid_view_new_with_factory (NULL, factory);
|
||||
gtk_widget_add_css_class (selection_view, "compact");
|
||||
gtk_grid_view_set_max_columns (GTK_GRID_VIEW (selection_view), 200);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), selection_view);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_box_append (GTK_BOX (box), sw);
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
|
||||
gridview = create_color_grid ();
|
||||
gtk_grid_view_set_model (GTK_GRID_VIEW (gridview), G_LIST_MODEL (selection));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), gridview);
|
||||
gtk_widget_set_hexpand (sw, TRUE);
|
||||
gtk_widget_set_vexpand (sw, TRUE);
|
||||
|
||||
selection_filter = G_LIST_MODEL (gtk_selection_filter_model_new (GTK_SELECTION_MODEL (selection)));
|
||||
g_signal_connect (selection_filter, "items-changed", G_CALLBACK (update_selection_count), selection_size_label);
|
||||
g_signal_connect (selection_filter, "items-changed", G_CALLBACK (update_selection_average), selection_average_picture);
|
||||
|
||||
no_selection = G_LIST_MODEL (gtk_no_selection_new (selection_filter));
|
||||
gtk_grid_view_set_model (GTK_GRID_VIEW (selection_view), no_selection);
|
||||
g_object_unref (no_selection);
|
||||
|
||||
selection_info_toggle = gtk_toggle_button_new ();
|
||||
gtk_button_set_icon_name (GTK_BUTTON (selection_info_toggle), "emblem-important-symbolic");
|
||||
gtk_widget_set_tooltip_text (selection_info_toggle, "Show selection info");
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), selection_info_toggle);
|
||||
|
||||
g_object_bind_property (selection_info_toggle, "active",
|
||||
selection_info_revealer, "reveal-child",
|
||||
G_BINDING_DEFAULT);
|
||||
model = gtk_grid_view_get_model (GTK_GRID_VIEW (gridview));
|
||||
g_object_get (model, "model", &model, NULL);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Refill");
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (refill),
|
||||
gtk_sort_list_model_get_model (sort_model));
|
||||
gtk_sort_list_model_get_model (GTK_SORT_LIST_MODEL (model)));
|
||||
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
|
||||
|
||||
@@ -993,27 +800,20 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
pango_attr_list_insert (attrs, pango_attr_font_features_new ("tnum"));
|
||||
gtk_label_set_attributes (GTK_LABEL (label), attrs);
|
||||
pango_attr_list_unref (attrs);
|
||||
string = g_strdup_printf ("%'u", 4096);
|
||||
len = g_utf8_strlen (string, -1);
|
||||
g_free (string);
|
||||
gtk_label_set_width_chars (GTK_LABEL (label), len + 2);
|
||||
gtk_label_set_width_chars (GTK_LABEL (label), 6);
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 1);
|
||||
|
||||
g_signal_connect (selection, "items-changed", G_CALLBACK (items_changed_cb), label);
|
||||
g_signal_connect (gtk_grid_view_get_model (GTK_GRID_VIEW (gridview)),
|
||||
"items-changed", G_CALLBACK (items_changed_cb), label);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), label);
|
||||
|
||||
dropdown = gtk_drop_down_new_from_strings ((const char * const[]) { "8", "64", "512", "4096", "32768", "262144", "2097152", "16777216", NULL });
|
||||
dropdown = gtk_drop_down_new ();
|
||||
gtk_drop_down_set_from_strings (GTK_DROP_DOWN (dropdown), (const char *[]) { "8", "64", "512", "4096", "32768", "262144", "2097152", "16777216", NULL });
|
||||
g_signal_connect (dropdown, "notify::selected",
|
||||
G_CALLBACK (limit_changed_cb),
|
||||
gtk_sort_list_model_get_model (sort_model));
|
||||
gtk_sort_list_model_get_model (GTK_SORT_LIST_MODEL (model)));
|
||||
g_signal_connect (dropdown, "notify::selected",
|
||||
G_CALLBACK (limit_changed_cb2),
|
||||
label);
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_number_item), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_number_item), NULL);
|
||||
gtk_drop_down_set_factory (GTK_DROP_DOWN (dropdown), factory);
|
||||
g_object_unref (factory);
|
||||
gtk_drop_down_set_selected (GTK_DROP_DOWN (dropdown), 3); /* 4096 */
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), dropdown);
|
||||
|
||||
@@ -1080,19 +880,24 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
g_list_store_append (sorters, multi_sorter);
|
||||
g_object_unref (multi_sorter);
|
||||
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING,
|
||||
NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
|
||||
dropdown = gtk_drop_down_new (G_LIST_MODEL (sorters), expression);
|
||||
dropdown = gtk_drop_down_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_box_append (GTK_BOX (box), gtk_label_new ("Sort by:"));
|
||||
gtk_box_append (GTK_BOX (box), dropdown);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
|
||||
|
||||
g_object_bind_property (dropdown, "selected-item", sort_model, "sorter", G_BINDING_SYNC_CREATE);
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING,
|
||||
NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (dropdown), expression);
|
||||
gtk_expression_unref (expression);
|
||||
|
||||
gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (sorters));
|
||||
g_object_unref (sorters);
|
||||
|
||||
g_object_bind_property (dropdown, "selected-item", model, "sorter", G_BINDING_SYNC_CREATE);
|
||||
|
||||
factories = g_list_store_new (GTK_TYPE_LIST_ITEM_FACTORY);
|
||||
|
||||
@@ -1106,20 +911,25 @@ do_listview_colors (GtkWidget *do_widget)
|
||||
set_title (factory, "Everything");
|
||||
g_list_store_append (factories, factory);
|
||||
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING,
|
||||
NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
dropdown = gtk_drop_down_new (G_LIST_MODEL (factories), expression);
|
||||
dropdown = gtk_drop_down_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_box_append (GTK_BOX (box), gtk_label_new ("Show:"));
|
||||
gtk_box_append (GTK_BOX (box), dropdown);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), box);
|
||||
|
||||
g_object_bind_property (dropdown, "selected-item", gridview, "factory", G_BINDING_SYNC_CREATE);
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING,
|
||||
NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (dropdown), expression);
|
||||
gtk_expression_unref (expression);
|
||||
|
||||
g_object_unref (selection);
|
||||
gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (factories));
|
||||
g_object_unref (factories);
|
||||
|
||||
g_object_bind_property (dropdown, "selected-item", gridview, "factory", G_BINDING_SYNC_CREATE);
|
||||
g_object_unref (model);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -1,3 +0,0 @@
|
||||
.view.compact > child {
|
||||
padding: 1px;
|
||||
}
|
@@ -1,11 +1,11 @@
|
||||
listview.viewswitcher {
|
||||
list.viewswitcher {
|
||||
border: 1px solid gray;
|
||||
}
|
||||
|
||||
listview.viewswitcher > row {
|
||||
list.viewswitcher > row {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
listview.viewswitcher row:selected {
|
||||
list.viewswitcher row:selected {
|
||||
background: gray;
|
||||
}
|
||||
|
@@ -174,6 +174,7 @@
|
||||
<property name="default-height">400</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">go-up-symbolic</property>
|
||||
|
@@ -6,6 +6,7 @@
|
||||
<property name="title" translatable="yes">Minesweeper</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">New Game</property>
|
||||
|
@@ -214,6 +214,8 @@ transform_settings_to_keys (GBinding *binding,
|
||||
GtkSortListModel *sort_model;
|
||||
GtkFilterListModel *filter_model;
|
||||
GtkFilter *filter;
|
||||
GtkNoSelection *selection_model;
|
||||
GtkExpression *expression;
|
||||
char **keys;
|
||||
guint i;
|
||||
|
||||
@@ -241,13 +243,24 @@ transform_settings_to_keys (GBinding *binding,
|
||||
g_object_unref (settings);
|
||||
|
||||
sort_model = gtk_sort_list_model_new (G_LIST_MODEL (store),
|
||||
g_object_ref (gtk_column_view_get_sorter (GTK_COLUMN_VIEW (data))));
|
||||
gtk_column_view_get_sorter (GTK_COLUMN_VIEW (data)));
|
||||
g_object_unref (store);
|
||||
|
||||
filter = gtk_string_filter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name"));
|
||||
g_set_object (¤t_filter, filter);
|
||||
expression = gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name");
|
||||
filter = gtk_string_filter_new ();
|
||||
gtk_string_filter_set_expression (GTK_STRING_FILTER (filter), expression);
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (sort_model), filter);
|
||||
gtk_expression_unref (expression);
|
||||
g_object_unref (sort_model);
|
||||
|
||||
g_value_take_object (to_value, gtk_no_selection_new (G_LIST_MODEL (filter_model)));
|
||||
g_set_object (¤t_filter, filter);
|
||||
|
||||
g_object_unref (filter);
|
||||
|
||||
selection_model = gtk_no_selection_new (G_LIST_MODEL (filter_model));
|
||||
g_object_unref (filter_model);
|
||||
|
||||
g_value_take_object (to_value, selection_model);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -358,8 +371,6 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
g_object_unref (scope);
|
||||
|
||||
gtk_builder_add_from_resource (builder, "/listview_settings/listview_settings.ui", NULL);
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
@@ -396,8 +407,8 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
g_object_unref (actions);
|
||||
|
||||
model = create_settings_model (NULL, NULL);
|
||||
treemodel = gtk_tree_list_model_new (model,
|
||||
FALSE,
|
||||
treemodel = gtk_tree_list_model_new (FALSE,
|
||||
model,
|
||||
TRUE,
|
||||
create_settings_model,
|
||||
NULL,
|
||||
@@ -411,6 +422,8 @@ do_listview_settings (GtkWidget *do_widget)
|
||||
columnview, NULL);
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (listview), G_LIST_MODEL (selection));
|
||||
g_object_unref (selection);
|
||||
g_object_unref (treemodel);
|
||||
g_object_unref (model);
|
||||
|
||||
name_column = GTK_COLUMN_VIEW_COLUMN (gtk_builder_get_object (builder, "name_column"));
|
||||
sorter = gtk_string_sorter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name"));
|
||||
|
@@ -6,6 +6,7 @@
|
||||
<property name="default-height">480</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="search_button">
|
||||
<property name="icon-name">system-search-symbolic</property>
|
||||
|
@@ -77,13 +77,13 @@ gtk_weather_info_new (GDateTime *timestamp,
|
||||
|
||||
static GDateTime *
|
||||
parse_timestamp (const char *string,
|
||||
GTimeZone *_tz)
|
||||
GTimeZone *_timezone)
|
||||
{
|
||||
char *with_seconds;
|
||||
GDateTime *result;
|
||||
|
||||
with_seconds = g_strconcat (string, ":00", NULL);
|
||||
result = g_date_time_new_from_iso8601 (with_seconds, _tz);
|
||||
result = g_date_time_new_from_iso8601 (with_seconds, _timezone);
|
||||
g_free (with_seconds);
|
||||
|
||||
return result;
|
||||
@@ -194,8 +194,8 @@ create_weather_model (void)
|
||||
}
|
||||
|
||||
static void
|
||||
setup_widget (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *list_item)
|
||||
setup_widget (GtkListItem *list_item,
|
||||
gpointer unused)
|
||||
{
|
||||
GtkWidget *box, *child;
|
||||
|
||||
@@ -218,8 +218,8 @@ setup_widget (GtkSignalListItemFactory *factory,
|
||||
}
|
||||
|
||||
static void
|
||||
bind_widget (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *list_item)
|
||||
bind_widget (GtkListItem *list_item,
|
||||
gpointer unused)
|
||||
{
|
||||
GtkWidget *box, *child;
|
||||
GtkWeatherInfo *info;
|
||||
@@ -281,16 +281,19 @@ GtkWidget *
|
||||
create_weather_view (void)
|
||||
{
|
||||
GtkWidget *listview;
|
||||
GListModel *model;
|
||||
GtkListItemFactory *factory;
|
||||
GListModel *model, *selection;
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_widget), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_widget), NULL);
|
||||
model = G_LIST_MODEL (gtk_no_selection_new (create_weather_model ()));
|
||||
listview = gtk_list_view_new_with_factory (model, factory);
|
||||
listview = gtk_list_view_new_with_factory (
|
||||
gtk_functions_list_item_factory_new (setup_widget,
|
||||
bind_widget,
|
||||
NULL, NULL));
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (listview), GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_list_view_set_show_separators (GTK_LIST_VIEW (listview), TRUE);
|
||||
model = create_weather_model ();
|
||||
selection = G_LIST_MODEL (gtk_no_selection_new (model));
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (listview), selection);
|
||||
g_object_unref (selection);
|
||||
g_object_unref (model);
|
||||
|
||||
return listview;
|
||||
}
|
||||
@@ -310,7 +313,7 @@ do_listview_weather (GtkWidget *do_widget)
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Weather");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
listview = create_weather_view ();
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
|
||||
|
@@ -1,238 +0,0 @@
|
||||
/* Lists/Words
|
||||
*
|
||||
* This demo shows filtering a long list - of words.
|
||||
*
|
||||
* You should have the file `/usr/share/dict/words` installed for
|
||||
* this demo to work.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *progress;
|
||||
|
||||
const char *factory_text =
|
||||
"<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||
"<interface>\n"
|
||||
" <template class='GtkListItem'>\n"
|
||||
" <property name='child'>\n"
|
||||
" <object class='GtkLabel'>\n"
|
||||
" <property name='ellipsize'>end</property>\n"
|
||||
" <property name='xalign'>0</property>\n"
|
||||
" <binding name='label'>\n"
|
||||
" <lookup name='string' type='GtkStringObject'>\n"
|
||||
" <lookup name='item'>GtkListItem</lookup>\n"
|
||||
" </lookup>\n"
|
||||
" </binding>\n"
|
||||
" </object>\n"
|
||||
" </property>\n"
|
||||
" </template>\n"
|
||||
"</interface>\n";
|
||||
|
||||
static void
|
||||
update_title_cb (GtkFilterListModel *model)
|
||||
{
|
||||
guint total;
|
||||
char *title;
|
||||
guint pending;
|
||||
|
||||
total = g_list_model_get_n_items (gtk_filter_list_model_get_model (model));
|
||||
pending = gtk_filter_list_model_get_pending (model);
|
||||
|
||||
title = g_strdup_printf ("%u lines", g_list_model_get_n_items (G_LIST_MODEL (model)));
|
||||
|
||||
gtk_widget_set_visible (progress, pending != 0);
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), (total - pending) / (double) total);
|
||||
gtk_window_set_title (GTK_WINDOW (window), title);
|
||||
g_free (title);
|
||||
}
|
||||
|
||||
static void
|
||||
read_lines_cb (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GBufferedInputStream *stream = G_BUFFERED_INPUT_STREAM (object);
|
||||
GtkStringList *stringlist = data;
|
||||
GError *error = NULL;
|
||||
gsize size;
|
||||
GPtrArray *lines;
|
||||
gssize n_filled;
|
||||
const char *buffer, *newline;
|
||||
|
||||
n_filled = g_buffered_input_stream_fill_finish (stream, result, &error);
|
||||
if (n_filled < 0)
|
||||
{
|
||||
g_print ("Could not read data: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
g_object_unref (stringlist);
|
||||
return;
|
||||
}
|
||||
|
||||
buffer = g_buffered_input_stream_peek_buffer (stream, &size);
|
||||
|
||||
if (n_filled == 0)
|
||||
{
|
||||
if (size)
|
||||
gtk_string_list_take (stringlist, g_utf8_make_valid (buffer, size));
|
||||
g_object_unref (stringlist);
|
||||
return;
|
||||
}
|
||||
|
||||
lines = NULL;
|
||||
while ((newline = memchr (buffer, '\n', size)))
|
||||
{
|
||||
if (newline > buffer)
|
||||
{
|
||||
if (lines == NULL)
|
||||
lines = g_ptr_array_new_with_free_func (g_free);
|
||||
g_ptr_array_add (lines, g_utf8_make_valid (buffer, newline - buffer));
|
||||
}
|
||||
if (g_input_stream_skip (G_INPUT_STREAM (stream), newline - buffer + 1, NULL, &error) < 0)
|
||||
{
|
||||
g_clear_error (&error);
|
||||
break;
|
||||
}
|
||||
buffer = g_buffered_input_stream_peek_buffer (stream, &size);
|
||||
}
|
||||
if (lines == NULL)
|
||||
{
|
||||
g_buffered_input_stream_set_buffer_size (stream, g_buffered_input_stream_get_buffer_size (stream) + 4096);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_ptr_array_add (lines, NULL);
|
||||
gtk_string_list_splice (stringlist, g_list_model_get_n_items (G_LIST_MODEL (stringlist)), 0, (const char **) lines->pdata);
|
||||
g_ptr_array_free (lines, TRUE);
|
||||
}
|
||||
|
||||
g_buffered_input_stream_fill_async (stream, -1, G_PRIORITY_HIGH_IDLE, NULL, read_lines_cb, data);
|
||||
}
|
||||
|
||||
static void
|
||||
file_is_open_cb (GObject *file,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GFileInputStream *file_stream;
|
||||
GBufferedInputStream *stream;
|
||||
|
||||
file_stream = g_file_read_finish (G_FILE (file), result, &error);
|
||||
if (file_stream == NULL)
|
||||
{
|
||||
g_print ("Could not open file: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
g_object_unref (data);
|
||||
return;
|
||||
}
|
||||
|
||||
stream = G_BUFFERED_INPUT_STREAM (g_buffered_input_stream_new (G_INPUT_STREAM (file_stream)));
|
||||
g_buffered_input_stream_fill_async (stream, -1, G_PRIORITY_HIGH_IDLE, NULL, read_lines_cb, data);
|
||||
g_object_unref (stream);
|
||||
}
|
||||
|
||||
static void
|
||||
load_file (GtkStringList *list,
|
||||
GFile *file)
|
||||
{
|
||||
gtk_string_list_splice (list, 0, g_list_model_get_n_items (G_LIST_MODEL (list)), NULL);
|
||||
g_file_read_async (file, G_PRIORITY_HIGH_IDLE, NULL, file_is_open_cb, g_object_ref (list));
|
||||
}
|
||||
|
||||
static void
|
||||
file_selected_cb (GtkWidget *button,
|
||||
GtkStringList *stringlist)
|
||||
{
|
||||
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
|
||||
|
||||
if (file)
|
||||
{
|
||||
load_file (stringlist, file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_listview_words (GtkWidget *do_widget)
|
||||
{
|
||||
if (window == NULL)
|
||||
{
|
||||
GtkWidget *header, *listview, *sw, *vbox, *search_entry, *open_button, *overlay;
|
||||
GtkFilterListModel *filter_model;
|
||||
GtkStringList *stringlist;
|
||||
GtkFilter *filter;
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_path ("/usr/share/dict/words");
|
||||
if (g_file_query_exists (file, NULL))
|
||||
{
|
||||
stringlist = gtk_string_list_new (NULL);
|
||||
load_file (stringlist, file);
|
||||
}
|
||||
else
|
||||
{
|
||||
char **words;
|
||||
words = g_strsplit ("lorem ipsum dolor sit amet consectetur adipisci elit sed eiusmod tempor incidunt labore et dolore magna aliqua ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat", " ", -1);
|
||||
stringlist = gtk_string_list_new ((const char **) words);
|
||||
g_strfreev (words);
|
||||
}
|
||||
g_object_unref (file);
|
||||
|
||||
filter = gtk_string_filter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string"));
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (stringlist), filter);
|
||||
gtk_filter_list_model_set_incremental (filter_model, TRUE);
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
open_button = gtk_file_chooser_button_new ("_Open", GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
g_signal_connect (open_button, "file-set", G_CALLBACK (file_selected_cb), stringlist);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), open_button);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer*)&window);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
search_entry = gtk_search_entry_new ();
|
||||
g_object_bind_property (search_entry, "text", filter, "search", 0);
|
||||
gtk_box_append (GTK_BOX (vbox), search_entry);
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
gtk_box_append (GTK_BOX (vbox), overlay);
|
||||
|
||||
progress = gtk_progress_bar_new ();
|
||||
gtk_widget_set_halign (progress, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (progress, GTK_ALIGN_START);
|
||||
gtk_widget_set_hexpand (progress, TRUE);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), progress);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_widget_set_vexpand (sw, TRUE);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
|
||||
|
||||
listview = gtk_list_view_new_with_factory (
|
||||
G_LIST_MODEL (gtk_no_selection_new (G_LIST_MODEL (filter_model))),
|
||||
gtk_builder_list_item_factory_new_from_bytes (NULL,
|
||||
g_bytes_new_static (factory_text, strlen (factory_text))));
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
|
||||
|
||||
g_signal_connect (filter_model, "items-changed", G_CALLBACK (update_title_cb), progress);
|
||||
g_signal_connect (filter_model, "notify::pending", G_CALLBACK (update_title_cb), progress);
|
||||
update_title_cb (filter_model);
|
||||
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
return window;
|
||||
}
|
@@ -13,12 +13,11 @@
|
||||
static GtkWidget *info_view;
|
||||
static GtkWidget *source_view;
|
||||
|
||||
static char *current_file = NULL;
|
||||
static gchar *current_file = NULL;
|
||||
|
||||
static GtkWidget *notebook;
|
||||
static GtkSingleSelection *selection;
|
||||
static GtkWidget *toplevel;
|
||||
static char **search_needle;
|
||||
|
||||
typedef struct _GtkDemo GtkDemo;
|
||||
struct _GtkDemo
|
||||
@@ -134,28 +133,22 @@ gtk_demo_run (GtkDemo *self,
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
activate_about (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
const char *authors[] = {
|
||||
const gchar *authors[] = {
|
||||
"The GTK Team",
|
||||
NULL
|
||||
};
|
||||
char *version;
|
||||
char *os_name;
|
||||
char *os_version;
|
||||
GString *s;
|
||||
|
||||
s = g_string_new ("");
|
||||
|
||||
os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
|
||||
os_version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID);
|
||||
if (os_name && os_version)
|
||||
g_string_append_printf (s, "OS\t%s %s\n\n", os_name, os_version);
|
||||
g_string_append (s, "System libraries\n");
|
||||
g_string_append_printf (s, "\tGLib\t%d.%d.%d\n",
|
||||
glib_major_version,
|
||||
@@ -190,8 +183,6 @@ activate_about (GSimpleAction *action,
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
g_free (version);
|
||||
g_free (os_name);
|
||||
g_free (os_version);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -234,128 +225,391 @@ activate_run (GSimpleAction *action,
|
||||
gtk_demo_run (demo, window);
|
||||
}
|
||||
|
||||
static GBytes *
|
||||
fontify_text (const char *format,
|
||||
const char *text)
|
||||
/* Stupid syntax highlighting.
|
||||
*
|
||||
* No regex was used in the making of this highlighting.
|
||||
* It should only work for simple cases. This is good, as
|
||||
* that's all we should have in the demos.
|
||||
*/
|
||||
/* This code should not be used elsewhere, except perhaps as an example of how
|
||||
* to iterate through a text buffer.
|
||||
*/
|
||||
enum {
|
||||
STATE_NORMAL,
|
||||
STATE_IN_COMMENT
|
||||
};
|
||||
|
||||
static const char *tokens[] =
|
||||
{
|
||||
GSubprocess *subprocess;
|
||||
GBytes *stdin_buf;
|
||||
GBytes *stdout_buf = NULL;
|
||||
GBytes *stderr_buf = NULL;
|
||||
GError *error = NULL;
|
||||
char *format_arg;
|
||||
"/*",
|
||||
"\"",
|
||||
NULL
|
||||
};
|
||||
|
||||
format_arg = g_strconcat ("--syntax=", format, NULL);
|
||||
subprocess = g_subprocess_new (G_SUBPROCESS_FLAGS_STDIN_PIPE |
|
||||
G_SUBPROCESS_FLAGS_STDOUT_PIPE |
|
||||
G_SUBPROCESS_FLAGS_STDERR_PIPE,
|
||||
&error,
|
||||
"highlight",
|
||||
format_arg,
|
||||
"--out-format=pango",
|
||||
NULL);
|
||||
g_free (format_arg);
|
||||
static const char *types[] =
|
||||
{
|
||||
"static",
|
||||
"const ",
|
||||
"void",
|
||||
"gint",
|
||||
" int ",
|
||||
" char ",
|
||||
"gchar ",
|
||||
"gfloat",
|
||||
"float",
|
||||
"double",
|
||||
"gint8",
|
||||
"gint16",
|
||||
"gint32",
|
||||
"guint",
|
||||
"guint8",
|
||||
"guint16",
|
||||
"guint32",
|
||||
"guchar",
|
||||
"glong",
|
||||
"gboolean" ,
|
||||
"gshort",
|
||||
"gushort",
|
||||
"gulong",
|
||||
"gdouble",
|
||||
"gldouble",
|
||||
"gpointer",
|
||||
"NULL",
|
||||
"GList",
|
||||
"GSList",
|
||||
"FALSE",
|
||||
"TRUE",
|
||||
"FILE ",
|
||||
"GtkColorSelection ",
|
||||
"GtkWidget ",
|
||||
"GtkButton ",
|
||||
"GdkColor ",
|
||||
"GdkRectangle ",
|
||||
"GdkEventExpose ",
|
||||
"GdkGC ",
|
||||
"GdkPixbufLoader ",
|
||||
"GdkPixbuf ",
|
||||
"GError",
|
||||
"size_t",
|
||||
"GtkAboutDialog ",
|
||||
"GtkAction ",
|
||||
"GtkActionEntry ",
|
||||
"GtkRadioActionEntry ",
|
||||
"GtkIconFactory ",
|
||||
"GtkTextBuffer ",
|
||||
"GtkStatusbar ",
|
||||
"GtkTextIter ",
|
||||
"GtkTextMark ",
|
||||
"GdkEventWindowState ",
|
||||
"GtkActionGroup ",
|
||||
"GtkUIManager ",
|
||||
"GtkRadioAction ",
|
||||
"GtkActionClass ",
|
||||
"GtkToggleActionEntry ",
|
||||
"GtkAssistant ",
|
||||
"GtkBuilder ",
|
||||
"GtkSizeGroup ",
|
||||
"GtkTreeModel ",
|
||||
"GtkTreeSelection ",
|
||||
"GdkDisplay ",
|
||||
"GdkScreen ",
|
||||
"GdkSurface ",
|
||||
"GdkEventButton ",
|
||||
"GdkCursor ",
|
||||
"GtkTreeIter ",
|
||||
"GtkTreeViewColumn ",
|
||||
"GdkDisplayManager ",
|
||||
"GdkClipboard ",
|
||||
"GtkIconSize ",
|
||||
"GtkImage ",
|
||||
"GdkDragContext ",
|
||||
"GtkSelectionData ",
|
||||
"GtkDialog ",
|
||||
"GtkMenuItem ",
|
||||
"GtkListStore ",
|
||||
"GtkCellLayout ",
|
||||
"GtkCellRenderer ",
|
||||
"GtkTreePath ",
|
||||
"GtkTreeStore ",
|
||||
"GtkEntry ",
|
||||
"GtkEditable ",
|
||||
"GtkEditableInterface ",
|
||||
"GdkPixmap ",
|
||||
"GdkEventConfigure ",
|
||||
"GdkEventMotion ",
|
||||
"GdkModifierType ",
|
||||
"GtkEntryCompletion ",
|
||||
"GtkToolItem ",
|
||||
"GDir ",
|
||||
"GtkIconView ",
|
||||
"GtkCellRendererText ",
|
||||
"GtkContainer ",
|
||||
"GtkPaned ",
|
||||
"GtkPrintOperation ",
|
||||
"GtkPrintContext ",
|
||||
"cairo_t ",
|
||||
"PangoLayout "
|
||||
"PangoFontDescription ",
|
||||
"PangoRenderer ",
|
||||
"PangoMatrix ",
|
||||
"PangoContext ",
|
||||
"PangoLayout ",
|
||||
"GtkToggleButton ",
|
||||
"GString ",
|
||||
"GtkIconSize ",
|
||||
"GtkTreeView ",
|
||||
"GtkTextTag ",
|
||||
"GdkEvent ",
|
||||
"GdkEventKey ",
|
||||
"GtkTextView ",
|
||||
"GdkBitmap ",
|
||||
"GtkTextChildAnchor ",
|
||||
"GArray ",
|
||||
"GtkCellEditable ",
|
||||
"GtkCellRendererToggle ",
|
||||
NULL
|
||||
};
|
||||
|
||||
if (!subprocess)
|
||||
static const char *control[] =
|
||||
{
|
||||
" if ",
|
||||
" while ",
|
||||
" else",
|
||||
" do ",
|
||||
" for ",
|
||||
"?",
|
||||
":",
|
||||
"return ",
|
||||
"goto ",
|
||||
NULL
|
||||
};
|
||||
void
|
||||
parse_chars (gchar *text,
|
||||
gchar **end_ptr,
|
||||
gint *state,
|
||||
const char **tag,
|
||||
gboolean start)
|
||||
{
|
||||
gint i;
|
||||
gchar *next_token;
|
||||
|
||||
/* Handle comments first */
|
||||
if (*state == STATE_IN_COMMENT)
|
||||
{
|
||||
if (g_error_matches (error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
|
||||
*end_ptr = strstr (text, "*/");
|
||||
if (*end_ptr)
|
||||
{
|
||||
static gboolean warned = FALSE;
|
||||
|
||||
if (!warned)
|
||||
{
|
||||
warned = TRUE;
|
||||
g_message ("For syntax highlighting, install the “highlight” program");
|
||||
}
|
||||
*end_ptr += 2;
|
||||
*state = STATE_NORMAL;
|
||||
*tag = "comment";
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
*tag = NULL;
|
||||
*end_ptr = NULL;
|
||||
|
||||
/* check for comment */
|
||||
if (!strncmp (text, "/*", 2))
|
||||
{
|
||||
*end_ptr = strstr (text, "*/");
|
||||
if (*end_ptr)
|
||||
*end_ptr += 2;
|
||||
else
|
||||
g_warning ("%s", error->message);
|
||||
|
||||
g_clear_error (&error);
|
||||
|
||||
return NULL;
|
||||
*state = STATE_IN_COMMENT;
|
||||
*tag = "comment";
|
||||
return;
|
||||
}
|
||||
|
||||
stdin_buf = g_bytes_new_static (text, strlen (text));
|
||||
|
||||
if (!g_subprocess_communicate (subprocess,
|
||||
stdin_buf,
|
||||
NULL,
|
||||
&stdout_buf,
|
||||
&stderr_buf,
|
||||
&error))
|
||||
/* check for preprocessor defines */
|
||||
if (*text == '#' && start)
|
||||
{
|
||||
g_clear_pointer (&stdin_buf, g_bytes_unref);
|
||||
g_clear_pointer (&stdout_buf, g_bytes_unref);
|
||||
g_clear_pointer (&stderr_buf, g_bytes_unref);
|
||||
|
||||
g_warning ("%s", error->message);
|
||||
g_clear_error (&error);
|
||||
|
||||
return NULL;
|
||||
*end_ptr = NULL;
|
||||
*tag = "preprocessor";
|
||||
return;
|
||||
}
|
||||
|
||||
g_bytes_unref (stdin_buf);
|
||||
|
||||
if (g_subprocess_get_exit_status (subprocess) != 0)
|
||||
/* functions */
|
||||
if (start && * text != '\t' && *text != ' ' && *text != '{' && *text != '}')
|
||||
{
|
||||
if (stderr_buf)
|
||||
g_warning ("%s", (char *)g_bytes_get_data (stderr_buf, NULL));
|
||||
if (strstr (text, "("))
|
||||
{
|
||||
*end_ptr = strstr (text, "(");
|
||||
*tag = "function";
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* check for types */
|
||||
for (i = 0; types[i] != NULL; i++)
|
||||
if (!strncmp (text, types[i], strlen (types[i])) ||
|
||||
(start && types[i][0] == ' ' && !strncmp (text, types[i] + 1, strlen (types[i]) - 1)))
|
||||
{
|
||||
*end_ptr = text + strlen (types[i]);
|
||||
*tag = "type";
|
||||
return;
|
||||
}
|
||||
|
||||
g_clear_pointer (&stdout_buf, g_bytes_unref);
|
||||
/* check for control */
|
||||
for (i = 0; control[i] != NULL; i++)
|
||||
if (!strncmp (text, control[i], strlen (control[i])))
|
||||
{
|
||||
*end_ptr = text + strlen (control[i]);
|
||||
*tag = "control";
|
||||
return;
|
||||
}
|
||||
|
||||
/* check for string */
|
||||
if (text[0] == '"')
|
||||
{
|
||||
gint maybe_escape = FALSE;
|
||||
|
||||
*end_ptr = text + 1;
|
||||
*tag = "string";
|
||||
while (**end_ptr != '\000')
|
||||
{
|
||||
if (**end_ptr == '\"' && !maybe_escape)
|
||||
{
|
||||
*end_ptr += 1;
|
||||
return;
|
||||
}
|
||||
if (**end_ptr == '\\')
|
||||
maybe_escape = TRUE;
|
||||
else
|
||||
maybe_escape = FALSE;
|
||||
*end_ptr += 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
g_clear_pointer (&stderr_buf, g_bytes_unref);
|
||||
/* not at the start of a tag. Find the next one. */
|
||||
for (i = 0; tokens[i] != NULL; i++)
|
||||
{
|
||||
next_token = strstr (text, tokens[i]);
|
||||
if (next_token)
|
||||
{
|
||||
if (*end_ptr)
|
||||
*end_ptr = (*end_ptr<next_token)?*end_ptr:next_token;
|
||||
else
|
||||
*end_ptr = next_token;
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (subprocess);
|
||||
for (i = 0; types[i] != NULL; i++)
|
||||
{
|
||||
next_token = strstr (text, types[i]);
|
||||
if (next_token)
|
||||
{
|
||||
if (*end_ptr)
|
||||
*end_ptr = (*end_ptr<next_token)?*end_ptr:next_token;
|
||||
else
|
||||
*end_ptr = next_token;
|
||||
}
|
||||
}
|
||||
|
||||
return stdout_buf;
|
||||
for (i = 0; control[i] != NULL; i++)
|
||||
{
|
||||
next_token = strstr (text, control[i]);
|
||||
if (next_token)
|
||||
{
|
||||
if (*end_ptr)
|
||||
*end_ptr = (*end_ptr<next_token)?*end_ptr:next_token;
|
||||
else
|
||||
*end_ptr = next_token;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* While not as cool as c-mode, this will do as a quick attempt at highlighting */
|
||||
void
|
||||
fontify (const char *format,
|
||||
GtkTextBuffer *source_buffer)
|
||||
fontify (GtkTextBuffer *source_buffer)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
char *text;
|
||||
GBytes *bytes;
|
||||
GtkTextIter start_iter, next_iter, tmp_iter;
|
||||
gint state;
|
||||
gchar *text;
|
||||
gchar *start_ptr, *end_ptr;
|
||||
const char *tag;
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
text = gtk_text_buffer_get_text (source_buffer, &start, &end, TRUE);
|
||||
gtk_text_buffer_create_tag (source_buffer, "source",
|
||||
"font", "monospace",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "comment",
|
||||
"foreground", "DodgerBlue",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "type",
|
||||
"foreground", "ForestGreen",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "string",
|
||||
"foreground", "RosyBrown",
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "control",
|
||||
"foreground", "purple",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "preprocessor",
|
||||
"style", PANGO_STYLE_OBLIQUE,
|
||||
"foreground", "burlywood4",
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag (source_buffer, "function",
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
"foreground", "DarkGoldenrod4",
|
||||
NULL);
|
||||
|
||||
bytes = fontify_text (format, text);
|
||||
if (bytes)
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start_iter, &tmp_iter);
|
||||
gtk_text_buffer_apply_tag_by_name (source_buffer, "source", &start_iter, &tmp_iter);
|
||||
|
||||
state = STATE_NORMAL;
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (source_buffer, &start_iter, 0);
|
||||
|
||||
next_iter = start_iter;
|
||||
while (gtk_text_iter_forward_line (&next_iter))
|
||||
{
|
||||
char *markup;
|
||||
gsize len;
|
||||
gboolean start = TRUE;
|
||||
start_ptr = text = gtk_text_iter_get_text (&start_iter, &next_iter);
|
||||
|
||||
markup = g_bytes_unref_to_data (bytes, &len);
|
||||
gtk_text_buffer_delete (source_buffer, &start, &end);
|
||||
gtk_text_buffer_insert_markup (source_buffer, &start, markup, len);
|
||||
g_free (markup);
|
||||
do
|
||||
{
|
||||
parse_chars (start_ptr, &end_ptr, &state, &tag, start);
|
||||
|
||||
start = FALSE;
|
||||
if (end_ptr)
|
||||
{
|
||||
tmp_iter = start_iter;
|
||||
gtk_text_iter_forward_chars (&tmp_iter, end_ptr - start_ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_iter = next_iter;
|
||||
}
|
||||
if (tag)
|
||||
gtk_text_buffer_apply_tag_by_name (source_buffer, tag, &start_iter, &tmp_iter);
|
||||
|
||||
start_iter = tmp_iter;
|
||||
start_ptr = end_ptr;
|
||||
}
|
||||
while (end_ptr);
|
||||
|
||||
g_free (text);
|
||||
start_iter = next_iter;
|
||||
}
|
||||
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_image (const char *format,
|
||||
const char *resource)
|
||||
display_image (const char *resource)
|
||||
{
|
||||
GtkWidget *sw, *image;
|
||||
|
||||
image = gtk_picture_new_for_resource (resource);
|
||||
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
|
||||
|
||||
return sw;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_text (const char *format,
|
||||
const char *resource)
|
||||
display_text (const char *resource)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkWidget *textview, *sw;
|
||||
@@ -382,15 +636,13 @@ display_text (const char *format,
|
||||
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_set_text (buffer, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
|
||||
|
||||
if (format)
|
||||
fontify (format, buffer);
|
||||
|
||||
if (g_str_has_suffix (resource, ".c"))
|
||||
fontify (buffer);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
@@ -400,8 +652,7 @@ display_text (const char *format,
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_video (const char *format,
|
||||
const char *resource)
|
||||
display_video (const char *resource)
|
||||
{
|
||||
GtkWidget *video;
|
||||
|
||||
@@ -428,27 +679,25 @@ display_nothing (const char *resource)
|
||||
|
||||
static struct {
|
||||
const char *extension;
|
||||
const char *format;
|
||||
GtkWidget * (* display_func) (const char *format,
|
||||
const char *resource);
|
||||
GtkWidget * (* display_func) (const char *resource);
|
||||
} display_funcs[] = {
|
||||
{ ".gif", NULL, display_image },
|
||||
{ ".jpg", NULL, display_image },
|
||||
{ ".png", NULL, display_image },
|
||||
{ ".c", "c", display_text },
|
||||
{ ".css", "css", display_text },
|
||||
{ ".glsl", NULL, display_text },
|
||||
{ ".h", "c", display_text },
|
||||
{ ".txt", NULL, display_text },
|
||||
{ ".ui", "xml", display_text },
|
||||
{ ".webm", NULL, display_video }
|
||||
{ ".gif", display_image },
|
||||
{ ".jpg", display_image },
|
||||
{ ".png", display_image },
|
||||
{ ".c", display_text },
|
||||
{ ".css", display_text },
|
||||
{ ".glsl", display_text },
|
||||
{ ".h", display_text },
|
||||
{ ".txt", display_text },
|
||||
{ ".ui", display_text },
|
||||
{ ".webm", display_video }
|
||||
};
|
||||
|
||||
static void
|
||||
add_data_tab (const char *demoname)
|
||||
add_data_tab (const gchar *demoname)
|
||||
{
|
||||
char *resource_dir, *resource_name;
|
||||
char **resources;
|
||||
gchar *resource_dir, *resource_name;
|
||||
gchar **resources;
|
||||
GtkWidget *widget, *label;
|
||||
guint i, j;
|
||||
|
||||
@@ -471,7 +720,7 @@ add_data_tab (const char *demoname)
|
||||
}
|
||||
|
||||
if (j < G_N_ELEMENTS(display_funcs))
|
||||
widget = display_funcs[j].display_func (display_funcs[j].format, resource_name);
|
||||
widget = display_funcs[j].display_func (resource_name);
|
||||
else
|
||||
widget = display_nothing (resource_name);
|
||||
|
||||
@@ -492,15 +741,15 @@ add_data_tab (const char *demoname)
|
||||
static void
|
||||
remove_data_tabs (void)
|
||||
{
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
for (i = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) - 1; i > 1; i--)
|
||||
gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), i);
|
||||
}
|
||||
|
||||
void
|
||||
load_file (const char *demoname,
|
||||
const char *filename)
|
||||
load_file (const gchar *demoname,
|
||||
const gchar *filename)
|
||||
{
|
||||
GtkTextBuffer *info_buffer, *source_buffer;
|
||||
GtkTextIter start, end;
|
||||
@@ -508,9 +757,9 @@ load_file (const char *demoname,
|
||||
GError *err = NULL;
|
||||
int state = 0;
|
||||
gboolean in_para = 0;
|
||||
char **lines;
|
||||
gchar **lines;
|
||||
GBytes *bytes;
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
if (!g_strcmp0 (current_file, filename))
|
||||
return;
|
||||
@@ -550,9 +799,9 @@ load_file (const char *demoname,
|
||||
gtk_text_buffer_get_iter_at_offset (info_buffer, &start, 0);
|
||||
for (i = 0; lines[i] != NULL; i++)
|
||||
{
|
||||
char *p;
|
||||
char *q;
|
||||
char *r;
|
||||
gchar *p;
|
||||
gchar *q;
|
||||
gchar *r;
|
||||
|
||||
/* Make sure \r is stripped at the end for the poor windows people */
|
||||
lines[i] = g_strchomp (lines[i]);
|
||||
@@ -666,7 +915,7 @@ load_file (const char *demoname,
|
||||
|
||||
g_strfreev (lines);
|
||||
|
||||
fontify ("c", source_buffer);
|
||||
fontify (source_buffer);
|
||||
|
||||
gtk_text_buffer_end_irreversible_action (source_buffer);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (source_view), source_buffer);
|
||||
@@ -696,18 +945,7 @@ selection_cb (GtkSingleSelection *sel,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkTreeListRow *row = gtk_single_selection_get_selected_item (sel);
|
||||
GtkDemo *demo;
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (notebook), !!row);
|
||||
|
||||
if (!row)
|
||||
{
|
||||
gtk_window_set_title (GTK_WINDOW (toplevel), "No match");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
demo = gtk_tree_list_row_get_item (row);
|
||||
GtkDemo *demo = gtk_tree_list_row_get_item (row);
|
||||
|
||||
if (demo->filename)
|
||||
load_file (demo->name, demo->filename);
|
||||
@@ -715,84 +953,6 @@ selection_cb (GtkSingleSelection *sel,
|
||||
gtk_window_set_title (GTK_WINDOW (toplevel), demo->title);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
filter_demo (GtkDemo *demo)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Show only if the name maches every needle */
|
||||
for (i = 0; search_needle[i]; i++)
|
||||
{
|
||||
if (!demo->title)
|
||||
return FALSE;
|
||||
|
||||
if (g_str_match_string (search_needle[i], demo->title, TRUE))
|
||||
continue;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
demo_filter_by_name (GtkTreeListRow *row,
|
||||
GtkFilterListModel *model)
|
||||
{
|
||||
GListModel *children;
|
||||
GtkDemo *demo;
|
||||
guint i, n;
|
||||
|
||||
/* Show all items if search is empty */
|
||||
if (!search_needle || !search_needle[0] || !*search_needle[0])
|
||||
return TRUE;
|
||||
|
||||
g_assert (GTK_IS_TREE_LIST_ROW (row));
|
||||
g_assert (GTK_IS_FILTER_LIST_MODEL (model));
|
||||
|
||||
children = gtk_tree_list_row_get_children (row);
|
||||
if (children)
|
||||
{
|
||||
n = g_list_model_get_n_items (children);
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
demo = g_list_model_get_item (children, i);
|
||||
g_assert (GTK_IS_DEMO (demo));
|
||||
|
||||
if (filter_demo (demo))
|
||||
{
|
||||
g_object_unref (demo);
|
||||
return TRUE;
|
||||
}
|
||||
g_object_unref (demo);
|
||||
}
|
||||
}
|
||||
|
||||
demo = gtk_tree_list_row_get_item (row);
|
||||
g_assert (GTK_IS_DEMO (demo));
|
||||
|
||||
return filter_demo (demo);
|
||||
}
|
||||
|
||||
static void
|
||||
demo_search_changed_cb (GtkSearchEntry *entry,
|
||||
GtkFilter *filter)
|
||||
{
|
||||
const char *text;
|
||||
|
||||
g_assert (GTK_IS_SEARCH_ENTRY (entry));
|
||||
g_assert (GTK_IS_FILTER (filter));
|
||||
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
|
||||
g_clear_pointer (&search_needle, g_strfreev);
|
||||
|
||||
if (text && *text)
|
||||
search_needle = g_strsplit (text, " ", 0);
|
||||
|
||||
gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
|
||||
}
|
||||
|
||||
static GListModel *
|
||||
create_demo_model (void)
|
||||
{
|
||||
@@ -847,25 +1007,13 @@ get_child_model (gpointer item,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
clear_search (GtkSearchBar *bar)
|
||||
{
|
||||
if (!gtk_search_bar_get_search_mode (bar))
|
||||
{
|
||||
GtkWidget *entry = gtk_search_bar_get_child (GTK_SEARCH_BAR (bar));
|
||||
gtk_editable_set_text (GTK_EDITABLE (entry), "");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GListModel *listmodel;
|
||||
GtkTreeListModel *treemodel;
|
||||
GtkWidget *window, *listview, *search_entry, *search_bar;
|
||||
GtkFilterListModel *filter_model;
|
||||
GtkFilter *filter;
|
||||
GtkWidget *window, *listview;
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "run", activate_run, NULL, NULL, NULL }
|
||||
@@ -886,24 +1034,15 @@ activate (GApplication *app)
|
||||
toplevel = GTK_WIDGET (window);
|
||||
listview = GTK_WIDGET (gtk_builder_get_object (builder, "listview"));
|
||||
g_signal_connect (listview, "activate", G_CALLBACK (activate_cb), window);
|
||||
search_bar = GTK_WIDGET (gtk_builder_get_object (builder, "searchbar"));
|
||||
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
|
||||
|
||||
listmodel = create_demo_model ();
|
||||
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
|
||||
FALSE,
|
||||
treemodel = gtk_tree_list_model_new (FALSE,
|
||||
G_LIST_MODEL (listmodel),
|
||||
TRUE,
|
||||
get_child_model,
|
||||
NULL,
|
||||
NULL);
|
||||
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (treemodel), NULL);
|
||||
filter = gtk_custom_filter_new ((GtkCustomFilterFunc)demo_filter_by_name, filter_model, NULL);
|
||||
gtk_filter_list_model_set_filter (filter_model, filter);
|
||||
g_object_unref (filter);
|
||||
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
||||
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
||||
|
||||
selection = gtk_single_selection_new (G_LIST_MODEL (filter_model));
|
||||
selection = gtk_single_selection_new (G_LIST_MODEL (treemodel));
|
||||
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL);
|
||||
gtk_list_view_set_model (GTK_LIST_VIEW (listview), G_LIST_MODEL (selection));
|
||||
|
||||
@@ -941,12 +1080,12 @@ list_demos (void)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
static gint
|
||||
command_line (GApplication *app,
|
||||
GApplicationCommandLine *cmdline)
|
||||
{
|
||||
GVariantDict *options;
|
||||
const char *name = NULL;
|
||||
const gchar *name = NULL;
|
||||
gboolean autoquit = FALSE;
|
||||
gboolean list = FALSE;
|
||||
DemoData *d, *c;
|
||||
@@ -1000,6 +1139,7 @@ out:
|
||||
demo = (func) (window);
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (demo), GTK_WINDOW (window));
|
||||
gtk_window_set_modal (GTK_WINDOW (demo), TRUE);
|
||||
|
||||
g_signal_connect_swapped (G_OBJECT (demo), "destroy", G_CALLBACK (g_application_quit), app);
|
||||
}
|
||||
@@ -1015,7 +1155,7 @@ out:
|
||||
static void
|
||||
print_version (void)
|
||||
{
|
||||
g_print ("gtk4-demo %d.%d.%d\n",
|
||||
g_print ("gtk3-demo %d.%d.%d\n",
|
||||
gtk_get_major_version (),
|
||||
gtk_get_minor_version (),
|
||||
gtk_get_micro_version ());
|
||||
@@ -1049,14 +1189,24 @@ main (int argc, char **argv)
|
||||
{ "inspector", activate_inspector, NULL, NULL, NULL },
|
||||
};
|
||||
struct {
|
||||
const char *action_and_target;
|
||||
const char *accelerators[2];
|
||||
const gchar *action_and_target;
|
||||
const gchar *accelerators[2];
|
||||
} accels[] = {
|
||||
{ "app.about", { "F1", NULL } },
|
||||
{ "app.quit", { "<Control>q", NULL } },
|
||||
};
|
||||
int i;
|
||||
|
||||
/* Most code in gtk-demo is intended to be exemplary, but not
|
||||
* these few lines, which are just a hack so gtk-demo will work
|
||||
* in the GTK tree without installing it.
|
||||
*/
|
||||
if (g_file_test ("../../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
||||
{
|
||||
g_setenv ("GTK_IM_MODULE_FILE", "../../modules/input/immodules.cache", TRUE);
|
||||
}
|
||||
/* -- End of hack -- */
|
||||
|
||||
app = gtk_application_new ("org.gtk.Demo4", G_APPLICATION_NON_UNIQUE|G_APPLICATION_HANDLES_COMMAND_LINE);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
|
@@ -16,6 +16,15 @@
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
<object class="GtkTreeStore" id="treestore">
|
||||
<columns>
|
||||
<column type="gchararray"/>
|
||||
<column type="gchararray"/>
|
||||
<column type="gchararray"/>
|
||||
<column type="gpointer"/>
|
||||
<column type="gint"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkApplicationWindow" id="window">
|
||||
<style>
|
||||
<class name="devel"/>
|
||||
@@ -24,6 +33,7 @@
|
||||
<property name="default-height">600</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="headerbar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
@@ -55,29 +65,12 @@
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="min-content-width">150</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="width-request">220</property>
|
||||
<property name="orientation">vertical</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="key-capture-widget">window</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search-entry"/>
|
||||
</child>
|
||||
<object class="GtkListView" id="listview">
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="resource">/ui/main-listitem.ui</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<object class="GtkListView" id="listview">
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="resource">/ui/main-listitem.ui</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -21,7 +21,7 @@ source_toggled (GtkToggleButton *button)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, end;
|
||||
char *markup;
|
||||
gchar *markup;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
@@ -50,7 +50,7 @@ do_markup (GtkWidget *do_widget)
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
GBytes *bytes;
|
||||
const char *markup;
|
||||
const gchar *markup;
|
||||
GtkWidget *header;
|
||||
GtkWidget *show_source;
|
||||
|
||||
@@ -69,6 +69,7 @@ do_markup (GtkWidget *do_widget)
|
||||
g_signal_connect (show_source, "toggled", G_CALLBACK (source_toggled), stack);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), show_source);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
|
||||
@@ -80,7 +81,7 @@ do_markup (GtkWidget *do_widget)
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 10);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 10);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
@@ -93,7 +94,7 @@ do_markup (GtkWidget *do_widget)
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view2), 10);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view2), 10);
|
||||
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
@@ -102,7 +103,7 @@ do_markup (GtkWidget *do_widget)
|
||||
gtk_stack_add_named (GTK_STACK (stack), sw, "source");
|
||||
|
||||
bytes = g_resources_lookup_data ("/markup/markup.txt", 0, NULL);
|
||||
markup = (const char *)g_bytes_get_data (bytes, NULL);
|
||||
markup = (const gchar *)g_bytes_get_data (bytes, NULL);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
gtk_text_buffer_get_start_iter (buffer, &iter);
|
||||
|
@@ -49,7 +49,6 @@ demos = files([
|
||||
'listview_minesweeper.c',
|
||||
'listview_settings.c',
|
||||
'listview_weather.c',
|
||||
'listview_words.c',
|
||||
'markup.c',
|
||||
'modelbutton.c',
|
||||
'overlay.c',
|
||||
|
@@ -259,7 +259,7 @@
|
||||
259|GTK+ and friends|GTKtoolkit|#java bindings version 4.0.16 released: http://article.gmane.org/gmane.comp.gnome.bindings.java/1796 #gtk|1276885917|0||0|0
|
||||
260|GTK+ and friends|GTKtoolkit|RT @cwiiis: MxIconTheme and MxIcon respect system's icon theme (and changes) now in #mx master :) Made possible by @thosw's XSettings work|1276883019|0||0|0
|
||||
261|GTK+ and friends|GTKtoolkit|#javascript mailing list just created. Discuss its usage in GObject libraries: GTK+, Glib ... http://ur1.ca/08lwz by @jwendell #gtk|1276842639|0||0|0
|
||||
262|GTK+ and friends|GTKtoolkit|Note for Win32 users: XP theming is back in 2.90.3 . Please test. #gtk|1276829697|0||0|0
|
||||
262|GTK+ and friends|GTKtoolkit|Note fot Win32 users: XP theming is back in 2.90.3 . Please test. #gtk|1276829697|0||0|0
|
||||
263|GTK+ and friends|GTKtoolkit|GTK+ 2.90.3 (unstable) released: http://mail.gnome.org/archives/gtk-devel-list/2010-June/msg00137.html #gtk|1276829633|0||0|0
|
||||
264|GTK+ and friends|GTKtoolkit|GLib 2.25.9 (unstable) released: http://ur1.ca/08hrl WARNING: API changes in GDBus, GSettings and GApplication #gtk|1276829581|0||0|0
|
||||
265|scaroo|scaroo|RT @scaroo: #SeedKit does RGBA window with css shadows and stuff : http://dl.dropbox.com/u/5746554/seedkit-does-rgba.png|1276734086|0|GTKtoolkit|0|1
|
||||
|
@@ -4,7 +4,9 @@
|
||||
<property name="title" translatable="yes">Model Button</property>
|
||||
<property name="resizable">0</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar"/>
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
|
@@ -31,11 +31,6 @@
|
||||
<update_contact>matthias.clasen_at_gmail.com</update_contact>
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<releases>
|
||||
<release version="3.99.0" date="2020-07-30">
|
||||
<description>
|
||||
<p>A new developers snapshot towards GTK 4.0.</p>
|
||||
</description>
|
||||
</release>
|
||||
<release version="3.94.0" date="2018-06-25">
|
||||
<description>
|
||||
<p>A new developers snapshot towards GTK 4.0.</p>
|
||||
|
@@ -12,9 +12,9 @@ static void
|
||||
margin_changed (GtkAdjustment *adjustment,
|
||||
GtkTextView *text)
|
||||
{
|
||||
int value;
|
||||
gint value;
|
||||
|
||||
value = (int)gtk_adjustment_get_value (adjustment);
|
||||
value = (gint)gtk_adjustment_get_value (adjustment);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (text), value);
|
||||
g_object_set (tag, "pixels-above-lines", value, NULL);
|
||||
}
|
||||
@@ -40,7 +40,7 @@ do_overlay2 (GtkWidget *do_widget)
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Decorative Overlay");
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include <gtk/gtkunixprint.h>
|
||||
|
||||
static void
|
||||
done_cb (GtkDialog *dialog, int response, gpointer data)
|
||||
done_cb (GtkDialog *dialog, gint response, gpointer data)
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ typedef struct
|
||||
cairo_t *cr;
|
||||
GdkRGBA draw_color;
|
||||
GtkPadController *pad_controller;
|
||||
double brush_size;
|
||||
gdouble brush_size;
|
||||
} DrawingArea;
|
||||
|
||||
typedef struct
|
||||
@@ -38,7 +38,7 @@ static GtkPadActionEntry pad_actions[] = {
|
||||
{ GTK_PAD_ACTION_STRIP, -1, -1, N_("Brush size"), "pad.brush_size" },
|
||||
};
|
||||
|
||||
static const char *pad_colors[] = {
|
||||
static const gchar *pad_colors[] = {
|
||||
"black",
|
||||
"pink",
|
||||
"green",
|
||||
@@ -55,8 +55,8 @@ static void drawing_area_set_color (DrawingArea *area,
|
||||
|
||||
static void
|
||||
drawing_area_ensure_surface (DrawingArea *area,
|
||||
int width,
|
||||
int height)
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
if (!area->surface ||
|
||||
cairo_image_surface_get_width (area->surface) != width ||
|
||||
@@ -154,7 +154,7 @@ on_pad_button_activate (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
DrawingArea *area)
|
||||
{
|
||||
const char *color = g_object_get_data (G_OBJECT (action), "color");
|
||||
const gchar *color = g_object_get_data (G_OBJECT (action), "color");
|
||||
GdkRGBA rgba;
|
||||
|
||||
gdk_rgba_parse (&rgba, color);
|
||||
@@ -166,7 +166,7 @@ on_pad_knob_change (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
DrawingArea *area)
|
||||
{
|
||||
double value = g_variant_get_double (parameter);
|
||||
gdouble value = g_variant_get_double (parameter);
|
||||
|
||||
area->brush_size = value;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ drawing_area_root (GtkWidget *widget)
|
||||
GSimpleActionGroup *action_group;
|
||||
GSimpleAction *action;
|
||||
GtkWidget *toplevel;
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->root (widget);
|
||||
|
||||
@@ -255,9 +255,9 @@ drawing_area_class_init (DrawingAreaClass *klass)
|
||||
static void
|
||||
drawing_area_apply_stroke (DrawingArea *area,
|
||||
GdkDeviceTool *tool,
|
||||
double x,
|
||||
double y,
|
||||
double pressure)
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble pressure)
|
||||
{
|
||||
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
|
||||
{
|
||||
@@ -281,8 +281,8 @@ drawing_area_apply_stroke (DrawingArea *area,
|
||||
|
||||
static void
|
||||
stylus_gesture_down (GtkGestureStylus *gesture,
|
||||
double x,
|
||||
double y,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
DrawingArea *area)
|
||||
{
|
||||
cairo_new_path (area->cr);
|
||||
@@ -290,13 +290,13 @@ stylus_gesture_down (GtkGestureStylus *gesture,
|
||||
|
||||
static void
|
||||
stylus_gesture_motion (GtkGestureStylus *gesture,
|
||||
double x,
|
||||
double y,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
DrawingArea *area)
|
||||
{
|
||||
GdkTimeCoord *backlog;
|
||||
GdkDeviceTool *tool;
|
||||
double pressure;
|
||||
gdouble pressure;
|
||||
guint n_items;
|
||||
|
||||
tool = gtk_gesture_stylus_get_device_tool (gesture);
|
||||
@@ -392,6 +392,7 @@ do_paint (GtkWidget *toplevel)
|
||||
gtk_window_set_child (GTK_WINDOW (window), draw_area);
|
||||
|
||||
headerbar = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (headerbar), TRUE);
|
||||
|
||||
colorbutton = gtk_color_button_new ();
|
||||
g_signal_connect (colorbutton, "color-set",
|
||||
|
@@ -293,7 +293,6 @@ do_paintable_mediastream (GtkWidget *do_widget)
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Nuclear MediaStream");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
nuclear = gtk_nuclear_media_stream_new ();
|
||||
gtk_media_stream_set_loop (GTK_MEDIA_STREAM (nuclear), TRUE);
|
||||
|
@@ -47,9 +47,9 @@ toggle_shrink (GtkWidget *widget,
|
||||
|
||||
static GtkWidget *
|
||||
create_pane_options (GtkPaned *paned,
|
||||
const char *frame_label,
|
||||
const char *label1,
|
||||
const char *label2)
|
||||
const gchar *frame_label,
|
||||
const gchar *label1,
|
||||
const gchar *label2)
|
||||
{
|
||||
GtkWidget *child1, *child2;
|
||||
GtkWidget *frame;
|
||||
|
@@ -276,6 +276,7 @@ do_peg_solitaire (GtkWidget *do_widget)
|
||||
g_signal_connect (restart, "clicked", G_CALLBACK (restart), NULL);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), restart);
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
|
@@ -39,7 +39,7 @@ static GdkPixbuf *frame;
|
||||
|
||||
/* Background image */
|
||||
static GdkPixbuf *background;
|
||||
static int back_width, back_height;
|
||||
static gint back_width, back_height;
|
||||
|
||||
/* Images */
|
||||
static GdkPixbuf *images[N_IMAGES];
|
||||
@@ -51,7 +51,7 @@ static GtkWidget *da;
|
||||
static gboolean
|
||||
load_pixbufs (GError **error)
|
||||
{
|
||||
int i;
|
||||
gint i;
|
||||
|
||||
if (background)
|
||||
return TRUE; /* already loaded earlier */
|
||||
|
@@ -14,13 +14,13 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *resourcename;
|
||||
double font_size;
|
||||
gchar *resourcename;
|
||||
gdouble font_size;
|
||||
|
||||
int lines_per_page;
|
||||
char **lines;
|
||||
int num_lines;
|
||||
int num_pages;
|
||||
gint lines_per_page;
|
||||
gchar **lines;
|
||||
gint num_lines;
|
||||
gint num_pages;
|
||||
} PrintData;
|
||||
|
||||
static void
|
||||
@@ -55,17 +55,17 @@ begin_print (GtkPrintOperation *operation,
|
||||
static void
|
||||
draw_page (GtkPrintOperation *operation,
|
||||
GtkPrintContext *context,
|
||||
int page_nr,
|
||||
gint page_nr,
|
||||
gpointer user_data)
|
||||
{
|
||||
PrintData *data = (PrintData *)user_data;
|
||||
cairo_t *cr;
|
||||
PangoLayout *layout;
|
||||
int text_width, text_height;
|
||||
double width;
|
||||
int line, i;
|
||||
gint text_width, text_height;
|
||||
gdouble width;
|
||||
gint line, i;
|
||||
PangoFontDescription *desc;
|
||||
char *page_str;
|
||||
gchar *page_str;
|
||||
|
||||
cr = gtk_print_context_get_cairo_context (context);
|
||||
width = gtk_print_context_get_width (context);
|
||||
|
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static int count = 0;
|
||||
static gint count = 0;
|
||||
static guint timeout = 0;
|
||||
|
||||
static void
|
||||
@@ -25,7 +25,7 @@ static gboolean
|
||||
reveal_one (gpointer data)
|
||||
{
|
||||
GtkWidget *window = data;
|
||||
char *name;
|
||||
gchar *name;
|
||||
GtkRevealer *revealer;
|
||||
|
||||
name = g_strdup_printf ("revealer%d", count);
|
||||
|
@@ -19,8 +19,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -35,8 +35,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -51,8 +51,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">3</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -66,8 +66,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -82,8 +82,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -98,8 +98,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -114,8 +114,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -129,8 +129,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">4</property>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -145,8 +145,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -33,9 +33,12 @@
|
||||
<object class="GtkLabel" id="label_plain">
|
||||
<property name="label">Plain</property>
|
||||
<property name="xalign">0</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_plain"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -45,9 +48,12 @@
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<property name="hexpand">1</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_plain"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -55,9 +61,12 @@
|
||||
<object class="GtkLabel" id="label_marks">
|
||||
<property name="label">Marks</property>
|
||||
<property name="xalign">0</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_marks"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -74,9 +83,12 @@
|
||||
<mark value="3" position="bottom"></mark>
|
||||
<mark value="4" position="bottom"></mark>
|
||||
</marks>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_marks"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -84,9 +96,12 @@
|
||||
<object class="GtkLabel" id="label_discrete">
|
||||
<property name="label">Discrete</property>
|
||||
<property name="xalign">0</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_discrete"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
@@ -97,6 +112,9 @@
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment3</property>
|
||||
<property name="hexpand">1</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_discrete"/>
|
||||
</accessibility>
|
||||
<marks>
|
||||
<mark value="0" position="bottom"></mark>
|
||||
<mark value="1" position="bottom"></mark>
|
||||
@@ -105,8 +123,8 @@
|
||||
<mark value="4" position="bottom"></mark>
|
||||
</marks>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -37,7 +37,6 @@ static void
|
||||
search_progress_done (GtkEntry *entry)
|
||||
{
|
||||
gtk_entry_set_progress_fraction (entry, 0.0);
|
||||
g_object_unref (entry);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -55,11 +54,9 @@ finish_search (GtkButton *button)
|
||||
static gboolean
|
||||
start_search_feedback (gpointer data)
|
||||
{
|
||||
gtk_entry_set_progress_fraction (GTK_ENTRY (data), 0.1);
|
||||
search_progress_id = g_timeout_add_full (G_PRIORITY_DEFAULT, 100,
|
||||
(GSourceFunc)search_progress, g_object_ref (data),
|
||||
(GSourceFunc)search_progress, data,
|
||||
(GDestroyNotify)search_progress_done);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
@@ -126,7 +123,7 @@ set_search_by (GSimpleAction *action,
|
||||
|
||||
static void
|
||||
icon_press_cb (GtkEntry *entry,
|
||||
int position,
|
||||
gint position,
|
||||
gpointer data)
|
||||
{
|
||||
if (position == GTK_ENTRY_ICON_PRIMARY)
|
||||
@@ -165,8 +162,7 @@ activate_cb (GtkEntry *entry,
|
||||
}
|
||||
|
||||
static void
|
||||
search_entry_destroyed (gpointer data,
|
||||
GObject *widget)
|
||||
search_entry_destroyed (GtkWidget *widget)
|
||||
{
|
||||
if (finish_search_id != 0)
|
||||
{
|
||||
@@ -265,8 +261,8 @@ do_search_entry (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Search Entry");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (window), search_entry_destroyed, &window);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (search_entry_destroyed), &window);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||
gtk_widget_set_margin_start (vbox, 5);
|
||||
|
@@ -8,12 +8,12 @@
|
||||
|
||||
static void
|
||||
show_shortcuts (GtkWidget *window,
|
||||
const char *id,
|
||||
const char *view)
|
||||
const gchar *id,
|
||||
const gchar *view)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *overlay;
|
||||
char *path;
|
||||
gchar *path;
|
||||
|
||||
path = g_strdup_printf ("/shortcuts/%s.ui", id);
|
||||
builder = gtk_builder_new_from_resource (path);
|
||||
|
@@ -18,7 +18,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
GtkWidget *box;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *header;
|
||||
const char * pages[] = {
|
||||
const gchar* pages[] = {
|
||||
"Welcome to GTK",
|
||||
"GtkStackSidebar Widget",
|
||||
"Automatic navigation",
|
||||
@@ -30,7 +30,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
"Page 9",
|
||||
NULL
|
||||
};
|
||||
const char *c = NULL;
|
||||
const gchar *c = NULL;
|
||||
guint i;
|
||||
|
||||
if (!window)
|
||||
@@ -40,6 +40,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
gtk_widget_set_size_request (window, 500, 350);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR(header), TRUE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW(window), header);
|
||||
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
@@ -272,7 +272,7 @@ start_puzzle (GdkPaintable *paintable)
|
||||
|
||||
/* Create a new grid */
|
||||
grid = gtk_grid_new ();
|
||||
gtk_widget_set_focusable (grid, TRUE);
|
||||
gtk_widget_set_can_focus (grid, TRUE);
|
||||
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (frame), grid);
|
||||
aspect_ratio = gdk_paintable_get_intrinsic_aspect_ratio (paintable);
|
||||
if (aspect_ratio == 0.0)
|
||||
@@ -284,7 +284,7 @@ start_puzzle (GdkPaintable *paintable)
|
||||
* keys to move the puzzle */
|
||||
controller = gtk_shortcut_controller_new ();
|
||||
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
GTK_SHORTCUT_SCOPE_LOCAL);
|
||||
GTK_SHORTCUT_SCOPE_GLOBAL);
|
||||
add_move_binding (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
GDK_KEY_Left, GDK_KEY_KP_Left,
|
||||
-1, 0);
|
||||
@@ -443,7 +443,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
|
||||
gtk_media_stream_set_muted (media, TRUE);
|
||||
gtk_media_stream_play (media);
|
||||
add_choice (choices, GDK_PAINTABLE (media));
|
||||
sw = gtk_scrolled_window_new ();
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), choices);
|
||||
gtk_grid_attach (GTK_GRID (tweaks), sw, 0, 0, 2, 1);
|
||||
|
||||
@@ -470,6 +470,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
|
||||
g_signal_connect (restart, "clicked", G_CALLBACK (reshuffle), NULL);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), restart);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), tweak);
|
||||
window = gtk_window_new ();
|
||||
|
@@ -11,13 +11,13 @@
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
gint
|
||||
spinbutton_hex_spin_input (GtkSpinButton *spin_button,
|
||||
double *new_val)
|
||||
gdouble *new_val)
|
||||
{
|
||||
const char *buf;
|
||||
char *err;
|
||||
double res;
|
||||
const gchar *buf;
|
||||
gchar *err;
|
||||
gdouble res;
|
||||
|
||||
buf = gtk_editable_get_text (GTK_EDITABLE (spin_button));
|
||||
res = strtol (buf, &err, 16);
|
||||
@@ -28,19 +28,19 @@ spinbutton_hex_spin_input (GtkSpinButton *spin_button,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
gint
|
||||
spinbutton_hex_spin_output (GtkSpinButton *spin_button)
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
char *buf;
|
||||
double val;
|
||||
gchar *buf;
|
||||
gdouble val;
|
||||
|
||||
adjustment = gtk_spin_button_get_adjustment (spin_button);
|
||||
val = gtk_adjustment_get_value (adjustment);
|
||||
if (fabs (val) < 1e-5)
|
||||
buf = g_strdup ("0x00");
|
||||
else
|
||||
buf = g_strdup_printf ("0x%.2X", (int) val);
|
||||
buf = g_strdup_printf ("0x%.2X", (gint) val);
|
||||
if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
|
||||
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
|
||||
g_free (buf);
|
||||
@@ -48,17 +48,17 @@ spinbutton_hex_spin_output (GtkSpinButton *spin_button)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
gint
|
||||
spinbutton_time_spin_input (GtkSpinButton *spin_button,
|
||||
double *new_val)
|
||||
gdouble *new_val)
|
||||
{
|
||||
const char *text;
|
||||
char **str;
|
||||
const gchar *text;
|
||||
gchar **str;
|
||||
gboolean found = FALSE;
|
||||
int hours;
|
||||
int minutes;
|
||||
char *endh;
|
||||
char *endm;
|
||||
gint hours;
|
||||
gint minutes;
|
||||
gchar *endh;
|
||||
gchar *endm;
|
||||
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (spin_button));
|
||||
str = g_strsplit (text, ":", 2);
|
||||
@@ -87,13 +87,13 @@ spinbutton_time_spin_input (GtkSpinButton *spin_button,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
gint
|
||||
spinbutton_time_spin_output (GtkSpinButton *spin_button)
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
char *buf;
|
||||
double hours;
|
||||
double minutes;
|
||||
gchar *buf;
|
||||
gdouble hours;
|
||||
gdouble minutes;
|
||||
|
||||
adjustment = gtk_spin_button_get_adjustment (spin_button);
|
||||
hours = gtk_adjustment_get_value (adjustment) / 60.0;
|
||||
@@ -121,12 +121,12 @@ static const char *month[12] = {
|
||||
"December"
|
||||
};
|
||||
|
||||
int
|
||||
gint
|
||||
spinbutton_month_spin_input (GtkSpinButton *spin_button,
|
||||
double *new_val)
|
||||
gdouble *new_val)
|
||||
{
|
||||
int i;
|
||||
char *tmp1, *tmp2;
|
||||
gint i;
|
||||
gchar *tmp1, *tmp2;
|
||||
gboolean found = FALSE;
|
||||
|
||||
for (i = 1; i <= 12; i++)
|
||||
@@ -145,17 +145,17 @@ spinbutton_month_spin_input (GtkSpinButton *spin_button,
|
||||
*new_val = 0.0;
|
||||
return GTK_INPUT_ERROR;
|
||||
}
|
||||
*new_val = (double) i;
|
||||
*new_val = (gdouble) i;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
gint
|
||||
spinbutton_month_spin_output (GtkSpinButton *spin_button)
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
double value;
|
||||
int i;
|
||||
gdouble value;
|
||||
gint i;
|
||||
|
||||
adjustment = gtk_spin_button_get_adjustment (spin_button);
|
||||
value = gtk_adjustment_get_value (adjustment);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user