Compare commits

..

25 Commits

Author SHA1 Message Date
Matthias Clasen
825b2a4139 wip: benchmarks 2020-07-12 20:54:46 -04:00
Matthias Clasen
8a23649d40 stringlist: Reuse objects
Keep a bitset of positions where the array contains
objects, and check those for reusable objects whenever
we need a new object.

We still keep the low-bit marking of string pointers,
so we can implement g_list_model_get_item without having
to consult the bitset.

In scrolling through the words demo, this keeps the
number of live string objects at ~200.
2020-07-12 20:52:48 -04:00
Matthias Clasen
bf367b219b stringlist: Use an array
A version of GtkStringList that uses a GPtrArray
to hold the strings / objects. We avoid a second
array by marking strings using a low bit of the
pointer.
2020-06-30 23:37:21 -04:00
Matthias Clasen
77435d31fa gtk-demo: Use a progressbar in the words demo
This looks better and a bit more polished.
2020-07-01 02:47:50 +02:00
Matthias Clasen
6edb8f096f gtk-demo: No selection in the words demo
This demo is about filtering, not about selection,
so use a GtkNoSelection.
2020-07-01 02:46:05 +02:00
Matthias Clasen
c4dfee8860 gtk-demo: Cosmetic fixes for the words demo
Set a window size, and don't put newlines in titles, left align and
ellipsize the label.
2020-07-01 02:46:05 +02:00
Benjamin Otte
8ac1e77c9a demo: Make words listview load async
And add an "Open" button (why are filechooser buttons such a catastrophe
that I can't make them smaller?).
2020-07-01 02:46:05 +02:00
Benjamin Otte
65ceb6c15a stringlist: Call splice() for adding items after construction
This has the benefit of actually allowing NULL to be passed.
2020-07-01 02:46:05 +02:00
Benjamin Otte
f70d10f6ac stringlist: Remove n_additions argument from gtk_string_list_splice()
char ** arrays are null-terminated everywhere, so make sure they are in
splice(), too.

Also fix the argument to be a const char * const * like in the
constructor.
2020-07-01 02:46:05 +02:00
Benjamin Otte
0bbd083d79 stringlist: Clarify docs for gtk_string_list_get_string()
Make sure it's obvious that it behaves like g_list_model_get_item() and
returns NULL for pos >= n_items.
2020-07-01 02:46:05 +02:00
Benjamin Otte
102d2986c6 stringlist: Make one constructor call the other
Simplifies code.
2020-07-01 02:46:05 +02:00
Benjamin Otte
c74201ca87 filterlistmodel: Look at type of change
This way we can avoid refiltering most of an already filtered list when
the change becomes more strict.
2020-07-01 02:46:05 +02:00
Benjamin Otte
b09019a5b4 gtk-demo: Add incremental filtering to words demo 2020-07-01 02:46:05 +02:00
Benjamin Otte
1dd08ad8db filterlistmodel: Add gtk_filter_list_model_get_pending()
This allows tracking if the model is busy filtering.
2020-07-01 02:46:05 +02:00
Benjamin Otte
eb0704855f filterlistmodel: Add incremental filtering 2020-07-01 02:46:05 +02:00
Benjamin Otte
c4c1d4a1b3 bitset: Add gtk_bitset_new_range()
It's a common use.
2020-07-01 02:46:05 +02:00
Benjamin Otte
e6756f605e stringlist: Make property not construct-only
Massively speeds up creation of long stringlists.
2020-07-01 02:46:05 +02:00
Benjamin Otte
1f4b8e089e filterlistmodel: Rewrite with bitset data structure
Bitsets are more powerful, less memory intensive and faster than the old
GtkRbTree version.
2020-07-01 02:46:05 +02:00
Benjamin Otte
c0e08db739 bitset: Add APIs needed for a filterlistmodel 2020-06-30 00:46:56 +02:00
Benjamin Otte
1c337d350d tests: Make testlistview be a list again
The grid conversion was for testing and should never have been
committed.
2020-06-30 00:46:56 +02:00
Benjamin Otte
81e675dfbf gtk-demo: Add a listview demo for filtering strings 2020-06-30 00:36:14 +02:00
Benjamin Otte
8556221429 stringlist: Take a const char const * argument
Sucks that we need to cast a char**, but otherwise we need to cast
{"foo", "bar", "baz" } arrays.
2020-06-30 00:36:14 +02:00
Benjamin Otte
1b4109a7fd scrolledwindow: Expand by default
Use gtk_scrolled_window_set_hexpand/vexpand(FALSE) to make the scrolled
window not expand.
2020-06-30 00:36:13 +02:00
Benjamin Otte
df0786be7a stringfilter: Don't crash if the expression returns "" 2020-06-30 00:36:13 +02:00
Benjamin Otte
3f545da08d a11y: Remove double initialization of variables 2020-06-30 00:36:13 +02:00
1263 changed files with 46425 additions and 53478 deletions

View File

@@ -19,8 +19,8 @@ variables:
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror" COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true -Dvulkan=yes" BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true -Dvulkan=yes"
FEATURE_FLAGS: "-Dcloudproviders=true" FEATURE_FLAGS: "-Dcloudproviders=true"
MESON_TEST_TIMEOUT_MULTIPLIER: 3 MESON_TEST_TIMEOUT_MULTIPLIER: 2
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v20" FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v17"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master" FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v19" DOCS_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora-docs:v19"
@@ -180,22 +180,6 @@ static-scan:
- _scan_build/meson-logs - _scan_build/meson-logs
allow_failure: true 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
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: reference:
image: $DOCS_IMAGE image: $DOCS_IMAGE
stage: docs stage: docs

View File

View File

@@ -35,13 +35,4 @@ branch, as well as their available versions.
- [ ] Add the new job to `.gitlab-ci.yml` referencing the image - [ ] Add the new job to `.gitlab-ci.yml` referencing the image
- [ ] Open a merge request with your changes and let it run - [ ] 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 [registry]: https://gitlab.gnome.org/GNOME/gtk/container_registry

View File

@@ -41,14 +41,12 @@ RUN dnf -y install \
itstool \ itstool \
json-glib-devel \ json-glib-devel \
lcov \ lcov \
libasan \
libattr-devel \ libattr-devel \
libepoxy-devel \ libepoxy-devel \
libffi-devel \ libffi-devel \
libmount-devel \ libmount-devel \
librsvg2 \ librsvg2 \
libselinux-devel \ libselinux-devel \
libubsan \
libXcomposite-devel \ libXcomposite-devel \
libXcursor-devel \ libXcursor-devel \
libXcursor-devel \ libXcursor-devel \

View File

@@ -1,4 +1,4 @@
FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v20 FROM registry.gitlab.gnome.org/gnome/gtk/fedora-base:v19
ARG HOST_USER_ID=5555 ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID} ENV HOST_USER_ID ${HOST_USER_ID}

View File

@@ -7,14 +7,10 @@ srcdir=$( pwd )
builddir=$1 builddir=$1
backend=$2 backend=$2
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp
case "${backend}" in case "${backend}" in
x11) x11)
xvfb-run -a -s "-screen 0 1024x768x24" \ xvfb-run -a -s "-screen 0 1024x768x24" \
meson test -C ${builddir} \ meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \ --print-errorlogs \
--setup=${backend} \ --setup=${backend} \
--suite=gtk \ --suite=gtk \
@@ -34,7 +30,6 @@ case "${backend}" in
export WAYLAND_DISPLAY=wayland-5 export WAYLAND_DISPLAY=wayland-5
meson test -C ${builddir} \ meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \ --print-errorlogs \
--setup=${backend} \ --setup=${backend} \
--suite=gtk \ --suite=gtk \
@@ -53,7 +48,6 @@ case "${backend}" in
export BROADWAY_DISPLAY=:5 export BROADWAY_DISPLAY=:5
meson test -C ${builddir} \ meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \ --print-errorlogs \
--setup=${backend} \ --setup=${backend} \
--suite=gtk \ --suite=gtk \

86
NEWS
View File

@@ -1,89 +1,3 @@
Overview of Changes in GTK 3.99.0
=================================
* 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
* 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
* GDK:
- Compress scroll events
- Keep a scroll history
- Clean up GdkDevice api
- Improve frame clock accuracy
- Add a new macOS backend
* 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 Overview of Changes in GTK 3.98.5
================================= =================================

View File

@@ -1,38 +1,29 @@
{ {
"app-id" : "org.gtk.WidgetFactory4", "app-id": "org.gtk.WidgetFactory4",
"runtime" : "org.gnome.Platform", "runtime": "org.gnome.Platform",
"runtime-version" : "master", "runtime-version": "master",
"sdk" : "org.gnome.Sdk", "sdk": "org.gnome.Sdk",
"command" : "gtk4-widget-factory", "command": "gtk4-widget-factory",
"tags" : [ "tags": ["devel", "development", "nightly"],
"devel", "desktop-file-name-prefix": "(Development) ",
"development", "finish-args": [
"nightly"
],
"desktop-file-name-prefix" : "(Development) ",
"finish-args" : [
"--device=dri", "--device=dri",
"--share=ipc", "--share=ipc",
"--socket=fallback-x11", "--socket=fallback-x11",
"--socket=wayland", "--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", "/include",
"/lib/pkgconfig", "/lib/pkgconfig", "/share/pkgconfig",
"/share/pkgconfig",
"/share/aclocal", "/share/aclocal",
"/man", "/man", "/share/man", "/share/gtk-doc",
"/share/man", "*.la", ".a",
"/share/gtk-doc",
"*.la",
".a",
"/lib/girepository-1.0", "/lib/girepository-1.0",
"/share/gir-1.0", "/share/gir-1.0",
"/share/doc" "/share/doc"
], ],
"modules" : [ "modules": [
{ {
"name" : "wayland", "name" : "wayland",
"buildsystem" : "autotools", "buildsystem" : "autotools",
@@ -48,18 +39,18 @@
] ]
}, },
{ {
"name" : "graphene", "name": "graphene",
"buildsystem" : "meson", "buildsystem": "meson",
"builddir" : true, "builddir": true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib", "--libdir=/app/lib",
"-Dtests=false", "-Dtests=false",
"-Dbenchmarks=false" "-Dbenchmarks=false"
], ],
"sources" : [ "sources": [
{ {
"type" : "git", "type": "git",
"url" : "https://github.com/ebassi/graphene.git" "url": "https://github.com/ebassi/graphene.git"
} }
] ]
}, },
@@ -67,7 +58,7 @@
"name" : "libsass", "name" : "libsass",
"buildsystem" : "meson", "buildsystem" : "meson",
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib" "--libdir=/app/lib"
], ],
"sources" : [ "sources" : [
@@ -82,7 +73,7 @@
"name" : "sassc", "name" : "sassc",
"buildsystem" : "meson", "buildsystem" : "meson",
"builddir" : true, "builddir" : true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib" "--libdir=/app/lib"
], ],
"sources" : [ "sources" : [
@@ -94,23 +85,18 @@
] ]
}, },
{ {
"name" : "gtk", "name": "gtk",
"buildsystem" : "meson", "buildsystem": "meson",
"builddir" : true, "builddir": true,
"config-opts" : [ "config-opts": [
"--libdir=/app/lib" "--libdir=/app/lib"
], ],
"sources" : [ "sources": [
{ {
"type" : "git", "type": "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git" "url": "https://gitlab.gnome.org/GNOME/gtk.git"
} }
] ]
} }
], ]
"build-options" : {
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''"
}
}
} }

View File

@@ -15,13 +15,7 @@ if 'DESTDIR' not in os.environ:
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules') gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
print('Compiling GSettings schemas...') print('Compiling GSettings schemas...')
glib_compile_schemas = subprocess.check_output(['pkg-config', subprocess.call(['glib-compile-schemas',
'--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,
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')]) os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
print('Updating icon cache...') print('Updating icon cache...')
@@ -30,14 +24,8 @@ if 'DESTDIR' not in os.environ:
print('Updating module cache for print backends...') print('Updating module cache for print backends...')
os.makedirs(gtk_printmodule_dir, exist_ok=True) os.makedirs(gtk_printmodule_dir, exist_ok=True)
gio_querymodules = subprocess.check_output(['pkg-config', subprocess.call(['gio-querymodules', gtk_printmodule_dir])
'--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])
print('Updating module cache for input methods...') print('Updating module cache for input methods...')
os.makedirs(gtk_immodule_dir, exist_ok=True) os.makedirs(gtk_immodule_dir, exist_ok=True)
subprocess.call([gio_querymodules, gtk_immodule_dir]) subprocess.call(['gio-querymodules', gtk_immodule_dir])

View File

@@ -81,11 +81,11 @@ constraint_editor_application_activate (GApplication *app)
static void static void
constraint_editor_application_open (GApplication *app, constraint_editor_application_open (GApplication *app,
GFile **files, GFile **files,
int n_files, gint n_files,
const char *hint) const gchar *hint)
{ {
ConstraintEditorWindow *win; ConstraintEditorWindow *win;
int i; gint i;
for (i = 0; i < n_files; i++) for (i = 0; i < n_files; i++)
{ {

View File

@@ -193,7 +193,7 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
static void static void
open_response_cb (GtkNativeDialog *dialog, open_response_cb (GtkNativeDialog *dialog,
int response, gint response,
ConstraintEditorWindow *self) ConstraintEditorWindow *self)
{ {
gtk_native_dialog_hide (dialog); gtk_native_dialog_hide (dialog);
@@ -285,7 +285,7 @@ serialize_model (GListModel *list)
static void static void
save_response_cb (GtkNativeDialog *dialog, save_response_cb (GtkNativeDialog *dialog,
int response, gint response,
ConstraintEditorWindow *self) ConstraintEditorWindow *self)
{ {
gtk_native_dialog_hide (dialog); gtk_native_dialog_hide (dialog);

View File

@@ -9,6 +9,7 @@
<property name="default-height">768</property> <property name="default-height">768</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="header"> <object class="GtkHeaderBar" id="header">
<property name="show-title-buttons">1</property>
<child type="start"> <child type="start">
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">document-open-symbolic</property> <property name="icon-name">document-open-symbolic</property>

View File

@@ -174,29 +174,28 @@ constraint_view_init (ConstraintView *self)
manager = gtk_constraint_layout_new (); manager = gtk_constraint_layout_new ();
gtk_widget_set_layout_manager (GTK_WIDGET (self), manager); 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)); 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); filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter); constraints = (GListModel *)gtk_filter_list_model_new (all_constraints, filter);
g_object_unref (filter); g_object_unref (filter);
g_object_unref (all_constraints);
all_children = gtk_widget_observe_children (GTK_WIDGET (self));
filter = gtk_custom_filter_new (omit_internal, NULL, NULL); filter = gtk_custom_filter_new (omit_internal, NULL, NULL);
children = (GListModel *)gtk_filter_list_model_new (all_children, filter); children = (GListModel *)gtk_filter_list_model_new (all_children, filter);
g_object_unref (filter); g_object_unref (filter);
g_object_unref (all_children);
list = g_list_store_new (G_TYPE_LIST_MODEL); list = g_list_store_new (G_TYPE_LIST_MODEL);
g_list_store_append (list, children); g_list_store_append (list, children);
g_list_store_append (list, guides); g_list_store_append (list, guides);
g_list_store_append (list, constraints); 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 (children);
g_object_unref (guides); g_object_unref (guides);
g_object_unref (constraints); 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 (); controller = (GtkEventController *)gtk_gesture_drag_new ();
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self); g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);

View File

@@ -34,7 +34,7 @@ static void create_window (GApplication *app, const char *contents);
static void static void
show_action_dialog (GSimpleAction *action) show_action_dialog (GSimpleAction *action)
{ {
const char *name; const gchar *name;
GtkWidget *dialog; GtkWidget *dialog;
name = g_action_get_name (G_ACTION (action)); name = g_action_get_name (G_ACTION (action));
@@ -58,9 +58,9 @@ show_action_infobar (GSimpleAction *action,
gpointer data) gpointer data)
{ {
DemoApplicationWindow *window = data; DemoApplicationWindow *window = data;
char *text; gchar *text;
const char *name; const gchar *name;
const char *value; const gchar *value;
name = g_action_get_name (G_ACTION (action)); name = g_action_get_name (G_ACTION (action));
value = g_variant_get_string (parameter, NULL); value = g_variant_get_string (parameter, NULL);
@@ -92,7 +92,7 @@ activate_new (GSimpleAction *action,
static void static void
open_response_cb (GtkNativeDialog *dialog, open_response_cb (GtkNativeDialog *dialog,
int response_id, gint response_id,
gpointer user_data) gpointer user_data)
{ {
GtkFileChooserNative *native = user_data; GtkFileChooserNative *native = user_data;
@@ -185,7 +185,7 @@ activate_about (GSimpleAction *action,
{ {
GtkWidget *window = user_data; GtkWidget *window = user_data;
const char *authors[] = { const gchar *authors[] = {
"Peter Mattis", "Peter Mattis",
"Spencer Kimball", "Spencer Kimball",
"Josh MacDonald", "Josh MacDonald",
@@ -193,7 +193,7 @@ activate_about (GSimpleAction *action,
NULL NULL
}; };
const char *documentors[] = { const gchar *documentors[] = {
"Owen Taylor", "Owen Taylor",
"Tony Gale", "Tony Gale",
"Matthias Clasen <mclasen@redhat.com>", "Matthias Clasen <mclasen@redhat.com>",
@@ -244,9 +244,9 @@ static void
update_statusbar (GtkTextBuffer *buffer, update_statusbar (GtkTextBuffer *buffer,
DemoApplicationWindow *window) DemoApplicationWindow *window)
{ {
char *msg; gchar *msg;
int row, col; gint row, col;
int count; gint count;
GtkTextIter iter; GtkTextIter iter;
/* clear any previous message, underflow is allowed */ /* clear any previous message, underflow is allowed */

View File

@@ -16,8 +16,8 @@ static GtkWidget *placeholder;
static void static void
on_name_appeared (GDBusConnection *connection, on_name_appeared (GDBusConnection *connection,
const char *name, const gchar *name,
const char *name_owner, const gchar *name_owner,
gpointer user_data) gpointer user_data)
{ {
name_seen = TRUE; name_seen = TRUE;
@@ -25,7 +25,7 @@ on_name_appeared (GDBusConnection *connection,
static void static void
on_name_vanished (GDBusConnection *connection, on_name_vanished (GDBusConnection *connection,
const char *name, const gchar *name,
gpointer user_data) gpointer user_data)
{ {
if (!name_seen) if (!name_seen)
@@ -55,7 +55,7 @@ do_application_demo (GtkWidget *toplevel)
if (placeholder == NULL) if (placeholder == NULL)
{ {
const char *command; const gchar *command;
GError *error = NULL; GError *error = NULL;
if (g_file_test ("./gtk4-demo-application" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE)) if (g_file_test ("./gtk4-demo-application" APP_EXTENSION, G_FILE_TEST_IS_EXECUTABLE))

View File

@@ -12,7 +12,7 @@ static GtkWidget *progress_bar = NULL;
static gboolean static gboolean
apply_changes_gradually (gpointer data) apply_changes_gradually (gpointer data)
{ {
double fraction; gdouble fraction;
/* Work, work, work... */ /* Work, work, work... */
fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (progress_bar)); 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 static void
on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data) on_assistant_prepare (GtkWidget *widget, GtkWidget *page, gpointer data)
{ {
int current_page, n_pages; gint current_page, n_pages;
char *title; gchar *title;
current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget)); current_page = gtk_assistant_get_current_page (GTK_ASSISTANT (widget));
n_pages = gtk_assistant_get_n_pages (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); GtkAssistant *assistant = GTK_ASSISTANT (data);
GtkWidget *current_page; GtkWidget *current_page;
int page_number; gint page_number;
const char *text; const gchar *text;
page_number = gtk_assistant_get_current_page (assistant); page_number = gtk_assistant_get_current_page (assistant);
current_page = gtk_assistant_get_nth_page (assistant, page_number); current_page = gtk_assistant_get_nth_page (assistant, page_number);

View File

@@ -38,7 +38,7 @@ create_icon_store (void)
GtkTreeIter iter; GtkTreeIter iter;
GtkListStore *store; GtkListStore *store;
int i; gint i;
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING); store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
@@ -77,7 +77,7 @@ set_sensitive (GtkCellLayout *cell_layout,
gpointer data) gpointer data)
{ {
GtkTreePath *path; GtkTreePath *path;
int *indices; gint *indices;
gboolean sensitive; gboolean sensitive;
path = gtk_tree_model_get_path (tree_model, iter); path = gtk_tree_model_get_path (tree_model, iter);
@@ -175,7 +175,7 @@ create_capital_store (void)
GtkTreeIter iter, iter2; GtkTreeIter iter, iter2;
GtkTreeStore *store; GtkTreeStore *store;
int i; gint i;
store = gtk_tree_store_new (1, G_TYPE_STRING); store = gtk_tree_store_new (1, G_TYPE_STRING);

View File

@@ -38,14 +38,14 @@ struct {
#pragma GCC diagnostic ignored "-Wformat-nonliteral" #pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void static void
update_css_for_blend_mode (GtkCssProvider *provider, update_css_for_blend_mode (GtkCssProvider *provider,
const char *blend_mode) const gchar *blend_mode)
{ {
GBytes *bytes; GBytes *bytes;
char *css; gchar *css;
bytes = g_resources_lookup_data ("/css_blendmodes/css_blendmodes.css", 0, NULL); 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, blend_mode,
blend_mode); blend_mode);
@@ -62,7 +62,7 @@ row_activated (GtkListBox *listbox,
GtkListBoxRow *row, GtkListBoxRow *row,
GtkCssProvider *provider) GtkCssProvider *provider)
{ {
const char *blend_mode; const gchar *blend_mode;
blend_mode = blend_modes[gtk_list_box_row_get_index (row)].id; blend_mode = blend_modes[gtk_list_box_row_get_index (row)].id;
@@ -75,7 +75,7 @@ setup_listbox (GtkBuilder *builder,
{ {
GtkWidget *normal_row; GtkWidget *normal_row;
GtkWidget *listbox; GtkWidget *listbox;
int i; gint i;
normal_row = NULL; normal_row = NULL;
listbox = gtk_list_box_new (); listbox = gtk_list_box_new ();

View File

@@ -140,7 +140,6 @@
</gresource> </gresource>
<gresource prefix="/listview_colors"> <gresource prefix="/listview_colors">
<file compressed="true">color.names.txt</file> <file compressed="true">color.names.txt</file>
<file>listview_colors.css</file>
</gresource> </gresource>
<gresource prefix="/shortcuts"> <gresource prefix="/shortcuts">
<file>shortcuts.ui</file> <file>shortcuts.ui</file>

View File

@@ -17,7 +17,7 @@ G_DEFINE_TYPE(DemoImage, demo_image, GTK_TYPE_WIDGET)
static GdkPaintable * static GdkPaintable *
get_image_paintable (GtkImage *image) get_image_paintable (GtkImage *image)
{ {
const char *icon_name; const gchar *icon_name;
GtkIconTheme *icon_theme; GtkIconTheme *icon_theme;
GtkIconPaintable *icon; GtkIconPaintable *icon;

View File

@@ -16,7 +16,7 @@ message_dialog_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
GtkWidget *dialog; GtkWidget *dialog;
static int i = 1; static gint i = 1;
dialog = gtk_message_dialog_new (GTK_WINDOW (window), dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,

View File

@@ -597,83 +597,6 @@ css_button_new (const char *class)
return button; 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; static GtkWidget *window = NULL;
GtkWidget * GtkWidget *
@@ -747,7 +670,18 @@ do_dnd (GtkWidget *do_widget)
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
for (i = 0; colors[i]; i++) 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 ("rainbow1"));
gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow2")); gtk_box_append (GTK_BOX (box3), css_button_new ("rainbow2"));

View File

@@ -64,8 +64,8 @@ scribble_draw (GtkDrawingArea *da,
/* Draw a rectangle on the screen */ /* Draw a rectangle on the screen */
static void static void
draw_brush (GtkWidget *widget, draw_brush (GtkWidget *widget,
double x, gdouble x,
double y) gdouble y)
{ {
GdkRectangle update_rect; GdkRectangle update_rect;
cairo_t *cr; cairo_t *cr;

View File

@@ -92,7 +92,7 @@ strings_setup_item_full (GtkSignalListItemFactory *factory,
gtk_label_set_xalign (GTK_LABEL (title), 0.0); gtk_label_set_xalign (GTK_LABEL (title), 0.0);
description = gtk_label_new (""); description = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (description), 0.0); 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); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);

View File

@@ -16,9 +16,9 @@
typedef struct typedef struct
{ {
int number; gint number;
char *product; gchar *product;
int yummy; gint yummy;
} }
Item; Item;
@@ -74,7 +74,7 @@ add_items (void)
static GtkTreeModel * static GtkTreeModel *
create_items_model (void) create_items_model (void)
{ {
int i = 0; gint i = 0;
GtkListStore *model; GtkListStore *model;
GtkTreeIter iter; GtkTreeIter iter;
@@ -109,7 +109,7 @@ static GtkTreeModel *
create_numbers_model (void) create_numbers_model (void)
{ {
#define N_NUMBERS 10 #define N_NUMBERS 10
int i = 0; gint i = 0;
GtkListStore *model; GtkListStore *model;
GtkTreeIter iter; GtkTreeIter iter;
@@ -192,7 +192,7 @@ remove_item (GtkWidget *widget, gpointer data)
if (gtk_tree_selection_get_selected (selection, NULL, &iter)) if (gtk_tree_selection_get_selected (selection, NULL, &iter))
{ {
int i; gint i;
GtkTreePath *path; GtkTreePath *path;
path = gtk_tree_model_get_path (model, &iter); path = gtk_tree_model_get_path (model, &iter);
@@ -211,7 +211,7 @@ separator_row (GtkTreeModel *model,
gpointer data) gpointer data)
{ {
GtkTreePath *path; GtkTreePath *path;
int idx; gint idx;
path = gtk_tree_model_get_path (model, iter); path = gtk_tree_model_get_path (model, iter);
idx = gtk_tree_path_get_indices (path)[0]; idx = gtk_tree_path_get_indices (path)[0];
@@ -224,7 +224,7 @@ separator_row (GtkTreeModel *model,
static void static void
editing_started (GtkCellRenderer *cell, editing_started (GtkCellRenderer *cell,
GtkCellEditable *editable, GtkCellEditable *editable,
const char *path, const gchar *path,
gpointer data) gpointer data)
{ {
gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable), gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (editable),
@@ -233,15 +233,15 @@ editing_started (GtkCellRenderer *cell,
static void static void
cell_edited (GtkCellRendererText *cell, cell_edited (GtkCellRendererText *cell,
const char *path_string, const gchar *path_string,
const char *new_text, const gchar *new_text,
gpointer data) gpointer data)
{ {
GtkTreeModel *model = (GtkTreeModel *)data; GtkTreeModel *model = (GtkTreeModel *)data;
GtkTreePath *path = gtk_tree_path_new_from_string (path_string); GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
GtkTreeIter iter; 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); gtk_tree_model_get_iter (model, &iter, path);
@@ -249,7 +249,7 @@ cell_edited (GtkCellRendererText *cell,
{ {
case COLUMN_ITEM_NUMBER: case COLUMN_ITEM_NUMBER:
{ {
int i; gint i;
i = gtk_tree_path_get_indices (path)[0]; i = gtk_tree_path_get_indices (path)[0];
g_array_index (articles, Item, i).number = atoi (new_text); g_array_index (articles, Item, i).number = atoi (new_text);
@@ -261,8 +261,8 @@ cell_edited (GtkCellRendererText *cell,
case COLUMN_ITEM_PRODUCT: case COLUMN_ITEM_PRODUCT:
{ {
int i; gint i;
char *old_text; gchar *old_text;
gtk_tree_model_get (model, &iter, column, &old_text, -1); gtk_tree_model_get (model, &iter, column, &old_text, -1);
g_free (old_text); g_free (old_text);

View File

@@ -13,7 +13,7 @@
static GtkWidget *window = NULL; static GtkWidget *window = NULL;
static void static void
response_cb (GtkDialog *dialog, int response_id) response_cb (GtkDialog *dialog, gint response_id)
{ {
gtk_window_destroy (GTK_WINDOW (window)); gtk_window_destroy (GTK_WINDOW (window));
window = NULL; window = NULL;

View File

@@ -22,8 +22,8 @@ format_number (GtkTreeViewColumn *col,
GtkTreeIter *iter, GtkTreeIter *iter,
gpointer data) gpointer data)
{ {
int num; gint num;
char *text; gchar *text;
gtk_tree_model_get (model, iter, GPOINTER_TO_INT (data), &num, -1); gtk_tree_model_get (model, iter, GPOINTER_TO_INT (data), &num, -1);
text = g_strdup_printf ("%d", num); text = g_strdup_printf ("%d", num);
@@ -35,11 +35,11 @@ static void
filter_modify_func (GtkTreeModel *model, filter_modify_func (GtkTreeModel *model,
GtkTreeIter *iter, GtkTreeIter *iter,
GValue *value, GValue *value,
int column, gint column,
gpointer data) gpointer data)
{ {
GtkTreeModelFilter *filter_model = GTK_TREE_MODEL_FILTER (model); GtkTreeModelFilter *filter_model = GTK_TREE_MODEL_FILTER (model);
int width, height; gint width, height;
GtkTreeModel *child_model; GtkTreeModel *child_model;
GtkTreeIter child_iter; GtkTreeIter child_iter;
@@ -75,7 +75,7 @@ visible_func (GtkTreeModel *model,
GtkTreeIter *iter, GtkTreeIter *iter,
gpointer data) gpointer data)
{ {
int width; gint width;
gtk_tree_model_get (model, iter, gtk_tree_model_get (model, iter,
WIDTH_COLUMN, &width, WIDTH_COLUMN, &width,

View File

@@ -6,6 +6,7 @@
<property name="default-height">400</property> <property name="default-height">400</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id=""> <object class="GtkHeaderBar" id="">
<property name="show-title-buttons">1</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<style> <style>

View File

@@ -29,7 +29,7 @@ draw_color (GtkDrawingArea *drawingarea,
} }
static GtkWidget * static GtkWidget *
color_swatch_new (const char *color) color_swatch_new (const gchar *color)
{ {
GtkWidget *button, *area; GtkWidget *button, *area;
@@ -48,7 +48,7 @@ do_flowbox (GtkWidget *do_widget)
{ {
static GtkWidget *window = NULL; static GtkWidget *window = NULL;
GtkWidget *scrolled, *flowbox; GtkWidget *scrolled, *flowbox;
const char *colors[] = { const gchar *colors[] = {
"AliceBlue", "AliceBlue",
"AntiqueWhite", "AntiqueWhite",
"AntiqueWhite1", "AntiqueWhite1",
@@ -716,7 +716,7 @@ do_flowbox (GtkWidget *do_widget)
"YellowGreen", "YellowGreen",
NULL NULL
}; };
int i; gint i;
if (!window) if (!window)
{ {

View File

@@ -7,6 +7,7 @@
<property name="title">Font Explorer</property> <property name="title">Font Explorer</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">
<property name="show-title-buttons">1</property>
<child> <child>
<object class="GtkButton" id="reset"> <object class="GtkButton" id="reset">
<property name="receives-default">1</property> <property name="receives-default">1</property>

View File

@@ -295,7 +295,7 @@ update_display (void)
GList *l; GList *l;
PangoAttrList *attrs; PangoAttrList *attrs;
PangoAttribute *attr; PangoAttribute *attr;
int ins, bound; gint ins, bound;
guint start, end; guint start, end;
PangoLanguage *lang; PangoLanguage *lang;
char *font_desc; char *font_desc;
@@ -479,7 +479,7 @@ update_script_combo (void)
{ {
GtkListStore *store; GtkListStore *store;
hb_font_t *hb_font; hb_font_t *hb_font;
int i, j, k; gint i, j, k;
PangoFont *pango_font; PangoFont *pango_font;
GHashTable *tags; GHashTable *tags;
GHashTableIter iter; GHashTableIter iter;
@@ -593,7 +593,7 @@ update_script_combo (void)
static void static void
update_features (void) update_features (void)
{ {
int i, j; gint i, j;
GtkTreeModel *model; GtkTreeModel *model;
GtkTreeIter iter; GtkTreeIter iter;
guint script_index, lang_index; guint script_index, lang_index;
@@ -728,8 +728,8 @@ static void
entry_activated (GtkEntry *entry, entry_activated (GtkEntry *entry,
GtkAdjustment *adjustment) GtkAdjustment *adjustment)
{ {
double value; gdouble value;
char *err = NULL; gchar *err = NULL;
value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err); value = g_strtod (gtk_editable_get_text (GTK_EDITABLE (entry)), &err);
if (err != NULL) if (err != NULL)
@@ -939,7 +939,7 @@ instance_changed (GtkComboBox *combo)
{ {
Axis *axis; Axis *axis;
Axis akey; Axis akey;
double value; gdouble value;
value = coords[ai[i].axis_index]; value = coords[ai[i].axis_index];

View File

@@ -36,11 +36,11 @@ adjustment_get_normalized_value (GtkAdjustment *adj)
static void static void
val_to_xy (GtkFontPlane *plane, val_to_xy (GtkFontPlane *plane,
int *x, gint *x,
int *y) gint *y)
{ {
double u, v; gdouble u, v;
int width, height; gint width, height;
width = gtk_widget_get_allocated_width (GTK_WIDGET (plane)); width = gtk_widget_get_allocated_width (GTK_WIDGET (plane));
height = gtk_widget_get_allocated_height (GTK_WIDGET (plane)); height = gtk_widget_get_allocated_height (GTK_WIDGET (plane));
@@ -57,8 +57,8 @@ plane_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot) GtkSnapshot *snapshot)
{ {
GtkFontPlane *plane = GTK_FONT_PLANE (widget); GtkFontPlane *plane = GTK_FONT_PLANE (widget);
int x, y; gint x, y;
int width, height; gint width, height;
cairo_t *cr; cairo_t *cr;
val_to_xy (plane, &x, &y); val_to_xy (plane, &x, &y);
@@ -125,11 +125,11 @@ adjustment_set_normalized_value (GtkAdjustment *adj,
static void static void
update_value (GtkFontPlane *plane, update_value (GtkFontPlane *plane,
int x, gint x,
int y) gint y)
{ {
GtkWidget *widget = GTK_WIDGET (plane); GtkWidget *widget = GTK_WIDGET (plane);
double u, v; gdouble u, v;
u = CLAMP (x * (1.0 / gtk_widget_get_allocated_width (widget)), 0, 1); 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); v = CLAMP (1 - y * (1.0 / gtk_widget_get_allocated_height (widget)), 0, 1);
@@ -142,8 +142,8 @@ update_value (GtkFontPlane *plane,
static void static void
plane_drag_gesture_begin (GtkGestureDrag *gesture, plane_drag_gesture_begin (GtkGestureDrag *gesture,
double start_x, gdouble start_x,
double start_y, gdouble start_y,
GtkFontPlane *plane) GtkFontPlane *plane)
{ {
guint button; guint button;
@@ -164,11 +164,11 @@ plane_drag_gesture_begin (GtkGestureDrag *gesture,
static void static void
plane_drag_gesture_update (GtkGestureDrag *gesture, plane_drag_gesture_update (GtkGestureDrag *gesture,
double offset_x, gdouble offset_x,
double offset_y, gdouble offset_y,
GtkFontPlane *plane) GtkFontPlane *plane)
{ {
double start_x, start_y; gdouble start_x, start_y;
gtk_gesture_drag_get_start_point (GTK_GESTURE_DRAG (gesture), gtk_gesture_drag_get_start_point (GTK_GESTURE_DRAG (gesture),
&start_x, &start_y); &start_x, &start_y);
@@ -177,8 +177,8 @@ plane_drag_gesture_update (GtkGestureDrag *gesture,
static void static void
plane_drag_gesture_end (GtkGestureDrag *gesture, plane_drag_gesture_end (GtkGestureDrag *gesture,
double offset_x, gdouble offset_x,
double offset_y, gdouble offset_y,
GtkFontPlane *plane) GtkFontPlane *plane)
{ {
set_cross_cursor (GTK_WIDGET (plane), FALSE); set_cross_cursor (GTK_WIDGET (plane), FALSE);

View File

@@ -9,8 +9,8 @@
static GtkGesture *rotate = NULL; static GtkGesture *rotate = NULL;
static GtkGesture *zoom = NULL; static GtkGesture *zoom = NULL;
static double swipe_x = 0; static gdouble swipe_x = 0;
static double swipe_y = 0; static gdouble swipe_y = 0;
static gboolean long_pressed = FALSE; static gboolean long_pressed = FALSE;
static gboolean static gboolean
@@ -26,8 +26,8 @@ touchpad_swipe_gesture_begin (GtkGesture *gesture,
static void static void
swipe_gesture_swept (GtkGestureSwipe *gesture, swipe_gesture_swept (GtkGestureSwipe *gesture,
double velocity_x, gdouble velocity_x,
double velocity_y, gdouble velocity_y,
GtkWidget *widget) GtkWidget *widget)
{ {
swipe_x = velocity_x / 10; swipe_x = velocity_x / 10;
@@ -37,8 +37,8 @@ swipe_gesture_swept (GtkGestureSwipe *gesture,
static void static void
long_press_gesture_pressed (GtkGestureLongPress *gesture, long_press_gesture_pressed (GtkGestureLongPress *gesture,
double x, gdouble x,
double y, gdouble y,
GtkWidget *widget) GtkWidget *widget)
{ {
long_pressed = TRUE; long_pressed = TRUE;
@@ -56,8 +56,8 @@ long_press_gesture_end (GtkGesture *gesture,
static void static void
rotation_angle_changed (GtkGestureRotate *gesture, rotation_angle_changed (GtkGestureRotate *gesture,
double angle, gdouble angle,
double delta, gdouble delta,
GtkWidget *widget) GtkWidget *widget)
{ {
gtk_widget_queue_draw (widget); gtk_widget_queue_draw (widget);
@@ -65,7 +65,7 @@ rotation_angle_changed (GtkGestureRotate *gesture,
static void static void
zoom_scale_changed (GtkGestureZoom *gesture, zoom_scale_changed (GtkGestureZoom *gesture,
double scale, gdouble scale,
GtkWidget *widget) GtkWidget *widget)
{ {
gtk_widget_queue_draw (widget); gtk_widget_queue_draw (widget);
@@ -93,8 +93,8 @@ drawing_area_draw (GtkDrawingArea *area,
{ {
cairo_pattern_t *pat; cairo_pattern_t *pat;
cairo_matrix_t matrix; cairo_matrix_t matrix;
double angle, scale; gdouble angle, scale;
double x_center, y_center; gdouble x_center, y_center;
gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center); gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center);

View File

@@ -98,7 +98,7 @@ gtk_fishbowl_measure (GtkWidget *widget,
GHashTableIter iter; GHashTableIter iter;
gpointer key, value; gpointer key, value;
GtkFishbowlChild *child; GtkFishbowlChild *child;
int child_min, child_nat; gint child_min, child_nat;
*minimum = 0; *minimum = 0;
*natural = 0; *natural = 0;

View File

@@ -30,6 +30,7 @@ do_headerbar (GtkWidget *do_widget)
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
header = gtk_header_bar_new (); header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
button = gtk_button_new (); button = gtk_button_new ();
icon = g_themed_icon_new ("mail-send-receive-symbolic"); icon = g_themed_icon_new ("mail-send-receive-symbolic");

View File

@@ -18,7 +18,7 @@ static void
insert_link (GtkTextBuffer *buffer, insert_link (GtkTextBuffer *buffer,
GtkTextIter *iter, GtkTextIter *iter,
const char *text, const char *text,
int page) gint page)
{ {
GtkTextTag *tag; GtkTextTag *tag;
@@ -35,7 +35,7 @@ insert_link (GtkTextBuffer *buffer,
*/ */
static void static void
show_page (GtkTextBuffer *buffer, show_page (GtkTextBuffer *buffer,
int page) gint page)
{ {
GtkTextIter iter; GtkTextIter iter;
@@ -91,7 +91,7 @@ follow_if_link (GtkWidget *text_view,
for (tagp = tags; tagp != NULL; tagp = tagp->next) for (tagp = tags; tagp != NULL; tagp = tagp->next)
{ {
GtkTextTag *tag = tagp->data; 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) if (page != 0)
{ {
@@ -134,14 +134,14 @@ key_pressed (GtkEventController *controller,
} }
static void set_cursor_if_appropriate (GtkTextView *text_view, static void set_cursor_if_appropriate (GtkTextView *text_view,
int x, gint x,
int y); gint y);
static void static void
released_cb (GtkGestureClick *gesture, released_cb (GtkGestureClick *gesture,
guint n_press, guint n_press,
double x, gdouble x,
double y, gdouble y,
GtkWidget *text_view) GtkWidget *text_view)
{ {
GtkTextIter start, end, iter; GtkTextIter start, end, iter;
@@ -168,8 +168,8 @@ released_cb (GtkGestureClick *gesture,
static void static void
motion_cb (GtkEventControllerMotion *controller, motion_cb (GtkEventControllerMotion *controller,
double x, gdouble x,
double y, gdouble y,
GtkTextView *text_view) GtkTextView *text_view)
{ {
set_cursor_if_appropriate (text_view, x, y); set_cursor_if_appropriate (text_view, x, y);
@@ -183,8 +183,8 @@ static gboolean hovering_over_link = FALSE;
*/ */
static void static void
set_cursor_if_appropriate (GtkTextView *text_view, set_cursor_if_appropriate (GtkTextView *text_view,
int x, gint x,
int y) gint y)
{ {
GSList *tags = NULL, *tagp = NULL; GSList *tags = NULL, *tagp = NULL;
GtkTextIter iter; GtkTextIter iter;
@@ -196,7 +196,7 @@ set_cursor_if_appropriate (GtkTextView *text_view,
for (tagp = tags; tagp != NULL; tagp = tagp->next) for (tagp = tags; tagp != NULL; tagp = tagp->next)
{ {
GtkTextTag *tag = tagp->data; 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) if (page != 0)
{ {

View File

@@ -6,6 +6,7 @@
<property name="default-height">500</property> <property name="default-height">500</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">
<property name="show-title-buttons">1</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<style> <style>

View File

@@ -25,7 +25,7 @@ enum
static GdkPixbuf *file_pixbuf, *folder_pixbuf; static GdkPixbuf *file_pixbuf, *folder_pixbuf;
char *parent; gchar *parent;
GtkWidget *up_button; GtkWidget *up_button;
/* Loads the images for the demo and returns whether the operation succeeded */ /* Loads the images for the demo and returns whether the operation succeeded */
@@ -47,7 +47,7 @@ static void
fill_store (GtkListStore *store) fill_store (GtkListStore *store)
{ {
GDir *dir; GDir *dir;
const char *name; const gchar *name;
GtkTreeIter iter; GtkTreeIter iter;
/* First clear the store */ /* First clear the store */
@@ -62,7 +62,7 @@ fill_store (GtkListStore *store)
name = g_dir_read_name (dir); name = g_dir_read_name (dir);
while (name != NULL) while (name != NULL)
{ {
char *path, *display_name; gchar *path, *display_name;
gboolean is_dir; gboolean is_dir;
/* We ignore hidden files that start with a '.' */ /* We ignore hidden files that start with a '.' */
@@ -90,14 +90,14 @@ fill_store (GtkListStore *store)
g_dir_close (dir); g_dir_close (dir);
} }
static int static gint
sort_func (GtkTreeModel *model, sort_func (GtkTreeModel *model,
GtkTreeIter *a, GtkTreeIter *a,
GtkTreeIter *b, GtkTreeIter *b,
gpointer user_data) gpointer user_data)
{ {
gboolean is_dir_a, is_dir_b; gboolean is_dir_a, is_dir_b;
char *name_a, *name_b; gchar *name_a, *name_b;
int ret; int ret;
/* We need this function because we want to sort /* We need this function because we want to sort
@@ -158,7 +158,7 @@ item_activated (GtkIconView *icon_view,
gpointer user_data) gpointer user_data)
{ {
GtkListStore *store; GtkListStore *store;
char *path; gchar *path;
GtkTreeIter iter; GtkTreeIter iter;
gboolean is_dir; gboolean is_dir;
@@ -192,7 +192,7 @@ up_clicked (GtkButton *item,
gpointer user_data) gpointer user_data)
{ {
GtkListStore *store; GtkListStore *store;
char *dir_name; gchar *dir_name;
store = GTK_LIST_STORE (user_data); store = GTK_LIST_STORE (user_data);

View File

@@ -19,8 +19,8 @@ static void
fill_store (GtkListStore *store) fill_store (GtkListStore *store)
{ {
GtkTreeIter iter; GtkTreeIter iter;
const char *text[] = { "Red", "Green", "Blue", "Yellow" }; const gchar *text[] = { "Red", "Green", "Blue", "Yellow" };
int i; gint i;
/* First clear the store */ /* First clear the store */
gtk_list_store_clear (store); gtk_list_store_clear (store);
@@ -49,7 +49,7 @@ set_cell_color (GtkCellLayout *cell_layout,
GtkTreeIter *iter, GtkTreeIter *iter,
gpointer data) gpointer data)
{ {
char *text; gchar *text;
GdkRGBA color; GdkRGBA color;
guint32 pixel = 0; guint32 pixel = 0;
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
@@ -60,10 +60,10 @@ set_cell_color (GtkCellLayout *cell_layout,
if (gdk_rgba_parse (&color, text)) if (gdk_rgba_parse (&color, text))
pixel = pixel =
((int)(color.red * 255)) << 24 | ((gint)(color.red * 255)) << 24 |
((int)(color.green * 255)) << 16 | ((gint)(color.green * 255)) << 16 |
((int)(color.blue * 255)) << 8 | ((gint)(color.blue * 255)) << 8 |
((int)(color.alpha * 255)); ((gint)(color.alpha * 255));
g_free (text); g_free (text);
@@ -77,8 +77,8 @@ set_cell_color (GtkCellLayout *cell_layout,
static void static void
edited (GtkCellRendererText *cell, edited (GtkCellRendererText *cell,
char *path_string, gchar *path_string,
char *text, gchar *text,
gpointer data) gpointer data)
{ {
GtkTreeModel *model; GtkTreeModel *model;

View File

@@ -43,10 +43,10 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
static void static void
progressive_updated_callback (GdkPixbufLoader *loader, progressive_updated_callback (GdkPixbufLoader *loader,
int x, gint x,
int y, gint y,
int width, gint width,
int height, gint height,
gpointer data) gpointer data)
{ {
GtkWidget *picture; GtkWidget *picture;
@@ -58,7 +58,7 @@ progressive_updated_callback (GdkPixbufLoader *loader,
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf); gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
} }
static int static gint
progressive_timeout (gpointer data) progressive_timeout (gpointer data)
{ {
GtkWidget *picture; GtkWidget *picture;

View File

@@ -8,7 +8,7 @@
static void static void
on_bar_response (GtkInfoBar *info_bar, on_bar_response (GtkInfoBar *info_bar,
int response_id, gint response_id,
gpointer user_data) gpointer user_data)
{ {
GtkWidget *dialog; GtkWidget *dialog;

View File

@@ -9,7 +9,7 @@
static void static void
response_cb (GtkWidget *dialog, response_cb (GtkWidget *dialog,
int response_id, gint response_id,
gpointer data) gpointer data)
{ {
gtk_window_destroy (GTK_WINDOW (dialog)); gtk_window_destroy (GTK_WINDOW (dialog));
@@ -17,7 +17,7 @@ response_cb (GtkWidget *dialog,
static gboolean static gboolean
activate_link (GtkWidget *label, activate_link (GtkWidget *label,
const char *uri, const gchar *uri,
gpointer data) gpointer data)
{ {
if (g_strcmp0 (uri, "keynav") == 0) if (g_strcmp0 (uri, "keynav") == 0)

View File

@@ -81,7 +81,7 @@ spinner_timeout (gpointer data)
static GtkTreeModel * static GtkTreeModel *
create_model (void) create_model (void)
{ {
int i = 0; gint i = 0;
GtkListStore *store; GtkListStore *store;
GtkTreeIter iter; GtkTreeIter iter;

View File

@@ -89,14 +89,14 @@ static GParamSpec *color_properties[N_COLOR_PROPS] = { NULL, };
static void static void
rgb_to_hsv (GdkRGBA *rgba, rgb_to_hsv (GdkRGBA *rgba,
double *h_out, gdouble *h_out,
double *s_out, gdouble *s_out,
double *v_out) gdouble *v_out)
{ {
double red, green, blue; gdouble red, green, blue;
double h, s, v; gdouble h, s, v;
double min, max; gdouble min, max;
double delta; gdouble delta;
red = rgba->red; red = rgba->red;
green = rgba->green; green = rgba->green;
@@ -627,23 +627,6 @@ setup_listitem_cb (GtkListItemFactory *factory,
gtk_expression_unref (color_expression); 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 static void
set_title (gpointer item, set_title (gpointer item,
const char *title) const char *title)
@@ -662,6 +645,7 @@ create_color_grid (void)
{ {
GtkWidget *gridview; GtkWidget *gridview;
GtkListItemFactory *factory; GtkListItemFactory *factory;
GListModel *model, *selection;
gridview = gtk_grid_view_new (); gridview = gtk_grid_view_new ();
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL); gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
@@ -675,6 +659,13 @@ create_color_grid (void)
gtk_grid_view_set_max_columns (GTK_GRID_VIEW (gridview), 24); gtk_grid_view_set_max_columns (GTK_GRID_VIEW (gridview), 24);
gtk_grid_view_set_enable_rubberband (GTK_GRID_VIEW (gridview), TRUE); 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_multi_selection_new (model));
gtk_grid_view_set_model (GTK_GRID_VIEW (gridview), selection);
g_object_unref (selection);
g_object_unref (model);
return gridview; return gridview;
} }
@@ -786,63 +777,6 @@ bind_number_item (GtkSignalListItemFactory *factory,
g_free (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; static GtkWidget *window = NULL;
GtkWidget * GtkWidget *
@@ -850,11 +784,10 @@ do_listview_colors (GtkWidget *do_widget)
{ {
if (window == NULL) if (window == NULL)
{ {
GtkMultiSelection *selection; GtkWidget *header, *gridview, *sw, *box, *dropdown;
GtkSortListModel *sort_model;
GtkWidget *header, *overlay, *gridview, *sw, *box, *dropdown;
GtkListItemFactory *factory; GtkListItemFactory *factory;
GListStore *factories; GListStore *factories;
GListModel *model;
GtkSorter *sorter; GtkSorter *sorter;
GtkSorter *multi_sorter; GtkSorter *multi_sorter;
GListStore *sorters; GListStore *sorters;
@@ -864,31 +797,11 @@ do_listview_colors (GtkWidget *do_widget)
PangoAttrList *attrs; PangoAttrList *attrs;
char *string; char *string;
guint len; 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 (gtk_multi_selection_new (G_LIST_MODEL (sort_model)));
window = gtk_window_new (); window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Colors"); gtk_window_set_title (GTK_WINDOW (window), "Colors");
header = gtk_header_bar_new (); 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_titlebar (GTK_WINDOW (window), header);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
@@ -896,96 +809,18 @@ do_listview_colors (GtkWidget *do_widget)
gtk_widget_get_display (do_widget)); gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer*)&window); 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 (); sw = gtk_scrolled_window_new ();
gtk_widget_set_hexpand (sw, TRUE); gtk_window_set_child (GTK_WINDOW (window), sw);
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 (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);
gridview = create_color_grid (); 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_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), gridview);
gtk_widget_set_hexpand (sw, TRUE); model = gtk_grid_view_get_model (GTK_GRID_VIEW (gridview));
gtk_widget_set_vexpand (sw, TRUE); g_object_get (model, "model", &model, NULL);
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 (selection_filter);
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);
button = gtk_button_new_with_mnemonic ("_Refill"); button = gtk_button_new_with_mnemonic ("_Refill");
g_signal_connect (button, "clicked", g_signal_connect (button, "clicked",
G_CALLBACK (refill), 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); gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
@@ -1000,14 +835,15 @@ do_listview_colors (GtkWidget *do_widget)
gtk_label_set_width_chars (GTK_LABEL (label), len + 2); gtk_label_set_width_chars (GTK_LABEL (label), len + 2);
gtk_label_set_xalign (GTK_LABEL (label), 1); 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); gtk_header_bar_pack_start (GTK_HEADER_BAR (header), label);
dropdown = gtk_drop_down_new (); 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 }); 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_signal_connect (dropdown, "notify::selected",
G_CALLBACK (limit_changed_cb), 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_signal_connect (dropdown, "notify::selected",
G_CALLBACK (limit_changed_cb2), G_CALLBACK (limit_changed_cb2),
label); label);
@@ -1099,7 +935,7 @@ do_listview_colors (GtkWidget *do_widget)
gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (sorters)); gtk_drop_down_set_model (GTK_DROP_DOWN (dropdown), G_LIST_MODEL (sorters));
g_object_unref (sorters); g_object_unref (sorters);
g_object_bind_property (dropdown, "selected-item", sort_model, "sorter", G_BINDING_SYNC_CREATE); g_object_bind_property (dropdown, "selected-item", model, "sorter", G_BINDING_SYNC_CREATE);
factories = g_list_store_new (GTK_TYPE_LIST_ITEM_FACTORY); factories = g_list_store_new (GTK_TYPE_LIST_ITEM_FACTORY);
@@ -1131,6 +967,7 @@ do_listview_colors (GtkWidget *do_widget)
g_object_unref (factories); g_object_unref (factories);
g_object_bind_property (dropdown, "selected-item", gridview, "factory", G_BINDING_SYNC_CREATE); g_object_bind_property (dropdown, "selected-item", gridview, "factory", G_BINDING_SYNC_CREATE);
g_object_unref (model);
} }
if (!gtk_widget_get_visible (window)) if (!gtk_widget_get_visible (window))

View File

@@ -1,3 +0,0 @@
.view.compact > child {
padding: 1px;
}

View File

@@ -1,11 +1,11 @@
listview.viewswitcher { list.viewswitcher {
border: 1px solid gray; border: 1px solid gray;
} }
listview.viewswitcher > row { list.viewswitcher > row {
padding: 5px; padding: 5px;
} }
listview.viewswitcher row:selected { list.viewswitcher row:selected {
background: gray; background: gray;
} }

View File

@@ -174,6 +174,7 @@
<property name="default-height">400</property> <property name="default-height">400</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id=""> <object class="GtkHeaderBar" id="">
<property name="show-title-buttons">1</property>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">go-up-symbolic</property> <property name="icon-name">go-up-symbolic</property>

View File

@@ -6,6 +6,7 @@
<property name="title" translatable="yes">Minesweeper</property> <property name="title" translatable="yes">Minesweeper</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id=""> <object class="GtkHeaderBar" id="">
<property name="show-title-buttons">1</property>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="label">New Game</property> <property name="label">New Game</property>

View File

@@ -215,6 +215,7 @@ transform_settings_to_keys (GBinding *binding,
GtkFilterListModel *filter_model; GtkFilterListModel *filter_model;
GtkFilter *filter; GtkFilter *filter;
GtkNoSelection *selection_model; GtkNoSelection *selection_model;
GtkExpression *expression;
char **keys; char **keys;
guint i; guint i;
@@ -245,8 +246,11 @@ transform_settings_to_keys (GBinding *binding,
gtk_column_view_get_sorter (GTK_COLUMN_VIEW (data))); gtk_column_view_get_sorter (GTK_COLUMN_VIEW (data)));
g_object_unref (store); g_object_unref (store);
filter = gtk_string_filter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "name")); 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); filter_model = gtk_filter_list_model_new (G_LIST_MODEL (sort_model), filter);
gtk_expression_unref (expression);
g_object_unref (sort_model); g_object_unref (sort_model);
g_set_object (&current_filter, filter); g_set_object (&current_filter, filter);

View File

@@ -6,6 +6,7 @@
<property name="default-height">480</property> <property name="default-height">480</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">
<property name="show-title-buttons">1</property>
<child type="end"> <child type="end">
<object class="GtkToggleButton" id="search_button"> <object class="GtkToggleButton" id="search_button">
<property name="icon-name">system-search-symbolic</property> <property name="icon-name">system-search-symbolic</property>

View File

@@ -194,8 +194,8 @@ create_weather_model (void)
} }
static void static void
setup_widget (GtkSignalListItemFactory *factory, setup_widget (GtkListItem *list_item,
GtkListItem *list_item) gpointer unused)
{ {
GtkWidget *box, *child; GtkWidget *box, *child;
@@ -218,8 +218,8 @@ setup_widget (GtkSignalListItemFactory *factory,
} }
static void static void
bind_widget (GtkSignalListItemFactory *factory, bind_widget (GtkListItem *list_item,
GtkListItem *list_item) gpointer unused)
{ {
GtkWidget *box, *child; GtkWidget *box, *child;
GtkWeatherInfo *info; GtkWeatherInfo *info;
@@ -282,12 +282,11 @@ create_weather_view (void)
{ {
GtkWidget *listview; GtkWidget *listview;
GListModel *model, *selection; GListModel *model, *selection;
GtkListItemFactory *factory;
factory = gtk_signal_list_item_factory_new (); listview = gtk_list_view_new_with_factory (
g_signal_connect (factory, "setup", G_CALLBACK (setup_widget), NULL); gtk_functions_list_item_factory_new (setup_widget,
g_signal_connect (factory, "bind", G_CALLBACK (bind_widget), NULL); bind_widget,
listview = gtk_list_view_new_with_factory (factory); NULL, NULL));
gtk_orientable_set_orientation (GTK_ORIENTABLE (listview), GTK_ORIENTATION_HORIZONTAL); gtk_orientable_set_orientation (GTK_ORIENTABLE (listview), GTK_ORIENTATION_HORIZONTAL);
gtk_list_view_set_show_separators (GTK_LIST_VIEW (listview), TRUE); gtk_list_view_set_show_separators (GTK_LIST_VIEW (listview), TRUE);
model = create_weather_model (); model = create_weather_model ();

View File

@@ -160,6 +160,7 @@ do_listview_words (GtkWidget *do_widget)
GtkNoSelection *selection; GtkNoSelection *selection;
GtkStringList *stringlist; GtkStringList *stringlist;
GtkFilter *filter; GtkFilter *filter;
GtkExpression *expression;
GFile *file; GFile *file;
file = g_file_new_for_path ("/usr/share/dict/words"); file = g_file_new_for_path ("/usr/share/dict/words");
@@ -176,7 +177,10 @@ do_listview_words (GtkWidget *do_widget)
g_strfreev (words); g_strfreev (words);
} }
filter = gtk_string_filter_new (gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string")); filter = gtk_string_filter_new ();
expression = gtk_property_expression_new (GTK_TYPE_STRING_OBJECT, NULL, "string");
gtk_string_filter_set_expression (GTK_STRING_FILTER (filter), expression);
gtk_expression_unref (expression);
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (stringlist), filter); filter_model = gtk_filter_list_model_new (G_LIST_MODEL (stringlist), filter);
gtk_filter_list_model_set_incremental (filter_model, TRUE); gtk_filter_list_model_set_incremental (filter_model, TRUE);
@@ -211,7 +215,6 @@ do_listview_words (GtkWidget *do_widget)
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), progress); gtk_overlay_add_overlay (GTK_OVERLAY (overlay), progress);
sw = gtk_scrolled_window_new (); sw = gtk_scrolled_window_new ();
gtk_widget_set_vexpand (sw, TRUE);
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw); gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
listview = gtk_list_view_new_with_factory ( listview = gtk_list_view_new_with_factory (

View File

@@ -13,12 +13,11 @@
static GtkWidget *info_view; static GtkWidget *info_view;
static GtkWidget *source_view; static GtkWidget *source_view;
static char *current_file = NULL; static gchar *current_file = NULL;
static GtkWidget *notebook; static GtkWidget *notebook;
static GtkSingleSelection *selection; static GtkSingleSelection *selection;
static GtkWidget *toplevel; static GtkWidget *toplevel;
static char **search_needle;
typedef struct _GtkDemo GtkDemo; typedef struct _GtkDemo GtkDemo;
struct _GtkDemo struct _GtkDemo
@@ -141,7 +140,7 @@ activate_about (GSimpleAction *action,
gpointer user_data) gpointer user_data)
{ {
GtkApplication *app = user_data; GtkApplication *app = user_data;
const char *authors[] = { const gchar *authors[] = {
"The GTK Team", "The GTK Team",
NULL NULL
}; };
@@ -252,9 +251,11 @@ static const char *types[] =
"static", "static",
"const ", "const ",
"void", "void",
"gint",
" int ", " int ",
" char ", " char ",
"char ", "gchar ",
"gfloat",
"float", "float",
"double", "double",
"gint8", "gint8",
@@ -270,6 +271,8 @@ static const char *types[] =
"gshort", "gshort",
"gushort", "gushort",
"gulong", "gulong",
"gdouble",
"gldouble",
"gpointer", "gpointer",
"NULL", "NULL",
"GList", "GList",
@@ -381,14 +384,14 @@ static const char *control[] =
NULL NULL
}; };
void void
parse_chars (char *text, parse_chars (gchar *text,
char **end_ptr, gchar **end_ptr,
int *state, gint *state,
const char **tag, const char **tag,
gboolean start) gboolean start)
{ {
int i; gint i;
char *next_token; gchar *next_token;
/* Handle comments first */ /* Handle comments first */
if (*state == STATE_IN_COMMENT) if (*state == STATE_IN_COMMENT)
@@ -458,7 +461,7 @@ parse_chars (char *text,
/* check for string */ /* check for string */
if (text[0] == '"') if (text[0] == '"')
{ {
int maybe_escape = FALSE; gint maybe_escape = FALSE;
*end_ptr = text + 1; *end_ptr = text + 1;
*tag = "string"; *tag = "string";
@@ -521,9 +524,9 @@ void
fontify (GtkTextBuffer *source_buffer) fontify (GtkTextBuffer *source_buffer)
{ {
GtkTextIter start_iter, next_iter, tmp_iter; GtkTextIter start_iter, next_iter, tmp_iter;
int state; gint state;
char *text; gchar *text;
char *start_ptr, *end_ptr; gchar *start_ptr, *end_ptr;
const char *tag; const char *tag;
gtk_text_buffer_create_tag (source_buffer, "source", gtk_text_buffer_create_tag (source_buffer, "source",
@@ -691,10 +694,10 @@ static struct {
}; };
static void static void
add_data_tab (const char *demoname) add_data_tab (const gchar *demoname)
{ {
char *resource_dir, *resource_name; gchar *resource_dir, *resource_name;
char **resources; gchar **resources;
GtkWidget *widget, *label; GtkWidget *widget, *label;
guint i, j; guint i, j;
@@ -738,15 +741,15 @@ add_data_tab (const char *demoname)
static void static void
remove_data_tabs (void) remove_data_tabs (void)
{ {
int i; gint i;
for (i = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) - 1; i > 1; i--) for (i = gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) - 1; i > 1; i--)
gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), i); gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), i);
} }
void void
load_file (const char *demoname, load_file (const gchar *demoname,
const char *filename) const gchar *filename)
{ {
GtkTextBuffer *info_buffer, *source_buffer; GtkTextBuffer *info_buffer, *source_buffer;
GtkTextIter start, end; GtkTextIter start, end;
@@ -754,9 +757,9 @@ load_file (const char *demoname,
GError *err = NULL; GError *err = NULL;
int state = 0; int state = 0;
gboolean in_para = 0; gboolean in_para = 0;
char **lines; gchar **lines;
GBytes *bytes; GBytes *bytes;
int i; gint i;
if (!g_strcmp0 (current_file, filename)) if (!g_strcmp0 (current_file, filename))
return; return;
@@ -796,9 +799,9 @@ load_file (const char *demoname,
gtk_text_buffer_get_iter_at_offset (info_buffer, &start, 0); gtk_text_buffer_get_iter_at_offset (info_buffer, &start, 0);
for (i = 0; lines[i] != NULL; i++) for (i = 0; lines[i] != NULL; i++)
{ {
char *p; gchar *p;
char *q; gchar *q;
char *r; gchar *r;
/* Make sure \r is stripped at the end for the poor windows people */ /* Make sure \r is stripped at the end for the poor windows people */
lines[i] = g_strchomp (lines[i]); lines[i] = g_strchomp (lines[i]);
@@ -942,18 +945,7 @@ selection_cb (GtkSingleSelection *sel,
gpointer user_data) gpointer user_data)
{ {
GtkTreeListRow *row = gtk_single_selection_get_selected_item (sel); GtkTreeListRow *row = gtk_single_selection_get_selected_item (sel);
GtkDemo *demo; GtkDemo *demo = gtk_tree_list_row_get_item (row);
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);
if (demo->filename) if (demo->filename)
load_file (demo->name, demo->filename); load_file (demo->name, demo->filename);
@@ -961,84 +953,6 @@ selection_cb (GtkSingleSelection *sel,
gtk_window_set_title (GTK_WINDOW (toplevel), demo->title); 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 * static GListModel *
create_demo_model (void) create_demo_model (void)
{ {
@@ -1093,25 +1007,13 @@ get_child_model (gpointer item,
return NULL; 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 static void
activate (GApplication *app) activate (GApplication *app)
{ {
GtkBuilder *builder; GtkBuilder *builder;
GListModel *listmodel; GListModel *listmodel;
GtkTreeListModel *treemodel; GtkTreeListModel *treemodel;
GtkWidget *window, *listview, *search_entry, *search_bar; GtkWidget *window, *listview;
GtkFilterListModel *filter_model;
GtkFilter *filter;
static GActionEntry win_entries[] = { static GActionEntry win_entries[] = {
{ "run", activate_run, NULL, NULL, NULL } { "run", activate_run, NULL, NULL, NULL }
@@ -1132,8 +1034,6 @@ activate (GApplication *app)
toplevel = GTK_WIDGET (window); toplevel = GTK_WIDGET (window);
listview = GTK_WIDGET (gtk_builder_get_object (builder, "listview")); listview = GTK_WIDGET (gtk_builder_get_object (builder, "listview"));
g_signal_connect (listview, "activate", G_CALLBACK (activate_cb), window); 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 (); listmodel = create_demo_model ();
treemodel = gtk_tree_list_model_new (FALSE, treemodel = gtk_tree_list_model_new (FALSE,
@@ -1142,13 +1042,7 @@ activate (GApplication *app)
get_child_model, get_child_model,
NULL, NULL,
NULL); NULL);
filter_model = gtk_filter_list_model_new (G_LIST_MODEL (treemodel), NULL); selection = gtk_single_selection_new (G_LIST_MODEL (treemodel));
filter = gtk_custom_filter_new ((GtkCustomFilterFunc)demo_filter_by_name, filter_model, NULL);
gtk_filter_list_model_set_filter (filter_model, 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));
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL); 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)); gtk_list_view_set_model (GTK_LIST_VIEW (listview), G_LIST_MODEL (selection));
@@ -1186,12 +1080,12 @@ list_demos (void)
} }
} }
static int static gint
command_line (GApplication *app, command_line (GApplication *app,
GApplicationCommandLine *cmdline) GApplicationCommandLine *cmdline)
{ {
GVariantDict *options; GVariantDict *options;
const char *name = NULL; const gchar *name = NULL;
gboolean autoquit = FALSE; gboolean autoquit = FALSE;
gboolean list = FALSE; gboolean list = FALSE;
DemoData *d, *c; DemoData *d, *c;
@@ -1245,6 +1139,7 @@ out:
demo = (func) (window); demo = (func) (window);
gtk_window_set_transient_for (GTK_WINDOW (demo), GTK_WINDOW (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); g_signal_connect_swapped (G_OBJECT (demo), "destroy", G_CALLBACK (g_application_quit), app);
} }
@@ -1294,8 +1189,8 @@ main (int argc, char **argv)
{ "inspector", activate_inspector, NULL, NULL, NULL }, { "inspector", activate_inspector, NULL, NULL, NULL },
}; };
struct { struct {
const char *action_and_target; const gchar *action_and_target;
const char *accelerators[2]; const gchar *accelerators[2];
} accels[] = { } accels[] = {
{ "app.about", { "F1", NULL } }, { "app.about", { "F1", NULL } },
{ "app.quit", { "<Control>q", NULL } }, { "app.quit", { "<Control>q", NULL } },

View File

@@ -24,6 +24,7 @@
<property name="default-height">600</property> <property name="default-height">600</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="headerbar"> <object class="GtkHeaderBar" id="headerbar">
<property name="show-title-buttons">1</property>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="valign">center</property> <property name="valign">center</property>
@@ -55,29 +56,12 @@
<property name="hscrollbar-policy">never</property> <property name="hscrollbar-policy">never</property>
<property name="min-content-width">150</property> <property name="min-content-width">150</property>
<child> <child>
<object class="GtkBox"> <object class="GtkListView" id="listview">
<property name="width-request">220</property> <property name="factory">
<property name="orientation">vertical</property> <object class="GtkBuilderListItemFactory">
<property name="resource">/ui/main-listitem.ui</property>
<child>
<object class="GtkSearchBar" id="searchbar">
<property name="key-capture-widget">window</property>
<child>
<object class="GtkSearchEntry" id="search-entry"/>
</child>
</object> </object>
</child> </property>
<child>
<object class="GtkListView" id="listview">
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="resource">/ui/main-listitem.ui</property>
</object>
</property>
</object>
</child>
</object> </object>
</child> </child>
</object> </object>

View File

@@ -21,7 +21,7 @@ source_toggled (GtkToggleButton *button)
{ {
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
GtkTextIter start, end; GtkTextIter start, end;
char *markup; gchar *markup;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
gtk_text_buffer_get_bounds (buffer, &start, &end); gtk_text_buffer_get_bounds (buffer, &start, &end);
@@ -50,7 +50,7 @@ do_markup (GtkWidget *do_widget)
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
GtkTextIter iter; GtkTextIter iter;
GBytes *bytes; GBytes *bytes;
const char *markup; const gchar *markup;
GtkWidget *header; GtkWidget *header;
GtkWidget *show_source; GtkWidget *show_source;
@@ -69,6 +69,7 @@ do_markup (GtkWidget *do_widget)
g_signal_connect (show_source, "toggled", G_CALLBACK (source_toggled), stack); g_signal_connect (show_source, "toggled", G_CALLBACK (source_toggled), stack);
header = gtk_header_bar_new (); 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_header_bar_pack_start (GTK_HEADER_BAR (header), show_source);
gtk_window_set_titlebar (GTK_WINDOW (window), header); gtk_window_set_titlebar (GTK_WINDOW (window), header);
@@ -102,7 +103,7 @@ do_markup (GtkWidget *do_widget)
gtk_stack_add_named (GTK_STACK (stack), sw, "source"); gtk_stack_add_named (GTK_STACK (stack), sw, "source");
bytes = g_resources_lookup_data ("/markup/markup.txt", 0, NULL); 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)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_get_start_iter (buffer, &iter); gtk_text_buffer_get_start_iter (buffer, &iter);

View File

@@ -4,7 +4,9 @@
<property name="title" translatable="yes">Model Button</property> <property name="title" translatable="yes">Model Button</property>
<property name="resizable">0</property> <property name="resizable">0</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"/> <object class="GtkHeaderBar">
<property name="show-title-buttons">1</property>
</object>
</child> </child>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">

View File

@@ -12,9 +12,9 @@ static void
margin_changed (GtkAdjustment *adjustment, margin_changed (GtkAdjustment *adjustment,
GtkTextView *text) 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); gtk_text_view_set_left_margin (GTK_TEXT_VIEW (text), value);
g_object_set (tag, "pixels-above-lines", value, NULL); g_object_set (tag, "pixels-above-lines", value, NULL);
} }

View File

@@ -9,7 +9,7 @@
#include <gtk/gtkunixprint.h> #include <gtk/gtkunixprint.h>
static void static void
done_cb (GtkDialog *dialog, int response, gpointer data) done_cb (GtkDialog *dialog, gint response, gpointer data)
{ {
gtk_window_destroy (GTK_WINDOW (dialog)); gtk_window_destroy (GTK_WINDOW (dialog));
} }

View File

@@ -20,7 +20,7 @@ typedef struct
cairo_t *cr; cairo_t *cr;
GdkRGBA draw_color; GdkRGBA draw_color;
GtkPadController *pad_controller; GtkPadController *pad_controller;
double brush_size; gdouble brush_size;
} DrawingArea; } DrawingArea;
typedef struct typedef struct
@@ -38,7 +38,7 @@ static GtkPadActionEntry pad_actions[] = {
{ GTK_PAD_ACTION_STRIP, -1, -1, N_("Brush size"), "pad.brush_size" }, { GTK_PAD_ACTION_STRIP, -1, -1, N_("Brush size"), "pad.brush_size" },
}; };
static const char *pad_colors[] = { static const gchar *pad_colors[] = {
"black", "black",
"pink", "pink",
"green", "green",
@@ -55,8 +55,8 @@ static void drawing_area_set_color (DrawingArea *area,
static void static void
drawing_area_ensure_surface (DrawingArea *area, drawing_area_ensure_surface (DrawingArea *area,
int width, gint width,
int height) gint height)
{ {
if (!area->surface || if (!area->surface ||
cairo_image_surface_get_width (area->surface) != width || cairo_image_surface_get_width (area->surface) != width ||
@@ -154,7 +154,7 @@ on_pad_button_activate (GSimpleAction *action,
GVariant *parameter, GVariant *parameter,
DrawingArea *area) 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; GdkRGBA rgba;
gdk_rgba_parse (&rgba, color); gdk_rgba_parse (&rgba, color);
@@ -166,7 +166,7 @@ on_pad_knob_change (GSimpleAction *action,
GVariant *parameter, GVariant *parameter,
DrawingArea *area) DrawingArea *area)
{ {
double value = g_variant_get_double (parameter); gdouble value = g_variant_get_double (parameter);
area->brush_size = value; area->brush_size = value;
} }
@@ -195,7 +195,7 @@ drawing_area_root (GtkWidget *widget)
GSimpleActionGroup *action_group; GSimpleActionGroup *action_group;
GSimpleAction *action; GSimpleAction *action;
GtkWidget *toplevel; GtkWidget *toplevel;
int i; gint i;
GTK_WIDGET_CLASS (drawing_area_parent_class)->root (widget); GTK_WIDGET_CLASS (drawing_area_parent_class)->root (widget);
@@ -255,9 +255,9 @@ drawing_area_class_init (DrawingAreaClass *klass)
static void static void
drawing_area_apply_stroke (DrawingArea *area, drawing_area_apply_stroke (DrawingArea *area,
GdkDeviceTool *tool, GdkDeviceTool *tool,
double x, gdouble x,
double y, gdouble y,
double pressure) gdouble pressure)
{ {
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER) 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 static void
stylus_gesture_down (GtkGestureStylus *gesture, stylus_gesture_down (GtkGestureStylus *gesture,
double x, gdouble x,
double y, gdouble y,
DrawingArea *area) DrawingArea *area)
{ {
cairo_new_path (area->cr); cairo_new_path (area->cr);
@@ -290,13 +290,13 @@ stylus_gesture_down (GtkGestureStylus *gesture,
static void static void
stylus_gesture_motion (GtkGestureStylus *gesture, stylus_gesture_motion (GtkGestureStylus *gesture,
double x, gdouble x,
double y, gdouble y,
DrawingArea *area) DrawingArea *area)
{ {
GdkTimeCoord *backlog; GdkTimeCoord *backlog;
GdkDeviceTool *tool; GdkDeviceTool *tool;
double pressure; gdouble pressure;
guint n_items; guint n_items;
tool = gtk_gesture_stylus_get_device_tool (gesture); 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); gtk_window_set_child (GTK_WINDOW (window), draw_area);
headerbar = gtk_header_bar_new (); headerbar = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (headerbar), TRUE);
colorbutton = gtk_color_button_new (); colorbutton = gtk_color_button_new ();
g_signal_connect (colorbutton, "color-set", g_signal_connect (colorbutton, "color-set",

View File

@@ -47,9 +47,9 @@ toggle_shrink (GtkWidget *widget,
static GtkWidget * static GtkWidget *
create_pane_options (GtkPaned *paned, create_pane_options (GtkPaned *paned,
const char *frame_label, const gchar *frame_label,
const char *label1, const gchar *label1,
const char *label2) const gchar *label2)
{ {
GtkWidget *child1, *child2; GtkWidget *child1, *child2;
GtkWidget *frame; GtkWidget *frame;

View File

@@ -276,6 +276,7 @@ do_peg_solitaire (GtkWidget *do_widget)
g_signal_connect (restart, "clicked", G_CALLBACK (restart), NULL); g_signal_connect (restart, "clicked", G_CALLBACK (restart), NULL);
header = gtk_header_bar_new (); 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_start (GTK_HEADER_BAR (header), restart);
window = gtk_window_new (); window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_window_set_display (GTK_WINDOW (window),

View File

@@ -39,7 +39,7 @@ static GdkPixbuf *frame;
/* Background image */ /* Background image */
static GdkPixbuf *background; static GdkPixbuf *background;
static int back_width, back_height; static gint back_width, back_height;
/* Images */ /* Images */
static GdkPixbuf *images[N_IMAGES]; static GdkPixbuf *images[N_IMAGES];
@@ -51,7 +51,7 @@ static GtkWidget *da;
static gboolean static gboolean
load_pixbufs (GError **error) load_pixbufs (GError **error)
{ {
int i; gint i;
if (background) if (background)
return TRUE; /* already loaded earlier */ return TRUE; /* already loaded earlier */

View File

@@ -14,13 +14,13 @@
typedef struct typedef struct
{ {
char *resourcename; gchar *resourcename;
double font_size; gdouble font_size;
int lines_per_page; gint lines_per_page;
char **lines; gchar **lines;
int num_lines; gint num_lines;
int num_pages; gint num_pages;
} PrintData; } PrintData;
static void static void
@@ -55,17 +55,17 @@ begin_print (GtkPrintOperation *operation,
static void static void
draw_page (GtkPrintOperation *operation, draw_page (GtkPrintOperation *operation,
GtkPrintContext *context, GtkPrintContext *context,
int page_nr, gint page_nr,
gpointer user_data) gpointer user_data)
{ {
PrintData *data = (PrintData *)user_data; PrintData *data = (PrintData *)user_data;
cairo_t *cr; cairo_t *cr;
PangoLayout *layout; PangoLayout *layout;
int text_width, text_height; gint text_width, text_height;
double width; gdouble width;
int line, i; gint line, i;
PangoFontDescription *desc; PangoFontDescription *desc;
char *page_str; gchar *page_str;
cr = gtk_print_context_get_cairo_context (context); cr = gtk_print_context_get_cairo_context (context);
width = gtk_print_context_get_width (context); width = gtk_print_context_get_width (context);

View File

@@ -6,7 +6,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
static int count = 0; static gint count = 0;
static guint timeout = 0; static guint timeout = 0;
static void static void
@@ -25,7 +25,7 @@ static gboolean
reveal_one (gpointer data) reveal_one (gpointer data)
{ {
GtkWidget *window = data; GtkWidget *window = data;
char *name; gchar *name;
GtkRevealer *revealer; GtkRevealer *revealer;
name = g_strdup_printf ("revealer%d", count); name = g_strdup_printf ("revealer%d", count);

View File

@@ -123,7 +123,7 @@ set_search_by (GSimpleAction *action,
static void static void
icon_press_cb (GtkEntry *entry, icon_press_cb (GtkEntry *entry,
int position, gint position,
gpointer data) gpointer data)
{ {
if (position == GTK_ENTRY_ICON_PRIMARY) if (position == GTK_ENTRY_ICON_PRIMARY)

View File

@@ -8,12 +8,12 @@
static void static void
show_shortcuts (GtkWidget *window, show_shortcuts (GtkWidget *window,
const char *id, const gchar *id,
const char *view) const gchar *view)
{ {
GtkBuilder *builder; GtkBuilder *builder;
GtkWidget *overlay; GtkWidget *overlay;
char *path; gchar *path;
path = g_strdup_printf ("/shortcuts/%s.ui", id); path = g_strdup_printf ("/shortcuts/%s.ui", id);
builder = gtk_builder_new_from_resource (path); builder = gtk_builder_new_from_resource (path);

View File

@@ -18,7 +18,7 @@ do_sidebar (GtkWidget *do_widget)
GtkWidget *box; GtkWidget *box;
GtkWidget *widget; GtkWidget *widget;
GtkWidget *header; GtkWidget *header;
const char * pages[] = { const gchar* pages[] = {
"Welcome to GTK", "Welcome to GTK",
"GtkStackSidebar Widget", "GtkStackSidebar Widget",
"Automatic navigation", "Automatic navigation",
@@ -30,7 +30,7 @@ do_sidebar (GtkWidget *do_widget)
"Page 9", "Page 9",
NULL NULL
}; };
const char *c = NULL; const gchar *c = NULL;
guint i; guint i;
if (!window) if (!window)
@@ -40,6 +40,7 @@ do_sidebar (GtkWidget *do_widget)
gtk_widget_set_size_request (window, 500, 350); gtk_widget_set_size_request (window, 500, 350);
header = gtk_header_bar_new (); 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_titlebar (GTK_WINDOW(window), header);
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar"); gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);

View File

@@ -470,6 +470,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
g_signal_connect (restart, "clicked", G_CALLBACK (reshuffle), NULL); g_signal_connect (restart, "clicked", G_CALLBACK (reshuffle), NULL);
header = gtk_header_bar_new (); 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_start (GTK_HEADER_BAR (header), restart);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), tweak); gtk_header_bar_pack_end (GTK_HEADER_BAR (header), tweak);
window = gtk_window_new (); window = gtk_window_new ();

View File

@@ -11,13 +11,13 @@
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
int gint
spinbutton_hex_spin_input (GtkSpinButton *spin_button, spinbutton_hex_spin_input (GtkSpinButton *spin_button,
double *new_val) gdouble *new_val)
{ {
const char *buf; const gchar *buf;
char *err; gchar *err;
double res; gdouble res;
buf = gtk_editable_get_text (GTK_EDITABLE (spin_button)); buf = gtk_editable_get_text (GTK_EDITABLE (spin_button));
res = strtol (buf, &err, 16); res = strtol (buf, &err, 16);
@@ -28,19 +28,19 @@ spinbutton_hex_spin_input (GtkSpinButton *spin_button,
return TRUE; return TRUE;
} }
int gint
spinbutton_hex_spin_output (GtkSpinButton *spin_button) spinbutton_hex_spin_output (GtkSpinButton *spin_button)
{ {
GtkAdjustment *adjustment; GtkAdjustment *adjustment;
char *buf; gchar *buf;
double val; gdouble val;
adjustment = gtk_spin_button_get_adjustment (spin_button); adjustment = gtk_spin_button_get_adjustment (spin_button);
val = gtk_adjustment_get_value (adjustment); val = gtk_adjustment_get_value (adjustment);
if (fabs (val) < 1e-5) if (fabs (val) < 1e-5)
buf = g_strdup ("0x00"); buf = g_strdup ("0x00");
else 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)))) if (strcmp (buf, gtk_editable_get_text (GTK_EDITABLE (spin_button))))
gtk_editable_set_text (GTK_EDITABLE (spin_button), buf); gtk_editable_set_text (GTK_EDITABLE (spin_button), buf);
g_free (buf); g_free (buf);
@@ -48,17 +48,17 @@ spinbutton_hex_spin_output (GtkSpinButton *spin_button)
return TRUE; return TRUE;
} }
int gint
spinbutton_time_spin_input (GtkSpinButton *spin_button, spinbutton_time_spin_input (GtkSpinButton *spin_button,
double *new_val) gdouble *new_val)
{ {
const char *text; const gchar *text;
char **str; gchar **str;
gboolean found = FALSE; gboolean found = FALSE;
int hours; gint hours;
int minutes; gint minutes;
char *endh; gchar *endh;
char *endm; gchar *endm;
text = gtk_editable_get_text (GTK_EDITABLE (spin_button)); text = gtk_editable_get_text (GTK_EDITABLE (spin_button));
str = g_strsplit (text, ":", 2); str = g_strsplit (text, ":", 2);
@@ -87,13 +87,13 @@ spinbutton_time_spin_input (GtkSpinButton *spin_button,
return TRUE; return TRUE;
} }
int gint
spinbutton_time_spin_output (GtkSpinButton *spin_button) spinbutton_time_spin_output (GtkSpinButton *spin_button)
{ {
GtkAdjustment *adjustment; GtkAdjustment *adjustment;
char *buf; gchar *buf;
double hours; gdouble hours;
double minutes; gdouble minutes;
adjustment = gtk_spin_button_get_adjustment (spin_button); adjustment = gtk_spin_button_get_adjustment (spin_button);
hours = gtk_adjustment_get_value (adjustment) / 60.0; hours = gtk_adjustment_get_value (adjustment) / 60.0;
@@ -121,12 +121,12 @@ static const char *month[12] = {
"December" "December"
}; };
int gint
spinbutton_month_spin_input (GtkSpinButton *spin_button, spinbutton_month_spin_input (GtkSpinButton *spin_button,
double *new_val) gdouble *new_val)
{ {
int i; gint i;
char *tmp1, *tmp2; gchar *tmp1, *tmp2;
gboolean found = FALSE; gboolean found = FALSE;
for (i = 1; i <= 12; i++) for (i = 1; i <= 12; i++)
@@ -145,17 +145,17 @@ spinbutton_month_spin_input (GtkSpinButton *spin_button,
*new_val = 0.0; *new_val = 0.0;
return GTK_INPUT_ERROR; return GTK_INPUT_ERROR;
} }
*new_val = (double) i; *new_val = (gdouble) i;
return TRUE; return TRUE;
} }
int gint
spinbutton_month_spin_output (GtkSpinButton *spin_button) spinbutton_month_spin_output (GtkSpinButton *spin_button)
{ {
GtkAdjustment *adjustment; GtkAdjustment *adjustment;
double value; gdouble value;
int i; gint i;
adjustment = gtk_spin_button_get_adjustment (spin_button); adjustment = gtk_spin_button_get_adjustment (spin_button);
value = gtk_adjustment_get_value (adjustment); value = gtk_adjustment_get_value (adjustment);

View File

@@ -4,6 +4,7 @@
<property name="resizable">0</property> <property name="resizable">0</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="header"> <object class="GtkHeaderBar" id="header">
<property name="show-title-buttons">1</property>
<child type="start"> <child type="start">
<object class="GtkToggleButton" id="toggle"> <object class="GtkToggleButton" id="toggle">
<property name="label">Cycle</property> <property name="label">Cycle</property>

View File

@@ -14,7 +14,7 @@
typedef struct _TreeItem TreeItem; typedef struct _TreeItem TreeItem;
struct _TreeItem struct _TreeItem
{ {
const char *label; const gchar *label;
gboolean alex; gboolean alex;
gboolean havoc; gboolean havoc;
gboolean tim; gboolean tim;
@@ -222,7 +222,7 @@ create_model (void)
static void static void
item_toggled (GtkCellRendererToggle *cell, item_toggled (GtkCellRendererToggle *cell,
char *path_str, gchar *path_str,
gpointer data) gpointer data)
{ {
GtkTreeModel *model = (GtkTreeModel *)data; GtkTreeModel *model = (GtkTreeModel *)data;
@@ -230,7 +230,7 @@ item_toggled (GtkCellRendererToggle *cell,
GtkTreeIter iter; GtkTreeIter iter;
gboolean toggle_item; gboolean toggle_item;
int *column; gint *column;
column = g_object_get_data (G_OBJECT (cell), "column"); column = g_object_get_data (G_OBJECT (cell), "column");
@@ -252,7 +252,7 @@ item_toggled (GtkCellRendererToggle *cell,
static void static void
add_columns (GtkTreeView *treeview) add_columns (GtkTreeView *treeview)
{ {
int col_offset; gint col_offset;
GtkCellRenderer *renderer; GtkCellRenderer *renderer;
GtkTreeViewColumn *column; GtkTreeViewColumn *column;
GtkTreeModel *model = gtk_tree_view_get_model (treeview); GtkTreeModel *model = gtk_tree_view_get_model (treeview);
@@ -272,7 +272,7 @@ add_columns (GtkTreeView *treeview)
/* alex column */ /* alex column */
renderer = gtk_cell_renderer_toggle_new (); renderer = gtk_cell_renderer_toggle_new ();
g_object_set (renderer, "xalign", 0.0, NULL); g_object_set (renderer, "xalign", 0.0, NULL);
g_object_set_data (G_OBJECT (renderer), "column", (int *)ALEX_COLUMN); g_object_set_data (G_OBJECT (renderer), "column", (gint *)ALEX_COLUMN);
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model); g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
@@ -294,7 +294,7 @@ add_columns (GtkTreeView *treeview)
/* havoc column */ /* havoc column */
renderer = gtk_cell_renderer_toggle_new (); renderer = gtk_cell_renderer_toggle_new ();
g_object_set (renderer, "xalign", 0.0, NULL); g_object_set (renderer, "xalign", 0.0, NULL);
g_object_set_data (G_OBJECT (renderer), "column", (int *)HAVOC_COLUMN); g_object_set_data (G_OBJECT (renderer), "column", (gint *)HAVOC_COLUMN);
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model); g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
@@ -315,7 +315,7 @@ add_columns (GtkTreeView *treeview)
/* tim column */ /* tim column */
renderer = gtk_cell_renderer_toggle_new (); renderer = gtk_cell_renderer_toggle_new ();
g_object_set (renderer, "xalign", 0.0, NULL); g_object_set (renderer, "xalign", 0.0, NULL);
g_object_set_data (G_OBJECT (renderer), "column", (int *)TIM_COLUMN); g_object_set_data (G_OBJECT (renderer), "column", (gint *)TIM_COLUMN);
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model); g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
@@ -337,7 +337,7 @@ add_columns (GtkTreeView *treeview)
/* owen column */ /* owen column */
renderer = gtk_cell_renderer_toggle_new (); renderer = gtk_cell_renderer_toggle_new ();
g_object_set (renderer, "xalign", 0.0, NULL); g_object_set (renderer, "xalign", 0.0, NULL);
g_object_set_data (G_OBJECT (renderer), "column", (int *)OWEN_COLUMN); g_object_set_data (G_OBJECT (renderer), "column", (gint *)OWEN_COLUMN);
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model); g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
@@ -358,7 +358,7 @@ add_columns (GtkTreeView *treeview)
/* dave column */ /* dave column */
renderer = gtk_cell_renderer_toggle_new (); renderer = gtk_cell_renderer_toggle_new ();
g_object_set (renderer, "xalign", 0.0, NULL); g_object_set (renderer, "xalign", 0.0, NULL);
g_object_set_data (G_OBJECT (renderer), "column", (int *)DAVE_COLUMN); g_object_set_data (G_OBJECT (renderer), "column", (gint *)DAVE_COLUMN);
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model); g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);

View File

@@ -73,6 +73,7 @@ do_video_player (GtkWidget *do_widget)
gtk_window_set_child (GTK_WINDOW (window), video); gtk_window_set_child (GTK_WINDOW (window), video);
title = gtk_header_bar_new (); title = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (title), TRUE);
gtk_window_set_titlebar (GTK_WINDOW (window), title); gtk_window_set_titlebar (GTK_WINDOW (window), title);
open_button = gtk_button_new_with_mnemonic ("_Open"); open_button = gtk_button_new_with_mnemonic ("_Open");

View File

@@ -43,7 +43,7 @@ about_activated (GSimpleAction *action,
gpointer user_data) gpointer user_data)
{ {
GtkApplication *app = user_data; GtkApplication *app = user_data;
const char *authors[] = { const gchar *authors[] = {
"The GTK Team", "The GTK Team",
NULL NULL
}; };
@@ -103,7 +103,7 @@ static GActionEntry app_entries[] =
static void static void
icon_browser_app_startup (GApplication *app) icon_browser_app_startup (GApplication *app)
{ {
const char *quit_accels[2] = { "<Ctrl>Q", NULL }; const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
G_APPLICATION_CLASS (icon_browser_app_parent_class)->startup (app); G_APPLICATION_CLASS (icon_browser_app_parent_class)->startup (app);

View File

@@ -44,13 +44,13 @@ icon_browser_window_get_icon_theme (IconBrowserWindow *win)
static void static void
add_icon (IconBrowserWindow *win, add_icon (IconBrowserWindow *win,
const char *name, const gchar *name,
const char *description, const gchar *description,
const char *context) const gchar *context)
{ {
GtkIconTheme *icon_theme = icon_browser_window_get_icon_theme (win); GtkIconTheme *icon_theme = icon_browser_window_get_icon_theme (win);
char *regular_name; gchar *regular_name;
char *symbolic_name; gchar *symbolic_name;
IbIcon *icon; IbIcon *icon;
regular_name = g_strdup (name); regular_name = g_strdup (name);
@@ -77,9 +77,9 @@ add_icon (IconBrowserWindow *win,
static void static void
add_context (IconBrowserWindow *win, add_context (IconBrowserWindow *win,
const char *id, const gchar *id,
const char *name, const gchar *name,
const char *description) const gchar *description)
{ {
IbContext *context; IbContext *context;
@@ -161,7 +161,7 @@ copy_to_clipboard (GtkButton *button,
} }
static void static void
set_image (GtkWidget *image, const char *name, int size) set_image (GtkWidget *image, const gchar *name, gint size)
{ {
gtk_image_set_from_icon_name (GTK_IMAGE (image), name); gtk_image_set_from_icon_name (GTK_IMAGE (image), name);
gtk_image_set_pixel_size (GTK_IMAGE (image), size); gtk_image_set_pixel_size (GTK_IMAGE (image), size);
@@ -219,7 +219,7 @@ item_activated (GtkGridView *view,
static GdkPaintable * static GdkPaintable *
get_image_paintable (GtkImage *image) get_image_paintable (GtkImage *image)
{ {
const char *icon_name; const gchar *icon_name;
GtkIconTheme *icon_theme; GtkIconTheme *icon_theme;
GtkIconPaintable *icon; GtkIconPaintable *icon;
int size; int size;

View File

@@ -21,6 +21,7 @@
<property name="default-height">768</property> <property name="default-height">768</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="header"> <object class="GtkHeaderBar" id="header">
<property name="show-title-buttons">1</property>
<child type="title"> <child type="title">
<object class="GtkBox"> <object class="GtkBox">
<style> <style>

View File

@@ -1,88 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<linearGradient id="a" gradientUnits="userSpaceOnUse" x1="43.000351" x2="85.000351" y1="39.000164" y2="39.000164">
<stop offset="0" stop-color="#26a269"/>
<stop offset="0.0934161" stop-color="#84e3b7"/>
<stop offset="0.330831" stop-color="#26a269"/>
<stop offset="0.686952" stop-color="#26a269"/>
<stop offset="0.89736" stop-color="#175e3c"/>
<stop offset="1" stop-color="#26a269"/>
</linearGradient>
<linearGradient id="b" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#c0bfbc"/>
<stop offset="0.154754" stop-color="#ffffff"/>
<stop offset="0.433722" stop-color="#bdbbb5"/>
<stop offset="0.650505" stop-color="#c1c0ba"/>
<stop offset="0.825253" stop-color="#ffffff"/>
<stop offset="1" stop-color="#c0bfbc"/>
</linearGradient>
<linearGradient id="c" gradientTransform="matrix(0.0811899 -0.046875 0.069079 0.119648 307.03142 127.069456)" x1="-1710.210571" x2="-1774.45166" xlink:href="#b" y1="-1202.376709" y2="-1202.376709"/>
<linearGradient id="d" gradientTransform="matrix(-0.0811899 -0.046875 -0.069079 0.119648 -177.242852 127.069447)" x1="-1710.210571" x2="-1774.45166" xlink:href="#b" y1="-1202.376709" y2="-1202.376709"/>
<linearGradient id="e" gradientUnits="userSpaceOnUse" x1="14" x2="56" y1="94.999964" y2="94.999964">
<stop offset="0" stop-color="#813d9c"/>
<stop offset="0.109119" stop-color="#b378ca"/>
<stop offset="0.241583" stop-color="#813d9c"/>
<stop offset="0.731841" stop-color="#813d9c"/>
<stop offset="0.872163" stop-color="#4d255d"/>
<stop offset="1" stop-color="#813d9c"/>
</linearGradient>
<linearGradient id="f" gradientUnits="userSpaceOnUse" x1="72" x2="114" y1="94.999964" y2="94.999964">
<stop offset="0" stop-color="#e66100"/>
<stop offset="0.0678478" stop-color="#ff903e"/>
<stop offset="0.168852" stop-color="#e66100"/>
<stop offset="0.886626" stop-color="#e66100"/>
<stop offset="1" stop-color="#9d4200"/>
</linearGradient>
<clipPath id="g">
<rect height="128" width="128"/>
</clipPath>
<clipPath id="h">
<rect height="128" width="128"/>
</clipPath>
<filter id="i" height="100%" width="100%" x="0%" y="0%">
<feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
</filter>
<mask id="j">
<g clip-path="url(#h)" filter="url(#i)">
<g clip-path="url(#g)">
<path d="m 51 18 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#a)"/>
<path d="m 51 12 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#57e389"/>
<path d="m 76.976562 55.453125 c 1.480469 -0.855469 3.371094 -0.347656 4.226563 1.132813 l 6.742187 11.679687 c 0.855469 1.480469 0.347657 3.371094 -1.132812 4.226563 c -1.480469 0.851562 -3.371094 0.347656 -4.226562 -1.132813 l -6.742188 -11.679687 c -0.855469 -1.480469 -0.347656 -3.371094 1.132812 -4.226563 z m 0 0" fill="url(#c)"/>
<path d="m 52.8125 55.453125 c -1.480469 -0.855469 -3.371094 -0.347656 -4.226562 1.132813 l -6.742188 11.679687 c -0.855469 1.480469 -0.347656 3.371094 1.132812 4.226563 c 1.480469 0.851562 3.371094 0.347656 4.226563 -1.132813 l 6.742187 -11.679687 c 0.855469 -1.480469 0.347657 -3.371094 -1.132812 -4.226563 z m 0 0" fill="url(#d)"/>
<path d="m 22 74 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#e)"/>
<path d="m 22 68 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#dc8add"/>
<path d="m 80 74 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#f)"/>
<path d="m 80 68 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#ffa348"/>
</g>
</g>
</mask>
<mask id="k">
<g filter="url(#i)">
<rect fill-opacity="0.8" height="128" width="128"/>
</g>
</mask>
<linearGradient id="l" gradientTransform="matrix(0 0.37 -0.98462 0 295.38501 -30.360001)" gradientUnits="userSpaceOnUse" x1="300" x2="428" y1="235" y2="235">
<stop offset="0" stop-color="#f9f06b"/>
<stop offset="1" stop-color="#f5c211"/>
</linearGradient>
<clipPath id="m">
<rect height="128" width="128"/>
</clipPath>
<clipPath id="n">
<rect height="128" width="128"/>
</clipPath>
<path d="m 51 18 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#a)"/>
<path d="m 51 12 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#57e389"/>
<path d="m 76.976562 55.453125 c 1.480469 -0.855469 3.371094 -0.347656 4.226563 1.132813 l 6.742187 11.679687 c 0.855469 1.480469 0.347657 3.371094 -1.132812 4.226563 c -1.480469 0.851562 -3.371094 0.347656 -4.226562 -1.132813 l -6.742188 -11.679687 c -0.855469 -1.480469 -0.347656 -3.371094 1.132812 -4.226563 z m 0 0" fill="url(#c)"/>
<path d="m 52.8125 55.453125 c -1.480469 -0.855469 -3.371094 -0.347656 -4.226562 1.132813 l -6.742188 11.679687 c -0.855469 1.480469 -0.347656 3.371094 1.132812 4.226563 c 1.480469 0.851562 3.371094 0.347656 4.226563 -1.132813 l 6.742187 -11.679687 c 0.855469 -1.480469 0.347657 -3.371094 -1.132812 -4.226563 z m 0 0" fill="url(#d)"/>
<path d="m 22 74 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#e)"/>
<path d="m 22 68 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#dc8add"/>
<path d="m 80 74 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#f)"/>
<path d="m 80 68 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#ffa348"/>
<g clip-path="url(#n)" mask="url(#j)">
<g clip-path="url(#m)" mask="url(#k)">
<path d="m 128 80.640625 v 47.359375 h -128 v -47.359375 z m 0 0" fill="url(#l)"/>
<path d="m 13.308594 80.640625 l 47.355468 47.359375 h 21.214844 l -47.359375 -47.359375 z m 42.421875 0 l 47.363281 47.359375 h 21.214844 l -47.363282 -47.359375 z m 42.429687 0 l 29.839844 29.839844 v -21.210938 l -8.628906 -8.628906 z m -98.160156 7.90625 v 21.214844 l 18.238281 18.238281 h 21.214844 z m 0 0"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<linearGradient id="a" gradientUnits="userSpaceOnUse" x1="43.000351" x2="85.000351" y1="39.000164" y2="39.000164">
<stop offset="0" stop-color="#26a269"/>
<stop offset="0.0934161" stop-color="#84e3b7"/>
<stop offset="0.330831" stop-color="#26a269"/>
<stop offset="0.686952" stop-color="#26a269"/>
<stop offset="0.89736" stop-color="#175e3c"/>
<stop offset="1" stop-color="#26a269"/>
</linearGradient>
<linearGradient id="b" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#c0bfbc"/>
<stop offset="0.154754" stop-color="#ffffff"/>
<stop offset="0.433722" stop-color="#bdbbb5"/>
<stop offset="0.650505" stop-color="#c1c0ba"/>
<stop offset="0.825253" stop-color="#ffffff"/>
<stop offset="1" stop-color="#c0bfbc"/>
</linearGradient>
<linearGradient id="c" gradientTransform="matrix(0.0811899 -0.046875 0.069079 0.119648 307.03142 127.069456)" x1="-1710.210571" x2="-1774.45166" xlink:href="#b" y1="-1202.376709" y2="-1202.376709"/>
<linearGradient id="d" gradientTransform="matrix(-0.0811899 -0.046875 -0.069079 0.119648 -177.242852 127.069447)" x1="-1710.210571" x2="-1774.45166" xlink:href="#b" y1="-1202.376709" y2="-1202.376709"/>
<linearGradient id="e" gradientUnits="userSpaceOnUse" x1="14" x2="56" y1="94.999964" y2="94.999964">
<stop offset="0" stop-color="#813d9c"/>
<stop offset="0.109119" stop-color="#b378ca"/>
<stop offset="0.241583" stop-color="#813d9c"/>
<stop offset="0.731841" stop-color="#813d9c"/>
<stop offset="0.872163" stop-color="#4d255d"/>
<stop offset="1" stop-color="#813d9c"/>
</linearGradient>
<linearGradient id="f" gradientUnits="userSpaceOnUse" x1="72" x2="114" y1="94.999964" y2="94.999964">
<stop offset="0" stop-color="#e66100"/>
<stop offset="0.0678478" stop-color="#ff903e"/>
<stop offset="0.168852" stop-color="#e66100"/>
<stop offset="0.886626" stop-color="#e66100"/>
<stop offset="1" stop-color="#9d4200"/>
</linearGradient>
<path d="m 51 18 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#a)"/>
<path d="m 51 12 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#57e389"/>
<path d="m 76.976562 55.453125 c 1.480469 -0.855469 3.371094 -0.347656 4.226563 1.132813 l 6.742187 11.679687 c 0.855469 1.480469 0.347657 3.371094 -1.132812 4.226563 c -1.480469 0.851562 -3.371094 0.347656 -4.226562 -1.132813 l -6.742188 -11.679687 c -0.855469 -1.480469 -0.347656 -3.371094 1.132812 -4.226563 z m 0 0" fill="url(#c)"/>
<path d="m 52.8125 55.453125 c -1.480469 -0.855469 -3.371094 -0.347656 -4.226562 1.132813 l -6.742188 11.679687 c -0.855469 1.480469 -0.347656 3.371094 1.132812 4.226563 c 1.480469 0.851562 3.371094 0.347656 4.226563 -1.132813 l 6.742187 -11.679687 c 0.855469 -1.480469 0.347657 -3.371094 -1.132812 -4.226563 z m 0 0" fill="url(#d)"/>
<path d="m 22 74 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#e)"/>
<path d="m 22 68 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#dc8add"/>
<path d="m 80 74 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#f)"/>
<path d="m 80 68 h 26 c 4.417969 0 8 3.582031 8 8 v 26 c 0 4.417969 -3.582031 8 -8 8 h -26 c -4.417969 0 -8 -3.582031 -8 -8 v -26 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#ffa348"/>
</svg>

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<path d="m 5.75 1 c -0.414062 0 -0.75 0.335938 -0.75 0.75 v 4.5 c 0 0.414062 0.335938 0.75 0.75 0.75 h 0.191406 l -1 2 h -3.191406 c -0.414062 0 -0.75 0.335938 -0.75 0.75 v 4.5 c 0 0.414062 0.335938 0.75 0.75 0.75 h 4.5 c 0.414062 0 0.75 -0.335938 0.75 -0.75 v -4.5 c 0 -0.414062 -0.335938 -0.75 -0.75 -0.75 h -0.191406 l 1 -2 h 1.882812 l 1 2 h -0.191406 c -0.414062 0 -0.75 0.335938 -0.75 0.75 v 4.5 c 0 0.414062 0.335938 0.75 0.75 0.75 h 4.5 c 0.414062 0 0.75 -0.335938 0.75 -0.75 v -4.5 c 0 -0.414062 -0.335938 -0.75 -0.75 -0.75 h -3.191406 l -1 -2 h 0.191406 c 0.414062 0 0.75 -0.335938 0.75 -0.75 v -4.5 c 0 -0.414062 -0.335938 -0.75 -0.75 -0.75 z m 0 0"/>
</svg>

Before

Width:  |  Height:  |  Size: 801 B

View File

@@ -19,12 +19,3 @@ executable('gtk4-node-editor',
gui_app: true, gui_app: true,
link_args: extra_demo_ldflags, link_args: extra_demo_ldflags,
install: false) install: false)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach

View File

@@ -101,7 +101,7 @@ activate_about (GSimpleAction *action,
"website", "http://www.gtk.org", "website", "http://www.gtk.org",
"comments", "Program to test GTK rendering", "comments", "Program to test GTK rendering",
"authors", (const char *[]){ "Benjamin Otte", "Timm Bäder", NULL}, "authors", (const char *[]){ "Benjamin Otte", "Timm Bäder", NULL},
"logo-icon-name", "org.gtk.gtk4.NodeEditor.Devel", "logo-icon-name", "text-editor-symbolic",
"title", "About GTK Node Editor", "title", "About GTK Node Editor",
"system-information", s->str, "system-information", s->str,
NULL); NULL);
@@ -199,11 +199,11 @@ node_editor_application_activate (GApplication *app)
static void static void
node_editor_application_open (GApplication *app, node_editor_application_open (GApplication *app,
GFile **files, GFile **files,
int n_files, gint n_files,
const char *hint) const gchar *hint)
{ {
NodeEditorWindow *win; NodeEditorWindow *win;
int i; gint i;
for (i = 0; i < n_files; i++) for (i = 0; i < n_files; i++)
{ {

View File

@@ -80,7 +80,7 @@ text_view_error_free (TextViewError *e)
g_free (e->message); g_free (e->message);
} }
static char * static gchar *
get_current_text (GtkTextBuffer *buffer) get_current_text (GtkTextBuffer *buffer)
{ {
GtkTextIter start, end; GtkTextIter start, end;
@@ -288,14 +288,14 @@ text_view_query_tooltip_cb (GtkWidget *widget,
if (keyboard_tip) if (keyboard_tip)
{ {
int offset; gint offset;
g_object_get (self->text_buffer, "cursor-position", &offset, NULL); g_object_get (self->text_buffer, "cursor-position", &offset, NULL);
gtk_text_buffer_get_iter_at_offset (self->text_buffer, &iter, offset); gtk_text_buffer_get_iter_at_offset (self->text_buffer, &iter, offset);
} }
else else
{ {
int bx, by, trailing; gint bx, by, trailing;
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (self->text_view), GTK_TEXT_WINDOW_TEXT, gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (self->text_view), GTK_TEXT_WINDOW_TEXT,
x, y, &bx, &by); x, y, &bx, &by);
@@ -399,7 +399,7 @@ node_editor_window_load (NodeEditorWindow *self,
static void static void
open_response_cb (GtkWidget *dialog, open_response_cb (GtkWidget *dialog,
int response, gint response,
NodeEditorWindow *self) NodeEditorWindow *self)
{ {
gtk_widget_hide (dialog); gtk_widget_hide (dialog);
@@ -448,7 +448,7 @@ open_cb (GtkWidget *button,
static void static void
save_response_cb (GtkWidget *dialog, save_response_cb (GtkWidget *dialog,
int response, gint response,
NodeEditorWindow *self) NodeEditorWindow *self)
{ {
gtk_widget_hide (dialog); gtk_widget_hide (dialog);
@@ -577,7 +577,7 @@ create_cairo_texture (NodeEditorWindow *self)
static void static void
export_image_response_cb (GtkWidget *dialog, export_image_response_cb (GtkWidget *dialog,
int response, gint response,
GdkTexture *texture) GdkTexture *texture)
{ {
gtk_widget_hide (dialog); gtk_widget_hide (dialog);

View File

@@ -103,6 +103,7 @@
<property name="focus-widget">text_view</property> <property name="focus-widget">text_view</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="header"> <object class="GtkHeaderBar" id="header">
<property name="show-title-buttons">1</property>
<child type="start"> <child type="start">
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">document-open-symbolic</property> <property name="icon-name">document-open-symbolic</property>

View File

@@ -1,179 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="a" gradientTransform="matrix(0.232143 0 0 0.328947 -7.567033 263.82666)" gradientUnits="userSpaceOnUse" x1="88.595886" x2="536.595886" y1="-449.394012" y2="-449.394012">
<stop offset="0" stop-color="#acabae"/>
<stop offset="0.0384615" stop-color="#deddda"/>
<stop offset="0.0768555" stop-color="#c0bfbc"/>
<stop offset="0.923077" stop-color="#c0bfbc"/>
<stop offset="0.961538" stop-color="#deddda"/>
<stop offset="1" stop-color="#9a9996"/>
</linearGradient>
<linearGradient id="b" gradientUnits="userSpaceOnUse" x1="26.999876" x2="100.999876" y1="32.999688" y2="32.999688">
<stop offset="0" stop-color="#7e7c77"/>
<stop offset="0.3" stop-color="#9a9996"/>
<stop offset="1" stop-color="#9a9996"/>
</linearGradient>
<linearGradient id="c" gradientUnits="userSpaceOnUse" x1="67.467916" x2="67.467916" y1="83.999688" y2="36.782906">
<stop offset="0" stop-color="#deddda"/>
<stop offset="1" stop-color="#c0bfbc"/>
</linearGradient>
<clipPath id="d">
<path d="m 79 72 h 15 v 16 h -15 z m 0 0"/>
</clipPath>
<clipPath id="e">
<path d="m 93.21875 72.921875 l -14.21875 14.21875 h -4.0625 v -18.28125 h 18.28125 z m 0 0"/>
</clipPath>
<linearGradient id="f" gradientTransform="matrix(0 0.126951 0.126951 0 76.460862 36.359884)" gradientUnits="userSpaceOnUse" x1="344" x2="340" y1="76" y2="72">
<stop offset="0" stop-color="#d5d3cf"/>
<stop offset="1" stop-color="#ffffff"/>
</linearGradient>
<filter id="g" height="100%" width="100%" x="0%" y="0%">
<feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
</filter>
<mask id="h">
<g filter="url(#g)">
<rect fill-opacity="0.396" height="128" width="128"/>
</g>
</mask>
<linearGradient id="i" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#1c71d8"/>
<stop offset="0.323117" stop-color="#62a0ea"/>
<stop offset="0.59387" stop-color="#1b5aa6"/>
<stop offset="1" stop-color="#1c71d8"/>
</linearGradient>
<linearGradient id="j" gradientTransform="matrix(1.597748 1.597748 -1.06066 1.06066 -56.853041 -543.720139)" x1="224.504562" x2="231.453873" xlink:href="#i" y1="282.5" y2="282.5"/>
<radialGradient id="k" cx="227.599915" cy="201.029724" gradientTransform="matrix(4.072817 4.073078 -5.940048 5.939073 373.883117 -2098.049112)" gradientUnits="userSpaceOnUse" r="2.5">
<stop offset="0" stop-color="#93bdf1"/>
<stop offset="1" stop-color="#1a5fb4"/>
</radialGradient>
<linearGradient id="l" gradientTransform="matrix(2.121328 2.121328 -2.174353 2.174353 181.766074 -1021.145947)" gradientUnits="userSpaceOnUse" x1="226.90625" x2="228.86203" y1="288.75" y2="288.767151">
<stop offset="0" stop-color="#77767b"/>
<stop offset="0.443872" stop-color="#f6f5f4"/>
<stop offset="1" stop-color="#5e5c64"/>
</linearGradient>
<linearGradient id="m" gradientTransform="matrix(1.258421 1.258421 -1.06066 1.06066 57.381892 -503.024312)" gradientUnits="userSpaceOnUse" x1="223.1875" x2="233.0625" y1="278" y2="278">
<stop offset="0" stop-color="#ffa348"/>
<stop offset="0.265823" stop-color="#ffd7af"/>
<stop offset="0.734177" stop-color="#ff8d1c"/>
<stop offset="1" stop-color="#ffa348"/>
</linearGradient>
<linearGradient id="n" gradientTransform="matrix(1.573027 1.573027 -1.06066 1.06066 -14.348129 -574.754333)" x1="224.504562" x2="231.453873" xlink:href="#i" y1="282.5" y2="282.5"/>
<clipPath id="o">
<path d="m 79 72 h 15 v 16 h -15 z m 0 0"/>
</clipPath>
<clipPath id="p">
<path d="m 93.21875 72.921875 l -14.21875 14.21875 h -4.0625 v -18.28125 h 18.28125 z m 0 0"/>
</clipPath>
<mask id="q">
<g filter="url(#g)">
<rect fill-opacity="0.396" height="128" width="128"/>
</g>
</mask>
<clipPath id="r">
<rect height="152" width="192"/>
</clipPath>
<g id="s" clip-path="url(#r)">
<path d="m 29 112 c -4.433594 0 -8 -3.566406 -8 -8 v -2 c 0 4.433594 3.566406 8 8 8 h 88 c 4.433594 0 8 -3.566406 8 -8 v 2 c 0 4.433594 -3.566406 8 -8 8 z m 0 0" fill="#f6f5f4"/>
</g>
<clipPath id="t">
<rect height="128" width="128"/>
</clipPath>
<clipPath id="u">
<rect height="128" width="128"/>
</clipPath>
<mask id="v">
<g clip-path="url(#u)" filter="url(#g)">
<g clip-path="url(#t)">
<path d="m 21 16 c -4.433594 0 -8 3.566406 -8 8 v 84 c 0 4.433594 3.566406 8 8 8 h 4 v -4 h 80 v 4 h 4 c 4.433594 0 8 -3.566406 8 -8 v -84 c 0 -4.433594 -3.566406 -8 -8 -8 z m 0 0" fill="url(#a)"/>
<path d="m 21 12 h 88 c 4.417969 0 8 3.582031 8 8 v 68 c 0 4.417969 -3.582031 8 -8 8 h -88 c -4.417969 0 -8 -3.582031 -8 -8 v -68 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#deddda"/>
<path d="m 27 28 h 74 v 10 h -74 z m 0 0" fill="url(#b)"/>
<path d="m 27 38 h 74 v 46 h -74 z m 0 0" fill="url(#c)"/>
<path d="m 24 33 c 0 1.65625 -1.34375 3 -3 3 s -3 -1.34375 -3 -3 s 1.34375 -3 3 -3 s 3 1.34375 3 3 z m 0 0" fill="#bf5f00" fill-opacity="0.964567"/>
<path d="m 18 40 h 6 v 12 h -6 z m 0 0" fill="#acacac" fill-opacity="0.984252"/>
<path d="m 18 40 h 6 v 10 h -6 z m 0 0" fill="#d1d1d1" fill-opacity="0.984252"/>
<path d="m 37 36 h 56 v 44 h -56 z m 0 0" fill="#deddda" fill-opacity="0.984252"/>
<path d="m 37 34 h 56 c 1.105469 0 2 0.894531 2 2 s -0.894531 2 -2 2 h -56 c -1.105469 0 -2 -0.894531 -2 -2 s 0.894531 -2 2 -2 z m 0 0" fill-opacity="0.940945"/>
<path d="m 37 36.859375 h 56 v 36.925781 l -14.125 14.214844 h -41.875 z m 0 0" fill="#9a9996" fill-opacity="0.984252"/>
<path d="m 37 36 h 56 v 36.925781 l -14.125 14.214844 h -41.875 z m 0 0" fill="#f6f5f4" fill-opacity="0.984252"/>
<g clip-path="url(#o)">
<g clip-path="url(#p)">
<path d="m 79 77.386719 v 9.351562 c 0 2.464844 2 4.464844 4.464844 4.464844 h 9.351562 c 2.464844 0 4.464844 -2 4.464844 -4.464844 v -9.351562 c 0 -2.464844 -2 -4.464844 -4.464844 -4.464844 h -9.351562 c -2.464844 0 -4.464844 2 -4.464844 4.464844 z m 0 0" fill="url(#f)"/>
</g>
</g>
<path d="m 27 100 h 76 c 1.109375 0 2 0.890625 2 2 v 10 h -80 v -10 c 0 -1.109375 0.890625 -2 2 -2 z m 0 0" fill="#5e5c64" fill-opacity="0.940945"/>
<path d="m 27 102 h 76 c 1.109375 0 2 0.890625 2 2 v 10 h -80 v -10 c 0 -1.109375 0.890625 -2 2 -2 z m 0 0" fill="#9a9996"/>
<path d="m 13 106 v 2 c 0 4.433594 3.566406 8 8 8 h 4 v -2 h -4 c -4.433594 0 -8 -3.566406 -8 -8 z m 104 0 c 0 4.433594 -3.566406 8 -8 8 h -4 v 2 h 4 c 4.433594 0 8 -3.566406 8 -8 z m -92 6 v 2 h 80 v -2 z m 0 0" fill="#9e9c99" fill-opacity="0.366142"/>
<path d="m 27 38 v 46 l 6 -46 z m 0 0" fill="#7e7c77" fill-opacity="0.11811"/>
<path d="m 24 32 c 0 1.65625 -1.34375 3 -3 3 s -3 -1.34375 -3 -3 s 1.34375 -3 3 -3 s 3 1.34375 3 3 z m 0 0" fill="#ffa348" fill-opacity="0.964567"/>
<use mask="url(#q)" transform="matrix(1 0 0 1 -8 -16)" xlink:href="#s"/>
<path d="m 89.503906 31.144531 l 10.066406 10.066407 l -41.71875 41.71875 l -10.066406 -10.066407 z m 0 0" fill="#ffa348"/>
<path d="m 88.246094 29.886719 l 7.550781 7.550781 l -41.71875 41.71875 l -7.550781 -7.550781 z m 0 0" fill="#ff7800"/>
<path d="m 86.789062 28.429688 l 2.515626 2.515624 l -41.71875 41.71875 l -2.515626 -2.515624 z m 0 0" fill="#ffbe6f"/>
<path d="m 121.898438 -0.101562 c -4.855469 0.921874 -11.730469 5.152343 -18.140626 11.558593 l -16.96875 16.972657 l 12.78125 12.78125 l 16.972657 -16.972657 c 6.40625 -6.40625 10.636719 -13.28125 11.558593 -18.136719 z m 0 0" fill="url(#j)"/>
<path d="m 110.011719 13.882812 c -2.1875 -0.398437 -5.421875 0.988282 -8.167969 3.730469 l -11.871094 11.875 l -6.6875 6.6875 c -4.800781 4.800781 -9.234375 12.007813 -9.648437 13.042969 c -0.484375 1.207031 -0.449219 2.730469 0.953125 4.136719 c 1.40625 1.40625 2.917968 1.441406 4.136718 0.953125 c 1.035157 -0.414063 8.292969 -4.984375 13.042969 -9.648438 l 2.402344 -2.398437 l 16.160156 -16.160157 c 2.742188 -2.746093 4.128907 -5.976562 3.730469 -8.167968 c -0.742188 1.390625 -1.859375 2.902344 -3.308594 4.347656 l -13.996094 13.996094 l -5.089843 -5.089844 l 13.996093 -13.996094 c 1.445313 -1.445312 2.960938 -2.566406 4.347657 -3.308594 z m 0 0" fill="url(#k)"/>
<path d="m 95.273438 36.914062 l -2.960938 2.960938 l -2.398438 2.402344 c -4.90625 5.101562 -11.855468 10.828125 -11.855468 10.828125 c 1.011718 -0.433594 8.167968 -5.101563 12.914062 -9.769531 l 2.402344 -2.402344 l 2.960938 -2.957032 z m 0 0" fill="#62a0ea"/>
<path d="m 87.320312 26.835938 l 13.789063 13.789062 c 0.292969 0.292969 0.292969 0.769531 0 1.0625 s -0.769531 0.292969 -1.0625 0 l -13.789063 -13.789062 c -0.292968 -0.292969 -0.292968 -0.769532 0 -1.0625 c 0.292969 -0.289063 0.769532 -0.289063 1.0625 0 z m 0 0" fill="#3584e4"/>
<path d="m 42.421875 89.765625 c -3 3 -6.382813 4.484375 -7.554687 3.3125 c -1.171876 -1.171875 0.3125 -4.554687 3.3125 -7.554687 c 3.003906 -3.003907 6.386718 -4.488282 7.558593 -3.316407 s -0.3125 4.554688 -3.316406 7.558594 z m 0 0" fill="url(#l)"/>
<path d="m 45.269531 70.347656 l -7.851562 12.511719 l 7.835937 7.925781 l 12.597656 -7.855468 z m -6.039062 13.171875 l 5.449219 5.449219 c 0.347656 0.347656 0.449218 0.933594 0.097656 1.160156 c -0.886719 0.570313 -2.9375 1.539063 -2.9375 1.539063 c -0.25 0.128906 -0.539063 0.164062 -0.773438 -0.066407 l -4.546875 -4.550781 c -0.234375 -0.230469 -0.207031 -0.527343 -0.066406 -0.773437 l 1.617187 -2.859375 c 0.207032 -0.363281 0.8125 -0.25 1.160157 0.101562 z m 0 0" fill="url(#m)"/>
<path d="m 43.332031 74.777344 l 9.867188 9.867187 c 0.394531 0.390625 0.476562 0.871094 0.128906 1.066407 l -7.710937 5.253906 c -0.308594 0.210937 -0.785157 0.160156 -1.171876 -0.226563 l -6.984374 -6.988281 c -0.386719 -0.386719 -0.4375 -0.859375 -0.230469 -1.167969 l 5.234375 -7.8125 c 0.125 -0.285156 0.558594 -0.304687 0.867187 0.007813 z m 0 0" fill="url(#n)"/>
</g>
</g>
</mask>
<mask id="w">
<g filter="url(#g)">
<rect fill-opacity="0.8" height="128" width="128"/>
</g>
</mask>
<linearGradient id="x" gradientTransform="matrix(0 0.37 -0.98462 0 295.38501 -30.360001)" gradientUnits="userSpaceOnUse" x1="300" x2="428" y1="235" y2="235">
<stop offset="0" stop-color="#f9f06b"/>
<stop offset="1" stop-color="#f5c211"/>
</linearGradient>
<clipPath id="y">
<rect height="128" width="128"/>
</clipPath>
<clipPath id="z">
<rect height="128" width="128"/>
</clipPath>
</defs>
<path d="m 21 16 c -4.433594 0 -8 3.566406 -8 8 v 84 c 0 4.433594 3.566406 8 8 8 h 4 v -4 h 80 v 4 h 4 c 4.433594 0 8 -3.566406 8 -8 v -84 c 0 -4.433594 -3.566406 -8 -8 -8 z m 0 0" fill="url(#a)"/>
<path d="m 21 12 h 88 c 4.417969 0 8 3.582031 8 8 v 68 c 0 4.417969 -3.582031 8 -8 8 h -88 c -4.417969 0 -8 -3.582031 -8 -8 v -68 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#deddda"/>
<path d="m 27 28 h 74 v 10 h -74 z m 0 0" fill="url(#b)"/>
<path d="m 27 38 h 74 v 46 h -74 z m 0 0" fill="url(#c)"/>
<path d="m 24 33 c 0 1.65625 -1.34375 3 -3 3 s -3 -1.34375 -3 -3 s 1.34375 -3 3 -3 s 3 1.34375 3 3 z m 0 0" fill="#bf5f00" fill-opacity="0.964567"/>
<g fill-opacity="0.984252">
<path d="m 18 40 h 6 v 12 h -6 z m 0 0" fill="#acacac"/>
<path d="m 18 40 h 6 v 10 h -6 z m 0 0" fill="#d1d1d1"/>
<path d="m 37 36 h 56 v 44 h -56 z m 0 0" fill="#deddda"/>
</g>
<path d="m 37 34 h 56 c 1.105469 0 2 0.894531 2 2 s -0.894531 2 -2 2 h -56 c -1.105469 0 -2 -0.894531 -2 -2 s 0.894531 -2 2 -2 z m 0 0" fill-opacity="0.940945"/>
<path d="m 37 36.859375 h 56 v 36.925781 l -14.125 14.214844 h -41.875 z m 0 0" fill="#9a9996" fill-opacity="0.984252"/>
<path d="m 37 36 h 56 v 36.925781 l -14.125 14.214844 h -41.875 z m 0 0" fill="#f6f5f4" fill-opacity="0.984252"/>
<g clip-path="url(#d)">
<g clip-path="url(#e)">
<path d="m 79 77.386719 v 9.351562 c 0 2.464844 2 4.464844 4.464844 4.464844 h 9.351562 c 2.464844 0 4.464844 -2 4.464844 -4.464844 v -9.351562 c 0 -2.464844 -2 -4.464844 -4.464844 -4.464844 h -9.351562 c -2.464844 0 -4.464844 2 -4.464844 4.464844 z m 0 0" fill="url(#f)"/>
</g>
</g>
<path d="m 27 100 h 76 c 1.109375 0 2 0.890625 2 2 v 10 h -80 v -10 c 0 -1.109375 0.890625 -2 2 -2 z m 0 0" fill="#5e5c64" fill-opacity="0.940945"/>
<path d="m 27 102 h 76 c 1.109375 0 2 0.890625 2 2 v 10 h -80 v -10 c 0 -1.109375 0.890625 -2 2 -2 z m 0 0" fill="#9a9996"/>
<path d="m 13 106 v 2 c 0 4.433594 3.566406 8 8 8 h 4 v -2 h -4 c -4.433594 0 -8 -3.566406 -8 -8 z m 104 0 c 0 4.433594 -3.566406 8 -8 8 h -4 v 2 h 4 c 4.433594 0 8 -3.566406 8 -8 z m -92 6 v 2 h 80 v -2 z m 0 0" fill="#9e9c99" fill-opacity="0.366142"/>
<path d="m 27 38 v 46 l 6 -46 z m 0 0" fill="#7e7c77" fill-opacity="0.11811"/>
<path d="m 24 32 c 0 1.65625 -1.34375 3 -3 3 s -3 -1.34375 -3 -3 s 1.34375 -3 3 -3 s 3 1.34375 3 3 z m 0 0" fill="#ffa348" fill-opacity="0.964567"/>
<use mask="url(#h)" transform="matrix(1 0 0 1 -8 -16)" xlink:href="#s"/>
<path d="m 89.503906 31.144531 l 10.066406 10.066407 l -41.71875 41.71875 l -10.066406 -10.066407 z m 0 0" fill="#ffa348"/>
<path d="m 88.246094 29.886719 l 7.550781 7.550781 l -41.71875 41.71875 l -7.550781 -7.550781 z m 0 0" fill="#ff7800"/>
<path d="m 86.789062 28.429688 l 2.515626 2.515624 l -41.71875 41.71875 l -2.515626 -2.515624 z m 0 0" fill="#ffbe6f"/>
<path d="m 121.898438 -0.101562 c -4.855469 0.921874 -11.730469 5.152343 -18.140626 11.558593 l -16.96875 16.972657 l 12.78125 12.78125 l 16.972657 -16.972657 c 6.40625 -6.40625 10.636719 -13.28125 11.558593 -18.136719 z m 0 0" fill="url(#j)"/>
<path d="m 110.011719 13.882812 c -2.1875 -0.398437 -5.421875 0.988282 -8.167969 3.730469 l -11.871094 11.875 l -6.6875 6.6875 c -4.800781 4.800781 -9.234375 12.007813 -9.648437 13.042969 c -0.484375 1.207031 -0.449219 2.730469 0.953125 4.136719 c 1.40625 1.40625 2.917968 1.441406 4.136718 0.953125 c 1.035157 -0.414063 8.292969 -4.984375 13.042969 -9.648438 l 2.402344 -2.398437 l 16.160156 -16.160157 c 2.742188 -2.746093 4.128907 -5.976562 3.730469 -8.167968 c -0.742188 1.390625 -1.859375 2.902344 -3.308594 4.347656 l -13.996094 13.996094 l -5.089843 -5.089844 l 13.996093 -13.996094 c 1.445313 -1.445312 2.960938 -2.566406 4.347657 -3.308594 z m 0 0" fill="url(#k)"/>
<path d="m 95.273438 36.914062 l -2.960938 2.960938 l -2.398438 2.402344 c -4.90625 5.101562 -11.855468 10.828125 -11.855468 10.828125 c 1.011718 -0.433594 8.167968 -5.101563 12.914062 -9.769531 l 2.402344 -2.402344 l 2.960938 -2.957032 z m 0 0" fill="#62a0ea"/>
<path d="m 87.320312 26.835938 l 13.789063 13.789062 c 0.292969 0.292969 0.292969 0.769531 0 1.0625 s -0.769531 0.292969 -1.0625 0 l -13.789063 -13.789062 c -0.292968 -0.292969 -0.292968 -0.769532 0 -1.0625 c 0.292969 -0.289063 0.769532 -0.289063 1.0625 0 z m 0 0" fill="#3584e4"/>
<path d="m 42.421875 89.765625 c -3 3 -6.382813 4.484375 -7.554687 3.3125 c -1.171876 -1.171875 0.3125 -4.554687 3.3125 -7.554687 c 3.003906 -3.003907 6.386718 -4.488282 7.558593 -3.316407 s -0.3125 4.554688 -3.316406 7.558594 z m 0 0" fill="url(#l)"/>
<path d="m 45.269531 70.347656 l -7.851562 12.511719 l 7.835937 7.925781 l 12.597656 -7.855468 z m -6.039062 13.171875 l 5.449219 5.449219 c 0.347656 0.347656 0.449218 0.933594 0.097656 1.160156 c -0.886719 0.570313 -2.9375 1.539063 -2.9375 1.539063 c -0.25 0.128906 -0.539063 0.164062 -0.773438 -0.066407 l -4.546875 -4.550781 c -0.234375 -0.230469 -0.207031 -0.527343 -0.066406 -0.773437 l 1.617187 -2.859375 c 0.207032 -0.363281 0.8125 -0.25 1.160157 0.101562 z m 0 0" fill="url(#m)"/>
<path d="m 43.332031 74.777344 l 9.867188 9.867187 c 0.394531 0.390625 0.476562 0.871094 0.128906 1.066407 l -7.710937 5.253906 c -0.308594 0.210937 -0.785157 0.160156 -1.171876 -0.226563 l -6.984374 -6.988281 c -0.386719 -0.386719 -0.4375 -0.859375 -0.230469 -1.167969 l 5.234375 -7.8125 c 0.125 -0.285156 0.558594 -0.304687 0.867187 0.007813 z m 0 0" fill="url(#n)"/>
<g clip-path="url(#z)" mask="url(#v)">
<g clip-path="url(#y)" mask="url(#w)">
<path d="m 128 80.640625 v 47.359375 h -128 v -47.359375 z m 0 0" fill="url(#x)"/>
<path d="m 13.308594 80.640625 l 47.355468 47.359375 h 21.214844 l -47.359375 -47.359375 z m 42.421875 0 l 47.363281 47.359375 h 21.214844 l -47.363282 -47.359375 z m 42.429687 0 l 29.839844 29.839844 v -21.210938 l -8.628906 -8.628906 z m -98.160156 7.90625 v 21.214844 l 18.238281 18.238281 h 21.214844 z m 0 0"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -1,100 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<linearGradient id="a" gradientTransform="matrix(0.232143 0 0 0.328947 -7.567033 263.82666)" gradientUnits="userSpaceOnUse" x1="88.595886" x2="536.595886" y1="-449.394012" y2="-449.394012">
<stop offset="0" stop-color="#acabae"/>
<stop offset="0.0384615" stop-color="#deddda"/>
<stop offset="0.0768555" stop-color="#c0bfbc"/>
<stop offset="0.923077" stop-color="#c0bfbc"/>
<stop offset="0.961538" stop-color="#deddda"/>
<stop offset="1" stop-color="#9a9996"/>
</linearGradient>
<linearGradient id="b" gradientUnits="userSpaceOnUse" x1="26.999876" x2="100.999876" y1="32.999688" y2="32.999688">
<stop offset="0" stop-color="#7e7c77"/>
<stop offset="0.3" stop-color="#9a9996"/>
<stop offset="1" stop-color="#9a9996"/>
</linearGradient>
<linearGradient id="c" gradientUnits="userSpaceOnUse" x1="67.467916" x2="67.467916" y1="83.999688" y2="36.782906">
<stop offset="0" stop-color="#deddda"/>
<stop offset="1" stop-color="#c0bfbc"/>
</linearGradient>
<clipPath id="d">
<path d="m 79 72 h 15 v 16 h -15 z m 0 0"/>
</clipPath>
<clipPath id="e">
<path d="m 93.21875 72.921875 l -14.21875 14.21875 h -4.0625 v -18.28125 h 18.28125 z m 0 0"/>
</clipPath>
<linearGradient id="f" gradientTransform="matrix(0 0.126951 0.126951 0 76.460862 36.359884)" gradientUnits="userSpaceOnUse" x1="344" x2="340" y1="76" y2="72">
<stop offset="0" stop-color="#d5d3cf"/>
<stop offset="1" stop-color="#ffffff"/>
</linearGradient>
<filter id="g" height="100%" width="100%" x="0%" y="0%">
<feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
</filter>
<mask id="h">
<g filter="url(#g)">
<rect fill-opacity="0.396" height="128" width="128"/>
</g>
</mask>
<clipPath id="i">
<rect height="152" width="192"/>
</clipPath>
<linearGradient id="j" gradientUnits="userSpaceOnUse">
<stop offset="0" stop-color="#1c71d8"/>
<stop offset="0.323117" stop-color="#62a0ea"/>
<stop offset="0.59387" stop-color="#1b5aa6"/>
<stop offset="1" stop-color="#1c71d8"/>
</linearGradient>
<linearGradient id="k" gradientTransform="matrix(1.597748 1.597748 -1.06066 1.06066 -56.853041 -543.720139)" x1="224.504562" x2="231.453873" xlink:href="#j" y1="282.5" y2="282.5"/>
<radialGradient id="l" cx="227.599915" cy="201.029724" gradientTransform="matrix(4.072817 4.073078 -5.940048 5.939073 373.883117 -2098.049112)" gradientUnits="userSpaceOnUse" r="2.5">
<stop offset="0" stop-color="#93bdf1"/>
<stop offset="1" stop-color="#1a5fb4"/>
</radialGradient>
<linearGradient id="m" gradientTransform="matrix(2.121328 2.121328 -2.174353 2.174353 181.766074 -1021.145947)" gradientUnits="userSpaceOnUse" x1="226.90625" x2="228.86203" y1="288.75" y2="288.767151">
<stop offset="0" stop-color="#77767b"/>
<stop offset="0.443872" stop-color="#f6f5f4"/>
<stop offset="1" stop-color="#5e5c64"/>
</linearGradient>
<linearGradient id="n" gradientTransform="matrix(1.258421 1.258421 -1.06066 1.06066 57.381892 -503.024312)" gradientUnits="userSpaceOnUse" x1="223.1875" x2="233.0625" y1="278" y2="278">
<stop offset="0" stop-color="#ffa348"/>
<stop offset="0.265823" stop-color="#ffd7af"/>
<stop offset="0.734177" stop-color="#ff8d1c"/>
<stop offset="1" stop-color="#ffa348"/>
</linearGradient>
<linearGradient id="o" gradientTransform="matrix(1.573027 1.573027 -1.06066 1.06066 -14.348129 -574.754333)" x1="224.504562" x2="231.453873" xlink:href="#j" y1="282.5" y2="282.5"/>
<path d="m 21 16 c -4.433594 0 -8 3.566406 -8 8 v 84 c 0 4.433594 3.566406 8 8 8 h 4 v -4 h 80 v 4 h 4 c 4.433594 0 8 -3.566406 8 -8 v -84 c 0 -4.433594 -3.566406 -8 -8 -8 z m 0 0" fill="url(#a)"/>
<path d="m 21 12 h 88 c 4.417969 0 8 3.582031 8 8 v 68 c 0 4.417969 -3.582031 8 -8 8 h -88 c -4.417969 0 -8 -3.582031 -8 -8 v -68 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#deddda"/>
<path d="m 27 28 h 74 v 10 h -74 z m 0 0" fill="url(#b)"/>
<path d="m 27 38 h 74 v 46 h -74 z m 0 0" fill="url(#c)"/>
<path d="m 24 33 c 0 1.65625 -1.34375 3 -3 3 s -3 -1.34375 -3 -3 s 1.34375 -3 3 -3 s 3 1.34375 3 3 z m 0 0" fill="#bf5f00" fill-opacity="0.964567"/>
<g fill-opacity="0.984252">
<path d="m 18 40 h 6 v 12 h -6 z m 0 0" fill="#acacac"/>
<path d="m 18 40 h 6 v 10 h -6 z m 0 0" fill="#d1d1d1"/>
<path d="m 37 36 h 56 v 44 h -56 z m 0 0" fill="#deddda"/>
</g>
<path d="m 37 34 h 56 c 1.105469 0 2 0.894531 2 2 s -0.894531 2 -2 2 h -56 c -1.105469 0 -2 -0.894531 -2 -2 s 0.894531 -2 2 -2 z m 0 0" fill-opacity="0.940945"/>
<path d="m 37 36.859375 h 56 v 36.925781 l -14.125 14.214844 h -41.875 z m 0 0" fill="#9a9996" fill-opacity="0.984252"/>
<path d="m 37 36 h 56 v 36.925781 l -14.125 14.214844 h -41.875 z m 0 0" fill="#f6f5f4" fill-opacity="0.984252"/>
<g clip-path="url(#d)">
<g clip-path="url(#e)">
<path d="m 79 77.386719 v 9.351562 c 0 2.464844 2 4.464844 4.464844 4.464844 h 9.351562 c 2.464844 0 4.464844 -2 4.464844 -4.464844 v -9.351562 c 0 -2.464844 -2 -4.464844 -4.464844 -4.464844 h -9.351562 c -2.464844 0 -4.464844 2 -4.464844 4.464844 z m 0 0" fill="url(#f)"/>
</g>
</g>
<path d="m 27 100 h 76 c 1.109375 0 2 0.890625 2 2 v 10 h -80 v -10 c 0 -1.109375 0.890625 -2 2 -2 z m 0 0" fill="#5e5c64" fill-opacity="0.940945"/>
<path d="m 27 102 h 76 c 1.109375 0 2 0.890625 2 2 v 10 h -80 v -10 c 0 -1.109375 0.890625 -2 2 -2 z m 0 0" fill="#9a9996"/>
<path d="m 13 106 v 2 c 0 4.433594 3.566406 8 8 8 h 4 v -2 h -4 c -4.433594 0 -8 -3.566406 -8 -8 z m 104 0 c 0 4.433594 -3.566406 8 -8 8 h -4 v 2 h 4 c 4.433594 0 8 -3.566406 8 -8 z m -92 6 v 2 h 80 v -2 z m 0 0" fill="#9e9c99" fill-opacity="0.366142"/>
<path d="m 27 38 v 46 l 6 -46 z m 0 0" fill="#7e7c77" fill-opacity="0.11811"/>
<path d="m 24 32 c 0 1.65625 -1.34375 3 -3 3 s -3 -1.34375 -3 -3 s 1.34375 -3 3 -3 s 3 1.34375 3 3 z m 0 0" fill="#ffa348" fill-opacity="0.964567"/>
<g clip-path="url(#i)" mask="url(#h)" transform="matrix(1 0 0 1 -8 -16)">
<path d="m 29 112 c -4.433594 0 -8 -3.566406 -8 -8 v -2 c 0 4.433594 3.566406 8 8 8 h 88 c 4.433594 0 8 -3.566406 8 -8 v 2 c 0 4.433594 -3.566406 8 -8 8 z m 0 0" fill="#f6f5f4"/>
</g>
<path d="m 89.503906 31.144531 l 10.066406 10.066407 l -41.71875 41.71875 l -10.066406 -10.066407 z m 0 0" fill="#ffa348"/>
<path d="m 88.246094 29.886719 l 7.550781 7.550781 l -41.71875 41.71875 l -7.550781 -7.550781 z m 0 0" fill="#ff7800"/>
<path d="m 86.789062 28.429688 l 2.515626 2.515624 l -41.71875 41.71875 l -2.515626 -2.515624 z m 0 0" fill="#ffbe6f"/>
<path d="m 121.898438 -0.101562 c -4.855469 0.921874 -11.730469 5.152343 -18.140626 11.558593 l -16.96875 16.972657 l 12.78125 12.78125 l 16.972657 -16.972657 c 6.40625 -6.40625 10.636719 -13.28125 11.558593 -18.136719 z m 0 0" fill="url(#k)"/>
<path d="m 110.011719 13.882812 c -2.1875 -0.398437 -5.421875 0.988282 -8.167969 3.730469 l -11.871094 11.875 l -6.6875 6.6875 c -4.800781 4.800781 -9.234375 12.007813 -9.648437 13.042969 c -0.484375 1.207031 -0.449219 2.730469 0.953125 4.136719 c 1.40625 1.40625 2.917968 1.441406 4.136718 0.953125 c 1.035157 -0.414063 8.292969 -4.984375 13.042969 -9.648438 l 2.402344 -2.398437 l 16.160156 -16.160157 c 2.742188 -2.746093 4.128907 -5.976562 3.730469 -8.167968 c -0.742188 1.390625 -1.859375 2.902344 -3.308594 4.347656 l -13.996094 13.996094 l -5.089843 -5.089844 l 13.996093 -13.996094 c 1.445313 -1.445312 2.960938 -2.566406 4.347657 -3.308594 z m 0 0" fill="url(#l)"/>
<path d="m 95.273438 36.914062 l -2.960938 2.960938 l -2.398438 2.402344 c -4.90625 5.101562 -11.855468 10.828125 -11.855468 10.828125 c 1.011718 -0.433594 8.167968 -5.101563 12.914062 -9.769531 l 2.402344 -2.402344 l 2.960938 -2.957032 z m 0 0" fill="#62a0ea"/>
<path d="m 87.320312 26.835938 l 13.789063 13.789062 c 0.292969 0.292969 0.292969 0.769531 0 1.0625 s -0.769531 0.292969 -1.0625 0 l -13.789063 -13.789062 c -0.292968 -0.292969 -0.292968 -0.769532 0 -1.0625 c 0.292969 -0.289063 0.769532 -0.289063 1.0625 0 z m 0 0" fill="#3584e4"/>
<path d="m 42.421875 89.765625 c -3 3 -6.382813 4.484375 -7.554687 3.3125 c -1.171876 -1.171875 0.3125 -4.554687 3.3125 -7.554687 c 3.003906 -3.003907 6.386718 -4.488282 7.558593 -3.316407 s -0.3125 4.554688 -3.316406 7.558594 z m 0 0" fill="url(#m)"/>
<path d="m 45.269531 70.347656 l -7.851562 12.511719 l 7.835937 7.925781 l 12.597656 -7.855468 z m -6.039062 13.171875 l 5.449219 5.449219 c 0.347656 0.347656 0.449218 0.933594 0.097656 1.160156 c -0.886719 0.570313 -2.9375 1.539063 -2.9375 1.539063 c -0.25 0.128906 -0.539063 0.164062 -0.773438 -0.066407 l -4.546875 -4.550781 c -0.234375 -0.230469 -0.207031 -0.527343 -0.066406 -0.773437 l 1.617187 -2.859375 c 0.207032 -0.363281 0.8125 -0.25 1.160157 0.101562 z m 0 0" fill="url(#n)"/>
<path d="m 43.332031 74.777344 l 9.867188 9.867187 c 0.394531 0.390625 0.476562 0.871094 0.128906 1.066407 l -7.710937 5.253906 c -0.308594 0.210937 -0.785157 0.160156 -1.171876 -0.226563 l -6.984374 -6.988281 c -0.386719 -0.386719 -0.4375 -0.859375 -0.230469 -1.167969 l 5.234375 -7.8125 c 0.125 -0.285156 0.558594 -0.304687 0.867187 0.007813 z m 0 0" fill="url(#o)"/>
</svg>

Before

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<filter id="a" height="100%" width="100%" x="0%" y="0%">
<feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
</filter>
<mask id="b">
<g filter="url(#a)">
<rect fill-opacity="0.396" height="16" width="16"/>
</g>
</mask>
<clipPath id="c">
<rect height="152" width="192"/>
</clipPath>
<g clip-path="url(#c)" mask="url(#b)" transform="matrix(1 0 0 1 -168 -16)">
<path d="m 29 112 c -4.433594 0 -8 -3.566406 -8 -8 v -2 c 0 4.433594 3.566406 8 8 8 h 88 c 4.433594 0 8 -3.566406 8 -8 v 2 c 0 4.433594 -3.566406 8 -8 8 z m 0 0" fill="#f6f5f4"/>
</g>
<g fill="#2e3436">
<path d="m 4 2 v 2 h 5.585938 l 2 -2 z m -2 3 c -0.5 0 -1 0.5 -1 1 v 4 c 0 0.5 0.5 1 1 1 h 1 v -2 h 2 c 0 -0.265625 0.105469 -0.519531 0.292969 -0.707031 l 3.292969 -3.292969 z m 11.414062 0 l -4 4 h 3.585938 v 2 h 1 c 0.5 0 1 -0.5 1 -1 v -4 c 0 -0.5 -0.5 -1 -1 -1 z m -9.414062 5 v 5 h 8 v -5 h -3.585938 l -0.707031 0.707031 c -0.1875 0.1875 -0.441406 0.292969 -0.707031 0.292969 h -1 c -0.550781 0 -1 -0.449219 -1 -1 z m 0 0"/>
<path d="m 6 10 h 1 l 9 -9 l -1 -1 l -9 9 z m 0 0"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -12,12 +12,3 @@ install_data('org.gtk.PrintEditor4.desktop', install_dir: gtk_applicationsdir)
# appdata # appdata
install_data('org.gtk.PrintEditor4.appdata.xml', install_dir: gtk_appdatadir) install_data('org.gtk.PrintEditor4.appdata.xml', install_dir: gtk_appdatadir)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach

View File

@@ -2,7 +2,7 @@
Name=Print Editor Name=Print Editor
Comment=A simple editor demonstrating GTK printing Comment=A simple editor demonstrating GTK printing
Exec=gtk4-print-editor %f Exec=gtk4-print-editor %f
Icon=org.gtk.PrintEditor4.Devel Icon=text-editor-symbolic
Terminal=false Terminal=false
Type=Application Type=Application
StartupNotify=true StartupNotify=true

View File

@@ -33,8 +33,8 @@ update_title (GtkWindow *window)
static void static void
update_statusbar (void) update_statusbar (void)
{ {
char *msg; gchar *msg;
int row, col; gint row, col;
GtkTextIter iter; GtkTextIter iter;
const char *print_str; const char *print_str;
@@ -633,7 +633,7 @@ activate_about (GSimpleAction *action,
"website", "http://www.gtk.org", "website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK printing", "comments", "Program to demonstrate GTK printing",
"authors", (const char *[]){ "Alexander Larsson", NULL }, "authors", (const char *[]){ "Alexander Larsson", NULL },
"logo-icon-name", "org.gtk.PrintEditor4.Devel", "logo-icon-name", "text-editor-symbolic",
"title", "About GTK Print Editor", "title", "About GTK Print Editor",
"system-information", sysinfo->str, "system-information", sysinfo->str,
NULL); NULL);
@@ -675,7 +675,7 @@ static GActionEntry app_entries[] = {
{ "print", activate_print, NULL, NULL, NULL } { "print", activate_print, NULL, NULL, NULL }
}; };
static const char ui_info[] = static const gchar ui_info[] =
"<interface>" "<interface>"
" <menu id='menubar'>" " <menu id='menubar'>"
" <submenu>" " <submenu>"
@@ -781,8 +781,6 @@ activate (GApplication *app)
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE); gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE);
update_title (GTK_WINDOW (main_window)); update_title (GTK_WINDOW (main_window));
gtk_widget_add_css_class (main_window, "devel");
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (main_window), box); gtk_window_set_child (GTK_WINDOW (main_window), box);

View File

@@ -139,9 +139,9 @@ get_busy (GSimpleAction *action,
gtk_widget_set_sensitive (window, FALSE); gtk_widget_set_sensitive (window, FALSE);
} }
static int current_page = 0; static gint current_page = 0;
static gboolean static gboolean
on_page (int i) on_page (gint i)
{ {
return current_page == i; return current_page == i;
} }
@@ -250,12 +250,12 @@ activate_about (GSimpleAction *action,
gpointer user_data) gpointer user_data)
{ {
GtkApplication *app = user_data; GtkApplication *app = user_data;
const char *authors[] = { const gchar *authors[] = {
"Andrea Cimitan", "Andrea Cimitan",
"Cosimo Cecchi", "Cosimo Cecchi",
NULL NULL
}; };
char *version; gchar *version;
GString *s; GString *s;
s = g_string_new (""); s = g_string_new ("");
@@ -422,8 +422,8 @@ static void
spin_value_changed (GtkAdjustment *adjustment, GtkWidget *label) spin_value_changed (GtkAdjustment *adjustment, GtkWidget *label)
{ {
GtkWidget *w; GtkWidget *w;
int v; gint v;
char *text; gchar *text;
v = (int)gtk_adjustment_get_value (adjustment); v = (int)gtk_adjustment_get_value (adjustment);
@@ -454,8 +454,8 @@ spin_value_reset (GtkWidget *button, GtkAdjustment *adjustment)
dismiss (button); dismiss (button);
} }
static int pulse_time = 250; static gint pulse_time = 250;
static int pulse_entry_mode = 0; static gint pulse_entry_mode = 0;
static void static void
remove_pulse (gpointer pulse_id) remove_pulse (gpointer pulse_id)
@@ -482,7 +482,7 @@ pulse_it (GtkWidget *widget)
static void static void
update_pulse_time (GtkAdjustment *adjustment, GtkWidget *widget) update_pulse_time (GtkAdjustment *adjustment, GtkWidget *widget)
{ {
double value; gdouble value;
guint pulse_id; guint pulse_id;
value = gtk_adjustment_get_value (adjustment); value = gtk_adjustment_get_value (adjustment);
@@ -537,12 +537,12 @@ on_entry_icon_release (GtkEntry *entry,
static void static void
on_scale_button_value_changed (GtkScaleButton *button, on_scale_button_value_changed (GtkScaleButton *button,
double value, gdouble value,
gpointer user_data) gpointer user_data)
{ {
GtkAdjustment *adjustment; GtkAdjustment *adjustment;
double val; gdouble val;
char *str; gchar *str;
adjustment = gtk_scale_button_get_adjustment (button); adjustment = gtk_scale_button_get_adjustment (button);
val = gtk_scale_button_get_value (button); val = gtk_scale_button_get_value (button);
@@ -557,9 +557,9 @@ on_scale_button_value_changed (GtkScaleButton *button,
} }
else else
{ {
int percent; gint percent;
percent = (int) (100. * val / (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) + .5); percent = (gint) (100. * val / (gtk_adjustment_get_upper (adjustment) - gtk_adjustment_get_lower (adjustment)) + .5);
str = g_strdup_printf (C_("volume percentage", "%d%%"), percent); str = g_strdup_printf (C_("volume percentage", "%d%%"), percent);
} }
@@ -627,7 +627,7 @@ static void
on_range_from_changed (GtkSpinButton *from) on_range_from_changed (GtkSpinButton *from)
{ {
GtkSpinButton *to; GtkSpinButton *to;
int v1, v2; gint v1, v2;
to = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (from), "range_to_spin")); to = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (from), "range_to_spin"));
@@ -642,7 +642,7 @@ static void
on_range_to_changed (GtkSpinButton *to) on_range_to_changed (GtkSpinButton *to)
{ {
GtkSpinButton *from; GtkSpinButton *from;
int v1, v2; gint v1, v2;
from = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (to), "range_from_spin")); from = GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (to), "range_from_spin"));
@@ -654,7 +654,7 @@ on_range_to_changed (GtkSpinButton *to)
} }
static void static void
info_bar_response (GtkWidget *infobar, int response_id) info_bar_response (GtkWidget *infobar, gint response_id)
{ {
if (response_id == GTK_RESPONSE_CLOSE) if (response_id == GTK_RESPONSE_CLOSE)
gtk_widget_hide (infobar); gtk_widget_hide (infobar);
@@ -703,7 +703,7 @@ action_dialog_button_clicked (GtkButton *button, GtkWidget *page)
static void static void
page_changed_cb (GtkWidget *stack, GParamSpec *pspec, gpointer data) page_changed_cb (GtkWidget *stack, GParamSpec *pspec, gpointer data)
{ {
const char *name; const gchar *name;
GtkWidget *window; GtkWidget *window;
GtkWidget *page; GtkWidget *page;
@@ -853,10 +853,10 @@ update_title_header (GtkListBoxRow *row,
gpointer data) gpointer data)
{ {
GtkWidget *header; GtkWidget *header;
char *title; gchar *title;
header = gtk_list_box_row_get_header (row); header = gtk_list_box_row_get_header (row);
title = (char *)g_object_get_data (G_OBJECT (row), "title"); title = (gchar *)g_object_get_data (G_OBJECT (row), "title");
if (!header && title) if (!header && title)
{ {
title = g_strdup_printf ("<b>%s</b>", title); title = g_strdup_printf ("<b>%s</b>", title);
@@ -881,8 +881,8 @@ overshot (GtkScrolledWindow *sw, GtkPositionType pos, GtkWidget *widget)
{ {
GtkWidget *box, *row, *label, *swatch; GtkWidget *box, *row, *label, *swatch;
GdkRGBA rgba; GdkRGBA rgba;
const char *color; const gchar *color;
char *text; gchar *text;
GtkWidget *silver; GtkWidget *silver;
GtkWidget *gold; GtkWidget *gold;
@@ -983,7 +983,7 @@ set_color (GtkListBox *box, GtkListBoxRow *row, GtkColorChooser *chooser)
static void static void
populate_colors (GtkWidget *widget, GtkWidget *chooser) populate_colors (GtkWidget *widget, GtkWidget *chooser)
{ {
struct { const char *name; const char *color; const char *title; } colors[] = { struct { const gchar *name; const gchar *color; const gchar *title; } colors[] = {
{ "2.5", "#C8828C", "Red" }, { "2.5", "#C8828C", "Red" },
{ "5", "#C98286", NULL }, { "5", "#C98286", NULL },
{ "7.5", "#C9827F", NULL }, { "7.5", "#C9827F", NULL },
@@ -1025,7 +1025,7 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser)
{ "7.5", "#C48299", NULL }, { "7.5", "#C48299", NULL },
{ "10", "#C68292", NULL } { "10", "#C68292", NULL }
}; };
int i; gint i;
GtkWidget *row, *box, *label, *swatch; GtkWidget *row, *box, *label, *swatch;
GtkWidget *sw; GtkWidget *sw;
GdkRGBA rgba; GdkRGBA rgba;
@@ -1081,7 +1081,7 @@ populate_colors (GtkWidget *widget, GtkWidget *chooser)
typedef struct { typedef struct {
GtkWidget *flowbox; GtkWidget *flowbox;
char *filename; gchar *filename;
} BackgroundData; } BackgroundData;
static void static void
@@ -1127,11 +1127,11 @@ background_loaded_cb (GObject *source,
static void static void
populate_flowbox (GtkWidget *flowbox) populate_flowbox (GtkWidget *flowbox)
{ {
const char *location; const gchar *location;
GDir *dir; GDir *dir;
GError *error = NULL; GError *error = NULL;
const char *name; const gchar *name;
char *filename; gchar *filename;
GFile *file; GFile *file;
GInputStream *stream; GInputStream *stream;
BackgroundData *bd; BackgroundData *bd;
@@ -1288,7 +1288,7 @@ my_text_view_class_init (MyTextViewClass *class)
} }
static void static void
my_text_view_set_background (MyTextView *tv, const char *filename, gboolean is_resource) my_text_view_set_background (MyTextView *tv, const gchar *filename, gboolean is_resource)
{ {
GError *error = NULL; GError *error = NULL;
GFile *file; GFile *file;
@@ -1331,12 +1331,12 @@ my_text_view_set_adjustment (MyTextView *tv, GtkAdjustment *adjustment)
} }
static void static void
close_selection_dialog (GtkWidget *dialog, int response, GtkWidget *tv) close_selection_dialog (GtkWidget *dialog, gint response, GtkWidget *tv)
{ {
GtkWidget *box; GtkWidget *box;
GtkWidget *child; GtkWidget *child;
GList *children; GList *children;
const char *filename; const gchar *filename;
gboolean is_resource; gboolean is_resource;
gtk_widget_hide (dialog); gtk_widget_hide (dialog);
@@ -1352,7 +1352,7 @@ close_selection_dialog (GtkWidget *dialog, int response, GtkWidget *tv)
return; return;
child = children->data; child = children->data;
filename = (const char *)g_object_get_data (G_OBJECT (child), "filename"); filename = (const gchar *)g_object_get_data (G_OBJECT (child), "filename");
is_resource = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "is-resource")); is_resource = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (child), "is-resource"));
g_list_free (children); g_list_free (children);
@@ -1377,8 +1377,8 @@ static void
handle_insert (GtkWidget *button, GtkWidget *textview) handle_insert (GtkWidget *button, GtkWidget *textview)
{ {
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
const char *id; const gchar *id;
const char *text; const gchar *text;
id = gtk_buildable_get_name (GTK_BUILDABLE (button)); id = gtk_buildable_get_name (GTK_BUILDABLE (button));
@@ -1402,7 +1402,7 @@ handle_cutcopypaste (GtkWidget *button, GtkWidget *textview)
{ {
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
GdkClipboard *clipboard; GdkClipboard *clipboard;
const char *id; const gchar *id;
clipboard = gtk_widget_get_clipboard (textview); clipboard = gtk_widget_get_clipboard (textview);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview));
@@ -1421,7 +1421,7 @@ handle_cutcopypaste (GtkWidget *button, GtkWidget *textview)
static void static void
clipboard_formats_notify (GdkClipboard *clipboard, GdkEvent *event, GtkWidget *button) clipboard_formats_notify (GdkClipboard *clipboard, GdkEvent *event, GtkWidget *button)
{ {
const char *id; const gchar *id;
gboolean has_text; gboolean has_text;
id = gtk_buildable_get_name (GTK_BUILDABLE (button)); id = gtk_buildable_get_name (GTK_BUILDABLE (button));
@@ -1434,7 +1434,7 @@ clipboard_formats_notify (GdkClipboard *clipboard, GdkEvent *event, GtkWidget *b
static void static void
textbuffer_notify_selection (GObject *object, GParamSpec *pspec, GtkWidget *button) textbuffer_notify_selection (GObject *object, GParamSpec *pspec, GtkWidget *button)
{ {
const char *id; const gchar *id;
gboolean has_selection; gboolean has_selection;
id = gtk_buildable_get_name (GTK_BUILDABLE (button)); id = gtk_buildable_get_name (GTK_BUILDABLE (button));
@@ -1469,7 +1469,7 @@ page_combo_separator_func (GtkTreeModel *model,
GtkTreeIter *iter, GtkTreeIter *iter,
gpointer data) gpointer data)
{ {
char *text; gchar *text;
gboolean res; gboolean res;
gtk_tree_model_get (model, iter, 0, &text, -1); gtk_tree_model_get (model, iter, 0, &text, -1);
@@ -1594,7 +1594,7 @@ text_view_add_to_context_menu (GtkTextView *text_view)
static void static void
open_popover_text_changed (GtkEntry *entry, GParamSpec *pspec, GtkWidget *button) open_popover_text_changed (GtkEntry *entry, GParamSpec *pspec, GtkWidget *button)
{ {
const char *text; const gchar *text;
text = gtk_editable_get_text (GTK_EDITABLE (entry)); text = gtk_editable_get_text (GTK_EDITABLE (entry));
gtk_widget_set_sensitive (button, strlen (text) > 0); gtk_widget_set_sensitive (button, strlen (text) > 0);
@@ -1864,8 +1864,8 @@ activate (GApplication *app)
{ "print", activate_print, NULL, NULL, NULL }, { "print", activate_print, NULL, NULL, NULL },
}; };
struct { struct {
const char *action_and_target; const gchar *action_and_target;
const char *accelerators[2]; const gchar *accelerators[2];
} accels[] = { } accels[] = {
{ "app.about", { "F1", NULL } }, { "app.about", { "F1", NULL } },
{ "app.quit", { "<Control>q", NULL } }, { "app.quit", { "<Control>q", NULL } },
@@ -1878,15 +1878,15 @@ activate (GApplication *app)
{ "win.lock", { "<Control>l", NULL } }, { "win.lock", { "<Control>l", NULL } },
}; };
struct { struct {
const char *action_and_target; const gchar *action_and_target;
const char *accelerators[2]; const gchar *accelerators[2];
} late_accels[] = { } late_accels[] = {
{ "app.cut", { "<Control>x", NULL } }, { "app.cut", { "<Control>x", NULL } },
{ "app.copy", { "<Control>c", NULL } }, { "app.copy", { "<Control>c", NULL } },
{ "app.paste", { "<Control>v", NULL } }, { "app.paste", { "<Control>v", NULL } },
{ "win.delete", { "Delete", NULL } }, { "win.delete", { "Delete", NULL } },
}; };
int i; gint i;
GPermission *permission; GPermission *permission;
GAction *action; GAction *action;
GError *error = NULL; GError *error = NULL;
@@ -2282,7 +2282,7 @@ main (int argc, char *argv[])
{ "check-off-disabled", NULL, NULL, "false", NULL }, { "check-off-disabled", NULL, NULL, "false", NULL },
{ "radio-x-disabled", NULL, "s", "'x'", NULL }, { "radio-x-disabled", NULL, "s", "'x'", NULL },
}; };
int status; gint status;
app = gtk_application_new ("org.gtk.WidgetFactory4", G_APPLICATION_NON_UNIQUE); app = gtk_application_new ("org.gtk.WidgetFactory4", G_APPLICATION_NON_UNIQUE);

View File

@@ -436,6 +436,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="title">GTK Widget Factory</property> <property name="title">GTK Widget Factory</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="headerbar1"> <object class="GtkHeaderBar" id="headerbar1">
<property name="show-title-buttons">1</property>
<child type="title"> <child type="title">
<object class="GtkStackSwitcher" id="stack_switcher"> <object class="GtkStackSwitcher" id="stack_switcher">
<property name="stack">toplevel_stack</property> <property name="stack">toplevel_stack</property>

View File

@@ -474,19 +474,19 @@ The maximum width of each column is given by the longest element in the
column: column:
```c ```c
void gtk_type_set_property (GtkType *type, void gtk_type_set_property (GtkType *type,
const char *value, const gchar *value,
GError **error); GError **error);
const char *gtk_type_get_property (GtkType *type); const gchar *gtk_type_get_property (GtkType *type);
``` ```
It is also possible to align the columns to the next tab: It is also possible to align the columns to the next tab:
```c ```c
void gtk_type_set_prop (GtkType *type, void gtk_type_set_prop (GtkType *type,
float value); gfloat value);
float gtk_type_get_prop (GtkType *type); gfloat gtk_type_get_prop (GtkType *type);
int gtk_type_update_foobar (GtkType *type); gint gtk_type_update_foobar (GtkType *type);
``` ```
Public headers should never be included directly: Public headers should never be included directly:

View File

@@ -426,8 +426,8 @@ draw_cb (GtkDrawingArea *drawing_area,
/* Draw a rectangle on the surface at the given position */ /* Draw a rectangle on the surface at the given position */
static void static void
draw_brush (GtkWidget *widget, draw_brush (GtkWidget *widget,
double x, gdouble x,
double y) gdouble y)
{ {
cairo_t *cr; cairo_t *cr;
@@ -797,8 +797,8 @@ example_app_activate (GApplication *app)
static void static void
example_app_open (GApplication *app, example_app_open (GApplication *app,
GFile **files, GFile **files,
int n_files, gint n_files,
const char *hint) const gchar *hint)
{ {
GList *windows; GList *windows;
ExampleAppWindow *win; ExampleAppWindow *win;
@@ -1138,7 +1138,7 @@ example_app_startup (GApplication *app)
{ {
GtkBuilder *builder; GtkBuilder *builder;
GMenuModel *app_menu; GMenuModel *app_menu;
const char *quit_accels[2] = { "&lt;Ctrl&gt;Q", NULL }; const gchar *quit_accels[2] = { "&lt;Ctrl&gt;Q", NULL };
G_APPLICATION_CLASS (example_app_parent_class)->startup (app); G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
@@ -1423,6 +1423,7 @@ the search bar below the header bar.
<property name="default-height">400</property> <property name="default-height">400</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="header"> <object class="GtkHeaderBar" id="header">
<property name="show-title-buttons">1</property>
<child type="title"> <child type="title">
<object class="GtkStackSwitcher" id="tabs"> <object class="GtkStackSwitcher" id="tabs">
<property name="stack">stack</property> <property name="stack">stack</property>
@@ -1476,7 +1477,7 @@ static void
search_text_changed (GtkEntry *entry, search_text_changed (GtkEntry *entry,
ExampleAppWindow *win) ExampleAppWindow *win)
{ {
const char *text; const gchar *text;
GtkWidget *tab; GtkWidget *tab;
GtkWidget *view; GtkWidget *view;
GtkTextBuffer *buffer; GtkTextBuffer *buffer;
@@ -1536,6 +1537,7 @@ GtkMenuButton, GtkRevealer and GtkListBox.
<property name="default-height">400</property> <property name="default-height">400</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar" id="header"> <object class="GtkHeaderBar" id="header">
<property name="show-title-buttons">1</property>
<child type="title"> <child type="title">
<object class="GtkStackSwitcher" id="tabs"> <object class="GtkStackSwitcher" id="tabs">
<property name="stack">stack</property> <property name="stack">stack</property>

View File

@@ -177,7 +177,6 @@ def ConvertToDocbook(infile, outfile):
subprocess.check_call(["pandoc", infile, "-o", outfile, subprocess.check_call(["pandoc", infile, "-o", outfile,
"--from=" + input_format, "--from=" + input_format,
"--to=" + output_format, "--to=" + output_format,
"--standalone",
"--top-level-division=" + division]) "--top-level-division=" + division])
def ExpandGtkDocAbbreviations(infile, outfile): def ExpandGtkDocAbbreviations(infile, outfile):

View File

@@ -54,9 +54,8 @@
<section> <section>
<xi:include href="xml/gtkfilter.xml" /> <xi:include href="xml/gtkfilter.xml" />
<xi:include href="xml/gtkcustomfilter.xml" /> <xi:include href="xml/gtkcustomfilter.xml" />
<xi:include href="xml/gtkmultifilter.xml" />
<xi:include href="xml/gtkstringfilter.xml" /> <xi:include href="xml/gtkstringfilter.xml" />
<xi:include href="xml/gtkfilefilter.xml" /> <xi:include href="xml/gtkmultifilter.xml" />
</section> </section>
<xi:include href="xml/gtkflattenlistmodel.xml" /> <xi:include href="xml/gtkflattenlistmodel.xml" />
<xi:include href="xml/gtkmaplistmodel.xml" /> <xi:include href="xml/gtkmaplistmodel.xml" />
@@ -65,9 +64,9 @@
<section> <section>
<xi:include href="xml/gtksorter.xml" /> <xi:include href="xml/gtksorter.xml" />
<xi:include href="xml/gtkcustomsorter.xml" /> <xi:include href="xml/gtkcustomsorter.xml" />
<xi:include href="xml/gtkmultisorter.xml" />
<xi:include href="xml/gtkstringsorter.xml" /> <xi:include href="xml/gtkstringsorter.xml" />
<xi:include href="xml/gtknumericsorter.xml" /> <xi:include href="xml/gtknumericsorter.xml" />
<xi:include href="xml/gtkmultisorter.xml" />
</section> </section>
<xi:include href="xml/gtkselectionmodel.xml" /> <xi:include href="xml/gtkselectionmodel.xml" />
<section> <section>
@@ -75,7 +74,6 @@
<xi:include href="xml/gtksingleselection.xml" /> <xi:include href="xml/gtksingleselection.xml" />
<xi:include href="xml/gtkmultiselection.xml" /> <xi:include href="xml/gtkmultiselection.xml" />
</section> </section>
<xi:include href="xml/gtkselectionfiltermodel.xml" />
<xi:include href="xml/gtkbookmarklist.xml" /> <xi:include href="xml/gtkbookmarklist.xml" />
<xi:include href="xml/gtkdirectorylist.xml" /> <xi:include href="xml/gtkdirectorylist.xml" />
<xi:include href="xml/gtkstringlist.xml" /> <xi:include href="xml/gtkstringlist.xml" />
@@ -93,9 +91,7 @@
<xi:include href="xml/gtklistview.xml" /> <xi:include href="xml/gtklistview.xml" />
<xi:include href="xml/gtkgridview.xml" /> <xi:include href="xml/gtkgridview.xml" />
<xi:include href="xml/gtkcolumnview.xml" /> <xi:include href="xml/gtkcolumnview.xml" />
<section> <xi:include href="xml/gtkcolumnviewcolumn.xml" />
<xi:include href="xml/gtkcolumnviewcolumn.xml" />
</section>
<xi:include href="xml/gtkdropdown.xml" /> <xi:include href="xml/gtkdropdown.xml" />
</chapter> </chapter>
@@ -288,6 +284,7 @@
<xi:include href="xml/gtkfilechoosernative.xml" /> <xi:include href="xml/gtkfilechoosernative.xml" />
<xi:include href="xml/gtkfilechooserdialog.xml" /> <xi:include href="xml/gtkfilechooserdialog.xml" />
<xi:include href="xml/gtkfilechooserwidget.xml" /> <xi:include href="xml/gtkfilechooserwidget.xml" />
<xi:include href="xml/gtkfilefilter.xml" />
<xi:include href="xml/gtkfontchooser.xml" /> <xi:include href="xml/gtkfontchooser.xml" />
<xi:include href="xml/gtkfontbutton.xml" /> <xi:include href="xml/gtkfontbutton.xml" />
<xi:include href="xml/gtkfontchooserwidget.xml" /> <xi:include href="xml/gtkfontchooserwidget.xml" />

View File

@@ -375,7 +375,7 @@ gtk_bitset_subtract
gtk_bitset_difference gtk_bitset_difference
gtk_bitset_shift_left gtk_bitset_shift_left
gtk_bitset_shift_right gtk_bitset_shift_right
gtk_bitset_splice gtk_bitset_slice
<SUBSECTION> <SUBSECTION>
GtkBitsetIter GtkBitsetIter
gtk_bitset_iter_init_first gtk_bitset_iter_init_first
@@ -423,7 +423,6 @@ gtk_selection_model_get_type
GtkNoSelection GtkNoSelection
gtk_no_selection_new gtk_no_selection_new
gtk_no_selection_get_model gtk_no_selection_get_model
gtk_no_selection_set_model
<SUBSECTION Private> <SUBSECTION Private>
gtk_no_selection_get_type gtk_no_selection_get_type
</SECTION> </SECTION>
@@ -435,7 +434,6 @@ GtkSingleSelection
GTK_INVALID_LIST_POSITION GTK_INVALID_LIST_POSITION
gtk_single_selection_new gtk_single_selection_new
gtk_single_selection_get_model gtk_single_selection_get_model
gtk_single_selection_set_model
gtk_single_selection_get_selected gtk_single_selection_get_selected
gtk_single_selection_set_selected gtk_single_selection_set_selected
gtk_single_selection_get_selected_item gtk_single_selection_get_selected_item
@@ -452,8 +450,6 @@ gtk_single_selection_get_type
<TITLE>GtkMultiSeledction</TITLE> <TITLE>GtkMultiSeledction</TITLE>
GtkMultiSelection GtkMultiSelection
gtk_multi_selection_new gtk_multi_selection_new
gtk_multi_selection_get_model
gtk_multi_selection_set_model
<SUBSECTION Private> <SUBSECTION Private>
gtk_multi_selection_get_type gtk_multi_selection_get_type
</SECTION> </SECTION>
@@ -1300,19 +1296,23 @@ gtk_file_chooser_get_current_name
<SUBSECTION> <SUBSECTION>
gtk_file_chooser_get_file gtk_file_chooser_get_file
gtk_file_chooser_set_file gtk_file_chooser_set_file
gtk_file_chooser_select_file
gtk_file_chooser_unselect_file
gtk_file_chooser_select_all
gtk_file_chooser_unselect_all
gtk_file_chooser_get_files gtk_file_chooser_get_files
gtk_file_chooser_set_current_folder gtk_file_chooser_set_current_folder
gtk_file_chooser_get_current_folder gtk_file_chooser_get_current_folder
<SUBSECTION> <SUBSECTION>
gtk_file_chooser_add_filter gtk_file_chooser_add_filter
gtk_file_chooser_remove_filter gtk_file_chooser_remove_filter
gtk_file_chooser_get_filters gtk_file_chooser_list_filters
gtk_file_chooser_set_filter gtk_file_chooser_set_filter
gtk_file_chooser_get_filter gtk_file_chooser_get_filter
<SUBSECTION> <SUBSECTION>
gtk_file_chooser_add_shortcut_folder gtk_file_chooser_add_shortcut_folder
gtk_file_chooser_remove_shortcut_folder gtk_file_chooser_remove_shortcut_folder
gtk_file_chooser_get_shortcut_folders gtk_file_chooser_list_shortcut_folders
<SUBSECTION> <SUBSECTION>
gtk_file_chooser_add_choice gtk_file_chooser_add_choice
gtk_file_chooser_remove_choice gtk_file_chooser_remove_choice
@@ -1409,13 +1409,18 @@ GtkFileChooserButtonPrivate
<SECTION> <SECTION>
<FILE>gtkfilefilter</FILE> <FILE>gtkfilefilter</FILE>
GtkFileFilter GtkFileFilter
GtkFileFilterInfo
GtkFileFilterFlags
GtkFileFilterFunc
gtk_file_filter_new gtk_file_filter_new
gtk_file_filter_set_name gtk_file_filter_set_name
gtk_file_filter_get_name gtk_file_filter_get_name
gtk_file_filter_add_mime_type gtk_file_filter_add_mime_type
gtk_file_filter_add_pattern gtk_file_filter_add_pattern
gtk_file_filter_add_pixbuf_formats gtk_file_filter_add_pixbuf_formats
gtk_file_filter_get_attributes gtk_file_filter_add_custom
gtk_file_filter_get_needed
gtk_file_filter_filter
<SUBSECTION Serialization> <SUBSECTION Serialization>
gtk_file_filter_new_from_gvariant gtk_file_filter_new_from_gvariant
@@ -1440,8 +1445,6 @@ gtk_directory_list_get_file
gtk_directory_list_set_file gtk_directory_list_set_file
gtk_directory_list_get_io_priority gtk_directory_list_get_io_priority
gtk_directory_list_set_io_priority gtk_directory_list_set_io_priority
gtk_directory_list_get_monitored
gtk_directory_list_set_monitored
gtk_directory_list_is_loading gtk_directory_list_is_loading
gtk_directory_list_get_error gtk_directory_list_get_error
<SUBSECTION Standard> <SUBSECTION Standard>
@@ -1536,6 +1539,7 @@ gtk_custom_filter_get_type
<TITLE>GtkFilterListModel</TITLE> <TITLE>GtkFilterListModel</TITLE>
GtkFilterListModel GtkFilterListModel
gtk_filter_list_model_new gtk_filter_list_model_new
gtk_filter_list_model_new_for_type
gtk_filter_list_model_set_model gtk_filter_list_model_set_model
gtk_filter_list_model_get_model gtk_filter_list_model_get_model
gtk_filter_list_model_set_filter gtk_filter_list_model_set_filter
@@ -2041,6 +2045,8 @@ gtk_menu_button_get_menu_model
GtkArrowType GtkArrowType
gtk_menu_button_set_direction gtk_menu_button_set_direction
gtk_menu_button_get_direction gtk_menu_button_get_direction
gtk_menu_button_set_align_widget
gtk_menu_button_get_align_widget
gtk_menu_button_set_icon_name gtk_menu_button_set_icon_name
gtk_menu_button_get_icon_name gtk_menu_button_get_icon_name
gtk_menu_button_set_label gtk_menu_button_set_label
@@ -2695,6 +2701,7 @@ gtk_size_group_get_type
<TITLE>GtkSliceListModel</TITLE> <TITLE>GtkSliceListModel</TITLE>
GtkSliceListModel GtkSliceListModel
gtk_slice_list_model_new gtk_slice_list_model_new
gtk_slice_list_model_new_for_type
gtk_slice_list_model_set_model gtk_slice_list_model_set_model
gtk_slice_list_model_get_model gtk_slice_list_model_get_model
gtk_slice_list_model_set_offset gtk_slice_list_model_set_offset
@@ -2826,13 +2833,11 @@ gtk_tree_list_row_sorter_get_type
<TITLE>GtkSortListModel</TITLE> <TITLE>GtkSortListModel</TITLE>
GtkSortListModel GtkSortListModel
gtk_sort_list_model_new gtk_sort_list_model_new
gtk_sort_list_model_new_for_type
gtk_sort_list_model_set_sorter gtk_sort_list_model_set_sorter
gtk_sort_list_model_get_sorter gtk_sort_list_model_get_sorter
gtk_sort_list_model_set_model gtk_sort_list_model_set_model
gtk_sort_list_model_get_model gtk_sort_list_model_get_model
gtk_sort_list_model_set_incremental
gtk_sort_list_model_get_incremental
gtk_sort_list_model_get_peanding
<SUBSECTION Standard> <SUBSECTION Standard>
GTK_SORT_LIST_MODEL GTK_SORT_LIST_MODEL
GTK_IS_SORT_LIST_MODEL GTK_IS_SORT_LIST_MODEL
@@ -3421,7 +3426,6 @@ gtk_tree_list_row_get_type
<SECTION> <SECTION>
<FILE>gtktreeexpander</FILE> <FILE>gtktreeexpander</FILE>
<TITLE>GtkTreeExpander</TITLE> <TITLE>GtkTreeExpander</TITLE>
GtkTreeExpander
gtk_tree_expander_new gtk_tree_expander_new
gtk_tree_expander_get_child gtk_tree_expander_get_child
gtk_tree_expander_set_child gtk_tree_expander_set_child
@@ -7543,27 +7547,12 @@ gtk_expression_watch_unwatch
<SUBSECTION> <SUBSECTION>
gtk_property_expression_new gtk_property_expression_new
gtk_property_expression_new_for_pspec gtk_property_expression_new_for_pspec
gtk_property_expression_get_expression
gtk_property_expression_get_pspec
gtk_constant_expression_new gtk_constant_expression_new
gtk_constant_expression_new_for_value gtk_constant_expression_new_for_value
gtk_constant_expression_get_value
gtk_object_expression_new gtk_object_expression_new
gtk_object_expression_get_object
gtk_closure_expression_new gtk_closure_expression_new
gtk_cclosure_expression_new gtk_cclosure_expression_new
<SUBSECTION>
GTK_VALUE_HOLDS_EXPRESSION
gtk_value_set_expression
gtk_value_take_expression
gtk_value_get_expression
gtk_value_dup_expression
<SUBSECTION>
GtkParamSpecExpression
gtk_param_spec_expression
<SUBSECTION Standard> <SUBSECTION Standard>
GTK_IS_EXPRESSION GTK_IS_EXPRESSION
GTK_TYPE_EXPRESSION GTK_TYPE_EXPRESSION
@@ -7624,18 +7613,6 @@ gtk_string_list_take
gtk_string_list_remove gtk_string_list_remove
gtk_string_list_splice gtk_string_list_splice
gtk_string_list_get_string gtk_string_list_get_string
<SUBSECTION>
GtkStringObject GtkStringObject
gtk_string_object_new
gtk_string_object_get_string gtk_string_object_get_string
</SECTION> </SECTION>
<SECTION>
<FILE>gtkselectionfiltermodel</FILE>
<TITLE>GtkSelectionFilterModel</TITLE>
GtkSelectionFilterModel
gtk_selection_filter_model_new
gtk_selection_filter_model_new_for_type
gtk_selection_filter_model_set_model
gtk_selection_filter_model_get_model
</SECTION>

View File

@@ -19,7 +19,6 @@ gtk_assistant_get_type
gtk_assistant_page_get_type gtk_assistant_page_get_type
gtk_bin_layout_get_type gtk_bin_layout_get_type
gtk_bitset_get_type gtk_bitset_get_type
gtk_expression_get_type
gtk_bookmark_list_get_type gtk_bookmark_list_get_type
gtk_box_get_type gtk_box_get_type
gtk_box_layout_get_type gtk_box_layout_get_type
@@ -30,7 +29,6 @@ gtk_builder_list_item_factory_get_type
gtk_builder_scope_get_type gtk_builder_scope_get_type
gtk_button_get_type gtk_button_get_type
gtk_calendar_get_type gtk_calendar_get_type
gtk_cclosure_expression_get_type
gtk_cell_area_get_type gtk_cell_area_get_type
gtk_cell_area_box_get_type gtk_cell_area_box_get_type
gtk_cell_area_context_get_type gtk_cell_area_context_get_type
@@ -48,7 +46,6 @@ gtk_cell_renderer_toggle_get_type
gtk_cell_view_get_type gtk_cell_view_get_type
gtk_center_layout_get_type gtk_center_layout_get_type
gtk_check_button_get_type gtk_check_button_get_type
gtk_closure_expression_get_type
gtk_color_button_get_type gtk_color_button_get_type
gtk_color_chooser_get_type gtk_color_chooser_get_type
gtk_color_chooser_dialog_get_type gtk_color_chooser_dialog_get_type
@@ -57,7 +54,6 @@ gtk_column_view_get_type
gtk_column_view_column_get_type gtk_column_view_column_get_type
gtk_combo_box_get_type gtk_combo_box_get_type
gtk_combo_box_text_get_type gtk_combo_box_text_get_type
gtk_constant_expression_get_type
gtk_constraint_get_type gtk_constraint_get_type
gtk_constraint_guide_get_type gtk_constraint_guide_get_type
gtk_constraint_layout_get_type gtk_constraint_layout_get_type
@@ -154,7 +150,6 @@ gtk_no_selection_get_type
gtk_notebook_get_type gtk_notebook_get_type
gtk_notebook_page_get_type gtk_notebook_page_get_type
gtk_numeric_sorter_get_type gtk_numeric_sorter_get_type
gtk_object_expression_get_type
gtk_orientable_get_type gtk_orientable_get_type
gtk_overlay_get_type gtk_overlay_get_type
gtk_overlay_layout_get_type gtk_overlay_layout_get_type
@@ -177,7 +172,6 @@ gtk_print_operation_preview_get_type
gtk_print_settings_get_type gtk_print_settings_get_type
@DISABLE_ON_W32@gtk_print_unix_dialog_get_type @DISABLE_ON_W32@gtk_print_unix_dialog_get_type
gtk_progress_bar_get_type gtk_progress_bar_get_type
gtk_property_expression_get_type
gtk_radio_button_get_type gtk_radio_button_get_type
gtk_range_get_type gtk_range_get_type
gtk_recent_manager_get_type gtk_recent_manager_get_type
@@ -190,7 +184,6 @@ gtk_scrollbar_get_type
gtk_scrolled_window_get_type gtk_scrolled_window_get_type
gtk_search_bar_get_type gtk_search_bar_get_type
gtk_search_entry_get_type gtk_search_entry_get_type
gtk_selection_filter_model_get_type
gtk_selection_model_get_type gtk_selection_model_get_type
gtk_separator_get_type gtk_separator_get_type
gtk_settings_get_type gtk_settings_get_type
@@ -235,7 +228,6 @@ gtk_text_view_get_type
gtk_toggle_button_get_type gtk_toggle_button_get_type
gtk_tree_drag_dest_get_type gtk_tree_drag_dest_get_type
gtk_tree_drag_source_get_type gtk_tree_drag_source_get_type
gtk_tree_expander_get_type
gtk_tree_list_model_get_type gtk_tree_list_model_get_type
gtk_tree_list_row_get_type gtk_tree_list_row_get_type
gtk_tree_list_row_sorter_get_type gtk_tree_list_row_sorter_get_type

View File

@@ -137,41 +137,8 @@ use gtk_button_new_from_icon_name().
### Stop using GtkWidget event signals ### Stop using GtkWidget event signals
Event controllers and gestures replace event signals in GTK 4. Event controllers and #GtkGestures replace event signals in GTK 4.
They have been backported to GTK 3.x so you can prepare for this change.
Most of them have been backported to GTK 3.x so you can prepare
for this change.
| Signal | Event controller |
| --- | --- |
| ::event | #GtkEventControllerLegacy |
| ::event-after | #GtkEventControllerLegacy |
| ::button-press-event | #GtkGestureClick |
| ::button-release-event | #GtkGestureClick |
| ::touch-event | various touch gestures |
| ::scroll-event | #GtkEventControllerScroll |
| ::motion-notify-event | #GtkEventControllerMotion |
| ::delete-event | - |
| ::key-press-event | #GtkEventControllerKey |
| ::key-release-event | #GtkEventControllerKey |
| ::enter-notify-event | #GtkEventControllerMotion |
| ::leave-notify-event | #GtkEventControllerMotion |
| ::configure-event | replaced by #GdkSurface::size-changed |
| ::focus-in-event | #GtkEventControllerFocus |
| ::focus-out-event | #GtkEventControllerFocus |
| ::map-event | replaced by #GdkSurface:mapped |
| ::unmap-event | replaced by #GdkSurface:mapped |
| ::property-notify-event | replaced by #GdkClipboard |
| ::selection-clear-event | replaced by #GdkClipboard |
| ::selection-request-event | replaced by #GdkClipboard |
| ::selection-notify-event | replaced by #GdkClipboard |
| Drag-and-Drop signals | #GtkDragSource, #GtkDropTarget |
| ::proximity-in-event | #GtkGestureStylus |
| ::proximity-out-event | #GtkGestureStylus |
| ::visibility-notify-event | - |
| ::window-state-event | replaced by #GdkToplevel:state |
| ::damage-event | - |
| ::grab-broken-event | - |
### Set a proper application ID ### Set a proper application ID
@@ -203,7 +170,7 @@ in GTK 3, you can prepare for the switch by using gtk_widget_destroy()
only on toplevel windows, and replace all other uses with only on toplevel windows, and replace all other uses with
gtk_container_remove() or g_object_unref(). gtk_container_remove() or g_object_unref().
### Reduce the use of generic container APIs ### Reduce the use of generic container APIs</title>
GTK 4 removes gtk_container_add() and gtk_container_remove(). While there GTK 4 removes gtk_container_add() and gtk_container_remove(). While there
is not always a replacement for gtk_container_remove() in GTK 3, you can is not always a replacement for gtk_container_remove() in GTK 3, you can
@@ -444,7 +411,6 @@ and gtk_box_append(). You can also reorder box children as necessary.
The gtk_header_bar_set_show_close_button() function has been renamed to The gtk_header_bar_set_show_close_button() function has been renamed to
the more accurate name gtk_header_bar_set_show_title_buttons(). The the more accurate name gtk_header_bar_set_show_title_buttons(). The
corresponding getter and the property itself have also been renamed. corresponding getter and the property itself have also been renamed.
The default value of the property is now %TRUE instead of %FALSE.
The gtk_header_bar_set_custom_title() function has been renamed to The gtk_header_bar_set_custom_title() function has been renamed to
the more accurate name gtk_header_bar_set_title_widget(). The the more accurate name gtk_header_bar_set_title_widget(). The
@@ -564,26 +530,6 @@ by a layout manager (if they are layout-related), or handled in some
other way. One possibility is to use child meta objects, as seen with other way. One possibility is to use child meta objects, as seen with
GtkAssistantPage, GtkStackPage and the like. GtkAssistantPage, GtkStackPage and the like.
The replacements for gtk_container_add() are:
| Widget | Replacement |
| ------ | ----------- |
| GtkActionBar | gtk_action_bar_pack_start(), gtk_action_bar_pack_end() |
| GtkBox | gtk_box_append() |
| GtkExpander | gtk_expander_set_child() |
| GtkFixed | gtk_fixed_put() |
| GtkFlowBox | gtk_flow_box_insert() |
| GtkGrid | gtk_grid_attach() |
| GtkHeaderBar | gtk_header_bar_pack_start(), gtk_header_bar_pack_end() |
| GtkIconView | - |
| GtkInfoBar | gtk_info_bar_add_child() |
| GtkListBox | gtk_list_box_insert() |
| GtkNotebook | gtk_notebook_append_page() |
| GtkPaned | gtk_paned_set_start_child(), gtk_paned_set_end_child() |
| GtkStack | gtk_stack_add_named() |
| GtkTextView | gtk_text_view_add_child_at_anchor(), gtk_text_view_add_overlay() |
| GtkTreeView | - |
### Stop using GtkContainer::border-width ### Stop using GtkContainer::border-width
GTK 4 has removed the #GtkContainer::border-width property (together GTK 4 has removed the #GtkContainer::border-width property (together

View File

@@ -123,32 +123,6 @@ the number of listitems they create such as with gtk_grid_view_set_max_columns()
and developers running into performance problems should definitely study the and developers running into performance problems should definitely study the
tradeoffs of those and experiment with them. tradeoffs of those and experiment with them.
## Choosing the right model {#model-choosing}
GTK offers a wide variety of wrapping models which change or supplement an
existing model (or models) in some way. But when it comes to storing your
actual data, there are only a few ready-made choices available: #GListStore
and #GtkStringList.
GListStore is backed by a balanced tree and has performance characteristics
that are expected for that data structure. It works reasonably well for dataset
sizes in the 1,000,000 range, and can handle insertions and deletions. It uses
a cached iter to make linear access to the items fast.
GtkStringList is not a general store - it can only handle strings. It is
backed by an dynamically allocated array and has performance characteristics
that are expected for that data structure. GtkStringList is a good fit for any
place where you would otherwise use `char*[]` and works best if the dataset
is not very dynamic.
If these models don't fit your use case or scalability requirements, you
should make a custom #GListModel. It is a small interface and not very hard
to implement.
For asymptotic performance comparisons between tree- and array-based
implementations, see this
[article](https://en.wikipedia.org/wiki/Dynamic_array#Performance).
## Displaying trees {#displaying-trees} ## Displaying trees {#displaying-trees}
While #GtkTreeView provided built-in support for trees, the list widgets, and While #GtkTreeView provided built-in support for trees, the list widgets, and
@@ -209,7 +183,7 @@ transitioning code for easy lookup:
| #GtkTreeModel | #GListModel | | #GtkTreeModel | #GListModel |
| #GtkTreePath | #guint position, #GtkTreeListRow | | #GtkTreePath | #guint position, #GtkTreeListRow |
| #GtkTreeIter | #guint position | | #GtkTreeIter | #guint position |
| #GtkTreeRowReference | #GObject item | | GtkTreeRowReference | #GObject item |
| #GtkListStore | #GListStore | | #GtkListStore | #GListStore |
| #GtkTreeStore | #GtkTreeListModel, #GtkTreeExpander | | #GtkTreeStore | #GtkTreeListModel, #GtkTreeExpander |
| #GtkTreeSelection | #GtkSelectionModel | | #GtkTreeSelection | #GtkSelectionModel |

View File

@@ -189,7 +189,7 @@ tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data)
{ {
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeModel *model; GtkTreeModel *model;
char *author; gchar *author;
if (gtk_tree_selection_get_selected (selection, &model, &iter)) if (gtk_tree_selection_get_selected (selection, &model, &iter))
{ {

View File

@@ -141,8 +141,8 @@ take_window_shot (Window child,
XWindowAttributes attrs; XWindowAttributes attrs;
Window xid; Window xid;
Display *dpy; Display *dpy;
int x = 0, y = 0; gint x = 0, y = 0;
int width, height; gint width, height;
GdkPixbuf *tmp, *tmp2; GdkPixbuf *tmp, *tmp2;
GdkPixbuf *retval = NULL; GdkPixbuf *retval = NULL;

Some files were not shown because too many files have changed in this diff Show More