Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

See merge request GNOME/gtk!2870
This commit is contained in:
Matthias Clasen 2020-11-20 02:02:10 +00:00
commit 8e4cc59a7a
14 changed files with 498 additions and 145 deletions

View File

@ -1,5 +1,5 @@
/* Builder
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, toolbar
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, GtkShortcutController, toolbar
*
* Demonstrates a traditional interface, loaded from a XML description,
* and shows how to connect actions to the menu items and toolbar buttons.

View File

@ -1,106 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">ConstraintsBuilder</property>
<property name="default-width">260</property>
<child>
<object class="ConstraintsGrid">
<property name="layout-manager">
<object class="GtkConstraintLayout">
<constraints>
<guide name="space"
min-width="10" min-height="10"
nat-width="100" nat-height="10"
max-width="200" max-height="20"
strength="strong"/>
<constraint target="button1" target-attribute="width"
relation="le"
constant="200"
strength="required"/>
<constraint target="super" target-attribute="start"
relation="eq"
source="button1" source-attribute="start"
constant="-8"
strength="required"/>
<constraint target="button1" target-attribute="width"
relation="eq"
source="button2" source-attribute="width"
strength="required"/>
<constraint target="button1" target-attribute="end"
relation="eq"
source="space" source-attribute="start"
strength="required"/>
<constraint target="space" target-attribute="end"
relation="eq"
source="button2" source-attribute="start"
strength="required"/>
<constraint target="super" target-attribute="end"
relation="eq"
source="button2" source-attribute="end"
constant="8"
strength="required"/>
<constraint target="super" target-attribute="start"
relation="eq"
source="button3" source-attribute="start"
constant="-8"
strength="required"/>
<constraint target="super" target-attribute="end"
relation="eq"
source="button3" source-attribute="end"
constant="8"
strength="required"/>
<constraint target="super" target-attribute="top"
relation="eq"
source="button1" source-attribute="top"
constant="-8"
strength="required"/>
<constraint target="super" target-attribute="top"
relation="eq"
source="button2" source-attribute="top"
constant="-8"
strength="required"/>
<constraint target="button1" target-attribute="bottom"
relation="eq"
source="button3" source-attribute="top"
constant="-12"
strength="required"/>
<constraint target="button2" target-attribute="bottom"
relation="eq"
source="button3" source-attribute="top"
constant="-12"
strength="required"/>
<constraint target="button3" target-attribute="height"
relation="eq"
source="button1" source-attribute="height"
strength="required"/>
<constraint target="button3" target-attribute="height"
relation="eq"
source="button2" source-attribute="height"
strength="required"/>
<constraint target="super" target-attribute="bottom"
relation="eq"
source="button3" source-attribute="bottom"
constant="8"
strength="required"/>
</constraints>
</object>
</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">Child 1</property>
</object>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label">Child 2</property>
</object>
</child>
<child>
<object class="GtkButton" id="button3">
<property name="label">Child 3</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,8 +1,10 @@
/* Constraints/Builder
*
* GtkConstraintLayouts can be created in .ui files, and constraints can be
* set up at that time as well, as this example demonstrates. It uses the
* same setup as the Simple constraints demo.
* GtkConstraintLayouts can be created in .ui files, and constraints can
* be set up at that time as well, as this example demonstrates. It shows
* various ways to do spacing and sizing with constraints.
*
* Make the window wider to see the rows react differently
*/
#include <glib/gi18n.h>
@ -43,7 +45,7 @@ constraints_grid_class_init (ConstraintsGridClass *klass)
}
GtkWidget *
do_constraints4 (GtkWidget *do_widget)
do_constraints_builder (GtkWidget *do_widget)
{
static GtkWidget *window;
@ -53,7 +55,7 @@ do_constraints4 (GtkWidget *do_widget)
g_type_ensure (constraints_grid_get_type ());
builder = gtk_builder_new_from_resource ("/constraints4/constraints.ui");
builder = gtk_builder_new_from_resource ("/constraints_builder/constraints_builder.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),

View File

@ -0,0 +1,460 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">ConstraintsBuilder</property>
<property name="default-width">260</property>
<child>
<object class="ConstraintsGrid">
<property name="halign">fill</property>
<property name="valign">fill</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="layout-manager">
<object class="GtkConstraintLayout">
<constraints>
<guide name="guide1" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide2" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide3" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide4" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide5" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide6" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide7" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide8" min-width="10" nat-width="200" strength="weak"/>
<guide name="guide9" min-width="0" nat-width="200" strength="weak"/>
<guide name="guide10" min-width="0" nat-width="200" strength="weak"/>
<guide name="barrier1" min-height="10"/>
<guide name="barrier2" min-height="10"/>
<guide name="barrier3" min-height="10"/>
<guide name="barrier4" min-height="10"/>
<!-- Spread Chain -->
<constraint target="super" target-attribute="top"
relation="eq"
source="button1" source-attribute="top"
strength="required"/>
<constraint target="super" target-attribute="top"
relation="eq"
source="button2" source-attribute="top"
strength="required"/>
<constraint target="super" target-attribute="top"
relation="eq"
source="button3" source-attribute="top"
strength="required"/>
<constraint target="super" target-attribute="left"
relation="eq"
source="guide1" source-attribute="left"
strength="required"/>
<constraint target="button1" target-attribute="left"
relation="eq"
source="guide1" source-attribute="right"
strength="required"/>
<constraint target="guide2" target-attribute="left"
relation="eq"
source="button1" source-attribute="right"
strength="required"/>
<constraint target="button2" target-attribute="left"
relation="eq"
source="guide2" source-attribute="right"
strength="required"/>
<constraint target="guide3" target-attribute="left"
relation="eq"
source="button2" source-attribute="right"
strength="required"/>
<constraint target="button3" target-attribute="left"
relation="eq"
source="guide3" source-attribute="right"
strength="required"/>
<constraint target="guide4" target-attribute="left"
relation="eq"
source="button3" source-attribute="right"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="guide4" source-attribute="right"
strength="required"/>
<constraint target="guide1" target-attribute="width"
relation="eq"
source="guide2" source-attribute="width"
strength="required"/>
<constraint target="guide2" target-attribute="width"
relation="eq"
source="guide3" source-attribute="width"
strength="required"/>
<constraint target="guide3" target-attribute="width"
relation="eq"
source="guide4" source-attribute="width"
strength="required"/>
<constraint target="button1" target-attribute="width"
relation="eq"
source="button2" source-attribute="width"
strength="required"/>
<constraint target="button2" target-attribute="width"
relation="eq"
source="button3" source-attribute="width"
strength="required"/>
<constraint target="button1" target-attribute="bottom"
relation="eq"
source="barrier1" source-attribute="top"
strength="required"/>
<constraint target="button2" target-attribute="bottom"
relation="eq"
source="barrier1" source-attribute="top"
strength="required"/>
<constraint target="button3" target-attribute="bottom"
relation="eq"
source="barrier1" source-attribute="top"
strength="required"/>
<!-- Spread Inside Chain -->
<constraint target="super" target-attribute="left"
relation="eq"
source="button4" source-attribute="left"
strength="required"/>
<constraint target="guide5" target-attribute="left"
relation="eq"
source="button4" source-attribute="right"
strength="required"/>
<constraint target="button5" target-attribute="left"
relation="eq"
source="guide5" source-attribute="right"
strength="required"/>
<constraint target="guide6" target-attribute="left"
relation="eq"
source="button5" source-attribute="right"
strength="required"/>
<constraint target="button6" target-attribute="left"
relation="eq"
source="guide6" source-attribute="right"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="button6" source-attribute="right"
strength="required"/>
<constraint target="guide5" target-attribute="width"
relation="eq"
source="guide6" source-attribute="width"
strength="required"/>
<constraint target="button4" target-attribute="width"
relation="eq"
source="button5" source-attribute="width"
strength="required"/>
<constraint target="button5" target-attribute="width"
relation="eq"
source="button6" source-attribute="width"
strength="required"/>
<constraint target="button4" target-attribute="top"
relation="eq"
source="barrier1" source-attribute="bottom"
strength="required"/>
<constraint target="button5" target-attribute="top"
relation="eq"
source="barrier1" source-attribute="bottom"
strength="required"/>
<constraint target="button6" target-attribute="top"
relation="eq"
source="barrier1" source-attribute="bottom"
strength="required"/>
<constraint target="button4" target-attribute="bottom"
relation="eq"
source="barrier2" source-attribute="top"
strength="required"/>
<constraint target="button5" target-attribute="bottom"
relation="eq"
source="barrier2" source-attribute="top"
strength="required"/>
<constraint target="button6" target-attribute="bottom"
relation="eq"
source="barrier2" source-attribute="top"
strength="required"/>
<!-- Weighted Chain -->
<constraint target="super" target-attribute="left"
relation="eq"
source="button7" source-attribute="left"
strength="required"/>
<constraint target="button8" target-attribute="left"
relation="eq"
source="button7" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="button9" target-attribute="left"
relation="eq"
source="button8" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="button9" source-attribute="right"
strength="required"/>
<constraint target="button8" target-attribute="width"
relation="eq"
source="button7" source-attribute="width"
multiplier="2"
strength="required"/>
<constraint target="button9" target-attribute="width"
relation="eq"
source="button7" source-attribute="width"
multiplier="3"
strength="required"/>
<constraint target="button7" target-attribute="top"
relation="eq"
source="barrier2" source-attribute="bottom"
strength="required"/>
<constraint target="button8" target-attribute="top"
relation="eq"
source="barrier2" source-attribute="bottom"
strength="required"/>
<constraint target="button9" target-attribute="top"
relation="eq"
source="barrier2" source-attribute="bottom"
strength="required"/>
<constraint target="button7" target-attribute="bottom"
relation="eq"
source="barrier3" source-attribute="top"
strength="required"/>
<constraint target="button8" target-attribute="bottom"
relation="eq"
source="barrier3" source-attribute="top"
strength="required"/>
<constraint target="button9" target-attribute="bottom"
relation="eq"
source="barrier3" source-attribute="top"
strength="required"/>
<!-- Packed Chain -->
<constraint target="super" target-attribute="left"
relation="eq"
source="guide7" source-attribute="left"
strength="required"/>
<constraint target="button10" target-attribute="left"
relation="eq"
source="guide7" source-attribute="right"
strength="required"/>
<constraint target="button11" target-attribute="left"
relation="eq"
source="button10" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="button12" target-attribute="left"
relation="eq"
source="button11" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="guide8" target-attribute="left"
relation="eq"
source="button12" source-attribute="right"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="guide8" source-attribute="right"
strength="required"/>
<constraint target="guide7" target-attribute="width"
relation="eq"
source="guide8" source-attribute="width"
strength="required"/>
<constraint target="button10" target-attribute="width"
relation="eq"
source="button11" source-attribute="width"
strength="required"/>
<constraint target="button11" target-attribute="width"
relation="eq"
source="button12" source-attribute="width"
strength="required"/>
<constraint target="button10" target-attribute="top"
relation="eq"
source="barrier3" source-attribute="bottom"
strength="required"/>
<constraint target="button11" target-attribute="top"
relation="eq"
source="barrier3" source-attribute="bottom"
strength="required"/>
<constraint target="button12" target-attribute="top"
relation="eq"
source="barrier3" source-attribute="bottom"
strength="required"/>
<constraint target="button10" target-attribute="bottom"
relation="eq"
source="barrier4" source-attribute="top"
strength="required"/>
<constraint target="button11" target-attribute="bottom"
relation="eq"
source="barrier4" source-attribute="top"
strength="required"/>
<constraint target="button12" target-attribute="bottom"
relation="eq"
source="barrier4" source-attribute="top"
strength="required"/>
<!-- Packed Chain with Bias -->
<constraint target="super" target-attribute="left"
relation="eq"
source="guide9" source-attribute="left"
strength="required"/>
<constraint target="button13" target-attribute="left"
relation="eq"
source="guide9" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="button14" target-attribute="left"
relation="eq"
source="button13" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="button15" target-attribute="left"
relation="eq"
source="button14" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="guide10" target-attribute="left"
relation="eq"
source="button15" source-attribute="right"
constant="10"
strength="required"/>
<constraint target="super" target-attribute="right"
relation="eq"
source="guide10" source-attribute="right"
strength="required"/>
<constraint target="guide9" target-attribute="width"
relation="eq"
source="guide10" source-attribute="width"
multiplier="4"
strength="required"/>
<constraint target="button13" target-attribute="width"
relation="eq"
source="button14" source-attribute="width"
strength="required"/>
<constraint target="button14" target-attribute="width"
relation="eq"
source="button15" source-attribute="width"
strength="required"/>
<constraint target="button13" target-attribute="top"
relation="eq"
source="barrier4" source-attribute="bottom"
strength="required"/>
<constraint target="button14" target-attribute="top"
relation="eq"
source="barrier4" source-attribute="bottom"
strength="required"/>
<constraint target="button15" target-attribute="top"
relation="eq"
source="barrier4" source-attribute="bottom"
strength="required"/>
<constraint target="super" target-attribute="bottom"
relation="ge"
source="button13" source-attribute="bottom"
strength="required"/>
<constraint target="super" target-attribute="bottom"
relation="ge"
source="button14" source-attribute="bottom"
strength="required"/>
<constraint target="super" target-attribute="bottom"
relation="ge"
source="button15" source-attribute="bottom"
strength="required"/>
</constraints>
</object>
</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button2">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button3">
<property name="label">C</property>
</object>
</child>
<child>
<object class="GtkButton" id="button4">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button5">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button6">
<property name="label">C</property>
</object>
</child>
<child>
<object class="GtkButton" id="button7">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button8">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button9">
<property name="label">C</property>
</object>
</child>
<child>
<object class="GtkButton" id="button10">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button11">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button12">
<property name="label">C</property>
</object>
</child>
<child>
<object class="GtkButton" id="button13">
<property name="label">A</property>
</object>
</child>
<child>
<object class="GtkButton" id="button14">
<property name="label">B</property>
</object>
</child>
<child>
<object class="GtkButton" id="button15">
<property name="label">C</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -205,7 +205,7 @@ interactive_grid_init (InteractiveGrid *self)
}
GtkWidget *
do_constraints2 (GtkWidget *do_widget)
do_constraints_interactive (GtkWidget *do_widget)
{
static GtkWidget *window;

View File

@ -128,7 +128,7 @@ vfl_grid_init (VflGrid *self)
}
GtkWidget *
do_constraints3 (GtkWidget *do_widget)
do_constraints_vfl (GtkWidget *do_widget)
{
static GtkWidget *window;

View File

@ -18,8 +18,8 @@
<file>demoimage.c</file>
<file>demoimage.h</file>
</gresource>
<gresource prefix="/constraints4">
<file>constraints.ui</file>
<gresource prefix="/constraints_builder">
<file>constraints_builder.ui</file>
</gresource>
<gresource prefix="/css_accordion">
<file>css_accordion.css</file>
@ -253,9 +253,9 @@
<file>clipboard.c</file>
<file>combobox.c</file>
<file>constraints.c</file>
<file>constraints2.c</file>
<file>constraints3.c</file>
<file>constraints4.c</file>
<file>constraints_interactive.c</file>
<file>constraints_vfl.c</file>
<file>constraints_builder.c</file>
<file>css_accordion.c</file>
<file>css_basics.c</file>
<file>css_blendmodes.c</file>
@ -294,7 +294,7 @@
<file>layoutmanager2.c</file>
<file>links.c</file>
<file>listbox.c</file>
<file>listbox2.c</file>
<file>listbox_controls.c</file>
<file>listview_applauncher.c</file>
<file>listview_colors.c</file>
<file>listview_clocks.c</file>
@ -309,7 +309,7 @@
<file>markup.c</file>
<file>menu.c</file>
<file>overlay.c</file>
<file>overlay2.c</file>
<file>overlay_decorative.c</file>
<file>paint.c</file>
<file>pagesetup.c</file>
<file>paintable.c</file>
@ -359,8 +359,8 @@
<file>messages.txt</file>
<file>apple-red.png</file>
</gresource>
<gresource prefix="/listbox2">
<file>listbox2.ui</file>
<gresource prefix="/listbox_controls">
<file>listbox_controls.ui</file>
</gresource>
<gresource prefix="/glarea">
<file>glarea-gl.fs.glsl</file>

View File

@ -34,7 +34,7 @@ row_activated (GtkListBox *list,
}
GtkWidget *
do_listbox2 (GtkWidget *do_widget)
do_listbox_controls (GtkWidget *do_widget)
{
if (!window)
{
@ -47,7 +47,7 @@ do_listbox2 (GtkWidget *do_widget)
builder = gtk_builder_new ();
gtk_builder_set_scope (builder, scope);
gtk_builder_add_from_resource (builder, "/listbox2/listbox2.ui", NULL);
gtk_builder_add_from_resource (builder, "/listbox_controls/listbox_controls.ui", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),

View File

@ -7,9 +7,9 @@ demos = files([
'clipboard.c',
'combobox.c',
'constraints.c',
'constraints2.c',
'constraints3.c',
'constraints4.c',
'constraints_interactive.c',
'constraints_vfl.c',
'constraints_builder.c',
'css_accordion.c',
'css_basics.c',
'css_blendmodes.c',
@ -44,7 +44,7 @@ demos = files([
'layoutmanager2.c',
'links.c',
'listbox.c',
'listbox2.c',
'listbox_controls.c',
'menu.c',
'flowbox.c',
'list_store.c',
@ -60,7 +60,7 @@ demos = files([
'listview_words.c',
'markup.c',
'overlay.c',
'overlay2.c',
'overlay_decorative.c',
'paint.c',
'paintable.c',
'paintable_animated.c',

View File

@ -21,7 +21,7 @@ margin_changed (GtkAdjustment *adjustment,
}
GtkWidget *
do_overlay2 (GtkWidget *do_widget)
do_overlay_decorative (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;

View File

@ -1,5 +1,5 @@
/* Sliding Puzzle
* #Keywords: GdkPaintable, GdkGesture, game
* #Keywords: GdkPaintable, GdkGesture, GtkShortcutController, game
*
* This demo demonstrates how to use gestures and paintables to create a
* small sliding puzzle game.
@ -281,7 +281,8 @@ start_puzzle (GdkPaintable *paintable)
gtk_aspect_frame_set_obey_child (GTK_ASPECT_FRAME (frame), FALSE);
/* Add shortcuts so people can use the arrow
* keys to move the puzzle */
* keys to move the puzzle
*/
controller = gtk_shortcut_controller_new ();
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller),
GTK_SHORTCUT_SCOPE_LOCAL);

View File

@ -196,13 +196,13 @@ typedef enum
/**
* GtkSensitivityType:
* @GTK_SENSITIVITY_AUTO: The arrow is made insensitive if the
* thumb is at the end
* @GTK_SENSITIVITY_ON: The arrow is always sensitive
* @GTK_SENSITIVITY_OFF: The arrow is always insensitive
* @GTK_SENSITIVITY_AUTO: The control is made insensitive if no
* action can be triggered
* @GTK_SENSITIVITY_ON: The control is always sensitive
* @GTK_SENSITIVITY_OFF: The control is always insensitive
*
* Determines how GTK handles the sensitivity of stepper arrows
* at the end of range widgets.
* Determines how GTK handles the sensitivity of various controls,
* such as combo box buttons.
*/
typedef enum
{

View File

@ -52,8 +52,8 @@
* #GtkAdjustment:page-size represents the size of the visible scrollable area.
* The fields #GtkAdjustment:step-increment and #GtkAdjustment:page-increment
* fields are added to or subtracted from the #GtkAdjustment:value when the user
* asks to move by a step (using e.g. the cursor arrow keys or, if present, the
* stepper buttons) or by a page (using e.g. the Page Down/Up keys).
* asks to move by a step (using e.g. the cursor arrow keys) or by a page (using
* e.g. the Page Down/Up keys).
*
* # CSS nodes
*
@ -71,10 +71,6 @@
* The range node gets the style class .fine-tune added when the scrollbar is
* in 'fine-tuning' mode.
*
* If steppers are enabled, they are represented by up to four additional
* subnodes with name button. These get the style classes .up and .down to
* indicate in which direction they are moving.
*
* Other style classes that may be added to scrollbars inside #GtkScrolledWindow
* include the positional classes (.left, .right, .top, .bottom) and style
* classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering).