Compare commits

...

56 Commits

Author SHA1 Message Date
Nelson Benítez León bd206f3b7a Improve window size for long text tooltips
When a tooltip reaches the hardcoded limit of 50
chars it will wrap to a new line, but keeps the
window's width same as if it were just one line.

From GtkLabel docs:
"For wrapping labels, width-chars is used as the
minimum width, if specified, and max-width-chars
is used as the natural width."

So we detect for this case and set label's width-chars
property, so we set the minimum size to a lesser value.

Fixes #5521
2023-01-22 16:34:07 +00:00
Jordi Mas 8f2ad8f154 Update Catalan translation 2023-01-21 16:58:51 +01:00
Ekaterine Papava 2f894bb4ef Update Georgian translation 2023-01-20 16:04:31 +00:00
Matthias Clasen 2509fe0d17 Merge branch 'matthiasc/for-main' into 'main'
Cosmetics

See merge request GNOME/gtk!5434
2023-01-17 21:37:39 +00:00
Matthias Clasen 83a5611ce8 settings: Modernize the code
Drop some things that are no longer relevant,
and make this code look like modern GObject code.
2023-01-17 15:19:50 -05:00
Matthias Clasen af088d5e11 settings: Drop object_list
This code came from a time when we were installing
additional settings at runtime. We no longer do that,
so this code is unnecessary.
2023-01-17 08:30:37 -05:00
Matthias Clasen a6e1c5c96a modules: Cosmetics
Use g_strv_length, instead of open-coding it.
2023-01-17 07:47:28 -05:00
Matthias Clasen 3c8c54ed15 stylecascade: Avoid some allocations 2023-01-17 07:39:51 -05:00
Matthias Clasen c4d3d72c57 Merge branch 'fix-hidpi-pictures' into 'main'
picture: Fix hi-dpi image handling

See merge request GNOME/gtk!5430
2023-01-16 14:32:01 +00:00
Matthias Clasen cd79159420 picture: Fix hi-dpi image handling
The idea behind this code was to let scalable
images (i.e. mainly SVGs) provide twice as much
detail when the scale is 2. But we were also
using a scaler for pngs, causing them to be too
small on a hidpi screen. Fix that.

Note that there are cases where you want scaling
for pngs (when you display them scaled down, so
the image has 'hidden' detail). But we are not
attempting to handle that situation automatically.
2023-01-16 08:48:37 -05:00
Emin Tufan Çetin 071c6c60c0 Update Turkish translation 2023-01-15 22:47:27 +00:00
Matthias Clasen fc24f401b7 Merge branch 'matthiasc/for-main' into 'main'
Use GtkUriLauncher where appropriate

See merge request GNOME/gtk!5432
2023-01-15 18:48:22 +00:00
Matthias Clasen 6c96e51b07 Use GtkUriLauncher where appropriate
GtkLabel, GtkLinkButton and GtkAboutDialog
all have a uri, not a file, so it makes more
sense to use a GtkUriLauncher.
2023-01-15 13:26:53 -05:00
Matthias Clasen e703163bc4 Merge branch 'uri-launcher-demo' into 'main'
urilauncher: Fix finish function mismatch

See merge request GNOME/gtk!5431
2023-01-15 17:47:18 +00:00
Matthias Clasen ad549cbded gtk-demo: Add a uri launcher demo 2023-01-15 11:58:43 -05:00
Matthias Clasen 673beef210 urilauncher: Fix finish function mismatch
We need to call the finish function that
matches the async function.
2023-01-15 11:58:09 -05:00
Matthias Clasen 55baa1f2e1 Merge branch 'docs-escape-xml-tag' into 'main'
Escape GtkBuilder XML tag in comment with backtick

Closes #5312

See merge request GNOME/gtk!5429
2023-01-15 15:12:28 +00:00
sunce b13f05537b Escape GtkBuilder XML tag in comment with backtick
Escape XML tags in gi-docgen oriented comment e.g. from <child> to
`<child>`, so that they don't become HTML tag on the final webpage.
This fix includes everything from commit ff46ea64 and #5312.

Fixes #5312
2023-01-15 16:55:18 +08:00
Matthias Clasen 0834dac6ee Merge branch 'matthiasc/for-main' into 'main'
widgetfactory: Load textures in threads

See merge request GNOME/gtk!5428
2023-01-15 04:12:47 +00:00
Matthias Clasen 3c31f72219 texture: Update docs
Document that we support TIFF as well.
2023-01-14 22:48:57 -05:00
Matthias Clasen a0f63160d6 widgetfactory: Load textures in threads
It is useful to show how this is done, even
though the images here are not terribly large.
2023-01-14 22:38:20 -05:00
Matthias Clasen c99d85954a Merge branch 'nielsdg/gtkwidgetactionactivatefunc-nullable-variant' into 'main'
Add missing nullable to GtkWidgetActionActivateFunc

See merge request GNOME/gtk!5424
2023-01-15 00:46:11 +00:00
Matthias Clasen 33f31d06f9 Merge branch 'uri-launcher' into 'main'
filelauncher: Plug a memory leak

See merge request GNOME/gtk!5425
2023-01-14 22:59:01 +00:00
Matthias Clasen bf4b40f17e docs: Update deprecations for gtk_show_uri
We have a better replacement now.
2023-01-14 17:39:28 -05:00
Matthias Clasen 7aba9e3295 urilauncher: Add cross-references to the docs 2023-01-14 17:39:28 -05:00
Matthias Clasen 3080cb7acd Add GtkUriLauncher 2023-01-14 17:39:28 -05:00
Matthias Clasen 4b404f0dea Add g_openuri_portal_open_uri_async
This avoids a roundtrip through GFile and
thus works with random uri schemes.
2023-01-14 14:32:51 -05:00
Matthias Clasen 0c1c0524c7 openuri: Some reshuffling
This is in preparation of adding a method
that takes a uri instead of a GFile.
2023-01-14 14:32:51 -05:00
Matthias Clasen b58ef290dc filelauncher: Plug a memory leak
Oops
2023-01-14 14:32:51 -05:00
Niels De Graef 1387fba7f8 Add missing nullable to GtkWidgetActionActivateFunc
The `GVariant` that is passed on to the `GtkWidgetActionActivateFunc`
can be `NULL` in case the parameter type is also `NULL`, so mark it
nullable.
2023-01-14 15:30:15 +01:00
Matthias Clasen 34b9ec5be2 Merge branch 'matthiasc/for-main' into 'main'
Fix a compiler warning

See merge request GNOME/gtk!5423
2023-01-14 05:30:10 +00:00
Matthias Clasen cefdfbd894 icontheme: Streamline the suffix handling code 2023-01-14 00:14:43 -05:00
Matthias Clasen 3676ddbdff icontheme: Avoid some allocations
When loading icon themes, we can reuse memory
instead of allocating and freeing in a loop.
2023-01-14 00:14:43 -05:00
Matthias Clasen 7c1a0e0c15 icontheme: Keep a single string set
Instead of keeping a GtkStringSet per IconTheme,
just make one for the whole GtkIconTheme.

This avoids loops of the themes in some places, and
due to the overlap in icon names between the themes,
it reduces the amount of memory we use for the icon
names with Adwaita+hicolor from 5+4 chunks to 6 chunks.
2023-01-14 00:14:43 -05:00
Matthias Clasen 19bb043a85 testsuite: Fix various compiler warnings
These are mostly dead stores that clang
isn't happy with.
2023-01-14 00:14:43 -05:00
Matthias Clasen fecc80b59c Fix a compiler warning
Clang things that timings can be NULL here,
and I think it might be right.
2023-01-14 00:14:41 -05:00
Matthias Clasen 1648dc36f8 Merge branch 'wip/corey/fix-docs' into 'main'
docs: Fix dependency names

See merge request GNOME/gtk!5422
2023-01-14 04:23:34 +00:00
Matthias Clasen a27a2cbf40 Merge branch 'matthiasc/for-main' into 'main'
Silence a compiler warning

See merge request GNOME/gtk!5421
2023-01-14 00:18:50 +00:00
Corey Berla e418656a04 docs: Fix dependency names
When gi-docgen added the "related" key, it also began checking
that the dependencies were actually dependencies otherwise they aren't
listed as dependencies.  The capitalization needs to match the
namespace.
2023-01-13 14:24:33 -08:00
Matthias Clasen d4ec1afe44 Merge branch 'fix-spinner-stop' into 'main'
gtkcssanimatedstyle: Fix return of new_advance()

Closes #4426

See merge request GNOME/gtk!5420
2023-01-13 20:14:25 +00:00
Matteo Percivaldi 374d97008b gtkcssanimatedstyle: Fix return of new_advance()
This was causing animation and transition to stop randomly and reset
their state to initial state.

This issue has existed since commit
7b68bdb831.

Closes #4426
2023-01-13 18:08:56 +01:00
Matthias Clasen fecc923c2c Silence compiler warnings
Clang complains that these are dead stores.
They are, indeed.
2023-01-13 12:07:40 -05:00
Matthias Clasen 703ed608c0 Fix a compiler warning
Clang things that load_error might be NULL here.
It may be right.
2023-01-13 12:07:40 -05:00
Matthias Clasen 99f07c7c0a Fix a compiler warning
Clang things that timings can be NULL here,
and I think it might be right.
2023-01-13 12:07:40 -05:00
Matthias Clasen 51b4d70b8f gridview: Add a few assertions
Just to help static analysis out.

self->n_columns can't ever be 0, since
we clamp it between min_columns and
max_columns, with min_columns always
being at least one.
2023-01-13 12:07:40 -05:00
Matthias Clasen 746d12fc43 Silence a compiler warning
Clang was complaining that we never use the
value stored in mime_type. Just don't store it,
we are only interested in the side-effect
(interning the string).
2023-01-13 12:07:40 -05:00
Matthias Clasen 96ce9e10b8 Merge branch 'faster-ci' into 'main'
Add a build-testsuite option

See merge request GNOME/gtk!5419
2023-01-13 12:57:15 +00:00
Matthias Clasen 3090795351 ci: Try to speed up builds a bit
Don't build demos and tests, and only build
the testsuite where we want to run it.
2023-01-13 07:26:41 -05:00
Matthias Clasen 815b54f3df Update the build documentation 2023-01-13 07:15:15 -05:00
Matthias Clasen 9ad27e4371 Add a build-testsuite option
This will let us run the testsuite in ci without
having to build all the manual tests.
2023-01-13 07:14:33 -05:00
Matthias Clasen a6e1804474 Merge branch 'macos-werror' into 'main'
CI: turn on -Werror for MacOS build

See merge request GNOME/gtk!5418
2023-01-13 03:08:36 +00:00
Benjamin Otte 7ae549e253 CI: turn on -Werror for MacOS build
The build is error-free and we want to keep it that way.

We'd also like to make Timm do real work instead of having to fix clang
warnings all the time and this build is a clang build.
2023-01-12 20:12:37 -05:00
Matthias Clasen 434d8ef0ea Merge branch 'wip/chergert/fix-macos-warnings' into 'main'
Fixes a few compilation warnings on macOS

See merge request GNOME/gtk!5415
2023-01-13 00:10:48 +00:00
Christian Hergert 958ecf2855 gdk/macos: fix warning about _coreCursorType 2023-01-12 13:22:47 -08:00
Christian Hergert fb12ad807a gsk/gl: fix warning when join_sources() is unused 2023-01-12 13:22:25 -08:00
Christian Hergert 965c52d369 gdk: fix warning when !HAVE_EGL 2023-01-12 13:22:02 -08:00
66 changed files with 2778 additions and 2314 deletions
+10 -2
View File
@@ -24,7 +24,7 @@ stages:
variables:
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v40"
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
@@ -206,7 +206,7 @@ macos:
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
script:
- meson setup
- meson setup ${COMMON_MESON_FLAGS}
-Dx11-backend=false
-Dbroadway-backend=true
-Dmacos-backend=true
@@ -215,6 +215,10 @@ macos:
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
-Ddemos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dbuild-testsuite=false
_build
- meson compile -C _build
artifacts:
@@ -387,6 +391,10 @@ reference:
-Dgtk_doc=true
-Dgdk-pixbuf:gtk_doc=true
-Dpango:gtk_doc=true
-Ddemos=false
-Dbuild-examples=false
-Dbuild-tests=false
-Dbuild-testsuite=false
_build
- meson compile -C _build
- mkdir -p _reference/
+54 -22
View File
@@ -1,11 +1,11 @@
/* Pickers
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog
/* Pickers and Launchers
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog, GtkFileLauncher, GtkUriLauncher
*
* These widgets are mainly intended for use in preference dialogs.
* The dialogs are mainly intended for use in preference dialogs.
* They allow to select colors, fonts and applications.
*
* This demo shows both the default appearance for these dialogs,
* as well as some of the customizations that are possible.
* The launchers let you open files or URIs in applications that
* can handle them.
*/
#include <gtk/gtk.h>
@@ -73,9 +73,9 @@ open_file (GtkButton *picker,
}
static void
launch_done (GObject *source,
GAsyncResult *result,
gpointer data)
open_app_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkFileLauncher *launcher = GTK_FILE_LAUNCHER (source);
GError *error = NULL;
@@ -97,7 +97,35 @@ open_app (GtkButton *picker)
file = G_FILE (g_object_get_data (G_OBJECT (picker), "file"));
launcher = gtk_file_launcher_new (file);
gtk_file_launcher_launch (launcher, parent, NULL, launch_done, NULL);
gtk_file_launcher_launch (launcher, parent, NULL, open_app_done, NULL);
g_object_unref (launcher);
}
static void
open_uri_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkUriLauncher *launcher = GTK_URI_LAUNCHER (source);
GError *error = NULL;
if (!gtk_uri_launcher_launch_finish (launcher, result, &error))
{
g_print ("%s\n", error->message);
g_error_free (error);
}
}
static void
launch_uri (GtkButton *picker)
{
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (picker)));
GtkUriLauncher *launcher;
launcher = gtk_uri_launcher_new ("http://www.gtk.org");
gtk_uri_launcher_launch (launcher, parent, NULL, open_uri_done, NULL);
g_object_unref (launcher);
}
@@ -113,7 +141,7 @@ do_pickers (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Pickers");
gtk_window_set_title (GTK_WINDOW (window), "Pickers and Launchers");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
table = gtk_grid_new ();
@@ -121,8 +149,8 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_set_margin_end (table, 20);
gtk_widget_set_margin_top (table, 20);
gtk_widget_set_margin_bottom (table, 20);
gtk_grid_set_row_spacing (GTK_GRID (table), 3);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_grid_set_row_spacing (GTK_GRID (table), 6);
gtk_grid_set_column_spacing (GTK_GRID (table), 6);
gtk_window_set_child (GTK_WINDOW (window), table);
label = gtk_label_new ("Color:");
@@ -149,7 +177,7 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
button = gtk_button_new_from_icon_name ("document-open-symbolic");
label = gtk_label_new ("None");
gtk_label_set_xalign (GTK_LABEL (label), 0.);
@@ -158,19 +186,23 @@ do_pickers (GtkWidget *do_widget)
g_signal_connect (button, "clicked", G_CALLBACK (open_file), label);
gtk_box_append (GTK_BOX (picker), label);
gtk_box_append (GTK_BOX (picker), button);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
label = gtk_label_new ("Application:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 4, 1, 1);
app_picker = gtk_button_new_from_icon_name ("emblem-system-symbolic");
gtk_widget_set_halign (app_picker, GTK_ALIGN_END);
gtk_widget_set_sensitive (app_picker, FALSE);
g_signal_connect (app_picker, "clicked", G_CALLBACK (open_app), NULL);
gtk_grid_attach (GTK_GRID (table), app_picker, 1, 4, 1, 1);
gtk_box_append (GTK_BOX (picker), app_picker);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
label = gtk_label_new ("URI:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
picker = gtk_button_new_with_label ("www.gtk.org");
g_signal_connect (picker, "clicked", G_CALLBACK (launch_uri), NULL);
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
}
if (!gtk_widget_get_visible (window))
+68
View File
@@ -2056,6 +2056,67 @@ hide_widget (GtkWidget *widget)
gtk_widget_set_visible (widget, FALSE);
}
static void
load_texture_thread (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
const char *resource_path = (const char *) task_data;
GBytes *bytes;
GdkTexture *texture;
GError *error = NULL;
bytes = g_resources_lookup_data (resource_path, 0, &error);
if (!bytes)
{
g_task_return_error (task, error);
return;
}
texture = gdk_texture_new_from_bytes (bytes, &error);
g_bytes_unref (bytes);
if (!texture)
{
g_task_return_error (task, error);
return;
}
g_task_return_pointer (task, texture, g_object_unref);
}
static void
load_texture_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkWidget *picture = GTK_WIDGET (source);
GdkTexture *texture;
GError *error = NULL;
texture = g_task_propagate_pointer (G_TASK (result), &error);
if (!texture)
{
g_warning ("%s", error->message);
g_error_free (error);
return;
}
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
static void
load_texture_in_thread (GtkWidget *picture,
const char *resource_path)
{
GTask *task = g_task_new (picture, NULL, load_texture_done, NULL);
g_task_set_task_data (task, (gpointer)resource_path, NULL);
g_task_run_in_thread (task, load_texture_thread);
g_object_unref (task);
}
static void
activate (GApplication *app)
{
@@ -2155,6 +2216,13 @@ activate (GApplication *app)
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
load_texture_in_thread ((GtkWidget *)gtk_builder_get_object (builder, "notebook_sunset"),
"/org/gtk/WidgetFactory4/sunset.jpg");
load_texture_in_thread ((GtkWidget *)gtk_builder_get_object (builder, "notebook_nyc"),
"/org/gtk/WidgetFactory4/nyc.jpg");
load_texture_in_thread ((GtkWidget *)gtk_builder_get_object (builder, "notebook_beach"),
"/org/gtk/WidgetFactory4/beach.jpg");
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
+3 -6
View File
@@ -1263,8 +1263,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
<object class="GtkPicture" id="notebook_sunset">
<property name="content-fit">cover</property>
<child>
<object class="GtkDragSource">
@@ -1290,8 +1289,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/nyc.jpg</property>
<object class="GtkPicture" id="notebook_nyc">
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
@@ -1316,8 +1314,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/beach.jpg</property>
<object class="GtkPicture" id="notebook_beach">
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
+2 -2
View File
@@ -18,12 +18,12 @@ search_index = true
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."Gio-2.0"]
name = "GIO"
name = "Gio"
description = "GObject Interfaces and Objects, Networking, IPC, and I/O"
docs_url = "https://docs.gtk.org/gio/"
[dependencies."cairo-1.0"]
name = "Cairo"
name = "cairo"
description = "A 2D graphics library with support for multiple output devices"
docs_url = "https://www.cairographics.org/manual/"
+1 -1
View File
@@ -19,7 +19,7 @@ dependencies = ["Graphene-1.0", "Gdk-4.0"]
docs_url = "https://ebassi.github.io/graphene/docs/"
[dependencies."Gdk-4.0"]
name = "GDK"
name = "Gdk"
description = "The GTK windowing system abstraction"
docs_url = "https://docs.gtk.org/gdk4/"
+16 -22
View File
@@ -236,23 +236,17 @@ By default, GTK will try to build with support for the Vulkan graphics
API in addition to cairo and OpenGL. This option can be used to explicitly
control whether Vulkan should be used.
### `xinerama`
By default, GTK will try to link against the Xinerama libraries
if they are found. This option can be used to explicitly control
whether Xinerama should be used.
### `media`
### `media-gstreamer` and `media-ffmpeg`
By default, GTK will try to build the gstreamer backend for
media playback support. This option can be used to explicitly
media playback support. These option can be used to explicitly
control which media backends should be built.
### `print`
### `print-cups`
By default, GTK will try to build various print backends
if their dependencies are found. This option can be used
to explicitly control which print backends should be built.
to explicitly control whether the cups print backend should be built.
### `cloudproviders`
@@ -274,18 +268,13 @@ support in the file chooser.
This option controls whether GTK should use colord for color
calibration support in the cups print backend.
### `gtk_doc` and `man-pages`
### `gtk_doc`, `man-pages` and `update_screenshots`
The *gtk-doc* package is used to generate the reference documentation
included with GTK. By default support for *gtk-doc* is disabled
The *gi-docgen* package is used to generate the reference documentation
included with GTK. By default support for *gi-docgen* is disabled
because it requires various extra dependencies to be installed.
If you have *gtk-doc* and *pandoc* installed and are modifying GTK,
you may want to enable *gtk-doc* support by passing in `-Dgtk_doc=true`.
Additionally, some tools provided by GTK have their own
manual pages generated using a similar set of dependencies;
if you have *xsltproc* then you can generate manual pages by
passing `-Dman-pages=true` when configuring the build.
Introspection needs to be enabled, since the documentation is generated
from introspection data.
### `introspection`
@@ -294,9 +283,14 @@ is mainly useful for shortening turnaround times on developer
systems. Installed builds of GTK should always have introspection
support.
### `build-tests`, `demos`
### `build-testsuite`
By default, GTK will build quite a few tests and demos.
If you want to run the testsuite to ensure that your GTK build
works, you should enable it with this option.
### `build-tests`, `build-examples`, `demos`
By default, GTK will build quite a few tests, examples and demos.
While these are useful on a developer system, they are not
needed when GTK is built e.g. for a flatpak runtime. These
options allow to disable building tests and demos.
+2 -2
View File
@@ -14,12 +14,12 @@ search_index = true
dependencies = ["Gdk-4.0", "Gsk-4.0"]
[dependencies."Gdk-4.0"]
name = "GDK"
name = "Gdk"
description = "The GTK windowing system abstraction"
docs_url = "https://docs.gtk.org/gdk4/"
[dependencies."Gsk-4.0"]
name = "GSK"
name = "Gsk"
description = "The GTK rendering abstraction"
docs_url = "https://docs.gtk.org/gsk4/"
+4
View File
@@ -105,3 +105,7 @@ retire it. If you need such a widget, it is relatively trivial to create one
using a [class@Gtk.Revealer] with labels and buttons.
Other libraries, such as libadwaita, may provide replacements as well.
## gtk_show_uri is being replaced
Instead of gtk_show_uri(), you should use GtkUriLauncher or GtkFileLauncher.
+1 -1
View File
@@ -1777,11 +1777,11 @@ gdk_display_init_egl (GdkDisplay *self,
gpointer
gdk_display_get_egl_display (GdkDisplay *self)
{
#ifdef HAVE_EGL
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
#ifdef HAVE_EGL
if (!priv->egl_display &&
!gdk_display_prepare_gl (self, NULL))
return NULL;
+5 -2
View File
@@ -621,8 +621,11 @@ gdk_frame_clock_paint_idle (void *data)
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
}
#ifdef G_ENABLE_DEBUG
if (GDK_DEBUG_CHECK (FRAMES))
timings->frame_end_time = g_get_monotonic_time ();
if (GDK_DEBUG_CHECK (FRAMES))
{
if (timings)
timings->frame_end_time = g_get_monotonic_time ();
}
#endif /* G_ENABLE_DEBUG */
G_GNUC_FALLTHROUGH;
+3 -3
View File
@@ -463,7 +463,7 @@ gdk_texture_new_from_resource (const char *resource_path)
* Creates a new texture by loading an image from a file.
*
* The file format is detected automatically. The supported formats
* are PNG and JPEG, though more formats might be available.
* are PNG, JPEG and TIFF, though more formats might be available.
*
* If %NULL is returned, then @error will be set.
*
@@ -556,7 +556,7 @@ gdk_texture_new_from_bytes_pixbuf (GBytes *bytes,
* Creates a new texture by loading an image from memory,
*
* The file format is detected automatically. The supported formats
* are PNG and JPEG, though more formats might be available.
* are PNG, JPEG and TIFF, though more formats might be available.
*
* If %NULL is returned, then @error will be set.
*
@@ -602,7 +602,7 @@ gdk_texture_new_from_bytes (GBytes *bytes,
* Creates a new texture by loading an image from a file.
*
* The file format is detected automatically. The supported formats
* are PNG and JPEG, though more formats might be available.
* are PNG, JPEG and TIFF, though more formats might be available.
*
* If %NULL is returned, then @error will be set.
*
+4
View File
@@ -23,6 +23,10 @@
#include "gdkmacoscursor-private.h"
@interface NSCursor()
-(long long)_coreCursorType;
@end
/* OS X only exports a number of cursor types in its public NSCursor interface.
* By overriding the private _coreCursorType method, we can tell OS X to load
* one of its internal cursors instead (since cursor images are loaded on demand
+1 -1
View File
@@ -982,7 +982,7 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display,
GOutputStream *stream;
if (special_targets[i].mime_type)
mime_type = gdk_intern_mime_type (special_targets[i].mime_type);
gdk_intern_mime_type (special_targets[i].mime_type);
stream = gdk_x11_selection_output_stream_new (display,
notify,
requestor,
+1 -1
View File
@@ -184,7 +184,7 @@ gsk_gl_driver_shader_weak_cb (gpointer data,
}
}
G_GNUC_NULL_TERMINATED static inline GBytes *
G_GNUC_UNUSED G_GNUC_NULL_TERMINATED static inline GBytes *
join_sources (GBytes *first_bytes,
...)
{
+1 -1
View File
@@ -962,7 +962,7 @@ gtk_css_parser_parse_url_arg (GtkCssParser *parser,
* gtk_css_parser_consume_url:
* @self: a `GtkCssParser`
*
* If the parser matches the <url> token from the [CSS
* If the parser matches the `<url>` token from the [CSS
* specification](https://drafts.csswg.org/css-values-4/#url-value),
* consumes it, resolves the URL and returns the resulting `GFile`.
* On failure, an error is emitted and %NULL is returned.
+2 -2
View File
@@ -59,8 +59,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* ## GtkComboBoxText as GtkBuildable
*
* The `GtkComboBoxText` implementation of the `GtkBuildable` interface supports
* adding items directly using the <items> element and specifying <item>
* elements for each item. Each <item> element can specify the “id”
* adding items directly using the `<items>` element and specifying `<item>`
* elements for each item. Each `<item>` element can specify the “id”
* corresponding to the appended text and also supports the regular
* translation attributes “translatable”, “context” and “comments”.
*
+6 -3
View File
@@ -99,7 +99,8 @@ window_handle_exported (GtkWindow *window,
* This is the recommended call to be used as it passes information
* necessary for sandbox helpers to parent their dialogs properly.
*
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] or
* [method@Gtk.UriLauncher.launch] instead
*/
void
gtk_show_uri_full (GtkWindow *parent,
@@ -147,7 +148,8 @@ gtk_show_uri_full (GtkWindow *parent,
* Returns: %TRUE if the URI was shown successfully.
* Otherwise, %FALSE is returned and @error is set
*
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch_finish] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch_finish] or
* [method@Gtk.UriLauncher.launch_finish] instead
*/
gboolean
gtk_show_uri_full_finish (GtkWindow *parent,
@@ -191,7 +193,8 @@ show_uri_done (GObject *object,
* This function launches the default application for showing
* a given uri, or shows an error dialog if that fails.
*
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] or
* [method@Gtk.UriLauncher.launch] instead
*/
void
gtk_show_uri (GtkWindow *parent,
+2 -2
View File
@@ -47,8 +47,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* ## GtkTreeStore as GtkBuildable
*
* The GtkTreeStore implementation of the `GtkBuildable` interface allows
* to specify the model columns with a <columns> element that may contain
* multiple <column> elements, each specifying one model column. The “type”
* to specify the model columns with a `<columns>` element that may contain
* multiple `<column>` elements, each specifying one model column. The “type”
* attribute specifies the data type for the column.
*
* An example of a UI Definition fragment for a tree store:
+10 -8
View File
@@ -587,10 +587,12 @@ gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
if (gdk_texture_can_load (bytes))
{
/* We know these formats can't be scaled */
texture = gdk_texture_new_from_bytes (bytes, NULL);
if (texture == NULL)
return NULL;
/* We know these formats can't be scaled */
paintable = GDK_PAINTABLE (texture);
}
else
{
@@ -610,15 +612,15 @@ gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
g_object_unref (loader);
if (loader_data.scale_factor != 1)
paintable = gtk_scaler_new (GDK_PAINTABLE (texture), loader_data.scale_factor);
else
paintable = g_object_ref (GDK_PAINTABLE (texture));
g_object_unref (texture);
}
if (loader_data.scale_factor != 1)
paintable = gtk_scaler_new (GDK_PAINTABLE (texture), loader_data.scale_factor);
else
paintable = g_object_ref ((GdkPaintable *)texture);
g_object_unref (texture);
return paintable;
}
+55 -11
View File
@@ -103,6 +103,7 @@ enum {
typedef struct {
GtkWindow *parent;
GFile *file;
char *uri;
gboolean open_folder;
GDBusConnection *connection;
GCancellable *cancellable;
@@ -125,6 +126,7 @@ open_uri_data_free (OpenUriData *data)
gtk_window_unexport_handle (data->parent);
g_clear_object (&data->parent);
g_clear_object (&data->file);
g_free (data->uri);
g_clear_object (&data->cancellable);
g_clear_object (&data->task);
g_free (data->handle);
@@ -258,14 +260,13 @@ canceled (GCancellable *cancellable,
}
static void
open_uri (GFile *file,
gboolean open_folder,
open_uri (OpenUriData *data,
const char *parent_window,
const char *activation_token,
GAsyncReadyCallback callback,
gpointer user_data)
GAsyncReadyCallback callback)
{
OpenUriData *data = user_data;
GFile *file = data->file;
gboolean open_folder = data->open_folder;
GTask *task;
GVariant *opts = NULL;
int i;
@@ -277,9 +278,9 @@ open_uri (GFile *file,
connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (openuri));
data->connection = g_object_ref (connection);
task = g_task_new (NULL, NULL, callback, user_data);
task = g_task_new (NULL, NULL, callback, data);
g_task_set_check_cancellable (task, FALSE);
g_task_set_task_data (task, user_data, NULL);
g_task_set_task_data (task, data, NULL);
if (data->cancellable)
data->cancel_handler = g_signal_connect (data->cancellable, "cancelled", G_CALLBACK (canceled), task);
@@ -312,7 +313,7 @@ open_uri (GFile *file,
opts = g_variant_builder_end (&opt_builder);
if (g_file_is_native (file))
if (file && g_file_is_native (file))
{
const char *path = NULL;
GUnixFDList *fd_list = NULL;
@@ -366,12 +367,15 @@ open_uri (GFile *file,
}
else
{
char *uri = g_file_get_uri (file);
char *uri = NULL;
if (file)
uri = g_file_get_uri (file);
data->call = OPEN_URI;
gxdp_open_uri_call_open_uri (openuri,
parent_window ? parent_window : "",
uri,
uri ? uri : data->uri,
opts,
NULL,
open_call_done,
@@ -431,7 +435,7 @@ window_handle_exported (GtkWindow *window,
activation_token = G_APP_LAUNCH_CONTEXT_GET_CLASS (context)->get_startup_notify_id (context, NULL, NULL);
g_object_unref (context);
open_uri (data->file, data->open_folder, handle, activation_token, open_uri_done, data);
open_uri (data, handle, activation_token, open_uri_done);
g_free (activation_token);
}
@@ -471,5 +475,45 @@ gboolean
g_openuri_portal_open_finish (GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == g_openuri_portal_open_async, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
void
g_openuri_portal_open_uri_async (const char *uri,
GtkWindow *parent,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
OpenUriData *data;
if (!init_openuri_portal ())
{
g_task_report_new_error (NULL, callback, user_data, NULL,
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
"The OpenURI portal is not available");
return;
}
data = g_new0 (OpenUriData, 1);
data->parent = parent ? g_object_ref (parent) : NULL;
data->uri = g_strdup (uri);
data->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
data->task = g_task_new (parent, cancellable, callback, user_data);
g_task_set_check_cancellable (data->task, FALSE);
g_task_set_source_tag (data->task, g_openuri_portal_open_uri_async);
if (!parent || !gtk_window_export_handle (parent, window_handle_exported, data))
window_handle_exported (parent, NULL, data);
}
gboolean
g_openuri_portal_open_uri_finish (GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == g_openuri_portal_open_uri_async, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
+9
View File
@@ -38,6 +38,15 @@ void g_openuri_portal_open_async (GFile *file,
gboolean g_openuri_portal_open_finish (GAsyncResult *result,
GError **error);
void g_openuri_portal_open_uri_async (const char *uri,
GtkWindow *window,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_openuri_portal_open_uri_finish (GAsyncResult *result,
GError **error);
G_END_DECLS
#endif
+1
View File
@@ -286,6 +286,7 @@
#include <gtk/deprecated/gtktreeviewcolumn.h>
#include <gtk/gtktypebuiltins.h>
#include <gtk/gtktypes.h>
#include <gtk/gtkurilauncher.h>
#include <gtk/gtkversion.h>
#include <gtk/gtkvideo.h>
#include <gtk/gtkviewport.h>
+4 -7
View File
@@ -44,13 +44,13 @@
#include "gtkorientable.h"
#include "gtkscrolledwindow.h"
#include "gtktextview.h"
#include "gtkfilelauncher.h"
#include "gtkmain.h"
#include "gtktogglebutton.h"
#include "gtktypebuiltins.h"
#include "gtkstack.h"
#include "gtkstackswitcher.h"
#include "gtksettings.h"
#include "gtkurilauncher.h"
#include "gtkheaderbar.h"
#include "gtkprivate.h"
#include <glib/gi18n-lib.h>
@@ -932,16 +932,13 @@ static gboolean
gtk_about_dialog_activate_link (GtkAboutDialog *about,
const char *uri)
{
GtkFileLauncher *launcher;
GFile *file;
GtkUriLauncher *launcher;
file = g_file_new_for_uri (uri);
launcher = gtk_file_launcher_new (file);
launcher = gtk_uri_launcher_new (uri);
gtk_file_launcher_launch (launcher, GTK_WINDOW (about), NULL, NULL, NULL);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (about), NULL, NULL, NULL);
g_object_unref (launcher);
g_object_unref (file);
return TRUE;
}
+2 -2
View File
@@ -80,7 +80,7 @@ gtk_buildable_set_buildable_id (GtkBuildable *buildable,
* Gets the ID of the @buildable object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the <object> tag used to construct the @buildable.
* of the `<object>` tag used to construct the @buildable.
*
* Returns: (nullable): the ID of the buildable object
**/
@@ -193,7 +193,7 @@ gtk_buildable_construct_child (GtkBuildable *buildable,
* @data: (out): return location for user data that will be passed in
* to parser functions
*
* This is called for each unknown element under <child>.
* This is called for each unknown element under `<child>`.
*
* Returns: %TRUE if an object has a custom implementation, %FALSE
* if it doesn't.
+3 -3
View File
@@ -109,14 +109,14 @@ struct _GtkBuildableParser
* interface is created.
* @construct_child: Constructs a child of a buildable that has been
* specified as constructor in the UI definition. This can be used to
* reference a widget created in a <ui> tag which is outside
* reference a widget created in a `<ui>` tag which is outside
* of the normal GtkBuilder UI definition hierarchy. A reference to the
* constructed object is returned and becomes owned by the caller.
* @custom_tag_start: Implement this if the buildable needs to parse
* content below <child>. To handle an element, the implementation
* content below `<child>`. To handle an element, the implementation
* must fill in the @parser and @user_data and return %TRUE.
* `GtkWidget` implements this to parse accessible attributes specified
* in <accessibility> elements.
* in `<accessibility>` elements.
* Note that @user_data must be freed in @custom_tag_end or @custom_finished.
* @custom_tag_end: Called for the end tag of each custom element that is
* handled by the buildable (see @custom_tag_start).
+2 -2
View File
@@ -192,9 +192,9 @@
*
* Beyond this general structure, several object classes define their
* own XML DTD fragments for filling in the ANY placeholders in the DTD
* above. Note that a custom element in a <child> element gets parsed by
* above. Note that a custom element in a `<child>` element gets parsed by
* the custom tag handler of the parent object, while a custom element in
* an <object> element gets parsed by the custom tag handler of the object.
* an `<object>` element gets parsed by the custom tag handler of the object.
*
* These XML fragments are explained in the documentation of the
* respective objects.
+1 -1
View File
@@ -57,7 +57,7 @@ typedef enum { /*< prefix=GTK_BUILDER_CLOSURE >*/
* correct function name for registering the type and then use dlsym() to load it.
* The default implementation just tries g_type_from_name() and otherwise fails.
* @get_type_from_function: Try to lookup a `GType` via the given function name, specified
* explicitly in a GtkBuilder file, like via the "type-func" attribute in the "<object>" tag.
* explicitly in a GtkBuilder file, like via the "type-func" attribute in the `<object>` tag.
* This function is very rarely used.
* The C implementation will use dlsym() and call the resulting function as a `GTypeFunc`.
* The default implementation will fail and just return %G_TYPE_INVALID.
+1 -1
View File
@@ -37,7 +37,7 @@
*
* The `GtkCenterBox` implementation of the `GtkBuildable` interface
* supports placing children in the 3 positions by specifying start, center
* or end as the type attribute of a <child> element.
* or end as the type attribute of a `<child>` element.
*
* # CSS nodes
*
-2
View File
@@ -1325,9 +1325,7 @@ gtk_compose_table_check (const GtkComposeTable *table,
if (n_compose == 1)
return TRUE;
seq = NULL;
match = FALSE;
value = 0;
for (i = n_compose - 1; i < table->max_seq_len; i++)
{
+4 -1
View File
@@ -937,9 +937,12 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (source), NULL);
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base_style), NULL);
if (timestamp == 0 || timestamp == source->current_time)
if (timestamp == 0)
return g_object_ref (source->style);
if (timestamp == source->current_time)
return g_object_ref (GTK_CSS_STYLE (source));
gtk_internal_return_val_if_fail (timestamp > source->current_time, NULL);
animations = NULL;
+2 -2
View File
@@ -135,8 +135,8 @@
* # GtkEntry as GtkBuildable
*
* The `GtkEntry` implementation of the `GtkBuildable` interface supports a
* custom <attributes> element, which supports any number of <attribute>
* elements. The <attribute> element has attributes named name, value,
* custom `<attributes>` element, which supports any number of `<attribute>`
* elements. The `<attribute>` element has attributes named name, value,
* start and end and allows you to specify `PangoAttribute` values for
* this label.
*
+2 -2
View File
@@ -79,8 +79,8 @@
*
* The `GtkExpander` implementation of the `GtkBuildable` interface supports
* placing a child in the label position by specifying label as the
* type attribute of a <child> element. A normal content child can be
* specified without specifying a <child> type attribute.
* type attribute of a `<child>` element. A normal content child can be
* specified without specifying a `<child>` type attribute.
*
* An example of a UI definition fragment with GtkExpander:
*
+7 -3
View File
@@ -29,8 +29,8 @@
/**
* GtkFileLauncher:
*
* A `GtkFileLauncher` object collects the arguments that are needed to open a uri
* with an application.
* A `GtkFileLauncher` object collects the arguments that are needed to open a
* file with an application.
*
* Depending on system configuration, user preferences and available APIs, this
* may or may not show an app chooser dialog or launch the default application
@@ -40,6 +40,8 @@
* This API follows the GIO async pattern, and the result can be obtained by
* calling [method@Gtk.FileLauncher.launch_finish].
*
* To launch uris that don't represent files, use [class@Gtk.UriLauncher].
*
* Since: 4.10
*/
@@ -70,7 +72,9 @@ gtk_file_launcher_init (GtkFileLauncher *self)
static void
gtk_file_launcher_finalize (GObject *object)
{
//GtkFileLauncher *self = GTK_FILE_LAUNCHER (object);
GtkFileLauncher *self = GTK_FILE_LAUNCHER (object);
g_clear_object (&self->file);
G_OBJECT_CLASS (gtk_file_launcher_parent_class)->finalize (object);
}
+2 -2
View File
@@ -51,8 +51,8 @@
*
* The `GtkFrame` implementation of the `GtkBuildable` interface supports
* placing a child in the label position by specifying label as the
* type attribute of a <child> element. A normal content child can
* be specified without specifying a <child> type attribute.
* type attribute of a `<child>` element. A normal content child can
* be specified without specifying a `<child>` type attribute.
*
* An example of a UI definition fragment with GtkFrame:
* ```xml
+4
View File
@@ -627,6 +627,8 @@ gtk_grid_view_compute_n_columns (GtkGridView *self,
n_columns = CLAMP (n_columns, self->min_columns, self->max_columns);
g_assert (n_columns > 0);
return n_columns;
}
@@ -869,6 +871,8 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
i = 0;
row_height = 0;
g_assert (self->n_columns > 0);
for (cell = gtk_list_item_manager_get_first (self->item_manager);
cell != NULL;
cell = gtk_rb_tree_node_get_next (cell))
+1 -1
View File
@@ -61,7 +61,7 @@
*
* The `GtkHeaderBar` implementation of the `GtkBuildable` interface supports
* adding children at the start or end sides by specifying start or end as
* the type attribute of a <child> element, or setting the title widget by
* the type attribute of a `<child>` element, or setting the title widget by
* specifying title value.
*
* By default the `GtkHeaderBar` uses a `GtkLabel` displaying the title of the
+101 -101
View File
@@ -130,10 +130,35 @@ struct _GtkStringSet {
int used_in_chunk;
};
#ifdef G_ENABLE_DEBUG
static void
dump_string_set (GtkStringSet *set)
{
GtkStringSetChunk *chunk = set->chunks;
unsigned int n_chunks = 0;
GHashTableIter iter;
gpointer key;
while (chunk)
{
n_chunks++;
chunk = chunk->next;
}
g_print ("%u strings, %u chunks\n", g_hash_table_size (set->hash), n_chunks);
g_hash_table_iter_init (&iter, set->hash);
while (g_hash_table_iter_next (&iter, &key, NULL))
{
char *string = key;
g_print ("%s\n", string);
}
}
#endif
static void
gtk_string_set_init (GtkStringSet *set)
{
set->hash = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
set->hash = g_hash_table_new (g_str_hash, g_str_equal);
set->chunks = NULL;
set->used_in_chunk = STRING_SET_CHUNK_SIZE; /* To trigger a grow directly */
}
@@ -306,6 +331,8 @@ struct _GtkIconTheme
GtkIconPaintable *lru_cache[LRU_CACHE_SIZE]; /* Protected by icon_cache lock */
int lru_cache_current; /* Protected by icon_cache lock */
GtkStringSet icons;
char *current_theme;
char **search_path;
char **resource_path;
@@ -409,7 +436,6 @@ typedef struct
GArray *dir_sizes; /* IconThemeDirSize */
GArray *dirs; /* IconThemeDir */
GtkStringSet icons;
} IconTheme;
typedef struct
@@ -465,8 +491,6 @@ static GtkIconPaintable *theme_lookup_icon (IconTheme *the
int size,
int scale,
gboolean allow_svg);
static gboolean theme_has_icon (IconTheme *theme,
const char *icon_name);
static void theme_subdir_load (GtkIconTheme *self,
IconTheme *theme,
GKeyFile *theme_file,
@@ -477,7 +501,8 @@ static gboolean rescan_themes (GtkIconTheme *sel
static GtkIconPaintable *icon_paintable_new (const char *icon_name,
int desired_size,
int desired_scale);
static IconCacheFlag suffix_from_name (const char *name);
static inline IconCacheFlag
suffix_from_name (const char *name);
static void icon_ensure_texture__locked (GtkIconPaintable *icon,
gboolean in_thread);
static void gtk_icon_theme_unset_display (GtkIconTheme *self);
@@ -1358,6 +1383,7 @@ blow_themes (GtkIconTheme *self)
g_list_free_full (self->themes, (GDestroyNotify) theme_destroy);
g_array_set_size (self->dir_mtimes, 0);
g_hash_table_destroy (self->unthemed_icons);
gtk_string_set_destroy (&self->icons);
}
self->themes = NULL;
self->unthemed_icons = NULL;
@@ -1834,34 +1860,25 @@ free_unthemed_icon (UnthemedIcon *unthemed_icon)
g_slice_free (UnthemedIcon, unthemed_icon);
}
static void
strip_suffix_inline (char *filename)
static inline void
strip_suffix_inline (char *filename,
IconCacheFlag suffix)
{
char *dot;
if (g_str_has_suffix (filename, ".symbolic.png"))
filename[strlen(filename)-13] = 0;
dot = strrchr (filename, '.');
if (dot != NULL)
*dot = 0;
if (suffix & ICON_CACHE_FLAG_SYMBOLIC_PNG_SUFFIX)
filename[strlen (filename) - strlen (".symbolic.png")] = 0;
else if (suffix & (ICON_CACHE_FLAG_XPM_SUFFIX|
ICON_CACHE_FLAG_SVG_SUFFIX|
ICON_CACHE_FLAG_PNG_SUFFIX))
filename[strlen (filename) - 4] = 0;
}
static char *
strip_suffix (const char *filename)
static inline char *
strip_suffix (const char *filename,
IconCacheFlag suffix)
{
const char *dot;
if (g_str_has_suffix (filename, ".symbolic.png"))
return g_strndup (filename, strlen(filename)-13);
dot = strrchr (filename, '.');
if (dot == NULL)
return g_strdup (filename);
return g_strndup (filename, dot - filename);
char *dup = g_strdup (filename);
strip_suffix_inline (dup, suffix);
return dup;
}
static void
@@ -1881,7 +1898,7 @@ add_unthemed_icon (GtkIconTheme *self,
return;
abs_file = g_build_filename (dir, file, NULL);
base_name = strip_suffix (file);
base_name = strip_suffix (file, new_suffix);
unthemed_icon = g_hash_table_lookup (self->unthemed_icons, base_name);
@@ -1939,6 +1956,8 @@ load_themes (GtkIconTheme *self)
GStatBuf stat_buf;
int j;
gtk_string_set_init (&self->icons);
if (self->current_theme)
insert_theme (self, self->current_theme);
@@ -2014,6 +2033,8 @@ load_themes (GtkIconTheme *self)
}
gdk_debug_message ("%s", s->str);
g_string_free (s, TRUE);
dump_string_set (&self->icons);
}
#endif
}
@@ -2159,10 +2180,13 @@ real_choose_icon (GtkIconTheme *self,
theme = l->data;
for (i = 0; icon_names[i] && icon_name_is_symbolic (icon_names[i], -1); i++)
{
icon_name = icon_names[i];
icon = theme_lookup_icon (theme, icon_name, size, scale, self->pixbuf_supports_svg);
if (icon)
goto out;
icon_name = gtk_string_set_lookup (&self->icons, icon_names[i]);
if (icon_name)
{
icon = theme_lookup_icon (theme, icon_name, size, scale, self->pixbuf_supports_svg);
if (icon)
goto out;
}
}
}
@@ -2172,10 +2196,13 @@ real_choose_icon (GtkIconTheme *self,
for (i = 0; icon_names[i]; i++)
{
icon_name = icon_names[i];
icon = theme_lookup_icon (theme, icon_name, size, scale, self->pixbuf_supports_svg);
if (icon)
goto out;
icon_name = gtk_string_set_lookup (&self->icons, icon_names[i]);
if (icon_name)
{
icon = theme_lookup_icon (theme, icon_name, size, scale, self->pixbuf_supports_svg);
if (icon)
goto out;
}
}
}
@@ -2556,7 +2583,6 @@ gboolean
gtk_icon_theme_has_icon (GtkIconTheme *self,
const char *icon_name)
{
GList *l;
gboolean res = FALSE;
g_return_val_if_fail (GTK_IS_ICON_THEME (self), FALSE);
@@ -2566,13 +2592,10 @@ gtk_icon_theme_has_icon (GtkIconTheme *self,
ensure_valid_themes (self, FALSE);
for (l = self->themes; l; l = l->next)
if (gtk_string_set_lookup (&self->icons, icon_name) != NULL)
{
if (theme_has_icon (l->data, icon_name))
{
res = TRUE;
goto out;
}
res = TRUE;
goto out;
}
out:
@@ -2611,13 +2634,10 @@ gtk_icon_theme_has_gicon (GtkIconTheme *self,
for (int i = 0; names[i]; i++)
{
for (GList *l = self->themes; l; l = l->next)
if (gtk_string_set_lookup (&self->icons, names[i]) != NULL)
{
if (theme_has_icon (l->data, names[i]))
{
res = TRUE;
goto out;
}
res = TRUE;
goto out;
}
}
@@ -2663,6 +2683,7 @@ gtk_icon_theme_get_icon_sizes (GtkIconTheme *self,
int i;
GHashTable *sizes;
int *result, *r;
const char *interned_icon_name;
g_return_val_if_fail (GTK_IS_ICON_THEME (self), NULL);
@@ -2672,10 +2693,11 @@ gtk_icon_theme_get_icon_sizes (GtkIconTheme *self,
sizes = g_hash_table_new (g_direct_hash, g_direct_equal);
interned_icon_name = gtk_string_set_lookup (&self->icons, icon_name);
for (l = self->themes; l; l = l->next)
{
IconTheme *theme = l->data;
const char *interned_icon_name = gtk_string_set_lookup (&theme->icons, icon_name);
for (i = 0; i < theme->dir_sizes->len; i++)
{
@@ -2732,25 +2754,15 @@ gtk_icon_theme_get_icon_names (GtkIconTheme *self)
char **names;
char *key;
int i;
GList *l;
gtk_icon_theme_lock (self);
ensure_valid_themes (self, FALSE);
icons = g_hash_table_new (g_str_hash, g_str_equal);
gtk_string_set_list (&self->icons, icons);
l = self->themes;
while (l != NULL)
{
IconTheme *theme = l->data;
gtk_string_set_list (&theme->icons, icons);
l = l->next;
}
g_hash_table_foreach (self->unthemed_icons,
add_key_to_hash,
icons);
g_hash_table_foreach (self->unthemed_icons, add_key_to_hash, icons);
names = g_new (char *, g_hash_table_size (icons) + 1);
@@ -2809,7 +2821,6 @@ theme_new (const char *theme_name,
theme->name = g_strdup (theme_name);
theme->dir_sizes = g_array_new (FALSE, FALSE, sizeof (IconThemeDirSize));
theme->dirs = g_array_new (FALSE, FALSE, sizeof (IconThemeDir));
gtk_string_set_init (&theme->icons);
theme->display_name =
g_key_file_get_locale_string (theme_file, "Icon Theme", "Name", NULL, NULL);
@@ -2840,8 +2851,6 @@ theme_destroy (IconTheme *theme)
theme_dir_destroy (&g_array_index (theme->dirs, IconThemeDir, i));
g_array_free (theme->dirs, TRUE);
gtk_string_set_destroy (&theme->icons);
g_free (theme);
}
@@ -3040,13 +3049,6 @@ theme_lookup_icon (IconTheme *theme,
IconCacheFlag min_suffix;
int i;
/* Its not uncommon with misses, so we do an early check which allows us do
* do a lot less work.
* We also intern the name so later hash lookups are faster. */
icon_name = gtk_string_set_lookup (&theme->icons, icon_name);
if (icon_name == NULL)
return FALSE;
min_difference = G_MAXINT;
min_dir_size = NULL;
@@ -3106,13 +3108,6 @@ theme_lookup_icon (IconTheme *theme,
return NULL;
}
static gboolean
theme_has_icon (IconTheme *theme,
const char *icon_name)
{
return gtk_string_set_lookup (&theme->icons, icon_name) != NULL;
}
static GHashTable *
scan_directory (GtkIconTheme *self,
char *full_dir,
@@ -3138,14 +3133,13 @@ scan_directory (GtkIconTheme *self,
if (suffix == ICON_CACHE_FLAG_NONE)
continue;
strip_suffix_inline ((char *)name);
strip_suffix_inline ((char *)name, suffix);
interned = gtk_string_set_add (set, name);
if (!icons)
icons = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
hash_suffix = GPOINTER_TO_INT (g_hash_table_lookup (icons, interned));
/* takes ownership of base_name */
g_hash_table_replace (icons, (char *)interned, GUINT_TO_POINTER (hash_suffix|suffix));
}
@@ -3182,11 +3176,10 @@ scan_resource_directory (GtkIconTheme *self,
if (!icons)
icons = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL);
strip_suffix_inline (name);
strip_suffix_inline (name, suffix);
interned = gtk_string_set_add (set, name);
hash_suffix = GPOINTER_TO_INT (g_hash_table_lookup (icons, interned));
/* takes ownership of base_name */
g_hash_table_replace (icons, (char *)interned, GUINT_TO_POINTER (hash_suffix|suffix));
}
@@ -3326,6 +3319,7 @@ theme_subdir_load (GtkIconTheme *self,
IconThemeDirSize *dir_size;
int scale;
guint i;
GString *str;
size = g_key_file_get_integer (theme_file, subdir, "Size", &error);
if (error)
@@ -3373,18 +3367,22 @@ theme_subdir_load (GtkIconTheme *self,
dir_size_index = theme_ensure_dir_size (theme, type, size, min_size, max_size, threshold, scale);
dir_size = &g_array_index (theme->dir_sizes, IconThemeDirSize, dir_size_index);
str = g_string_sized_new (256);
for (i = 0; i < self->dir_mtimes->len; i++)
{
IconThemeDirMtime *dir_mtime = &g_array_index (self->dir_mtimes, IconThemeDirMtime, i);
char *full_dir;
if (!dir_mtime->exists)
continue; /* directory doesn't exist */
full_dir = g_build_filename (dir_mtime->dir, subdir, NULL);
g_string_assign (str, dir_mtime->dir);
if (str->str[str->len - 1] != '/')
g_string_append_c (str, '/');
g_string_append (str, subdir);
/* First, see if we have a cache for the directory */
if (dir_mtime->cache != NULL || g_file_test (full_dir, G_FILE_TEST_IS_DIR))
if (dir_mtime->cache != NULL || g_file_test (str->str, G_FILE_TEST_IS_DIR))
{
GHashTable *icons = NULL;
@@ -3395,50 +3393,52 @@ theme_subdir_load (GtkIconTheme *self,
}
if (dir_mtime->cache != NULL)
icons = gtk_icon_cache_list_icons_in_directory (dir_mtime->cache, subdir, &theme->icons);
icons = gtk_icon_cache_list_icons_in_directory (dir_mtime->cache, subdir, &self->icons);
else
icons = scan_directory (self, full_dir, &theme->icons);
icons = scan_directory (self, str->str, &self->icons);
if (icons)
{
theme_add_dir_with_icons (theme,
dir_size,
FALSE,
g_steal_pointer (&full_dir),
g_strdup (str->str),
icons);
g_hash_table_destroy (icons);
}
}
g_free (full_dir);
}
if (strcmp (theme->name, FALLBACK_ICON_THEME) == 0)
{
int r;
for (r = 0; self->resource_path[r]; r++)
{
GHashTable *icons;
char *full_dir;
g_string_assign (str, self->resource_path[r]);
if (str->str[str->len - 1] != '/')
g_string_append_c (str, '/');
g_string_append (str, subdir);
/* Force a trailing / here, to avoid extra copies in GResource */
full_dir = g_build_filename (self->resource_path[r], subdir, " ", NULL);
full_dir[strlen (full_dir) - 1] = '\0';
if (str->str[str->len - 1] != '/')
g_string_append_c (str, '/');
icons = scan_resource_directory (self, full_dir, &theme->icons);
icons = scan_resource_directory (self, str->str, &self->icons);
if (icons)
{
theme_add_dir_with_icons (theme,
dir_size,
TRUE,
g_steal_pointer (&full_dir),
g_strdup (str->str),
icons);
g_hash_table_destroy (icons);
}
g_free (full_dir);
}
}
g_string_free (str, TRUE);
}
/*
@@ -3840,7 +3840,7 @@ icon_ensure_texture__locked (GtkIconPaintable *icon,
if (!icon->texture)
{
g_warning ("Failed to load icon %s: %s", icon->filename, load_error->message);
g_warning ("Failed to load icon %s: %s", icon->filename, load_error ? load_error->message : "");
g_clear_error (&load_error);
icon->texture = gdk_texture_new_from_resource (IMAGE_MISSING_RESOURCE_PATH);
icon->icon_name = g_strdup ("image-missing");
+5 -8
View File
@@ -40,7 +40,6 @@
#include "gtkshortcut.h"
#include "gtkshortcutcontroller.h"
#include "gtkshortcuttrigger.h"
#include "gtkfilelauncher.h"
#include "gtksnapshot.h"
#include "gtkrenderbackgroundprivate.h"
#include "gtkrenderborderprivate.h"
@@ -48,6 +47,7 @@
#include "gtktextutilprivate.h"
#include "gtktooltip.h"
#include "gtktypebuiltins.h"
#include "gtkurilauncher.h"
#include "gtkwidgetprivate.h"
#include "gtkpopovermenu.h"
#include "gtknative.h"
@@ -94,7 +94,7 @@
* # GtkLabel as GtkBuildable
*
* The GtkLabel implementation of the GtkBuildable interface supports a
* custom <attributes> element, which supports any number of <attribute>
* custom `<attributes>` element, which supports any number of `<attribute>`
* elements. The <attribute> element has attributes named name, value,
* start and end and allows you to specify [struct@Pango.Attribute]
* values for this label.
@@ -2102,17 +2102,14 @@ gtk_label_activate_link (GtkLabel *self,
{
GtkWidget *widget = GTK_WIDGET (self);
GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
GFile *file;
GtkFileLauncher *launcher;
GtkUriLauncher *launcher;
if (!GTK_IS_WINDOW (toplevel))
return FALSE;
file = g_file_new_for_uri (uri);
launcher = gtk_file_launcher_new (file);
gtk_file_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
launcher = gtk_uri_launcher_new (uri);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
g_object_unref (launcher);
g_object_unref (file);
return TRUE;
}
+2 -2
View File
@@ -90,8 +90,8 @@
* # GtkLevelBar as GtkBuildable
*
* The `GtkLevelBar` implementation of the `GtkBuildable` interface supports a
* custom <offsets> element, which can contain any number of <offset> elements,
* each of which must have name and value attributes.
* custom `<offsets>` element, which can contain any number of `<offset>` elements,
* each of which must have "name" and "value" attributes.
*
* # CSS nodes
*
+4 -7
View File
@@ -65,9 +65,9 @@
#include "gtkmarshalers.h"
#include "gtkpopovermenu.h"
#include "gtkprivate.h"
#include "gtkfilelauncher.h"
#include "gtksizerequest.h"
#include "gtktooltip.h"
#include "gtkurilauncher.h"
#include "gtkwidgetprivate.h"
#include <string.h>
@@ -479,16 +479,13 @@ static gboolean
gtk_link_button_activate_link (GtkLinkButton *link_button)
{
GtkWidget *toplevel;
GFile *file;
GtkFileLauncher *launcher;
GtkUriLauncher *launcher;
toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (link_button)));
file = g_file_new_for_uri (link_button->uri);
launcher = gtk_file_launcher_new (file);
gtk_file_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
launcher = gtk_uri_launcher_new (link_button->uri);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
g_object_unref (launcher);
g_object_unref (file);
gtk_link_button_set_visited (link_button, TRUE);
+2 -2
View File
@@ -378,10 +378,10 @@ gtk_list_base_get_allocation_across (GtkListBase *self,
* @pos: item to select
* @modify: %TRUE if the selection should be modified, %FALSE
* if a new selection should be done. This is usually set
* to %TRUE if the user keeps the <Shift> key pressed.
* to %TRUE if the user keeps the `<Shift>` key pressed.
* @extend_pos: %TRUE if the selection should be extended.
* Selections are usually extended from the last selected
* position if the user presses the <Ctrl> key.
* position if the user presses the `<Ctrl>` key.
*
* Selects the item at @pos according to how GTK list widgets modify
* selections, both when clicking rows with the mouse or when using
+1 -1
View File
@@ -66,7 +66,7 @@
*
* The `GtkListBox` implementation of the `GtkBuildable` interface supports
* setting a child as the placeholder by specifying placeholder as the type
* attribute of a <child> element. See [method@Gtk.ListBox.set_placeholder]
* attribute of a `<child>` element. See [method@Gtk.ListBox.set_placeholder]
* for info.
*
* # CSS nodes
+3 -5
View File
@@ -146,18 +146,16 @@ get_module_path (void)
char **
_gtk_get_module_path (const char *type)
{
char **paths = get_module_path();
char **paths = get_module_path ();
char **path;
char **result;
int count = 0;
for (path = paths; *path; path++)
count++;
count = g_strv_length (paths);
result = g_new (char *, count * 4 + 1);
count = 0;
for (path = get_module_path (); *path; path++)
for (path = paths; *path; path++)
{
result[count++] = g_build_filename (*path, GTK_BINARY_VERSION, GTK_HOST, type, NULL);
result[count++] = g_build_filename (*path, GTK_BINARY_VERSION, type, NULL);
+3 -3
View File
@@ -77,14 +77,14 @@
*
* The `GtkNotebook` implementation of the `GtkBuildable` interface
* supports placing children into tabs by specifying tab as the
* type attribute of a <child> element. Note that the content
* type attribute of a `<child>` element. Note that the content
* of the tab must be created before the tab can be filled.
* A tab child can be specified without specifying a <child>
* A tab child can be specified without specifying a `<child>`
* type attribute.
*
* To add a child widget in the notebooks action area, specify
* "action-start" or action-end as the type attribute of the
* <child> element.
* `<child>` element.
*
* An example of a UI definition fragment with `GtkNotebook`:
*
+2 -2
View File
@@ -64,8 +64,8 @@
*
* # GtkScale as GtkBuildable
*
* `GtkScale` supports a custom <marks> element, which can contain multiple
* <mark\> elements. The value and position attributes have the same
* `GtkScale` supports a custom `<marks>` element, which can contain multiple
* `<mark\>` elements. The value and position attributes have the same
* meaning as [method@Gtk.Scale.add_mark] parameters of the same name. If
* the element is not empty, its content is taken as the markup to show at
* the mark. It can be translated with the usual translatable and
+164 -348
View File
@@ -198,9 +198,13 @@ enum {
PROP_RECENT_FILES_ENABLED,
PROP_LONG_PRESS_TIME,
PROP_KEYNAV_USE_CARET,
PROP_OVERLAY_SCROLLING
PROP_OVERLAY_SCROLLING,
NUM_PROPERTIES
};
static GParamSpec *pspecs[NUM_PROPERTIES] = { NULL, };
/* --- prototypes --- */
static void gtk_settings_provider_iface_init (GtkStyleProviderInterface *iface);
@@ -215,8 +219,6 @@ static void gtk_settings_set_property (GObject *object,
GParamSpec *pspec);
static void gtk_settings_notify (GObject *object,
GParamSpec *pspec);
static guint settings_install_property_parser (GtkSettingsClass *class,
GParamSpec *pspec);
static void settings_update_double_click (GtkSettings *settings);
static void settings_update_cursor_theme (GtkSettings *settings);
@@ -238,8 +240,6 @@ static void settings_update_provider (GdkDisplay *display
/* --- variables --- */
static GQuark quark_gtk_settings = 0;
static GSList *object_list = NULL;
static guint class_n_properties = 0;
static GPtrArray *display_settings;
@@ -252,42 +252,29 @@ G_DEFINE_TYPE_EXTENDED (GtkSettings, gtk_settings, G_TYPE_OBJECT, 0,
static void
gtk_settings_init (GtkSettings *settings)
{
GParamSpec **pspecs, **p;
guint n_pspecs;
guint i = 0;
char *path;
const char * const *config_dirs;
g_datalist_init (&settings->queued_settings);
object_list = g_slist_prepend (object_list, settings);
settings->style_cascades = g_slist_prepend (NULL, _gtk_style_cascade_new ());
settings->theme_provider = gtk_css_provider_new ();
/* build up property array for all yet existing properties and queue
* notification for them (at least notification for internal properties
* will instantly be caught)
*/
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), &n_pspecs);
settings->property_values = g_new0 (GtkSettingsPropertyValue, n_pspecs);
settings->property_values = g_new0 (GtkSettingsPropertyValue, NUM_PROPERTIES - 1);
g_object_freeze_notify (G_OBJECT (settings));
i = 0;
for (p = pspecs; *p; p++)
for (i = 1; i < NUM_PROPERTIES; i++)
{
GParamSpec *pspec = *p;
GParamSpec *pspec = pspecs[i];
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
if (pspec->owner_type != G_OBJECT_TYPE (settings))
continue;
g_value_init (&settings->property_values[i].value, value_type);
g_param_value_set_default (pspec, &settings->property_values[i].value);
g_value_init (&settings->property_values[i - 1].value, value_type);
g_param_value_set_default (pspec, &settings->property_values[i - 1].value);
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
settings->property_values[i].source = GTK_SETTINGS_SOURCE_DEFAULT;
i++;
settings->property_values[i - 1].source = GTK_SETTINGS_SOURCE_DEFAULT;
}
g_free (pspecs);
path = g_build_filename (_gtk_get_data_prefix (), "share", "gtk-4.0", "settings.ini", NULL);
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
@@ -335,11 +322,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* The maximum time to allow between two clicks for them to be considered
* a double click, in milliseconds.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-double-click-time", NULL, NULL,
0, G_MAXINT, 400,
GTK_PARAM_READWRITE));
g_assert (result == PROP_DOUBLE_CLICK_TIME);
pspecs[PROP_DOUBLE_CLICK_TIME] = g_param_spec_int ("gtk-double-click-time", NULL, NULL,
0, G_MAXINT, 400,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-double-click-distance:
@@ -347,11 +332,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* The maximum distance allowed between two clicks for them to be considered
* a double click, in pixels.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-double-click-distance", NULL, NULL,
0, G_MAXINT, 5,
GTK_PARAM_READWRITE));
g_assert (result == PROP_DOUBLE_CLICK_DISTANCE);
pspecs[PROP_DOUBLE_CLICK_DISTANCE] = g_param_spec_int ("gtk-double-click-distance", NULL, NULL,
0, G_MAXINT, 5,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-cursor-blink:
@@ -361,22 +344,18 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Also see the [property@Gtk.Settings:gtk-cursor-blink-timeout] setting,
* which allows more flexible control over cursor blinking.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-cursor-blink", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_CURSOR_BLINK);
pspecs[PROP_CURSOR_BLINK] = g_param_spec_boolean ("gtk-cursor-blink", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-cursor-blink-time:
*
* Length of the cursor blink cycle, in milliseconds.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-cursor-blink-time", NULL, NULL,
100, G_MAXINT, 1200,
GTK_PARAM_READWRITE));
g_assert (result == PROP_CURSOR_BLINK_TIME);
pspecs[PROP_CURSOR_BLINK_TIME] = g_param_spec_int ("gtk-cursor-blink-time", NULL, NULL,
100, G_MAXINT, 1200,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-cursor-blink-timeout:
@@ -388,11 +367,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Setting this to zero has the same effect as setting
* [property@Gtk.Settings:gtk-cursor-blink] to %FALSE.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-cursor-blink-timeout", NULL, NULL,
1, G_MAXINT, 10,
GTK_PARAM_READWRITE));
g_assert (result == PROP_CURSOR_BLINK_TIMEOUT);
pspecs[PROP_CURSOR_BLINK_TIMEOUT] = g_param_spec_int ("gtk-cursor-blink-timeout", NULL, NULL,
1, G_MAXINT, 10,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-split-cursor:
@@ -400,22 +377,18 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Whether two cursors should be displayed for mixed left-to-right and
* right-to-left text.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-split-cursor", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_SPLIT_CURSOR);
pspecs[PROP_SPLIT_CURSOR] = g_param_spec_boolean ("gtk-split-cursor", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-cursor-aspect-ratio:
*
* The aspect ratio of the text caret.
*/
result = settings_install_property_parser (class,
g_param_spec_double ("gtk-cursor-aspect-ratio", NULL, NULL,
0.0, 1.0, 0.04,
GTK_PARAM_READWRITE));
g_assert (result == PROP_CURSOR_ASPECT_RATIO);
pspecs[PROP_CURSOR_ASPECT_RATIO] = g_param_spec_double ("gtk-cursor-aspect-ratio", NULL, NULL,
0.0, 1.0, 0.04,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-theme-name:
@@ -425,11 +398,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* See [class@Gtk.CssProvider] for details about how
* GTK finds the CSS stylesheet for a theme.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-theme-name", NULL, NULL,
DEFAULT_THEME_NAME,
GTK_PARAM_READWRITE));
g_assert (result == PROP_THEME_NAME);
pspecs[PROP_THEME_NAME] = g_param_spec_string ("gtk-theme-name", NULL, NULL,
DEFAULT_THEME_NAME,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-icon-theme-name:
@@ -439,22 +410,18 @@ gtk_settings_class_init (GtkSettingsClass *class)
* See [class@Gtk.IconTheme] for details about how
* GTK handles icon themes.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-icon-theme-name", NULL, NULL,
DEFAULT_ICON_THEME,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ICON_THEME_NAME);
pspecs[PROP_ICON_THEME_NAME] = g_param_spec_string ("gtk-icon-theme-name", NULL, NULL,
DEFAULT_ICON_THEME,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-dnd-drag-threshold:
*
* The number of pixels the cursor can move before dragging.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-dnd-drag-threshold", NULL, NULL,
1, G_MAXINT, 8,
GTK_PARAM_READWRITE));
g_assert (result == PROP_DND_DRAG_THRESHOLD);
pspecs[PROP_DND_DRAG_THRESHOLD] = g_param_spec_int ("gtk-dnd-drag-threshold", NULL, NULL,
1, G_MAXINT, 8,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-font-name:
@@ -463,11 +430,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* GTK uses the family name and size from this string.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-font-name", NULL, NULL,
"Sans 10",
GTK_PARAM_READWRITE));
g_assert (result == PROP_FONT_NAME);
pspecs[PROP_FONT_NAME] = g_param_spec_string ("gtk-font-name", NULL, NULL,
"Sans 10",
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-xft-antialias:
@@ -476,12 +441,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* The values are 0 for no, 1 for yes, or -1 for the system default.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-xft-antialias", NULL, NULL,
-1, 1, -1,
GTK_PARAM_READWRITE));
g_assert (result == PROP_XFT_ANTIALIAS);
pspecs[PROP_XFT_ANTIALIAS] = g_param_spec_int ("gtk-xft-antialias", NULL, NULL,
-1, 1, -1,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-xft-hinting:
@@ -490,12 +452,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* The values are 0 for no, 1 for yes, or -1 for the system default.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-xft-hinting", NULL, NULL,
-1, 1, -1,
GTK_PARAM_READWRITE));
g_assert (result == PROP_XFT_HINTING);
pspecs[PROP_XFT_HINTING] = g_param_spec_int ("gtk-xft-hinting", NULL, NULL,
-1, 1, -1,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-xft-hintstyle:
@@ -505,12 +464,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* The possible vaues are hintnone, hintslight,
* hintmedium, hintfull.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-xft-hintstyle", NULL, NULL,
NULL,
GTK_PARAM_READWRITE));
g_assert (result == PROP_XFT_HINTSTYLE);
pspecs[PROP_XFT_HINTSTYLE] = g_param_spec_string ("gtk-xft-hintstyle", NULL, NULL,
NULL,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-xft-rgba:
@@ -519,14 +475,10 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* The possible values are none, rgb, bgr, vrgb, vbgr.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-xft-rgba", NULL, NULL,
NULL,
GTK_PARAM_READWRITE));
pspecs[PROP_XFT_RGBA] = g_param_spec_string ("gtk-xft-rgba", NULL, NULL,
NULL,
GTK_PARAM_READWRITE);
g_assert (result == PROP_XFT_RGBA);
/**
* GtkSettings:gtk-xft-dpi:
*
@@ -534,12 +486,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* -1 to use the default value.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-xft-dpi", NULL, NULL,
-1, 1024*1024, -1,
GTK_PARAM_READWRITE));
g_assert (result == PROP_XFT_DPI);
pspecs[PROP_XFT_DPI] = g_param_spec_int ("gtk-xft-dpi", NULL, NULL,
-1, 1024*1024, -1,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-hint-font-metrics:
@@ -551,12 +500,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* Since: 4.6
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-hint-font-metrics", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_HINT_FONT_METRICS);
pspecs[PROP_HINT_FONT_METRICS] = g_param_spec_boolean ("gtk-hint-font-metrics", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-cursor-theme-name:
@@ -565,11 +511,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* Use %NULL to use the default theme.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-cursor-theme-name", NULL, NULL,
NULL,
GTK_PARAM_READWRITE));
g_assert (result == PROP_CURSOR_THEME_NAME);
pspecs[PROP_CURSOR_THEME_NAME] = g_param_spec_string ("gtk-cursor-theme-name", NULL, NULL,
NULL,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-cursor-theme-size:
@@ -578,23 +522,18 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* 0 means to use the default size.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-cursor-theme-size", NULL, NULL,
0, 128, 0,
GTK_PARAM_READWRITE));
g_assert (result == PROP_CURSOR_THEME_SIZE);
pspecs[PROP_CURSOR_THEME_SIZE] = g_param_spec_int ("gtk-cursor-theme-size", NULL, NULL,
0, 128, 0,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-alternative-button-order:
*
* Whether buttons in dialogs should use the alternative button order.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-alternative-button-order", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ALTERNATIVE_BUTTON_ORDER);
pspecs[PROP_ALTERNATIVE_BUTTON_ORDER] = g_param_spec_boolean ("gtk-alternative-button-order", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-alternative-sort-arrows:
@@ -605,23 +544,18 @@ gtk_settings_class_init (GtkSettingsClass *class)
* By default an arrow pointing down means the column is sorted
* in ascending order. When set to %TRUE, this order will be inverted.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-alternative-sort-arrows", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ALTERNATIVE_SORT_ARROWS);
pspecs[PROP_ALTERNATIVE_SORT_ARROWS] = g_param_spec_boolean ("gtk-alternative-sort-arrows", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-enable-animations:
*
* Whether to enable toolkit-wide animations.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-enable-animations", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ENABLE_ANIMATIONS);
pspecs[PROP_ENABLE_ANIMATIONS] = g_param_spec_boolean ("gtk-enable-animations", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-error-bell:
@@ -633,12 +567,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* windowing system may offer ways to configure the error bell in many
* ways, such as flashing the window or similar visual effects.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-error-bell", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ERROR_BELL);
pspecs[PROP_ERROR_BELL] = g_param_spec_boolean ("gtk-error-bell", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-print-backends:
@@ -649,11 +580,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Available print backends depend on the GTK installation,
* and may include "file", "cups", "lpr" or "papi".
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-print-backends", NULL, NULL,
GTK_PRINT_BACKENDS,
GTK_PARAM_READWRITE));
g_assert (result == PROP_PRINT_BACKENDS);
pspecs[PROP_PRINT_BACKENDS] = g_param_spec_string ("gtk-print-backends", NULL, NULL,
GTK_PRINT_BACKENDS,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-print-preview-command:
@@ -669,11 +598,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* The preview application is responsible for removing the pdf
* file and the print settings file when it is done.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-print-preview-command", NULL, NULL,
PRINT_PREVIEW_COMMAND,
GTK_PARAM_READWRITE));
g_assert (result == PROP_PRINT_PREVIEW_COMMAND);
pspecs[PROP_PRINT_PREVIEW_COMMAND] = g_param_spec_string ("gtk-print-preview-command", NULL, NULL,
PRINT_PREVIEW_COMMAND,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-enable-accels:
@@ -681,11 +608,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Whether menu items should have visible accelerators which can be
* activated.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-enable-accels", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ENABLE_ACCELS);
pspecs[PROP_ENABLE_ACCELS] = g_param_spec_boolean ("gtk-enable-accels", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-im-module:
@@ -699,11 +624,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* See [class@Gtk.IMContext].
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-im-module", NULL, NULL,
NULL,
GTK_PARAM_READWRITE));
g_assert (result == PROP_IM_MODULE);
pspecs[PROP_IM_MODULE] = g_param_spec_string ("gtk-im-module", NULL, NULL,
NULL,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-recent-files-max-age:
@@ -715,24 +638,19 @@ gtk_settings_class_init (GtkSettingsClass *class)
* If set to 0, the list will always be empty; if set to -1, no
* item will be removed.
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-recent-files-max-age", NULL, NULL,
-1, G_MAXINT,
30,
GTK_PARAM_READWRITE));
g_assert (result == PROP_RECENT_FILES_MAX_AGE);
pspecs[PROP_RECENT_FILES_MAX_AGE] = g_param_spec_int ("gtk-recent-files-max-age", NULL, NULL,
-1, G_MAXINT,
30,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-fontconfig-timestamp:
*
* Timestamp of the current fontconfig configuration.
*/
result = settings_install_property_parser (class,
g_param_spec_uint ("gtk-fontconfig-timestamp", NULL, NULL,
0, G_MAXUINT, 0,
GTK_PARAM_READWRITE));
g_assert (result == PROP_FONTCONFIG_TIMESTAMP);
pspecs[PROP_FONTCONFIG_TIMESTAMP] = g_param_spec_uint ("gtk-fontconfig-timestamp", NULL, NULL,
0, G_MAXUINT, 0,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-sound-theme-name:
@@ -745,11 +663,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* GTK itself does not support event sounds, you have to use
* a loadable module like the one that comes with libcanberra.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-sound-theme-name", NULL, NULL,
"freedesktop",
GTK_PARAM_READWRITE));
g_assert (result == PROP_SOUND_THEME_NAME);
pspecs[PROP_SOUND_THEME_NAME] = g_param_spec_string ("gtk-sound-theme-name", NULL, NULL,
"freedesktop",
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-enable-input-feedback-sounds:
@@ -762,11 +678,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* GTK itself does not support event sounds, you have to use a loadable
* module like the one that comes with libcanberra.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-enable-input-feedback-sounds", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ENABLE_INPUT_FEEDBACK_SOUNDS);
pspecs[PROP_ENABLE_INPUT_FEEDBACK_SOUNDS] = g_param_spec_boolean ("gtk-enable-input-feedback-sounds", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-enable-event-sounds:
@@ -779,11 +693,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* GTK itself does not support event sounds, you have to use a loadable
* module like the one that comes with libcanberra.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-enable-event-sounds", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ENABLE_EVENT_SOUNDS);
pspecs[PROP_ENABLE_EVENT_SOUNDS] = g_param_spec_boolean ("gtk-enable-event-sounds", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-primary-button-warps-slider:
@@ -799,11 +711,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* be available by holding Shift and primary-clicking, or clicking the middle
* mouse button.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-primary-button-warps-slider", NULL, NULL,
pspecs[PROP_PRIMARY_BUTTON_WARPS_SLIDER] = g_param_spec_boolean ("gtk-primary-button-warps-slider", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_PRIMARY_BUTTON_WARPS_SLIDER);
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-application-prefer-dark-theme:
@@ -823,22 +733,18 @@ gtk_settings_class_init (GtkSettingsClass *class)
* are white/light and the dark chrome creates too much contrast
* (web browser, text editor...).
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-application-prefer-dark-theme", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_APPLICATION_PREFER_DARK_THEME);
pspecs[PROP_APPLICATION_PREFER_DARK_THEME] = g_param_spec_boolean ("gtk-application-prefer-dark-theme", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gkt-entry-select-on-focus:
*
* Whether to select the contents of an entry when it is focused.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-entry-select-on-focus", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ENTRY_SELECT_ON_FOCUS);
pspecs[PROP_ENTRY_SELECT_ON_FOCUS] = g_param_spec_boolean ("gtk-entry-select-on-focus", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-entry-password-hint-timeout:
@@ -849,12 +755,10 @@ gtk_settings_class_init (GtkSettingsClass *class)
* This value is in milliseconds. 0 disables showing the
* last char. 600 is a good value for enabling it.
*/
result = settings_install_property_parser (class,
g_param_spec_uint ("gtk-entry-password-hint-timeout", NULL, NULL,
pspecs[PROP_ENTRY_PASSWORD_HINT_TIMEOUT] = g_param_spec_uint ("gtk-entry-password-hint-timeout", NULL, NULL,
0, G_MAXUINT,
0,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ENTRY_PASSWORD_HINT_TIMEOUT);
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-label-select-on-focus:
@@ -862,11 +766,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Whether to select the contents of a selectable
* label when it is focused.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-label-select-on-focus", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_LABEL_SELECT_ON_FOCUS);
pspecs[PROP_LABEL_SELECT_ON_FOCUS] = g_param_spec_boolean ("gtk-label-select-on-focus", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-shell-shows-app-menu:
@@ -874,10 +776,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Set to %TRUE if the desktop environment is displaying
* the app menu, %FALSE if the app should display it itself.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-shell-shows-app-menu", NULL, NULL,
FALSE, GTK_PARAM_READWRITE));
g_assert (result == PROP_SHELL_SHOWS_APP_MENU);
pspecs[PROP_SHELL_SHOWS_APP_MENU] = g_param_spec_boolean ("gtk-shell-shows-app-menu", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-shell-shows-menubar:
@@ -885,10 +786,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Set to %TRUE if the desktop environment is displaying
* the menubar, %FALSE if the app should display it itself.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-shell-shows-menubar", NULL, NULL,
FALSE, GTK_PARAM_READWRITE));
g_assert (result == PROP_SHELL_SHOWS_MENUBAR);
pspecs[PROP_SHELL_SHOWS_MENUBAR] = g_param_spec_boolean ("gtk-shell-shows-menubar", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-shell-shows-desktop:
@@ -896,10 +796,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Set to %TRUE if the desktop environment is displaying
* the desktop folder, %FALSE if not.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-shell-shows-desktop", NULL, NULL,
TRUE, GTK_PARAM_READWRITE));
g_assert (result == PROP_SHELL_SHOWS_DESKTOP);
pspecs[PROP_SHELL_SHOWS_DESKTOP] = g_param_spec_boolean ("gtk-shell-shows-desktop", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-decoration-layout:
@@ -925,10 +824,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Also note that the setting can be overridden with the
* [property@Gtk.HeaderBar:decoration-layout] property.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-decoration-layout", NULL, NULL,
"menu:minimize,maximize,close", GTK_PARAM_READWRITE));
g_assert (result == PROP_DECORATION_LAYOUT);
pspecs[PROP_DECORATION_LAYOUT] = g_param_spec_string ("gtk-decoration-layout", NULL, NULL,
"menu:minimize,maximize,close",
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-titlebar-double-click:
@@ -939,10 +837,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Recognized actions are minimize, toggle-maximize, menu, lower
* or none.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-titlebar-double-click", NULL, NULL,
"toggle-maximize", GTK_PARAM_READWRITE));
g_assert (result == PROP_TITLEBAR_DOUBLE_CLICK);
pspecs[PROP_TITLEBAR_DOUBLE_CLICK] = g_param_spec_string ("gtk-titlebar-double-click", NULL, NULL,
"toggle-maximize",
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-titlebar-middle-click:
@@ -953,10 +850,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Recognized actions are minimize, toggle-maximize, menu, lower
* or none.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-titlebar-middle-click", NULL, NULL,
"none", GTK_PARAM_READWRITE));
g_assert (result == PROP_TITLEBAR_MIDDLE_CLICK);
pspecs[PROP_TITLEBAR_MIDDLE_CLICK] = g_param_spec_string ("gtk-titlebar-middle-click", NULL, NULL,
"none",
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-titlebar-right-click:
@@ -967,10 +863,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Recognized actions are minimize, toggle-maximize, menu, lower
* or none.
*/
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-titlebar-right-click", NULL, NULL,
"menu", GTK_PARAM_READWRITE));
g_assert (result == PROP_TITLEBAR_RIGHT_CLICK);
pspecs[PROP_TITLEBAR_RIGHT_CLICK] = g_param_spec_string ("gtk-titlebar-right-click", NULL, NULL,
"menu",
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-dialogs-use-header:
@@ -982,11 +877,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* This setting does not affect custom dialogs using `GtkDialog`
* directly, or message dialogs.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-dialogs-use-header", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_DIALOGS_USE_HEADER);
pspecs[PROP_DIALOGS_USE_HEADER] = g_param_spec_boolean ("gtk-dialogs-use-header", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-enable-primary-paste:
@@ -994,11 +887,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Whether a middle click on a mouse should paste the
* 'PRIMARY' clipboard content at the cursor location.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-enable-primary-paste", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_ENABLE_PRIMARY_PASTE);
pspecs[PROP_ENABLE_PRIMARY_PASTE] = g_param_spec_boolean ("gtk-enable-primary-paste", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-recent-files-enabled:
@@ -1008,11 +899,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* If set to %FALSE, the list will always be empty.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-recent-files-enabled", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_RECENT_FILES_ENABLED);
pspecs[PROP_RECENT_FILES_ENABLED] = g_param_spec_boolean ("gtk-recent-files-enabled", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-long-press-time:
@@ -1021,11 +910,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* See [class@Gtk.GestureLongPress].
*/
result = settings_install_property_parser (class,
g_param_spec_uint ("gtk-long-press-time", NULL, NULL,
0, G_MAXINT, 500,
GTK_PARAM_READWRITE));
g_assert (result == PROP_LONG_PRESS_TIME);
pspecs[PROP_LONG_PRESS_TIME] = g_param_spec_uint ("gtk-long-press-time", NULL, NULL,
0, G_MAXINT, 500,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-keynav-use-caret:
@@ -1035,11 +922,9 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* This is useful when using a screen reader.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-keynav-use-caret", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_KEYNAV_USE_CARET);
pspecs[PROP_KEYNAV_USE_CARET] = g_param_spec_boolean ("gtk-keynav-use-caret", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkSettings:gtk-overlay-scrolling:
@@ -1049,11 +934,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* If this is set to %FALSE, scrolled windows will have permanent
* scrollbars.
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-overlay-scrolling", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE));
g_assert (result == PROP_OVERLAY_SCROLLING);
pspecs[PROP_OVERLAY_SCROLLING] = g_param_spec_boolean ("gtk-overlay-scrolling", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, pspecs);
}
static GtkSettings *
@@ -1074,10 +959,8 @@ gtk_settings_finalize (GObject *object)
GtkSettings *settings = GTK_SETTINGS (object);
guint i;
object_list = g_slist_remove (object_list, settings);
for (i = 0; i < class_n_properties; i++)
g_value_unset (&settings->property_values[i].value);
for (i = 1; i < NUM_PROPERTIES; i++)
g_value_unset (&settings->property_values[i - 1].value);
g_free (settings->property_values);
g_datalist_clear (&settings->queued_settings);
@@ -1431,70 +1314,6 @@ apply_queued_setting (GtkSettings *settings,
g_value_unset (&tmp_value);
}
static guint
settings_install_property_parser (GtkSettingsClass *class,
GParamSpec *pspec)
{
GSList *node, *next;
switch (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec)))
{
case G_TYPE_BOOLEAN:
case G_TYPE_UCHAR:
case G_TYPE_CHAR:
case G_TYPE_UINT:
case G_TYPE_INT:
case G_TYPE_ULONG:
case G_TYPE_LONG:
case G_TYPE_FLOAT:
case G_TYPE_DOUBLE:
case G_TYPE_STRING:
case G_TYPE_ENUM:
break;
case G_TYPE_BOXED:
default:
g_warning (G_STRLOC ": no parser for property \"%s\" of type '%s'",
pspec->name, g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
return 0;
}
if (g_object_class_find_property (G_OBJECT_CLASS (class), pspec->name))
{
g_warning (G_STRLOC ": an rc-data property \"%s\" already exists",
pspec->name);
return 0;
}
for (node = object_list; node; node = node->next)
g_object_freeze_notify (node->data);
g_object_class_install_property (G_OBJECT_CLASS (class), ++class_n_properties, pspec);
for (node = object_list; node; node = node->next)
{
GtkSettings *settings = node->data;
GtkSettingsValue *qvalue;
settings->property_values = g_renew (GtkSettingsPropertyValue, settings->property_values, class_n_properties);
settings->property_values[class_n_properties - 1].value.g_type = 0;
g_value_init (&settings->property_values[class_n_properties - 1].value, G_PARAM_SPEC_VALUE_TYPE (pspec));
g_param_value_set_default (pspec, &settings->property_values[class_n_properties - 1].value);
settings->property_values[class_n_properties - 1].source = GTK_SETTINGS_SOURCE_DEFAULT;
g_object_notify_by_pspec (G_OBJECT (settings), pspec);
qvalue = g_datalist_id_dup_data (&settings->queued_settings, g_param_spec_get_name_quark (pspec), NULL, NULL);
if (qvalue)
apply_queued_setting (settings, pspec, qvalue);
}
for (node = object_list; node; node = next)
{
next = node->next;
g_object_thaw_notify (node->data);
}
return class_n_properties;
}
static void
free_value (gpointer data)
{
@@ -2008,13 +1827,10 @@ settings_update_xsetting (GtkSettings *settings,
static void
settings_update_xsettings (GtkSettings *settings)
{
GParamSpec **pspecs;
int i;
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), NULL);
for (i = 0; pspecs[i]; i++)
settings_update_xsetting (settings, pspecs[i], FALSE);
g_free (pspecs);
}
static void
+8 -8
View File
@@ -555,22 +555,22 @@ gtk_shortcuts_shortcut_class_init (GtkShortcutsShortcutClass *klass)
* by separating them with a space, but keep in mind that the available width
* is limited.
*
* It is also possible to specify ranges of shortcuts, using "..." between
* the keys. Sequences of keys can be specified using a "+" or "&" between
* It is also possible to specify ranges of shortcuts, using `...` between
* the keys. Sequences of keys can be specified using a `+` or `&` between
* the keys.
*
* Examples:
*
* - A single shortcut: <ctl><alt>delete
* - Two alternative shortcuts: <shift>a Home
* - A range of shortcuts: <alt>1...<alt>9
* - Several keys pressed together: Control_L&Control_R
* - A sequence of shortcuts or keys: <ctl>c+<ctl>x
* - A single shortcut: `<ctl><alt>delete`
* - Two alternative shortcuts: `<shift>a Home`
* - A range of shortcuts: `<alt>1...<alt>9`
* - Several keys pressed together: `Control_L&Control_R`
* - A sequence of shortcuts or keys: `<ctl>c+<ctl>x`
*
* Use "+" instead of "&" when the keys may (or have to be) pressed
* sequentially (e.g use "t+t" for 'press the t key twice').
*
* Note that <, > and & need to be escaped as &lt;, &gt; and &amp; when used
* Note that `<`, `>` and `&` need to be escaped as `&lt;`, `&gt`; and `&amp`; when used
* in .ui files.
*/
properties[PROP_ACCELERATOR] =
+3 -3
View File
@@ -79,10 +79,10 @@
*
* # GtkSizeGroup as GtkBuildable
*
* Size groups can be specified in a UI definition by placing an <object>
* Size groups can be specified in a UI definition by placing an `<object>`
* element with `class="GtkSizeGroup"` somewhere in the UI definition. The
* widgets that belong to the size group are specified by a <widgets> element
* that may contain multiple <widget> elements, one for each member of the
* widgets that belong to the size group are specified by a `<widgets>` element
* that may contain multiple `<widget>` elements, one for each member of the
* size group. The name attribute gives the id of the widget.
*
* An example of a UI definition fragment with `GtkSizeGroup`:
+2 -2
View File
@@ -38,8 +38,8 @@
* # GtkStringList as GtkBuildable
*
* The `GtkStringList` implementation of the `GtkBuildable` interface
* supports adding items directly using the <items> element and
* specifying <item> elements for each item. Each <item> element
* supports adding items directly using the `<items>` element and
* specifying `<item>` elements for each item. Each `<item>` element
* supports the regular translation attributes translatable,
* context and comments.
*
+8 -2
View File
@@ -30,6 +30,7 @@ struct _GtkStyleCascadeIter {
int n_cascades;
int *cascade_index; /* each one points at last index that was returned, */
/* not next one that should be returned */
int index_[20];
};
struct _GtkStyleProviderData
@@ -83,7 +84,11 @@ gtk_style_cascade_iter_init (GtkStyleCascade *cascade,
while ((cas = cas->parent) != NULL)
iter->n_cascades++;
iter->cascade_index = g_new (int, iter->n_cascades);
if (iter->n_cascades < 20)
iter->cascade_index = iter->index_;
else
iter->cascade_index = g_new (int, iter->n_cascades);
for (cas = cascade, ix = 0; ix < iter->n_cascades; cas = cas->parent, ix++)
iter->cascade_index[ix] = cas->providers->len;
@@ -93,7 +98,8 @@ gtk_style_cascade_iter_init (GtkStyleCascade *cascade,
static void
gtk_style_cascade_iter_clear (GtkStyleCascadeIter *iter)
{
g_free (iter->cascade_index);
if (iter->cascade_index != iter->index_)
g_free (iter->cascade_index);
}
static GtkSettings *
+1 -1
View File
@@ -50,7 +50,7 @@
*
* The `GtkTextTagTable` implementation of the `GtkBuildable` interface
* supports adding tags by specifying tag as the type attribute
* of a <child> element.
* of a `<child>` element.
*
* An example of a UI definition fragment specifying tags:
* ```xml
+6 -1
View File
@@ -66,6 +66,8 @@ struct _GtkTooltipWindowClass
GtkWidgetClass parent_class;
};
#define CHARS_WRAP_LIMIT 50
static void gtk_tooltip_window_native_init (GtkNativeInterface *iface);
G_DEFINE_TYPE_WITH_CODE (GtkTooltipWindow, gtk_tooltip_window, GTK_TYPE_WIDGET,
@@ -417,7 +419,10 @@ update_label_width (GtkLabel *label)
len = g_utf8_strlen (text, -1);
gtk_label_set_max_width_chars (label, MIN (len, 50));
if (len > CHARS_WRAP_LIMIT)
gtk_label_set_width_chars (label, CHARS_WRAP_LIMIT);
gtk_label_set_max_width_chars (label, MIN (len, CHARS_WRAP_LIMIT));
gtk_label_set_wrap (label, TRUE);
}
}
+339
View File
@@ -0,0 +1,339 @@
/*
* GTK - The GIMP Toolkit
* Copyright (C) 2022 Red Hat, Inc.
* All rights reserved.
*
* This Library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This Library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkurilauncher.h"
#include "gtkdialogerror.h"
#include "gopenuriportal.h"
#include "deprecated/gtkshow.h"
#include <glib/gi18n-lib.h>
/**
* GtkUriLauncher:
*
* A `GtkUriLauncher` object collects the arguments that are needed to open a uri
* with an application.
*
* Depending on system configuration, user preferences and available APIs, this
* may or may not show an app chooser dialog or launch the default application
* right away.
*
* The operation is started with the [method@Gtk.UriLauncher.launch] function.
* This API follows the GIO async pattern, and the result can be obtained by
* calling [method@Gtk.UriLauncher.launch_finish].
*
* To launch a file, use [class@Gtk.FileLauncher].
*
* Since: 4.10
*/
/* {{{ GObject implementation */
struct _GtkUriLauncher
{
GObject parent_instance;
char *uri;
};
enum {
PROP_URI = 1,
NUM_PROPERTIES
};
static GParamSpec *properties[NUM_PROPERTIES];
G_DEFINE_TYPE (GtkUriLauncher, gtk_uri_launcher, G_TYPE_OBJECT)
static void
gtk_uri_launcher_init (GtkUriLauncher *self)
{
}
static void
gtk_uri_launcher_finalize (GObject *object)
{
GtkUriLauncher *self = GTK_URI_LAUNCHER (object);
g_free (self->uri);
G_OBJECT_CLASS (gtk_uri_launcher_parent_class)->finalize (object);
}
static void
gtk_uri_launcher_get_property (GObject *object,
unsigned int property_id,
GValue *value,
GParamSpec *pspec)
{
GtkUriLauncher *self = GTK_URI_LAUNCHER (object);
switch (property_id)
{
case PROP_URI:
g_value_set_string (value, self->uri);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gtk_uri_launcher_set_property (GObject *object,
unsigned int property_id,
const GValue *value,
GParamSpec *pspec)
{
GtkUriLauncher *self = GTK_URI_LAUNCHER (object);
switch (property_id)
{
case PROP_URI:
gtk_uri_launcher_set_uri (self, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gtk_uri_launcher_class_init (GtkUriLauncherClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = gtk_uri_launcher_finalize;
object_class->get_property = gtk_uri_launcher_get_property;
object_class->set_property = gtk_uri_launcher_set_property;
/**
* GtkUriLauncher:uri: (attributes org.gtk.Property.get=gtk_uri_launcher_get_uri org.gtk.Property.set=gtk_uri_launcher_set_uri)
*
* The uri to launch.
*
* Since: 4.10
*/
properties[PROP_URI] =
g_param_spec_string ("uri", NULL, NULL,
NULL,
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
}
/* }}} */
/* {{{ API: Constructor */
/**
* gtk_uri_launcher_new:
* @uri: (nullable): the uri to open
*
* Creates a new `GtkUriLauncher` object.
*
* Returns: the new `GtkUriLauncher`
*
* Since: 4.10
*/
GtkUriLauncher *
gtk_uri_launcher_new (const char *uri)
{
return g_object_new (GTK_TYPE_URI_LAUNCHER,
"uri", uri,
NULL);
}
/* }}} */
/* {{{ API: Getters and setters */
/**
* gtk_uri_launcher_get_uri:
* @self: a `GtkUriLauncher`
*
* Gets the uri that will be opened.
*
* Returns: (transfer none) (nullable): the uri
*
* Since: 4.10
*/
const char *
gtk_uri_launcher_get_uri (GtkUriLauncher *self)
{
g_return_val_if_fail (GTK_IS_URI_LAUNCHER (self), NULL);
return self->uri;
}
/**
* gtk_uri_launcher_set_uri:
* @self: a `GtkUriLauncher`
* @uri: (nullable): the uri
*
* Sets the uri that will be opened.
*
* Since: 4.10
*/
void
gtk_uri_launcher_set_uri (GtkUriLauncher *self,
const char *uri)
{
g_return_if_fail (GTK_IS_URI_LAUNCHER (self));
if (g_strcmp0 (self->uri, uri) == 0)
return;
g_free (self->uri);
self->uri = g_strdup (uri);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_URI]);
}
/* }}} */
/* {{{ Async implementation */
#ifndef G_OS_WIN32
static void
open_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GTask *task = G_TASK (data);
GError *error = NULL;
if (!g_openuri_portal_open_uri_finish (result, &error))
g_task_return_error (task, error);
else
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
#endif
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_uri_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkWindow *parent = GTK_WINDOW (source);
GTask *task = G_TASK (data);
GError *error = NULL;
if (!gtk_show_uri_full_finish (parent, result, &error))
{
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_CANCELLED, "Cancelled by user");
else
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED, "%s", error->message);
g_error_free (error);
}
else
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
G_GNUC_END_IGNORE_DEPRECATIONS
/* }}} */
/* {{{ Async API */
/**
* gtk_uri_launcher_launch:
* @self: a `GtkUriLauncher`
* @parent: (nullable): the parent `GtkWindow`
* @cancellable: (nullable): a `GCancellable` to cancel the operation
* @callback: (scope async): a callback to call when the operation is complete
* @user_data: (closure callback): data to pass to @callback
*
* Launch an application to open the uri.
*
* This may present an app chooser dialog to the user.
*
* The @callback will be called when the operation is completed.
* It should call [method@Gtk.UriLauncher.launch_finish] to obtain
* the result.
*
* Since: 4.10
*/
void
gtk_uri_launcher_launch (GtkUriLauncher *self,
GtkWindow *parent,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
g_return_if_fail (GTK_IS_URI_LAUNCHER (self));
task = g_task_new (self, cancellable, callback, user_data);
g_task_set_check_cancellable (task, FALSE);
g_task_set_source_tag (task, gtk_uri_launcher_launch);
if (self->uri == NULL)
{
g_task_return_new_error (task,
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
"No uri to launch");
return;
}
#ifndef G_OS_WIN32
if (g_openuri_portal_is_available ())
g_openuri_portal_open_uri_async (self->uri, parent, cancellable, open_done, task);
else
#endif
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_show_uri_full (parent, self->uri, GDK_CURRENT_TIME, cancellable, show_uri_done, task);
G_GNUC_END_IGNORE_DEPRECATIONS
}
/**
* gtk_uri_launcher_launch_finish:
* @self: a `GtkUriLauncher`
* @result: a `GAsyncResult`
* @error: return location for a [enum@Gtk.DialogError] or [enum@Gio.Error] error
*
* Finishes the [method@Gtk.UriLauncher.launch] call and
* returns the result.
*
* Returns: `TRUE` if an application was launched,
* or `FALSE` and @error is set
*
* Since: 4.10
*/
gboolean
gtk_uri_launcher_launch_finish (GtkUriLauncher *self,
GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (GTK_IS_URI_LAUNCHER (self), FALSE);
g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_uri_launcher_launch, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
/* }}} */
/* vim:set foldmethod=marker expandtab: */
+57
View File
@@ -0,0 +1,57 @@
/* GTK - The GIMP Toolkit
*
* Copyright (C) 2022 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gdk/gdk.h>
#include <gtk/gtkwindow.h>
G_BEGIN_DECLS
#define GTK_TYPE_URI_LAUNCHER (gtk_uri_launcher_get_type ())
GDK_AVAILABLE_IN_4_10
G_DECLARE_FINAL_TYPE (GtkUriLauncher, gtk_uri_launcher, GTK, URI_LAUNCHER, GObject)
GDK_AVAILABLE_IN_4_10
GtkUriLauncher * gtk_uri_launcher_new (const char *uri);
GDK_AVAILABLE_IN_4_10
const char * gtk_uri_launcher_get_uri (GtkUriLauncher *self);
GDK_AVAILABLE_IN_4_10
void gtk_uri_launcher_set_uri (GtkUriLauncher *self,
const char *uri);
GDK_AVAILABLE_IN_4_10
void gtk_uri_launcher_launch (GtkUriLauncher *self,
GtkWindow *parent,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
GDK_AVAILABLE_IN_4_10
gboolean gtk_uri_launcher_launch_finish (GtkUriLauncher *self,
GAsyncResult *result,
GError **error);
G_END_DECLS
+1 -1
View File
@@ -937,7 +937,7 @@ void gtk_widget_get_color (GtkWidget *widget,
* GtkWidgetActionActivateFunc:
* @widget: the widget to which the action belongs
* @action_name: the action name
* @parameter: parameter for activation
* @parameter: (nullable): parameter for activation
*
* The type of the callback functions used for activating
* actions installed with gtk_widget_class_install_action().
+1 -1
View File
@@ -119,7 +119,7 @@
*
* The `GtkWindow` implementation of the [iface@Gtk.Buildable] interface supports
* setting a child as the titlebar by specifying titlebar as the type
* attribute of a <child> element.
* attribute of a `<child>` element.
*
* # CSS nodes
*
+2
View File
@@ -390,6 +390,7 @@ gtk_public_sources = files([
'gtktreeexpander.c',
'gtktreelistmodel.c',
'gtktreelistrowsorter.c',
'gtkurilauncher.c',
'gtkversion.c',
'gtkvideo.c',
'gtkviewport.c',
@@ -615,6 +616,7 @@ gtk_public_headers = files([
'gtktreelistmodel.h',
'gtktreelistrowsorter.h',
'gtktypes.h',
'gtkurilauncher.h',
'gtkvideo.h',
'gtkviewport.h',
'gtkvolumebutton.h',
+2
View File
@@ -747,6 +747,8 @@ endif
subdir('tools')
if get_option('build-tests')
subdir('tests')
endif
if get_option('build-testsuite')
subdir('testsuite')
endif
if get_option('build-examples')
+5
View File
@@ -114,6 +114,11 @@ option('profile',
value: 'default',
description : 'Profile to use for demos')
option('build-testsuite',
type: 'boolean',
value: true,
description : 'Build testsuite')
option('build-examples',
type: 'boolean',
value: true,
+896 -864
View File
File diff suppressed because it is too large Load Diff
+839 -804
View File
File diff suppressed because it is too large Load Diff
+15 -15
View File
@@ -15,23 +15,23 @@
# Çağatay Yiğit Şahin <cyigitsahin@outlook.com>, 2017.
# Muhammet Kara <muhammetk@gmail.com>, 2014, 2015, 2017.
# Furkan Ahmet Kara <furkanahmetkara.fk@gmail.com>, 2018.
# Sabri Ünal <libreajans@gmail.com>, 2022, 2023.
# Emin Tufan Çetin <etcetin@gmail.com>, 2018-2023.
# Sabri Ünal <libreajans@gmail.com>, 2022.
# Emin Tufan Çetin <etcetin@gmail.com>, 2018, 2019, 2020, 2021, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: gtk+\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gtk/-/issues/\n"
"POT-Creation-Date: 2023-01-08 14:30+0000\n"
"PO-Revision-Date: 2023-01-11 10:00+0300\n"
"Last-Translator: Emin Tufan Çetin <etcetin@gmail.com>\n"
"Language-Team: Turkish <gnome-turk@gnome.org>\n"
"PO-Revision-Date: 2022-12-21 12:52+0300\n"
"Last-Translator: Sabri Ünal <libreajans@gmail.com>\n"
"Language-Team: Türkçe <gnome-turk@gnome.org>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"
"X-Generator: Gtranslator 42.0\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.1.1\n"
#: gdk/broadway/gdkbroadway-server.c:135
#, c-format
@@ -204,7 +204,7 @@ msgstr "Escape"
#: gdk/keynamesprivate.h:6850
msgctxt "keyboard label"
msgid "Multi_key"
msgstr "Compose"
msgstr "Çoklu Tuş"
#: gdk/keynamesprivate.h:6851
msgctxt "keyboard label"
@@ -275,7 +275,7 @@ msgstr "Boşluk (numerik klavye)"
#: gdk/keynamesprivate.h:6865
msgctxt "keyboard label"
msgid "KP_Tab"
msgstr "Sekme (numerik klavye)"
msgstr "Tab (numerik klavye)"
#: gdk/keynamesprivate.h:6866
msgctxt "keyboard label"
@@ -295,7 +295,7 @@ msgstr "Sol (numerik klavye)"
#: gdk/keynamesprivate.h:6869
msgctxt "keyboard label"
msgid "KP_Up"
msgstr "Yukarı (numerik klavye)"
msgstr "Up (numerik klavye)"
#: gdk/keynamesprivate.h:6870
msgctxt "keyboard label"
@@ -360,7 +360,7 @@ msgstr "Monitör Parlaklığını Artır"
#: gdk/keynamesprivate.h:6882
msgctxt "keyboard label"
msgid "MonBrightnessDown"
msgstr "Monitör Parlaklığını Düşür"
msgstr "Monitör Parlaklığını Azalt"
#: gdk/keynamesprivate.h:6883
msgctxt "keyboard label"
@@ -370,7 +370,7 @@ msgstr "Klavye Parlaklığını Artır"
#: gdk/keynamesprivate.h:6884
msgctxt "keyboard label"
msgid "KbdBrightnessDown"
msgstr "Klavye Parlaklığını Düşür"
msgstr "Klavye Parlaklığını Azalt"
#: gdk/keynamesprivate.h:6885
msgctxt "keyboard label"
@@ -390,7 +390,7 @@ msgstr "Sesi Azalt"
#: gdk/keynamesprivate.h:6888
msgctxt "keyboard label"
msgid "AudioRaiseVolume"
msgstr "Sesi Artır"
msgstr "Sesi Yükselt"
#: gdk/keynamesprivate.h:6889
msgctxt "keyboard label"
@@ -1251,7 +1251,7 @@ msgstr "Meta"
#: gtk/gtkaccelgroup.c:942
msgctxt "keyboard label"
msgid "KP"
msgstr "NK"
msgstr "Numerik Klavye"
#: gtk/gtkaccelgroup.c:949
msgctxt "keyboard label"
@@ -6135,7 +6135,7 @@ msgstr "Yazı tipi adı ara"
#: gtk/ui/gtkfontchooserwidget.ui:79
msgid "Filter by"
msgstr "_Süzgeç"
msgstr "Süzgeç"
#: gtk/ui/gtkfontchooserwidget.ui:89
msgid "Monospace"
+1
View File
@@ -500,6 +500,7 @@ test_iter (void)
g_assert_false (gtk_bitset_iter_next (&iter, &value));
ret = gtk_bitset_iter_init_at (&iter, set, 0, &value);
g_assert_false (ret);
g_assert_false (gtk_bitset_iter_is_valid (&iter));
g_assert_cmpuint (gtk_bitset_iter_get_value (&iter), ==, 0);
+7 -12
View File
@@ -55,9 +55,8 @@ recent_manager_add (void)
recent_data->app_exec = (char *)"testrecentchooser %u";
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
{
res = gtk_recent_manager_add_full (manager,
uri,
recent_data);
res = gtk_recent_manager_add_full (manager, uri, recent_data);
g_assert_false (res);
}
g_test_trap_assert_failed ();
@@ -67,9 +66,8 @@ recent_manager_add (void)
recent_data->app_exec = (char *)"testrecentchooser %u";
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
{
res = gtk_recent_manager_add_full (manager,
uri,
recent_data);
res = gtk_recent_manager_add_full (manager, uri, recent_data);
g_assert_false (res);
}
g_test_trap_assert_failed ();
@@ -79,9 +77,8 @@ recent_manager_add (void)
recent_data->app_exec = NULL;
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
{
res = gtk_recent_manager_add_full (manager,
uri,
recent_data);
res = gtk_recent_manager_add_full (manager, uri, recent_data);
g_assert_false (res);
}
g_test_trap_assert_failed ();
@@ -90,9 +87,7 @@ recent_manager_add (void)
recent_data->mime_type = (char *)"text/plain";
recent_data->app_name = (char *)"testrecentchooser";
recent_data->app_exec = (char *)"testrecentchooser %u";
res = gtk_recent_manager_add_full (manager,
uri,
recent_data);
res = gtk_recent_manager_add_full (manager, uri, recent_data);
g_assert_true (res);
g_slice_free (GtkRecentData, recent_data);
+2
View File
@@ -39,6 +39,8 @@ test_trigger_basic (void)
trigger = gtk_never_trigger_get ();
g_assert_true (GTK_IS_SHORTCUT_TRIGGER (trigger));
trigger = gtk_keyval_trigger_new (GDK_KEY_a, GDK_CONTROL_MASK);
g_assert_cmpint (gtk_keyval_trigger_get_keyval (GTK_KEYVAL_TRIGGER (trigger)), ==, GDK_KEY_a);
g_assert_cmpint (gtk_keyval_trigger_get_modifiers (GTK_KEYVAL_TRIGGER (trigger)), ==, GDK_CONTROL_MASK);