Compare commits
64 Commits
revert-ab1
...
matthiasc/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
670e0cbb14 | ||
|
|
539d3d21f1 | ||
|
|
2195314b3c | ||
|
|
cff7106751 | ||
|
|
113e4b9a80 | ||
|
|
084e1c1b51 | ||
|
|
944ce59e1b | ||
|
|
6cedd65829 | ||
|
|
a21df8f009 | ||
|
|
fc2e3c8006 | ||
|
|
efebc3e9a9 | ||
|
|
089f75169f | ||
|
|
909383a15e | ||
|
|
68e85d08b9 | ||
|
|
71b0dd4024 | ||
|
|
9f2342f04e | ||
|
|
0fda8f5211 | ||
|
|
4b212f9e04 | ||
|
|
464ec29e27 | ||
|
|
2648f34b1b | ||
|
|
8fdd4285f9 | ||
|
|
7478ff1a4b | ||
|
|
7969287148 | ||
|
|
9d3c28e4db | ||
|
|
021e8e4e3a | ||
|
|
5382717616 | ||
|
|
b027d773ca | ||
|
|
77935f73cc | ||
|
|
450e51fd4b | ||
|
|
b13d3666f9 | ||
|
|
5152bea86f | ||
|
|
1f01546232 | ||
|
|
8173fb7a08 | ||
|
|
2f33ef6f02 | ||
|
|
2c812d5437 | ||
|
|
c5d9694573 | ||
|
|
3b92caba7d | ||
|
|
d7e4e8bfeb | ||
|
|
ab48a745dd | ||
|
|
e823218ee7 | ||
|
|
9ab449e0af | ||
|
|
049a06b6a6 | ||
|
|
b39f2b6465 | ||
|
|
c78019852e | ||
|
|
948845b28b | ||
|
|
416d7de267 | ||
|
|
af99e4ca4b | ||
|
|
5a733854b6 | ||
|
|
19eb3019fe | ||
|
|
ad5277145e | ||
|
|
32ab032cfa | ||
|
|
7661759acd | ||
|
|
468317fef2 | ||
|
|
343c9ca4fc | ||
|
|
edd05cd69b | ||
|
|
47e537678d | ||
|
|
fb552ba10a | ||
|
|
33d9f46574 | ||
|
|
ae7429a7d0 | ||
|
|
d6554e37b6 | ||
|
|
67c91bad5f | ||
|
|
65e6e9854e | ||
|
|
a9a5453a4b | ||
|
|
5b4ae36c64 |
@@ -1,7 +1,3 @@
|
||||
include:
|
||||
- project: 'gnome/citemplates'
|
||||
file: 'flatpak/flatpak_ci_initiative.yml'
|
||||
|
||||
stages:
|
||||
- build
|
||||
- analysis
|
||||
@@ -153,7 +149,6 @@ msys2-mingw64:
|
||||
artifacts:
|
||||
paths:
|
||||
- "${APPID}-dev.flatpak"
|
||||
- 'repo.tar'
|
||||
expire_in: 1 day
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
|
||||
@@ -205,24 +200,6 @@ flatpak-master:icon-browser:
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
# Publish the demo apps to the GNOME Nightly repo
|
||||
# https://wiki.gnome.org/Apps/Nightly
|
||||
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
|
||||
nightly demo:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-master:demo']
|
||||
needs: ['flatpak-master:demo']
|
||||
|
||||
nightly factory:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-master:widget-factory']
|
||||
needs: ['flatpak-master:widget-factory']
|
||||
|
||||
nightly icon-browser:
|
||||
extends: '.publish_nightly'
|
||||
dependencies: ['flatpak-master:icon-browser']
|
||||
needs: ['flatpak-master:icon-browser']
|
||||
|
||||
static-scan:
|
||||
image: $FEDORA_IMAGE
|
||||
stage: analysis
|
||||
|
||||
@@ -40,8 +40,3 @@ flatpak build-bundle \
|
||||
${appid}-dev.flatpak \
|
||||
--runtime-repo=https://nightly.gnome.org/gnome-nightly.flatpakrepo \
|
||||
${appid}
|
||||
|
||||
# to be consumed by the nightly publish jobs
|
||||
if [[ $CI_COMMIT_BRANCH == master ]]; then
|
||||
tar cf repo.tar ${repodir}
|
||||
fi
|
||||
|
||||
119
NEWS
@@ -1,94 +1,5 @@
|
||||
Overview of Changes in 3.99.4
|
||||
=============================
|
||||
|
||||
* GtkColumnView:
|
||||
- Improve column resizing
|
||||
- Make double-click reset column widths
|
||||
- Move header outside of scrollbars
|
||||
|
||||
* GtkSearchEntry:
|
||||
- Add an icon
|
||||
|
||||
* GtkDropDown:
|
||||
- Polish the appearance
|
||||
|
||||
* GtkColorChooser:
|
||||
- Accessibility improvements
|
||||
|
||||
* GtkPopoverMenu:
|
||||
- Add accessibility support
|
||||
- Allow custom items. This adds new API:
|
||||
gtk_popover_menu_add/remove_child
|
||||
gtk_popover_menu_bar_add/remove_child
|
||||
|
||||
* GtkTextView:
|
||||
- Fix rendering and positioning of anchored children
|
||||
- Fix positioning of touch handles
|
||||
|
||||
* Constraints:
|
||||
- Fix loading constraints from ui files
|
||||
|
||||
* Media support:
|
||||
- Use cubic instead of linear volume
|
||||
|
||||
* Accessibility:
|
||||
- Implement Component for all widgets
|
||||
- Implement Text and EditableText for all editables
|
||||
- Rework accessible name/description computation
|
||||
- Add documentation for app and widget developers
|
||||
- Handle HIDDEN state changes by adding/removing elements
|
||||
- Support setting accessibility attributes in ui files
|
||||
- Make window controls accessible
|
||||
|
||||
* Introspection:
|
||||
- Add some missing annotations
|
||||
|
||||
* gdk:
|
||||
- Deliver events on flush
|
||||
- Drop the unused GdkPoint struct from the API
|
||||
- Improve popup autohide behavior
|
||||
|
||||
* Demos:
|
||||
- Add another constraints demo
|
||||
- Tweak various demos to improve consistency
|
||||
- Small accessibility improvements
|
||||
|
||||
* Tools:
|
||||
- Improve gtk4-builder-tool handling of various
|
||||
widgets when converting ui files from GTK 3
|
||||
|
||||
* Documentation:
|
||||
- Use GtkApplication in all examples
|
||||
- Improve and expand the widget gallery
|
||||
|
||||
* Testsuite:
|
||||
- Improve coverage of GDK
|
||||
- Improve coverage of gtk4-builder-tool
|
||||
|
||||
* Build:
|
||||
- Fix the build with cups 2.2.12
|
||||
- Make cloudprint support build without warnings
|
||||
|
||||
* Broadway:
|
||||
- Support modifiers for scroll events
|
||||
|
||||
* Windows:
|
||||
- Improve IME support
|
||||
|
||||
* OS X:
|
||||
- Fix various input issues
|
||||
- Make GtkGLArea work (with the cairo backend)
|
||||
|
||||
* Translation updates:
|
||||
German
|
||||
Polish
|
||||
|
||||
|
||||
Overview of Changes in 3.99.3
|
||||
=============================
|
||||
|
||||
* Accessibility:
|
||||
- Add an initial AT-SPI backend
|
||||
Overview of Changes
|
||||
===================
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Allow inserting multiple Emoji by pressing Control
|
||||
@@ -103,44 +14,18 @@ Overview of Changes in 3.99.3
|
||||
* GtkScale:
|
||||
- Change the default value of the :draw-value property
|
||||
|
||||
* GtkPopover:
|
||||
- Avoid losing focus when popovers are close
|
||||
|
||||
* GtkColorChooser:
|
||||
- Add color names back for accessibility
|
||||
|
||||
* Input methods:
|
||||
- Add a 'private' input hint
|
||||
|
||||
* GL Renderer:
|
||||
- Fix issues with texture caching
|
||||
- Fix texture flipping problems
|
||||
|
||||
* Build:
|
||||
- Use meson yield feature for some options
|
||||
- Require gtk-doc 1.33
|
||||
- Require sysprof 3.38
|
||||
|
||||
* Wayland:
|
||||
- Clean up Wayland backend api, add annotations
|
||||
- Generate introspection for Wayland backend api
|
||||
|
||||
* Windows:
|
||||
- Fix modal window handling and window stacking
|
||||
|
||||
* MacOS:
|
||||
- Fix the build
|
||||
- Define GDK_WINDOWING_MACOS
|
||||
- Fix various event handling issues
|
||||
|
||||
* Demos:
|
||||
- Add another column view demo
|
||||
- Add an svg paintable demo
|
||||
|
||||
* Translation updates
|
||||
Czech
|
||||
Lithuanian
|
||||
Polish
|
||||
|
||||
|
||||
Overview of Changes in GTK 3.99.2
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* always defined to indicate that i18n is enabled */
|
||||
#define ENABLE_NLS 1
|
||||
|
||||
/* Use structured logging */
|
||||
#define G_LOG_STRUCTURED 1
|
||||
|
||||
/* The prefix for our gettext translation domains. */
|
||||
#mesondefine GETTEXT_PACKAGE
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ struct _ConstraintEditorWindow
|
||||
G_DEFINE_TYPE(ConstraintEditorWindow, constraint_editor_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
|
||||
static GtkConstraintTarget *
|
||||
find_target (GListModel *model,
|
||||
find_target (GListModel *model,
|
||||
GtkConstraintTarget *orig)
|
||||
{
|
||||
const char *name;
|
||||
@@ -163,30 +163,20 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
|
||||
GtkConstraint *clone;
|
||||
GtkConstraintTarget *target;
|
||||
GtkConstraintTarget *source;
|
||||
GtkConstraintAttribute source_attr;
|
||||
|
||||
item = g_list_model_get_item (list, i);
|
||||
constraint = GTK_CONSTRAINT (item);
|
||||
|
||||
target = gtk_constraint_get_target (constraint);
|
||||
source = gtk_constraint_get_source (constraint);
|
||||
source_attr = gtk_constraint_get_source_attribute (constraint);
|
||||
|
||||
if (source == NULL && source_attr == GTK_CONSTRAINT_ATTRIBUTE_NONE)
|
||||
clone = gtk_constraint_new_constant (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
|
||||
clone = gtk_constraint_new (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
|
||||
gtk_constraint_get_target_attribute (constraint),
|
||||
gtk_constraint_get_relation (constraint),
|
||||
find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), source),
|
||||
gtk_constraint_get_target_attribute (constraint),
|
||||
gtk_constraint_get_multiplier (constraint),
|
||||
gtk_constraint_get_constant (constraint),
|
||||
gtk_constraint_get_strength (constraint));
|
||||
else
|
||||
clone = gtk_constraint_new (find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), target),
|
||||
gtk_constraint_get_target_attribute (constraint),
|
||||
gtk_constraint_get_relation (constraint),
|
||||
find_target (constraint_view_get_model (CONSTRAINT_VIEW (self->view)), source),
|
||||
source_attr,
|
||||
gtk_constraint_get_multiplier (constraint),
|
||||
gtk_constraint_get_constant (constraint),
|
||||
gtk_constraint_get_strength (constraint));
|
||||
|
||||
constraint_view_add_constraint (CONSTRAINT_VIEW (self->view), clone);
|
||||
|
||||
@@ -310,7 +300,7 @@ save_response_cb (GtkNativeDialog *dialog,
|
||||
model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
|
||||
text = serialize_model (model);
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
g_file_replace_contents (file, text, strlen (text),
|
||||
g_file_replace_contents (file, text, -1,
|
||||
NULL, FALSE,
|
||||
G_FILE_CREATE_NONE,
|
||||
NULL,
|
||||
|
||||
@@ -142,9 +142,6 @@ get_target (GListModel *model,
|
||||
{
|
||||
int i;
|
||||
|
||||
if (id == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strcmp ("super", id) == 0)
|
||||
return NULL;
|
||||
|
||||
@@ -215,22 +212,6 @@ get_relation_nick (GtkConstraintRelation relation)
|
||||
return nick;
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_relation_display_name (GtkConstraintRelation relation)
|
||||
{
|
||||
switch (relation)
|
||||
{
|
||||
case GTK_CONSTRAINT_RELATION_LE:
|
||||
return "≤";
|
||||
case GTK_CONSTRAINT_RELATION_EQ:
|
||||
return "=";
|
||||
case GTK_CONSTRAINT_RELATION_GE:
|
||||
return "≥";
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
static GtkConstraintStrength
|
||||
get_strength (const char *id)
|
||||
{
|
||||
@@ -350,7 +331,6 @@ source_attr_changed (ConstraintEditor *editor)
|
||||
{
|
||||
gtk_widget_set_sensitive (editor->source, TRUE);
|
||||
gtk_widget_set_sensitive (editor->multiplier, TRUE);
|
||||
gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +347,7 @@ constraint_editor_constraint_to_string (GtkConstraint *constraint)
|
||||
|
||||
name = get_target_name (gtk_constraint_get_target (constraint));
|
||||
attr = get_attr_nick (gtk_constraint_get_target_attribute (constraint));
|
||||
relation = get_relation_display_name (gtk_constraint_get_relation (constraint));
|
||||
relation = get_relation_nick (gtk_constraint_get_relation (constraint));
|
||||
|
||||
if (name == NULL)
|
||||
name = "[ ]";
|
||||
@@ -461,12 +441,8 @@ update_preview (ConstraintEditor *editor)
|
||||
static void
|
||||
update_button (ConstraintEditor *editor)
|
||||
{
|
||||
const char *target = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target));
|
||||
const char *source = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source));
|
||||
const char *source_attr = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
|
||||
|
||||
if (target &&
|
||||
(source || (source_attr && get_target_attr (source_attr) == GTK_CONSTRAINT_ATTRIBUTE_NONE)))
|
||||
if (gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target)) != NULL &&
|
||||
gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source)) != NULL)
|
||||
gtk_widget_set_sensitive (editor->button, TRUE);
|
||||
else
|
||||
gtk_widget_set_sensitive (editor->button, FALSE);
|
||||
|
||||
@@ -78,7 +78,6 @@
|
||||
<object class="GtkComboBoxText" id="source_attr">
|
||||
<signal name="changed" handler="update_preview" swapped="yes"/>
|
||||
<signal name="changed" handler="source_attr_changed" swapped="yes"/>
|
||||
<signal name="changed" handler="update_button" swapped="yes"/>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">3</property>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="resizable">0</property>
|
||||
<property name="title">CSS Blend Modes</property>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Builder
|
||||
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, GtkShortcutController, toolbar
|
||||
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, toolbar
|
||||
*
|
||||
* Demonstrates a traditional interface, loaded from a XML description,
|
||||
* and shows how to connect actions to the menu items and toolbar buttons.
|
||||
@@ -158,6 +158,7 @@ do_builder (GtkWidget *do_widget)
|
||||
about = GTK_WIDGET (gtk_builder_get_object (builder, "aboutdialog1"));
|
||||
gtk_window_set_transient_for (GTK_WINDOW (about), GTK_WINDOW (window));
|
||||
gtk_window_set_hide_on_close (GTK_WINDOW (about), TRUE);
|
||||
g_signal_connect (about, "response", G_CALLBACK (gtk_widget_hide), NULL);
|
||||
g_object_set_data_full (G_OBJECT (window), "about",
|
||||
about, (GDestroyNotify)gtk_window_destroy);
|
||||
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
/* Constraints/Simple Constraints
|
||||
/* Constraints/Simple
|
||||
* #Keywords: GtkLayoutManager
|
||||
*
|
||||
* GtkConstraintLayout provides a layout manager that uses relations
|
||||
* between widgets (also known as “constraints”) to compute the position
|
||||
* between widgets (also known as "constraints") to compute the position
|
||||
* and size of each child.
|
||||
*
|
||||
* In addition to child widgets, the constraints can involve spacer
|
||||
* objects (also known as “guides”). This example has a guide between
|
||||
* the two buttons in the top row.
|
||||
*
|
||||
* Try resizing the window to see how the constraints react to update
|
||||
* the layout.
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
@@ -241,12 +234,15 @@ simple_grid_init (SimpleGrid *self)
|
||||
|
||||
self->button1 = gtk_button_new_with_label ("Child 1");
|
||||
gtk_widget_set_parent (self->button1, widget);
|
||||
gtk_widget_set_name (self->button1, "button1");
|
||||
|
||||
self->button2 = gtk_button_new_with_label ("Child 2");
|
||||
gtk_widget_set_parent (self->button2, widget);
|
||||
gtk_widget_set_name (self->button2, "button2");
|
||||
|
||||
self->button3 = gtk_button_new_with_label ("Child 3");
|
||||
gtk_widget_set_parent (self->button3, widget);
|
||||
gtk_widget_set_name (self->button3, "button3");
|
||||
|
||||
GtkLayoutManager *manager = gtk_widget_get_layout_manager (GTK_WIDGET (self));
|
||||
build_constraints (self, GTK_CONSTRAINT_LAYOUT (manager));
|
||||
@@ -263,8 +259,7 @@ do_constraints (GtkWidget *do_widget)
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Simple Constraints");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 260, -1);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Constraints");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Constraints/Interactive Constraints
|
||||
/* Constraints/Interactive
|
||||
* #Keywords: GtkConstraintLayout
|
||||
*
|
||||
* This example shows how constraints can be updated during user interaction.
|
||||
* Demonstrate how constraints can be updates during user interaction.
|
||||
* The vertical edge between the buttons can be dragged with the mouse.
|
||||
*/
|
||||
|
||||
@@ -205,7 +205,7 @@ interactive_grid_init (InteractiveGrid *self)
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_constraints_interactive (GtkWidget *do_widget)
|
||||
do_constraints2 (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window;
|
||||
|
||||
@@ -215,8 +215,7 @@ do_constraints_interactive (GtkWidget *do_widget)
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Interactive Constraints");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 260, -1);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Constraints");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
@@ -2,10 +2,6 @@
|
||||
*
|
||||
* GtkConstraintLayout allows defining constraints using a
|
||||
* compact syntax called Visual Format Language, or VFL.
|
||||
*
|
||||
* A typical example of a VFL specification looks like this:
|
||||
*
|
||||
* H:|-[button1(==button2)]-12-[button2]-|
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
@@ -128,7 +124,7 @@ vfl_grid_init (VflGrid *self)
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_constraints_vfl (GtkWidget *do_widget)
|
||||
do_constraints3 (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window;
|
||||
|
||||
@@ -138,8 +134,7 @@ do_constraints_vfl (GtkWidget *do_widget)
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Constraints — VFL");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 260, -1);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Constraints");
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
@@ -1,74 +0,0 @@
|
||||
/* 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 shows
|
||||
* various ways to do spacing and sizing with constraints.
|
||||
*
|
||||
* Make the window wider to see the rows react differently
|
||||
*/
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_DECLARE_FINAL_TYPE (ConstraintsGrid, constraints_grid, CONSTRAINTS, GRID, GtkWidget)
|
||||
|
||||
struct _ConstraintsGrid
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ConstraintsGrid, constraints_grid, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
constraints_grid_init (ConstraintsGrid *grid)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
constraints_grid_dispose (GObject *object)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (object);
|
||||
GtkWidget *child;
|
||||
|
||||
while ((child = gtk_widget_get_first_child (widget)))
|
||||
gtk_widget_unparent (child);
|
||||
|
||||
G_OBJECT_CLASS (constraints_grid_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
constraints_grid_class_init (ConstraintsGridClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = constraints_grid_dispose;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_constraints_builder (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
|
||||
g_type_ensure (constraints_grid_get_type ());
|
||||
|
||||
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),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -1,460 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="title" translatable="yes">Constraints — Builder</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>
|
||||
@@ -18,9 +18,6 @@
|
||||
<file>demoimage.c</file>
|
||||
<file>demoimage.h</file>
|
||||
</gresource>
|
||||
<gresource prefix="/constraints_builder">
|
||||
<file>constraints_builder.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/css_accordion">
|
||||
<file>css_accordion.css</file>
|
||||
<file>reset.css</file>
|
||||
@@ -43,11 +40,6 @@
|
||||
<file>cssview.css</file>
|
||||
<file>reset.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/dropdown">
|
||||
<file>suggestionentry.h</file>
|
||||
<file>suggestionentry.c</file>
|
||||
<file>suggestionentry.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/theming_style_classes">
|
||||
<file>theming.ui</file>
|
||||
</gresource>
|
||||
@@ -213,8 +205,6 @@
|
||||
<file>demo3widget.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/paintable_svg">
|
||||
<file>svgpaintable.h</file>
|
||||
<file>svgpaintable.c</file>
|
||||
<file>org.gtk.gtk4.NodeEditor.Devel.svg</file>
|
||||
</gresource>
|
||||
<gresource prefix="/shortcuts">
|
||||
@@ -236,12 +226,9 @@
|
||||
<file>revealer.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/images">
|
||||
<file>pixbufpaintable.h</file>
|
||||
<file>pixbufpaintable.c</file>
|
||||
<file>alphatest.png</file>
|
||||
<file>floppybuddy.gif</file>
|
||||
<file>gtk-logo.webm</file>
|
||||
<file alias="org.gtk.Demo4.svg">data/scalable/apps/org.gtk.Demo4.svg</file>
|
||||
</gresource>
|
||||
<gresource prefix="/video-player">
|
||||
<file>bbb.png</file>
|
||||
@@ -253,9 +240,8 @@
|
||||
<file>clipboard.c</file>
|
||||
<file>combobox.c</file>
|
||||
<file>constraints.c</file>
|
||||
<file>constraints_interactive.c</file>
|
||||
<file>constraints_vfl.c</file>
|
||||
<file>constraints_builder.c</file>
|
||||
<file>constraints2.c</file>
|
||||
<file>constraints3.c</file>
|
||||
<file>css_accordion.c</file>
|
||||
<file>css_basics.c</file>
|
||||
<file>css_blendmodes.c</file>
|
||||
@@ -294,7 +280,7 @@
|
||||
<file>layoutmanager2.c</file>
|
||||
<file>links.c</file>
|
||||
<file>listbox.c</file>
|
||||
<file>listbox_controls.c</file>
|
||||
<file>listbox2.c</file>
|
||||
<file>listview_applauncher.c</file>
|
||||
<file>listview_colors.c</file>
|
||||
<file>listview_clocks.c</file>
|
||||
@@ -309,7 +295,7 @@
|
||||
<file>markup.c</file>
|
||||
<file>menu.c</file>
|
||||
<file>overlay.c</file>
|
||||
<file>overlay_decorative.c</file>
|
||||
<file>overlay2.c</file>
|
||||
<file>paint.c</file>
|
||||
<file>pagesetup.c</file>
|
||||
<file>paintable.c</file>
|
||||
@@ -359,8 +345,8 @@
|
||||
<file>messages.txt</file>
|
||||
<file>apple-red.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/listbox_controls">
|
||||
<file>listbox_controls.ui</file>
|
||||
<gresource prefix="/listbox2">
|
||||
<file>listbox2.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/glarea">
|
||||
<file>glarea-gl.fs.glsl</file>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
</menu>
|
||||
<object class="GtkAboutDialog" id="aboutdialog1">
|
||||
<property name="program-name" translatable="yes">Builder demo</property>
|
||||
<property name="logo-icon-name" translatable="yes">org.gtk.Demo4</property>
|
||||
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
|
||||
<property name="modal">True</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window1">
|
||||
@@ -96,18 +96,13 @@
|
||||
<child>
|
||||
<object class="GtkPopoverMenuBar" id="menubar1">
|
||||
<property name="menu-model">menubar</property>
|
||||
<accessibility>
|
||||
<property name="label">Main Menu</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="toolbar1">
|
||||
<property name="accessible-role">toolbar</property>
|
||||
<property name="css-classes">toolbar</property>
|
||||
<accessibility>
|
||||
<property name="label">Toolbar</property>
|
||||
</accessibility>
|
||||
<style>
|
||||
<class name="toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
|
||||
@@ -47,38 +47,6 @@ get_image_paintable (GtkImage *image)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_drag_icon (DemoImage *demo,
|
||||
GtkDragIcon *icon)
|
||||
{
|
||||
const char *icon_name;
|
||||
GdkPaintable *paintable;
|
||||
GtkWidget *image;
|
||||
|
||||
switch (gtk_image_get_storage_type (GTK_IMAGE (demo->image)))
|
||||
{
|
||||
case GTK_IMAGE_PAINTABLE:
|
||||
paintable = gtk_image_get_paintable (GTK_IMAGE (demo->image));
|
||||
image = gtk_image_new_from_paintable (paintable);
|
||||
break;
|
||||
case GTK_IMAGE_ICON_NAME:
|
||||
icon_name = gtk_image_get_icon_name (GTK_IMAGE (demo->image));
|
||||
image = gtk_image_new_from_icon_name (icon_name);
|
||||
break;
|
||||
case GTK_IMAGE_EMPTY:
|
||||
case GTK_IMAGE_GICON:
|
||||
default:
|
||||
g_warning ("Image storage type %d not handled",
|
||||
gtk_image_get_storage_type (GTK_IMAGE (demo->image)));
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (image),
|
||||
gtk_image_get_pixel_size (GTK_IMAGE (demo->image)));
|
||||
|
||||
gtk_drag_icon_set_child (icon, image);
|
||||
}
|
||||
|
||||
static void
|
||||
drag_begin (GtkDragSource *source,
|
||||
GdkDrag *drag,
|
||||
@@ -86,8 +54,14 @@ drag_begin (GtkDragSource *source,
|
||||
{
|
||||
GtkWidget *widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
|
||||
DemoImage *demo = DEMO_IMAGE (widget);
|
||||
GdkPaintable *paintable;
|
||||
|
||||
update_drag_icon (demo, GTK_DRAG_ICON (gtk_drag_icon_get_for_drag (drag)));
|
||||
paintable = get_image_paintable (GTK_IMAGE (demo->image));
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
}
|
||||
|
||||
static GdkContentProvider *
|
||||
|
||||
@@ -44,23 +44,11 @@ G_DEFINE_TYPE_WITH_CODE (DemoTaggedEntry, demo_tagged_entry, GTK_TYPE_WIDGET,
|
||||
static void
|
||||
demo_tagged_entry_init (DemoTaggedEntry *entry)
|
||||
{
|
||||
GtkCssProvider *provider;
|
||||
|
||||
entry->text = gtk_text_new ();
|
||||
gtk_widget_set_hexpand (entry->text, TRUE);
|
||||
gtk_widget_set_vexpand (entry->text, TRUE);
|
||||
gtk_widget_set_parent (entry->text, GTK_WIDGET (entry));
|
||||
gtk_editable_init_delegate (GTK_EDITABLE (entry));
|
||||
gtk_editable_set_width_chars (GTK_EDITABLE (entry->text), 6);
|
||||
gtk_editable_set_max_width_chars (GTK_EDITABLE (entry->text), 6);
|
||||
gtk_widget_add_css_class (GTK_WIDGET (entry), "tagged");
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/tagged_entry/tagstyle.css");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -128,7 +116,6 @@ demo_tagged_entry_class_init (DemoTaggedEntryClass *klass)
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
gtk_widget_class_set_css_name (widget_class, "entry");
|
||||
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_TEXT_BOX);
|
||||
}
|
||||
|
||||
static GtkEditable *
|
||||
@@ -224,6 +211,7 @@ static void
|
||||
demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
tag->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_parent (tag->box, GTK_WIDGET (tag));
|
||||
@@ -233,6 +221,13 @@ demo_tagged_entry_tag_init (DemoTaggedEntryTag *tag)
|
||||
gesture = gtk_gesture_click_new ();
|
||||
g_signal_connect (gesture, "released", G_CALLBACK (on_released), tag);
|
||||
gtk_widget_add_controller (GTK_WIDGET (tag), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/tagged_entry/tagstyle.css");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -113,9 +113,12 @@ apply_transform (CanvasItem *item)
|
||||
y = gtk_widget_get_allocated_height (item->label) / 2.0;
|
||||
item->r = sqrt (x*x + y*y);
|
||||
|
||||
transform = gsk_transform_translate (NULL, &(graphene_point_t) { item->r, item->r });
|
||||
transform = gsk_transform_rotate (transform, item->angle + item->delta);
|
||||
transform = gsk_transform_translate (transform, &(graphene_point_t) { -x, -y });
|
||||
transform = gsk_transform_translate (
|
||||
gsk_transform_rotate (
|
||||
gsk_transform_translate (NULL,
|
||||
&(graphene_point_t) { item->r, item->r }),
|
||||
item->angle + item->delta),
|
||||
&(graphene_point_t) { - x, - y });
|
||||
|
||||
gtk_fixed_set_child_transform (GTK_FIXED (item->fixed), item->label, transform);
|
||||
gsk_transform_unref (transform);
|
||||
|
||||
@@ -311,7 +311,6 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 250, -1);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (close_window), NULL);
|
||||
@@ -326,8 +325,9 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
/*
|
||||
* Create the groups area
|
||||
*/
|
||||
label = gtk_label_new ("Knockout groups");
|
||||
gtk_widget_add_css_class (label, "heading");
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Knockout groups</u>");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
@@ -344,8 +344,9 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
* Create the scribble area
|
||||
*/
|
||||
|
||||
label = gtk_label_new ("Scribble area");
|
||||
gtk_widget_add_css_class (label, "heading");
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Scribble area</u>");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
/* Lists/Selections
|
||||
/* Drop Downs
|
||||
*
|
||||
* The GtkDropDown widget is a modern alternative to GtkComboBox.
|
||||
* It uses list models instead of tree models, and the content is
|
||||
* displayed using widgets instead of cell renderers.
|
||||
*
|
||||
* This example also shows a custom widget that can replace
|
||||
* GtkEntryCompletion or GtkComboBoxText. It is not currently
|
||||
* part of GTK.
|
||||
* The examples here demonstrate how to use different kinds of
|
||||
* list models with GtkDropDown, how to use search and how to
|
||||
* display the selected item differently from the presentation
|
||||
* in the popup.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "suggestionentry.h"
|
||||
|
||||
|
||||
#define STRING_TYPE_HOLDER (string_holder_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (StringHolder, string_holder, STRING, HOLDER, GObject)
|
||||
@@ -64,22 +65,18 @@ strings_setup_item_single_line (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkWidget *box, *image, *title;
|
||||
GtkWidget *checkmark;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
|
||||
image = gtk_image_new ();
|
||||
title = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (title), 0.0);
|
||||
checkmark = gtk_image_new_from_icon_name ("object-select-symbolic");
|
||||
|
||||
gtk_box_append (GTK_BOX (box), image);
|
||||
gtk_box_append (GTK_BOX (box), title);
|
||||
gtk_box_append (GTK_BOX (box), checkmark);
|
||||
|
||||
g_object_set_data (G_OBJECT (item), "title", title);
|
||||
g_object_set_data (G_OBJECT (item), "image", image);
|
||||
g_object_set_data (G_OBJECT (item), "checkmark", checkmark);
|
||||
|
||||
gtk_list_item_set_child (item, box);
|
||||
}
|
||||
@@ -89,7 +86,6 @@ strings_setup_item_full (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkWidget *box, *box2, *image, *title, *description;
|
||||
GtkWidget *checkmark;
|
||||
|
||||
image = gtk_image_new ();
|
||||
title = gtk_label_new ("");
|
||||
@@ -97,7 +93,6 @@ strings_setup_item_full (GtkSignalListItemFactory *factory,
|
||||
description = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (description), 0.0);
|
||||
gtk_widget_add_css_class (description, "dim-label");
|
||||
checkmark = gtk_image_new_from_icon_name ("object-select-symbolic");
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
|
||||
@@ -106,48 +101,26 @@ strings_setup_item_full (GtkSignalListItemFactory *factory,
|
||||
gtk_box_append (GTK_BOX (box), box2);
|
||||
gtk_box_append (GTK_BOX (box2), title);
|
||||
gtk_box_append (GTK_BOX (box2), description);
|
||||
gtk_box_append (GTK_BOX (box), checkmark);
|
||||
|
||||
g_object_set_data (G_OBJECT (item), "title", title);
|
||||
g_object_set_data (G_OBJECT (item), "image", image);
|
||||
g_object_set_data (G_OBJECT (item), "description", description);
|
||||
g_object_set_data (G_OBJECT (item), "checkmark", checkmark);
|
||||
|
||||
gtk_list_item_set_child (item, box);
|
||||
}
|
||||
|
||||
static void
|
||||
selected_item_changed (GtkDropDown *dropdown,
|
||||
GParamSpec *pspec,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkWidget *checkmark;
|
||||
|
||||
checkmark = g_object_get_data (G_OBJECT (item), "checkmark");
|
||||
|
||||
if (gtk_drop_down_get_selected_item (dropdown) == gtk_list_item_get_item (item))
|
||||
gtk_widget_set_opacity (checkmark, 1.0);
|
||||
else
|
||||
gtk_widget_set_opacity (checkmark, 0.0);
|
||||
}
|
||||
|
||||
static void
|
||||
strings_bind_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item,
|
||||
gpointer data)
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkDropDown *dropdown = data;
|
||||
GtkWidget *image, *title, *description;
|
||||
GtkWidget *checkmark;
|
||||
StringHolder *holder;
|
||||
GtkWidget *popup;
|
||||
|
||||
holder = gtk_list_item_get_item (item);
|
||||
|
||||
title = g_object_get_data (G_OBJECT (item), "title");
|
||||
image = g_object_get_data (G_OBJECT (item), "image");
|
||||
description = g_object_get_data (G_OBJECT (item), "description");
|
||||
checkmark = g_object_get_data (G_OBJECT (item), "checkmark");
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (title), holder->title);
|
||||
if (image)
|
||||
@@ -160,43 +133,19 @@ strings_bind_item (GtkSignalListItemFactory *factory,
|
||||
gtk_label_set_label (GTK_LABEL (description), holder->description);
|
||||
gtk_widget_set_visible (description , holder->description != NULL);
|
||||
}
|
||||
|
||||
popup = gtk_widget_get_ancestor (title, GTK_TYPE_POPOVER);
|
||||
if (popup && gtk_widget_is_ancestor (popup, GTK_WIDGET (dropdown)))
|
||||
{
|
||||
gtk_widget_show (checkmark);
|
||||
g_signal_connect (dropdown, "notify::selected-item",
|
||||
G_CALLBACK (selected_item_changed), item);
|
||||
selected_item_changed (dropdown, NULL, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_hide (checkmark);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
strings_unbind_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *list_item,
|
||||
gpointer data)
|
||||
{
|
||||
GtkDropDown *dropdown = data;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (dropdown, selected_item_changed, list_item);
|
||||
}
|
||||
|
||||
static GtkListItemFactory *
|
||||
strings_factory_new (gpointer data, gboolean full)
|
||||
strings_factory_new (gboolean full)
|
||||
{
|
||||
GtkListItemFactory *factory;
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
if (full)
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (strings_setup_item_full), data);
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (strings_setup_item_full), NULL);
|
||||
else
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (strings_setup_item_single_line), data);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (strings_bind_item), data);
|
||||
g_signal_connect (factory, "unbind", G_CALLBACK (strings_unbind_item), data);
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (strings_setup_item_single_line), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (strings_bind_item), NULL);
|
||||
|
||||
return factory;
|
||||
}
|
||||
@@ -237,22 +186,19 @@ drop_down_new_from_strings (const char *const *titles,
|
||||
g_return_val_if_fail (descriptions == NULL || g_strv_length ((char **)icons) == g_strv_length ((char **)descriptions), NULL);
|
||||
|
||||
model = strings_model_new (titles, icons, descriptions);
|
||||
widget = g_object_new (GTK_TYPE_DROP_DOWN,
|
||||
"model", model,
|
||||
NULL);
|
||||
g_object_unref (model);
|
||||
|
||||
factory = strings_factory_new (widget, FALSE);
|
||||
factory = strings_factory_new (FALSE);
|
||||
if (icons != NULL || descriptions != NULL)
|
||||
list_factory = strings_factory_new (widget, TRUE);
|
||||
list_factory = strings_factory_new (TRUE);
|
||||
else
|
||||
list_factory = NULL;
|
||||
|
||||
g_object_set (widget,
|
||||
"factory", factory,
|
||||
"list-factory", list_factory,
|
||||
NULL);
|
||||
widget = g_object_new (GTK_TYPE_DROP_DOWN,
|
||||
"model", model,
|
||||
"factory", factory,
|
||||
"list-factory", list_factory,
|
||||
NULL);
|
||||
|
||||
g_object_unref (model);
|
||||
g_object_unref (factory);
|
||||
if (list_factory)
|
||||
g_object_unref (list_factory);
|
||||
@@ -272,110 +218,13 @@ get_title (gpointer item)
|
||||
return g_strdup (STRING_HOLDER (item)->title);
|
||||
}
|
||||
|
||||
static char *
|
||||
get_file_name (gpointer item)
|
||||
{
|
||||
return g_strdup (g_file_info_get_display_name (G_FILE_INFO (item)));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkWidget *box;
|
||||
GtkWidget *icon;
|
||||
GtkWidget *label;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
icon = gtk_image_new ();
|
||||
label = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_box_append (GTK_BOX (box), icon);
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
gtk_list_item_set_child (item, box);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
MatchObject *match = MATCH_OBJECT (gtk_list_item_get_item (item));
|
||||
GFileInfo *info = G_FILE_INFO (match_object_get_item (match));
|
||||
GtkWidget *box = gtk_list_item_get_child (item);
|
||||
GtkWidget *icon = gtk_widget_get_first_child (box);
|
||||
GtkWidget *label = gtk_widget_get_last_child (box);
|
||||
|
||||
gtk_image_set_from_gicon (GTK_IMAGE (icon), g_file_info_get_icon (info));
|
||||
gtk_label_set_label (GTK_LABEL (label), g_file_info_get_display_name (info));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_highlight_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_list_item_set_child (item, label);
|
||||
}
|
||||
|
||||
static void
|
||||
bind_highlight_item (GtkSignalListItemFactory *factory,
|
||||
GtkListItem *item)
|
||||
{
|
||||
MatchObject *obj;
|
||||
GtkWidget *label;
|
||||
PangoAttrList *attrs;
|
||||
PangoAttribute *attr;
|
||||
const char *str;
|
||||
|
||||
obj = MATCH_OBJECT (gtk_list_item_get_item (item));
|
||||
label = gtk_list_item_get_child (item);
|
||||
|
||||
str = match_object_get_string (obj);
|
||||
|
||||
gtk_label_set_label (GTK_LABEL (label), str);
|
||||
attrs = pango_attr_list_new ();
|
||||
attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
|
||||
attr->start_index = match_object_get_match_start (obj);
|
||||
attr->end_index = match_object_get_match_end (obj);
|
||||
pango_attr_list_insert (attrs, attr);
|
||||
gtk_label_set_attributes (GTK_LABEL (label), attrs);
|
||||
pango_attr_list_unref (attrs);
|
||||
}
|
||||
|
||||
static void
|
||||
match_func (MatchObject *obj,
|
||||
const char *search,
|
||||
gpointer user_data)
|
||||
{
|
||||
char *tmp1, *tmp2;
|
||||
char *p;
|
||||
|
||||
tmp1 = g_utf8_normalize (match_object_get_string (obj), -1, G_NORMALIZE_ALL);
|
||||
tmp2 = g_utf8_normalize (search, -1, G_NORMALIZE_ALL);
|
||||
|
||||
if ((p = strstr (tmp1, tmp2)) != NULL)
|
||||
match_object_set_match (obj,
|
||||
p - tmp1,
|
||||
(p - tmp1) + g_utf8_strlen (search, -1),
|
||||
1);
|
||||
else
|
||||
match_object_set_match (obj, 0, 0, 0);
|
||||
|
||||
g_free (tmp1);
|
||||
g_free (tmp2);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_dropdown (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *button, *box, *spin, *check, *hbox, *label, *entry;
|
||||
GtkWidget *button, *box, *spin, *check;
|
||||
GListModel *model;
|
||||
GtkExpression *expression;
|
||||
GtkListItemFactory *factory;
|
||||
const char * const times[] = { "1 minute", "2 minutes", "5 minutes", "20 minutes", NULL };
|
||||
const char * const many_times[] = {
|
||||
"1 minute", "2 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes",
|
||||
@@ -388,49 +237,22 @@ do_dropdown (GtkWidget *do_widget)
|
||||
const char * const device_descriptions[] = {
|
||||
"Built-in Audio", "Built-in audio", "Thinkpad Tunderbolt 3 Dock USB Audio", "Thinkpad Tunderbolt 3 Dock USB Audio", NULL
|
||||
};
|
||||
char *cwd;
|
||||
GFile *file;
|
||||
GListModel *dir;
|
||||
GtkStringList *strings;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Selections");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Drop Downs");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 20);
|
||||
|
||||
gtk_widget_set_margin_start (hbox, 20);
|
||||
gtk_widget_set_margin_end (hbox, 20);
|
||||
gtk_widget_set_margin_top (hbox, 20);
|
||||
gtk_widget_set_margin_bottom (hbox, 20);
|
||||
gtk_window_set_child (GTK_WINDOW (window), hbox);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_box_append (GTK_BOX (hbox), box);
|
||||
|
||||
label = gtk_label_new ("Dropdowns");
|
||||
gtk_widget_add_css_class (label, "title-4");
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
/* A basic dropdown */
|
||||
button = drop_down_new_from_strings (times, NULL, NULL);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
/* A dropdown using an expression to obtain strings */
|
||||
button = drop_down_new_from_strings (many_times, NULL, NULL);
|
||||
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (button), expression);
|
||||
gtk_expression_unref (expression);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
gtk_widget_set_margin_start (box, 10);
|
||||
gtk_widget_set_margin_end (box, 10);
|
||||
gtk_widget_set_margin_top (box, 10);
|
||||
gtk_widget_set_margin_bottom (box, 10);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
button = gtk_drop_down_new (NULL, NULL);
|
||||
|
||||
@@ -448,118 +270,30 @@ do_dropdown (GtkWidget *do_widget)
|
||||
|
||||
spin = gtk_spin_button_new_with_range (-1, g_list_model_get_n_items (G_LIST_MODEL (model)), 1);
|
||||
gtk_widget_set_halign (spin, GTK_ALIGN_START);
|
||||
gtk_widget_set_margin_start (spin, 20);
|
||||
g_object_bind_property (button, "selected", spin, "value", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
gtk_box_append (GTK_BOX (box), spin);
|
||||
|
||||
check = gtk_check_button_new_with_label ("Enable search");
|
||||
gtk_widget_set_margin_start (check, 20);
|
||||
g_object_bind_property (button, "enable-search", check, "active", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
gtk_box_append (GTK_BOX (box), check);
|
||||
|
||||
g_object_unref (model);
|
||||
|
||||
/* A dropdown with a separate list factory */
|
||||
button = drop_down_new_from_strings (device_titles, device_icons, device_descriptions);
|
||||
button = drop_down_new_from_strings (times, NULL, NULL);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
gtk_box_append (GTK_BOX (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL));
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_box_append (GTK_BOX (hbox), box);
|
||||
|
||||
label = gtk_label_new ("Suggestions");
|
||||
gtk_widget_add_css_class (label, "title-4");
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
/* A basic suggestion entry */
|
||||
entry = suggestion_entry_new ();
|
||||
g_object_set (entry, "placeholder-text", "Words with T or G…", NULL);
|
||||
strings = gtk_string_list_new ((const char *[]){
|
||||
"GNOME",
|
||||
"gnominious",
|
||||
"Gnomonic projection",
|
||||
"total",
|
||||
"totally",
|
||||
"toto",
|
||||
"tottery",
|
||||
"totterer",
|
||||
"Totten trust",
|
||||
"totipotent",
|
||||
"totipotency",
|
||||
"totemism",
|
||||
"totem pole",
|
||||
"Totara",
|
||||
"totalizer",
|
||||
"totalizator",
|
||||
"totalitarianism",
|
||||
"total parenteral nutrition",
|
||||
"total hysterectomy",
|
||||
"total eclipse",
|
||||
"Totipresence",
|
||||
"Totipalmi",
|
||||
"Tomboy",
|
||||
"zombie",
|
||||
NULL});
|
||||
suggestion_entry_set_model (SUGGESTION_ENTRY (entry), G_LIST_MODEL (strings));
|
||||
g_object_unref (strings);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), entry);
|
||||
|
||||
/* A suggestion entry using a custom model, and no filtering */
|
||||
entry = suggestion_entry_new ();
|
||||
|
||||
cwd = g_get_current_dir ();
|
||||
file = g_file_new_for_path (cwd);
|
||||
dir = G_LIST_MODEL (gtk_directory_list_new ("standard::display-name,standard::content-type,standard::icon,standard::size", file));
|
||||
suggestion_entry_set_model (SUGGESTION_ENTRY (entry), dir);
|
||||
g_object_unref (dir);
|
||||
g_object_unref (file);
|
||||
g_free (cwd);
|
||||
|
||||
button = drop_down_new_from_strings (many_times, NULL, NULL);
|
||||
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
|
||||
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
|
||||
0, NULL,
|
||||
(GCallback)get_file_name,
|
||||
(GCallback)get_title,
|
||||
NULL, NULL);
|
||||
suggestion_entry_set_expression (SUGGESTION_ENTRY (entry), expression);
|
||||
gtk_drop_down_set_expression (GTK_DROP_DOWN (button), expression);
|
||||
gtk_expression_unref (expression);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_item), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_item), NULL);
|
||||
|
||||
suggestion_entry_set_factory (SUGGESTION_ENTRY (entry), factory);
|
||||
g_object_unref (factory);
|
||||
|
||||
suggestion_entry_set_use_filter (SUGGESTION_ENTRY (entry), FALSE);
|
||||
suggestion_entry_set_show_arrow (SUGGESTION_ENTRY (entry), TRUE);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), entry);
|
||||
|
||||
/* A suggestion entry with match highlighting */
|
||||
entry = suggestion_entry_new ();
|
||||
g_object_set (entry, "placeholder-text", "Destination", NULL);
|
||||
|
||||
strings = gtk_string_list_new ((const char *[]){
|
||||
"app-mockups",
|
||||
"settings-mockups",
|
||||
"os-mockups",
|
||||
"software-mockups",
|
||||
"mocktails",
|
||||
NULL});
|
||||
suggestion_entry_set_model (SUGGESTION_ENTRY (entry), G_LIST_MODEL (strings));
|
||||
g_object_unref (strings);
|
||||
|
||||
gtk_box_append (GTK_BOX (box), entry);
|
||||
|
||||
suggestion_entry_set_match_func (SUGGESTION_ENTRY (entry), match_func, NULL, NULL);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_highlight_item), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_highlight_item), NULL);
|
||||
suggestion_entry_set_factory (SUGGESTION_ENTRY (entry), factory);
|
||||
g_object_unref (factory);
|
||||
|
||||
button = drop_down_new_from_strings (device_titles, device_icons, device_descriptions);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -78,11 +78,11 @@ do_entry_completion (GtkWidget *do_widget)
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_widget_set_margin_start (vbox, 18);
|
||||
gtk_widget_set_margin_end (vbox, 18);
|
||||
gtk_widget_set_margin_top (vbox, 18);
|
||||
gtk_widget_set_margin_bottom (vbox, 18);
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||
gtk_widget_set_margin_start (vbox, 5);
|
||||
gtk_widget_set_margin_end (vbox, 5);
|
||||
gtk_widget_set_margin_top (vbox, 5);
|
||||
gtk_widget_set_margin_bottom (vbox, 5);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
|
||||
@@ -27,16 +27,16 @@ do_entry_undo (GtkWidget *do_widget)
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_widget_set_margin_start (vbox, 18);
|
||||
gtk_widget_set_margin_end (vbox, 18);
|
||||
gtk_widget_set_margin_top (vbox, 18);
|
||||
gtk_widget_set_margin_bottom (vbox, 18);
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||
gtk_widget_set_margin_start (vbox, 5);
|
||||
gtk_widget_set_margin_end (vbox, 5);
|
||||
gtk_widget_set_margin_top (vbox, 5);
|
||||
gtk_widget_set_margin_bottom (vbox, 5);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"Use Control+z or Control+Shift+z to undo or redo changes");
|
||||
"Use Primary+z or Primary+Shift+z to undo or redo changes");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
/* Create our entry */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Error States
|
||||
/* Error states
|
||||
*
|
||||
* GtkLabel and GtkEntry can indicate errors if you set the .error
|
||||
* style class on them.
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<property name="modal">1</property>
|
||||
<property name="resizable">0</property>
|
||||
<property name="use-header-bar">1</property>
|
||||
<property name="title" translatable="yes">Error States</property>
|
||||
<property name="title" translatable="yes">Settings</property>
|
||||
<property name="hide-on-close">1</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.16"/>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
<column type="gint"/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">500</property>
|
||||
|
||||
@@ -1068,6 +1068,7 @@ update_font_variations (void)
|
||||
unsigned int length;
|
||||
int i;
|
||||
|
||||
child = gtk_widget_get_first_child (variations_grid);
|
||||
while ((child = gtk_widget_get_first_child (variations_grid)))
|
||||
gtk_grid_remove (GTK_GRID (variations_grid), child);
|
||||
|
||||
|
||||
@@ -501,7 +501,7 @@ fontify (const char *format,
|
||||
char *theme;
|
||||
gboolean prefer_dark;
|
||||
const char *style_arg;
|
||||
char *text;
|
||||
const char *text;
|
||||
GtkTextIter start, end;
|
||||
GBytes *bytes;
|
||||
GError *error = NULL;
|
||||
@@ -553,7 +553,7 @@ fontify (const char *format,
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
text = gtk_text_buffer_get_text (source_buffer, &start, &end, TRUE);
|
||||
bytes = g_bytes_new_take (text, strlen (text));
|
||||
bytes = g_bytes_new_static (text, strlen (text));
|
||||
|
||||
#ifdef HAVE_GIO_UNIX
|
||||
/* Work around https://gitlab.gnome.org/GNOME/glib/-/issues/2182 */
|
||||
@@ -570,5 +570,4 @@ fontify (const char *format,
|
||||
NULL,
|
||||
fontify_finish,
|
||||
g_object_ref (source_buffer));
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Pango/Font Rendering
|
||||
/* Pango/Font rendering
|
||||
*
|
||||
* Demonstrates various aspects of font rendering.
|
||||
*/
|
||||
|
||||
@@ -406,7 +406,6 @@ create_glarea_window (GtkWidget *do_widget)
|
||||
gl_area = gtk_gl_area_new ();
|
||||
gtk_widget_set_hexpand (gl_area, TRUE);
|
||||
gtk_widget_set_vexpand (gl_area, TRUE);
|
||||
gtk_widget_set_size_request (gl_area, 100, 200);
|
||||
gtk_box_append (GTK_BOX (box), gl_area);
|
||||
|
||||
/* We need to initialize and free GL resources, so we use
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* OpenGL/Transitions and Effects
|
||||
/* OpenGL/Transitions
|
||||
* #Keywords: OpenGL, shader, effect
|
||||
*
|
||||
* Create transitions between pages using a custom fragment shader.
|
||||
@@ -282,12 +282,11 @@ create_gltransition_window (GtkWidget *do_widget)
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transitions and Effects");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transitions");
|
||||
headerbar = gtk_header_bar_new ();
|
||||
scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, NULL);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
gtk_widget_set_size_request (scale, 100, -1);
|
||||
gtk_widget_set_tooltip_text (scale, "Transition duration");
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), scale);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
|
||||
|
||||
@@ -179,9 +179,6 @@ gtk_fishbowl_add (GtkFishbowl *fishbowl,
|
||||
child_info->dy = new_speed ();
|
||||
|
||||
gtk_widget_set_parent (widget, GTK_WIDGET (fishbowl));
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (widget),
|
||||
GTK_ACCESSIBLE_STATE_HIDDEN, TRUE,
|
||||
-1);
|
||||
|
||||
g_hash_table_insert (priv->children, widget, child_info);
|
||||
priv->count++;
|
||||
@@ -345,8 +342,6 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
|
||||
|
||||
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_PRESENTATION);
|
||||
}
|
||||
|
||||
guint
|
||||
|
||||
@@ -13,7 +13,7 @@ static GtkWidget *window = NULL;
|
||||
static GtkWidget *scrolledwindow;
|
||||
static int selected;
|
||||
|
||||
#define N_WIDGET_TYPES 7
|
||||
#define N_WIDGET_TYPES 6
|
||||
|
||||
|
||||
static int hincrement = 5;
|
||||
@@ -177,24 +177,6 @@ populate_grid (void)
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), list);
|
||||
}
|
||||
|
||||
extern GtkWidget *create_ucd_view (GtkWidget *label);
|
||||
|
||||
static void
|
||||
populate_list2 (void)
|
||||
{
|
||||
GtkWidget *list;
|
||||
|
||||
list = create_ucd_view (NULL);
|
||||
|
||||
hincrement = 0;
|
||||
vincrement = 5;
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), list);
|
||||
}
|
||||
|
||||
static void
|
||||
set_widget_type (int type)
|
||||
{
|
||||
@@ -234,11 +216,6 @@ set_widget_type (int type)
|
||||
break;
|
||||
|
||||
case 5:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a columned list");
|
||||
populate_list2 ();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a grid");
|
||||
populate_grid ();
|
||||
break;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <glib/gstdio.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include "pixbufpaintable.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GdkPixbufLoader *pixbuf_loader = NULL;
|
||||
@@ -57,7 +56,6 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), NULL);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
}
|
||||
|
||||
@@ -264,7 +262,7 @@ start_progressive_loading (GtkWidget *picture)
|
||||
* The timeout simply simulates a slow data source by inserting
|
||||
* pauses in the reading process.
|
||||
*/
|
||||
load_timeout = g_timeout_add (300, progressive_timeout, picture);
|
||||
load_timeout = g_timeout_add (1500, progressive_timeout, picture);
|
||||
g_source_set_name_by_id (load_timeout, "[gtk] progressive_timeout");
|
||||
}
|
||||
|
||||
@@ -347,8 +345,9 @@ do_images (GtkWidget *do_widget)
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_box_append (GTK_BOX (hbox), vbox);
|
||||
|
||||
label = gtk_label_new ("Image from a resource");
|
||||
gtk_widget_add_css_class (label, "heading");
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Image loaded from a file</u>");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
@@ -356,7 +355,7 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (vbox), frame);
|
||||
|
||||
image = gtk_image_new_from_resource ("/images/org.gtk.Demo4.svg");
|
||||
image = gtk_image_new_from_icon_name ("gtk3-demo");
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
|
||||
gtk_frame_set_child (GTK_FRAME (frame), image);
|
||||
@@ -364,8 +363,9 @@ do_images (GtkWidget *do_widget)
|
||||
|
||||
/* Animation */
|
||||
|
||||
label = gtk_label_new ("Animation from a resource");
|
||||
gtk_widget_add_css_class (label, "heading");
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Animation loaded from a file</u>");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
@@ -373,16 +373,15 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (vbox), frame);
|
||||
|
||||
paintable = pixbuf_paintable_new_from_resource ("/images/floppybuddy.gif");
|
||||
picture = gtk_picture_new_for_paintable (paintable);
|
||||
g_object_unref (paintable);
|
||||
picture = gtk_picture_new_for_resource ("/images/floppybuddy.gif");
|
||||
|
||||
gtk_frame_set_child (GTK_FRAME (frame), picture);
|
||||
|
||||
/* Symbolic icon */
|
||||
|
||||
label = gtk_label_new ("Symbolic themed icon");
|
||||
gtk_widget_add_css_class (label, "heading");
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Symbolic themed icon</u>");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
@@ -401,8 +400,9 @@ do_images (GtkWidget *do_widget)
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_box_append (GTK_BOX (hbox), vbox);
|
||||
|
||||
label = gtk_label_new ("Progressive image loading");
|
||||
gtk_widget_add_css_class (label, "heading");
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Progressive image loading</u>");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
@@ -414,7 +414,6 @@ do_images (GtkWidget *do_widget)
|
||||
* will create the pixbuf and fill it in.
|
||||
*/
|
||||
picture = gtk_picture_new ();
|
||||
gtk_picture_set_alternative_text (GTK_PICTURE (picture), "A slowly loading image");
|
||||
gtk_frame_set_child (GTK_FRAME (frame), picture);
|
||||
|
||||
start_progressive_loading (picture);
|
||||
@@ -423,8 +422,9 @@ do_images (GtkWidget *do_widget)
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_box_append (GTK_BOX (hbox), vbox);
|
||||
|
||||
label = gtk_label_new ("Displaying video");
|
||||
gtk_widget_add_css_class (label, "heading");
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>Displaying video</u>");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
@@ -440,8 +440,9 @@ do_images (GtkWidget *do_widget)
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_box_append (GTK_BOX (hbox), vbox);
|
||||
|
||||
label = gtk_label_new ("GtkWidgetPaintable");
|
||||
gtk_widget_add_css_class (label, "heading");
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>GtkWidgetPaintable</u>");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
paintable = gtk_widget_paintable_new (do_widget);
|
||||
|
||||
@@ -34,7 +34,7 @@ do_layoutmanager (GtkWidget *parent)
|
||||
int i;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Layout Manager — Transition");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Layout Manager—Transition");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 600);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ do_layoutmanager2 (GtkWidget *parent)
|
||||
int i;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Layout Manager — Transformation");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Layout Manager—Transformation");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 620);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* List Box/Complex
|
||||
/* List Box/Complex list
|
||||
*
|
||||
* GtkListBox allows lists with complicated layouts, using
|
||||
* regular widgets supporting sorting and filtering.
|
||||
@@ -197,7 +197,7 @@ gtk_message_row_update (GtkMessageRow *row)
|
||||
|
||||
if (strcmp (priv->message->sender_nick, "@GTKtoolkit") == 0)
|
||||
{
|
||||
gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4");
|
||||
gtk_image_set_from_icon_name (priv->avatar_image, "gtk3-demo");
|
||||
gtk_image_set_icon_size (priv->avatar_image, GTK_ICON_SIZE_LARGE);
|
||||
}
|
||||
else
|
||||
@@ -349,7 +349,7 @@ do_listbox (GtkWidget *do_widget)
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "List Box — Complex");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "List Box");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ row_activated (GtkListBox *list,
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_listbox_controls (GtkWidget *do_widget)
|
||||
do_listbox2 (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
@@ -47,7 +47,7 @@ do_listbox_controls (GtkWidget *do_widget)
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
|
||||
gtk_builder_add_from_resource (builder, "/listbox_controls/listbox_controls.ui", NULL);
|
||||
gtk_builder_add_from_resource (builder, "/listbox2/listbox2.ui", NULL);
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
@@ -80,7 +80,7 @@ ucd_model_new (void)
|
||||
iter = g_variant_iter_new (v);
|
||||
|
||||
store = g_list_store_new (G_TYPE_OBJECT);
|
||||
while (g_variant_iter_next (iter, "(u&s)", &u, &name))
|
||||
while (g_variant_iter_next (iter, "(us)", &u, &name))
|
||||
{
|
||||
if (u == 0)
|
||||
continue;
|
||||
@@ -259,7 +259,7 @@ selection_changed (GObject *object,
|
||||
gtk_label_set_label (GTK_LABEL (label), buffer);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
static GtkWidget *
|
||||
create_ucd_view (GtkWidget *label)
|
||||
{
|
||||
GtkWidget *cv;
|
||||
@@ -273,8 +273,7 @@ create_ucd_view (GtkWidget *label)
|
||||
selection = gtk_single_selection_new (ucd_model);
|
||||
gtk_single_selection_set_autoselect (selection, TRUE);
|
||||
gtk_single_selection_set_can_unselect (selection, FALSE);
|
||||
if (label)
|
||||
g_signal_connect (selection, "notify::selected", G_CALLBACK (selection_changed), label);
|
||||
g_signal_connect (selection, "notify::selected", G_CALLBACK (selection_changed), label);
|
||||
|
||||
cv = gtk_column_view_new (GTK_SELECTION_MODEL (selection));
|
||||
gtk_column_view_set_show_column_separators (GTK_COLUMN_VIEW (cv), TRUE);
|
||||
@@ -284,14 +283,12 @@ create_ucd_view (GtkWidget *label)
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_codepoint), NULL);
|
||||
column = gtk_column_view_column_new ("Codepoint", factory);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_centered_label), NULL);
|
||||
g_signal_connect (factory, "bind", G_CALLBACK (bind_char), NULL);
|
||||
column = gtk_column_view_column_new ("Char", factory);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
@@ -299,7 +296,6 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Name", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
@@ -307,7 +303,6 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Type", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_ellipsizing_label), NULL);
|
||||
@@ -315,7 +310,6 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Break Type", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_label), NULL);
|
||||
@@ -323,7 +317,6 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Combining Class", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
factory = gtk_signal_list_item_factory_new ();
|
||||
g_signal_connect (factory, "setup", G_CALLBACK (setup_label), NULL);
|
||||
@@ -331,7 +324,6 @@ create_ucd_view (GtkWidget *label)
|
||||
column = gtk_column_view_column_new ("Script", factory);
|
||||
gtk_column_view_column_set_resizable (column, TRUE);
|
||||
gtk_column_view_append_column (GTK_COLUMN_VIEW (cv), column);
|
||||
g_object_unref (column);
|
||||
|
||||
return cv;
|
||||
}
|
||||
|
||||
@@ -337,8 +337,8 @@ display_text (const char *format,
|
||||
|
||||
bytes = g_resources_lookup_data (resource, 0, NULL);
|
||||
g_assert (bytes);
|
||||
text = g_bytes_get_data (bytes, &len);
|
||||
g_assert (g_utf8_validate (text, len, NULL));
|
||||
|
||||
g_assert (g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL));
|
||||
|
||||
textview = gtk_text_view_new ();
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview), 20);
|
||||
@@ -354,8 +354,9 @@ display_text (const char *format,
|
||||
gtk_text_view_set_monospace (GTK_TEXT_VIEW (textview), TRUE);
|
||||
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
|
||||
text = g_bytes_unref_to_data (bytes, &len);
|
||||
gtk_text_buffer_set_text (buffer, text, len);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
if (format)
|
||||
fontify (format, buffer);
|
||||
|
||||
@@ -28,7 +28,14 @@
|
||||
<object class="GtkButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="action-name">win.run</property>
|
||||
<property name="label" translatable="yes">Run</property>
|
||||
<style>
|
||||
<class name="text-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Run</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
@@ -36,9 +43,6 @@
|
||||
<property name="valign">center</property>
|
||||
<property name="menu-model">gear_menu</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Primary menu</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -59,11 +63,7 @@
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="key-capture-widget">window</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search-entry">
|
||||
<accessibility>
|
||||
<relation name="controls">listview</relation>
|
||||
</accessibility>
|
||||
</object>
|
||||
<object class="GtkSearchEntry" id="search-entry"/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -78,10 +78,6 @@
|
||||
<property name="resource">/ui/main-listitem.ui</property>
|
||||
</object>
|
||||
</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Demo list</property>
|
||||
<relation name="controls">notebook</relation>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -116,10 +112,6 @@
|
||||
<property name="editable">0</property>
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="cursor-visible">0</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Info</property>
|
||||
<property name="description" translatable="yes">A description of the demo</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -150,10 +142,6 @@
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="pixels-above-lines">2</property>
|
||||
<property name="pixels-below-lines">2</property>
|
||||
<accessibility>
|
||||
<property name="label" translatable="yes">Source</property>
|
||||
<property name="description" translatable="yes">The source code of the demo</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -7,9 +7,8 @@ demos = files([
|
||||
'clipboard.c',
|
||||
'combobox.c',
|
||||
'constraints.c',
|
||||
'constraints_interactive.c',
|
||||
'constraints_vfl.c',
|
||||
'constraints_builder.c',
|
||||
'constraints2.c',
|
||||
'constraints3.c',
|
||||
'css_accordion.c',
|
||||
'css_basics.c',
|
||||
'css_blendmodes.c',
|
||||
@@ -19,6 +18,7 @@ demos = files([
|
||||
'cursors.c',
|
||||
'dialog.c',
|
||||
'drawingarea.c',
|
||||
'dropdown.c',
|
||||
'dnd.c',
|
||||
'editable_cells.c',
|
||||
'entry_completion.c',
|
||||
@@ -44,7 +44,7 @@ demos = files([
|
||||
'layoutmanager2.c',
|
||||
'links.c',
|
||||
'listbox.c',
|
||||
'listbox_controls.c',
|
||||
'listbox2.c',
|
||||
'menu.c',
|
||||
'flowbox.c',
|
||||
'list_store.c',
|
||||
@@ -53,14 +53,12 @@ demos = files([
|
||||
'listview_colors.c',
|
||||
'listview_filebrowser.c',
|
||||
'listview_minesweeper.c',
|
||||
'dropdown.c',
|
||||
'listview_settings.c',
|
||||
'listview_ucd.c',
|
||||
'listview_weather.c',
|
||||
'listview_words.c',
|
||||
'markup.c',
|
||||
'overlay.c',
|
||||
'overlay_decorative.c',
|
||||
'overlay2.c',
|
||||
'paint.c',
|
||||
'paintable.c',
|
||||
'paintable_animated.c',
|
||||
@@ -120,15 +118,11 @@ extra_demo_sources = files(['main.c',
|
||||
'singular_value_decomposition.c',
|
||||
'four_point_transform.c',
|
||||
'demo2widget.c',
|
||||
'demo3widget.c',
|
||||
'pixbufpaintable.c',
|
||||
'script-names.c',
|
||||
'unicode-names.c',
|
||||
'suggestionentry.c'])
|
||||
'demo3widget.c'])
|
||||
|
||||
if harfbuzz_dep.found() and pangoft_dep.found()
|
||||
demos += files(['font_features.c'])
|
||||
extra_demo_sources += files(['language-names.c'])
|
||||
demos += files(['font_features.c', 'listview_ucd.c'])
|
||||
extra_demo_sources += files(['script-names.c', 'language-names.c', 'unicode-names.c'])
|
||||
gtkdemo_deps += [ harfbuzz_dep, epoxy_dep ]
|
||||
endif
|
||||
|
||||
@@ -140,7 +134,6 @@ librsvg_dep = dependency('librsvg-2.0', version: '>= 2.46.0', required: false)
|
||||
|
||||
if librsvg_dep.found()
|
||||
demos += files('paintable_svg.c')
|
||||
extra_demo_sources += files(['svgpaintable.c'])
|
||||
gtkdemo_deps += [ librsvg_dep ]
|
||||
endif
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ margin_changed (GtkAdjustment *adjustment,
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_overlay_decorative (GtkWidget *do_widget)
|
||||
do_overlay2 (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Paintable/Simple Paintable
|
||||
/* Paintable/A simple paintable
|
||||
*
|
||||
* GdkPaintable is an interface used by GTK for drawings of any sort
|
||||
* that do not require layouting or positioning.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Paintable/Animated Paintable
|
||||
/* Paintable/An animated paintable
|
||||
*
|
||||
* GdkPaintable also allows paintables to change.
|
||||
*
|
||||
|
||||
@@ -153,7 +153,7 @@ do_paintable_emblem (GtkWidget *do_widget)
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paintable — Emblems");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Emblems");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Paintable/Media Stream
|
||||
/* Paintable/A media stream
|
||||
*
|
||||
* GdkPaintable is also used by the GtkMediaStream class.
|
||||
*
|
||||
|
||||
@@ -9,20 +9,183 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <librsvg/rsvg.h>
|
||||
|
||||
#include "svgpaintable.h"
|
||||
#define SVG_TYPE_PAINTABLE (svg_paintable_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SvgPaintable, svg_paintable, SVG, PAINTABLE, GObject)
|
||||
|
||||
struct _SvgPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
GFile *file;
|
||||
RsvgHandle *handle;
|
||||
};
|
||||
|
||||
struct _SvgPaintableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_FILE = 1,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
static void
|
||||
svg_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (paintable);
|
||||
cairo_t *cr;
|
||||
GError *error = NULL;
|
||||
|
||||
cr = gtk_snapshot_append_cairo (GTK_SNAPSHOT (snapshot),
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
if (!rsvg_handle_render_document (self->handle, cr,
|
||||
&(RsvgRectangle) {0, 0, width, height},
|
||||
&error))
|
||||
{
|
||||
g_error ("%s", error->message);
|
||||
}
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
static int
|
||||
svg_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (paintable);
|
||||
RsvgDimensionData data;
|
||||
|
||||
rsvg_handle_get_dimensions (self->handle, &data);
|
||||
|
||||
return data.width;
|
||||
}
|
||||
|
||||
static int
|
||||
svg_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (paintable);
|
||||
RsvgDimensionData data;
|
||||
|
||||
rsvg_handle_get_dimensions (self->handle, &data);
|
||||
|
||||
return data.height;
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_init_interface (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = svg_paintable_snapshot;
|
||||
iface->get_intrinsic_width = svg_paintable_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = svg_paintable_get_intrinsic_height;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (SvgPaintable, svg_paintable, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
svg_paintable_init_interface))
|
||||
|
||||
static void
|
||||
svg_paintable_init (SvgPaintable *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_dispose (GObject *object)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (object);
|
||||
|
||||
g_clear_object (&self->file);
|
||||
g_clear_object (&self->handle);
|
||||
|
||||
G_OBJECT_CLASS (svg_paintable_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FILE:
|
||||
{
|
||||
GFile *file = g_value_get_object (value);
|
||||
RsvgHandle *handle = rsvg_handle_new_from_gfile_sync (file,
|
||||
RSVG_HANDLE_FLAGS_NONE,
|
||||
NULL,
|
||||
NULL);
|
||||
rsvg_handle_set_dpi (handle, 90);
|
||||
|
||||
g_set_object (&self->file, file);
|
||||
g_set_object (&self->handle, handle);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FILE:
|
||||
g_value_set_object (value, self->file);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
svg_paintable_class_init (SvgPaintableClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->dispose = svg_paintable_dispose;
|
||||
object_class->set_property = svg_paintable_set_property;
|
||||
object_class->get_property = svg_paintable_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_FILE,
|
||||
g_param_spec_object ("file", "File", "File",
|
||||
G_TYPE_FILE,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static SvgPaintable *
|
||||
svg_paintable_new (GFile *file)
|
||||
{
|
||||
return g_object_new (SVG_TYPE_PAINTABLE,
|
||||
"file", file,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
file_set (GtkFileChooserButton *button,
|
||||
GtkWidget *picture)
|
||||
{
|
||||
GFile *file;
|
||||
GdkPaintable *paintable;
|
||||
SvgPaintable *paintable;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
|
||||
|
||||
paintable = svg_paintable_new (file);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (paintable));
|
||||
|
||||
g_object_unref (paintable);
|
||||
g_object_unref (file);
|
||||
@@ -38,15 +201,14 @@ do_paintable_svg (GtkWidget *do_widget)
|
||||
GtkFileFilter *filter;
|
||||
GtkWidget *button;
|
||||
GFile *file;
|
||||
GdkPaintable *paintable;
|
||||
SvgPaintable *paintable;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 330, 330);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paintable — SVG");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
button = gtk_file_chooser_button_new ("Select an SVG file", GTK_FILE_CHOOSER_ACTION_OPEN);
|
||||
@@ -65,7 +227,7 @@ do_paintable_svg (GtkWidget *do_widget)
|
||||
|
||||
file = g_file_new_for_uri ("resource:///paintable_svg/org.gtk.gtk4.NodeEditor.Devel.svg");
|
||||
paintable = svg_paintable_new (file);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (paintable));
|
||||
g_object_unref (paintable);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
@@ -3,16 +3,100 @@
|
||||
* The GtkPaned Widget divides its content area into two panes
|
||||
* with a divider in between that the user can adjust. A separate
|
||||
* child is placed into each pane. GtkPaned widgets can be split
|
||||
* horizontally or vertically. This test contains both a horizontal
|
||||
* and a vertical GtkPaned widget.
|
||||
* horizontally or vertially.
|
||||
*
|
||||
* There are a number of options that can be set for each pane.
|
||||
* You can use the Inspector to adjust the options for each side
|
||||
* of each widget.
|
||||
* This test contains both a horizontal and a vertical GtkPaned
|
||||
* widget, and allows you to adjust the options for each side of
|
||||
* each widget.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
toggle_resize (GtkWidget *widget,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
GtkPaned *paned;
|
||||
|
||||
parent = gtk_widget_get_parent (child);
|
||||
paned = GTK_PANED (parent);
|
||||
|
||||
if (child == gtk_paned_get_start_child (paned))
|
||||
gtk_paned_set_resize_start_child (paned, !gtk_paned_get_resize_start_child (paned));
|
||||
else
|
||||
gtk_paned_set_resize_end_child (paned, !gtk_paned_get_resize_end_child (paned));
|
||||
}
|
||||
|
||||
static void
|
||||
toggle_shrink (GtkWidget *widget,
|
||||
GtkWidget *child)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
GtkPaned *paned;
|
||||
|
||||
parent = gtk_widget_get_parent (child);
|
||||
paned = GTK_PANED (parent);
|
||||
|
||||
if (child == gtk_paned_get_start_child (paned))
|
||||
gtk_paned_set_shrink_start_child (paned, !gtk_paned_get_shrink_start_child (paned));
|
||||
else
|
||||
gtk_paned_set_shrink_end_child (paned, !gtk_paned_get_shrink_end_child (paned));
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_pane_options (GtkPaned *paned,
|
||||
const char *frame_label,
|
||||
const char *label1,
|
||||
const char *label2)
|
||||
{
|
||||
GtkWidget *child1, *child2;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *table;
|
||||
GtkWidget *label;
|
||||
GtkWidget *check_button;
|
||||
|
||||
child1 = gtk_paned_get_start_child (paned);
|
||||
child2 = gtk_paned_get_end_child (paned);
|
||||
|
||||
frame = gtk_frame_new (frame_label);
|
||||
|
||||
table = gtk_grid_new ();
|
||||
gtk_frame_set_child (GTK_FRAME (frame), table);
|
||||
|
||||
label = gtk_label_new (label1);
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
|
||||
|
||||
check_button = gtk_check_button_new_with_mnemonic ("_Resize");
|
||||
gtk_grid_attach (GTK_GRID (table), check_button, 0, 1, 1, 1);
|
||||
g_signal_connect (check_button, "toggled",
|
||||
G_CALLBACK (toggle_resize), child1);
|
||||
|
||||
check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
|
||||
gtk_grid_attach (GTK_GRID (table), check_button, 0, 2, 1, 1);
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (check_button), TRUE);
|
||||
g_signal_connect (check_button, "toggled",
|
||||
G_CALLBACK (toggle_shrink), child1);
|
||||
|
||||
label = gtk_label_new (label2);
|
||||
gtk_grid_attach (GTK_GRID (table), label, 1, 0, 1, 1);
|
||||
|
||||
check_button = gtk_check_button_new_with_mnemonic ("_Resize");
|
||||
gtk_grid_attach (GTK_GRID (table), check_button, 1, 1, 1, 1);
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (check_button), TRUE);
|
||||
g_signal_connect (check_button, "toggled",
|
||||
G_CALLBACK (toggle_resize), child2);
|
||||
|
||||
check_button = gtk_check_button_new_with_mnemonic ("_Shrink");
|
||||
gtk_grid_attach (GTK_GRID (table), check_button, 1, 2, 1, 1);
|
||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (check_button), TRUE);
|
||||
g_signal_connect (check_button, "toggled",
|
||||
G_CALLBACK (toggle_shrink), child2);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_panes (GtkWidget *do_widget)
|
||||
{
|
||||
@@ -20,19 +104,19 @@ do_panes (GtkWidget *do_widget)
|
||||
GtkWidget *frame;
|
||||
GtkWidget *hpaned;
|
||||
GtkWidget *vpaned;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *box;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 330, 250);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_widget_set_margin_start (vbox, 8);
|
||||
gtk_widget_set_margin_end (vbox, 8);
|
||||
@@ -48,37 +132,41 @@ do_panes (GtkWidget *do_widget)
|
||||
|
||||
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_paned_set_start_child (GTK_PANED (vpaned), hpaned);
|
||||
gtk_paned_set_shrink_start_child (GTK_PANED (vpaned), FALSE);
|
||||
|
||||
label = gtk_label_new ("Hi there");
|
||||
gtk_widget_set_margin_start (label, 4);
|
||||
gtk_widget_set_margin_end (label, 4);
|
||||
gtk_widget_set_margin_top (label, 4);
|
||||
gtk_widget_set_margin_bottom (label, 4);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_widget_set_vexpand (label, TRUE);
|
||||
gtk_paned_set_start_child (GTK_PANED (hpaned), label);
|
||||
gtk_paned_set_shrink_start_child (GTK_PANED (hpaned), FALSE);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_size_request (box, 60, 60);
|
||||
gtk_paned_set_start_child (GTK_PANED (hpaned), box);
|
||||
|
||||
label = gtk_label_new ("Hello");
|
||||
gtk_widget_set_margin_start (label, 4);
|
||||
gtk_widget_set_margin_end (label, 4);
|
||||
gtk_widget_set_margin_top (label, 4);
|
||||
gtk_widget_set_margin_bottom (label, 4);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_widget_set_vexpand (label, TRUE);
|
||||
gtk_paned_set_end_child (GTK_PANED (hpaned), label);
|
||||
gtk_paned_set_shrink_end_child (GTK_PANED (hpaned), FALSE);
|
||||
button = gtk_button_new_with_mnemonic ("_Hi there");
|
||||
gtk_widget_set_margin_start (button, 4);
|
||||
gtk_widget_set_margin_end (button, 4);
|
||||
gtk_widget_set_margin_top (button, 4);
|
||||
gtk_widget_set_margin_bottom (button, 4);
|
||||
gtk_widget_set_hexpand (button, TRUE);
|
||||
gtk_widget_set_vexpand (button, TRUE);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
label = gtk_label_new ("Goodbye");
|
||||
gtk_widget_set_margin_start (label, 4);
|
||||
gtk_widget_set_margin_end (label, 4);
|
||||
gtk_widget_set_margin_top (label, 4);
|
||||
gtk_widget_set_margin_bottom (label, 4);
|
||||
gtk_widget_set_hexpand (label, TRUE);
|
||||
gtk_widget_set_vexpand (label, TRUE);
|
||||
gtk_paned_set_end_child (GTK_PANED (vpaned), label);
|
||||
gtk_paned_set_shrink_end_child (GTK_PANED (vpaned), FALSE);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_size_request (box, 80, 60);
|
||||
gtk_paned_set_end_child (GTK_PANED (hpaned), box);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_size_request (box, 60, 80);
|
||||
gtk_paned_set_end_child (GTK_PANED (vpaned), box);
|
||||
|
||||
/* Now create toggle buttons to control sizing */
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox),
|
||||
create_pane_options (GTK_PANED (hpaned),
|
||||
"Horizontal",
|
||||
"Left",
|
||||
"Right"));
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox),
|
||||
create_pane_options (GTK_PANED (vpaned),
|
||||
"Vertical",
|
||||
"Top",
|
||||
"Bottom"));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "pixbufpaintable.h"
|
||||
|
||||
struct _PixbufPaintable {
|
||||
GObject parent_instance;
|
||||
|
||||
char *resource_path;
|
||||
GdkPixbufAnimation *anim;
|
||||
GdkPixbufAnimationIter *iter;
|
||||
|
||||
guint timeout;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_RESOURCE_PATH = 1,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
static void
|
||||
pixbuf_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
PixbufPaintable *self = PIXBUF_PAINTABLE (paintable);
|
||||
GTimeVal val;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkTexture *texture;
|
||||
|
||||
g_get_current_time (&val);
|
||||
gdk_pixbuf_animation_iter_advance (self->iter, &val);
|
||||
pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (self->iter);
|
||||
texture = gdk_texture_new_for_pixbuf (pixbuf);
|
||||
|
||||
gdk_paintable_snapshot (GDK_PAINTABLE (texture), snapshot, width, height);
|
||||
|
||||
g_object_unref (texture);
|
||||
}
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
static int
|
||||
pixbuf_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
PixbufPaintable *self = PIXBUF_PAINTABLE (paintable);
|
||||
|
||||
return gdk_pixbuf_animation_get_width (self->anim);
|
||||
}
|
||||
|
||||
static int
|
||||
pixbuf_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
PixbufPaintable *self = PIXBUF_PAINTABLE (paintable);
|
||||
|
||||
return gdk_pixbuf_animation_get_height (self->anim);
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_paintable_init_interface (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = pixbuf_paintable_snapshot;
|
||||
iface->get_intrinsic_width = pixbuf_paintable_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = pixbuf_paintable_get_intrinsic_height;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE(PixbufPaintable, pixbuf_paintable, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
pixbuf_paintable_init_interface))
|
||||
|
||||
static void
|
||||
pixbuf_paintable_init (PixbufPaintable *paintable)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
delay_cb (gpointer data)
|
||||
{
|
||||
PixbufPaintable *self = data;
|
||||
int delay;
|
||||
|
||||
delay = gdk_pixbuf_animation_iter_get_delay_time (self->iter);
|
||||
self->timeout = g_timeout_add (delay, delay_cb, self);
|
||||
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_paintable_set_resource_path (PixbufPaintable *self,
|
||||
const char *resource_path)
|
||||
{
|
||||
int delay;
|
||||
|
||||
g_free (self->resource_path);
|
||||
self->resource_path = g_strdup (resource_path);
|
||||
|
||||
g_clear_object (&self->anim);
|
||||
self->anim = gdk_pixbuf_animation_new_from_resource (resource_path, NULL);
|
||||
g_clear_object (&self->iter);
|
||||
self->iter = gdk_pixbuf_animation_get_iter (self->anim, NULL);
|
||||
|
||||
delay = gdk_pixbuf_animation_iter_get_delay_time (self->iter);
|
||||
self->timeout = g_timeout_add (delay, delay_cb, self);
|
||||
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
|
||||
g_object_notify (G_OBJECT (self), "resource-path");
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_paintable_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
PixbufPaintable *self = PIXBUF_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_RESOURCE_PATH:
|
||||
pixbuf_paintable_set_resource_path (self, g_value_get_string (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_paintable_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
PixbufPaintable *self = PIXBUF_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_RESOURCE_PATH:
|
||||
g_value_set_string (value, self->resource_path);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_paintable_dispose (GObject *object)
|
||||
{
|
||||
PixbufPaintable *self = PIXBUF_PAINTABLE (object);
|
||||
|
||||
g_clear_pointer (&self->resource_path, g_free);
|
||||
g_clear_object (&self->anim);
|
||||
g_clear_object (&self->iter);
|
||||
if (self->timeout)
|
||||
{
|
||||
g_source_remove (self->timeout);
|
||||
self->timeout = 0;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (pixbuf_paintable_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
pixbuf_paintable_class_init (PixbufPaintableClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->dispose = pixbuf_paintable_dispose;
|
||||
object_class->get_property = pixbuf_paintable_get_property;
|
||||
object_class->set_property = pixbuf_paintable_set_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_RESOURCE_PATH,
|
||||
g_param_spec_string ("resource-path", "Resource path", "Resource path",
|
||||
NULL, G_PARAM_READWRITE));
|
||||
|
||||
}
|
||||
|
||||
GdkPaintable *
|
||||
pixbuf_paintable_new_from_resource (const char *path)
|
||||
{
|
||||
return g_object_new (PIXBUF_TYPE_PAINTABLE,
|
||||
"resource-path", path,
|
||||
NULL);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define PIXBUF_TYPE_PAINTABLE (pixbuf_paintable_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE(PixbufPaintable, pixbuf_paintable, PIXBUF, PAINTABLE, GObject)
|
||||
|
||||
GdkPaintable * pixbuf_paintable_new_from_resource (const char *path);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -110,17 +110,17 @@ set_search_by (GSimpleAction *action,
|
||||
if (g_str_equal (term, "name"))
|
||||
{
|
||||
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, "Search by name");
|
||||
gtk_entry_set_placeholder_text (entry, "Name…");
|
||||
gtk_entry_set_placeholder_text (entry, "name");
|
||||
}
|
||||
else if (g_str_equal (term, "description"))
|
||||
{
|
||||
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, "Search by description");
|
||||
gtk_entry_set_placeholder_text (entry, "Description…");
|
||||
gtk_entry_set_placeholder_text (entry, "description");
|
||||
}
|
||||
else if (g_str_equal (term, "filename"))
|
||||
{
|
||||
gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, "Search by file name");
|
||||
gtk_entry_set_placeholder_text (entry, "File name…");
|
||||
gtk_entry_set_placeholder_text (entry, "file name");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,6 +254,7 @@ do_search_entry (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *label;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *find_button;
|
||||
GtkWidget *cancel_button;
|
||||
@@ -267,14 +268,18 @@ do_search_entry (GtkWidget *do_widget)
|
||||
|
||||
g_object_weak_ref (G_OBJECT (window), search_entry_destroyed, &window);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_widget_set_margin_start (vbox, 18);
|
||||
gtk_widget_set_margin_end (vbox, 18);
|
||||
gtk_widget_set_margin_top (vbox, 18);
|
||||
gtk_widget_set_margin_bottom (vbox, 18);
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
|
||||
gtk_widget_set_margin_start (vbox, 5);
|
||||
gtk_widget_set_margin_end (vbox, 5);
|
||||
gtk_widget_set_margin_top (vbox, 5);
|
||||
gtk_widget_set_margin_bottom (vbox, 5);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), "Search entry demo");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
|
||||
/* Create our entry */
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* Entry/Type to Search
|
||||
/* Entry/Delayed Search Entry
|
||||
*
|
||||
* GtkSearchEntry provides an entry that is ready for search.
|
||||
*
|
||||
* Search entries have their "search-changed" signal delayed and
|
||||
* should be used when the search operation is slow, such as big
|
||||
* datasets to search, or online searches.
|
||||
* Search entries have their "changed" signal delayed and should
|
||||
* be used when the searched operation is slow such as loads of
|
||||
* entries to search, or online searches.
|
||||
*
|
||||
* GtkSearchBar allows have a hidden search entry that 'springs
|
||||
* into action' upon keyboard input.
|
||||
@@ -18,69 +18,101 @@ search_changed_cb (GtkSearchEntry *entry,
|
||||
{
|
||||
const char *text;
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (entry));
|
||||
g_message ("search changed: %s", text);
|
||||
gtk_label_set_text (result_label, text ? text : "");
|
||||
}
|
||||
|
||||
static void
|
||||
changed_cb (GtkEditable *editable)
|
||||
{
|
||||
const char *text;
|
||||
text = gtk_editable_get_text (GTK_EDITABLE (editable));
|
||||
g_message ("changed: %s", text);
|
||||
}
|
||||
|
||||
static void
|
||||
search_changed (GtkSearchEntry *entry,
|
||||
GtkLabel *label)
|
||||
{
|
||||
gtk_label_set_text (label, "search-changed");
|
||||
}
|
||||
|
||||
static void
|
||||
next_match (GtkSearchEntry *entry,
|
||||
GtkLabel *label)
|
||||
{
|
||||
gtk_label_set_text (label, "next-match");
|
||||
}
|
||||
|
||||
static void
|
||||
previous_match (GtkSearchEntry *entry,
|
||||
GtkLabel *label)
|
||||
{
|
||||
gtk_label_set_text (label, "previous-match");
|
||||
}
|
||||
|
||||
static void
|
||||
stop_search (GtkSearchEntry *entry,
|
||||
GtkLabel *label)
|
||||
{
|
||||
gtk_label_set_text (label, "stop-search");
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_search_entry2 (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *box;
|
||||
GtkWidget *label;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *container;
|
||||
GtkWidget *searchbar;
|
||||
GtkWidget *button;
|
||||
GtkWidget *header;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Type to Search");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Delayed Search Entry");
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_widget_set_size_request (window, 200, -1);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
entry = gtk_search_entry_new ();
|
||||
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
|
||||
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (container), entry);
|
||||
searchbar = gtk_search_bar_new ();
|
||||
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (searchbar), GTK_EDITABLE (entry));
|
||||
gtk_search_bar_set_show_close_button (GTK_SEARCH_BAR (searchbar), FALSE);
|
||||
gtk_search_bar_set_child (GTK_SEARCH_BAR (searchbar), entry);
|
||||
gtk_search_bar_set_child (GTK_SEARCH_BAR (searchbar), container);
|
||||
gtk_box_append (GTK_BOX (vbox), searchbar);
|
||||
|
||||
/* Hook the search bar to key presses */
|
||||
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (searchbar), window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
|
||||
gtk_widget_set_margin_start (box, 18);
|
||||
gtk_widget_set_margin_end (box, 18);
|
||||
gtk_widget_set_margin_top (box, 18);
|
||||
gtk_widget_set_margin_bottom (box, 18);
|
||||
gtk_box_append (GTK_BOX (vbox), box);
|
||||
/* Help */
|
||||
label = gtk_label_new ("Start Typing to search");
|
||||
gtk_box_append (GTK_BOX (vbox), label);
|
||||
|
||||
/* Toggle button */
|
||||
button = gtk_toggle_button_new ();
|
||||
gtk_button_set_icon_name (GTK_BUTTON (button), "system-search-symbolic");
|
||||
button = gtk_toggle_button_new_with_label ("Search");
|
||||
g_object_bind_property (button, "active",
|
||||
searchbar, "search-mode-enabled",
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
gtk_box_append (GTK_BOX (vbox), button);
|
||||
|
||||
/* Result */
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_box_append (GTK_BOX (box), hbox);
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
|
||||
label = gtk_label_new ("Searching for:");
|
||||
label = gtk_label_new ("Result:");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
||||
gtk_widget_set_margin_start (label, 6);
|
||||
gtk_box_append (GTK_BOX (hbox), label);
|
||||
|
||||
label = gtk_label_new ("");
|
||||
@@ -88,6 +120,28 @@ do_search_entry2 (GtkWidget *do_widget)
|
||||
|
||||
g_signal_connect (entry, "search-changed",
|
||||
G_CALLBACK (search_changed_cb), label);
|
||||
g_signal_connect (entry, "changed",
|
||||
G_CALLBACK (changed_cb), label);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
|
||||
label = gtk_label_new ("Signal:");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
||||
gtk_widget_set_margin_start (label, 6);
|
||||
gtk_box_append (GTK_BOX (hbox), label);
|
||||
|
||||
label = gtk_label_new ("");
|
||||
gtk_box_append (GTK_BOX (hbox), label);
|
||||
|
||||
g_signal_connect (entry, "search-changed",
|
||||
G_CALLBACK (search_changed), label);
|
||||
g_signal_connect (entry, "next-match",
|
||||
G_CALLBACK (next_match), label);
|
||||
g_signal_connect (entry, "previous-match",
|
||||
G_CALLBACK (previous_match), label);
|
||||
g_signal_connect (entry, "stop-search",
|
||||
G_CALLBACK (stop_search), label);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -57,8 +57,6 @@ do_shortcut_triggers (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Shortcuts");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 200, -1);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
list = gtk_list_box_new ();
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<property name="margin-start">50</property>
|
||||
<property name="margin-end">50</property>
|
||||
<property name="margin-top">50</property>
|
||||
<property name="margin-bottom">50</property>
|
||||
<property name="margin-end">50</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Sliding Puzzle
|
||||
* #Keywords: GdkPaintable, GdkGesture, GtkShortcutController, game
|
||||
* #Keywords: GdkPaintable, GdkGesture, game
|
||||
*
|
||||
* This demo demonstrates how to use gestures and paintables to create a
|
||||
* small sliding puzzle game.
|
||||
@@ -281,8 +281,7 @@ 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);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
entry.suggestion > popover.menu.background > contents {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
entry.suggestion arrow {
|
||||
-gtk-icon-source: -gtk-icontheme('pan-down-symbolic');
|
||||
min-height: 16px;
|
||||
min-width: 16px;
|
||||
}
|
||||
|
||||
entry.suggestion > popover {
|
||||
margin-top: 6px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
entry.suggestion > popover listview {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
entry.suggestion > popover listview > row {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
entry.suggestion > popover listview > row:selected {
|
||||
outline-color: rgba(1,1,1,0.2);
|
||||
color: @theme_text_color;
|
||||
background-color: shade(#f6f5f4, 0.97);
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define MATCH_TYPE_OBJECT (match_object_get_type ())
|
||||
#define MATCH_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATCH_TYPE_OBJECT, MatchObject))
|
||||
#define MATCH_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATCH_TYPE_OBJECT))
|
||||
|
||||
typedef struct _MatchObject MatchObject;
|
||||
|
||||
GType match_object_get_type (void) G_GNUC_CONST;
|
||||
|
||||
gpointer match_object_get_item (MatchObject *object);
|
||||
const char * match_object_get_string (MatchObject *object);
|
||||
guint match_object_get_match_start (MatchObject *object);
|
||||
guint match_object_get_match_end (MatchObject *object);
|
||||
guint match_object_get_score (MatchObject *object);
|
||||
void match_object_set_match (MatchObject *object,
|
||||
guint start,
|
||||
guint end,
|
||||
guint score);
|
||||
|
||||
#define SUGGESTION_TYPE_ENTRY (suggestion_entry_get_type ())
|
||||
#define SUGGESTION_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SUGGESTION_TYPE_ENTRY, SuggestionEntry))
|
||||
#define SUGGESTION_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SUGGESTION_TYPE_ENTRY))
|
||||
|
||||
typedef struct _SuggestionEntry SuggestionEntry;
|
||||
|
||||
GType suggestion_entry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget* suggestion_entry_new (void);
|
||||
|
||||
void suggestion_entry_set_model (SuggestionEntry *self,
|
||||
GListModel *model);
|
||||
GListModel * suggestion_entry_get_model (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_factory (SuggestionEntry *self,
|
||||
GtkListItemFactory *factory);
|
||||
GtkListItemFactory *
|
||||
suggestion_entry_get_factory (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_use_filter (SuggestionEntry *self,
|
||||
gboolean use_ilter);
|
||||
gboolean suggestion_entry_get_use_filter (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_expression (SuggestionEntry *self,
|
||||
GtkExpression *expression);
|
||||
GtkExpression * suggestion_entry_get_expression (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_show_arrow (SuggestionEntry *self,
|
||||
gboolean show_arrow);
|
||||
gboolean suggestion_entry_get_show_arrow (SuggestionEntry *self);
|
||||
|
||||
typedef void (* SuggestionEntryMatchFunc) (MatchObject *object,
|
||||
const char *search,
|
||||
gpointer user_data);
|
||||
|
||||
void suggestion_entry_set_match_func (SuggestionEntry *self,
|
||||
SuggestionEntryMatchFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify destroy);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -1,166 +0,0 @@
|
||||
#include "svgpaintable.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <librsvg/rsvg.h>
|
||||
|
||||
struct _SvgPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
GFile *file;
|
||||
RsvgHandle *handle;
|
||||
};
|
||||
|
||||
struct _SvgPaintableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_FILE = 1,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
static void
|
||||
svg_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (paintable);
|
||||
cairo_t *cr;
|
||||
GError *error = NULL;
|
||||
|
||||
cr = gtk_snapshot_append_cairo (GTK_SNAPSHOT (snapshot),
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
if (!rsvg_handle_render_document (self->handle, cr,
|
||||
&(RsvgRectangle) {0, 0, width, height},
|
||||
&error))
|
||||
{
|
||||
g_error ("%s", error->message);
|
||||
}
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
static int
|
||||
svg_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (paintable);
|
||||
RsvgDimensionData data;
|
||||
|
||||
rsvg_handle_get_dimensions (self->handle, &data);
|
||||
|
||||
return data.width;
|
||||
}
|
||||
|
||||
static int
|
||||
svg_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (paintable);
|
||||
RsvgDimensionData data;
|
||||
|
||||
rsvg_handle_get_dimensions (self->handle, &data);
|
||||
|
||||
return data.height;
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_init_interface (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = svg_paintable_snapshot;
|
||||
iface->get_intrinsic_width = svg_paintable_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = svg_paintable_get_intrinsic_height;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (SvgPaintable, svg_paintable, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
svg_paintable_init_interface))
|
||||
|
||||
static void
|
||||
svg_paintable_init (SvgPaintable *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_dispose (GObject *object)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (object);
|
||||
|
||||
g_clear_object (&self->file);
|
||||
g_clear_object (&self->handle);
|
||||
|
||||
G_OBJECT_CLASS (svg_paintable_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FILE:
|
||||
{
|
||||
GFile *file = g_value_get_object (value);
|
||||
RsvgHandle *handle = rsvg_handle_new_from_gfile_sync (file,
|
||||
RSVG_HANDLE_FLAGS_NONE,
|
||||
NULL,
|
||||
NULL);
|
||||
rsvg_handle_set_dpi (handle, 90);
|
||||
|
||||
g_set_object (&self->file, file);
|
||||
g_set_object (&self->handle, handle);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
svg_paintable_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
SvgPaintable *self = SVG_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_FILE:
|
||||
g_value_set_object (value, self->file);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
svg_paintable_class_init (SvgPaintableClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->dispose = svg_paintable_dispose;
|
||||
object_class->set_property = svg_paintable_set_property;
|
||||
object_class->get_property = svg_paintable_get_property;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_FILE,
|
||||
g_param_spec_object ("file", "File", "File",
|
||||
G_TYPE_FILE,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
GdkPaintable *
|
||||
svg_paintable_new (GFile *file)
|
||||
{
|
||||
return g_object_new (SVG_TYPE_PAINTABLE,
|
||||
"file", file,
|
||||
NULL);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define SVG_TYPE_PAINTABLE (svg_paintable_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (SvgPaintable, svg_paintable, SVG, PAINTABLE, GObject)
|
||||
|
||||
GdkPaintable * svg_paintable_new (GFile *file);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -66,7 +66,6 @@ do_tagged_entry (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Tagged Entry");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 260, -1);
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
tag {
|
||||
margin: 4px 0px;
|
||||
margin: 4px;
|
||||
padding: 4px;
|
||||
border-radius: 4px;
|
||||
background: lightskyblue;
|
||||
@@ -17,7 +17,3 @@ tag button {
|
||||
padding: 0;
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
entry.tagged {
|
||||
border-spacing: 4px;
|
||||
}
|
||||
|
||||
@@ -545,7 +545,6 @@ recursive_attach_view (int depth,
|
||||
return;
|
||||
|
||||
child_view = gtk_text_view_new_with_buffer (gtk_text_view_get_buffer (view));
|
||||
gtk_widget_set_size_request (child_view, 260 - 20 * depth, -1);
|
||||
|
||||
/* Frame is to add a black border around each child view */
|
||||
frame = gtk_frame_new (NULL);
|
||||
@@ -591,8 +590,6 @@ easter_egg_callback (GtkWidget *button,
|
||||
g_object_unref (buffer);
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (gtk_widget_get_root (button)));
|
||||
gtk_window_set_modal (GTK_WINDOW (window), TRUE);
|
||||
sw = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
</object>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="resizable">0</property>
|
||||
<property name="title">Themes</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<child type="start">
|
||||
|
||||
@@ -102,11 +102,12 @@ text_buffer_remove_all_tags (GtkTextBuffer *buffer)
|
||||
}
|
||||
|
||||
static void
|
||||
deserialize_error_func (const GskParseLocation *start_location,
|
||||
const GskParseLocation *end_location,
|
||||
const GError *error,
|
||||
gpointer user_data)
|
||||
deserialize_error_func (const GtkCssSection *section,
|
||||
const GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
const GtkCssLocation *start_location = gtk_css_section_get_start_location (section);
|
||||
const GtkCssLocation *end_location = gtk_css_section_get_end_location (section);
|
||||
NodeEditorWindow *self = user_data;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
TextViewError text_view_error;
|
||||
@@ -465,7 +466,7 @@ save_response_cb (GtkWidget *dialog,
|
||||
text = get_current_text (self->text_buffer);
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
g_file_replace_contents (file, text, strlen (text),
|
||||
g_file_replace_contents (file, text, -1,
|
||||
NULL, FALSE,
|
||||
G_FILE_CREATE_NONE,
|
||||
NULL,
|
||||
|
||||
@@ -164,7 +164,7 @@ save_file (GFile *save_filename)
|
||||
NULL,
|
||||
&error);
|
||||
|
||||
if (error == NULL)
|
||||
if (error != NULL)
|
||||
{
|
||||
if (save_filename != filename)
|
||||
{
|
||||
|
||||
@@ -91,16 +91,6 @@ change_theme_state (GSimpleAction *action,
|
||||
|
||||
static GtkWidget *page_stack;
|
||||
|
||||
static void
|
||||
transition_speed_changed (GtkRange *range,
|
||||
gpointer data)
|
||||
{
|
||||
double value;
|
||||
|
||||
value = gtk_range_get_value (range);
|
||||
gtk_stack_set_transition_duration (GTK_STACK (page_stack), (int)value);
|
||||
}
|
||||
|
||||
static void
|
||||
change_transition_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
@@ -260,8 +250,6 @@ activate_about (GSimpleAction *action,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
GtkWindow *window;
|
||||
GtkWidget *button;
|
||||
const char *authors[] = {
|
||||
"Andrea Cimitan",
|
||||
"Cosimo Cecchi",
|
||||
@@ -279,10 +267,6 @@ activate_about (GSimpleAction *action,
|
||||
|
||||
s = g_string_new ("");
|
||||
|
||||
window = gtk_application_get_active_window (app);
|
||||
button = GTK_WIDGET (g_object_get_data (G_OBJECT (window), "open_menubutton"));
|
||||
gtk_menu_button_popdown (GTK_MENU_BUTTON (button));
|
||||
|
||||
os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
|
||||
os_version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID);
|
||||
if (os_name && os_version)
|
||||
@@ -308,7 +292,6 @@ activate_about (GSimpleAction *action,
|
||||
|
||||
dialog = g_object_new (GTK_TYPE_ABOUT_DIALOG,
|
||||
"transient-for", gtk_application_get_active_window (app),
|
||||
"modal", TRUE,
|
||||
"program-name", "GTK Widget Factory",
|
||||
"version", version,
|
||||
"copyright", "© 1997—2020 The GTK Team",
|
||||
@@ -332,21 +315,6 @@ activate_about (GSimpleAction *action,
|
||||
g_free (os_version);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_shortcuts_window (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
GtkWindow *window;
|
||||
GtkWidget *button;
|
||||
|
||||
window = gtk_application_get_active_window (app);
|
||||
button = GTK_WIDGET (g_object_get_data (G_OBJECT (window), "open_menubutton"));
|
||||
gtk_menu_button_popdown (GTK_MENU_BUTTON (button));
|
||||
gtk_widget_activate_action (GTK_WIDGET (window), "win.show-help-overlay", NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_quit (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
@@ -2054,7 +2022,6 @@ activate (GApplication *app)
|
||||
"validate_more_details", (GCallback)validate_more_details,
|
||||
"mode_switch_state_set", (GCallback)mode_switch_state_set,
|
||||
"level_scale_value_changed", (GCallback)level_scale_value_changed,
|
||||
"transition_speed_changed", (GCallback)transition_speed_changed,
|
||||
NULL);
|
||||
gtk_builder_set_scope (builder, scope);
|
||||
g_object_unref (scope);
|
||||
@@ -2392,7 +2359,6 @@ main (int argc, char *argv[])
|
||||
GAction *action;
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "about", activate_about, NULL, NULL, NULL },
|
||||
{ "shortcuts", activate_shortcuts_window, NULL, NULL, NULL },
|
||||
{ "quit", activate_quit, NULL, NULL, NULL },
|
||||
{ "inspector", activate_inspector, NULL, NULL, NULL },
|
||||
{ "main", NULL, "s", "'steak'", NULL },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<menu id="gear_menu_model">
|
||||
<menu id="gear_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Get Busy</attribute>
|
||||
@@ -40,9 +40,6 @@
|
||||
<attribute name="label" translatable="yes">Transition Pages</attribute>
|
||||
<attribute name="action">win.transition</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="custom">transition-speed</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
@@ -51,7 +48,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
|
||||
<attribute name="action">app.shortcuts</attribute>
|
||||
<attribute name="action">win.show-help-overlay</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_About Widget Factory</attribute>
|
||||
@@ -447,26 +444,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton" id="gear_menu_button">
|
||||
<property name="valign">center</property>
|
||||
<property name="popover">
|
||||
<object class="GtkPopoverMenu" id="gear_menu">
|
||||
<property name="menu-model">gear_menu_model</property>
|
||||
<child type="transition-speed">
|
||||
<object class="GtkScale">
|
||||
<property name="adjustment">
|
||||
<object class="GtkAdjustment">
|
||||
<property name="lower">0</property>
|
||||
<property name="upper">1000</property>
|
||||
<property name="value">250</property>
|
||||
<property name="step-increment">50</property>
|
||||
<property name="page-increment">50</property>
|
||||
<property name="page-size">0</property>
|
||||
</object>
|
||||
</property>
|
||||
<signal name="value-changed" handler="transition_speed_changed"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
<property name="menu-model">gear_menu</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -1145,7 +1123,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Caption</property>
|
||||
<style><class name="caption"/></style>
|
||||
<style><class name="Caption"/></style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -3220,7 +3198,7 @@ bad things might happen.</property>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="halign">end</property>
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
<property name="menu-model">gear_menu_model</property>
|
||||
<property name="menu-model">gear_menu</property>
|
||||
<property name="tooltip-text">This is a menu button</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
@@ -3304,6 +3282,246 @@ bad things might happen.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="new_style_menu">
|
||||
<style><class name="menu"/></style>
|
||||
<child>
|
||||
<object class="GtkStack">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">main</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="circular-buttons"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">printer-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="action-name">win.print</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="halign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">emblem-shared-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
<property name="action-name">app.share</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="halign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Open in New Window</property>
|
||||
<property name="action-name">app.open-in</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="inline-buttons"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkLabel" id="cut_copy_paste_filler"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Edit</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">edit-cut-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">edit-copy-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="icon">
|
||||
<object class="GThemedIcon">
|
||||
<property name="name">edit-paste-symbolic</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="iconic">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Pin</property>
|
||||
<property name="action-name">app.pin</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Select Labels…</property>
|
||||
<property name="action-name">app.labels</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Share…</property>
|
||||
<property name="action-name">app.share</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Basement</property>
|
||||
<property name="menu-name">basement</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Large</property>
|
||||
<property name="action-name">app.size</property>
|
||||
<property name="action-target">'large'</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Medium</property>
|
||||
<property name="action-name">app.size</property>
|
||||
<property name="action-target">'medium'</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Small</property>
|
||||
<property name="action-name">app.size</property>
|
||||
<property name="action-target">'small'</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Move to Trash</property>
|
||||
<property name="action-name">win.delete</property>
|
||||
<property name="indicator-size-group">main-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">basement</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Basement</property>
|
||||
<property name="role">title</property>
|
||||
<property name="menu-name">main</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Berk</property>
|
||||
<property name="action-name">app.berk</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Broni</property>
|
||||
<property name="action-name">app.broni</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">Drutt</property>
|
||||
<property name="action-name">app.drutt</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="text">The Thing Upstairs</property>
|
||||
<property name="action-name">app.upstairs</property>
|
||||
<property name="indicator-size-group">basement-indicators</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkSizeGroup" id="main-indicators">
|
||||
<widgets>
|
||||
<widget name="cut_copy_paste_filler"/>
|
||||
</widgets>
|
||||
</object>
|
||||
<object class="GtkSizeGroup" id="basement-indicators"/>
|
||||
<menu id="new_style_menu_model">
|
||||
<section>
|
||||
|
||||
@@ -16,16 +16,14 @@
|
||||
</releaseinfo>
|
||||
</bookinfo>
|
||||
|
||||
<chapter>
|
||||
<reference id="reference">
|
||||
<title>API Reference</title>
|
||||
<xi:include href="xml/general.xml" />
|
||||
<xi:include href="xml/gdkdisplaymanager.xml" />
|
||||
<xi:include href="xml/gdkdisplay.xml" />
|
||||
<xi:include href="xml/gdkseat.xml" />
|
||||
<xi:include href="xml/gdkdevice.xml" />
|
||||
<section>
|
||||
<xi:include href="xml/gdkdevicepad.xml" />
|
||||
</section>
|
||||
<xi:include href="xml/gdkdevicepad.xml" />
|
||||
<xi:include href="xml/gdkmonitor.xml" />
|
||||
<xi:include href="xml/regions.xml" />
|
||||
<xi:include href="xml/textures.xml" />
|
||||
@@ -34,24 +32,16 @@
|
||||
<xi:include href="xml/cursors.xml" />
|
||||
<xi:include href="xml/gdksurface.xml" />
|
||||
<xi:include href="xml/gdktoplevel.xml" />
|
||||
<section>
|
||||
<xi:include href="xml/gdktoplevellayout.xml" />
|
||||
<xi:include href="xml/gdktoplevelsize.xml" />
|
||||
</section>
|
||||
<xi:include href="xml/gdktoplevellayout.xml" />
|
||||
<xi:include href="xml/gdktoplevelsize.xml" />
|
||||
<xi:include href="xml/gdkpopup.xml" />
|
||||
<section>
|
||||
<xi:include href="xml/gdkpopuplayout.xml" />
|
||||
</section>
|
||||
<xi:include href="xml/gdkpopuplayout.xml" />
|
||||
<xi:include href="xml/gdkframeclock.xml" />
|
||||
<section>
|
||||
<xi:include href="xml/gdkframetimings.xml" />
|
||||
</section>
|
||||
<xi:include href="xml/gdkframetimings.xml" />
|
||||
<xi:include href="xml/gdkdrawcontext.xml" />
|
||||
<section>
|
||||
<xi:include href="xml/gdkglcontext.xml" />
|
||||
<xi:include href="xml/gdkvulkancontext.xml" />
|
||||
<xi:include href="xml/gdkcairocontext.xml" />
|
||||
</section>
|
||||
<xi:include href="xml/gdkglcontext.xml" />
|
||||
<xi:include href="xml/gdkvulkancontext.xml" />
|
||||
<xi:include href="xml/gdkcairocontext.xml" />
|
||||
<xi:include href="xml/events.xml" />
|
||||
<xi:include href="xml/keys.xml" />
|
||||
<xi:include href="xml/gdkclipboard.xml" />
|
||||
@@ -60,16 +50,13 @@
|
||||
<xi:include href="xml/gdkcontentprovider.xml" />
|
||||
<xi:include href="xml/gdkcontentserializer.xml" />
|
||||
<xi:include href="xml/gdkcontentdeserializer.xml" />
|
||||
<xi:include href="xml/gdkapplaunchcontext.xml" />
|
||||
<xi:include href="xml/pixbufs.xml" />
|
||||
<xi:include href="xml/pango_interaction.xml" />
|
||||
<xi:include href="xml/cairo_interaction.xml" />
|
||||
</chapter>
|
||||
<chapter>
|
||||
<title>GDK Platform Support</title>
|
||||
<xi:include href="xml/gdkapplaunchcontext.xml" />
|
||||
<xi:include href="xml/x_interaction.xml" />
|
||||
<xi:include href="xml/wayland_interaction.xml" />
|
||||
</chapter>
|
||||
</reference>
|
||||
|
||||
<index id="api-index-full">
|
||||
<title>Index of all symbols</title>
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
</MACRO>
|
||||
|
||||
<MACRO>
|
||||
<NAME>GDK_WINDOWING_MACOS</NAME>
|
||||
#define GDK_WINDOWING_MACOS
|
||||
<NAME>GDK_WINDOWING_QUARTZ</NAME>
|
||||
#define GDK_WINDOWING_QUARTZ
|
||||
</MACRO>
|
||||
|
||||
<MACRO>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<SUBSECTION>
|
||||
GDK_WINDOWING_X11
|
||||
GDK_WINDOWING_WIN32
|
||||
GDK_WINDOWING_MACOS
|
||||
GDK_WINDOWING_QUARTZ
|
||||
GDK_WINDOWING_WAYLAND
|
||||
|
||||
<SUBSECTION>
|
||||
@@ -303,8 +303,11 @@ gdk_cairo_draw_from_gl
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Rectangles and Regions</TITLE>
|
||||
<TITLE>Points, Rectangles and Regions</TITLE>
|
||||
<FILE>regions</FILE>
|
||||
GdkPoint
|
||||
|
||||
<SUBSECTION>
|
||||
GdkRectangle
|
||||
gdk_rectangle_intersect
|
||||
gdk_rectangle_union
|
||||
@@ -958,6 +961,7 @@ gdk_wayland_display_query_registry
|
||||
gdk_wayland_display_set_cursor_theme
|
||||
gdk_wayland_display_get_startup_notification_id
|
||||
gdk_wayland_display_set_startup_notification_id
|
||||
gdk_wayland_display_prefers_ssd
|
||||
gdk_wayland_display_query_registry
|
||||
|
||||
<SUBSECTION Device>
|
||||
@@ -965,7 +969,8 @@ gdk_wayland_seat_get_wl_seat
|
||||
gdk_wayland_device_get_wl_seat
|
||||
gdk_wayland_device_get_wl_pointer
|
||||
gdk_wayland_device_get_wl_keyboard
|
||||
gdk_wayland_device_get_node_path
|
||||
gdk_wayland_device_get_node_ath
|
||||
gdk_wayland_device_pad_set_feedback
|
||||
|
||||
<SUBSECTION Monitor>
|
||||
gdk_wayland_monitor_get_wl_output
|
||||
@@ -977,6 +982,9 @@ gdk_wayland_toplevel_export_handle
|
||||
gdk_wayland_toplevel_unexport_handle
|
||||
gdk_wayland_toplevel_set_transient_for_exported
|
||||
gdk_wayland_toplevel_set_application_id
|
||||
gdk_wayland_toplevel_announce_csd
|
||||
gdk_wayland_toplevel_inhibit_idle
|
||||
gdk_wayland_toplevel_uninhibit_idle
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_WAYLAND_DEVICE
|
||||
|
||||
@@ -64,46 +64,46 @@ gsk_render_node_get_bounds
|
||||
|
||||
<SUBSECTION Nodes>
|
||||
gsk_color_node_new
|
||||
gsk_color_node_get_color
|
||||
gsk_color_node_peek_color
|
||||
gsk_texture_node_new
|
||||
gsk_texture_node_get_texture
|
||||
GskColorStop
|
||||
gsk_linear_gradient_node_new
|
||||
gsk_linear_gradient_node_get_start
|
||||
gsk_linear_gradient_node_get_end
|
||||
gsk_linear_gradient_node_peek_start
|
||||
gsk_linear_gradient_node_peek_end
|
||||
gsk_linear_gradient_node_get_n_color_stops
|
||||
gsk_linear_gradient_node_get_color_stops
|
||||
gsk_linear_gradient_node_peek_color_stops
|
||||
gsk_repeating_linear_gradient_node_new
|
||||
gsk_radial_gradient_node_new
|
||||
gsk_radial_gradient_node_get_n_color_stops
|
||||
gsk_radial_gradient_node_get_color_stops
|
||||
gsk_radial_gradient_node_peek_color_stops
|
||||
gsk_radial_gradient_node_get_start
|
||||
gsk_radial_gradient_node_get_end
|
||||
gsk_radial_gradient_node_get_hradius
|
||||
gsk_radial_gradient_node_get_vradius
|
||||
gsk_radial_gradient_node_get_center
|
||||
gsk_radial_gradient_node_peek_center
|
||||
gsk_repeating_radial_gradient_node_new
|
||||
gsk_border_node_new
|
||||
gsk_border_node_get_outline
|
||||
gsk_border_node_get_widths
|
||||
gsk_border_node_get_colors
|
||||
gsk_border_node_peek_outline
|
||||
gsk_border_node_peek_widths
|
||||
gsk_border_node_peek_colors
|
||||
gsk_inset_shadow_node_new
|
||||
gsk_inset_shadow_node_get_outline
|
||||
gsk_inset_shadow_node_get_color
|
||||
gsk_inset_shadow_node_peek_outline
|
||||
gsk_inset_shadow_node_peek_color
|
||||
gsk_inset_shadow_node_get_dx
|
||||
gsk_inset_shadow_node_get_dy
|
||||
gsk_inset_shadow_node_get_spread
|
||||
gsk_inset_shadow_node_get_blur_radius
|
||||
gsk_outset_shadow_node_new
|
||||
gsk_outset_shadow_node_get_outline
|
||||
gsk_outset_shadow_node_get_color
|
||||
gsk_outset_shadow_node_peek_outline
|
||||
gsk_outset_shadow_node_peek_color
|
||||
gsk_outset_shadow_node_get_dx
|
||||
gsk_outset_shadow_node_get_dy
|
||||
gsk_outset_shadow_node_get_spread
|
||||
gsk_outset_shadow_node_get_blur_radius
|
||||
gsk_cairo_node_new
|
||||
gsk_cairo_node_get_draw_context
|
||||
gsk_cairo_node_get_surface
|
||||
gsk_cairo_node_peek_surface
|
||||
gsk_container_node_new
|
||||
gsk_container_node_get_n_children
|
||||
gsk_container_node_get_child
|
||||
@@ -115,20 +115,20 @@ gsk_opacity_node_get_child
|
||||
gsk_opacity_node_get_opacity
|
||||
gsk_color_matrix_node_new
|
||||
gsk_color_matrix_node_get_child
|
||||
gsk_color_matrix_node_get_color_matrix
|
||||
gsk_color_matrix_node_get_color_offset
|
||||
gsk_color_matrix_node_peek_color_matrix
|
||||
gsk_color_matrix_node_peek_color_offset
|
||||
gsk_repeat_node_new
|
||||
gsk_repeat_node_get_child
|
||||
gsk_repeat_node_get_child_bounds
|
||||
gsk_repeat_node_peek_child_bounds
|
||||
gsk_clip_node_new
|
||||
gsk_clip_node_get_child
|
||||
gsk_clip_node_get_clip
|
||||
gsk_clip_node_peek_clip
|
||||
gsk_rounded_clip_node_new
|
||||
gsk_rounded_clip_node_get_child
|
||||
gsk_rounded_clip_node_get_clip
|
||||
gsk_rounded_clip_node_peek_clip
|
||||
GskShadow
|
||||
gsk_shadow_node_new
|
||||
gsk_shadow_node_get_shadow
|
||||
gsk_shadow_node_peek_shadow
|
||||
gsk_shadow_node_get_n_shadows
|
||||
gsk_shadow_node_get_child
|
||||
GskBlendMode
|
||||
@@ -141,9 +141,9 @@ gsk_cross_fade_node_get_start_child
|
||||
gsk_cross_fade_node_get_end_child
|
||||
gsk_cross_fade_node_get_progress
|
||||
gsk_text_node_new
|
||||
gsk_text_node_get_font
|
||||
gsk_text_node_get_glyphs
|
||||
gsk_text_node_get_color
|
||||
gsk_text_node_peek_font
|
||||
gsk_text_node_peek_glyphs
|
||||
gsk_text_node_peek_color
|
||||
gsk_text_node_has_color_glyphs
|
||||
gsk_text_node_get_num_glyphs
|
||||
gsk_text_node_get_offset
|
||||
|
||||
@@ -107,9 +107,7 @@ The `plain` build type provided by Meson should only be used when
|
||||
packaging GTK, and it's expected that packagers will provide their
|
||||
own compiler flags when building GTK. See the previous section for
|
||||
the list of environment variables to be used to define compiler and
|
||||
linker flags. Note that with the plain build type, you are also
|
||||
responsible for controlling the debugging features of GTK with
|
||||
`-DG_ENABLE_DEBUG` and `-DG_DISABLE_CAST_CHECKS`.
|
||||
linker flags.
|
||||
|
||||
## Dependencies {#dependencies}
|
||||
|
||||
@@ -161,8 +159,7 @@ Other libraries are maintained separately.
|
||||
fonts and matching them against font names.
|
||||
- [Cairo](https://www.cairographics.org) is a graphics library that
|
||||
supports vector graphics and image compositing. Both Pango and GTK
|
||||
use Cairo for drawing. Note that we also need the auxiliary cairo-gobject
|
||||
library.
|
||||
use Cairo for drawing.
|
||||
- [libepoxy](https://github.com/anholt/libepoxy) is a library that
|
||||
abstracts the differences between different OpenGL libraries. GTK
|
||||
uses it for cross-platform GL support and for its own drawing.
|
||||
|
||||
@@ -586,53 +586,53 @@ print_hello (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static void
|
||||
quit_cb (GtkWindow *window)
|
||||
quit_cb (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
gtk_window_close (window);
|
||||
}
|
||||
gboolean *done = data;
|
||||
|
||||
static void
|
||||
activate (GtkApplication *app,
|
||||
gpointer user_data)
|
||||
{
|
||||
/* Construct a GtkBuilder instance and load our UI description */
|
||||
GtkBuilder *builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_file (builder, "builder.ui", NULL);
|
||||
*done = TRUE;
|
||||
|
||||
/* Connect signal handlers to the constructed widgets. */
|
||||
GObject *window = gtk_builder_get_object (builder, "window");
|
||||
gtk_window_set_application (GTK_WINDOW (window), app);
|
||||
|
||||
GObject *button = gtk_builder_get_object (builder, "button1");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
||||
|
||||
button = gtk_builder_get_object (builder, "button2");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
||||
|
||||
button = gtk_builder_get_object (builder, "quit");
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (quit_cb), window);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (window));
|
||||
|
||||
/* We do not need the builder any more */
|
||||
g_object_unref (builder);
|
||||
g_main_context_wakeup (NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GObject *window;
|
||||
GObject *button;
|
||||
gboolean done = FALSE;
|
||||
|
||||
#ifdef GTK_SRCDIR
|
||||
g_chdir (GTK_SRCDIR);
|
||||
#endif
|
||||
|
||||
GtkApplication *app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
gtk_init ();
|
||||
|
||||
int status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
/* Construct a GtkBuilder instance and load our UI description */
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_file (builder, "builder.ui", NULL);
|
||||
|
||||
return status;
|
||||
/* Connect signal handlers to the constructed widgets. */
|
||||
window = gtk_builder_get_object (builder, "window");
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (quit_cb), &done);
|
||||
|
||||
button = gtk_builder_get_object (builder, "button1");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
||||
|
||||
button = gtk_builder_get_object (builder, "button2");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
||||
|
||||
button = gtk_builder_get_object (builder, "quit");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (quit_cb), &done);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (window));
|
||||
|
||||
while (!done)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -971,7 +971,6 @@ gtk_editable_get_enable_undo
|
||||
gtk_editable_set_enable_undo
|
||||
<SUBSECTION>
|
||||
gtk_editable_install_properties
|
||||
gtk_editable_get_delegate
|
||||
gtk_editable_init_delegate
|
||||
gtk_editable_finish_delegate
|
||||
gtk_editable_delegate_set_property
|
||||
@@ -1432,7 +1431,6 @@ GTK_TYPE_BOOKMARK_LIST
|
||||
<FILE>gtkfilter</FILE>
|
||||
<TITLE>GtkFilter</TITLE>
|
||||
GtkFilter
|
||||
GtkFilterMatch
|
||||
gtk_filter_match
|
||||
gtk_filter_get_strictness
|
||||
<SUBSECTION>
|
||||
@@ -2108,7 +2106,6 @@ gtk_native_dialog_get_type
|
||||
<TITLE>GtkNotebook</TITLE>
|
||||
GtkNotebook
|
||||
GtkNotebookPage
|
||||
GtkNotebookTab
|
||||
gtk_notebook_new
|
||||
gtk_notebook_get_page
|
||||
gtk_notebook_get_pages
|
||||
@@ -2165,6 +2162,7 @@ GTK_NOTEBOOK_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_notebook_get_type
|
||||
gtk_notebook_page_get_type
|
||||
GtkNotebookTab
|
||||
GtkNotebookPrivate
|
||||
</SECTION>
|
||||
|
||||
@@ -4336,6 +4334,7 @@ gtk_snapshot_render_background
|
||||
gtk_snapshot_render_frame
|
||||
gtk_snapshot_render_focus
|
||||
gtk_snapshot_render_layout
|
||||
gtk_snapshot_render_insertion_cursor
|
||||
<SUBSECTION Private>
|
||||
gtk_snapshot_get_type
|
||||
</SECTION>
|
||||
@@ -4845,6 +4844,7 @@ gtk_render_line
|
||||
gtk_render_option
|
||||
gtk_render_activity
|
||||
gtk_render_icon
|
||||
gtk_render_insertion_cursor
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_STYLE_CONTEXT
|
||||
@@ -6150,8 +6150,6 @@ gtk_popover_get_has_arrow
|
||||
gtk_popover_set_offset
|
||||
gtk_popover_get_offset
|
||||
gtk_popover_set_default_widget
|
||||
gtk_popover_set_cascade_popdown
|
||||
gtk_popover_get_cascade_popdown
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_POPOVER
|
||||
GTK_IS_POPOVER
|
||||
@@ -6176,8 +6174,6 @@ gtk_popover_menu_new_from_model
|
||||
gtk_popover_menu_new_from_model_full
|
||||
gtk_popover_menu_set_menu_model
|
||||
gtk_popover_menu_get_menu_model
|
||||
gtk_popover_menu_add_child
|
||||
gtk_popover_menu_remove_child
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_POPOVER_MENU
|
||||
@@ -6196,8 +6192,6 @@ GtkPopoverMenuBar
|
||||
gtk_popover_menu_bar_new_from_model
|
||||
gtk_popover_menu_bar_set_menu_model
|
||||
gtk_popover_menu_bar_get_menu_model
|
||||
gtk_popover_menu_bar_add_child
|
||||
gtk_popover_menu_bar_remove_child
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_POPOVER_MENU_BAR
|
||||
|
||||
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.3 KiB |