Compare commits

..

2 Commits

Author SHA1 Message Date
Matthias Clasen c445db8f62 tests: Less linking
Build just a few binaries for the gsk tests,
avoiding the overhead of linking each one.
2023-01-12 20:43:58 -05:00
Matthias Clasen 9b635cae28 tests: Less linking
Build just a few binaries for the gdk tests,
avoiding the overhead of linking each one.
2023-01-12 20:11:14 -05:00
100 changed files with 2722 additions and 3074 deletions
+2 -10
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 -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
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 ${COMMON_MESON_FLAGS}
- meson setup
-Dx11-backend=false
-Dbroadway-backend=true
-Dmacos-backend=true
@@ -215,10 +215,6 @@ 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:
@@ -391,10 +387,6 @@ 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/
+22 -54
View File
@@ -1,11 +1,11 @@
/* Pickers and Launchers
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog, GtkFileLauncher, GtkUriLauncher
/* Pickers
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog
*
* The dialogs are mainly intended for use in preference dialogs.
* These widgets are mainly intended for use in preference dialogs.
* They allow to select colors, fonts and applications.
*
* The launchers let you open files or URIs in applications that
* can handle them.
* This demo shows both the default appearance for these dialogs,
* as well as some of the customizations that are possible.
*/
#include <gtk/gtk.h>
@@ -73,9 +73,9 @@ open_file (GtkButton *picker,
}
static void
open_app_done (GObject *source,
GAsyncResult *result,
gpointer data)
launch_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkFileLauncher *launcher = GTK_FILE_LAUNCHER (source);
GError *error = NULL;
@@ -97,35 +97,7 @@ 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, 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);
gtk_file_launcher_launch (launcher, parent, NULL, launch_done, NULL);
g_object_unref (launcher);
}
@@ -141,7 +113,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 and Launchers");
gtk_window_set_title (GTK_WINDOW (window), "Pickers");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
table = gtk_grid_new ();
@@ -149,8 +121,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), 6);
gtk_grid_set_column_spacing (GTK_GRID (table), 6);
gtk_grid_set_row_spacing (GTK_GRID (table), 3);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_window_set_child (GTK_WINDOW (window), table);
label = gtk_label_new ("Color:");
@@ -177,7 +149,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, 6);
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
button = gtk_button_new_from_icon_name ("document-open-symbolic");
label = gtk_label_new ("None");
gtk_label_set_xalign (GTK_LABEL (label), 0.);
@@ -186,23 +158,19 @@ 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_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);
gtk_grid_attach (GTK_GRID (table), app_picker, 1, 4, 1, 1);
}
if (!gtk_widget_get_visible (window))
-68
View File
@@ -2056,67 +2056,6 @@ 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)
{
@@ -2216,13 +2155,6 @@ 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");
+6 -3
View File
@@ -1263,7 +1263,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture" id="notebook_sunset">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
<property name="content-fit">cover</property>
<child>
<object class="GtkDragSource">
@@ -1289,7 +1290,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture" id="notebook_nyc">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/nyc.jpg</property>
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
@@ -1314,7 +1316,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture" id="notebook_beach">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/beach.jpg</property>
<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/"
+22 -16
View File
@@ -236,17 +236,23 @@ 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.
### `media-gstreamer` and `media-ffmpeg`
### `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`
By default, GTK will try to build the gstreamer backend for
media playback support. These option can be used to explicitly
media playback support. This option can be used to explicitly
control which media backends should be built.
### `print-cups`
### `print`
By default, GTK will try to build various print backends
if their dependencies are found. This option can be used
to explicitly control whether the cups print backend should be built.
to explicitly control which print backends should be built.
### `cloudproviders`
@@ -268,13 +274,18 @@ support in the file chooser.
This option controls whether GTK should use colord for color
calibration support in the cups print backend.
### `gtk_doc`, `man-pages` and `update_screenshots`
### `gtk_doc` and `man-pages`
The *gi-docgen* package is used to generate the reference documentation
included with GTK. By default support for *gi-docgen* is disabled
The *gtk-doc* package is used to generate the reference documentation
included with GTK. By default support for *gtk-doc* is disabled
because it requires various extra dependencies to be installed.
Introspection needs to be enabled, since the documentation is generated
from introspection data.
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`
@@ -283,14 +294,9 @@ is mainly useful for shortening turnaround times on developer
systems. Installed builds of GTK should always have introspection
support.
### `build-testsuite`
### `build-tests`, `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.
By default, GTK will build quite a few tests 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,7 +105,3 @@ 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;
+2 -5
View File
@@ -621,11 +621,8 @@ gdk_frame_clock_paint_idle (void *data)
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
}
#ifdef G_ENABLE_DEBUG
if (GDK_DEBUG_CHECK (FRAMES))
{
if (timings)
timings->frame_end_time = g_get_monotonic_time ();
}
if (GDK_DEBUG_CHECK (FRAMES))
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, JPEG and TIFF, though more formats might be available.
* are PNG and JPEG, 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, JPEG and TIFF, though more formats might be available.
* are PNG and JPEG, 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, JPEG and TIFF, though more formats might be available.
* are PNG and JPEG, though more formats might be available.
*
* If %NULL is returned, then @error will be set.
*
-4
View File
@@ -23,10 +23,6 @@
#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)
gdk_intern_mime_type (special_targets[i].mime_type);
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_UNUSED G_GNUC_NULL_TERMINATED static inline GBytes *
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”.
*
+3 -6
View File
@@ -99,8 +99,7 @@ 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] or
* [method@Gtk.UriLauncher.launch] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] instead
*/
void
gtk_show_uri_full (GtkWindow *parent,
@@ -148,8 +147,7 @@ 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] or
* [method@Gtk.UriLauncher.launch_finish] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch_finish] instead
*/
gboolean
gtk_show_uri_full_finish (GtkWindow *parent,
@@ -193,8 +191,7 @@ 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] or
* [method@Gtk.UriLauncher.launch] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.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:
+8 -10
View File
@@ -587,12 +587,10 @@ 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
{
@@ -612,15 +610,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;
}
+11 -55
View File
@@ -103,7 +103,6 @@ enum {
typedef struct {
GtkWindow *parent;
GFile *file;
char *uri;
gboolean open_folder;
GDBusConnection *connection;
GCancellable *cancellable;
@@ -126,7 +125,6 @@ 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);
@@ -260,13 +258,14 @@ canceled (GCancellable *cancellable,
}
static void
open_uri (OpenUriData *data,
open_uri (GFile *file,
gboolean open_folder,
const char *parent_window,
const char *activation_token,
GAsyncReadyCallback callback)
GAsyncReadyCallback callback,
gpointer user_data)
{
GFile *file = data->file;
gboolean open_folder = data->open_folder;
OpenUriData *data = user_data;
GTask *task;
GVariant *opts = NULL;
int i;
@@ -278,9 +277,9 @@ open_uri (OpenUriData *data,
connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (openuri));
data->connection = g_object_ref (connection);
task = g_task_new (NULL, NULL, callback, data);
task = g_task_new (NULL, NULL, callback, user_data);
g_task_set_check_cancellable (task, FALSE);
g_task_set_task_data (task, data, NULL);
g_task_set_task_data (task, user_data, NULL);
if (data->cancellable)
data->cancel_handler = g_signal_connect (data->cancellable, "cancelled", G_CALLBACK (canceled), task);
@@ -313,7 +312,7 @@ open_uri (OpenUriData *data,
opts = g_variant_builder_end (&opt_builder);
if (file && g_file_is_native (file))
if (g_file_is_native (file))
{
const char *path = NULL;
GUnixFDList *fd_list = NULL;
@@ -367,15 +366,12 @@ open_uri (OpenUriData *data,
}
else
{
char *uri = NULL;
if (file)
uri = g_file_get_uri (file);
char *uri = g_file_get_uri (file);
data->call = OPEN_URI;
gxdp_open_uri_call_open_uri (openuri,
parent_window ? parent_window : "",
uri ? uri : data->uri,
uri,
opts,
NULL,
open_call_done,
@@ -435,7 +431,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, handle, activation_token, open_uri_done);
open_uri (data->file, data->open_folder, handle, activation_token, open_uri_done, data);
g_free (activation_token);
}
@@ -475,45 +471,5 @@ 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,15 +38,6 @@ 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,7 +286,6 @@
#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>
+7 -4
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,13 +932,16 @@ static gboolean
gtk_about_dialog_activate_link (GtkAboutDialog *about,
const char *uri)
{
GtkUriLauncher *launcher;
GtkFileLauncher *launcher;
GFile *file;
launcher = gtk_uri_launcher_new (uri);
file = g_file_new_for_uri (uri);
launcher = gtk_file_launcher_new (file);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (about), NULL, NULL, NULL);
gtk_file_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,7 +1325,9 @@ 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++)
{
+1 -4
View File
@@ -937,12 +937,9 @@ 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)
if (timestamp == 0 || timestamp == source->current_time)
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:
*
+3 -7
View File
@@ -29,8 +29,8 @@
/**
* GtkFileLauncher:
*
* A `GtkFileLauncher` object collects the arguments that are needed to open a
* file with an application.
* A `GtkFileLauncher` 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
@@ -40,8 +40,6 @@
* 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
*/
@@ -72,9 +70,7 @@ gtk_file_launcher_init (GtkFileLauncher *self)
static void
gtk_file_launcher_finalize (GObject *object)
{
GtkFileLauncher *self = GTK_FILE_LAUNCHER (object);
g_clear_object (&self->file);
//GtkFileLauncher *self = GTK_FILE_LAUNCHER (object);
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,8 +627,6 @@ 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;
}
@@ -871,8 +869,6 @@ 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,35 +130,10 @@ 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 (g_str_hash, g_str_equal);
set->hash = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
set->chunks = NULL;
set->used_in_chunk = STRING_SET_CHUNK_SIZE; /* To trigger a grow directly */
}
@@ -331,8 +306,6 @@ 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;
@@ -436,6 +409,7 @@ typedef struct
GArray *dir_sizes; /* IconThemeDirSize */
GArray *dirs; /* IconThemeDir */
GtkStringSet icons;
} IconTheme;
typedef struct
@@ -491,6 +465,8 @@ 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,
@@ -501,8 +477,7 @@ static gboolean rescan_themes (GtkIconTheme *sel
static GtkIconPaintable *icon_paintable_new (const char *icon_name,
int desired_size,
int desired_scale);
static inline IconCacheFlag
suffix_from_name (const char *name);
static 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);
@@ -1383,7 +1358,6 @@ 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;
@@ -1860,25 +1834,34 @@ free_unthemed_icon (UnthemedIcon *unthemed_icon)
g_slice_free (UnthemedIcon, unthemed_icon);
}
static inline void
strip_suffix_inline (char *filename,
IconCacheFlag suffix)
static void
strip_suffix_inline (char *filename)
{
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;
char *dot;
if (g_str_has_suffix (filename, ".symbolic.png"))
filename[strlen(filename)-13] = 0;
dot = strrchr (filename, '.');
if (dot != NULL)
*dot = 0;
}
static inline char *
strip_suffix (const char *filename,
IconCacheFlag suffix)
static char *
strip_suffix (const char *filename)
{
char *dup = g_strdup (filename);
strip_suffix_inline (dup, suffix);
return dup;
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);
}
static void
@@ -1898,7 +1881,7 @@ add_unthemed_icon (GtkIconTheme *self,
return;
abs_file = g_build_filename (dir, file, NULL);
base_name = strip_suffix (file, new_suffix);
base_name = strip_suffix (file);
unthemed_icon = g_hash_table_lookup (self->unthemed_icons, base_name);
@@ -1956,8 +1939,6 @@ 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);
@@ -2033,8 +2014,6 @@ load_themes (GtkIconTheme *self)
}
gdk_debug_message ("%s", s->str);
g_string_free (s, TRUE);
dump_string_set (&self->icons);
}
#endif
}
@@ -2180,13 +2159,10 @@ 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 = 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;
}
icon_name = icon_names[i];
icon = theme_lookup_icon (theme, icon_name, size, scale, self->pixbuf_supports_svg);
if (icon)
goto out;
}
}
@@ -2196,13 +2172,10 @@ real_choose_icon (GtkIconTheme *self,
for (i = 0; icon_names[i]; i++)
{
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;
}
icon_name = icon_names[i];
icon = theme_lookup_icon (theme, icon_name, size, scale, self->pixbuf_supports_svg);
if (icon)
goto out;
}
}
@@ -2583,6 +2556,7 @@ 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);
@@ -2592,10 +2566,13 @@ gtk_icon_theme_has_icon (GtkIconTheme *self,
ensure_valid_themes (self, FALSE);
if (gtk_string_set_lookup (&self->icons, icon_name) != NULL)
for (l = self->themes; l; l = l->next)
{
res = TRUE;
goto out;
if (theme_has_icon (l->data, icon_name))
{
res = TRUE;
goto out;
}
}
out:
@@ -2634,10 +2611,13 @@ gtk_icon_theme_has_gicon (GtkIconTheme *self,
for (int i = 0; names[i]; i++)
{
if (gtk_string_set_lookup (&self->icons, names[i]) != NULL)
for (GList *l = self->themes; l; l = l->next)
{
res = TRUE;
goto out;
if (theme_has_icon (l->data, names[i]))
{
res = TRUE;
goto out;
}
}
}
@@ -2683,7 +2663,6 @@ 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);
@@ -2693,11 +2672,10 @@ 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++)
{
@@ -2754,15 +2732,25 @@ 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);
g_hash_table_foreach (self->unthemed_icons, add_key_to_hash, 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);
names = g_new (char *, g_hash_table_size (icons) + 1);
@@ -2821,6 +2809,7 @@ 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);
@@ -2851,6 +2840,8 @@ 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);
}
@@ -3049,6 +3040,13 @@ 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;
@@ -3108,6 +3106,13 @@ 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,
@@ -3133,13 +3138,14 @@ scan_directory (GtkIconTheme *self,
if (suffix == ICON_CACHE_FLAG_NONE)
continue;
strip_suffix_inline ((char *)name, suffix);
strip_suffix_inline ((char *)name);
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));
}
@@ -3176,10 +3182,11 @@ 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, suffix);
strip_suffix_inline (name);
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));
}
@@ -3319,7 +3326,6 @@ 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)
@@ -3367,22 +3373,18 @@ 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 */
g_string_assign (str, dir_mtime->dir);
if (str->str[str->len - 1] != '/')
g_string_append_c (str, '/');
g_string_append (str, subdir);
full_dir = g_build_filename (dir_mtime->dir, subdir, NULL);
/* First, see if we have a cache for the directory */
if (dir_mtime->cache != NULL || g_file_test (str->str, G_FILE_TEST_IS_DIR))
if (dir_mtime->cache != NULL || g_file_test (full_dir, G_FILE_TEST_IS_DIR))
{
GHashTable *icons = NULL;
@@ -3393,52 +3395,50 @@ theme_subdir_load (GtkIconTheme *self,
}
if (dir_mtime->cache != NULL)
icons = gtk_icon_cache_list_icons_in_directory (dir_mtime->cache, subdir, &self->icons);
icons = gtk_icon_cache_list_icons_in_directory (dir_mtime->cache, subdir, &theme->icons);
else
icons = scan_directory (self, str->str, &self->icons);
icons = scan_directory (self, full_dir, &theme->icons);
if (icons)
{
theme_add_dir_with_icons (theme,
dir_size,
FALSE,
g_strdup (str->str),
g_steal_pointer (&full_dir),
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 */
if (str->str[str->len - 1] != '/')
g_string_append_c (str, '/');
full_dir = g_build_filename (self->resource_path[r], subdir, " ", NULL);
full_dir[strlen (full_dir) - 1] = '\0';
icons = scan_resource_directory (self, str->str, &self->icons);
icons = scan_resource_directory (self, full_dir, &theme->icons);
if (icons)
{
theme_add_dir_with_icons (theme,
dir_size,
TRUE,
g_strdup (str->str),
g_steal_pointer (&full_dir),
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 ? load_error->message : "");
g_warning ("Failed to load icon %s: %s", icon->filename, 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");
+8 -5
View File
@@ -40,6 +40,7 @@
#include "gtkshortcut.h"
#include "gtkshortcutcontroller.h"
#include "gtkshortcuttrigger.h"
#include "gtkfilelauncher.h"
#include "gtksnapshot.h"
#include "gtkrenderbackgroundprivate.h"
#include "gtkrenderborderprivate.h"
@@ -47,7 +48,6 @@
#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,14 +2102,17 @@ gtk_label_activate_link (GtkLabel *self,
{
GtkWidget *widget = GTK_WIDGET (self);
GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
GtkUriLauncher *launcher;
GFile *file;
GtkFileLauncher *launcher;
if (!GTK_IS_WINDOW (toplevel))
return FALSE;
launcher = gtk_uri_launcher_new (uri);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
file = g_file_new_for_uri (uri);
launcher = gtk_file_launcher_new (file);
gtk_file_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
*
+7 -4
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,13 +479,16 @@ static gboolean
gtk_link_button_activate_link (GtkLinkButton *link_button)
{
GtkWidget *toplevel;
GtkUriLauncher *launcher;
GFile *file;
GtkFileLauncher *launcher;
toplevel = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (link_button)));
launcher = gtk_uri_launcher_new (link_button->uri);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (toplevel), NULL, NULL, NULL);
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);
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
+5 -3
View File
@@ -146,16 +146,18 @@ 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;
count = g_strv_length (paths);
for (path = paths; *path; path++)
count++;
result = g_new (char *, count * 4 + 1);
count = 0;
for (path = paths; *path; path++)
for (path = get_module_path (); *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
+348 -164
View File
@@ -198,13 +198,9 @@ enum {
PROP_RECENT_FILES_ENABLED,
PROP_LONG_PRESS_TIME,
PROP_KEYNAV_USE_CARET,
PROP_OVERLAY_SCROLLING,
NUM_PROPERTIES
PROP_OVERLAY_SCROLLING
};
static GParamSpec *pspecs[NUM_PROPERTIES] = { NULL, };
/* --- prototypes --- */
static void gtk_settings_provider_iface_init (GtkStyleProviderInterface *iface);
@@ -219,6 +215,8 @@ 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);
@@ -240,6 +238,8 @@ 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,29 +252,42 @@ 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 ();
settings->property_values = g_new0 (GtkSettingsPropertyValue, NUM_PROPERTIES - 1);
/* 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);
g_object_freeze_notify (G_OBJECT (settings));
for (i = 1; i < NUM_PROPERTIES; i++)
i = 0;
for (p = pspecs; *p; p++)
{
GParamSpec *pspec = pspecs[i];
GParamSpec *pspec = *p;
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
g_value_init (&settings->property_values[i - 1].value, value_type);
g_param_value_set_default (pspec, &settings->property_values[i - 1].value);
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_object_notify_by_pspec (G_OBJECT (settings), pspec);
settings->property_values[i - 1].source = GTK_SETTINGS_SOURCE_DEFAULT;
settings->property_values[i].source = GTK_SETTINGS_SOURCE_DEFAULT;
i++;
}
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);
@@ -322,9 +335,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* The maximum time to allow between two clicks for them to be considered
* a double click, in milliseconds.
*/
pspecs[PROP_DOUBLE_CLICK_TIME] = g_param_spec_int ("gtk-double-click-time", NULL, NULL,
0, G_MAXINT, 400,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-double-click-distance:
@@ -332,9 +347,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* The maximum distance allowed between two clicks for them to be considered
* a double click, in pixels.
*/
pspecs[PROP_DOUBLE_CLICK_DISTANCE] = g_param_spec_int ("gtk-double-click-distance", NULL, NULL,
0, G_MAXINT, 5,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-cursor-blink:
@@ -344,18 +361,22 @@ 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.
*/
pspecs[PROP_CURSOR_BLINK] = g_param_spec_boolean ("gtk-cursor-blink", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-cursor-blink-time:
*
* Length of the cursor blink cycle, in milliseconds.
*/
pspecs[PROP_CURSOR_BLINK_TIME] = g_param_spec_int ("gtk-cursor-blink-time", NULL, NULL,
100, G_MAXINT, 1200,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-cursor-blink-timeout:
@@ -367,9 +388,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Setting this to zero has the same effect as setting
* [property@Gtk.Settings:gtk-cursor-blink] to %FALSE.
*/
pspecs[PROP_CURSOR_BLINK_TIMEOUT] = g_param_spec_int ("gtk-cursor-blink-timeout", NULL, NULL,
1, G_MAXINT, 10,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-split-cursor:
@@ -377,18 +400,22 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Whether two cursors should be displayed for mixed left-to-right and
* right-to-left text.
*/
pspecs[PROP_SPLIT_CURSOR] = g_param_spec_boolean ("gtk-split-cursor", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-cursor-aspect-ratio:
*
* The aspect ratio of the text caret.
*/
pspecs[PROP_CURSOR_ASPECT_RATIO] = g_param_spec_double ("gtk-cursor-aspect-ratio", NULL, NULL,
0.0, 1.0, 0.04,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-theme-name:
@@ -398,9 +425,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* See [class@Gtk.CssProvider] for details about how
* GTK finds the CSS stylesheet for a theme.
*/
pspecs[PROP_THEME_NAME] = g_param_spec_string ("gtk-theme-name", NULL, NULL,
DEFAULT_THEME_NAME,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-icon-theme-name:
@@ -410,18 +439,22 @@ gtk_settings_class_init (GtkSettingsClass *class)
* See [class@Gtk.IconTheme] for details about how
* GTK handles icon themes.
*/
pspecs[PROP_ICON_THEME_NAME] = g_param_spec_string ("gtk-icon-theme-name", NULL, NULL,
DEFAULT_ICON_THEME,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-dnd-drag-threshold:
*
* The number of pixels the cursor can move before dragging.
*/
pspecs[PROP_DND_DRAG_THRESHOLD] = g_param_spec_int ("gtk-dnd-drag-threshold", NULL, NULL,
1, G_MAXINT, 8,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-font-name:
@@ -430,9 +463,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* GTK uses the family name and size from this string.
*/
pspecs[PROP_FONT_NAME] = g_param_spec_string ("gtk-font-name", NULL, NULL,
"Sans 10",
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-xft-antialias:
@@ -441,9 +476,12 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* The values are 0 for no, 1 for yes, or -1 for the system default.
*/
pspecs[PROP_XFT_ANTIALIAS] = g_param_spec_int ("gtk-xft-antialias", NULL, NULL,
-1, 1, -1,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-xft-hinting:
@@ -452,9 +490,12 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* The values are 0 for no, 1 for yes, or -1 for the system default.
*/
pspecs[PROP_XFT_HINTING] = g_param_spec_int ("gtk-xft-hinting", NULL, NULL,
-1, 1, -1,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-xft-hintstyle:
@@ -464,9 +505,12 @@ gtk_settings_class_init (GtkSettingsClass *class)
* The possible vaues are hintnone, hintslight,
* hintmedium, hintfull.
*/
pspecs[PROP_XFT_HINTSTYLE] = g_param_spec_string ("gtk-xft-hintstyle", NULL, NULL,
NULL,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-xft-rgba:
@@ -475,10 +519,14 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* The possible values are none, rgb, bgr, vrgb, vbgr.
*/
pspecs[PROP_XFT_RGBA] = g_param_spec_string ("gtk-xft-rgba", NULL, NULL,
NULL,
GTK_PARAM_READWRITE);
result = settings_install_property_parser (class,
g_param_spec_string ("gtk-xft-rgba", NULL, NULL,
NULL,
GTK_PARAM_READWRITE));
g_assert (result == PROP_XFT_RGBA);
/**
* GtkSettings:gtk-xft-dpi:
*
@@ -486,9 +534,12 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* -1 to use the default value.
*/
pspecs[PROP_XFT_DPI] = g_param_spec_int ("gtk-xft-dpi", NULL, NULL,
-1, 1024*1024, -1,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-hint-font-metrics:
@@ -500,9 +551,12 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* Since: 4.6
*/
pspecs[PROP_HINT_FONT_METRICS] = g_param_spec_boolean ("gtk-hint-font-metrics", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-cursor-theme-name:
@@ -511,9 +565,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* Use %NULL to use the default theme.
*/
pspecs[PROP_CURSOR_THEME_NAME] = g_param_spec_string ("gtk-cursor-theme-name", NULL, NULL,
NULL,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-cursor-theme-size:
@@ -522,18 +578,23 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* 0 means to use the default size.
*/
pspecs[PROP_CURSOR_THEME_SIZE] = g_param_spec_int ("gtk-cursor-theme-size", NULL, NULL,
0, 128, 0,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-alternative-button-order:
*
* Whether buttons in dialogs should use the alternative button order.
*/
pspecs[PROP_ALTERNATIVE_BUTTON_ORDER] = g_param_spec_boolean ("gtk-alternative-button-order", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-alternative-sort-arrows:
@@ -544,18 +605,23 @@ 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.
*/
pspecs[PROP_ALTERNATIVE_SORT_ARROWS] = g_param_spec_boolean ("gtk-alternative-sort-arrows", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-enable-animations:
*
* Whether to enable toolkit-wide animations.
*/
pspecs[PROP_ENABLE_ANIMATIONS] = g_param_spec_boolean ("gtk-enable-animations", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-error-bell:
@@ -567,9 +633,12 @@ 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.
*/
pspecs[PROP_ERROR_BELL] = g_param_spec_boolean ("gtk-error-bell", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-print-backends:
@@ -580,9 +649,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Available print backends depend on the GTK installation,
* and may include "file", "cups", "lpr" or "papi".
*/
pspecs[PROP_PRINT_BACKENDS] = g_param_spec_string ("gtk-print-backends", NULL, NULL,
GTK_PRINT_BACKENDS,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-print-preview-command:
@@ -598,9 +669,11 @@ 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.
*/
pspecs[PROP_PRINT_PREVIEW_COMMAND] = g_param_spec_string ("gtk-print-preview-command", NULL, NULL,
PRINT_PREVIEW_COMMAND,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-enable-accels:
@@ -608,9 +681,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Whether menu items should have visible accelerators which can be
* activated.
*/
pspecs[PROP_ENABLE_ACCELS] = g_param_spec_boolean ("gtk-enable-accels", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-im-module:
@@ -624,9 +699,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* See [class@Gtk.IMContext].
*/
pspecs[PROP_IM_MODULE] = g_param_spec_string ("gtk-im-module", NULL, NULL,
NULL,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-recent-files-max-age:
@@ -638,19 +715,24 @@ 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.
*/
pspecs[PROP_RECENT_FILES_MAX_AGE] = g_param_spec_int ("gtk-recent-files-max-age", NULL, NULL,
-1, G_MAXINT,
30,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-fontconfig-timestamp:
*
* Timestamp of the current fontconfig configuration.
*/
pspecs[PROP_FONTCONFIG_TIMESTAMP] = g_param_spec_uint ("gtk-fontconfig-timestamp", NULL, NULL,
0, G_MAXUINT, 0,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-sound-theme-name:
@@ -663,9 +745,11 @@ 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.
*/
pspecs[PROP_SOUND_THEME_NAME] = g_param_spec_string ("gtk-sound-theme-name", NULL, NULL,
"freedesktop",
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-enable-input-feedback-sounds:
@@ -678,9 +762,11 @@ 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.
*/
pspecs[PROP_ENABLE_INPUT_FEEDBACK_SOUNDS] = g_param_spec_boolean ("gtk-enable-input-feedback-sounds", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-enable-event-sounds:
@@ -693,9 +779,11 @@ 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.
*/
pspecs[PROP_ENABLE_EVENT_SOUNDS] = g_param_spec_boolean ("gtk-enable-event-sounds", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-primary-button-warps-slider:
@@ -711,9 +799,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* be available by holding Shift and primary-clicking, or clicking the middle
* mouse button.
*/
pspecs[PROP_PRIMARY_BUTTON_WARPS_SLIDER] = g_param_spec_boolean ("gtk-primary-button-warps-slider", NULL, NULL,
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-primary-button-warps-slider", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
GTK_PARAM_READWRITE));
g_assert (result == PROP_PRIMARY_BUTTON_WARPS_SLIDER);
/**
* GtkSettings:gtk-application-prefer-dark-theme:
@@ -733,18 +823,22 @@ gtk_settings_class_init (GtkSettingsClass *class)
* are white/light and the dark chrome creates too much contrast
* (web browser, text editor...).
*/
pspecs[PROP_APPLICATION_PREFER_DARK_THEME] = g_param_spec_boolean ("gtk-application-prefer-dark-theme", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gkt-entry-select-on-focus:
*
* Whether to select the contents of an entry when it is focused.
*/
pspecs[PROP_ENTRY_SELECT_ON_FOCUS] = g_param_spec_boolean ("gtk-entry-select-on-focus", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-entry-password-hint-timeout:
@@ -755,10 +849,12 @@ 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.
*/
pspecs[PROP_ENTRY_PASSWORD_HINT_TIMEOUT] = g_param_spec_uint ("gtk-entry-password-hint-timeout", NULL, NULL,
result = settings_install_property_parser (class,
g_param_spec_uint ("gtk-entry-password-hint-timeout", NULL, NULL,
0, G_MAXUINT,
0,
GTK_PARAM_READWRITE);
GTK_PARAM_READWRITE));
g_assert (result == PROP_ENTRY_PASSWORD_HINT_TIMEOUT);
/**
* GtkSettings:gtk-label-select-on-focus:
@@ -766,9 +862,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Whether to select the contents of a selectable
* label when it is focused.
*/
pspecs[PROP_LABEL_SELECT_ON_FOCUS] = g_param_spec_boolean ("gtk-label-select-on-focus", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-shell-shows-app-menu:
@@ -776,9 +874,10 @@ 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.
*/
pspecs[PROP_SHELL_SHOWS_APP_MENU] = g_param_spec_boolean ("gtk-shell-shows-app-menu", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-shell-shows-menubar:
@@ -786,9 +885,10 @@ 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.
*/
pspecs[PROP_SHELL_SHOWS_MENUBAR] = g_param_spec_boolean ("gtk-shell-shows-menubar", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-shell-shows-desktop:
@@ -796,9 +896,10 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Set to %TRUE if the desktop environment is displaying
* the desktop folder, %FALSE if not.
*/
pspecs[PROP_SHELL_SHOWS_DESKTOP] = g_param_spec_boolean ("gtk-shell-shows-desktop", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-decoration-layout:
@@ -824,9 +925,10 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Also note that the setting can be overridden with the
* [property@Gtk.HeaderBar:decoration-layout] property.
*/
pspecs[PROP_DECORATION_LAYOUT] = g_param_spec_string ("gtk-decoration-layout", NULL, NULL,
"menu:minimize,maximize,close",
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-titlebar-double-click:
@@ -837,9 +939,10 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Recognized actions are minimize, toggle-maximize, menu, lower
* or none.
*/
pspecs[PROP_TITLEBAR_DOUBLE_CLICK] = g_param_spec_string ("gtk-titlebar-double-click", NULL, NULL,
"toggle-maximize",
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-titlebar-middle-click:
@@ -850,9 +953,10 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Recognized actions are minimize, toggle-maximize, menu, lower
* or none.
*/
pspecs[PROP_TITLEBAR_MIDDLE_CLICK] = g_param_spec_string ("gtk-titlebar-middle-click", NULL, NULL,
"none",
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-titlebar-right-click:
@@ -863,9 +967,10 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Recognized actions are minimize, toggle-maximize, menu, lower
* or none.
*/
pspecs[PROP_TITLEBAR_RIGHT_CLICK] = g_param_spec_string ("gtk-titlebar-right-click", NULL, NULL,
"menu",
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-dialogs-use-header:
@@ -877,9 +982,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* This setting does not affect custom dialogs using `GtkDialog`
* directly, or message dialogs.
*/
pspecs[PROP_DIALOGS_USE_HEADER] = g_param_spec_boolean ("gtk-dialogs-use-header", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-enable-primary-paste:
@@ -887,9 +994,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* Whether a middle click on a mouse should paste the
* 'PRIMARY' clipboard content at the cursor location.
*/
pspecs[PROP_ENABLE_PRIMARY_PASTE] = g_param_spec_boolean ("gtk-enable-primary-paste", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-recent-files-enabled:
@@ -899,9 +1008,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* If set to %FALSE, the list will always be empty.
*/
pspecs[PROP_RECENT_FILES_ENABLED] = g_param_spec_boolean ("gtk-recent-files-enabled", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-long-press-time:
@@ -910,9 +1021,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* See [class@Gtk.GestureLongPress].
*/
pspecs[PROP_LONG_PRESS_TIME] = g_param_spec_uint ("gtk-long-press-time", NULL, NULL,
0, G_MAXINT, 500,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-keynav-use-caret:
@@ -922,9 +1035,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
*
* This is useful when using a screen reader.
*/
pspecs[PROP_KEYNAV_USE_CARET] = g_param_spec_boolean ("gtk-keynav-use-caret", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
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);
/**
* GtkSettings:gtk-overlay-scrolling:
@@ -934,11 +1049,11 @@ gtk_settings_class_init (GtkSettingsClass *class)
* If this is set to %FALSE, scrolled windows will have permanent
* scrollbars.
*/
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);
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);
}
static GtkSettings *
@@ -959,8 +1074,10 @@ gtk_settings_finalize (GObject *object)
GtkSettings *settings = GTK_SETTINGS (object);
guint i;
for (i = 1; i < NUM_PROPERTIES; i++)
g_value_unset (&settings->property_values[i - 1].value);
object_list = g_slist_remove (object_list, settings);
for (i = 0; i < class_n_properties; i++)
g_value_unset (&settings->property_values[i].value);
g_free (settings->property_values);
g_datalist_clear (&settings->queued_settings);
@@ -1314,6 +1431,70 @@ 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)
{
@@ -1827,10 +2008,13 @@ 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.
*
+2 -8
View File
@@ -30,7 +30,6 @@ 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
@@ -84,11 +83,7 @@ gtk_style_cascade_iter_init (GtkStyleCascade *cascade,
while ((cas = cas->parent) != NULL)
iter->n_cascades++;
if (iter->n_cascades < 20)
iter->cascade_index = iter->index_;
else
iter->cascade_index = g_new (int, iter->n_cascades);
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;
@@ -98,8 +93,7 @@ gtk_style_cascade_iter_init (GtkStyleCascade *cascade,
static void
gtk_style_cascade_iter_clear (GtkStyleCascadeIter *iter)
{
if (iter->cascade_index != iter->index_)
g_free (iter->cascade_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
+1 -6
View File
@@ -66,8 +66,6 @@ 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,
@@ -419,10 +417,7 @@ update_label_width (GtkLabel *label)
len = g_utf8_strlen (text, -1);
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_max_width_chars (label, MIN (len, 50));
gtk_label_set_wrap (label, TRUE);
}
}
-339
View File
@@ -1,339 +0,0 @@
/*
* 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
@@ -1,57 +0,0 @@
/* 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: (nullable): parameter for activation
* @parameter: 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,7 +390,6 @@ gtk_public_sources = files([
'gtktreeexpander.c',
'gtktreelistmodel.c',
'gtktreelistrowsorter.c',
'gtkurilauncher.c',
'gtkversion.c',
'gtkvideo.c',
'gtkviewport.c',
@@ -616,7 +615,6 @@ gtk_public_headers = files([
'gtktreelistmodel.h',
'gtktreelistrowsorter.h',
'gtktypes.h',
'gtkurilauncher.h',
'gtkvideo.h',
'gtkviewport.h',
'gtkvolumebutton.h',
-2
View File
@@ -747,8 +747,6 @@ 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,11 +114,6 @@ 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,
+864 -896
View File
File diff suppressed because it is too large Load Diff
+804 -839
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.
# Emin Tufan Çetin <etcetin@gmail.com>, 2018, 2019, 2020, 2021, 2022.
# Sabri Ünal <libreajans@gmail.com>, 2022, 2023.
# Emin Tufan Çetin <etcetin@gmail.com>, 2018-2023.
#
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: 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"
"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"
"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: Poedit 3.1.1\n"
"Plural-Forms: nplurals=1; plural=0\n"
"X-Generator: Gtranslator 42.0\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 "Çoklu Tuş"
msgstr "Compose"
#: 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 "Tab (numerik klavye)"
msgstr "Sekme (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 "Up (numerik klavye)"
msgstr "Yukarı (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ı Azalt"
msgstr "Monitör Parlaklığını Düşür"
#: 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ı Azalt"
msgstr "Klavye Parlaklığını Düşür"
#: 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 Yükselt"
msgstr "Sesi Artır"
#: gdk/keynamesprivate.h:6889
msgctxt "keyboard label"
@@ -1251,7 +1251,7 @@ msgstr "Meta"
#: gtk/gtkaccelgroup.c:942
msgctxt "keyboard label"
msgid "KP"
msgstr "Numerik Klavye"
msgstr "NK"
#: 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"
+4 -7
View File
@@ -21,6 +21,8 @@
#include <gtk/gtk.h>
#include "gdktests.h"
static void
int_free_func (int data)
{
@@ -78,12 +80,9 @@ int_free_func (int data)
#define GDK_ARRAY_NULL_TERMINATED 1
#include "arrayimpl.c"
int
main (int argc, char *argv[])
void
add_array_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
setlocale (LC_ALL, "C");
g_test_add_func ("/intarray/simple", int_array_test_simple);
g_test_add_func ("/intarray/prealloc/simple", pre_int_array_test_simple);
g_test_add_func ("/intarray/freefunc/simple", free_int_array_test_simple);
@@ -100,6 +99,4 @@ main (int argc, char *argv[])
g_test_add_func ("/intarray/null/prealloc/splice", null_pre_int_array_test_splice);
g_test_add_func ("/intarray/null/freefunc/splice", null_free_int_array_test_splice);
g_test_add_func ("/intarray/null/prealloc/freefunc/splice", null_pre_free_int_array_test_splice);
return g_test_run ();
}
+3 -7
View File
@@ -1,4 +1,5 @@
#include <gtk/gtk.h>
#include "gdktests.h"
static void
test_set_source_big_pixbuf (void)
@@ -28,13 +29,8 @@ test_set_source_big_pixbuf (void)
cairo_surface_destroy (surface);
}
int
main (int argc, char *argv[])
void
add_cairo_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
g_test_add_func ("/drawing/set-source-big-pixbuf", test_set_source_big_pixbuf);
return g_test_run ();
}
+5 -11
View File
@@ -2,6 +2,8 @@
#include <gtk/gtk.h>
#include "gdktests.h"
static GType
string_type (void)
{
@@ -218,17 +220,11 @@ test_parse_fail (void)
}
}
int
main (int argc, char *argv[])
void
add_content_formats_tests (void)
{
gsize i;
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
/* Ensure all the types we care about to exist */
for (i = 0; i < G_N_ELEMENTS(possible_types); i++)
for (gsize i = 0; i < G_N_ELEMENTS(possible_types); i++)
{
if (possible_types[i].type_func)
g_type_ensure (possible_types[i].type_func ());
@@ -238,6 +234,4 @@ main (int argc, char *argv[])
g_test_add_func ("/contentformats/parse_fail", test_parse_fail);
g_test_add_func ("/contentformats/print_and_parse", test_print_and_parse);
g_test_add_func ("/contentformats/union", test_union);
return g_test_run ();
}
+4 -8
View File
@@ -2,6 +2,8 @@
#include <gtk/gtk.h>
#include "gdktests.h"
typedef gboolean (* ValueCompareFunc) (GValue *v1, GValue *v2);
typedef struct {
@@ -463,13 +465,9 @@ test_custom_format (void)
g_free (data);
}
int
main (int argc, char *argv[])
void
add_content_serializer_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
g_test_add_func ("/content/text_plain_utf8", test_content_text_plain_utf8);
g_test_add_func ("/content/text_plain", test_content_text_plain);
g_test_add_func ("/content/color", test_content_color);
@@ -478,6 +476,4 @@ main (int argc, char *argv[])
g_test_add_func ("/content/file", test_content_file);
g_test_add_func ("/content/files", test_content_files);
g_test_add_func ("/content/custom", test_custom_format);
return g_test_run ();
}
+4 -8
View File
@@ -1,6 +1,8 @@
#include <gtk/gtk.h>
#include <cairo-gobject.h>
#include "gdktests.h"
static void
test_cursor_named (void)
{
@@ -54,16 +56,10 @@ test_cursor_fallback (void)
g_object_unref (fallback);
}
int
main (int argc, char *argv[])
void
add_cursor_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
g_test_add_func ("/cursor/named", test_cursor_named);
g_test_add_func ("/cursor/texture", test_cursor_texture);
g_test_add_func ("/cursor/fallback", test_cursor_fallback);
return g_test_run ();
}
+8 -8
View File
@@ -2,11 +2,14 @@
#include <gtk/gtk.h>
#include "gdktests.h"
static void
test_unset_display_subprocess1 (void)
{
GdkDisplayManager *manager;
gdk_set_allowed_backends ("x11");
g_unsetenv ("DISPLAY");
g_assert_false (gtk_init_check ());
@@ -18,6 +21,7 @@ test_unset_display_subprocess1 (void)
static void
test_unset_display_subprocess2 (void)
{
gdk_set_allowed_backends ("x11");
g_unsetenv ("DISPLAY");
gtk_init ();
@@ -39,6 +43,7 @@ test_bad_display_subprocess1 (void)
{
GdkDisplayManager *manager;
gdk_set_allowed_backends ("x11");
g_setenv ("DISPLAY", "poo", TRUE);
g_assert_false (gtk_init_check ());
@@ -50,6 +55,7 @@ test_bad_display_subprocess1 (void)
static void
test_bad_display_subprocess2 (void)
{
gdk_set_allowed_backends ("x11");
g_setenv ("DISPLAY", "poo", TRUE);
gtk_init ();
}
@@ -65,19 +71,13 @@ test_bad_display (void)
g_test_trap_assert_stderr ("*cannot open display*");
}
int
main (int argc, char *argv[])
void
add_display_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
gdk_set_allowed_backends ("x11");
g_test_add_func ("/display/unset-display", test_unset_display);
g_test_add_func ("/display/unset-display/subprocess/1", test_unset_display_subprocess1);
g_test_add_func ("/display/unset-display/subprocess/2", test_unset_display_subprocess2);
g_test_add_func ("/display/bad-display", test_bad_display);
g_test_add_func ("/display/bad-display/subprocess/1", test_bad_display_subprocess1);
g_test_add_func ("/display/bad-display/subprocess/2", test_bad_display_subprocess2);
return g_test_run ();
}
+4 -9
View File
@@ -1,5 +1,7 @@
#include <gtk/gtk.h>
#include "gdktests.h"
static void
test_basic (void)
{
@@ -40,16 +42,9 @@ test_set_default (void)
g_assert_true (d == d2);
}
int
main (int argc, char *argv[])
void
add_display_manager_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
/* Open default display */
gdk_display_open (NULL);
g_test_add_func ("/displaymanager/basic", test_basic);
g_test_add_func ("/displaymanager/set-default", test_set_default);
return g_test_run ();
}
+4 -7
View File
@@ -3,6 +3,8 @@
#include <gdk/x11/gdkx.h>
#endif
#include "gdktests.h"
static void
test_to_text_list (void)
{
@@ -34,13 +36,8 @@ test_to_text_list (void)
#endif
}
int
main (int argc, char *argv[])
void
add_encoding_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
g_test_add_func ("/encoding/to-text-list", test_to_text_list);
return g_test_run ();
}
+34
View File
@@ -0,0 +1,34 @@
/*
* Copyright © 2023 Matthias Clasen
*
* 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.1 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/>.
*/
#include <locale.h>
#include <gtk/gtk.h>
#include "gdkinternaltests.h"
int
main (int argc, char *argv[])
{
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
add_image_tests ();
add_texture_tests ();
return g_test_run ();
}
+4
View File
@@ -0,0 +1,4 @@
#pragma once
void add_image_tests (void);
void add_texture_tests (void);
+51
View File
@@ -0,0 +1,51 @@
/*
* Copyright © 2023 Matthias Clasen
*
* 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.1 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/>.
*/
#include <locale.h>
#include <gtk/gtk.h>
#include "gdktests.h"
int
main (int argc, char *argv[])
{
(g_test_init) (&argc, &argv, NULL);
/* display tests need this */
if (!g_test_subprocess ())
gtk_init ();
add_array_tests ();
add_cairo_tests ();
add_content_formats_tests ();
add_content_serializer_tests ();
add_cursor_tests ();
add_display_tests ();
add_display_manager_tests ();
add_encoding_tests ();
add_glcontext_tests ();
add_keysyms_tests ();
add_memory_texture_tests ();
add_pixbuf_tests ();
add_rectangle_tests ();
add_rgba_tests ();
add_seat_tests ();
add_texture_threads_tests ();
return g_test_run ();
}
+18
View File
@@ -0,0 +1,18 @@
#pragma once
void add_array_tests (void);
void add_cairo_tests (void);
void add_content_formats_tests (void);
void add_content_serializer_tests (void);
void add_cursor_tests (void);
void add_display_tests (void);
void add_display_manager_tests (void);
void add_encoding_tests (void);
void add_glcontext_tests (void);
void add_keysyms_tests (void);
void add_memory_texture_tests (void);
void add_pixbuf_tests (void);
void add_rectangle_tests (void);
void add_rgba_tests (void);
void add_seat_tests (void);
void add_texture_threads_tests (void);
+4 -6
View File
@@ -1,5 +1,7 @@
#include <gtk/gtk.h>
#include "gdktests.h"
#define ALL_APIS (GDK_GL_API_GL | GDK_GL_API_GLES)
static GdkGLAPI
@@ -68,15 +70,11 @@ test_allowed_backends (gconstpointer data)
g_object_unref (context);
}
int
main (int argc, char *argv[])
void
add_glcontext_tests (void)
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_data_func ("/allowed-apis/none", GSIZE_TO_POINTER (0), test_allowed_backends);
g_test_add_data_func ("/allowed-apis/gl", GSIZE_TO_POINTER (GDK_GL_API_GL), test_allowed_backends);
g_test_add_data_func ("/allowed-apis/gles", GSIZE_TO_POINTER (GDK_GL_API_GLES), test_allowed_backends);
g_test_add_data_func ("/allowed-apis/all", GSIZE_TO_POINTER (GDK_GL_API_GL | GDK_GL_API_GLES), test_allowed_backends);
return g_test_run ();
}
+4 -6
View File
@@ -3,6 +3,8 @@
#include "gdk/loaders/gdktiffprivate.h"
#include "gdk/loaders/gdkjpegprivate.h"
#include "gdkinternaltests.h"
static void
assert_texture_equal (GdkTexture *t1,
GdkTexture *t2)
@@ -118,11 +120,9 @@ test_save_image (gconstpointer test_data)
g_free (path);
}
int
main (int argc, char *argv[])
void
add_image_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
g_test_add_data_func ("/image/load/png", "image.png", test_load_image);
g_test_add_data_func ("/image/load/png2", "image-gray.png", test_load_image);
g_test_add_data_func ("/image/load/png3", "image-palette.png", test_load_image);
@@ -136,6 +136,4 @@ main (int argc, char *argv[])
g_test_add_data_func ("/image/save/png", "image.png", test_save_image);
g_test_add_data_func ("/image/save/tiff", "image.tiff", test_save_image);
g_test_add_data_func ("/image/save/jpeg", "image.jpeg", test_save_image);
return g_test_run ();
}
+4 -9
View File
@@ -1,6 +1,8 @@
#include <locale.h>
#include <gtk/gtk.h>
#include "gdktests.h"
static void
test_keysyms_basic (void)
{
@@ -123,19 +125,12 @@ test_key_unicode (void)
}
}
int
main (int argc, char *argv[])
void
add_keysyms_tests (void)
{
setlocale (LC_ALL, "");
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
g_test_add_func ("/keysyms/basic", test_keysyms_basic);
g_test_add_func ("/keysyms/void", test_keysyms_void);
g_test_add_func ("/keysyms/xf86", test_keysyms_xf86);
g_test_add_func ("/keys/case", test_key_case);
g_test_add_func ("/keys/unicode", test_key_unicode);
return g_test_run ();
}
+21 -20
View File
@@ -2,6 +2,8 @@
#include "gsk/gl/gskglrenderer.h"
#include "gdktests.h"
#define N 20
static GskRenderer *gl_renderer = NULL;
@@ -636,31 +638,30 @@ add_test (const char *name,
}
}
int
main (int argc, char *argv[])
static void
clear_gl_renderer (void)
{
int result;
gtk_test_init (&argc, &argv, NULL);
add_test ("/memorytexture/download_1x1", test_download_1x1);
add_test ("/memorytexture/download_4x4", test_download_4x4);
add_test ("/memorytexture/download_192x192", test_download_192x192);
gl_renderer = gsk_gl_renderer_new ();
if (!gsk_renderer_realize (gl_renderer, NULL, NULL))
{
g_clear_object (&gl_renderer);
}
result = g_test_run ();
if (gl_renderer)
{
gsk_renderer_unrealize (gl_renderer);
g_clear_object (&gl_renderer);
}
gdk_gl_context_clear_current ();
return result;
}
void
add_memory_texture_tests (void)
{
add_test ("/memorytexture/download_1x1", test_download_1x1);
add_test ("/memorytexture/download_4x4", test_download_4x4);
add_test ("/memorytexture/download_192x192", test_download_192x192);
if (!g_test_subprocess ())
{
gl_renderer = gsk_gl_renderer_new ();
if (!gsk_renderer_realize (gl_renderer, NULL, NULL))
g_clear_object (&gl_renderer);
atexit (clear_gl_renderer);
}
}
+70 -56
View File
@@ -6,70 +6,84 @@ clipboard_client = executable('clipboard-client',
install: false,
)
tests = [
{ 'name': 'array' },
{ 'name': 'cairo' },
{ 'name': 'clipboard', 'parallel': false, },
{ 'name': 'contentformats' },
{ 'name': 'contentserializer' },
{ 'name': 'cursor' },
{ 'name': 'display' },
{ 'name': 'displaymanager' },
{ 'name': 'encoding' },
{ 'name': 'glcontext' },
{ 'name': 'keysyms' },
{ 'name': 'memorytexture' },
{ 'name': 'pixbuf' },
{ 'name': 'rectangle' },
{ 'name': 'rgba' },
{ 'name': 'seat' },
{ 'name': 'texture-threads' },
]
clipboard_test = executable('clipboard',
sources: 'clipboard.c',
c_args: common_cflags,
dependencies: libgtk_dep,
install: false,
)
foreach t : tests
test_name = t.get('name')
test_exe = executable(test_name,
sources: '@0@.c'.format(test_name),
c_args: common_cflags,
dependencies: libgtk_dep,
install: false,
)
suites = ['gdk'] + t.get('suites', [])
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
is_parallel: t.get('parallel', false),
env: [
test('clipboard', clipboard_test,
args: [ '--tap', '-k' ],
protocol: 'tap',
is_parallel: false,
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'DBUS_SESSION_BUS_ADDRESS=',
],
suite: suites,
)
endforeach
],
suite: 'gdk',
)
internal_tests = [
'image',
'texture',
test_sources = [
'array.c',
'cairo.c',
'contentformats.c',
'contentserializer.c',
'cursor.c',
'display.c',
'displaymanager.c',
'encoding.c',
'glcontext.c',
'keysyms.c',
'memorytexture.c',
'pixbuf.c',
'rectangle.c',
'rgba.c',
'seat.c',
'texture-threads.c',
'gdktests.c'
]
foreach t : internal_tests
test_exe = executable(t, '@0@.c'.format(t),
c_args: common_cflags,
dependencies: libgtk_static_dep,
install: false,
)
gdktests = executable('gdktests',
sources: test_sources,
c_args: common_cflags,
dependencies: libgtk_dep,
install: false,
)
test(t, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [
test('gdktests', gdktests,
args: [ '--tap', '-k' ],
protocol: 'tap',
is_parallel: true,
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'DBUS_SESSION_BUS_ADDRESS=',
],
suite: 'gdk',
)
endforeach
],
suite: 'gdk',
)
internal_test_sources = [
'image.c',
'texture.c',
'gdkinternaltests.c',
]
gdkinternaltests = executable('gdkinternaltests',
sources: internal_test_sources,
c_args: common_cflags,
dependencies: libgtk_static_dep,
install: false,
)
test('gdkinternaltests', gdkinternaltests,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir()),
'DBUS_SESSION_BUS_ADDRESS=',
],
suite: 'gdk',
)
+4 -7
View File
@@ -1,5 +1,7 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gdktests.h"
static void
test_format (gconstpointer d)
{
@@ -29,14 +31,9 @@ test_format (gconstpointer d)
g_assert_true (found);
}
int
main (int argc, char *argv[])
void
add_pixbuf_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
g_test_add_data_func ("/pixbuf/format/png", "png", test_format);
g_test_add_data_func ("/pixbuf/format/jpeg", "jpeg", test_format);
return g_test_run ();
}
+4 -8
View File
@@ -1,6 +1,8 @@
#include <gtk/gtk.h>
#include <cairo-gobject.h>
#include "gdktests.h"
static void
test_rectangle_equal (void)
{
@@ -107,18 +109,12 @@ test_rectangle_contains (void)
g_assert_false (gdk_rectangle_contains_point (&b, 10, 6));
}
int
main (int argc, char *argv[])
void
add_rectangle_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
g_test_add_func ("/rectangle/equal", test_rectangle_equal);
g_test_add_func ("/rectangle/intersect", test_rectangle_intersect);
g_test_add_func ("/rectangle/union", test_rectangle_union);
g_test_add_func ("/rectangle/type", test_rectangle_type);
g_test_add_func ("/rectangle/contains", test_rectangle_contains);
return g_test_run ();
}
+4 -6
View File
@@ -1,6 +1,8 @@
#include <locale.h>
#include <gdk/gdk.h>
#include "gdktests.h"
static void
test_color_parse (void)
{
@@ -207,16 +209,12 @@ test_color_hash (void)
g_assert_cmpuint (hash1, !=, hash2);
}
int
main (int argc, char *argv[])
void
add_rgba_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
g_test_add_func ("/rgba/parse", test_color_parse);
g_test_add_func ("/rgba/parse/nonsense", test_color_parse_nonsense);
g_test_add_func ("/rgba/to-string", test_color_to_string);
g_test_add_func ("/rgba/copy", test_color_copy);
g_test_add_func ("/rgba/hash", test_color_hash);
return g_test_run ();
}
+4 -8
View File
@@ -1,5 +1,7 @@
#include <gtk/gtk.h>
#include "gdktests.h"
static void
test_list_seats (void)
{
@@ -124,15 +126,9 @@ test_default_seat (void)
g_list_free (tools);
}
int
main (int argc, char *argv[])
void
add_seat_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
g_test_add_func ("/seat/list", test_list_seats);
g_test_add_func ("/seat/default", test_default_seat);
return g_test_run ();
}
+4 -6
View File
@@ -2,6 +2,8 @@
#include "gsk/gl/gskglrenderer.h"
#include "gdktests.h"
/* This function will be called from a thread and/or the main loop.
* Textures are threadsafe after all. */
static void
@@ -111,12 +113,8 @@ texture_threads (void)
gdk_gl_context_clear_current ();
}
int
main (int argc, char *argv[])
void
add_texture_threads_tests (void)
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/texture-threads", texture_threads);
return g_test_run ();
}
+4 -7
View File
@@ -2,6 +2,8 @@
#include "gdk/gdkmemorytextureprivate.h"
#include "gdkinternaltests.h"
static void
compare_pixels (int width,
int height,
@@ -160,16 +162,11 @@ test_texture_subtexture (void)
g_object_unref (texture);
}
int
main (int argc, char *argv[])
void
add_texture_tests (void)
{
/* We want to use resources from libgtk, so we need gtk initialized */
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/texture/from-pixbuf", test_texture_from_pixbuf);
g_test_add_func ("/texture/from-resource", test_texture_from_resource);
g_test_add_func ("/texture/save-to-png", test_texture_save_to_png);
g_test_add_func ("/texture/subtexture", test_texture_subtexture);
return g_test_run ();
}
+4 -7
View File
@@ -20,6 +20,8 @@
#include <gtk/gtk.h>
#include "gsk/gskrendernodeprivate.h"
#include "gskinternaltests.h"
static void
test_can_diff_basic (void)
{
@@ -95,14 +97,9 @@ test_can_diff_transform (void)
gsk_transform_unref (t2);
}
int
main (int argc,
char *argv[])
void
add_diff_tests (void)
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/node/can-diff/basic", test_can_diff_basic);
g_test_add_func ("/node/can-diff/transform", test_can_diff_transform);
return g_test_run ();
}
+36
View File
@@ -0,0 +1,36 @@
/*
* Copyright © 2023 Matthias Clasen
*
* 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.1 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/>.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gskinternaltests.h"
int
main (int argc,
char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
add_diff_tests ();
add_half_float_tests ();
add_rounded_rect_tests ();
add_misc_tests ();
return g_test_run ();
}
+6
View File
@@ -0,0 +1,6 @@
#pragma once
void add_diff_tests (void);
void add_half_float_tests (void);
void add_rounded_rect_tests (void);
void add_misc_tests (void);
+34
View File
@@ -0,0 +1,34 @@
/*
* Copyright © 2023 Matthias Clasen
*
* 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.1 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/>.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gsktests.h"
int
main (int argc,
char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
add_transform_tests ();
add_shader_tests ();
return g_test_run ();
}
+4
View File
@@ -0,0 +1,4 @@
#pragma once
void add_transform_tests (void);
void add_shader_tests (void);
+4 -6
View File
@@ -2,6 +2,8 @@
#include "gsk/gl/fp16private.h"
#include "gskinternaltests.h"
static void
test_constants (void)
{
@@ -95,14 +97,10 @@ test_many (void)
}
}
int
main (int argc, char *argv[])
void
add_half_float_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
g_test_add_func ("/half-float/constants", test_constants);
g_test_add_func ("/half-float/roundtrip", test_roundtrip);
g_test_add_func ("/half-float/many", test_many);
return g_test_run ();
}
+34 -51
View File
@@ -242,69 +242,52 @@ foreach test : node_parser_tests
endif
endforeach
tests = [
['transform'],
['shader'],
test_sources = [
'transform.c',
'shader.c',
'gsktests.c',
]
test_cargs = []
gsktests = executable('gsktests',
test_sources,
dependencies: libgtk_dep,
c_args: common_cflags,
)
foreach t : tests
test_name = t.get(0)
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, [])
test_extra_cargs = t.get(2, [])
test_extra_ldflags = t.get(3, [])
test_exe = executable(test_name, test_srcs,
dependencies : libgtk_dep,
c_args : test_cargs + test_extra_cargs + common_cflags,
link_args : test_extra_ldflags,
)
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [
test('gsktests', gsktests,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [
'GSK_RENDERER=cairo',
'GTK_A11Y=test',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
],
suite: 'gsk',
)
endforeach
],
suite: 'gsk',
)
internal_tests = [
[ 'diff' ],
[ 'half-float' ],
['rounded-rect'],
['misc'],
internal_test_sources = [
'diff',
'half-float',
'rounded-rect',
'misc',
'gskinternaltests.c',
]
foreach t : internal_tests
test_name = t.get(0)
test_srcs = ['@0@.c'.format(test_name)] + t.get(1, [])
test_extra_cargs = t.get(2, [])
test_extra_ldflags = t.get(3, [])
gskinternaltests = executable('gskinternaltests',
test_sources,
dependencies: libgtk_static_dep,
c_args: common_cflags,
)
test_exe = executable(test_name,
sources: test_srcs,
dependencies : libgtk_static_dep,
c_args : test_cargs + test_extra_cargs + common_cflags,
link_args : test_extra_ldflags,
)
test(test_name, test_exe,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [
test('gskinternaltests', gskinternaltests,
args: [ '--tap', '-k' ],
protocol: 'tap',
env: [
'GSK_RENDERER=cairo',
'GTK_A11Y=test',
'G_TEST_SRCDIR=@0@'.format(meson.current_source_dir()),
'G_TEST_BUILDDIR=@0@'.format(meson.current_build_dir())
],
suite: 'gsk',
)
endforeach
],
suite: 'gsk',
)
+4 -7
View File
@@ -1,6 +1,8 @@
#include <gtk/gtk.h>
#include "gsk/gskrendernodeprivate.h"
#include "gskinternaltests.h"
static void
test_rendernode_gvalue (void)
{
@@ -82,15 +84,10 @@ test_conic_gradient_angle (void)
gsk_render_node_unref (node);
}
int
main (int argc, char *argv[])
void
add_misc_tests (void)
{
(g_test_init) (&argc, &argv, NULL);
gtk_init ();
g_test_add_func ("/rendernode/gvalue", test_rendernode_gvalue);
g_test_add_func ("/rendernode/border/uniform", test_bordernode_uniform);
g_test_add_func ("/rendernode/conic-gradient/angle", test_conic_gradient_angle);
return g_test_run ();
}
+4 -7
View File
@@ -22,6 +22,8 @@
#include <gtk/gtk.h>
#include <gsk/gskroundedrectprivate.h>
#include "gskinternaltests.h"
static void
test_contains_rect (void)
{
@@ -160,17 +162,12 @@ test_to_float (void)
g_assert_true (flt[10] == 9. && flt[11] == 11.);
}
int
main (int argc,
char *argv[])
void
add_rounded_rect_tests (void)
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/rounded-rect/contains-rect", test_contains_rect);
g_test_add_func ("/rounded-rect/intersects-rect", test_intersects_rect);
g_test_add_func ("/rounded-rect/contains-point", test_contains_point);
g_test_add_func ("/rounded-rect/is-circular", test_is_circular);
g_test_add_func ("/rounded-rect/to-float", test_to_float);
return g_test_run ();
}
+4 -7
View File
@@ -19,6 +19,8 @@
#include <gtk/gtk.h>
#include "gsktests.h"
/* shader fragment as found in nature */
const char shader0[] =
"// author: bobylito\n"
@@ -290,16 +292,11 @@ test_compile (void)
g_bytes_unref (bytes);
}
int
main (int argc,
char *argv[])
void
add_shader_tests (void)
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/shader/create/simple", test_create_simple);
g_test_add_func ("/shader/create/data", test_create_data);
g_test_add_func ("/shader/format-args", test_format_args);
g_test_add_func ("/shader/compile", test_compile);
return g_test_run ();
}
+4 -7
View File
@@ -21,6 +21,8 @@
#include <gtk/gtk.h>
#include "gsktests.h"
#define EPSILON (1.f / 1024 / 32) /* 2^-15 */
/* macros stolen from graphene testsuite, so they get to keep their names */
@@ -843,12 +845,9 @@ test_rotate3d_transform (void)
gsk_transform_unref (t2);
}
int
main (int argc,
char *argv[])
void
add_transform_tests (void)
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/transform/conversions/simple", test_conversions_simple);
g_test_add_func ("/transform/conversions/transformed", test_conversions_transformed);
g_test_add_func ("/transform/identity", test_identity);
@@ -865,6 +864,4 @@ main (int argc,
g_test_add_func ("/transform/perspective", test_perspective_transform);
g_test_add_func ("/transform/rotate", test_rotate_transform);
g_test_add_func ("/transform/rotate3d", test_rotate3d_transform);
return g_test_run ();
}
-1
View File
@@ -500,7 +500,6 @@ 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);
+12 -7
View File
@@ -55,8 +55,9 @@ 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);
g_assert_false (res);
res = gtk_recent_manager_add_full (manager,
uri,
recent_data);
}
g_test_trap_assert_failed ();
@@ -66,8 +67,9 @@ 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);
g_assert_false (res);
res = gtk_recent_manager_add_full (manager,
uri,
recent_data);
}
g_test_trap_assert_failed ();
@@ -77,8 +79,9 @@ 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);
g_assert_false (res);
res = gtk_recent_manager_add_full (manager,
uri,
recent_data);
}
g_test_trap_assert_failed ();
@@ -87,7 +90,9 @@ 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,8 +39,6 @@ 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);