Compare commits
68 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5383dcca3c | |||
| 2e415e266f | |||
| 915388cfdb | |||
| 1bf7f5eacb | |||
| 37acfcfcd5 | |||
| 621e0a13e9 | |||
| 92fcd37a19 | |||
| d8bde48b87 | |||
| 825ffb9422 | |||
| 046ef010b3 | |||
| b71ec6cb59 | |||
| fca19e72ad | |||
| 98d2320c93 | |||
| effc7a619d | |||
| 0ec017fcc0 | |||
| 94ad177176 | |||
| 4616104742 | |||
| a3a24b81c8 | |||
| debcc62775 | |||
| b11f31afea | |||
| db2e5648c9 | |||
| 46d1f04a7c | |||
| fe774c1ad8 | |||
| 08ee36e7c4 | |||
| 1605ec0a44 | |||
| 4b46e11b22 | |||
| 9993e91add | |||
| 9ac22c1088 | |||
| 47400e4bd8 | |||
| 8981ba4bd2 | |||
| 74a41eeb70 | |||
| ff874318c0 | |||
| a4598567b9 | |||
| 8f95661167 | |||
| e437c55142 | |||
| ff01067b8b | |||
| 7f4630abac | |||
| 4c9bd6ed9a | |||
| b6cd97be1e | |||
| c4cbd6ec1b | |||
| 312289fb11 | |||
| 036dd60a4e | |||
| 10c6c93f40 | |||
| 4d894e08f7 | |||
| 31407d0a4c | |||
| bb53cf53e7 | |||
| da9cd4659e | |||
| d3e6e303fc | |||
| a0c23b1c3d | |||
| 50b3a952c8 | |||
| 15b24a000d | |||
| 6a509608f9 | |||
| df6a52520c | |||
| 578db92973 | |||
| 3ab97fac1f | |||
| e8852c9a25 | |||
| fa0b379d30 | |||
| 1565053842 | |||
| 8288d9e87c | |||
| a900b30bcf | |||
| 9b671d1f79 | |||
| c2d82c23e6 | |||
| a88b4f517e | |||
| f9f9fa6dc6 | |||
| 02672a521a | |||
| a74420bc1a | |||
| 8789e78796 | |||
| 82b11623f4 |
+5
-3
@@ -78,7 +78,8 @@ fedora-x86_64:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- meson subprojects update
|
||||
- rm -rf subprojects/glib
|
||||
- meson subprojects update --reset
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
_build
|
||||
- ninja -C _build
|
||||
@@ -94,7 +95,7 @@ release-build:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- meson subprojects update
|
||||
- meson subprojects update --reset
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
_build
|
||||
- ninja -C _build
|
||||
@@ -109,7 +110,7 @@ installed-tests:
|
||||
G_TEST_ACCESSIBLE: 1
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- meson subprojects update
|
||||
- meson subprojects update --reset
|
||||
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
|
||||
_build
|
||||
- ninja -C _build
|
||||
@@ -164,6 +165,7 @@ macos:
|
||||
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
|
||||
- export MESON_FORCE_BACKTRACE=1
|
||||
script:
|
||||
- meson subprojects update --reset
|
||||
- meson -Dx11-backend=false
|
||||
-Dintrospection=disabled
|
||||
-Dcpp_std=c++11
|
||||
|
||||
@@ -157,8 +157,8 @@ Release notes
|
||||
The release notes for GTK are part of the migration guide in the API
|
||||
reference. See:
|
||||
|
||||
- [3.x release notes](https://developer.gnome.org/gtk3/unstable/gtk-migrating-2-to-3.html)
|
||||
- [4.x release notes](https://developer.gnome.org/gtk4/unstable/gtk-migrating-3-to-4.html)
|
||||
- [3.x release notes](https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html)
|
||||
- [4.x release notes](https://docs.gtk.org/gtk4/migrating-3to4.html)
|
||||
|
||||
Licensing terms
|
||||
---------------
|
||||
|
||||
@@ -163,8 +163,8 @@ drag_update_cb (GtkGestureDrag *drag,
|
||||
|
||||
static void
|
||||
drag_end_cb (GtkGestureDrag *drag,
|
||||
gdouble dx,
|
||||
gdouble dy,
|
||||
double dx,
|
||||
double dy,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkShadertoy *shadertoy = GTK_SHADERTOY (user_data);
|
||||
|
||||
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
website_url = "https://www.gtk.org"
|
||||
authors = "GTK Development Team"
|
||||
logo_url = "gtk-logo.svg"
|
||||
license = "GPL-2.1-or-later"
|
||||
license = "LGPL-2.1-or-later"
|
||||
description = "The GTK toolkit"
|
||||
dependencies = [ "GObject-2.0", "cairo-1.0", "Pango-1.0", "GdkWayland-4.0", "GdkX11-4.0" ]
|
||||
devhelp = true
|
||||
|
||||
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
website_url = "https://www.gtk.org"
|
||||
authors = "GTK Development Team"
|
||||
logo_url = "gtk-logo.svg"
|
||||
license = "GPL-2.1-or-later"
|
||||
license = "LGPL-2.1-or-later"
|
||||
description = "The GTK toolkit"
|
||||
dependencies = [ "GObject-2.0", "Graphene-1.0", "Pango-1.0", "Gdk-4.0" ]
|
||||
devhelp = true
|
||||
|
||||
@@ -5,7 +5,7 @@ repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
website_url = "https://www.gtk.org"
|
||||
authors = "GTK Development Team"
|
||||
logo_url = "gtk-logo.svg"
|
||||
license = "GPL-2.1-or-later"
|
||||
license = "LGPL-2.1-or-later"
|
||||
description = "The GTK toolkit"
|
||||
dependencies = [ "GObject-2.0", "Graphene-1.0", "Pango-1.0", "Gdk-4.0", "Gsk-4.0" ]
|
||||
devhelp = true
|
||||
|
||||
@@ -604,6 +604,9 @@ from `FALSE` to `TRUE`. In addition, there is a [property@Gtk.Widget:focusable]
|
||||
property, which controls whether an individual widget can receive
|
||||
the input focus.
|
||||
|
||||
The `gtk4-builder-tool` utility, when called with the `--3to4` option of the
|
||||
`simplify` command, will replace `:can-focus` by `:focusable`.
|
||||
|
||||
The feature to automatically keep the focus widget scrolled into view with
|
||||
`gtk_container_set_focus_vadjustment()` has been removed together with
|
||||
`GtkContainer`, and is provided by scrollable widgets instead. In the common
|
||||
@@ -740,7 +743,7 @@ The abstract base class `GtkBin` for single-child containers has been
|
||||
removed. The former subclasses are now derived directly from `GtkWidget`,
|
||||
and have a "child" property for their child widget. To add a child, use
|
||||
the setter for the "child" property (e.g. [method@Gtk.Frame.set_child]) instead
|
||||
of `gtk_container_add()`. Adding a child in a ui file with <child> still works.
|
||||
of `gtk_container_add()`. Adding a child in a ui file with `<child>` still works.
|
||||
|
||||
The affected classes are:
|
||||
|
||||
@@ -766,7 +769,7 @@ expand flags) and [vfunc@Gtk.Widget.get_request_mode] (if you want your
|
||||
container to support height-for-width).
|
||||
|
||||
You may also want to implement the [iface@Gtk.Buildable] interface, to support
|
||||
adding children with <child> in ui files.
|
||||
adding children with `<child>` in ui files.
|
||||
|
||||
### Adapt to GtkContainer removal
|
||||
|
||||
@@ -777,7 +780,7 @@ and have class-specific add() and remove() functions.
|
||||
The most noticeable change is the use of [method@Gtk.Box.append] or [method@Gtk.Box.prepend]
|
||||
instead of `gtk_container_add()` for adding children to `GtkBox`, and the change
|
||||
to use container-specific remove functions, such as [method@Gtk.Stack.remove] instead
|
||||
of `gtk_container_remove()`. Adding a child in a ui file with <child> still works.
|
||||
of `gtk_container_remove()`. Adding a child in a ui file with `<child>` still works.
|
||||
|
||||
The affected classes are:
|
||||
|
||||
@@ -804,6 +807,11 @@ by a layout manager (if they are layout-related), or handled in some
|
||||
other way. One possibility is to use child meta objects, as seen with
|
||||
[class@Gtk.AssistantPage], [class@Gtk.StackPage] and the like.
|
||||
|
||||
If you used to define child properties with `<packing>` in ui files, you have
|
||||
to switch to using `<layout>` for the corresponding layout properties.
|
||||
`gtk4-builder-tool` can help with this conversion, with the `--3to4` option
|
||||
of the `simplify` command.
|
||||
|
||||
The replacements for gtk_container_add() are:
|
||||
|
||||
| Widget | Replacement |
|
||||
|
||||
@@ -59,14 +59,12 @@ example_app_startup (GApplication *app)
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_create_window (GtkApplication *app,
|
||||
const char *save_id)
|
||||
example_app_activate (GApplication *app)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
|
||||
win = example_app_window_new (EXAMPLE_APP (app));
|
||||
gtk_widget_set_save_id (GTK_WIDGET (win), save_id);
|
||||
/* FIXME: differentiate save ids */
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -95,8 +93,8 @@ static void
|
||||
example_app_class_init (ExampleAppClass *class)
|
||||
{
|
||||
G_APPLICATION_CLASS (class)->startup = example_app_startup;
|
||||
G_APPLICATION_CLASS (class)->activate = example_app_activate;
|
||||
G_APPLICATION_CLASS (class)->open = example_app_open;
|
||||
GTK_APPLICATION_CLASS (class)->create_window = example_app_create_window;
|
||||
}
|
||||
|
||||
ExampleApp *
|
||||
@@ -105,7 +103,5 @@ example_app_new (void)
|
||||
return g_object_new (EXAMPLE_APP_TYPE,
|
||||
"application-id", "org.gtk.exampleapp",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
"register-session", TRUE,
|
||||
"save-state", TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ struct _ExampleAppWindow
|
||||
GtkWidget *words;
|
||||
GtkWidget *lines;
|
||||
GtkWidget *lines_label;
|
||||
|
||||
GList *files;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
@@ -213,68 +211,14 @@ example_app_window_dispose (GObject *object)
|
||||
|
||||
g_clear_object (&win->settings);
|
||||
|
||||
g_list_free_full (win->files, g_object_unref);
|
||||
win->files = NULL;
|
||||
|
||||
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
example_app_window_save_state (GtkWidget *widget,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
ExampleAppWindow *win = EXAMPLE_APP_WINDOW (widget);
|
||||
GVariantBuilder builder;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("as"));
|
||||
for (GList *l = win->files; l; l = l->next)
|
||||
{
|
||||
g_variant_builder_add (&builder, "s", g_file_peek_path (G_FILE (l->data)));
|
||||
}
|
||||
|
||||
g_variant_dict_insert_value (dict, "files", g_variant_builder_end (&builder));
|
||||
|
||||
/* Save window state */
|
||||
GTK_WIDGET_CLASS (example_app_window_parent_class)->save_state (widget, dict, save_children);
|
||||
|
||||
*save_children = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
example_app_window_restore_state (GtkWidget *widget,
|
||||
GVariant *state)
|
||||
{
|
||||
ExampleAppWindow *win = EXAMPLE_APP_WINDOW (widget);
|
||||
GVariantIter *iter;
|
||||
|
||||
/* Restore window state */
|
||||
GTK_WIDGET_CLASS (example_app_window_parent_class)->restore_state (widget, state);
|
||||
|
||||
if (g_variant_lookup (state, "files", "as", &iter))
|
||||
{
|
||||
const char *path;
|
||||
|
||||
while (g_variant_iter_next (iter, "&s", &path))
|
||||
{
|
||||
GFile *file = g_file_new_for_path (path);
|
||||
example_app_window_open (win, file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
{
|
||||
G_OBJECT_CLASS (class)->dispose = example_app_window_dispose;
|
||||
|
||||
GTK_WIDGET_CLASS (class)->save_state = example_app_window_save_state;
|
||||
GTK_WIDGET_CLASS (class)->restore_state = example_app_window_restore_state;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
|
||||
@@ -344,6 +288,4 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
|
||||
update_words (win);
|
||||
update_lines (win);
|
||||
|
||||
win->files = g_list_append (win->files, g_object_ref (file));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<property name="title" translatable="yes">Example Application</property>
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">400</property>
|
||||
<property name="save-id">window</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<child>
|
||||
@@ -27,7 +26,6 @@
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
<property name="save-id">search</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
@@ -40,7 +38,6 @@
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="save-id">content_box</property>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<child>
|
||||
@@ -52,10 +49,8 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="hbox">
|
||||
<property name="save-id">hbox</property>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="sidebar">
|
||||
<property name="save-id">sidebar</property>
|
||||
<property name="transition-type">slide-right</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sidebar-sw">
|
||||
@@ -71,7 +66,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="save-id">stack</property>
|
||||
<signal name="notify::visible-child" handler="visible_child_changed"/>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -220,6 +220,7 @@ new_window (GApplication *app,
|
||||
gtk_window_set_default_size ((GtkWindow*)window, 640, 480);
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Bloatpad");
|
||||
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), TRUE);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_window_set_child (GTK_WINDOW (window), grid);
|
||||
@@ -536,7 +537,7 @@ bloat_pad_startup (GApplication *application)
|
||||
|
||||
menu = gtk_application_get_menu_by_id (GTK_APPLICATION (application), "icon-menu");
|
||||
|
||||
file = g_file_new_for_uri ("resource:///org/gtk/libgtk/icons/16x16/actions/gtk-select-color.png");
|
||||
file = g_file_new_for_uri ("resource:///org/gtk/libgtk/icons/16x16/actions/insert-image.png");
|
||||
icon = g_file_icon_new (file);
|
||||
item = g_menu_item_new ("File Icon", NULL);
|
||||
g_menu_item_set_icon (item, icon);
|
||||
@@ -552,7 +553,7 @@ bloat_pad_startup (GApplication *application)
|
||||
g_object_unref (item);
|
||||
g_object_unref (icon);
|
||||
|
||||
bytes = g_resources_lookup_data ("/org/gtk/libgtk/icons/16x16/actions/gtk-select-font.png", 0, NULL);
|
||||
bytes = g_resources_lookup_data ("/org/gtk/libgtk/icons/16x16/actions/media-eject.png", 0, NULL);
|
||||
icon = g_bytes_icon_new (bytes);
|
||||
item = g_menu_item_new ("Bytes Icon", NULL);
|
||||
g_menu_item_set_icon (item, icon);
|
||||
@@ -561,19 +562,19 @@ bloat_pad_startup (GApplication *application)
|
||||
g_object_unref (icon);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
icon = G_ICON (gdk_pixbuf_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/gtk-preferences.png", NULL));
|
||||
icon = G_ICON (gdk_pixbuf_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/folder-new.png", NULL));
|
||||
item = g_menu_item_new ("Pixbuf", NULL);
|
||||
g_menu_item_set_icon (item, icon);
|
||||
g_menu_append_item (menu, item);
|
||||
g_object_unref (item);
|
||||
g_object_unref (icon);
|
||||
|
||||
file = g_file_new_for_uri ("resource:///org/gtk/libgtk/icons/16x16/actions/gtk-page-setup.png");
|
||||
file = g_file_new_for_uri ("resource:///org/gtk/libgtk/icons/16x16/actions/bookmark-new.png");
|
||||
icon = g_file_icon_new (file);
|
||||
emblem = g_emblem_new (icon);
|
||||
g_object_unref (icon);
|
||||
g_object_unref (file);
|
||||
file = g_file_new_for_uri ("resource:///org/gtk/libgtk/icons/16x16/actions/gtk-orientation-reverse-portrait.png");
|
||||
file = g_file_new_for_uri ("resource:///org/gtk/libgtk/icons/16x16/actions/dialog-warning.png");
|
||||
icon2 = g_file_icon_new (file);
|
||||
icon = g_emblemed_icon_new (icon2, emblem);
|
||||
item = g_menu_item_new ("Emblemed Icon", NULL);
|
||||
|
||||
@@ -330,14 +330,13 @@ gdk_display_open_default (void)
|
||||
}
|
||||
|
||||
/*< private >
|
||||
*
|
||||
* gdk_get_startup_notification_id
|
||||
* gdk_get_startup_notification_id:
|
||||
*
|
||||
* Returns the original value of the DESKTOP_STARTUP_ID environment
|
||||
* variable if it was defined and valid, or %NULL otherwise.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the original value of the
|
||||
* DESKTOP_STARTUP_ID environment variable, or %NULL.
|
||||
* DESKTOP_STARTUP_ID environment variable
|
||||
*/
|
||||
const char *
|
||||
gdk_get_startup_notification_id (void)
|
||||
|
||||
+1
-1
@@ -340,7 +340,7 @@ gdk_cursor_new_from_name (const char *name,
|
||||
* @texture: the texture providing the pixel data
|
||||
* @hotspot_x: the horizontal offset of the “hotspot” of the cursor
|
||||
* @hotspot_y: the vertical offset of the “hotspot” of the cursor
|
||||
* @fallback: (nullable): %NULL or the `GdkCursor` to fall back to when
|
||||
* @fallback: (nullable): the `GdkCursor` to fall back to when
|
||||
* this one cannot be supported
|
||||
*
|
||||
* Creates a new cursor from a `GdkTexture`.
|
||||
|
||||
+4
-4
@@ -384,11 +384,11 @@ gdk_display_is_closed (GdkDisplay *display)
|
||||
* gdk_display_get_event:
|
||||
* @display: a `GdkDisplay`
|
||||
*
|
||||
* Gets the next `GdkEvent` to be processed for @display, fetching events from the
|
||||
* windowing system if necessary.
|
||||
* Gets the next `GdkEvent` to be processed for @display,
|
||||
* fetching events from the windowing system if necessary.
|
||||
*
|
||||
* Returns: (nullable) (transfer full): the next `GdkEvent` to be processed,
|
||||
* or %NULL if no events are pending
|
||||
* Returns: (nullable) (transfer full): the next `GdkEvent`
|
||||
* to be processed
|
||||
*/
|
||||
GdkEvent *
|
||||
gdk_display_get_event (GdkDisplay *display)
|
||||
|
||||
@@ -323,7 +323,8 @@ gdk_display_manager_get_default_display (GdkDisplayManager *manager)
|
||||
* Gets the default `GdkDisplay`.
|
||||
*
|
||||
* This is a convenience function for:
|
||||
* `gdk_display_manager_get_default_display (gdk_display_manager_get ())`.
|
||||
*
|
||||
* gdk_display_manager_get_default_display (gdk_display_manager_get ())
|
||||
*
|
||||
* Returns: (nullable) (transfer none): a `GdkDisplay`, or %NULL if
|
||||
* there is no default display
|
||||
|
||||
+3
-3
@@ -481,11 +481,11 @@ _gdk_frame_clock_begin_frame (GdkFrameClock *frame_clock)
|
||||
* for the current frame or a recent frame.
|
||||
*
|
||||
* The `GdkFrameTimings` object may not yet be complete: see
|
||||
* [method@Gdk.FrameTimings.get_complete].
|
||||
* [method@Gdk.FrameTimings.get_complete] and
|
||||
* [method@Gdk.FrameClock.get_history_start].
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the `GdkFrameTimings` object
|
||||
* for the specified frame, or %NULL if it is not available. See
|
||||
* [method@Gdk.FrameClock.get_history_start].
|
||||
* for the specified frame, or %NULL if it is not available
|
||||
*/
|
||||
GdkFrameTimings *
|
||||
gdk_frame_clock_get_timings (GdkFrameClock *frame_clock,
|
||||
|
||||
@@ -53,8 +53,8 @@ G_BEGIN_DECLS
|
||||
* CAIRO_FORMAT_ARGB32 is represented by different `GdkMemoryFormats`
|
||||
* on architectures with different endiannesses.
|
||||
*
|
||||
* Its naming is modelled after VkFormat (see
|
||||
* https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkFormat
|
||||
* Its naming is modelled after
|
||||
* [VkFormat](https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkFormat)
|
||||
* for details).
|
||||
*/
|
||||
typedef enum {
|
||||
|
||||
@@ -1550,6 +1550,7 @@ pointer_handle_leave (void *data,
|
||||
GdkWaylandSeat *seat = data;
|
||||
GdkEvent *event;
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
|
||||
GdkDeviceGrabInfo *grab;
|
||||
|
||||
if (!surface)
|
||||
return;
|
||||
@@ -1561,8 +1562,11 @@ pointer_handle_leave (void *data,
|
||||
return;
|
||||
|
||||
_gdk_wayland_display_update_serial (display_wayland, serial);
|
||||
grab = _gdk_display_get_last_device_grab (seat->display,
|
||||
seat->logical_pointer);
|
||||
|
||||
if (seat->pointer_info.button_modifiers != 0)
|
||||
if (seat->pointer_info.button_modifiers != 0 &&
|
||||
grab && grab->implicit)
|
||||
{
|
||||
gulong display_serial;
|
||||
|
||||
|
||||
@@ -1648,6 +1648,7 @@ static TranslationEntry translations[] = {
|
||||
{ FALSE, "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } },
|
||||
{ FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
|
||||
{ FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } },
|
||||
/* Note, this setting doesn't exist, the portal and gsd fake it */
|
||||
{ FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } },
|
||||
};
|
||||
|
||||
|
||||
@@ -352,12 +352,14 @@ RegisterGdkClass (GdkSurfaceType wtype)
|
||||
{
|
||||
char sLoc [MAX_PATH+1];
|
||||
|
||||
if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
|
||||
// try to load first icon of executable program
|
||||
if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
|
||||
{
|
||||
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
|
||||
|
||||
if (0 == hAppIcon && 0 == hAppIconSm)
|
||||
{
|
||||
// fallback : load icon from GTK DLL
|
||||
if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
|
||||
{
|
||||
ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
|
||||
|
||||
@@ -82,7 +82,7 @@ typedef struct
|
||||
struct {
|
||||
float width;
|
||||
float height;
|
||||
gint uniform_data_len;
|
||||
int uniform_data_len;
|
||||
guchar uniform_data[32];
|
||||
} gl_shader;
|
||||
};
|
||||
|
||||
+1
-1
@@ -128,7 +128,7 @@ typedef enum {
|
||||
* The implementation of each blend mode is deferred to the
|
||||
* rendering pipeline.
|
||||
*
|
||||
* See https://www.w3.org/TR/compositing-1/#blending for more information
|
||||
* See <https://www.w3.org/TR/compositing-1/#blending> for more information
|
||||
* on blending and blend modes.
|
||||
*/
|
||||
typedef enum {
|
||||
|
||||
+11
-1
@@ -310,7 +310,17 @@ gsk_rounded_rect_scale_affine (GskRoundedRect *dest,
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX: Find a better name */
|
||||
/*<private>
|
||||
* gsk_rounded_rect_is_circular:
|
||||
* @self: the `GskRoundedRect` to check
|
||||
*
|
||||
* Checks if all corners of @self are quarter-circles (as
|
||||
* opposed to quarter-ellipses).
|
||||
*
|
||||
* Note that different corners can still have different radii.
|
||||
*
|
||||
* Returns: %TRUE if the rectangle is circular.
|
||||
*/
|
||||
gboolean
|
||||
gsk_rounded_rect_is_circular (const GskRoundedRect *self)
|
||||
{
|
||||
|
||||
@@ -149,7 +149,7 @@ gtk_text_buffer_get_run_attributes (GtkTextBuffer *buffer,
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GSList *tags, *temp_tags;
|
||||
gdouble scale = 1;
|
||||
double scale = 1;
|
||||
gboolean val_set = FALSE;
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (buffer, &iter, offset);
|
||||
|
||||
+81
-120
@@ -36,14 +36,14 @@
|
||||
#include <glib.h>
|
||||
|
||||
static gunichar
|
||||
get_char (const char **str)
|
||||
get_char (const char **str,
|
||||
gboolean casefold)
|
||||
{
|
||||
gunichar c = g_utf8_get_char (*str);
|
||||
*str = g_utf8_next_char (*str);
|
||||
|
||||
#ifdef G_PLATFORM_WIN32
|
||||
c = g_unichar_tolower (c);
|
||||
#endif
|
||||
if (casefold)
|
||||
c = g_unichar_tolower (c);
|
||||
|
||||
return c;
|
||||
}
|
||||
@@ -56,13 +56,14 @@ get_char (const char **str)
|
||||
|
||||
static gunichar
|
||||
get_unescaped_char (const char **str,
|
||||
gboolean *was_escaped)
|
||||
gboolean *was_escaped,
|
||||
gboolean casefold)
|
||||
{
|
||||
gunichar c = get_char (str);
|
||||
gunichar c = get_char (str, casefold);
|
||||
|
||||
*was_escaped = DO_ESCAPE && c == '\\';
|
||||
if (*was_escaped)
|
||||
c = get_char (str);
|
||||
c = get_char (str, casefold);
|
||||
|
||||
return c;
|
||||
}
|
||||
@@ -74,7 +75,8 @@ static gboolean
|
||||
gtk_fnmatch_intern (const char *pattern,
|
||||
const char *string,
|
||||
gboolean component_start,
|
||||
gboolean no_leading_period)
|
||||
gboolean no_leading_period,
|
||||
gboolean casefold)
|
||||
{
|
||||
const char *p = pattern, *n = string;
|
||||
|
||||
@@ -82,8 +84,8 @@ gtk_fnmatch_intern (const char *pattern,
|
||||
{
|
||||
const char *last_n = n;
|
||||
|
||||
gunichar c = get_char (&p);
|
||||
gunichar nc = get_char (&n);
|
||||
gunichar c = get_char (&p, casefold);
|
||||
gunichar nc = get_char (&n, casefold);
|
||||
|
||||
switch (c)
|
||||
{
|
||||
@@ -97,7 +99,7 @@ gtk_fnmatch_intern (const char *pattern,
|
||||
break;
|
||||
case '\\':
|
||||
if (DO_ESCAPE)
|
||||
c = get_char (&p);
|
||||
c = get_char (&p, casefold);
|
||||
if (nc != c)
|
||||
return FALSE;
|
||||
break;
|
||||
@@ -108,9 +110,9 @@ gtk_fnmatch_intern (const char *pattern,
|
||||
{
|
||||
const char *last_p;
|
||||
|
||||
for (last_p = p, c = get_char (&p);
|
||||
for (last_p = p, c = get_char (&p, casefold);
|
||||
c == '?' || c == '*';
|
||||
last_p = p, c = get_char (&p))
|
||||
last_p = p, c = get_char (&p, casefold))
|
||||
{
|
||||
if (c == '?')
|
||||
{
|
||||
@@ -120,7 +122,7 @@ gtk_fnmatch_intern (const char *pattern,
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
last_n = n; nc = get_char (&n);
|
||||
last_n = n; nc = get_char (&n, casefold);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,17 +140,17 @@ gtk_fnmatch_intern (const char *pattern,
|
||||
}
|
||||
|
||||
if (DO_ESCAPE && c == '\\')
|
||||
c = get_char (&p);
|
||||
c = get_char (&p, casefold);
|
||||
|
||||
for (p = last_p; nc != '\0';)
|
||||
{
|
||||
if ((c == '[' || nc == c) &&
|
||||
gtk_fnmatch_intern (p, last_n, component_start, no_leading_period))
|
||||
gtk_fnmatch_intern (p, last_n, component_start, no_leading_period, casefold))
|
||||
return TRUE;
|
||||
|
||||
component_start = (nc == G_DIR_SEPARATOR);
|
||||
last_n = n;
|
||||
nc = get_char (&n);
|
||||
nc = get_char (&n, casefold);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -170,7 +172,7 @@ gtk_fnmatch_intern (const char *pattern,
|
||||
if (not)
|
||||
++p;
|
||||
|
||||
c = get_unescaped_char (&p, &was_escaped);
|
||||
c = get_unescaped_char (&p, &was_escaped, casefold);
|
||||
for (;;)
|
||||
{
|
||||
register gunichar cstart = c, cend = c;
|
||||
@@ -178,15 +180,15 @@ gtk_fnmatch_intern (const char *pattern,
|
||||
/* [ (unterminated) loses. */
|
||||
return FALSE;
|
||||
|
||||
c = get_unescaped_char (&p, &was_escaped);
|
||||
c = get_unescaped_char (&p, &was_escaped, casefold);
|
||||
|
||||
if (!was_escaped && c == '-' && *p != ']')
|
||||
{
|
||||
cend = get_unescaped_char (&p, &was_escaped);
|
||||
cend = get_unescaped_char (&p, &was_escaped, casefold);
|
||||
if (cend == '\0')
|
||||
return FALSE;
|
||||
|
||||
c = get_char (&p);
|
||||
c = get_char (&p, casefold);
|
||||
}
|
||||
|
||||
if (nc >= cstart && nc <= cend)
|
||||
@@ -208,7 +210,7 @@ gtk_fnmatch_intern (const char *pattern,
|
||||
/* [... (unterminated) loses. */
|
||||
return FALSE;
|
||||
|
||||
c = get_unescaped_char (&p, &was_escaped);
|
||||
c = get_unescaped_char (&p, &was_escaped, casefold);
|
||||
}
|
||||
if (not)
|
||||
return FALSE;
|
||||
@@ -246,113 +248,72 @@ gtk_fnmatch_intern (const char *pattern,
|
||||
gboolean
|
||||
_gtk_fnmatch (const char *pattern,
|
||||
const char *string,
|
||||
gboolean no_leading_period)
|
||||
gboolean no_leading_period,
|
||||
gboolean casefold)
|
||||
{
|
||||
return gtk_fnmatch_intern (pattern, string, TRUE, no_leading_period);
|
||||
return gtk_fnmatch_intern (pattern, string, TRUE, no_leading_period, casefold);
|
||||
}
|
||||
|
||||
#undef FNMATCH_TEST_CASES
|
||||
#ifdef FNMATCH_TEST_CASES
|
||||
|
||||
#define TEST(pat, str, no_leading_period, result) \
|
||||
g_assert (_gtk_fnmatch ((pat), (str), (no_leading_period)) == result)
|
||||
|
||||
int main (int argc, char **argv)
|
||||
/* Turn a glob pattern into a case-insensitive one, by replacing
|
||||
* alphabetic characters by [xX] ranges.
|
||||
*/
|
||||
char *
|
||||
_gtk_make_ci_glob_pattern (const char *pattern)
|
||||
{
|
||||
TEST ("[a-]", "-", TRUE, TRUE);
|
||||
|
||||
TEST ("a", "a", TRUE, TRUE);
|
||||
TEST ("a", "b", TRUE, FALSE);
|
||||
GString *s;
|
||||
gboolean in_range = FALSE;
|
||||
|
||||
/* Test what ? matches */
|
||||
TEST ("?", "a", TRUE, TRUE);
|
||||
TEST ("?", ".", TRUE, FALSE);
|
||||
TEST ("a?", "a.", TRUE, TRUE);
|
||||
TEST ("a/?", "a/b", TRUE, TRUE);
|
||||
TEST ("a/?", "a/.", TRUE, FALSE);
|
||||
TEST ("?", "/", TRUE, FALSE);
|
||||
s = g_string_new ("");
|
||||
for (const char *p = pattern; *p; p = g_utf8_next_char (p))
|
||||
{
|
||||
gunichar c = g_utf8_get_char (p);
|
||||
if (in_range)
|
||||
{
|
||||
g_string_append_unichar (s, c);
|
||||
if (c == ']')
|
||||
in_range = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Test what * matches */
|
||||
TEST ("*", "a", TRUE, TRUE);
|
||||
TEST ("*", ".", TRUE, FALSE);
|
||||
TEST ("a*", "a.", TRUE, TRUE);
|
||||
TEST ("a/*", "a/b", TRUE, TRUE);
|
||||
TEST ("a/*", "a/.", TRUE, FALSE);
|
||||
TEST ("*", "/", TRUE, FALSE);
|
||||
#if DO_ESCAPE
|
||||
if (c == '\\')
|
||||
{
|
||||
g_string_append (s, "\\");
|
||||
p = g_utf8_next_char (p);
|
||||
if (*p == '\0')
|
||||
break;
|
||||
|
||||
/* Range tests */
|
||||
TEST ("[ab]", "a", TRUE, TRUE);
|
||||
TEST ("[ab]", "c", TRUE, FALSE);
|
||||
TEST ("[^ab]", "a", TRUE, FALSE);
|
||||
TEST ("[!ab]", "a", TRUE, FALSE);
|
||||
TEST ("[^ab]", "c", TRUE, TRUE);
|
||||
TEST ("[!ab]", "c", TRUE, TRUE);
|
||||
TEST ("[a-c]", "b", TRUE, TRUE);
|
||||
TEST ("[a-c]", "d", TRUE, FALSE);
|
||||
TEST ("[a-]", "-", TRUE, TRUE);
|
||||
TEST ("[]]", "]", TRUE, TRUE);
|
||||
TEST ("[^]]", "a", TRUE, TRUE);
|
||||
TEST ("[!]]", "a", TRUE, TRUE);
|
||||
c = g_utf8_get_char (p);
|
||||
g_string_append_unichar (s, c);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Various unclosed ranges */
|
||||
TEST ("[ab", "a", TRUE, FALSE);
|
||||
TEST ("[a-", "a", TRUE, FALSE);
|
||||
TEST ("[ab", "c", TRUE, FALSE);
|
||||
TEST ("[a-", "c", TRUE, FALSE);
|
||||
TEST ("[^]", "a", TRUE, FALSE);
|
||||
if (c == '[')
|
||||
{
|
||||
g_string_append (s, "[");
|
||||
p = g_utf8_next_char (p);
|
||||
if (*p == '\0')
|
||||
break;
|
||||
|
||||
/* Ranges and special no-wildcard matches */
|
||||
TEST ("[.]", ".", TRUE, FALSE);
|
||||
TEST ("a[.]", "a.", TRUE, TRUE);
|
||||
TEST ("a/[.]", "a/.", TRUE, FALSE);
|
||||
TEST ("[/]", "/", TRUE, FALSE);
|
||||
TEST ("[^/]", "a", TRUE, TRUE);
|
||||
|
||||
/* Basic tests of * (and combinations of * and ?) */
|
||||
TEST ("a*b", "ab", TRUE, TRUE);
|
||||
TEST ("a*b", "axb", TRUE, TRUE);
|
||||
TEST ("a*b", "axxb", TRUE, TRUE);
|
||||
TEST ("a**b", "ab", TRUE, TRUE);
|
||||
TEST ("a**b", "axb", TRUE, TRUE);
|
||||
TEST ("a**b", "axxb", TRUE, TRUE);
|
||||
TEST ("a*?*b", "ab", TRUE, FALSE);
|
||||
TEST ("a*?*b", "axb", TRUE, TRUE);
|
||||
TEST ("a*?*b", "axxb", TRUE, TRUE);
|
||||
c = g_utf8_get_char (p);
|
||||
g_string_append_unichar (s, c);
|
||||
|
||||
/* Test of *[range] */
|
||||
TEST ("a*[cd]", "ac", TRUE, TRUE);
|
||||
TEST ("a*[cd]", "axc", TRUE, TRUE);
|
||||
TEST ("a*[cd]", "axx", TRUE, FALSE);
|
||||
in_range = TRUE;
|
||||
continue;
|
||||
}
|
||||
else if (g_unichar_isalpha (c))
|
||||
{
|
||||
g_string_append (s, "[");
|
||||
g_string_append_unichar (s, g_unichar_tolower (c));
|
||||
g_string_append_unichar (s, g_unichar_toupper (c));
|
||||
g_string_append (s, "]");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_string_append_unichar (s, c);
|
||||
}
|
||||
}
|
||||
|
||||
TEST ("a/[.]", "a/.", TRUE, FALSE);
|
||||
TEST ("a*[.]", "a/.", TRUE, FALSE);
|
||||
|
||||
/* Test of UTF-8 */
|
||||
|
||||
TEST ("ä", "ä", TRUE, TRUE); /* TEST ("ä", "ä", TRUE); */
|
||||
TEST ("?", "ä", TRUE, TRUE); /* TEST ("?", "ä", TRUE); */
|
||||
TEST ("*ö", "äö", TRUE, TRUE); /* TEST ("*ö", "äö", TRUE); */
|
||||
TEST ("*ö", "ääö", TRUE, TRUE); /* TEST ("*ö", "ääö", TRUE); */
|
||||
TEST ("[ä]", "ä", TRUE, TRUE); /* TEST ("[ä]", "ä", TRUE); */
|
||||
TEST ("[ä-ö]", "é", TRUE, TRUE); /* TEST ("[ä-ö]", "é", TRUE); */
|
||||
TEST ("[ä-ö]", "a", TRUE, FALSE); /* TEST ("[ä-ö]", "a", FALSE); */
|
||||
|
||||
#ifdef DO_ESCAPE
|
||||
/* Tests of escaping */
|
||||
TEST ("\\\\", "\\", TRUE, TRUE);
|
||||
TEST ("\\?", "?", TRUE, TRUE);
|
||||
TEST ("\\?", "a", TRUE, FALSE);
|
||||
TEST ("\\*", "*", TRUE, TRUE);
|
||||
TEST ("\\*", "a", TRUE, FALSE);
|
||||
TEST ("\\[a-b]", "[a-b]", TRUE, TRUE);
|
||||
TEST ("[\\\\]", "\\", TRUE, TRUE);
|
||||
TEST ("[\\^a]", "a", TRUE, TRUE);
|
||||
TEST ("[a\\-c]", "b", TRUE, FALSE);
|
||||
TEST ("[a\\-c]", "-", TRUE, TRUE);
|
||||
TEST ("[a\\]", "a", TRUE, FALSE);
|
||||
#endif /* DO_ESCAPE */
|
||||
|
||||
return 0;
|
||||
return g_string_free (s, FALSE);
|
||||
}
|
||||
|
||||
#endif /* FNMATCH_TEST_CASES */
|
||||
|
||||
@@ -191,6 +191,7 @@
|
||||
#include <gtk/gtkpaned.h>
|
||||
#include <gtk/gtkpapersize.h>
|
||||
#include <gtk/gtkpasswordentry.h>
|
||||
#include <gtk/gtkpasswordentrybuffer.h>
|
||||
#include <gtk/gtkpicture.h>
|
||||
#include <gtk/gtkpopover.h>
|
||||
#include <gtk/gtkpopovermenu.h>
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
#include <gio/gunixfdlist.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
@@ -121,7 +119,6 @@ enum {
|
||||
WINDOW_ADDED,
|
||||
WINDOW_REMOVED,
|
||||
QUERY_END,
|
||||
CREATE_WINDOW,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -133,7 +130,6 @@ enum {
|
||||
PROP_SCREENSAVER_ACTIVE,
|
||||
PROP_MENUBAR,
|
||||
PROP_ACTIVE_WINDOW,
|
||||
PROP_SAVE_STATE,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
@@ -151,7 +147,6 @@ typedef struct
|
||||
|
||||
gboolean register_session;
|
||||
gboolean screensaver_active;
|
||||
gboolean save_state;
|
||||
GtkActionMuxer *muxer;
|
||||
GtkBuilder *menus_builder;
|
||||
char *help_overlay_path;
|
||||
@@ -275,26 +270,6 @@ gtk_application_startup (GApplication *g_application)
|
||||
gdk_profiler_end_mark (before, "gtk application startup", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_activate (GApplication *g_application)
|
||||
{
|
||||
GtkApplication *application = GTK_APPLICATION (g_application);
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
guint activate_id;
|
||||
|
||||
activate_id = g_signal_lookup ("activate", G_TYPE_APPLICATION);
|
||||
if (!g_signal_has_handler_pending (g_application, activate_id, 0, TRUE))
|
||||
{
|
||||
if (!priv->save_state ||
|
||||
!gtk_application_restore (application))
|
||||
{
|
||||
g_signal_emit (application,
|
||||
gtk_application_signals[CREATE_WINDOW], 0, NULL);
|
||||
gtk_window_present (GTK_WINDOW (priv->windows->data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_shutdown (GApplication *g_application)
|
||||
{
|
||||
@@ -309,9 +284,6 @@ gtk_application_shutdown (GApplication *g_application)
|
||||
|
||||
gtk_action_muxer_remove (priv->muxer, "app");
|
||||
|
||||
if (priv->save_state)
|
||||
gtk_application_save (application);
|
||||
|
||||
gtk_main_sync ();
|
||||
|
||||
G_APPLICATION_CLASS (gtk_application_parent_class)->shutdown (g_application);
|
||||
@@ -479,10 +451,6 @@ gtk_application_get_property (GObject *object,
|
||||
g_value_set_object (value, gtk_application_get_active_window (application));
|
||||
break;
|
||||
|
||||
case PROP_SAVE_STATE:
|
||||
g_value_set_boolean (value, priv->save_state);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -508,10 +476,6 @@ gtk_application_set_property (GObject *object,
|
||||
gtk_application_set_menubar (application, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_SAVE_STATE:
|
||||
priv->save_state = g_value_get_boolean (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -566,7 +530,6 @@ gtk_application_class_init (GtkApplicationClass *class)
|
||||
application_class->after_emit = gtk_application_after_emit;
|
||||
application_class->startup = gtk_application_startup;
|
||||
application_class->shutdown = gtk_application_shutdown;
|
||||
application_class->activate = gtk_application_activate;
|
||||
application_class->dbus_register = gtk_application_dbus_register;
|
||||
application_class->dbus_unregister = gtk_application_dbus_unregister;
|
||||
|
||||
@@ -623,33 +586,6 @@ gtk_application_class_init (GtkApplicationClass *class)
|
||||
NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkApplication::create-window:
|
||||
* @application: the `GtkApplication` which emitted the signal
|
||||
* @save_id: (nullable): save-id to set on the new window
|
||||
*
|
||||
* In response to this signal, you should create a new application window,
|
||||
* and add it to @application.
|
||||
*
|
||||
*`GtkApplication` will call [method@Gtk.Window.present] on the window.
|
||||
|
||||
* If @save_id is passed, it should be set as the [property@Gtk.Widget:save-id]
|
||||
* of the newly created window.
|
||||
*
|
||||
* You should handle this signal instead of `::activate` to make automatic
|
||||
* session saving work. See [property@Gtk.Application:save-state] for more
|
||||
* information.
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
gtk_application_signals[CREATE_WINDOW] =
|
||||
g_signal_new (I_("create-window"), GTK_TYPE_APPLICATION, G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GtkApplicationClass, create_window),
|
||||
NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_STRING);
|
||||
|
||||
/**
|
||||
* GtkApplication:register-session:
|
||||
*
|
||||
@@ -708,29 +644,6 @@ gtk_application_class_init (GtkApplicationClass *class)
|
||||
GTK_TYPE_WINDOW,
|
||||
G_PARAM_READABLE|G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkApplication:save-state:
|
||||
*
|
||||
* Whether to save and restore the application state automatically when the
|
||||
* application is closed or the session ends.
|
||||
*
|
||||
* In order to make automatic state restoration work, you should handle
|
||||
* [signal@Gtk.Application::create-window]. The default `::activate` handler
|
||||
* will emit that signal as needed, and call [method@Gtk.Application.restore]
|
||||
* when it finds saved state.
|
||||
*
|
||||
* In order to make state saving work, widgets need to have a
|
||||
* [property@Gtk.Widget:save-id] set.
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
gtk_application_props[PROP_SAVE_STATE] =
|
||||
g_param_spec_boolean ("save-state",
|
||||
P_("Save state"),
|
||||
P_("Whether to save application state automatically"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, gtk_application_props);
|
||||
}
|
||||
|
||||
@@ -1317,162 +1230,3 @@ gtk_application_set_screensaver_active (GtkApplication *application,
|
||||
g_object_notify (G_OBJECT (application), "screensaver-active");
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
get_state_file (GtkApplication *application)
|
||||
{
|
||||
const char *app_id;
|
||||
const char *dir;
|
||||
|
||||
app_id = g_application_get_application_id (G_APPLICATION (application));
|
||||
dir = g_get_user_cache_dir ();
|
||||
return g_strconcat (dir, G_DIR_SEPARATOR_S, app_id, ".state", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_application_save:
|
||||
* @application: a `GtkApplication`
|
||||
*
|
||||
* Saves the state of application.
|
||||
*
|
||||
* See [method@Gtk.Application.restore] for a way to restore the state.
|
||||
*
|
||||
* If [property@Gtk.Application:save-state] is set, `GtkApplication` calls this
|
||||
* function automatically when the application is closed or the session ends.
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
void
|
||||
gtk_application_save (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
GList *l;
|
||||
GVariantBuilder builder;
|
||||
GVariant *state;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
|
||||
|
||||
for (l = priv->windows; l != NULL; l = l->next)
|
||||
{
|
||||
const char *id;
|
||||
GVariant *v;
|
||||
|
||||
id = gtk_widget_get_save_id (GTK_WIDGET (l->data));
|
||||
if (!id)
|
||||
continue;
|
||||
|
||||
v = gtk_widget_save_state (GTK_WIDGET (l->data));
|
||||
g_variant_builder_add (&builder, "{sv}", id, v);
|
||||
}
|
||||
|
||||
state = g_variant_builder_end (&builder);
|
||||
|
||||
if (g_variant_n_children (state) > 0)
|
||||
{
|
||||
char *file = get_state_file (application);
|
||||
|
||||
g_file_set_contents (file,
|
||||
g_variant_get_data (state),
|
||||
g_variant_get_size (state),
|
||||
NULL);
|
||||
|
||||
g_free (file);
|
||||
}
|
||||
|
||||
g_variant_unref (state);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_application_forget:
|
||||
* @application: a `GtkApplication`
|
||||
*
|
||||
* Forget state that has been previously saved.
|
||||
*
|
||||
* Note that `GtkApplication` will save state automatically
|
||||
* as long as [property@Gtk.Application:save-state] is set,
|
||||
* so you probably want to unset that property as well, if
|
||||
* your goal is to implement a “factory reset”.
|
||||
*
|
||||
* See [method@Gtk.Application.save] for more information.
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
void
|
||||
gtk_application_forget (GtkApplication *application)
|
||||
{
|
||||
char *file = get_state_file (application);
|
||||
|
||||
g_remove (file);
|
||||
|
||||
g_free (file);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_application_restore:
|
||||
* @application: a `GtkApplication`
|
||||
*
|
||||
* Restores previously saved state.
|
||||
*
|
||||
* See [method@Gtk.Application.save] for a way to save application state.
|
||||
*
|
||||
* If [property@Gtk.Application:save-state] is set, `GtkApplication` calls this
|
||||
* function automatically in the default `::activate` handler. Note that you
|
||||
* need to handle the [signal@Gtk.Application::create-window] to make restoring
|
||||
* state work.
|
||||
*
|
||||
* Returns: %TRUE if at least one window has been restored from saved state
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
gboolean
|
||||
gtk_application_restore (GtkApplication *application)
|
||||
{
|
||||
GtkApplicationPrivate *priv = gtk_application_get_instance_private (application);
|
||||
char *file = get_state_file (application);
|
||||
char *contents;
|
||||
gsize len;
|
||||
GVariant *state;
|
||||
GVariantIter iter;
|
||||
const char *key;
|
||||
gboolean restored;
|
||||
|
||||
if (!g_file_get_contents (file, &contents, &len, NULL))
|
||||
{
|
||||
g_free (file);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
state = g_variant_new_from_data (G_VARIANT_TYPE_VARDICT, contents, len, FALSE, NULL, NULL);
|
||||
g_variant_iter_init (&iter, state);
|
||||
while (g_variant_iter_next (&iter, "{sv}", &key, NULL))
|
||||
g_signal_emit (application, gtk_application_signals[CREATE_WINDOW], 0, key);
|
||||
|
||||
restored = FALSE;
|
||||
|
||||
for (GList *l = priv->windows; l; l = l->next)
|
||||
{
|
||||
GtkWidget *window = GTK_WIDGET (l->data);
|
||||
const char *id;
|
||||
GVariant *v;
|
||||
|
||||
id = gtk_widget_get_save_id (window);
|
||||
if (id &&
|
||||
(v = g_variant_lookup_value (state, id, NULL)) != NULL)
|
||||
{
|
||||
restored = TRUE;
|
||||
gtk_widget_restore_state (window, v);
|
||||
g_variant_unref (v);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("::create-window did not set save-id");
|
||||
}
|
||||
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
g_free (file);
|
||||
g_free (contents);
|
||||
|
||||
return restored;
|
||||
}
|
||||
|
||||
+1
-12
@@ -64,11 +64,8 @@ struct _GtkApplicationClass
|
||||
void (*window_removed) (GtkApplication *application,
|
||||
GtkWindow *window);
|
||||
|
||||
void (*create_window) (GtkApplication *application,
|
||||
const char *save_id);
|
||||
|
||||
/*< private >*/
|
||||
gpointer padding[7];
|
||||
gpointer padding[8];
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@@ -138,14 +135,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
GMenu * gtk_application_get_menu_by_id (GtkApplication *application,
|
||||
const char *id);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
void gtk_application_save (GtkApplication *application);
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
void gtk_application_forget (GtkApplication *application);
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
gboolean gtk_application_restore (GtkApplication *application);
|
||||
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplication, g_object_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "gtkintl.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtkshortcutswindowprivate.h"
|
||||
#include "gtktooltipprivate.h"
|
||||
|
||||
#if defined(HAVE_GIO_UNIX) && !defined(__APPLE__)
|
||||
#include <gio/gdesktopappinfo.h>
|
||||
@@ -487,6 +488,8 @@ gtk_application_window_real_size_allocate (GtkWidget *widget,
|
||||
child = gtk_window_get_child (GTK_WINDOW (window));
|
||||
if (child != NULL && gtk_widget_get_visible (child))
|
||||
gtk_widget_size_allocate (child, &child_allocation, baseline);
|
||||
|
||||
gtk_tooltip_maybe_allocate (GTK_NATIVE (widget));
|
||||
}
|
||||
else
|
||||
GTK_WIDGET_CLASS (gtk_application_window_parent_class)->size_allocate (widget,
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "gtkversion.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
|
||||
/* XXX: For g_memdup2() */
|
||||
#include "gtkprivate.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "gtkcellareaboxcontextprivate.h"
|
||||
#include "gtkorientable.h"
|
||||
|
||||
/* XXX: For g_memdup2() */
|
||||
#include "gtkprivate.h"
|
||||
|
||||
/* GObjectClass */
|
||||
|
||||
+7
-3
@@ -436,7 +436,10 @@ gtk_cell_layout_set_attributesv (GtkCellLayout *cell_layout,
|
||||
* @cell: a `GtkCellRenderer`
|
||||
* @...: a %NULL-terminated list of attributes
|
||||
*
|
||||
* Sets the attributes in list as the attributes of @cell_layout.
|
||||
* Sets the attributes in the parameter list as the attributes
|
||||
* of @cell_layout.
|
||||
*
|
||||
* See [method@Gtk.CellLayout.add_attribute] for more details.
|
||||
*
|
||||
* The attributes should be in attribute/column order, as in
|
||||
* gtk_cell_layout_add_attribute(). All existing attributes are
|
||||
@@ -461,15 +464,16 @@ gtk_cell_layout_set_attributes (GtkCellLayout *cell_layout,
|
||||
* gtk_cell_layout_add_attribute:
|
||||
* @cell_layout: a `GtkCellLayout`
|
||||
* @cell: a `GtkCellRenderer`
|
||||
* @attribute: an attribute on the renderer
|
||||
* @attribute: a property on the renderer
|
||||
* @column: the column position on the model to get the attribute from
|
||||
*
|
||||
* Adds an attribute mapping to the list in @cell_layout.
|
||||
*
|
||||
* The @column is the column of the model to get a value from, and the
|
||||
* @attribute is the parameter on @cell to be set from the value. So for
|
||||
* @attribute is the property on @cell to be set from that value. So for
|
||||
* example if column 2 of the model contains strings, you could have the
|
||||
* “text” attribute of a `GtkCellRendererText` get its values from column 2.
|
||||
* In this context "attribute" and "property" are used interchangeably.
|
||||
*/
|
||||
void
|
||||
gtk_cell_layout_add_attribute (GtkCellLayout *cell_layout,
|
||||
|
||||
@@ -498,29 +498,6 @@ gtk_check_button_real_activate (GtkCheckButton *self)
|
||||
gtk_check_button_set_active (self, !gtk_check_button_get_active (self));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_check_button_save_state (GtkWidget *self,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
g_variant_dict_insert (dict, "active", "b", gtk_check_button_get_active (GTK_CHECK_BUTTON (self)));
|
||||
*save_children = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_check_button_restore_state (GtkWidget *self,
|
||||
GVariant *data)
|
||||
{
|
||||
gboolean value;
|
||||
|
||||
if (g_variant_lookup (data, "active", "b", &value))
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (self), value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_check_button_class_init (GtkCheckButtonClass *class)
|
||||
{
|
||||
@@ -541,8 +518,6 @@ gtk_check_button_class_init (GtkCheckButtonClass *class)
|
||||
|
||||
widget_class->state_flags_changed = gtk_check_button_state_flags_changed;
|
||||
widget_class->focus = gtk_check_button_focus;
|
||||
widget_class->save_state = gtk_check_button_save_state;
|
||||
widget_class->restore_state = gtk_check_button_restore_state;
|
||||
|
||||
class->activate = gtk_check_button_real_activate;
|
||||
|
||||
|
||||
@@ -263,43 +263,6 @@ update_from_editor (GtkColorEditor *editor,
|
||||
g_object_notify (G_OBJECT (widget), "rgba");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_color_chooser_save_state (GtkWidget *widget,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (widget);
|
||||
GdkRGBA c;
|
||||
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (cc), &c);
|
||||
|
||||
g_variant_dict_insert (dict, "show-editor", "b", gtk_widget_get_visible (cc->editor));
|
||||
g_variant_dict_insert (dict, "rgba", "(dddd)", c.red, c.green, c.blue, c.alpha);
|
||||
*save_children = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_color_chooser_restore_state (GtkWidget *widget,
|
||||
GVariant *data)
|
||||
{
|
||||
GtkColorChooserWidget *cc = GTK_COLOR_CHOOSER_WIDGET (widget);
|
||||
gboolean show_editor;
|
||||
double r, g, b, a;
|
||||
|
||||
if (g_variant_lookup (data, "show-editor", "b", &show_editor))
|
||||
gtk_color_chooser_widget_set_show_editor (cc, show_editor);
|
||||
|
||||
if (g_variant_lookup (data, "rgba", "(dddd)", &r, &g, &b, &a))
|
||||
{
|
||||
GdkRGBA c = { r, g, b, a };
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (cc), &c);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* UI construction {{{1 */
|
||||
|
||||
static void
|
||||
@@ -743,8 +706,6 @@ gtk_color_chooser_widget_class_init (GtkColorChooserWidgetClass *class)
|
||||
|
||||
widget_class->grab_focus = gtk_widget_grab_focus_child;
|
||||
widget_class->focus = gtk_widget_focus_child;
|
||||
widget_class->save_state = gtk_color_chooser_save_state;
|
||||
widget_class->restore_state = gtk_color_chooser_restore_state;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_RGBA, "rgba");
|
||||
g_object_class_override_property (object_class, PROP_USE_ALPHA, "use-alpha");
|
||||
|
||||
+10
-1
@@ -1851,6 +1851,10 @@ gtk_combo_box_new (void)
|
||||
*
|
||||
* Creates a new empty `GtkComboBox` with an entry.
|
||||
*
|
||||
* In order to use a combo box with entry, you need to tell it
|
||||
* which column of the model contains the text for the entry
|
||||
* by calling [method@Gtk.ComboBox.set_entry_text_column].
|
||||
*
|
||||
* Returns: A new `GtkComboBox`
|
||||
*/
|
||||
GtkWidget *
|
||||
@@ -1885,6 +1889,8 @@ gtk_combo_box_new_with_model (GtkTreeModel *model)
|
||||
*
|
||||
* Creates a new empty `GtkComboBox` with an entry and a model.
|
||||
*
|
||||
* See also [ctor@Gtk.ComboBox.new_with_entry].
|
||||
*
|
||||
* Returns: A new `GtkComboBox`
|
||||
*/
|
||||
GtkWidget *
|
||||
@@ -2674,7 +2680,10 @@ gtk_combo_box_get_has_entry (GtkComboBox *combo_box)
|
||||
* the internal entry
|
||||
*
|
||||
* Sets the model column which @combo_box should use to get strings
|
||||
* from to be @text_column.
|
||||
* from to be @text_column.
|
||||
*
|
||||
* For this column no separate
|
||||
* [class@Gtk.CellRenderer] is needed.
|
||||
*
|
||||
* The column @text_column in the model of @combo_box must be of
|
||||
* type %G_TYPE_STRING.
|
||||
|
||||
@@ -268,7 +268,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
font_size = _gtk_css_number_value_get (parent_style->core->font_size, 100);
|
||||
else
|
||||
font_size = gtk_css_font_size_get_default_px (provider, style);
|
||||
/* XXX: This is what WebKit does... */
|
||||
/* This is what WebKit does... */
|
||||
font_size /= 1.2;
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_LARGER:
|
||||
@@ -276,7 +276,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
font_size = _gtk_css_number_value_get (parent_style->core->font_size, 100);
|
||||
else
|
||||
font_size = gtk_css_font_size_get_default_px (provider, style);
|
||||
/* XXX: This is what WebKit does... */
|
||||
/* This is what WebKit does... */
|
||||
font_size *= 1.2;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
|
||||
/* XXX: For g_memdup2() */
|
||||
#include "gtkprivate.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -97,7 +96,8 @@ gtk_css_keyframes_add_keyframe (GtkCssKeyframes *keyframes,
|
||||
KEYFRAMES_VALUE (keyframes, k, p) = NULL;
|
||||
|
||||
/* XXX: GC properties that are now unset
|
||||
* in all keyframes? */
|
||||
* in all keyframes?
|
||||
*/
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "gtkcssnodedeclarationprivate.h"
|
||||
|
||||
/* XXX: For g_memdup2() */
|
||||
#include "gtkprivate.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "gtkexpression.h"
|
||||
|
||||
/* XXX: For g_memdup2() */
|
||||
#include "gtkprivate.h"
|
||||
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
+94
-10
@@ -23,8 +23,8 @@
|
||||
*
|
||||
* `GtkFileFilter` can be used to restrict the files being shown in a
|
||||
* `GtkFileChooser`. Files can be filtered based on their name (with
|
||||
* [method@Gtk.FileFilter.add_pattern]) or on their mime type (with
|
||||
* [method@Gtk.FileFilter.add_mime_type]).
|
||||
* [method@Gtk.FileFilter.add_pattern] or [method@Gtk.FileFilter.add_suffix])
|
||||
* or on their mime type (with [method@Gtk.FileFilter.add_mime_type]).
|
||||
*
|
||||
* Filtering by mime types handles aliasing and subclassing of mime
|
||||
* types; e.g. a filter for text/plain also matches a file with mime
|
||||
@@ -40,11 +40,13 @@
|
||||
* # GtkFileFilter as GtkBuildable
|
||||
*
|
||||
* The `GtkFileFilter` implementation of the `GtkBuildable` interface
|
||||
* supports adding rules using the <mime-types> and <patterns>
|
||||
* elements and listing the rules within. Specifying a <mime-type>
|
||||
* or <pattern> has the same effect as as calling
|
||||
* supports adding rules using the `<mime-types>` and `<patterns>` and
|
||||
* `<suffixes>` elements and listing the rules within. Specifying a
|
||||
* `<mime-type>` or `<pattern>` or `<suffix>` has the same effect as
|
||||
* as calling
|
||||
* [method@Gtk.FileFilter.add_mime_type] or
|
||||
* [method@Gtk.FileFilter.add_pattern].
|
||||
* [method@Gtk.FileFilter.add_pattern] or
|
||||
* [method@Gtk.FileFilter.add_suffix].
|
||||
*
|
||||
* An example of a UI definition fragment specifying `GtkFileFilter`
|
||||
* rules:
|
||||
@@ -57,8 +59,10 @@
|
||||
* </mime-types>
|
||||
* <patterns>
|
||||
* <pattern>*.txt</pattern>
|
||||
* <pattern>*.png</pattern>
|
||||
* </patterns>
|
||||
* <suffixes>
|
||||
* <suffix>png</suffix>
|
||||
* </suffixes>
|
||||
* </object>
|
||||
* ```
|
||||
*/
|
||||
@@ -85,6 +89,7 @@ typedef struct _FilterRule FilterRule;
|
||||
typedef enum {
|
||||
FILTER_RULE_PATTERN,
|
||||
FILTER_RULE_MIME_TYPE,
|
||||
FILTER_RULE_SUFFIX,
|
||||
FILTER_RULE_PIXBUF_FORMATS
|
||||
} FilterRuleType;
|
||||
|
||||
@@ -182,6 +187,7 @@ filter_rule_free (FilterRule *rule)
|
||||
switch (rule->type)
|
||||
{
|
||||
case FILTER_RULE_PATTERN:
|
||||
case FILTER_RULE_SUFFIX:
|
||||
g_free (rule->u.pattern);
|
||||
break;
|
||||
case FILTER_RULE_MIME_TYPE:
|
||||
@@ -245,7 +251,8 @@ gtk_file_filter_class_init (GtkFileFilterClass *class)
|
||||
typedef enum
|
||||
{
|
||||
PARSE_MIME_TYPES,
|
||||
PARSE_PATTERNS
|
||||
PARSE_PATTERNS,
|
||||
PARSE_SUFFIXES
|
||||
} ParserType;
|
||||
|
||||
typedef struct
|
||||
@@ -293,6 +300,13 @@ parser_start_element (GtkBuildableParseContext *context,
|
||||
if (!_gtk_builder_check_parent (data->builder, context, "patterns", error))
|
||||
return;
|
||||
|
||||
data->parsing = TRUE;
|
||||
}
|
||||
else if (strcmp (element_name, "suffix") == 0)
|
||||
{
|
||||
if (!_gtk_builder_check_parent (data->builder, context, "suffixes", error))
|
||||
return;
|
||||
|
||||
data->parsing = TRUE;
|
||||
}
|
||||
else
|
||||
@@ -334,6 +348,9 @@ parser_end_element (GtkBuildableParseContext *context,
|
||||
case PARSE_PATTERNS:
|
||||
gtk_file_filter_add_pattern (data->filter, data->string->str);
|
||||
break;
|
||||
case PARSE_SUFFIXES:
|
||||
gtk_file_filter_add_suffix (data->filter, data->string->str);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -379,6 +396,17 @@ gtk_file_filter_buildable_custom_tag_start (GtkBuildable *buildable,
|
||||
data->filter = GTK_FILE_FILTER (buildable);
|
||||
data->builder = builder;
|
||||
|
||||
*parser = sub_parser;
|
||||
*parser_data = data;
|
||||
}
|
||||
else if (strcmp (tagname, "suffixes") == 0)
|
||||
{
|
||||
data = g_slice_new0 (SubParserData);
|
||||
data->string = g_string_new ("");
|
||||
data->type = PARSE_SUFFIXES;
|
||||
data->filter = GTK_FILE_FILTER (buildable);
|
||||
data->builder = builder;
|
||||
|
||||
*parser = sub_parser;
|
||||
*parser_data = data;
|
||||
}
|
||||
@@ -422,7 +450,8 @@ gtk_file_filter_buildable_init (GtkBuildableIface *iface)
|
||||
* Such a filter doesn’t accept any files, so is not
|
||||
* particularly useful until you add rules with
|
||||
* [method@Gtk.FileFilter.add_mime_type],
|
||||
* [method@Gtk.FileFilter.add_pattern], or
|
||||
* [method@Gtk.FileFilter.add_pattern],
|
||||
* [method@Gtk.FileFilter.add_suffix] or
|
||||
* [method@Gtk.FileFilter.add_pixbuf_formats].
|
||||
*
|
||||
* To create a filter that accepts any file, use:
|
||||
@@ -543,6 +572,10 @@ gtk_file_filter_add_mime_type (GtkFileFilter *filter,
|
||||
* @pattern: a shell style glob
|
||||
*
|
||||
* Adds a rule allowing a shell style glob to a filter.
|
||||
*
|
||||
* Note that it depends on the platform whether pattern
|
||||
* matching ignores case or not. On Windows, it does, on
|
||||
* other platforms, it doesn't.
|
||||
*/
|
||||
void
|
||||
gtk_file_filter_add_pattern (GtkFileFilter *filter,
|
||||
@@ -561,6 +594,36 @@ gtk_file_filter_add_pattern (GtkFileFilter *filter,
|
||||
file_filter_add_rule (filter, rule);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_file_filter_add_suffix:
|
||||
* @filter: a `GtkFileFilter`
|
||||
* @suffix: filename suffix to match
|
||||
*
|
||||
* Adds a suffix match rule to a filter.
|
||||
*
|
||||
* This is similar to adding a match for the pattern
|
||||
* "*.@suffix".
|
||||
*
|
||||
* In contrast to pattern matches, suffix matches
|
||||
* are *always* case-insensitive.
|
||||
*/
|
||||
void
|
||||
gtk_file_filter_add_suffix (GtkFileFilter *filter,
|
||||
const char *suffix)
|
||||
{
|
||||
FilterRule *rule;
|
||||
|
||||
g_return_if_fail (GTK_IS_FILE_FILTER (filter));
|
||||
g_return_if_fail (suffix != NULL);
|
||||
|
||||
rule = g_slice_new (FilterRule);
|
||||
rule->type = FILTER_RULE_SUFFIX;
|
||||
rule->u.pattern = g_strconcat ("*.", suffix, NULL);
|
||||
|
||||
file_filter_add_attribute (filter, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME);
|
||||
file_filter_add_rule (filter, rule);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_file_filter_add_pixbuf_formats:
|
||||
* @filter: a `GtkFileFilter`
|
||||
@@ -657,6 +720,7 @@ NSArray * _gtk_file_filter_get_as_pattern_nsstrings (GtkFileFilter *filter)
|
||||
break;
|
||||
|
||||
case FILTER_RULE_PATTERN:
|
||||
case FILTER_RULE_SUFFIX:
|
||||
{
|
||||
// patterns will need to be stripped of their leading *.
|
||||
GString *pattern = g_string_new (rule->u.pattern);
|
||||
@@ -725,6 +789,10 @@ _gtk_file_filter_get_as_patterns (GtkFileFilter *filter)
|
||||
break;
|
||||
|
||||
case FILTER_RULE_PATTERN:
|
||||
case FILTER_RULE_SUFFIX:
|
||||
/* Note: we don't make the suffix pattern explicitly
|
||||
* case-insensitive, since this is only used on Windows
|
||||
*/
|
||||
g_ptr_array_add (array, g_strdup (rule->u.pattern));
|
||||
break;
|
||||
|
||||
@@ -794,9 +862,14 @@ gtk_file_filter_match (GtkFilter *filter,
|
||||
for (tmp_list = file_filter->rules; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
FilterRule *rule = tmp_list->data;
|
||||
gboolean ignore_case = FALSE;
|
||||
|
||||
switch (rule->type)
|
||||
{
|
||||
case FILTER_RULE_SUFFIX:
|
||||
ignore_case = TRUE;
|
||||
G_GNUC_FALLTHROUGH;
|
||||
|
||||
case FILTER_RULE_PATTERN:
|
||||
{
|
||||
const char *display_name;
|
||||
@@ -804,7 +877,7 @@ gtk_file_filter_match (GtkFilter *filter,
|
||||
display_name = g_file_info_get_display_name (info);
|
||||
if (display_name)
|
||||
{
|
||||
if (_gtk_fnmatch (rule->u.pattern, display_name, FALSE))
|
||||
if (_gtk_fnmatch (rule->u.pattern, display_name, FALSE, ignore_case))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -863,6 +936,17 @@ gtk_file_filter_to_gvariant (GtkFileFilter *filter)
|
||||
g_variant_builder_add (&builder, "(us)", 0, rule->u.pattern);
|
||||
break;
|
||||
|
||||
case FILTER_RULE_SUFFIX:
|
||||
{
|
||||
/* Tweak the glob, since the filechooser portal has no api
|
||||
* for case-insensitive globs
|
||||
*/
|
||||
char *pattern = _gtk_make_ci_glob_pattern (rule->u.pattern);
|
||||
g_variant_builder_add (&builder, "(us)", 0, pattern);
|
||||
g_free (pattern);
|
||||
}
|
||||
break;
|
||||
|
||||
case FILTER_RULE_MIME_TYPE:
|
||||
case FILTER_RULE_PIXBUF_FORMATS:
|
||||
for (i = 0; rule->u.content_types[i]; i++)
|
||||
|
||||
@@ -48,9 +48,15 @@ const char * gtk_file_filter_get_name (GtkFileFilter *filter);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_file_filter_add_mime_type (GtkFileFilter *filter,
|
||||
const char *mime_type);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_file_filter_add_pattern (GtkFileFilter *filter,
|
||||
const char *pattern);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
void gtk_file_filter_add_suffix (GtkFileFilter *filter,
|
||||
const char *suffix);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_file_filter_add_pixbuf_formats (GtkFileFilter *filter);
|
||||
|
||||
|
||||
+1
-1
@@ -2269,7 +2269,7 @@ real_choose_icon (GtkIconTheme *self,
|
||||
{
|
||||
GTK_NOTE(ICONFALLBACK, {
|
||||
char *s = g_strjoinv (", ", (char **)icon_names);
|
||||
g_message ("No icon found for: %s", s);
|
||||
g_message ("No icon found in %s (or fallbacks) for: %s", self->current_theme, s);
|
||||
g_free (s);
|
||||
});
|
||||
icon = icon_paintable_new ("image-missing", size, scale);
|
||||
|
||||
+3
-3
@@ -2002,7 +2002,7 @@ gtk_icon_view_set_cursor (GtkIconView *icon_view,
|
||||
_gtk_icon_view_set_cell_data (icon_view, item);
|
||||
gtk_cell_area_activate (icon_view->priv->cell_area, context,
|
||||
GTK_WIDGET (icon_view), &item->cell_area,
|
||||
0 /* XXX flags */, TRUE);
|
||||
0, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2156,7 +2156,7 @@ gtk_icon_view_button_press (GtkGestureClick *gesture,
|
||||
_gtk_icon_view_set_cell_data (icon_view, item);
|
||||
gtk_cell_area_activate (icon_view->priv->cell_area, context,
|
||||
GTK_WIDGET (icon_view),
|
||||
&item->cell_area, 0/* XXX flags */, FALSE);
|
||||
&item->cell_area, 0, FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2489,7 +2489,7 @@ gtk_icon_view_real_activate_cursor_item (GtkIconView *icon_view)
|
||||
gtk_cell_area_activate (icon_view->priv->cell_area, context,
|
||||
GTK_WIDGET (icon_view),
|
||||
&icon_view->priv->cursor_item->cell_area,
|
||||
0 /* XXX flags */,
|
||||
0,
|
||||
FALSE);
|
||||
|
||||
path = gtk_tree_path_new_from_indices (icon_view->priv->cursor_item->index, -1);
|
||||
|
||||
@@ -91,6 +91,8 @@ static GSList *global_tables;
|
||||
|
||||
static const guint16 gtk_compose_ignore[] = {
|
||||
0, /* Yes, XKB will send us key press events with NoSymbol :( */
|
||||
GDK_KEY_Overlay1_Enable,
|
||||
GDK_KEY_Overlay2_Enable,
|
||||
GDK_KEY_Shift_L,
|
||||
GDK_KEY_Shift_R,
|
||||
GDK_KEY_Control_L,
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkbuttonprivate.h"
|
||||
#include "gtknative.h"
|
||||
#include "gtkwindow.h"
|
||||
|
||||
typedef struct _GtkMenuButtonClass GtkMenuButtonClass;
|
||||
typedef struct _GtkMenuButtonPrivate GtkMenuButtonPrivate;
|
||||
@@ -116,6 +117,8 @@ struct _GtkMenuButton
|
||||
GtkWidget *label_widget;
|
||||
GtkWidget *arrow_widget;
|
||||
GtkArrowType arrow_type;
|
||||
|
||||
gboolean primary;
|
||||
};
|
||||
|
||||
struct _GtkMenuButtonClass
|
||||
@@ -133,6 +136,7 @@ enum
|
||||
PROP_LABEL,
|
||||
PROP_USE_UNDERLINE,
|
||||
PROP_HAS_FRAME,
|
||||
PROP_PRIMARY,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@@ -173,6 +177,9 @@ gtk_menu_button_set_property (GObject *object,
|
||||
case PROP_HAS_FRAME:
|
||||
gtk_menu_button_set_has_frame (self, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_PRIMARY:
|
||||
gtk_menu_button_set_primary (self, g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
@@ -209,6 +216,9 @@ gtk_menu_button_get_property (GObject *object,
|
||||
case PROP_HAS_FRAME:
|
||||
g_value_set_boolean (value, gtk_menu_button_get_has_frame (GTK_MENU_BUTTON (object)));
|
||||
break;
|
||||
case PROP_PRIMARY:
|
||||
g_value_set_boolean (value, gtk_menu_button_get_primary (GTK_MENU_BUTTON (object)));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
@@ -326,6 +336,9 @@ gtk_menu_button_grab_focus (GtkWidget *widget)
|
||||
return gtk_widget_grab_focus (self->button);
|
||||
}
|
||||
|
||||
static void gtk_menu_button_root (GtkWidget *widget);
|
||||
static void gtk_menu_button_unroot (GtkWidget *widget);
|
||||
|
||||
static void
|
||||
gtk_menu_button_class_init (GtkMenuButtonClass *klass)
|
||||
{
|
||||
@@ -337,6 +350,8 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
|
||||
gobject_class->notify = gtk_menu_button_notify;
|
||||
gobject_class->dispose = gtk_menu_button_dispose;
|
||||
|
||||
widget_class->root = gtk_menu_button_root;
|
||||
widget_class->unroot = gtk_menu_button_unroot;
|
||||
widget_class->measure = gtk_menu_button_measure;
|
||||
widget_class->size_allocate = gtk_menu_button_size_allocate;
|
||||
widget_class->state_flags_changed = gtk_menu_button_state_flags_changed;
|
||||
@@ -432,6 +447,20 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkMenuButton:primary: (attributes org.gtk.Property.get=gtk_menu_button_get_primary org.gtk.Property.set=gtk_menu_button_set_primary)
|
||||
*
|
||||
* Whether the menu button acts as a primary menu.
|
||||
*
|
||||
* Primary menus can be opened using the <kbd>F10</kbd> key
|
||||
*/
|
||||
menu_button_props[PROP_PRIMARY] =
|
||||
g_param_spec_boolean ("primary",
|
||||
P_("Primary"),
|
||||
P_("Whether the menubutton acts as a primary menu"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (gobject_class, LAST_PROP, menu_button_props);
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("menubutton"));
|
||||
@@ -1039,3 +1068,110 @@ gtk_menu_button_get_use_underline (GtkMenuButton *menu_button)
|
||||
|
||||
return gtk_button_get_use_underline (GTK_BUTTON (menu_button->button));
|
||||
}
|
||||
|
||||
static GList *
|
||||
get_menu_bars (GtkWindow *window)
|
||||
{
|
||||
return g_object_get_data (G_OBJECT (window), "gtk-menu-bar-list");
|
||||
}
|
||||
|
||||
static void
|
||||
set_menu_bars (GtkWindow *window,
|
||||
GList *menubars)
|
||||
{
|
||||
g_object_set_data (G_OBJECT (window), I_("gtk-menu-bar-list"), menubars);
|
||||
}
|
||||
|
||||
static void
|
||||
add_to_window (GtkWindow *window,
|
||||
GtkMenuButton *button)
|
||||
{
|
||||
GList *menubars = get_menu_bars (window);
|
||||
|
||||
set_menu_bars (window, g_list_prepend (menubars, button));
|
||||
}
|
||||
|
||||
static void
|
||||
remove_from_window (GtkWindow *window,
|
||||
GtkMenuButton *button)
|
||||
{
|
||||
GList *menubars = get_menu_bars (window);
|
||||
|
||||
menubars = g_list_remove (menubars, button);
|
||||
set_menu_bars (window, menubars);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_button_root (GtkWidget *widget)
|
||||
{
|
||||
GtkMenuButton *button = GTK_MENU_BUTTON (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_menu_button_parent_class)->root (widget);
|
||||
|
||||
if (button->primary)
|
||||
{
|
||||
GtkWidget *toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
|
||||
add_to_window (GTK_WINDOW (toplevel), button);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_button_unroot (GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *toplevel;
|
||||
|
||||
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
|
||||
remove_from_window (GTK_WINDOW (toplevel), GTK_MENU_BUTTON (widget));
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_menu_button_parent_class)->unroot (widget);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_button_set_primary: (attributes org.gtk.Method.set_property=primary)
|
||||
* @menu_button: a `GtkMenuButton`
|
||||
* @primary: whether the menubutton should act as a primary menu
|
||||
*
|
||||
* Sets whether menu button acts as a primary menu.
|
||||
*
|
||||
* Primary menus can be opened with the <kbd>F10</kbd> key.
|
||||
*/
|
||||
void
|
||||
gtk_menu_button_set_primary (GtkMenuButton *menu_button,
|
||||
gboolean primary)
|
||||
{
|
||||
GtkRoot *toplevel;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
|
||||
|
||||
if (menu_button->primary == primary)
|
||||
return;
|
||||
|
||||
menu_button->primary = primary;
|
||||
toplevel = gtk_widget_get_root (GTK_WIDGET (menu_button));
|
||||
|
||||
if (toplevel)
|
||||
{
|
||||
if (menu_button->primary)
|
||||
add_to_window (GTK_WINDOW (toplevel), menu_button);
|
||||
else
|
||||
remove_from_window (GTK_WINDOW (toplevel), menu_button);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_PRIMARY]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_button_get_primary: (attributes org.gtk.Method.get_property=primary)
|
||||
* @menu_button: a `GtkMenuButton`
|
||||
*
|
||||
* Returns whether the menu button acts as a primary menu.
|
||||
*
|
||||
* Returns: %TRUE if the button is a primary menu
|
||||
*/
|
||||
gboolean
|
||||
gtk_menu_button_get_primary (GtkMenuButton *menu_button)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_MENU_BUTTON (menu_button), FALSE);
|
||||
|
||||
return menu_button->primary;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,12 @@ void gtk_menu_button_set_create_popup_func (GtkMenuButton
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy_notify);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
void gtk_menu_button_set_primary (GtkMenuButton *menu_button,
|
||||
gboolean primary);
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
gboolean gtk_menu_button_get_primary (GtkMenuButton *menu_button);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_MENU_BUTTON_H__ */
|
||||
|
||||
@@ -292,6 +292,22 @@ open_submenu (GtkWidget *button,
|
||||
gtk_widget_grab_focus (focus);
|
||||
}
|
||||
|
||||
static void
|
||||
submenu_shown (GtkPopoverMenu *popover,
|
||||
GtkMenuTrackerItem *item)
|
||||
{
|
||||
if (gtk_menu_tracker_item_get_should_request_show (item))
|
||||
gtk_menu_tracker_item_request_submenu_shown (item, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
submenu_hidden (GtkPopoverMenu *popover,
|
||||
GtkMenuTrackerItem *item)
|
||||
{
|
||||
if (gtk_menu_tracker_item_get_should_request_show (item))
|
||||
gtk_menu_tracker_item_request_submenu_shown (item, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
|
||||
int position,
|
||||
@@ -324,6 +340,9 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
|
||||
g_object_bind_property (item, "label", widget, "text", G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (item, "icon", widget, "icon", G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (item, "sensitive", widget, "sensitive", G_BINDING_SYNC_CREATE);
|
||||
|
||||
g_signal_connect (submenu, "show", G_CALLBACK (submenu_shown), item);
|
||||
g_signal_connect (submenu, "hide", G_CALLBACK (submenu_hidden), item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+81
-44
@@ -809,13 +809,57 @@ gtk_menu_tracker_item_activated (GtkMenuTrackerItem *self)
|
||||
g_variant_unref (action_target);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
GObject parent;
|
||||
|
||||
GtkMenuTrackerItem *item;
|
||||
char *submenu_action;
|
||||
gboolean first_time;
|
||||
} GtkMenuTrackerOpener;
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent_class;
|
||||
} GtkMenuTrackerOpenerClass;
|
||||
|
||||
static void gtk_menu_tracker_opener_observer_iface_init (GtkActionObserverInterface *iface);
|
||||
|
||||
GType gtk_menu_tracker_opener_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkMenuTrackerOpener, gtk_menu_tracker_opener, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACTION_OBSERVER, gtk_menu_tracker_opener_observer_iface_init))
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_opener_init (GtkMenuTrackerOpener *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_opener_finalize (GObject *object)
|
||||
{
|
||||
GtkMenuTrackerOpener *opener = (GtkMenuTrackerOpener *)object;
|
||||
|
||||
gtk_action_observable_unregister_observer (opener->item->observable,
|
||||
opener->submenu_action,
|
||||
(GtkActionObserver *)opener);
|
||||
|
||||
if (GTK_IS_ACTION_MUXER (opener->item->observable))
|
||||
gtk_action_muxer_change_action_state (GTK_ACTION_MUXER (opener->item->observable),
|
||||
opener->submenu_action,
|
||||
g_variant_new_boolean (FALSE));
|
||||
|
||||
gtk_menu_tracker_item_set_submenu_shown (opener->item, FALSE);
|
||||
|
||||
g_free (opener->submenu_action);
|
||||
|
||||
G_OBJECT_CLASS (gtk_menu_tracker_opener_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_opener_class_init (GtkMenuTrackerOpenerClass *class)
|
||||
{
|
||||
G_OBJECT_CLASS (class)->finalize = gtk_menu_tracker_opener_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_opener_update (GtkMenuTrackerOpener *opener)
|
||||
{
|
||||
@@ -862,57 +906,49 @@ gtk_menu_tracker_opener_update (GtkMenuTrackerOpener *opener)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_opener_added (GActionGroup *group,
|
||||
const char *action_name,
|
||||
gpointer user_data)
|
||||
gtk_menu_tracker_opener_added (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const char *action_name,
|
||||
const GVariantType *parameter_type,
|
||||
gboolean enabled,
|
||||
GVariant *state)
|
||||
{
|
||||
GtkMenuTrackerOpener *opener = user_data;
|
||||
|
||||
if (g_str_equal (action_name, opener->submenu_action))
|
||||
gtk_menu_tracker_opener_update (opener);
|
||||
gtk_menu_tracker_opener_update ((GtkMenuTrackerOpener *)observer);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_opener_removed (GActionGroup *action_group,
|
||||
const char *action_name,
|
||||
gpointer user_data)
|
||||
gtk_menu_tracker_opener_removed (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const char *action_name)
|
||||
{
|
||||
GtkMenuTrackerOpener *opener = user_data;
|
||||
|
||||
if (g_str_equal (action_name, opener->submenu_action))
|
||||
gtk_menu_tracker_opener_update (opener);
|
||||
gtk_menu_tracker_opener_update ((GtkMenuTrackerOpener *)observer);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_opener_changed (GActionGroup *action_group,
|
||||
const char *action_name,
|
||||
GVariant *new_state,
|
||||
gpointer user_data)
|
||||
gtk_menu_tracker_opener_enabled_changed (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const char *action_name,
|
||||
gboolean enabled)
|
||||
{
|
||||
GtkMenuTrackerOpener *opener = user_data;
|
||||
|
||||
if (g_str_equal (action_name, opener->submenu_action))
|
||||
gtk_menu_tracker_opener_update (opener);
|
||||
gtk_menu_tracker_opener_update ((GtkMenuTrackerOpener *)observer);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_menu_tracker_opener_free (gpointer data)
|
||||
gtk_menu_tracker_opener_state_changed (GtkActionObserver *observer,
|
||||
GtkActionObservable *observable,
|
||||
const char *action_name,
|
||||
GVariant *state)
|
||||
{
|
||||
GtkMenuTrackerOpener *opener = data;
|
||||
gtk_menu_tracker_opener_update ((GtkMenuTrackerOpener *)observer);
|
||||
}
|
||||
|
||||
g_signal_handlers_disconnect_by_func (opener->item->observable, gtk_menu_tracker_opener_added, opener);
|
||||
g_signal_handlers_disconnect_by_func (opener->item->observable, gtk_menu_tracker_opener_removed, opener);
|
||||
g_signal_handlers_disconnect_by_func (opener->item->observable, gtk_menu_tracker_opener_changed, opener);
|
||||
|
||||
g_action_group_change_action_state (G_ACTION_GROUP (opener->item->observable),
|
||||
opener->submenu_action,
|
||||
g_variant_new_boolean (FALSE));
|
||||
|
||||
gtk_menu_tracker_item_set_submenu_shown (opener->item, FALSE);
|
||||
|
||||
g_free (opener->submenu_action);
|
||||
|
||||
g_slice_free (GtkMenuTrackerOpener, opener);
|
||||
static void
|
||||
gtk_menu_tracker_opener_observer_iface_init (GtkActionObserverInterface *iface)
|
||||
{
|
||||
iface->action_added = gtk_menu_tracker_opener_added;
|
||||
iface->action_removed = gtk_menu_tracker_opener_removed;
|
||||
iface->action_enabled_changed = gtk_menu_tracker_opener_enabled_changed;
|
||||
iface->action_state_changed = gtk_menu_tracker_opener_state_changed;
|
||||
}
|
||||
|
||||
static GtkMenuTrackerOpener *
|
||||
@@ -921,7 +957,8 @@ gtk_menu_tracker_opener_new (GtkMenuTrackerItem *item,
|
||||
{
|
||||
GtkMenuTrackerOpener *opener;
|
||||
|
||||
opener = g_slice_new (GtkMenuTrackerOpener);
|
||||
opener = g_object_new (gtk_menu_tracker_opener_get_type (), NULL);
|
||||
|
||||
opener->first_time = TRUE;
|
||||
opener->item = item;
|
||||
|
||||
@@ -930,9 +967,9 @@ gtk_menu_tracker_opener_new (GtkMenuTrackerItem *item,
|
||||
else
|
||||
opener->submenu_action = g_strdup (submenu_action);
|
||||
|
||||
g_signal_connect (item->observable, "action-added", G_CALLBACK (gtk_menu_tracker_opener_added), opener);
|
||||
g_signal_connect (item->observable, "action-removed", G_CALLBACK (gtk_menu_tracker_opener_removed), opener);
|
||||
g_signal_connect (item->observable, "action-state-changed", G_CALLBACK (gtk_menu_tracker_opener_changed), opener);
|
||||
gtk_action_observable_register_observer (item->observable,
|
||||
opener->submenu_action,
|
||||
(GtkActionObserver *)opener);
|
||||
|
||||
gtk_menu_tracker_opener_update (opener);
|
||||
|
||||
@@ -962,7 +999,7 @@ gtk_menu_tracker_item_request_submenu_shown (GtkMenuTrackerItem *self,
|
||||
if (shown)
|
||||
g_object_set_data_full (G_OBJECT (self), "submenu-opener",
|
||||
gtk_menu_tracker_opener_new (self, submenu_action),
|
||||
gtk_menu_tracker_opener_free);
|
||||
g_object_unref);
|
||||
else
|
||||
g_object_set_data (G_OBJECT (self), "submenu-opener", NULL);
|
||||
}
|
||||
|
||||
@@ -390,29 +390,6 @@ gtk_paned_set_orientation (GtkPaned *self,
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_paned_save_state (GtkWidget *paned,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
g_variant_dict_insert (dict, "position", "i", gtk_paned_get_position (GTK_PANED (paned)));
|
||||
*save_children = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_paned_restore_state (GtkWidget *paned,
|
||||
GVariant *data)
|
||||
{
|
||||
int value;
|
||||
|
||||
if (g_variant_lookup (data, "position", "i", &value))
|
||||
gtk_paned_set_position(GTK_PANED (paned), value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_class_init (GtkPanedClass *class)
|
||||
{
|
||||
@@ -431,8 +408,6 @@ gtk_paned_class_init (GtkPanedClass *class)
|
||||
widget_class->css_changed = gtk_paned_css_changed;
|
||||
widget_class->get_request_mode = gtk_paned_get_request_mode;
|
||||
widget_class->compute_expand = gtk_paned_compute_expand;
|
||||
widget_class->save_state = gtk_paned_save_state;
|
||||
widget_class->restore_state = gtk_paned_restore_state;
|
||||
|
||||
class->cycle_child_focus = gtk_paned_cycle_child_focus;
|
||||
class->toggle_handle_focus = gtk_paned_toggle_handle_focus;
|
||||
|
||||
+1
-29
@@ -31,7 +31,7 @@
|
||||
#include "gtkimage.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkpasswordentrybufferprivate.h"
|
||||
#include "gtkpasswordentrybuffer.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkcsspositionvalueprivate.h"
|
||||
@@ -415,32 +415,6 @@ gtk_password_entry_mnemonic_activate (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_password_entry_save_state (GtkWidget *widget,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget);
|
||||
|
||||
g_variant_dict_insert (dict, "visibility", "b", gtk_text_get_visibility (GTK_TEXT (entry->entry)));
|
||||
*save_children = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_password_entry_restore_state (GtkWidget *widget,
|
||||
GVariant *data)
|
||||
{
|
||||
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget);
|
||||
gboolean value;
|
||||
|
||||
if (g_variant_lookup (data, "visibility", "b", &value))
|
||||
gtk_text_set_visibility (GTK_TEXT (entry->entry), value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_password_entry_class_init (GtkPasswordEntryClass *klass)
|
||||
{
|
||||
@@ -457,8 +431,6 @@ gtk_password_entry_class_init (GtkPasswordEntryClass *klass)
|
||||
widget_class->mnemonic_activate = gtk_password_entry_mnemonic_activate;
|
||||
widget_class->grab_focus = gtk_widget_grab_focus_child;
|
||||
widget_class->focus = gtk_widget_focus_child;
|
||||
widget_class->save_state = gtk_password_entry_save_state;
|
||||
widget_class->restore_state = gtk_password_entry_restore_state;
|
||||
|
||||
/**
|
||||
* GtkPasswordEntry:placeholder-text:
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkpasswordentrybufferprivate.h"
|
||||
#include "gtkpasswordentrybuffer.h"
|
||||
|
||||
#include "gtksecurememoryprivate.h"
|
||||
|
||||
@@ -30,6 +30,16 @@
|
||||
/* Initial size of buffer, in bytes */
|
||||
#define MIN_SIZE 16
|
||||
|
||||
/**
|
||||
* GtkPasswordEntryBuffer:
|
||||
*
|
||||
* A `GtkEntryBuffer` that locks the underlying memory to prevent it
|
||||
* from being swapped to disk.
|
||||
*
|
||||
* `GtkPasswordEntry` uses a `GtkPasswordEntryBuffer`.
|
||||
*
|
||||
* Since 4.4.
|
||||
*/
|
||||
struct _GtkPasswordEntryBuffer
|
||||
{
|
||||
GtkEntryBuffer parent_instance;
|
||||
@@ -192,7 +202,7 @@ gtk_password_entry_buffer_init (GtkPasswordEntryBuffer *self)
|
||||
{
|
||||
}
|
||||
|
||||
/*< private >
|
||||
/**
|
||||
* gtk_password_entry_buffer_new:
|
||||
*
|
||||
* Creates a new `GtkEntryBuffer` using secure memory allocations.
|
||||
|
||||
@@ -26,8 +26,10 @@ G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_PASSWORD_ENTRY_BUFFER (gtk_password_entry_buffer_get_type())
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
G_DECLARE_FINAL_TYPE (GtkPasswordEntryBuffer, gtk_password_entry_buffer, GTK, PASSWORD_ENTRY_BUFFER, GtkEntryBuffer)
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
GtkEntryBuffer * gtk_password_entry_buffer_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && !defined (_M_ARM) && !defined (_M_ARM64)
|
||||
#include <intrin.h>
|
||||
|
||||
static inline guint
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
* of a toplevel `<menu>` element, which contains one or more `<item>`
|
||||
* elements. Each `<item>` element contains `<attribute>` and `<link>`
|
||||
* elements with a mandatory name attribute. `<link>` elements have the
|
||||
* same content model as `<menu>`. Instead of `<link name="submenu>` or
|
||||
* `<link name="section">`, you can use `<submenu>` or `<section>`
|
||||
* same content model as `<menu>`. Instead of `<link name="submenu">`
|
||||
* or `<link name="section">`, you can use `<submenu>` or `<section>`
|
||||
* elements.
|
||||
*
|
||||
* ```xml
|
||||
@@ -99,8 +99,8 @@
|
||||
* - "action": the prefixed name of the action to trigger
|
||||
* - "target": the parameter to use when activating the action
|
||||
* - "icon" and "verb-icon": names of icons that may be displayed
|
||||
* - "submenu-action": name of an action that may be used to determine
|
||||
* if a submenu can be opened
|
||||
* - "submenu-action": name of an action that may be used to track
|
||||
* whether a submenu is open
|
||||
* - "hidden-when": a string used to determine when the item will be hidden.
|
||||
* Possible values include "action-disabled", "action-missing", "macos-menubar".
|
||||
* This is mainly useful for exported menus, see [method@Gtk.Application.set_menubar].
|
||||
|
||||
+45
-45
@@ -59,6 +59,7 @@
|
||||
#include "gtkpopovermenubarprivate.h"
|
||||
#include "gtkpopovermenu.h"
|
||||
|
||||
#include "gtkbinlayout.h"
|
||||
#include "gtkboxlayout.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkmenubutton.h"
|
||||
@@ -104,6 +105,7 @@ struct _GtkPopoverMenuBarItem
|
||||
|
||||
GtkWidget *label;
|
||||
GtkPopover *popover;
|
||||
GtkMenuTrackerItem *tracker;
|
||||
};
|
||||
|
||||
typedef struct _GtkPopoverMenuBarItemClass GtkPopoverMenuBarItemClass;
|
||||
@@ -116,6 +118,18 @@ struct _GtkPopoverMenuBarItemClass
|
||||
|
||||
G_DEFINE_TYPE (GtkPopoverMenuBarItem, gtk_popover_menu_bar_item, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
open_submenu (GtkPopoverMenuBarItem *item)
|
||||
{
|
||||
gtk_popover_popup (item->popover);
|
||||
}
|
||||
|
||||
static void
|
||||
close_submenu (GtkPopoverMenuBarItem *item)
|
||||
{
|
||||
gtk_popover_popdown (item->popover);
|
||||
}
|
||||
|
||||
static void
|
||||
set_active_item (GtkPopoverMenuBar *bar,
|
||||
GtkPopoverMenuBarItem *item,
|
||||
@@ -132,12 +146,7 @@ set_active_item (GtkPopoverMenuBar *bar,
|
||||
was_popup = FALSE;
|
||||
|
||||
if (was_popup && changed)
|
||||
{
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (bar->active_item),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||
-1);
|
||||
gtk_popover_popdown (bar->active_item->popover);
|
||||
}
|
||||
close_submenu (bar->active_item);
|
||||
|
||||
if (changed)
|
||||
{
|
||||
@@ -153,12 +162,7 @@ set_active_item (GtkPopoverMenuBar *bar,
|
||||
if (bar->active_item)
|
||||
{
|
||||
if (popup || (was_popup && changed))
|
||||
{
|
||||
gtk_popover_popup (bar->active_item->popover);
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (bar->active_item),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||
-1);
|
||||
}
|
||||
open_submenu (bar->active_item);
|
||||
else if (changed)
|
||||
gtk_widget_grab_focus (GTK_WIDGET (bar->active_item));
|
||||
}
|
||||
@@ -279,6 +283,7 @@ gtk_popover_menu_bar_item_dispose (GObject *object)
|
||||
{
|
||||
GtkPopoverMenuBarItem *item = GTK_POPOVER_MENU_BAR_ITEM (object);
|
||||
|
||||
g_clear_object (&item->tracker);
|
||||
g_clear_pointer (&item->label, gtk_widget_unparent);
|
||||
g_clear_pointer ((GtkWidget **)&item->popover, gtk_widget_unparent);
|
||||
|
||||
@@ -291,37 +296,6 @@ gtk_popover_menu_bar_item_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (gtk_popover_menu_bar_item_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_popover_menu_bar_item_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
GtkPopoverMenuBarItem *item = GTK_POPOVER_MENU_BAR_ITEM (widget);
|
||||
|
||||
gtk_widget_measure (item->label, orientation, for_size,
|
||||
minimum, natural,
|
||||
minimum_baseline, natural_baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_popover_menu_bar_item_size_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline)
|
||||
{
|
||||
GtkPopoverMenuBarItem *item = GTK_POPOVER_MENU_BAR_ITEM (widget);
|
||||
|
||||
gtk_widget_size_allocate (item->label,
|
||||
&(GtkAllocation) { 0, 0, width, height },
|
||||
baseline);
|
||||
|
||||
gtk_popover_present (GTK_POPOVER (item->popover));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_popover_menu_bar_item_activate (GtkPopoverMenuBarItem *item)
|
||||
{
|
||||
@@ -359,8 +333,6 @@ gtk_popover_menu_bar_item_class_init (GtkPopoverMenuBarItemClass *klass)
|
||||
object_class->finalize = gtk_popover_menu_bar_item_finalize;
|
||||
|
||||
widget_class->root = gtk_popover_menu_bar_item_root;
|
||||
widget_class->measure = gtk_popover_menu_bar_item_measure;
|
||||
widget_class->size_allocate = gtk_popover_menu_bar_item_size_allocate;
|
||||
|
||||
klass->activate = gtk_popover_menu_bar_item_activate;
|
||||
|
||||
@@ -376,6 +348,7 @@ gtk_popover_menu_bar_item_class_init (GtkPopoverMenuBarItemClass *klass)
|
||||
gtk_widget_class_set_css_name (widget_class, I_("item"));
|
||||
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_MENU_ITEM);
|
||||
gtk_widget_class_set_activate_signal (widget_class, activate_signal);
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
}
|
||||
enum
|
||||
{
|
||||
@@ -420,6 +393,30 @@ popover_unmap (GtkPopover *popover,
|
||||
set_active_item (bar, NULL, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
popover_shown (GtkPopover *popover,
|
||||
GtkPopoverMenuBarItem *item)
|
||||
{
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (item),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, TRUE,
|
||||
-1);
|
||||
|
||||
if (gtk_menu_tracker_item_get_should_request_show (item->tracker))
|
||||
gtk_menu_tracker_item_request_submenu_shown (item->tracker, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
popover_hidden (GtkPopover *popover,
|
||||
GtkPopoverMenuBarItem *item)
|
||||
{
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (item),
|
||||
GTK_ACCESSIBLE_STATE_EXPANDED, FALSE,
|
||||
-1);
|
||||
|
||||
if (gtk_menu_tracker_item_get_should_request_show (item->tracker))
|
||||
gtk_menu_tracker_item_request_submenu_shown (item->tracker, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
tracker_insert (GtkMenuTrackerItem *item,
|
||||
int position,
|
||||
@@ -449,8 +446,11 @@ tracker_insert (GtkMenuTrackerItem *item,
|
||||
gtk_widget_set_halign (GTK_WIDGET (popover), GTK_ALIGN_START);
|
||||
|
||||
g_signal_connect (popover, "unmap", G_CALLBACK (popover_unmap), bar);
|
||||
g_signal_connect (popover, "show", G_CALLBACK (popover_shown), widget);
|
||||
g_signal_connect (popover, "hide", G_CALLBACK (popover_hidden), widget);
|
||||
|
||||
widget->popover = popover;
|
||||
widget->tracker = g_object_ref (item);
|
||||
|
||||
sibling = NULL;
|
||||
for (child = gtk_widget_get_first_child (GTK_WIDGET (bar)), i = 1;
|
||||
|
||||
+5
-1
@@ -61,7 +61,11 @@ const char * _gtk_get_data_prefix (void);
|
||||
|
||||
gboolean _gtk_fnmatch (const char *pattern,
|
||||
const char *string,
|
||||
gboolean no_leading_period);
|
||||
gboolean no_leading_period,
|
||||
gboolean casefold);
|
||||
|
||||
char * _gtk_make_ci_glob_pattern (const char *pattern);
|
||||
|
||||
|
||||
char * _gtk_get_lc_ctype (void);
|
||||
|
||||
|
||||
@@ -245,12 +245,6 @@ static gboolean gtk_range_scroll_controller_scroll (GtkEventControllerScrol
|
||||
static void gtk_range_set_orientation (GtkRange *range,
|
||||
GtkOrientation orientation);
|
||||
|
||||
static gboolean gtk_range_save_state (GtkWidget *range,
|
||||
GVariantDict *dict,
|
||||
gboolean *save);
|
||||
static gboolean gtk_range_restore_state (GtkWidget *range,
|
||||
GVariant *data);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkRange, gtk_range, GTK_TYPE_WIDGET,
|
||||
G_ADD_PRIVATE (GtkRange)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
|
||||
@@ -277,8 +271,6 @@ gtk_range_class_init (GtkRangeClass *class)
|
||||
widget_class->size_allocate = gtk_range_size_allocate;
|
||||
widget_class->unmap = gtk_range_unmap;
|
||||
widget_class->direction_changed = gtk_range_direction_changed;
|
||||
widget_class->save_state = gtk_range_save_state;
|
||||
widget_class->restore_state = gtk_range_restore_state;
|
||||
|
||||
class->move_slider = gtk_range_move_slider;
|
||||
class->change_value = gtk_range_real_change_value;
|
||||
@@ -2867,29 +2859,6 @@ _gtk_range_get_stop_positions (GtkRange *range,
|
||||
return priv->n_marks;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_range_save_state (GtkWidget *range,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
g_variant_dict_insert (dict, "value", "d", gtk_range_get_value (GTK_RANGE (range)));
|
||||
*save_children = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_range_restore_state (GtkWidget *range,
|
||||
GVariant *data)
|
||||
{
|
||||
double value;
|
||||
|
||||
if (g_variant_lookup (data, "value", "d", &value))
|
||||
gtk_range_set_value (GTK_RANGE (range), value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_range_set_round_digits: (attributes org.gtk.Method.set_property=round-digits)
|
||||
* @range: a `GtkRange`
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
|
||||
/* XXX: For g_memdup2() */
|
||||
#include "gtkprivate.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
+8
-3
@@ -208,6 +208,7 @@ struct _GtkSpinButton
|
||||
|
||||
double climb_rate;
|
||||
double timer_step;
|
||||
double swipe_remainder;
|
||||
|
||||
int width_chars;
|
||||
|
||||
@@ -838,6 +839,7 @@ swipe_gesture_begin (GtkGesture *gesture,
|
||||
{
|
||||
gtk_gesture_set_state (gesture, GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
gtk_widget_grab_focus (GTK_WIDGET (spin_button));
|
||||
spin_button->swipe_remainder = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -845,10 +847,12 @@ swipe_gesture_update (GtkGesture *gesture,
|
||||
GdkEventSequence *sequence,
|
||||
GtkSpinButton *spin_button)
|
||||
{
|
||||
double vel_y;
|
||||
double vel_y, step;
|
||||
|
||||
gtk_gesture_swipe_get_velocity (GTK_GESTURE_SWIPE (gesture), NULL, &vel_y);
|
||||
gtk_spin_button_real_spin (spin_button, -vel_y / 20);
|
||||
step = (-vel_y / 20) + spin_button->swipe_remainder;
|
||||
spin_button->swipe_remainder = fmod (step, gtk_adjustment_get_step_increment (spin_button->adjustment));
|
||||
gtk_spin_button_real_spin (spin_button, step - spin_button->swipe_remainder);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1075,7 +1079,8 @@ gtk_spin_button_init (GtkSpinButton *spin_button)
|
||||
G_CALLBACK (swipe_gesture_begin), spin_button);
|
||||
g_signal_connect (gesture, "update",
|
||||
G_CALLBACK (swipe_gesture_update), spin_button);
|
||||
gtk_widget_add_controller (GTK_WIDGET (spin_button), GTK_EVENT_CONTROLLER (gesture));
|
||||
gtk_widget_add_controller (GTK_WIDGET (spin_button->entry),
|
||||
GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
|
||||
GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
|
||||
|
||||
@@ -794,29 +794,6 @@ gtk_stack_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_stack_save_state (GtkWidget *widget,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
g_variant_dict_insert (dict, "visible-page", "s", gtk_stack_get_visible_child_name (GTK_STACK (widget)));
|
||||
*save_children = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_stack_restore_state (GtkWidget *widget,
|
||||
GVariant *data)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
if (g_variant_lookup (data, "visible-page", "&s", &name))
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (widget), name);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_stack_class_init (GtkStackClass *klass)
|
||||
{
|
||||
@@ -833,8 +810,6 @@ gtk_stack_class_init (GtkStackClass *klass)
|
||||
widget_class->measure = gtk_stack_measure;
|
||||
widget_class->compute_expand = gtk_stack_compute_expand;
|
||||
widget_class->get_request_mode = gtk_stack_get_request_mode;
|
||||
widget_class->save_state = gtk_stack_save_state;
|
||||
widget_class->restore_state = gtk_stack_restore_state;
|
||||
|
||||
/**
|
||||
* GtkStack:hhomogeneous: (attributes org.gtk.Property.get=gtk_stack_get_hhomogeneous org.gtk.Property.set=gtk_stack_set_hhomogeneous)
|
||||
|
||||
@@ -506,29 +506,6 @@ state_set (GtkSwitch *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_switch_save_state (GtkWidget *self,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
g_variant_dict_insert (dict, "active", "b", gtk_switch_get_active (GTK_SWITCH (self)));
|
||||
*save_children = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_switch_restore_state (GtkWidget *self,
|
||||
GVariant *data)
|
||||
{
|
||||
gboolean value;
|
||||
|
||||
if (g_variant_lookup (data, "active", "b", &value))
|
||||
gtk_switch_set_active (GTK_SWITCH (self), value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_switch_class_init (GtkSwitchClass *klass)
|
||||
{
|
||||
@@ -568,9 +545,6 @@ gtk_switch_class_init (GtkSwitchClass *klass)
|
||||
|
||||
g_object_class_install_properties (gobject_class, LAST_PROP, switch_props);
|
||||
|
||||
widget_class->save_state = gtk_switch_save_state;
|
||||
widget_class->restore_state = gtk_switch_restore_state;
|
||||
|
||||
klass->activate = gtk_switch_activate;
|
||||
klass->state_set = state_set;
|
||||
|
||||
|
||||
@@ -595,12 +595,6 @@ static void gtk_text_history_select_cb (gpointer funcs_data,
|
||||
int selection_insert,
|
||||
int selection_bound);
|
||||
|
||||
static gboolean gtk_text_save_state (GtkWidget *widget,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children);
|
||||
static gboolean gtk_text_restore_state (GtkWidget *widget,
|
||||
GVariant *data);
|
||||
|
||||
/* GtkTextContent implementation
|
||||
*/
|
||||
#define GTK_TYPE_TEXT_CONTENT (gtk_text_content_get_type ())
|
||||
@@ -740,8 +734,6 @@ gtk_text_class_init (GtkTextClass *class)
|
||||
widget_class->direction_changed = gtk_text_direction_changed;
|
||||
widget_class->state_flags_changed = gtk_text_state_flags_changed;
|
||||
widget_class->mnemonic_activate = gtk_text_mnemonic_activate;
|
||||
widget_class->save_state = gtk_text_save_state;
|
||||
widget_class->restore_state = gtk_text_restore_state;
|
||||
|
||||
class->move_cursor = gtk_text_move_cursor;
|
||||
class->insert_at_cursor = gtk_text_insert_at_cursor;
|
||||
@@ -1878,7 +1870,6 @@ gtk_text_init (GtkText *self)
|
||||
|
||||
gtk_widget_set_focusable (GTK_WIDGET (self), TRUE);
|
||||
gtk_widget_set_overflow (GTK_WIDGET (self), GTK_OVERFLOW_HIDDEN);
|
||||
gtk_widget_set_save_id (GTK_WIDGET (self), "text");
|
||||
|
||||
priv->editable = TRUE;
|
||||
priv->visible = TRUE;
|
||||
@@ -7190,26 +7181,3 @@ gtk_text_history_select_cb (gpointer funcs_data,
|
||||
selection_insert,
|
||||
selection_bound);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_text_save_state (GtkWidget *widget,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
g_variant_dict_insert (dict, "text", "s", gtk_editable_get_text (GTK_EDITABLE (widget)));
|
||||
*save_children = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_text_restore_state (GtkWidget *widget,
|
||||
GVariant *data)
|
||||
{
|
||||
const char *text;
|
||||
|
||||
if (g_variant_lookup (data, "text", "&s", &text))
|
||||
gtk_editable_set_text (GTK_EDITABLE (widget), text);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -249,29 +249,6 @@ get_group_first (GtkToggleButton *self)
|
||||
return group_first;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_toggle_button_save_state (GtkWidget *self,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
g_variant_dict_insert (dict, "active", "b", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self)));
|
||||
*save_children = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_toggle_button_restore_state (GtkWidget *self,
|
||||
GVariant *data)
|
||||
{
|
||||
gboolean value;
|
||||
|
||||
if (g_variant_lookup (data, "active", "b", &value))
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self), value);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_toggle_button_class_init (GtkToggleButtonClass *class)
|
||||
{
|
||||
@@ -284,8 +261,6 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
|
||||
gobject_class->get_property = gtk_toggle_button_get_property;
|
||||
|
||||
widget_class->mnemonic_activate = gtk_toggle_button_mnemonic_activate;
|
||||
widget_class->save_state = gtk_toggle_button_save_state;
|
||||
widget_class->restore_state = gtk_toggle_button_restore_state;
|
||||
|
||||
button_class->clicked = gtk_toggle_button_clicked;
|
||||
|
||||
|
||||
@@ -239,6 +239,11 @@ gtk_tree_expander_update_for_list_row (GtkTreeExpander *self)
|
||||
}
|
||||
}
|
||||
|
||||
/* The level property is >= 1 */
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (self),
|
||||
GTK_ACCESSIBLE_PROPERTY_LEVEL, depth + 1,
|
||||
-1);
|
||||
|
||||
while (child)
|
||||
{
|
||||
GtkWidget *prev = gtk_widget_get_prev_sibling (child);
|
||||
|
||||
+1
-227
@@ -479,8 +479,6 @@ enum {
|
||||
MOVE_FOCUS,
|
||||
KEYNAV_FAILED,
|
||||
QUERY_TOOLTIP,
|
||||
SAVE_STATE,
|
||||
RESTORE_STATE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -520,7 +518,6 @@ enum {
|
||||
PROP_CSS_NAME,
|
||||
PROP_CSS_CLASSES,
|
||||
PROP_LAYOUT_MANAGER,
|
||||
PROP_SAVE_ID,
|
||||
NUM_PROPERTIES,
|
||||
|
||||
/* GtkAccessible */
|
||||
@@ -999,9 +996,6 @@ gtk_widget_set_property (GObject *object,
|
||||
case PROP_ACCESSIBLE_ROLE:
|
||||
gtk_widget_set_accessible_role (widget, g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_SAVE_ID:
|
||||
gtk_widget_set_save_id (widget, g_value_get_string (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -1135,9 +1129,6 @@ gtk_widget_get_property (GObject *object,
|
||||
case PROP_ACCESSIBLE_ROLE:
|
||||
g_value_set_enum (value, gtk_widget_get_accessible_role (widget));
|
||||
break;
|
||||
case PROP_SAVE_ID:
|
||||
g_value_set_string (value, priv->save_id);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -1681,21 +1672,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
GTK_TYPE_LAYOUT_MANAGER,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkWidget:save-id: (attributes org.gtk.Property.get=gtk_widget_get_save_id org.gtk.Property.set=gtk_widget_set_save_id)
|
||||
*
|
||||
* The ID under which persistent state of this widget is saved.
|
||||
*
|
||||
* In order for a widget to have its state saved (and restored), the widget
|
||||
* and all its ancestors must have a `save-id`.
|
||||
*/
|
||||
widget_props[PROP_SAVE_ID] =
|
||||
g_param_spec_string ("save-id",
|
||||
P_("Save ID"),
|
||||
P_("The ID to save the widget state under"),
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, widget_props);
|
||||
|
||||
g_object_class_override_property (gobject_class, PROP_ACCESSIBLE_ROLE, "accessible-role");
|
||||
@@ -1979,53 +1955,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
_gtk_marshal_BOOLEAN__INT_INT_BOOLEAN_OBJECTv);
|
||||
|
||||
/**
|
||||
* GtkWidget:save-state:
|
||||
* @widget: the object which received the signal
|
||||
* @dict: a `GVariantDict`
|
||||
* @save_children: (out): return location for whether to save children
|
||||
*
|
||||
* The handler for this signal should persist any state of @widget
|
||||
* into @dict, and set @save_children if the child widgets may have
|
||||
* state worth saving too.
|
||||
*
|
||||
* See [signal@Gtk.Widget:restore-state].
|
||||
*
|
||||
* Returns: %TRUE to stop stop further handlers from running
|
||||
*/
|
||||
widget_signals[SAVE_STATE] =
|
||||
g_signal_new (I_("save-state"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkWidgetClass, save_state),
|
||||
_gtk_boolean_handled_accumulator, NULL,
|
||||
NULL,
|
||||
G_TYPE_BOOLEAN, 2,
|
||||
G_TYPE_VARIANT_DICT,
|
||||
G_TYPE_POINTER);
|
||||
|
||||
/**
|
||||
* GtkWidget:restore-state:
|
||||
* @widget: the object which received the signal
|
||||
* @state: an "a{sv}" `GVariant` with state to restore
|
||||
*
|
||||
* The handler for this signal should do the opposite of what the
|
||||
* corresponding handler for [signal@Gtk.Widget:save-state] does.
|
||||
*
|
||||
* See [signal@Gtk.Widget:save-state].
|
||||
*
|
||||
* Returns: %TRUE to stop stop further handlers from running
|
||||
*/
|
||||
widget_signals[RESTORE_STATE] =
|
||||
g_signal_new (I_("restore-state"),
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkWidgetClass, restore_state),
|
||||
_gtk_boolean_handled_accumulator, NULL,
|
||||
NULL,
|
||||
G_TYPE_BOOLEAN, 1,
|
||||
G_TYPE_VARIANT);
|
||||
|
||||
gtk_widget_class_set_css_name (klass, I_("widget"));
|
||||
gtk_widget_class_set_accessible_role (klass, GTK_ACCESSIBLE_ROLE_WIDGET);
|
||||
}
|
||||
@@ -2105,6 +2034,7 @@ _gtk_widget_emulate_press (GtkWidget *widget,
|
||||
NULL,
|
||||
gdk_touch_event_get_emulating_pointer (event));
|
||||
break;
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
press = gdk_button_event_new (GDK_BUTTON_PRESS,
|
||||
gdk_event_get_surface (event),
|
||||
@@ -7646,7 +7576,6 @@ gtk_widget_finalize (GObject *object)
|
||||
g_free (priv->name);
|
||||
g_free (priv->tooltip_markup);
|
||||
g_free (priv->tooltip_text);
|
||||
g_free (priv->save_id);
|
||||
|
||||
g_clear_pointer (&priv->transform, gsk_transform_unref);
|
||||
g_clear_pointer (&priv->allocated_transform, gsk_transform_unref);
|
||||
@@ -12999,158 +12928,3 @@ gtk_widget_set_active_state (GtkWidget *widget,
|
||||
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_widget_set_save_id (GtkWidget *widget,
|
||||
const char *id)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
|
||||
g_free (priv->save_id);
|
||||
priv->save_id = g_strdup (id);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_SAVE_ID]);
|
||||
}
|
||||
|
||||
const char *
|
||||
gtk_widget_get_save_id (GtkWidget *widget)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
|
||||
return priv->save_id;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_collect_child_state (GtkWidget *widget,
|
||||
GVariantDict *dict)
|
||||
{
|
||||
const char *id;
|
||||
GVariant *state;
|
||||
|
||||
id = gtk_widget_get_save_id (widget);
|
||||
if (!id)
|
||||
return;
|
||||
|
||||
if (g_variant_dict_contains (dict, id))
|
||||
{
|
||||
g_warning ("Duplicate save-id %s", id);
|
||||
return;
|
||||
}
|
||||
|
||||
state = gtk_widget_save_state (widget);
|
||||
|
||||
if (state)
|
||||
g_variant_dict_insert_value (dict, id, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_save_state:
|
||||
* @widget: a `GtkWidget`
|
||||
*
|
||||
* Save the state of @widget and its children to a `GVariant`.
|
||||
*
|
||||
* In order a widgets state to be saved by this, the widget and
|
||||
* all its ancestors must have a [property@Gtk.Widget:save-id].
|
||||
*
|
||||
* See [signal@Gtk.Widget::save-state] for how to override what
|
||||
* state is saved.
|
||||
*
|
||||
* This function is used by `GtkApplication` to implement automatic
|
||||
* state saving. It is recommended that you use that functionality.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A `GVariant` with the saved state
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
GVariant *
|
||||
gtk_widget_save_state (GtkWidget *widget)
|
||||
{
|
||||
const char *id;
|
||||
GVariantDict *dict;
|
||||
GVariantBuilder data;
|
||||
gboolean save_children = TRUE;
|
||||
gboolean ret;
|
||||
GVariant *v;
|
||||
|
||||
id = gtk_widget_get_save_id (widget);
|
||||
if (id == NULL)
|
||||
return NULL;
|
||||
|
||||
dict = g_variant_dict_new (NULL);
|
||||
|
||||
g_signal_emit (widget, widget_signals[SAVE_STATE], 0, dict, &save_children, &ret);
|
||||
|
||||
g_variant_builder_init (&data, G_VARIANT_TYPE_VARDICT);
|
||||
|
||||
v = g_variant_dict_end (dict);
|
||||
if (g_variant_n_children (v) > 0)
|
||||
g_variant_builder_add (&data, "{sv}", "data", v);
|
||||
else
|
||||
g_variant_unref (v);
|
||||
|
||||
if (save_children)
|
||||
{
|
||||
g_variant_dict_init (dict, NULL);
|
||||
gtk_widget_forall (widget, (GtkCallback) gtk_widget_collect_child_state, dict);
|
||||
v = g_variant_dict_end (dict);
|
||||
if (g_variant_n_children (v) > 0)
|
||||
g_variant_builder_add (&data, "{sv}", "children", v);
|
||||
else
|
||||
g_variant_unref (v);
|
||||
}
|
||||
|
||||
g_variant_dict_unref (dict);
|
||||
|
||||
v = g_variant_builder_end (&data);
|
||||
if (g_variant_n_children (v) > 0)
|
||||
return v;
|
||||
|
||||
g_variant_unref (v);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_widget_restore_child_state (GtkWidget *widget,
|
||||
GVariant *data)
|
||||
{
|
||||
const char *id;
|
||||
GVariant *v;
|
||||
|
||||
id = gtk_widget_get_save_id (widget);
|
||||
if (!id)
|
||||
return;
|
||||
|
||||
v = g_variant_lookup_value (data, id, G_VARIANT_TYPE_VARDICT);
|
||||
if (v)
|
||||
gtk_widget_restore_state (widget, v);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_restore_state:
|
||||
* @widget: a `GtkWidget`
|
||||
* @state: an "a{sv}" `GVariant` as returned by gtk_widget_save_state()
|
||||
*
|
||||
* Restores state of @widget and its children.
|
||||
*
|
||||
* See [method@Gtk.Widget.save_state] for how to save state.
|
||||
*
|
||||
* This function is used by `GtkApplication` to implement automatic
|
||||
* state restoration. It is recommended that you use that functionality.
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
void
|
||||
gtk_widget_restore_state (GtkWidget *widget,
|
||||
GVariant *state)
|
||||
{
|
||||
GVariant *data;
|
||||
gboolean ret;
|
||||
|
||||
data = g_variant_lookup_value (state, "data", G_VARIANT_TYPE_VARDICT);
|
||||
if (data)
|
||||
g_signal_emit (widget, widget_signals[RESTORE_STATE], 0, data, &ret);
|
||||
|
||||
data = g_variant_lookup_value (state, "children", G_VARIANT_TYPE_VARDICT);
|
||||
if (data)
|
||||
gtk_widget_forall (widget, (GtkCallback) gtk_widget_restore_child_state, data);
|
||||
}
|
||||
|
||||
+1
-23
@@ -257,18 +257,11 @@ struct _GtkWidgetClass
|
||||
double x,
|
||||
double y);
|
||||
|
||||
gboolean (* save_state) (GtkWidget *widget,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children);
|
||||
|
||||
gboolean (* restore_state) (GtkWidget *widget,
|
||||
GVariant *data);
|
||||
|
||||
/*< private >*/
|
||||
|
||||
GtkWidgetClassPrivate *priv;
|
||||
|
||||
gpointer padding[6];
|
||||
gpointer padding[8];
|
||||
};
|
||||
|
||||
|
||||
@@ -984,21 +977,6 @@ GtkAccessibleRole gtk_widget_class_get_accessible_role (GtkWidgetClass
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
void gtk_widget_set_save_id (GtkWidget *widget,
|
||||
const char *id);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
const char * gtk_widget_get_save_id (GtkWidget *widget);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
GVariant * gtk_widget_save_state (GtkWidget *widget);
|
||||
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
void gtk_widget_restore_state (GtkWidget *widget,
|
||||
GVariant *state);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_WIDGET_H__ */
|
||||
|
||||
@@ -198,9 +198,6 @@ struct _GtkWidgetPrivate
|
||||
/* Accessibility */
|
||||
GtkAccessibleRole accessible_role;
|
||||
GtkATContext *at_context;
|
||||
|
||||
/* State saving */
|
||||
char *save_id;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
|
||||
+6
-52
@@ -64,6 +64,7 @@
|
||||
#include "gtkpopovermenubarprivate.h"
|
||||
#include "gtkcssboxesimplprivate.h"
|
||||
#include "gtktooltipprivate.h"
|
||||
#include "gtkmenubutton.h"
|
||||
|
||||
#include "inspector/window.h"
|
||||
|
||||
@@ -708,54 +709,6 @@ gtk_window_get_request_mode (GtkWidget *widget)
|
||||
return GTK_SIZE_REQUEST_CONSTANT_SIZE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_window_save_state (GtkWidget *widget,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children)
|
||||
{
|
||||
GtkWindow *win = GTK_WINDOW (widget);
|
||||
int width, height;
|
||||
|
||||
g_variant_dict_insert (dict, "maximized", "b", gtk_window_is_maximized (win));
|
||||
g_variant_dict_insert (dict, "fullscreen", "b", gtk_window_is_fullscreen (win));
|
||||
|
||||
gtk_window_get_default_size (win, &width, &height);
|
||||
g_variant_dict_insert (dict, "size", "(ii)", width, height);
|
||||
|
||||
*save_children = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_window_restore_state (GtkWidget *widget,
|
||||
GVariant *state)
|
||||
{
|
||||
GtkWindow *win = GTK_WINDOW (widget);
|
||||
gboolean maximized;
|
||||
gboolean fullscreen;
|
||||
int width, height;
|
||||
|
||||
if (g_variant_lookup (state, "maximized", "b", &maximized))
|
||||
{
|
||||
if (maximized)
|
||||
gtk_window_maximize (win);
|
||||
}
|
||||
|
||||
if (g_variant_lookup (state, "fullscreen", "b", &fullscreen))
|
||||
{
|
||||
if (fullscreen)
|
||||
gtk_window_fullscreen (win);
|
||||
}
|
||||
|
||||
if (g_variant_lookup (state, "size", "(ii)", &width, &height))
|
||||
{
|
||||
gtk_window_set_default_size (win, width, height);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_class_init (GtkWindowClass *klass)
|
||||
{
|
||||
@@ -787,8 +740,6 @@ gtk_window_class_init (GtkWindowClass *klass)
|
||||
widget_class->move_focus = gtk_window_move_focus;
|
||||
widget_class->measure = gtk_window_measure;
|
||||
widget_class->css_changed = gtk_window_css_changed;
|
||||
widget_class->save_state = gtk_window_save_state;
|
||||
widget_class->restore_state = gtk_window_restore_state;
|
||||
|
||||
klass->activate_default = gtk_window_real_activate_default;
|
||||
klass->activate_focus = gtk_window_real_activate_focus;
|
||||
@@ -5857,7 +5808,10 @@ gtk_window_activate_menubar (GtkWidget *widget,
|
||||
gtk_widget_focus_sort (GTK_WIDGET (window), GTK_DIR_TAB_FORWARD, menubars);
|
||||
|
||||
first = g_ptr_array_index (menubars, 0);
|
||||
gtk_popover_menu_bar_select_first (GTK_POPOVER_MENU_BAR (first));
|
||||
if (GTK_IS_POPOVER_MENU_BAR (first))
|
||||
gtk_popover_menu_bar_select_first (GTK_POPOVER_MENU_BAR (first));
|
||||
else if (GTK_IS_MENU_BUTTON (first))
|
||||
gtk_menu_button_popup (GTK_MENU_BUTTON (first));
|
||||
|
||||
g_ptr_array_free (menubars, TRUE);
|
||||
|
||||
@@ -6200,7 +6154,7 @@ gtk_window_set_debugging (GdkDisplay *display,
|
||||
* gtk_window_set_interactive_debugging:
|
||||
* @enable: %TRUE to enable interactive debugging
|
||||
*
|
||||
* Opens or closes the [interactive debugger](#interactive-debugging).
|
||||
* Opens or closes the [interactive debugger](running.html#interactive-debugging).
|
||||
*
|
||||
* The debugger offers access to the widget hierarchy of the application
|
||||
* and to useful debugging tools.
|
||||
|
||||
@@ -604,6 +604,7 @@ gtk_public_headers = files([
|
||||
'gtkpaned.h',
|
||||
'gtkpapersize.h',
|
||||
'gtkpasswordentry.h',
|
||||
'gtkpasswordentrybuffer.h',
|
||||
'gtkpicture.h',
|
||||
'gtkpopover.h',
|
||||
'gtkpopovermenu.h',
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
directory=glib
|
||||
url=https://gitlab.gnome.org/GNOME/glib.git
|
||||
push-url=ssh://git@gitlab.gnome.org:GNOME/glib.git
|
||||
revision=master
|
||||
revision=main
|
||||
depth=1
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
gtk_tests = [
|
||||
# testname, optional extra sources
|
||||
['state-saving'],
|
||||
['testpopup'],
|
||||
['testupload'],
|
||||
['testtransform'],
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
/* state-saving.c
|
||||
* Copyright (C) 2021 Red Hat, Inc
|
||||
*
|
||||
* 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 <gtk/gtk.h>
|
||||
|
||||
|
||||
static void
|
||||
quit_cb (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gboolean *done = data;
|
||||
|
||||
*done = TRUE;
|
||||
|
||||
g_main_context_wakeup (NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
save_cb (GtkWidget *window)
|
||||
{
|
||||
GVariant *state;
|
||||
char *s;
|
||||
GError *error = NULL;
|
||||
|
||||
state = gtk_widget_save_state (window);
|
||||
if (!state)
|
||||
{
|
||||
g_print ("no state\n");
|
||||
return;
|
||||
}
|
||||
|
||||
s = g_variant_print (state, TRUE);
|
||||
g_print ("%s\n", s);
|
||||
g_free (s);
|
||||
|
||||
if (!g_file_set_contents ("saved-state",
|
||||
g_variant_get_data (state),
|
||||
g_variant_get_size (state),
|
||||
&error))
|
||||
{
|
||||
g_error ("Failed to save state: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_variant_unref (state);
|
||||
}
|
||||
|
||||
static void
|
||||
restore_cb (GtkWidget *window)
|
||||
{
|
||||
char *contents;
|
||||
gsize len;
|
||||
GError *error = NULL;
|
||||
GVariant *state;
|
||||
|
||||
if (!g_file_get_contents ("saved-state", &contents, &len, &error))
|
||||
{
|
||||
g_print ("Error loading state: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
state = g_variant_new_from_data (G_VARIANT_TYPE_VARDICT, contents, len, FALSE, NULL, NULL);
|
||||
gtk_widget_restore_state (window, state);
|
||||
g_variant_unref (state);
|
||||
}
|
||||
|
||||
static void
|
||||
add_to_list (GtkWidget *list)
|
||||
{
|
||||
GtkWidget *entry;
|
||||
int i;
|
||||
char *s;
|
||||
GtkWidget *w;
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
|
||||
gtk_widget_set_save_id (entry, "entry");
|
||||
gtk_list_box_append (GTK_LIST_BOX (list), entry);
|
||||
|
||||
for (i = 0, w = gtk_widget_get_first_child (list);
|
||||
w;
|
||||
w = gtk_widget_get_next_sibling (w)) i++;
|
||||
|
||||
s = g_strdup_printf ("item%d", i);
|
||||
gtk_widget_set_save_id (gtk_widget_get_parent (entry), s);
|
||||
g_free (s);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
save_list (GtkWidget *list,
|
||||
GVariantDict *dict,
|
||||
gboolean *save_children,
|
||||
gpointer data)
|
||||
{
|
||||
int n_items;
|
||||
GtkWidget *w;
|
||||
|
||||
for (n_items = 0, w = gtk_widget_get_first_child (list);
|
||||
w;
|
||||
w = gtk_widget_get_next_sibling (w)) n_items++;
|
||||
|
||||
g_variant_dict_insert (dict, "n-items", "i", n_items);
|
||||
*save_children = TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
restore_list (GtkWidget *list,
|
||||
GVariant *data)
|
||||
{
|
||||
int n_items;
|
||||
|
||||
if (g_variant_lookup (data, "n-items", "i", &n_items))
|
||||
{
|
||||
for (int i = 0; i < n_items; i++)
|
||||
add_to_list (list);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window, *box, *hbox, *button, *scale;
|
||||
GtkWidget *entry, *cc, *sw, *stack, *switcher;
|
||||
GtkWidget *list;
|
||||
gboolean done = FALSE;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_widget_set_save_id (window, "window");
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "hello world");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_widget_set_save_id (box, "box");
|
||||
|
||||
stack = gtk_stack_new ();
|
||||
gtk_widget_set_save_id (stack, "stack");
|
||||
switcher = gtk_stack_switcher_new ();
|
||||
gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (switcher), GTK_STACK (stack));
|
||||
|
||||
gtk_box_append (GTK_BOX (box), switcher);
|
||||
gtk_box_append (GTK_BOX (box), stack);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_box_append (GTK_BOX (box), hbox);
|
||||
|
||||
button = gtk_button_new_with_label ("Save");
|
||||
gtk_widget_set_hexpand (button, TRUE);
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (save_cb), window);
|
||||
gtk_box_append (GTK_BOX (hbox), button);
|
||||
|
||||
button = gtk_button_new_with_label ("Restore");
|
||||
gtk_widget_set_hexpand (button, TRUE);
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (restore_cb), window);
|
||||
gtk_box_append (GTK_BOX (hbox), button);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_widget_set_save_id (box, "box");
|
||||
|
||||
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0, 100, 1);
|
||||
gtk_widget_set_save_id (scale, "scale");
|
||||
gtk_box_append (GTK_BOX (box), scale);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_widget_set_save_id (entry, "entry");
|
||||
gtk_box_append (GTK_BOX (box), entry);
|
||||
|
||||
cc = gtk_color_chooser_widget_new ();
|
||||
gtk_widget_set_save_id (cc, "color");
|
||||
gtk_box_append (GTK_BOX (box), cc);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_save_id (hbox, "hbox");
|
||||
gtk_box_append (GTK_BOX (box), hbox);
|
||||
|
||||
sw = gtk_switch_new ();
|
||||
gtk_widget_set_save_id (sw, "switch");
|
||||
gtk_widget_set_valign (sw, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (hbox), sw);
|
||||
|
||||
button = gtk_check_button_new_with_label ("Check");
|
||||
gtk_widget_set_save_id (button, "check");
|
||||
gtk_box_append (GTK_BOX (hbox), button);
|
||||
|
||||
button = gtk_toggle_button_new_with_label ("Toggle");
|
||||
gtk_widget_set_save_id (button, "toggle");
|
||||
gtk_box_append (GTK_BOX (hbox), button);
|
||||
|
||||
entry = gtk_spin_button_new_with_range (0, 100, 1);
|
||||
gtk_widget_set_save_id (entry, "spin");
|
||||
gtk_box_append (GTK_BOX (hbox), entry);
|
||||
|
||||
entry = gtk_password_entry_new ();
|
||||
gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry), TRUE);
|
||||
gtk_widget_set_save_id (entry, "password");
|
||||
gtk_box_append (GTK_BOX (box), entry);
|
||||
|
||||
gtk_stack_add_titled (GTK_STACK (stack), box, "page1", "Page 1");
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_save_id (box, "box2");
|
||||
|
||||
list = gtk_list_box_new ();
|
||||
gtk_widget_set_save_id (list, "list");
|
||||
g_signal_connect (list, "save-state", G_CALLBACK (save_list), NULL);
|
||||
g_signal_connect (list, "restore-state", G_CALLBACK (restore_list), NULL);
|
||||
|
||||
button = gtk_button_new_with_label ("Add");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (add_to_list), list);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
gtk_box_append (GTK_BOX (box), list);
|
||||
|
||||
gtk_stack_add_titled (GTK_STACK (stack), box, "page2", "Page 2");
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
while (!done)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
+2
-2
@@ -5576,8 +5576,8 @@ native_filter_changed (GtkWidget *combo,
|
||||
case 1: /* pattern */
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, "Text");
|
||||
gtk_file_filter_add_pattern (filter, "*.doc");
|
||||
gtk_file_filter_add_pattern (filter, "*.txt");
|
||||
gtk_file_filter_add_suffix (filter, "doc");
|
||||
gtk_file_filter_add_suffix (filter, "txt");
|
||||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (native), filter);
|
||||
g_object_unref (filter);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ type_name_mangle (const char *name,
|
||||
gboolean split_first_cap)
|
||||
{
|
||||
GString *symbol_name = g_string_new ("");
|
||||
gint i;
|
||||
int i;
|
||||
|
||||
for (i = 0; name[i] != '\0'; i++)
|
||||
{
|
||||
@@ -300,7 +300,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
const GType *all_types;
|
||||
guint n_types = 0, i;
|
||||
gint result;
|
||||
int result;
|
||||
|
||||
/* These must be set before before gtk_test_init */
|
||||
g_setenv ("GIO_USE_VFS", "local", TRUE);
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/* GtkFileFilter tests
|
||||
*
|
||||
* Copyright (C) 2021, 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/>.
|
||||
*/
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
test_basic (void)
|
||||
{
|
||||
GtkFileFilter *filter;
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_set_name (filter, "test");
|
||||
g_assert_cmpstr (gtk_file_filter_get_name (filter), ==, "test");
|
||||
|
||||
g_object_unref (filter);
|
||||
}
|
||||
|
||||
static void
|
||||
test_pattern (void)
|
||||
{
|
||||
GtkFileFilter *filter;
|
||||
char *attrs;
|
||||
GFileInfo *info;
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_pattern (filter, "D*.st[xy]");
|
||||
attrs = g_strjoinv (",", (char **)gtk_file_filter_get_attributes (filter));
|
||||
|
||||
info = g_file_info_new ();
|
||||
|
||||
g_file_info_set_display_name (info, "abracadabra");
|
||||
g_assert_false (gtk_filter_match (GTK_FILTER (filter), info));
|
||||
|
||||
g_file_info_set_display_name (info, "dro.stx");
|
||||
g_assert_false (gtk_filter_match (GTK_FILTER (filter), info));
|
||||
|
||||
g_file_info_set_display_name (info, "Dro.sty");
|
||||
g_assert_true (gtk_filter_match (GTK_FILTER (filter), info));
|
||||
|
||||
g_object_unref (info);
|
||||
g_free (attrs);
|
||||
g_object_unref (filter);
|
||||
}
|
||||
|
||||
static void
|
||||
test_suffix (void)
|
||||
{
|
||||
GtkFileFilter *filter;
|
||||
char *attrs;
|
||||
GFileInfo *info;
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_suffix (filter, "txt");
|
||||
attrs = g_strjoinv (",", (char **)gtk_file_filter_get_attributes (filter));
|
||||
|
||||
info = g_file_info_new ();
|
||||
|
||||
g_file_info_set_display_name (info, "abracadabra");
|
||||
g_assert_false (gtk_filter_match (GTK_FILTER (filter), info));
|
||||
|
||||
g_file_info_set_display_name (info, "dro.txt");
|
||||
g_assert_true (gtk_filter_match (GTK_FILTER (filter), info));
|
||||
|
||||
g_file_info_set_display_name (info, "dro.TXT");
|
||||
g_assert_true (gtk_filter_match (GTK_FILTER (filter), info));
|
||||
|
||||
g_object_unref (info);
|
||||
g_free (attrs);
|
||||
g_object_unref (filter);
|
||||
}
|
||||
|
||||
static void
|
||||
test_mime_type (void)
|
||||
{
|
||||
GtkFileFilter *filter;
|
||||
char *attrs;
|
||||
GFileInfo *info;
|
||||
|
||||
filter = gtk_file_filter_new ();
|
||||
gtk_file_filter_add_mime_type (filter, "image/png");
|
||||
attrs = g_strjoinv (",", (char **)gtk_file_filter_get_attributes (filter));
|
||||
|
||||
info = g_file_info_new ();
|
||||
|
||||
g_file_info_set_display_name (info, "abracadabra");
|
||||
g_file_info_set_content_type (info, "text/plain");
|
||||
g_assert_false (gtk_filter_match (GTK_FILTER (filter), info));
|
||||
|
||||
g_file_info_set_display_name (info, "dro.png");
|
||||
g_file_info_set_content_type (info, "image/png");
|
||||
g_assert_true (gtk_filter_match (GTK_FILTER (filter), info));
|
||||
|
||||
g_file_info_set_display_name (info, "dro.PNG");
|
||||
g_file_info_set_content_type (info, "image/png");
|
||||
g_assert_true (gtk_filter_match (GTK_FILTER (filter), info));
|
||||
|
||||
g_object_unref (info);
|
||||
g_free (attrs);
|
||||
g_object_unref (filter);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
setlocale (LC_ALL, "C");
|
||||
|
||||
g_test_add_func ("/filefilter/basic", test_basic);
|
||||
g_test_add_func ("/filefilter/pattern", test_pattern);
|
||||
g_test_add_func ("/filefilter/suffix", test_suffix);
|
||||
g_test_add_func ("/filefilter/mimetype", test_mime_type);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtk/gtkprivate.h"
|
||||
|
||||
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)
|
||||
#define DO_ESCAPE 0
|
||||
#else
|
||||
#define DO_ESCAPE 1
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
const char *pat;
|
||||
const char *str;
|
||||
gboolean no_leading_period;
|
||||
gboolean ci;
|
||||
gboolean result;
|
||||
} TestCase;
|
||||
|
||||
static TestCase tests[] = {
|
||||
{ "[a-]", "-", TRUE, FALSE, TRUE },
|
||||
|
||||
{ "a", "a", TRUE, FALSE, TRUE },
|
||||
{ "a", "b", TRUE, FALSE, FALSE },
|
||||
|
||||
/* Test what ? matches */
|
||||
{ "?", "a", TRUE, FALSE, TRUE },
|
||||
{ "?", ".", TRUE, FALSE, FALSE },
|
||||
{ "a?", "a.", TRUE, FALSE, TRUE },
|
||||
{ "a/?", "a/b", TRUE, FALSE, TRUE },
|
||||
{ "a/?", "a/.", TRUE, FALSE, FALSE },
|
||||
{ "?", "/", TRUE, FALSE, FALSE },
|
||||
|
||||
/* Test what * matches */
|
||||
{ "*", "a", TRUE, FALSE, TRUE },
|
||||
{ "*", ".", TRUE, FALSE, FALSE },
|
||||
{ "a*", "a.", TRUE, FALSE, TRUE },
|
||||
{ "a/*", "a/b", TRUE, FALSE, TRUE },
|
||||
{ "a/*", "a/.", TRUE, FALSE, FALSE },
|
||||
{ "*", "/", TRUE, FALSE, FALSE },
|
||||
|
||||
/* Range tests */
|
||||
{ "[ab]", "a", TRUE, FALSE, TRUE },
|
||||
{ "[ab]", "c", TRUE, FALSE, FALSE },
|
||||
{ "[^ab]", "a", TRUE, FALSE, FALSE },
|
||||
{ "[!ab]", "a", TRUE, FALSE, FALSE },
|
||||
{ "[^ab]", "c", TRUE, FALSE, TRUE },
|
||||
{ "[!ab]", "c", TRUE, FALSE, TRUE },
|
||||
{ "[a-c]", "b", TRUE, FALSE, TRUE },
|
||||
{ "[a-c]", "d", TRUE, FALSE, FALSE },
|
||||
{ "[a-]", "-", TRUE, FALSE, TRUE },
|
||||
{ "[]]", "]", TRUE, FALSE, TRUE },
|
||||
{ "[^]]", "a", TRUE, FALSE, TRUE },
|
||||
{ "[!]]", "a", TRUE, FALSE, TRUE },
|
||||
|
||||
/* Various unclosed ranges */
|
||||
{ "[ab", "a", TRUE, FALSE, FALSE },
|
||||
{ "[a-", "a", TRUE, FALSE, FALSE },
|
||||
{ "[ab", "c", TRUE, FALSE, FALSE },
|
||||
{ "[a-", "c", TRUE, FALSE, FALSE },
|
||||
{ "[^]", "a", TRUE, FALSE, FALSE },
|
||||
|
||||
/* Ranges and special no-wildcard matches */
|
||||
{ "[.]", ".", TRUE, FALSE, FALSE },
|
||||
{ "a[.]", "a.", TRUE, FALSE, TRUE },
|
||||
{ "a/[.]", "a/.", TRUE, FALSE, FALSE },
|
||||
{ "[/]", "/", TRUE, FALSE, FALSE },
|
||||
{ "[^/]", "a", TRUE, FALSE, TRUE },
|
||||
|
||||
/* Basic tests of * (and combinations of * and ?) */
|
||||
{ "a*b", "ab", TRUE, FALSE, TRUE },
|
||||
{ "a*b", "axb", TRUE, FALSE, TRUE },
|
||||
{ "a*b", "axxb", TRUE, FALSE, TRUE },
|
||||
{ "a**b", "ab", TRUE, FALSE, TRUE },
|
||||
{ "a**b", "axb", TRUE, FALSE, TRUE },
|
||||
{ "a**b", "axxb", TRUE, FALSE, TRUE },
|
||||
{ "a*?*b", "ab", TRUE, FALSE, FALSE },
|
||||
{ "a*?*b", "axb", TRUE, FALSE, TRUE },
|
||||
{ "a*?*b", "axxb", TRUE, FALSE, TRUE },
|
||||
|
||||
/* Test of *[range] */
|
||||
{ "a*[cd]", "ac", TRUE, FALSE, TRUE },
|
||||
{ "a*[cd]", "axc", TRUE, FALSE, TRUE },
|
||||
{ "a*[cd]", "axx", TRUE, FALSE, FALSE },
|
||||
|
||||
{ "a/[.]", "a/.", TRUE, FALSE, FALSE },
|
||||
{ "a*[.]", "a/.", TRUE, FALSE, FALSE },
|
||||
|
||||
|
||||
/* Test of UTF-8 */
|
||||
|
||||
{ "ä", "ä", TRUE, FALSE, TRUE },
|
||||
{ "?", "ä", TRUE, FALSE, TRUE },
|
||||
{ "*ö", "äö", TRUE, FALSE, TRUE },
|
||||
{ "*ö", "ääö", TRUE, FALSE, TRUE },
|
||||
{ "[ä]", "ä", TRUE, FALSE, TRUE },
|
||||
{ "[ä-ö]", "é", TRUE, FALSE, TRUE },
|
||||
{ "[ä-ö]", "a", TRUE, FALSE, FALSE },
|
||||
|
||||
/* ci patterns */
|
||||
{ "*.txt", "a.TXT", TRUE, TRUE, TRUE },
|
||||
{ "*.txt", "a.TxT", TRUE, TRUE, TRUE },
|
||||
{ "*.txt", "a.txT", TRUE, TRUE, TRUE },
|
||||
{ "*ö", "äÖ", TRUE, TRUE, TRUE },
|
||||
|
||||
#ifdef DO_ESCAPE
|
||||
/* Tests of escaping */
|
||||
{ "\\\\", "\\", TRUE, FALSE, TRUE },
|
||||
{ "\\?", "?", TRUE, FALSE, TRUE },
|
||||
{ "\\?", "a", TRUE, FALSE, FALSE },
|
||||
{ "\\*", "*", TRUE, FALSE, TRUE },
|
||||
{ "\\*", "a", TRUE, FALSE, FALSE },
|
||||
{ "\\[a-b]", "[a-b]", TRUE, FALSE, TRUE },
|
||||
{ "[\\\\]", "\\", TRUE, FALSE, TRUE },
|
||||
{ "[\\^a]", "a", TRUE, FALSE, TRUE },
|
||||
{ "[a\\-c]", "b", TRUE, FALSE, FALSE },
|
||||
{ "[a\\-c]", "-", TRUE, FALSE, TRUE },
|
||||
{ "[a\\]", "a", TRUE, FALSE, FALSE },
|
||||
#endif /* DO_ESCAPE */
|
||||
};
|
||||
|
||||
static void
|
||||
test_fnmatch (gconstpointer data)
|
||||
{
|
||||
const TestCase *test = data;
|
||||
|
||||
g_assert_true (_gtk_fnmatch (test->pat, test->str, test->no_leading_period, test->ci) == test->result);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char *glob;
|
||||
const char *ci;
|
||||
} CITest;
|
||||
|
||||
static CITest citests[] = {
|
||||
{ "*.txt", "*.[tT][xX][tT]" },
|
||||
{ "*.TXT", "*.[tT][xX][tT]" },
|
||||
{ "*?[]-abc]t", "*?[]-abc][tT]" },
|
||||
#ifdef DO_ESCAPE
|
||||
/* Tests of escaping */
|
||||
{ "\\\\", "\\\\" },
|
||||
{ "\\??", "\\??" },
|
||||
{ "\\**", "\\**" },
|
||||
{ "\\[", "\\[" },
|
||||
{ "\\[a-", "\\[[aA]-" },
|
||||
{ "\\[]", "\\[]" },
|
||||
#endif
|
||||
};
|
||||
|
||||
static void
|
||||
test_ci_glob (gconstpointer data)
|
||||
{
|
||||
const CITest *test = data;
|
||||
char *ci;
|
||||
|
||||
ci = _gtk_make_ci_glob_pattern (test->glob);
|
||||
g_assert_cmpstr (ci, ==, test->ci);
|
||||
g_free (ci);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
(g_test_init) (&argc, &argv, NULL);
|
||||
|
||||
for (int i = 0; i < G_N_ELEMENTS (tests); i++)
|
||||
{
|
||||
char *path = g_strdup_printf ("/fnmatch/test%d", i);
|
||||
g_test_add_data_func (path, &tests[i], test_fnmatch);
|
||||
}
|
||||
|
||||
for (int i = 0; i < G_N_ELEMENTS (citests); i++)
|
||||
{
|
||||
char *path = g_strdup_printf ("/ci-glob/test%d", i);
|
||||
g_test_add_data_func (path, &citests[i], test_ci_glob);
|
||||
}
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
@@ -89,7 +89,7 @@ print_attr_list (PangoAttrList *attrs, GString *string)
|
||||
|
||||
iter = pango_attr_list_get_iterator (attrs);
|
||||
do {
|
||||
gint start, end;
|
||||
int start, end;
|
||||
GSList *list, *l;
|
||||
|
||||
pango_attr_iterator_range (iter, &start, &end);
|
||||
|
||||
@@ -38,6 +38,7 @@ tests = [
|
||||
{ 'name': 'defaultvalue' },
|
||||
{ 'name': 'entry' },
|
||||
{ 'name': 'expression' },
|
||||
{ 'name': 'filefilter' },
|
||||
{ 'name': 'filter' },
|
||||
{ 'name': 'filterlistmodel' },
|
||||
{
|
||||
@@ -118,6 +119,7 @@ internal_tests = [
|
||||
{ 'name': 'rbtree' },
|
||||
{ 'name': 'timsort' },
|
||||
{ 'name': 'texthistory' },
|
||||
{ 'name': 'fnmatch' },
|
||||
]
|
||||
|
||||
# Tests that are expected to fail
|
||||
|
||||
@@ -4,15 +4,12 @@
|
||||
<object class="GtkWindow">
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="can_focus">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="can_focus">0</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="can_focus">0</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">0</property>
|
||||
@@ -20,12 +17,14 @@
|
||||
<object class="GtkButton">
|
||||
<property name="halign">center</property>
|
||||
<property name="label" translatable="yes">_</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">F</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -34,6 +33,7 @@
|
||||
<property name="halign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="label" translatable="yes">E</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -41,6 +41,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="label" translatable="yes">FE</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -56,12 +57,14 @@
|
||||
<object class="GtkButton">
|
||||
<property name="halign">center</property>
|
||||
<property name="label" translatable="yes">_</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">F</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -70,6 +73,7 @@
|
||||
<property name="halign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="label" translatable="yes">E</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -77,6 +81,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="label" translatable="yes">FE</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -94,12 +99,14 @@
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">_</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">F</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -108,6 +115,7 @@
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">E</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -115,6 +123,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">FE</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -122,7 +131,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="can_focus">0</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="orientation">vertical</property>
|
||||
@@ -130,12 +138,14 @@
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">_I</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FI</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -144,6 +154,7 @@
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">EI</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -151,12 +162,14 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">FEI</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_S</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -164,6 +177,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FS</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">start</property>
|
||||
</object>
|
||||
@@ -172,6 +186,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">ES</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -180,6 +195,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">FES</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">start</property>
|
||||
</object>
|
||||
@@ -187,6 +203,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_N</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -194,6 +211,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FN</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">end</property>
|
||||
</object>
|
||||
@@ -202,6 +220,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">EN</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -210,6 +229,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">FEN</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">end</property>
|
||||
</object>
|
||||
@@ -217,6 +237,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_C</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -224,6 +245,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FC</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -232,6 +254,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">EC</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -240,6 +263,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">FEC</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -247,6 +271,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_B</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -254,6 +279,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FB</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">baseline</property>
|
||||
</object>
|
||||
@@ -262,6 +288,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">EB</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
@@ -270,6 +297,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="label" translatable="yes">FEB</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">baseline</property>
|
||||
</object>
|
||||
@@ -278,7 +306,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="can_focus">0</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="orientation">vertical</property>
|
||||
@@ -286,6 +313,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">_I</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="vexpand">0</property>
|
||||
</object>
|
||||
@@ -293,6 +321,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FI</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="vexpand">0</property>
|
||||
</object>
|
||||
@@ -301,6 +330,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">EI</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
</object>
|
||||
@@ -308,6 +338,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FEI</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
</object>
|
||||
@@ -315,6 +346,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_S</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">0</property>
|
||||
@@ -323,6 +355,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FS</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="vexpand">0</property>
|
||||
@@ -331,6 +364,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">ES</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -339,6 +373,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FES</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -347,6 +382,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_N</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">0</property>
|
||||
@@ -355,6 +391,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FN</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="vexpand">0</property>
|
||||
@@ -363,6 +400,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">EN</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -371,6 +409,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FEN</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -379,6 +418,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_C</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">0</property>
|
||||
@@ -387,6 +427,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FC</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">0</property>
|
||||
@@ -395,6 +436,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">EC</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -403,6 +445,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FEC</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -411,6 +454,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_B</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">0</property>
|
||||
@@ -419,6 +463,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FB</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="vexpand">0</property>
|
||||
@@ -427,6 +472,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">EB</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -435,6 +481,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FEB</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -444,7 +491,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="can_focus">0</property>
|
||||
<property name="hexpand">0</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="orientation">vertical</property>
|
||||
@@ -452,6 +498,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">_I</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
</object>
|
||||
@@ -459,6 +506,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FI</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
</object>
|
||||
@@ -467,6 +515,7 @@
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">EI</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
</object>
|
||||
@@ -474,6 +523,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FEI</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
</object>
|
||||
@@ -481,6 +531,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_S</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -489,6 +540,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FS</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -497,6 +549,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">ES</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -505,6 +558,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FES</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -513,6 +567,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_N</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -521,6 +576,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FN</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -529,6 +585,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">EN</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -537,6 +594,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FEN</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -545,6 +603,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_C</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -553,6 +612,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FC</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -561,6 +621,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">EC</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -569,6 +630,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FEC</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -577,6 +639,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">_B</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -585,6 +648,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FB</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -593,6 +657,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">EB</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="vexpand">1</property>
|
||||
@@ -601,6 +666,7 @@
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">FEB</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="vexpand">1</property>
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
<child>
|
||||
<object class="GtkSwitch" id="button5">
|
||||
<property name="active">1</property>
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
@@ -76,6 +77,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="button6">
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<layout>
|
||||
<property name="column">5</property>
|
||||
@@ -85,6 +87,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button7">
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="label">Text Button</property>
|
||||
<layout>
|
||||
@@ -95,6 +98,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button8">
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
@@ -106,6 +110,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button9">
|
||||
<property name="focusable">1</property>
|
||||
<property name="receives_default">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
|
||||
@@ -721,6 +721,7 @@ maybe_rename_property (Element *element, MyParserData *data)
|
||||
{ "GtkHeaderBar", "custom-title", GTK_TYPE_HEADER_BAR, PROP_KIND_OBJECT, "title-widget", { NULL, NULL, NULL } },
|
||||
{ "GtkStack", "homogeneous", GTK_TYPE_STACK, PROP_KIND_OBJECT, "hhomogeneous", { "vhomogeneous", NULL, NULL } },
|
||||
{ "GtkImage", "pixbuf", GTK_TYPE_IMAGE, PROP_KIND_OBJECT, "file", { NULL, NULL, NULL } },
|
||||
{ "GtkWidget", "can-focus", GTK_TYPE_WIDGET, PROP_KIND_OBJECT, "focusable", { NULL, NULL, NULL } },
|
||||
};
|
||||
int i, k, l;
|
||||
PropKind kind;
|
||||
|
||||
Reference in New Issue
Block a user