Compare commits
301 Commits
ci-introsp
...
wip/toolti
Author | SHA1 | Date | |
---|---|---|---|
|
abcf2e3bf7 | ||
|
a123d99fcd | ||
|
4f760a9a2a | ||
|
7e6be71d38 | ||
|
ed46982cc5 | ||
|
e92270f928 | ||
|
79a96b9bef | ||
|
ff55264e60 | ||
|
3d6fdffb7c | ||
|
b14339dc56 | ||
|
f2dce6d847 | ||
|
53ca60adbf | ||
|
20f160495d | ||
|
61d39a09a5 | ||
|
0e251906fb | ||
|
2cc6c4d2d1 | ||
|
6efdaa9ffd | ||
|
d06cdf6318 | ||
|
7df572d308 | ||
|
739137ccf9 | ||
|
42ca760f9c | ||
|
57d3719583 | ||
|
0b5b350f3e | ||
|
236fc57329 | ||
|
7686b13a1e | ||
|
56d3a79990 | ||
|
ddd113ac98 | ||
|
962de8f1ee | ||
|
2415c02bbd | ||
|
e25cb8b907 | ||
|
6fc706f983 | ||
|
e09287a109 | ||
|
efe21869fb | ||
|
2f898e8bb9 | ||
|
059cc3b818 | ||
|
68011e99ac | ||
|
d2b508d95c | ||
|
433295127c | ||
|
24e3556c30 | ||
|
c17aa12235 | ||
|
40c8d8ba9f | ||
|
92fc2156ff | ||
|
4f08b4be9c | ||
|
94202e6339 | ||
|
5815604853 | ||
|
f47aba05b0 | ||
|
8239186c26 | ||
|
3a5fdfcfda | ||
|
8007891132 | ||
|
b0fe4dec2c | ||
|
b86d81872c | ||
|
1e0f860a75 | ||
|
8efebbaf46 | ||
|
56e590bd31 | ||
|
64b673853b | ||
|
3872da535f | ||
|
1f0024a7f0 | ||
|
cb94c7d69e | ||
|
82e92582bd | ||
|
92bcf4c7a7 | ||
|
b21a027d10 | ||
|
cad890ee29 | ||
|
e4894a69d4 | ||
|
0aec11f292 | ||
|
7280618c7d | ||
|
6c8f5f9d17 | ||
|
91d261a0b3 | ||
|
77ffc1f9ed | ||
|
8ad49b33ed | ||
|
79d6190684 | ||
|
edc57e4282 | ||
|
baf82cdf7a | ||
|
3fa691a1ab | ||
|
053617a283 | ||
|
40926a28ee | ||
|
e2058aaecd | ||
|
efd009e6d8 | ||
|
b32519966f | ||
|
8bb133072d | ||
|
926764be0d | ||
|
b96509c030 | ||
|
81c68b86ea | ||
|
824c730362 | ||
|
a4cfbec5c2 | ||
|
84944f1c63 | ||
|
1086acce92 | ||
|
d03b1524e6 | ||
|
82f4b1630c | ||
|
77d15b1751 | ||
|
401f8a7f31 | ||
|
3d4bb76694 | ||
|
327da3de9a | ||
|
d46252ca21 | ||
|
d2cbc454f6 | ||
|
49fcf41693 | ||
|
8baefaf4d8 | ||
|
c60ffeedfa | ||
|
c8066bcd8b | ||
|
9f4cea190a | ||
|
7639d3daa0 | ||
|
8683925fe0 | ||
|
4c7cafdba8 | ||
|
03f145e868 | ||
|
1b44a64ef7 | ||
|
37e381e95d | ||
|
e0f95844c1 | ||
|
539f06147a | ||
|
d2b55dff2d | ||
|
0070cff32d | ||
|
88e890c29c | ||
|
e33da18577 | ||
|
cda1a25a5a | ||
|
a9103ccd7c | ||
|
8effa10e79 | ||
|
7906f09c75 | ||
|
4cdb9ed322 | ||
|
b74a3de299 | ||
|
774d61c682 | ||
|
642924a0f1 | ||
|
d827fe711d | ||
|
d328374c94 | ||
|
7f009b9952 | ||
|
27b4b5ee32 | ||
|
0e73bfa202 | ||
|
fb9b54d4b2 | ||
|
cdb4d71125 | ||
|
8b4d84981e | ||
|
4996097219 | ||
|
0c4dcd9d57 | ||
|
aaecb3d84b | ||
|
771b3ea6f3 | ||
|
75e202f02b | ||
|
94d3fd84b5 | ||
|
a40abcf74d | ||
|
9f90eb41c8 | ||
|
4b9e5304cc | ||
|
ef623aaabc | ||
|
de40b0b061 | ||
|
356dea3349 | ||
|
63bbc79f48 | ||
|
d80c130d7f | ||
|
14b27446a3 | ||
|
289b157e32 | ||
|
85237c8665 | ||
|
61195df7a3 | ||
|
ce07c0559d | ||
|
f4edbdfc1f | ||
|
526187d36c | ||
|
96673d5106 | ||
|
88f5d4547c | ||
|
34976a791c | ||
|
ad73afcd79 | ||
|
4735d38e31 | ||
|
17c21513a8 | ||
|
3c165b3b77 | ||
|
cac514f647 | ||
|
8d0773fad0 | ||
|
fa848e94d2 | ||
|
d8e47383cb | ||
|
dec5707ca9 | ||
|
0ec5a3f0d9 | ||
|
aae25c4fa0 | ||
|
ec394e805b | ||
|
5d26af06e4 | ||
|
44f9a51827 | ||
|
e2781af16f | ||
|
b96d7b62d1 | ||
|
edd5d36159 | ||
|
77af8e303d | ||
|
53f9737dcf | ||
|
3a9883b3ca | ||
|
99ef14b59f | ||
|
e2abe6dd29 | ||
|
12ecbd1508 | ||
|
b8d1a9eb0d | ||
|
41322e2a7a | ||
|
649ae635a7 | ||
|
686be577d5 | ||
|
9a65ed9ada | ||
|
f59f355190 | ||
|
b9b1bf85e1 | ||
|
4aa5fba0b5 | ||
|
97d0e8c6e0 | ||
|
07441ad000 | ||
|
183431c918 | ||
|
af6e0ee2b3 | ||
|
04e4a02cd0 | ||
|
9d7b77f874 | ||
|
67759d4c3e | ||
|
54b613392b | ||
|
ee1f8d8d06 | ||
|
8e261056b9 | ||
|
ee284a560a | ||
|
e098ffb88d | ||
|
e9ddf0fda5 | ||
|
937c94bab5 | ||
|
71433d01b3 | ||
|
4a133b4eef | ||
|
5b06b08a0e | ||
|
1f63896c6b | ||
|
e137152520 | ||
|
25826eafe3 | ||
|
1706b80815 | ||
|
7f975472a7 | ||
|
8c1072fad1 | ||
|
188a61f02d | ||
|
2d1b7d128e | ||
|
9dfac6fe3f | ||
|
a3f042b5b4 | ||
|
d62e2faee6 | ||
|
53d86d411a | ||
|
8bd2043a40 | ||
|
d2b5beffbf | ||
|
d64d46912e | ||
|
837b141747 | ||
|
92ac66f16a | ||
|
130ae89e54 | ||
|
77cf6cd406 | ||
|
2dcb2400d1 | ||
|
8127d70b8a | ||
|
ab0ad4a0d7 | ||
|
05ad3c543a | ||
|
b4d5ddcae5 | ||
|
817112ab3c | ||
|
0b4a1bb62f | ||
|
80867acf94 | ||
|
32740a720a | ||
|
fd1fe0eed5 | ||
|
fa90747815 | ||
|
c31431c5fa | ||
|
e393465fd7 | ||
|
8653a5e27b | ||
|
431545877e | ||
|
c3c2bc513e | ||
|
ab59562170 | ||
|
3f1bd3722d | ||
|
120f13c95d | ||
|
4822e02be3 | ||
|
6b4bed2c7a | ||
|
739f681076 | ||
|
c2e4e1af73 | ||
|
35d50f88c8 | ||
|
fa0509c473 | ||
|
67822d0c9a | ||
|
43a453e465 | ||
|
74dcbae1f3 | ||
|
850549ba83 | ||
|
689673188b | ||
|
b1bedbc71a | ||
|
f31c85ff99 | ||
|
cb056a1e8f | ||
|
57bf4ac59a | ||
|
8165616b3c | ||
|
e3b9f9a3bf | ||
|
99c3928cec | ||
|
2fa876e839 | ||
|
700a2df110 | ||
|
efa4174828 | ||
|
e5c430266e | ||
|
3bbcaa9e8f | ||
|
11351eb76b | ||
|
062f0fe0b2 | ||
|
02ac248541 | ||
|
662539acf7 | ||
|
4a44c1b7bf | ||
|
f8ef15b555 | ||
|
76cc1cae00 | ||
|
1b64a17547 | ||
|
f1741584e6 | ||
|
55d2f190ef | ||
|
3209d0f937 | ||
|
d0a8d263ac | ||
|
6d9db8610e | ||
|
ac3d3c647e | ||
|
91d8c230f3 | ||
|
b47e721ab6 | ||
|
0a2e0775b6 | ||
|
c4a47e218f | ||
|
2e2121c7ad | ||
|
5f01f6f36b | ||
|
5ec53e6a11 | ||
|
b968ced567 | ||
|
3fee02808b | ||
|
dc7081599d | ||
|
ccb890f065 | ||
|
6784772c9d | ||
|
65c56ea812 | ||
|
064eb6a87f | ||
|
c6104fe7fd | ||
|
555230ec9c | ||
|
2a11f5f889 | ||
|
f66950f48c | ||
|
5477c1cdfe | ||
|
75c75e001c | ||
|
af32092f16 | ||
|
b54ef5c398 | ||
|
473709fee3 | ||
|
a837b57849 | ||
|
12adf6362f | ||
|
80185b0f2a | ||
|
99dd33a9a3 |
@@ -99,12 +99,12 @@ release-build:
|
||||
.mingw-defaults: &mingw-defaults
|
||||
stage: build
|
||||
tags:
|
||||
- win32
|
||||
- win32-ps
|
||||
script:
|
||||
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu
|
||||
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
|
||||
cache:
|
||||
key: "%CI_JOB_NAME%"
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
|
||||
msys2-mingw32:
|
||||
|
@@ -34,7 +34,7 @@ pacman --noconfirm -S --needed \
|
||||
mingw-w64-$MSYS2_ARCH-shared-mime-info
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/gtk/issues/2243
|
||||
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
|
||||
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner-v2/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
|
||||
pacman --noconfirm -U "mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
|
||||
|
||||
mkdir -p _ccache
|
||||
@@ -45,11 +45,14 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
export CCACHE_DISABLE=true
|
||||
# FIXME: introspection disabled for now because of
|
||||
# https://gitlab.gnome.org/GNOME/gobject-introspection/-/issues/340
|
||||
meson \
|
||||
-Dx11-backend=false \
|
||||
-Dwayland-backend=false \
|
||||
-Dwin32-backend=true \
|
||||
-Dvulkan=no \
|
||||
-Dintrospection=false \
|
||||
--werror \
|
||||
_build
|
||||
unset CCACHE_DISABLE
|
||||
|
@@ -22,12 +22,7 @@ Please, do not use the issue tracker for support questions. If you have
|
||||
questions on how to use GTK effectively, you can use:
|
||||
|
||||
- the `#gtk` IRC channel on irc.gnome.org
|
||||
- the [gtk](https://mail.gnome.org/mailman/listinfo/gtk-list) mailing list,
|
||||
for general questions on GTK
|
||||
- the [gtk-app-devel](https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list)
|
||||
mailing list, for questions on application development with GTK
|
||||
- the [gtk-devel](https://mail.gnome.org/mailman/listinfo/gtk-devel-list)
|
||||
mailing list, for questions on developing GTK itself
|
||||
- the [gtk tag on the GNOME Discourse instance](https://discourse.gnome.org/tag/gtk)
|
||||
|
||||
You can also look at the GTK tag on [Stack
|
||||
Overflow](https://stackoverflow.com/questions/tagged/gtk).
|
||||
|
12
README.md
12
README.md
@@ -27,9 +27,9 @@ The official developers blog
|
||||
|
||||
- https://blog.gtk.org
|
||||
|
||||
Information about mailing lists can be found at
|
||||
Discussion forum
|
||||
|
||||
- http://www.gtk.org/mailing-lists.php
|
||||
- https://discourse.gnome.org/c/platform/core/
|
||||
|
||||
Nightly documentation can be found at
|
||||
- Gtk: https://gnome.pages.gitlab.gnome.org/gtk/gtk/
|
||||
@@ -140,6 +140,12 @@ In the bug report please include:
|
||||
* Further information such as stack traces may be useful, but
|
||||
is not necessary.
|
||||
|
||||
Contributing to GTK
|
||||
-------------------
|
||||
|
||||
Please, follow the [contribution guide](./CONTRIBUTING.md) to know how to
|
||||
start contributing to GTK.
|
||||
|
||||
Release notes
|
||||
-------------
|
||||
|
||||
@@ -156,4 +162,4 @@ GTK is released under the terms of the GNU Lesser General Public License,
|
||||
version 2.1 or, at your option, any later version, as published by the Free
|
||||
Software Foundation.
|
||||
|
||||
Please, see the `COPYING` file for further information.
|
||||
Please, see the [`COPYING`](./COPYING) file for further information.
|
||||
|
@@ -426,7 +426,7 @@ edit_constraint (ConstraintEditorWindow *win,
|
||||
|
||||
editor = constraint_editor_new (model, constraint);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
|
||||
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
|
||||
|
||||
g_signal_connect (editor, "done", G_CALLBACK (constraint_editor_done), win);
|
||||
|
||||
@@ -460,7 +460,7 @@ edit_guide (ConstraintEditorWindow *win,
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Edit Guide");
|
||||
|
||||
editor = guide_editor_new (guide);
|
||||
gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (editor));
|
||||
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
|
||||
|
||||
g_signal_connect (editor, "done", G_CALLBACK (guide_editor_done), win);
|
||||
gtk_widget_show (window);
|
||||
|
@@ -9,7 +9,6 @@
|
||||
<property name="default-height">768</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="title" translatable="yes">GTK Constraint Editor</property>
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
|
@@ -216,7 +216,7 @@ constraint_view_add_child (ConstraintView *view,
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_add_css_class (frame, "child");
|
||||
gtk_widget_set_name (frame, name);
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), label);
|
||||
gtk_widget_set_parent (frame, GTK_WIDGET (view));
|
||||
|
||||
update_weak_position (view, frame, 100, 100);
|
||||
@@ -259,7 +259,7 @@ constraint_view_add_guide (ConstraintView *view,
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_add_css_class (frame, "guide");
|
||||
g_object_set_data (G_OBJECT (frame), "internal", (char *)"yes");
|
||||
gtk_container_add (GTK_CONTAINER (frame), label);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), label);
|
||||
gtk_widget_insert_after (frame, GTK_WIDGET (view), NULL);
|
||||
|
||||
g_object_set_data (G_OBJECT (guide), "frame", frame);
|
||||
|
@@ -503,13 +503,13 @@ demo_application_window_unrealize (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
demo_application_window_destroy (GtkWidget *widget)
|
||||
demo_application_window_dispose (GObject *object)
|
||||
{
|
||||
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
|
||||
DemoApplicationWindow *window = (DemoApplicationWindow *)object;
|
||||
|
||||
demo_application_window_store_state (window);
|
||||
|
||||
GTK_WIDGET_CLASS (demo_application_window_parent_class)->destroy (widget);
|
||||
G_OBJECT_CLASS (demo_application_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -519,11 +519,11 @@ demo_application_window_class_init (DemoApplicationWindowClass *class)
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->constructed = demo_application_window_constructed;
|
||||
object_class->dispose = demo_application_window_dispose;
|
||||
|
||||
widget_class->size_allocate = demo_application_window_size_allocate;
|
||||
widget_class->realize = demo_application_window_realize;
|
||||
widget_class->unrealize = demo_application_window_unrealize;
|
||||
widget_class->destroy = demo_application_window_destroy;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/application_demo/application.ui");
|
||||
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, message);
|
||||
|
@@ -39,7 +39,7 @@ enum {
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
static GQuark child_data_quark = 0;
|
||||
|
||||
G_DEFINE_TYPE (BlurOverlay, blur_overlay, GTK_TYPE_BIN)
|
||||
G_DEFINE_TYPE (BlurOverlay, blur_overlay, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
blur_overlay_set_overlay_child (GtkWidget *widget,
|
||||
@@ -204,7 +204,7 @@ blur_overlay_size_allocate (GtkWidget *widget,
|
||||
GtkWidget *child;
|
||||
GtkWidget *main_widget;
|
||||
|
||||
main_widget = gtk_bin_get_child (GTK_BIN (overlay));
|
||||
main_widget = overlay->main_widget;
|
||||
if (main_widget && gtk_widget_get_visible (main_widget))
|
||||
gtk_widget_size_allocate (main_widget,
|
||||
&(GtkAllocation) {
|
||||
@@ -290,43 +290,6 @@ blur_overlay_get_child_position (BlurOverlay *overlay,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
blur_overlay_add (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
BlurOverlay *overlay = BLUR_OVERLAY (container);
|
||||
gtk_widget_insert_after (widget, GTK_WIDGET (container), NULL);
|
||||
overlay->main_widget = widget;
|
||||
}
|
||||
|
||||
static void
|
||||
blur_overlay_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
BlurOverlay *overlay = BLUR_OVERLAY (container);
|
||||
gtk_widget_unparent (widget);
|
||||
if (overlay->main_widget == widget)
|
||||
overlay->main_widget = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
blur_overlay_forall (GtkContainer *overlay,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
child = gtk_widget_get_first_child (GTK_WIDGET (overlay));
|
||||
while (child != NULL)
|
||||
{
|
||||
GtkWidget *next = gtk_widget_get_next_sibling (child);
|
||||
|
||||
(* callback) (child, callback_data);
|
||||
|
||||
child = next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
blur_overlay_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
@@ -420,21 +383,32 @@ blur_overlay_snapshot (GtkWidget *widget,
|
||||
gsk_render_node_unref (main_widget_node);
|
||||
}
|
||||
|
||||
static void
|
||||
blur_overlay_dispose (GObject *object)
|
||||
{
|
||||
BlurOverlay *overlay = BLUR_OVERLAY (object);
|
||||
GtkWidget *child;
|
||||
|
||||
g_clear_pointer (&overlay->main_widget, gtk_widget_unparent);
|
||||
|
||||
while ((child = gtk_widget_get_first_child (GTK_WIDGET (overlay))))
|
||||
gtk_widget_unparent (child);
|
||||
|
||||
G_OBJECT_CLASS (blur_overlay_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
blur_overlay_class_init (BlurOverlayClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
object_class->dispose = blur_overlay_dispose;
|
||||
|
||||
widget_class->measure = blur_overlay_measure;
|
||||
widget_class->size_allocate = blur_overlay_size_allocate;
|
||||
widget_class->snapshot = blur_overlay_snapshot;
|
||||
|
||||
container_class->add = blur_overlay_add;
|
||||
container_class->remove = blur_overlay_remove;
|
||||
container_class->forall = blur_overlay_forall;
|
||||
|
||||
klass->get_child_position = blur_overlay_get_child_position;
|
||||
|
||||
signals[GET_CHILD_POSITION] =
|
||||
@@ -477,3 +451,11 @@ blur_overlay_add_overlay (BlurOverlay *overlay,
|
||||
|
||||
blur_overlay_set_overlay_child (widget, child);
|
||||
}
|
||||
|
||||
void
|
||||
blur_overlay_set_child (BlurOverlay *overlay,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_insert_after (widget, GTK_WIDGET (overlay), NULL);
|
||||
overlay->main_widget = widget;
|
||||
}
|
||||
|
@@ -37,14 +37,14 @@ typedef struct _BlurOverlayClass BlurOverlayClass;
|
||||
|
||||
struct _BlurOverlay
|
||||
{
|
||||
GtkBin parent_instance;
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GtkWidget *main_widget;
|
||||
};
|
||||
|
||||
struct _BlurOverlayClass
|
||||
{
|
||||
GtkBinClass parent_class;
|
||||
GtkWidgetClass parent_class;
|
||||
|
||||
gboolean (*get_child_position) (BlurOverlay *overlay,
|
||||
GtkWidget *widget,
|
||||
@@ -59,6 +59,9 @@ GDK_AVAILABLE_IN_ALL
|
||||
void blur_overlay_add_overlay (BlurOverlay *overlay,
|
||||
GtkWidget *widget,
|
||||
double blur);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void blur_overlay_set_child (BlurOverlay *overlay,
|
||||
GtkWidget *widget);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -118,7 +118,7 @@ do_clipboard (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_top (vbox, 8);
|
||||
gtk_widget_set_margin_bottom (vbox, 8);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");
|
||||
|
||||
|
@@ -324,7 +324,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 10);
|
||||
gtk_widget_set_margin_top (vbox, 10);
|
||||
gtk_widget_set_margin_bottom (vbox, 10);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
/* A combobox demonstrating cell renderers, separators and
|
||||
* insensitive rows
|
||||
@@ -337,7 +337,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (box, 5);
|
||||
gtk_widget_set_margin_top (box, 5);
|
||||
gtk_widget_set_margin_bottom (box, 5);
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), box);
|
||||
|
||||
model = create_icon_store ();
|
||||
combo = gtk_combo_box_new_with_model (model);
|
||||
@@ -381,7 +381,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (box, 5);
|
||||
gtk_widget_set_margin_top (box, 5);
|
||||
gtk_widget_set_margin_bottom (box, 5);
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), box);
|
||||
|
||||
model = create_capital_store ();
|
||||
combo = gtk_combo_box_new_with_model (model);
|
||||
@@ -412,7 +412,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (box, 5);
|
||||
gtk_widget_set_margin_top (box, 5);
|
||||
gtk_widget_set_margin_bottom (box, 5);
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), box);
|
||||
|
||||
combo = gtk_combo_box_text_new_with_entry ();
|
||||
fill_combo_entry (combo);
|
||||
@@ -421,8 +421,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
entry = g_object_new (TYPE_MASK_ENTRY, NULL);
|
||||
MASK_ENTRY (entry)->mask = "^([0-9]*|One|Two|2\302\275|Three)$";
|
||||
|
||||
gtk_container_remove (GTK_CONTAINER (combo), gtk_bin_get_child (GTK_BIN (combo)));
|
||||
gtk_container_add (GTK_CONTAINER (combo), entry);
|
||||
gtk_combo_box_set_child (GTK_COMBO_BOX (combo), entry);
|
||||
|
||||
/* A combobox with string IDs */
|
||||
frame = gtk_frame_new ("String IDs");
|
||||
@@ -433,7 +432,7 @@ do_combobox (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (box, 5);
|
||||
gtk_widget_set_margin_top (box, 5);
|
||||
gtk_widget_set_margin_bottom (box, 5);
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), box);
|
||||
|
||||
combo = gtk_combo_box_text_new ();
|
||||
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "never", "Not visible");
|
||||
|
@@ -21,23 +21,24 @@ struct _SimpleGrid
|
||||
G_DEFINE_TYPE (SimpleGrid, simple_grid, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
simple_grid_destroy (GtkWidget *widget)
|
||||
simple_grid_dispose (GObject *object)
|
||||
{
|
||||
SimpleGrid *self = SIMPLE_GRID (widget);
|
||||
SimpleGrid *self = SIMPLE_GRID (object);
|
||||
|
||||
g_clear_pointer (&self->button1, gtk_widget_destroy);
|
||||
g_clear_pointer (&self->button2, gtk_widget_destroy);
|
||||
g_clear_pointer (&self->button3, gtk_widget_destroy);
|
||||
|
||||
GTK_WIDGET_CLASS (simple_grid_parent_class)->destroy (widget);
|
||||
G_OBJECT_CLASS (simple_grid_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
simple_grid_class_init (SimpleGridClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
widget_class->destroy = simple_grid_destroy;
|
||||
object_class->dispose = simple_grid_dispose;
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
|
||||
}
|
||||
@@ -257,16 +258,16 @@ 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), "Constraints");
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Constraints");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
grid = g_object_new (simple_grid_get_type (), NULL);
|
||||
gtk_widget_set_hexpand (grid, TRUE);
|
||||
|
@@ -22,23 +22,24 @@ struct _InteractiveGrid
|
||||
G_DEFINE_TYPE (InteractiveGrid, interactive_grid, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
interactive_grid_destroy (GtkWidget *widget)
|
||||
interactive_grid_dispose (GObject *object)
|
||||
{
|
||||
InteractiveGrid *self = INTERACTIVE_GRID (widget);
|
||||
InteractiveGrid *self = INTERACTIVE_GRID (object);
|
||||
|
||||
g_clear_pointer (&self->button1, gtk_widget_destroy);
|
||||
g_clear_pointer (&self->button2, gtk_widget_destroy);
|
||||
g_clear_pointer (&self->button3, gtk_widget_destroy);
|
||||
|
||||
GTK_WIDGET_CLASS (interactive_grid_parent_class)->destroy (widget);
|
||||
G_OBJECT_CLASS (interactive_grid_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
interactive_grid_class_init (InteractiveGridClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
widget_class->destroy = interactive_grid_destroy;
|
||||
object_class->dispose = interactive_grid_dispose;
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
|
||||
}
|
||||
@@ -213,16 +214,16 @@ do_constraints2 (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");
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Constraints");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
grid = g_object_new (interactive_grid_get_type (), NULL);
|
||||
gtk_widget_set_hexpand (grid, TRUE);
|
||||
|
@@ -20,23 +20,24 @@ struct _VflGrid
|
||||
G_DEFINE_TYPE (VflGrid, vfl_grid, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
vfl_grid_destroy (GtkWidget *widget)
|
||||
vfl_grid_dispose (GObject *object)
|
||||
{
|
||||
VflGrid *self = VFL_GRID (widget);
|
||||
VflGrid *self = VFL_GRID (object);
|
||||
|
||||
g_clear_pointer (&self->button1, gtk_widget_destroy);
|
||||
g_clear_pointer (&self->button2, gtk_widget_destroy);
|
||||
g_clear_pointer (&self->button3, gtk_widget_destroy);
|
||||
|
||||
GTK_WIDGET_CLASS (vfl_grid_parent_class)->destroy (widget);
|
||||
G_OBJECT_CLASS (vfl_grid_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
vfl_grid_class_init (VflGridClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
widget_class->destroy = vfl_grid_destroy;
|
||||
object_class->dispose = vfl_grid_dispose;
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_CONSTRAINT_LAYOUT);
|
||||
}
|
||||
@@ -133,16 +134,16 @@ do_constraints3 (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");
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Constraints");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
grid = g_object_new (vfl_grid_get_type (), NULL);
|
||||
gtk_widget_set_hexpand (grid, TRUE);
|
||||
|
@@ -34,7 +34,7 @@ do_css_accordion (GtkWidget *do_widget)
|
||||
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
|
||||
gtk_container_add (GTK_CONTAINER (window), container);
|
||||
gtk_window_set_child (GTK_WINDOW (window), container);
|
||||
|
||||
child = gtk_button_new_with_label ("This");
|
||||
gtk_container_add (GTK_CONTAINER (container), child);
|
||||
|
@@ -92,7 +92,7 @@ do_css_basics (GtkWidget *do_widget)
|
||||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
|
||||
container = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (window), container);
|
||||
gtk_window_set_child (GTK_WINDOW (window), container);
|
||||
child = gtk_text_view_new_with_buffer (text);
|
||||
gtk_container_add (GTK_CONTAINER (container), child);
|
||||
g_signal_connect (text, "changed",
|
||||
|
@@ -94,7 +94,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
container = gtk_overlay_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), container);
|
||||
gtk_window_set_child (GTK_WINDOW (window), container);
|
||||
|
||||
child = gtk_drawing_area_new ();
|
||||
gtk_widget_set_name (child, "canvas");
|
||||
|
@@ -80,7 +80,7 @@ do_css_pixbufs (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
gtk_container_add (GTK_CONTAINER (window), paned);
|
||||
gtk_window_set_child (GTK_WINDOW (window), paned);
|
||||
|
||||
/* Need a filler so we get a handle */
|
||||
child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
|
@@ -99,7 +99,7 @@ do_css_shadows (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
gtk_container_add (GTK_CONTAINER (window), paned);
|
||||
gtk_window_set_child (GTK_WINDOW (window), paned);
|
||||
|
||||
child = create_toolbar ();
|
||||
gtk_container_add (GTK_CONTAINER (paned), child);
|
||||
|
@@ -118,14 +118,14 @@ do_dialog (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (frame, 8);
|
||||
gtk_widget_set_margin_top (frame, 8);
|
||||
gtk_widget_set_margin_bottom (frame, 8);
|
||||
gtk_container_add (GTK_CONTAINER (window), frame);
|
||||
gtk_window_set_child (GTK_WINDOW (window), frame);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_widget_set_margin_start (vbox, 8);
|
||||
gtk_widget_set_margin_end (vbox, 8);
|
||||
gtk_widget_set_margin_top (vbox, 8);
|
||||
gtk_widget_set_margin_bottom (vbox, 8);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), vbox);
|
||||
|
||||
/* Standard message dialog */
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
|
||||
|
@@ -443,7 +443,7 @@ do_dnd (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (box), box2);
|
||||
@@ -474,7 +474,7 @@ do_dnd (GtkWidget *do_widget)
|
||||
|
||||
box3 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_add_css_class (box3, "linked");
|
||||
gtk_container_add (GTK_CONTAINER (sw), box3);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), box3);
|
||||
|
||||
for (i = 0; colors[i]; i++)
|
||||
{
|
||||
|
@@ -42,7 +42,9 @@ create_surface (GtkWidget *widget)
|
||||
}
|
||||
|
||||
static void
|
||||
scribble_size_allocate (GtkWidget *widget)
|
||||
scribble_resize (GtkWidget *widget,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
create_surface (widget);
|
||||
}
|
||||
@@ -202,7 +204,7 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 16);
|
||||
gtk_widget_set_margin_top (vbox, 16);
|
||||
gtk_widget_set_margin_bottom (vbox, 16);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
/*
|
||||
* Create the checkerboard area
|
||||
@@ -221,7 +223,7 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), checkerboard_draw, NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), da);
|
||||
|
||||
/*
|
||||
* Create the scribble area
|
||||
@@ -240,10 +242,10 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), da);
|
||||
|
||||
g_signal_connect (da, "size-allocate",
|
||||
G_CALLBACK (scribble_size_allocate), NULL);
|
||||
g_signal_connect (da, "resize",
|
||||
G_CALLBACK (scribble_resize), NULL);
|
||||
|
||||
drag = gtk_gesture_drag_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
|
||||
|
@@ -360,7 +360,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 5);
|
||||
gtk_widget_set_margin_top (vbox, 5);
|
||||
gtk_widget_set_margin_bottom (vbox, 5);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox),
|
||||
gtk_label_new ("Shopping list (you can edit the cells!)"));
|
||||
@@ -387,7 +387,7 @@ do_editable_cells (GtkWidget *do_widget)
|
||||
g_object_unref (numbers_model);
|
||||
g_object_unref (items_model);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), treeview);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
|
||||
|
||||
/* some buttons */
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
|
||||
|
@@ -59,7 +59,7 @@ do_entry_completion (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 5);
|
||||
gtk_widget_set_margin_top (vbox, 5);
|
||||
gtk_widget_set_margin_bottom (vbox, 5);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), "Completion demo, try writing <b>total</b> or <b>gnome</b> for example.");
|
||||
|
@@ -33,7 +33,7 @@ do_entry_undo (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 5);
|
||||
gtk_widget_set_margin_top (vbox, 5);
|
||||
gtk_widget_set_margin_bottom (vbox, 5);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
|
@@ -78,7 +78,7 @@ do_expander (GtkWidget *do_widget)
|
||||
"A second paragraph will contain even more "
|
||||
"innuendo, just to make you scroll down or "
|
||||
"resize the window. Do it already !", -1);
|
||||
gtk_container_add (GTK_CONTAINER (sw), tv);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), tv);
|
||||
gtk_container_add (GTK_CONTAINER (expander), sw);
|
||||
gtk_container_add (GTK_CONTAINER (area), expander);
|
||||
g_signal_connect (expander, "notify::expanded",
|
||||
|
@@ -161,7 +161,7 @@ create_menu_button (void)
|
||||
GtkWidget *w = gtk_menu_button_new ();
|
||||
GtkWidget *popover = gtk_popover_new ();
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (popover), gtk_button_new_with_label ("Hey!"));
|
||||
gtk_popover_set_child (GTK_POPOVER (popover), gtk_button_new_with_label ("Hey!"));
|
||||
gtk_popover_set_autohide (GTK_POPOVER (popover), FALSE);
|
||||
gtk_menu_button_set_popover (GTK_MENU_BUTTON (w), popover);
|
||||
g_signal_connect (w, "map", G_CALLBACK (mapped), NULL);
|
||||
@@ -194,7 +194,7 @@ static void
|
||||
set_widget_type (GtkFishbowl *fishbowl,
|
||||
int widget_type_index)
|
||||
{
|
||||
GtkWidget *window, *headerbar;
|
||||
GtkWidget *window;
|
||||
|
||||
if (widget_type_index == selected_widget_type)
|
||||
return;
|
||||
@@ -205,9 +205,8 @@ set_widget_type (GtkFishbowl *fishbowl,
|
||||
widget_types[selected_widget_type].create_func);
|
||||
|
||||
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl)));
|
||||
headerbar = gtk_window_get_titlebar (GTK_WINDOW (window));
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
|
||||
widget_types[selected_widget_type].name);
|
||||
gtk_window_set_title (GTK_WINDOW (window),
|
||||
widget_types[selected_widget_type].name);
|
||||
}
|
||||
|
||||
void
|
||||
|
@@ -131,10 +131,10 @@ create_demo_window (GtkWidget *do_widget)
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
|
||||
fixed = gtk_fixed_new ();
|
||||
gtk_container_add (GTK_CONTAINER (sw), fixed);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), fixed);
|
||||
gtk_widget_set_halign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
|
||||
|
||||
|
@@ -37,7 +37,7 @@ color_swatch_new (const gchar *color)
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (area), 24);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (area), 24);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (area), draw_color, (gpointer) color, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (button), area);
|
||||
gtk_button_set_child (GTK_BUTTON (button), area);
|
||||
|
||||
return button;
|
||||
}
|
||||
@@ -735,8 +735,8 @@ do_flowbox (GtkWidget *do_widget)
|
||||
gtk_flow_box_set_max_children_per_line (GTK_FLOW_BOX (flowbox), 30);
|
||||
gtk_flow_box_set_selection_mode (GTK_FLOW_BOX (flowbox), GTK_SELECTION_NONE);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), flowbox);
|
||||
gtk_container_add (GTK_CONTAINER (window), scrolled);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), flowbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), scrolled);
|
||||
|
||||
for (i = 0; colors[i]; i++)
|
||||
gtk_container_add (GTK_CONTAINER (flowbox), color_swatch_new (colors[i]));
|
||||
|
@@ -4,10 +4,10 @@
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">500</property>
|
||||
<property name="title">Font Explorer</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<property name="title">Font Explorer</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="reset">
|
||||
<property name="receives-default">1</property>
|
||||
|
@@ -93,7 +93,7 @@ do_gears (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_top (overlay, 12);
|
||||
gtk_widget_set_margin_bottom (overlay, 12);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
gtk_window_set_child (GTK_WINDOW (window), overlay);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_set_halign (frame, GTK_ALIGN_START);
|
||||
@@ -103,11 +103,11 @@ do_gears (GtkWidget *do_widget)
|
||||
|
||||
fps_label = gtk_label_new ("");
|
||||
gtk_widget_set_halign (fps_label, GTK_ALIGN_START);
|
||||
gtk_container_add (GTK_CONTAINER (frame), fps_label);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), fps_label);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), box);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), box);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
|
@@ -153,7 +153,7 @@ do_gestures (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), drawing_area);
|
||||
gtk_window_set_child (GTK_WINDOW (window), drawing_area);
|
||||
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
|
||||
drawing_area_draw,
|
||||
|
@@ -401,7 +401,7 @@ create_glarea_window (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_top (box, 12);
|
||||
gtk_widget_set_margin_bottom (box, 12);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
gl_area = gtk_gl_area_new ();
|
||||
gtk_widget_set_hexpand (gl_area, TRUE);
|
||||
|
@@ -2,9 +2,8 @@
|
||||
*
|
||||
* GtkHeaderBar is a container that is suitable for implementing
|
||||
* window titlebars. One of its features is that it can position
|
||||
* a title (and optional subtitle) centered with regard to the
|
||||
* full width, regardless of variable-width content at the left
|
||||
* or right.
|
||||
* a title centered with regard to the full width, regardless of
|
||||
* variable-width content at the left or right.
|
||||
*
|
||||
* It is commonly used with gtk_window_set_titlebar()
|
||||
*/
|
||||
@@ -25,36 +24,35 @@ do_headerbar (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), "Welcome to Facebook - Log in, sign up or learn more");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Welcome to Facebook - Log in, sign up or learn more");
|
||||
gtk_header_bar_set_has_subtitle (GTK_HEADER_BAR (header), FALSE);
|
||||
|
||||
button = gtk_button_new ();
|
||||
icon = g_themed_icon_new ("mail-send-receive-symbolic");
|
||||
image = gtk_image_new_from_gicon (icon);
|
||||
g_object_unref (icon);
|
||||
gtk_container_add (GTK_CONTAINER (button), image);
|
||||
gtk_button_set_child (GTK_BUTTON (button), image);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_widget_add_css_class (box, "linked");
|
||||
button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
|
||||
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-start-symbolic"));
|
||||
gtk_container_add (GTK_CONTAINER (box), button);
|
||||
button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
|
||||
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("pan-end-symbolic"));
|
||||
gtk_container_add (GTK_CONTAINER (box), button);
|
||||
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);
|
||||
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), gtk_text_view_new ());
|
||||
gtk_window_set_child (GTK_WINDOW (window), gtk_text_view_new ());
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -266,8 +266,8 @@ do_hypertext (GtkWidget *do_widget)
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
|
||||
|
||||
show_page (buffer, 1);
|
||||
}
|
||||
|
@@ -66,9 +66,9 @@ populate_icons (void)
|
||||
hincrement = 0;
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow), grid);
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), grid);
|
||||
}
|
||||
|
||||
static char *content;
|
||||
@@ -102,9 +102,9 @@ populate_text (gboolean hilight)
|
||||
hincrement = 0;
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), textview);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -126,9 +126,9 @@ populate_image (void)
|
||||
hincrement = 5;
|
||||
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow), image);
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), image);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -137,9 +137,8 @@ set_widget_type (int type)
|
||||
if (tick_cb)
|
||||
gtk_widget_remove_tick_callback (window, tick_cb);
|
||||
|
||||
if (gtk_bin_get_child (GTK_BIN (scrolledwindow)))
|
||||
gtk_container_remove (GTK_CONTAINER (scrolledwindow),
|
||||
gtk_bin_get_child (GTK_BIN (scrolledwindow)));
|
||||
if (gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (scrolledwindow)))
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), NULL);
|
||||
|
||||
selected = type;
|
||||
|
||||
|
@@ -263,7 +263,7 @@ do_iconview (GtkWidget *do_widget)
|
||||
load_pixbufs ();
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
tool_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), tool_bar);
|
||||
@@ -312,7 +312,7 @@ do_iconview (GtkWidget *do_widget)
|
||||
/* Connect to the "item-activated" signal */
|
||||
g_signal_connect (icon_view, "item-activated",
|
||||
G_CALLBACK (item_activated), store);
|
||||
gtk_container_add (GTK_CONTAINER (sw), icon_view);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), icon_view);
|
||||
|
||||
gtk_widget_grab_focus (icon_view);
|
||||
}
|
||||
|
@@ -146,7 +146,7 @@ do_iconview_edit (GtkWidget *do_widget)
|
||||
"text", COL_TEXT,
|
||||
NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), icon_view);
|
||||
gtk_window_set_child (GTK_WINDOW (window), icon_view);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -346,7 +346,7 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (base_vbox, 16);
|
||||
gtk_widget_set_margin_top (base_vbox, 16);
|
||||
gtk_widget_set_margin_bottom (base_vbox, 16);
|
||||
gtk_container_add (GTK_CONTAINER (window), base_vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), base_vbox);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
|
||||
gtk_container_add (GTK_CONTAINER (base_vbox), hbox);
|
||||
@@ -367,7 +367,7 @@ do_images (GtkWidget *do_widget)
|
||||
image = gtk_image_new_from_icon_name ("gtk3-demo");
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), image);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), image);
|
||||
|
||||
|
||||
/* Animation */
|
||||
@@ -384,7 +384,7 @@ do_images (GtkWidget *do_widget)
|
||||
|
||||
picture = gtk_picture_new_for_resource ("/images/floppybuddy.gif");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), picture);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), picture);
|
||||
|
||||
/* Symbolic icon */
|
||||
|
||||
@@ -402,7 +402,7 @@ do_images (GtkWidget *do_widget)
|
||||
image = gtk_image_new_from_gicon (gicon);
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), image);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), image);
|
||||
|
||||
|
||||
/* Progressive */
|
||||
@@ -423,7 +423,7 @@ do_images (GtkWidget *do_widget)
|
||||
* will create the pixbuf and fill it in.
|
||||
*/
|
||||
picture = gtk_picture_new ();
|
||||
gtk_container_add (GTK_CONTAINER (frame), picture);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), picture);
|
||||
|
||||
start_progressive_loading (picture);
|
||||
|
||||
@@ -443,7 +443,7 @@ do_images (GtkWidget *do_widget)
|
||||
|
||||
video = gtk_video_new_for_resource ("/images/gtk-logo.webm");
|
||||
gtk_media_stream_set_loop (gtk_video_get_media_stream (GTK_VIDEO (video)), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (frame), video);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), video);
|
||||
|
||||
/* Widget paintables */
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
|
@@ -66,7 +66,7 @@ do_infobar (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 8);
|
||||
gtk_widget_set_margin_top (vbox, 8);
|
||||
gtk_widget_set_margin_bottom (vbox, 8);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
bar = gtk_info_bar_new ();
|
||||
gtk_container_add (GTK_CONTAINER (vbox), bar);
|
||||
@@ -143,7 +143,7 @@ do_infobar (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (actions, 8);
|
||||
gtk_widget_set_margin_top (actions, 8);
|
||||
gtk_widget_set_margin_bottom (actions, 8);
|
||||
gtk_container_add (GTK_CONTAINER (frame), actions);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), actions);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -81,7 +81,7 @@ do_links (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (label, 20);
|
||||
gtk_widget_set_margin_top (label, 20);
|
||||
gtk_widget_set_margin_bottom (label, 20);
|
||||
gtk_container_add (GTK_CONTAINER (window), label);
|
||||
gtk_window_set_child (GTK_WINDOW (window), label);
|
||||
gtk_widget_show (label);
|
||||
}
|
||||
|
||||
|
@@ -266,7 +266,7 @@ do_list_store (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 8);
|
||||
gtk_widget_set_margin_top (vbox, 8);
|
||||
gtk_widget_set_margin_bottom (vbox, 8);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
label = gtk_label_new ("This is the bug list (note: not based on real data, it would be nice to have a nice ODBC interface to bugzilla or so, though).");
|
||||
gtk_container_add (GTK_CONTAINER (vbox), label);
|
||||
@@ -289,7 +289,7 @@ do_list_store (GtkWidget *do_widget)
|
||||
|
||||
g_object_unref (model);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), treeview);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
|
||||
|
||||
/* add columns to the tree view */
|
||||
add_columns (GTK_TREE_VIEW (treeview));
|
||||
|
@@ -360,7 +360,7 @@ do_listbox (GtkWidget *do_widget)
|
||||
&window);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
label = gtk_label_new ("Messages from GTK and friends");
|
||||
gtk_container_add (GTK_CONTAINER (vbox), label);
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
@@ -368,7 +368,7 @@ do_listbox (GtkWidget *do_widget)
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), scrolled);
|
||||
listbox = gtk_list_box_new ();
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), listbox);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), listbox);
|
||||
|
||||
gtk_list_box_set_sort_func (GTK_LIST_BOX (listbox), (GtkListBoxSortFunc)gtk_message_row_sort, listbox, NULL);
|
||||
gtk_list_box_set_activate_on_single_click (GTK_LIST_BOX (listbox), FALSE);
|
||||
|
@@ -17,7 +17,7 @@ static gchar *current_file = NULL;
|
||||
|
||||
static GtkWidget *notebook;
|
||||
static GtkWidget *treeview;
|
||||
static GtkWidget *headerbar;
|
||||
static GtkWidget *toplevel;
|
||||
|
||||
enum {
|
||||
NAME_COLUMN,
|
||||
@@ -571,7 +571,7 @@ display_image (const char *resource)
|
||||
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sw), image);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
|
||||
|
||||
return sw;
|
||||
}
|
||||
@@ -614,7 +614,7 @@ display_text (const char *resource)
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), textview);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), textview);
|
||||
|
||||
return sw;
|
||||
}
|
||||
@@ -915,7 +915,7 @@ selection_cb (GtkTreeSelection *selection,
|
||||
if (filename)
|
||||
load_file (name, filename);
|
||||
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), title);
|
||||
gtk_window_set_title (GTK_WINDOW (toplevel), title);
|
||||
|
||||
g_free (name);
|
||||
g_free (title);
|
||||
@@ -1030,9 +1030,9 @@ activate (GApplication *app)
|
||||
|
||||
info_view = (GtkWidget *)gtk_builder_get_object (builder, "info-textview");
|
||||
source_view = (GtkWidget *)gtk_builder_get_object (builder, "source-textview");
|
||||
headerbar = (GtkWidget *)gtk_builder_get_object (builder, "headerbar");
|
||||
treeview = (GtkWidget *)gtk_builder_get_object (builder, "treeview");
|
||||
model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
|
||||
toplevel = GTK_WIDGET (window);
|
||||
|
||||
load_file (gtk_demos[0].name, gtk_demos[0].filename);
|
||||
|
||||
|
@@ -31,7 +31,6 @@
|
||||
</style>
|
||||
<property name="default-width">800</property>
|
||||
<property name="default-height">600</property>
|
||||
<property name="title">GTK Demo</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="headerbar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
|
@@ -63,7 +63,7 @@ do_markup (GtkWidget *do_widget)
|
||||
|
||||
stack = gtk_stack_new ();
|
||||
gtk_widget_show (stack);
|
||||
gtk_container_add (GTK_CONTAINER (window), stack);
|
||||
gtk_window_set_child (GTK_WINDOW (window), stack);
|
||||
|
||||
show_source = gtk_check_button_new_with_label ("Source");
|
||||
gtk_widget_set_valign (show_source, GTK_ALIGN_CENTER);
|
||||
@@ -86,7 +86,7 @@ do_markup (GtkWidget *do_widget)
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
|
||||
|
||||
gtk_stack_add_named (GTK_STACK (stack), sw, "formatted");
|
||||
|
||||
@@ -99,7 +99,7 @@ do_markup (GtkWidget *do_widget)
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view2);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view2);
|
||||
|
||||
gtk_stack_add_named (GTK_STACK (stack), sw, "source");
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="title" translatable="yes">Model Button</property>
|
||||
<property name="resizable">0</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<property name="title" translatable="yes">Model Button</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@@ -37,7 +37,7 @@ do_overlay (GtkWidget *do_widget)
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (overlay), grid);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), grid);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
|
||||
@@ -78,7 +78,7 @@ do_overlay (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_bottom (entry, 8);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), entry);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
gtk_window_set_child (GTK_WINDOW (window), overlay);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
@@ -57,9 +57,9 @@ do_overlay2 (GtkWidget *do_widget)
|
||||
gtk_text_iter_forward_word_end (&end);
|
||||
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
gtk_container_add (GTK_CONTAINER (sw), text);
|
||||
gtk_window_set_child (GTK_WINDOW (window), overlay);
|
||||
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), text);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
@@ -389,10 +389,9 @@ do_paint (GtkWidget *toplevel)
|
||||
window = gtk_window_new ();
|
||||
|
||||
draw_area = drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), draw_area);
|
||||
gtk_window_set_child (GTK_WINDOW (window), draw_area);
|
||||
|
||||
headerbar = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), "Paint");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (headerbar), TRUE);
|
||||
|
||||
colorbutton = gtk_color_button_new ();
|
||||
@@ -405,6 +404,7 @@ do_paint (GtkWidget *toplevel)
|
||||
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paint");
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
@@ -164,7 +164,7 @@ do_paintable (GtkWidget *do_widget)
|
||||
|
||||
nuclear = gtk_nuclear_icon_new (0.0);
|
||||
image = gtk_image_new_from_paintable (nuclear);
|
||||
gtk_container_add (GTK_CONTAINER (window), image);
|
||||
gtk_window_set_child (GTK_WINDOW (window), image);
|
||||
g_object_unref (nuclear);
|
||||
}
|
||||
|
||||
|
@@ -196,7 +196,7 @@ do_paintable_animated (GtkWidget *do_widget)
|
||||
|
||||
nuclear = gtk_nuclear_animation_new ();
|
||||
image = gtk_image_new_from_paintable (nuclear);
|
||||
gtk_container_add (GTK_CONTAINER (window), image);
|
||||
gtk_window_set_child (GTK_WINDOW (window), image);
|
||||
g_object_unref (nuclear);
|
||||
}
|
||||
|
||||
|
@@ -298,7 +298,7 @@ do_paintable_mediastream (GtkWidget *do_widget)
|
||||
gtk_media_stream_set_loop (GTK_MEDIA_STREAM (nuclear), TRUE);
|
||||
|
||||
video = gtk_video_new_for_media_stream (nuclear);
|
||||
gtk_container_add (GTK_CONTAINER (window), video);
|
||||
gtk_window_set_child (GTK_WINDOW (window), video);
|
||||
|
||||
g_object_unref (nuclear);
|
||||
}
|
||||
|
@@ -103,7 +103,7 @@ create_pane_options (GtkPaned *paned,
|
||||
gtk_widget_set_margin_bottom (frame, 4);
|
||||
|
||||
table = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), table);
|
||||
|
||||
label = gtk_label_new (label1);
|
||||
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
|
||||
@@ -159,7 +159,7 @@ do_panes (GtkWidget *do_widget)
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
gtk_widget_set_margin_start (vpaned, 5);
|
||||
@@ -176,7 +176,7 @@ do_panes (GtkWidget *do_widget)
|
||||
gtk_paned_add1 (GTK_PANED (hpaned), frame);
|
||||
|
||||
button = gtk_button_new_with_mnemonic ("_Hi there");
|
||||
gtk_container_add (GTK_CONTAINER(frame), button);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), button);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_set_size_request (frame, 80, 60);
|
||||
|
@@ -40,9 +40,9 @@ do_password_entry (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Choose a Password");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Choose a Password");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
|
||||
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
|
||||
g_signal_connect (window, "destroy",
|
||||
@@ -53,7 +53,7 @@ do_password_entry (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (box, 18);
|
||||
gtk_widget_set_margin_top (box, 18);
|
||||
gtk_widget_set_margin_bottom (box, 18);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
entry = gtk_password_entry_new ();
|
||||
gtk_password_entry_set_show_peek_icon (GTK_PASSWORD_ENTRY (entry), TRUE);
|
||||
|
@@ -276,13 +276,12 @@ do_peg_solitaire (GtkWidget *do_widget)
|
||||
g_signal_connect (restart, "clicked", G_CALLBACK (restart), NULL);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "Peg Solitaire");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), restart);
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Sliding Puzzle");
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Peg Solitaire");
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||
g_signal_connect (window, "destroy",
|
||||
@@ -295,7 +294,7 @@ do_peg_solitaire (GtkWidget *do_widget)
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
||||
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
|
||||
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
gtk_window_set_child (GTK_WINDOW (window), grid);
|
||||
|
||||
for (x = 0; x < 7; x++)
|
||||
{
|
||||
|
@@ -29,7 +29,7 @@ do_pickers (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_bottom (table, 20);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table), 3);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
|
||||
gtk_container_add (GTK_CONTAINER (window), table);
|
||||
gtk_window_set_child (GTK_WINDOW (window), table);
|
||||
|
||||
label = gtk_label_new ("Color:");
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
||||
|
@@ -212,7 +212,7 @@ do_pixbufs (GtkWidget *do_widget)
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), back_height);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_func, NULL, NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
gtk_window_set_child (GTK_WINDOW (window), da);
|
||||
|
||||
gtk_widget_add_tick_callback (da, on_tick, NULL, NULL);
|
||||
}
|
||||
|
@@ -185,7 +185,7 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_box_set_homogeneous (GTK_BOX (box), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
/* Add a drawing area */
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
|
@@ -269,7 +269,7 @@ do_search_entry (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 5);
|
||||
gtk_widget_set_margin_top (vbox, 5);
|
||||
gtk_widget_set_margin_bottom (vbox, 5);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label), "Search entry demo");
|
||||
|
@@ -78,7 +78,7 @@ do_search_entry2 (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
entry = gtk_search_entry_new ();
|
||||
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
@@ -87,7 +87,7 @@ do_search_entry2 (GtkWidget *do_widget)
|
||||
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_container_add (GTK_CONTAINER (searchbar), container);
|
||||
gtk_search_bar_set_child (GTK_SEARCH_BAR (searchbar), container);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), searchbar);
|
||||
|
||||
/* Hook the search bar to key presses */
|
||||
|
@@ -65,7 +65,7 @@ do_shortcut_triggers (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_bottom (list, 6);
|
||||
gtk_widget_set_margin_start (list, 6);
|
||||
gtk_widget_set_margin_end (list, 6);
|
||||
gtk_container_add (GTK_CONTAINER (window), list);
|
||||
gtk_window_set_child (GTK_WINDOW (window), list);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (shortcuts); i++)
|
||||
{
|
||||
|
@@ -74,7 +74,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
g_object_set (gtk_stack_get_page (GTK_STACK (stack), widget), "title", c, NULL);
|
||||
}
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -112,7 +112,7 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 5);
|
||||
gtk_widget_set_margin_top (vbox, 5);
|
||||
gtk_widget_set_margin_bottom (vbox, 5);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
g_object_set_data_full (G_OBJECT (window), "size-group", size_group, g_object_unref);
|
||||
@@ -128,7 +128,7 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_bottom (table, 5);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table), 5);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), table);
|
||||
|
||||
add_row (GTK_GRID (table), 0, size_group, "_Foreground", color_options);
|
||||
add_row (GTK_GRID (table), 1, size_group, "_Background", color_options);
|
||||
@@ -144,7 +144,7 @@ do_sizegroup (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_bottom (table, 5);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table), 5);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
|
||||
gtk_container_add (GTK_CONTAINER (frame), table);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), table);
|
||||
|
||||
add_row (GTK_GRID (table), 0, size_group, "_Dashing", dash_options);
|
||||
add_row (GTK_GRID (table), 1, size_group, "_Line ends", end_options);
|
||||
|
@@ -267,15 +267,10 @@ start_puzzle (GdkPaintable *paintable)
|
||||
guint x, y;
|
||||
float aspect_ratio;
|
||||
|
||||
/* Remove the old grid (if there is one) */
|
||||
grid = gtk_bin_get_child (GTK_BIN (frame));
|
||||
if (grid)
|
||||
gtk_container_remove (GTK_CONTAINER (frame), grid);
|
||||
|
||||
/* Create a new grid */
|
||||
grid = gtk_grid_new ();
|
||||
gtk_widget_set_can_focus (grid, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (frame), grid);
|
||||
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (frame), grid);
|
||||
aspect_ratio = gdk_paintable_get_intrinsic_aspect_ratio (paintable);
|
||||
if (aspect_ratio == 0.0)
|
||||
aspect_ratio = 1.0;
|
||||
@@ -345,7 +340,7 @@ reshuffle (void)
|
||||
{
|
||||
GtkWidget *grid;
|
||||
|
||||
grid = gtk_bin_get_child (GTK_BIN (frame));
|
||||
grid = gtk_aspect_frame_get_child (GTK_ASPECT_FRAME (frame));
|
||||
if (solved)
|
||||
start_puzzle (puzzle);
|
||||
else
|
||||
@@ -372,13 +367,14 @@ reconfigure (void)
|
||||
child = selected->data;
|
||||
g_list_free (selected);
|
||||
}
|
||||
image = gtk_bin_get_child (GTK_BIN (child));
|
||||
|
||||
image = gtk_flow_box_child_get_child (GTK_FLOW_BOX_CHILD (child));
|
||||
puzzle = gtk_image_get_paintable (GTK_IMAGE (image));
|
||||
|
||||
start_puzzle (puzzle);
|
||||
start_puzzle (puzzle);
|
||||
popover = gtk_widget_get_ancestor (size_spin, GTK_TYPE_POPOVER);
|
||||
gtk_popover_popdown (GTK_POPOVER (popover));
|
||||
grid = gtk_bin_get_child (GTK_BIN (frame));
|
||||
grid = gtk_aspect_frame_get_child (GTK_ASPECT_FRAME (frame));
|
||||
gtk_widget_grab_focus (grid);
|
||||
}
|
||||
|
||||
@@ -429,7 +425,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
|
||||
gtk_media_stream_play (media);
|
||||
add_choice (choices, GDK_PAINTABLE (media));
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sw), choices);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), choices);
|
||||
gtk_grid_attach (GTK_GRID (tweaks), sw, 0, 0, 2, 1);
|
||||
|
||||
label = gtk_label_new ("Size");
|
||||
@@ -445,7 +441,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
|
||||
g_signal_connect (apply, "clicked", G_CALLBACK (reconfigure), NULL);
|
||||
|
||||
popover = gtk_popover_new ();
|
||||
gtk_container_add (GTK_CONTAINER (popover), tweaks);
|
||||
gtk_popover_set_child (GTK_POPOVER (popover), tweaks);
|
||||
|
||||
tweak = gtk_menu_button_new ();
|
||||
gtk_menu_button_set_popover (GTK_MENU_BUTTON (tweak), popover);
|
||||
@@ -468,7 +464,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
frame = gtk_aspect_frame_new (0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (window), frame);
|
||||
gtk_window_set_child (GTK_WINDOW (window), frame);
|
||||
|
||||
start_puzzle (puzzle);
|
||||
}
|
||||
|
@@ -46,8 +46,8 @@ do_tabs (GtkWidget *do_widget)
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -67,9 +67,9 @@ do_tagged_entry (GtkWidget *do_widget)
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), "A tagged entry");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "A tagged entry");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_window_set_deletable (GTK_WINDOW (window), FALSE);
|
||||
g_signal_connect (window, "destroy",
|
||||
@@ -80,7 +80,7 @@ do_tagged_entry (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (box, 18);
|
||||
gtk_widget_set_margin_top (box, 18);
|
||||
gtk_widget_set_margin_bottom (box, 18);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
entry = demo_tagged_entry_new ();
|
||||
gtk_container_add (GTK_CONTAINER (box), entry);
|
||||
|
@@ -69,7 +69,7 @@ do_textmask (GtkWidget *do_widget)
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
gtk_window_set_child (GTK_WINDOW (window), da);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_text, NULL, NULL);
|
||||
}
|
||||
|
||||
|
@@ -159,7 +159,7 @@ create_text_view (GtkWidget *hbox,
|
||||
swindow = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), swindow);
|
||||
textview = gtk_text_view_new ();
|
||||
gtk_container_add (GTK_CONTAINER (swindow), textview);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (swindow), textview);
|
||||
|
||||
timeout = setup_scroll (GTK_TEXT_VIEW (textview), to_end);
|
||||
|
||||
@@ -188,7 +188,7 @@ do_textscroll (GtkWidget *do_widget)
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), hbox);
|
||||
|
||||
create_text_view (hbox, TRUE);
|
||||
create_text_view (hbox, FALSE);
|
||||
|
@@ -53,8 +53,8 @@ do_textundo (GtkWidget *do_widget)
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -486,7 +486,7 @@ do_textview (GtkWidget *do_widget)
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Multiple Views");
|
||||
|
||||
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
|
||||
gtk_container_add (GTK_CONTAINER (window), vpaned);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vpaned);
|
||||
|
||||
/* For convenience, we just use the autocreated buffer from
|
||||
* the first text view; you could also create the buffer
|
||||
@@ -503,7 +503,7 @@ do_textview (GtkWidget *do_widget)
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_paned_add1 (GTK_PANED (vpaned), sw);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), view1);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view1);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
@@ -511,7 +511,7 @@ do_textview (GtkWidget *do_widget)
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_paned_add2 (GTK_PANED (vpaned), sw);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), view2);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view2);
|
||||
|
||||
create_tags (buffer);
|
||||
insert_text (GTK_TEXT_VIEW (view1));
|
||||
@@ -547,7 +547,7 @@ recursive_attach_view (int depth,
|
||||
|
||||
/* Frame is to add a black border around each child view */
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_container_add (GTK_CONTAINER (frame), child_view);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), child_view);
|
||||
|
||||
gtk_text_view_add_child_at_anchor (view, frame, anchor);
|
||||
|
||||
@@ -594,8 +594,8 @@ easter_egg_callback (GtkWidget *button,
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
gtk_window_set_child (GTK_WINDOW (window), sw);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);
|
||||
|
||||
window_ptr = &window;
|
||||
g_object_add_weak_pointer (G_OBJECT (window), window_ptr);
|
||||
|
@@ -97,7 +97,6 @@ change_theme (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GtkBuilder *builder = data;
|
||||
GtkWidget *header;
|
||||
GtkWidget *label;
|
||||
Theme next = themes[theme++ % G_N_ELEMENTS (themes)];
|
||||
char *name;
|
||||
@@ -107,9 +106,8 @@ change_theme (GtkWidget *widget,
|
||||
"gtk-application-prefer-dark-theme", next.dark,
|
||||
NULL);
|
||||
|
||||
header = GTK_WIDGET (gtk_builder_get_object (builder, "header"));
|
||||
name = g_strconcat (next.name, next.dark ? " (dark)" : NULL, NULL);
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (header), name);
|
||||
gtk_window_set_title (GTK_WINDOW (widget), name);
|
||||
g_free (name);
|
||||
|
||||
label = GTK_WIDGET (gtk_builder_get_object (builder, "fps"));
|
||||
|
@@ -31,7 +31,7 @@ do_theming_style_classes (GtkWidget *do_widget)
|
||||
builder = gtk_builder_new_from_resource ("/theming_style_classes/theming.ui");
|
||||
|
||||
grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
gtk_window_set_child (GTK_WINDOW (window), grid);
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
|
@@ -29,10 +29,10 @@ do_transparent (GtkWidget *do_widget)
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transparency");
|
||||
|
||||
overlay = blur_overlay_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
gtk_window_set_child (GTK_WINDOW (window), overlay);
|
||||
|
||||
button = gtk_button_new_with_label ("Don't click this button!");
|
||||
label = gtk_bin_get_child (GTK_BIN (button));
|
||||
label = gtk_button_get_child (GTK_BUTTON (button));
|
||||
gtk_widget_set_margin_start (label, 50);
|
||||
gtk_widget_set_margin_end (label, 50);
|
||||
gtk_widget_set_margin_top (label, 50);
|
||||
@@ -45,7 +45,7 @@ do_transparent (GtkWidget *do_widget)
|
||||
blur_overlay_add_overlay (BLUR_OVERLAY (overlay), button, 5.0);
|
||||
|
||||
button = gtk_button_new_with_label ("Maybe this one?");
|
||||
label = gtk_bin_get_child (GTK_BIN (button));
|
||||
label = gtk_button_get_child (GTK_BUTTON (button));
|
||||
gtk_widget_set_margin_start (label, 50);
|
||||
gtk_widget_set_margin_end (label, 50);
|
||||
gtk_widget_set_margin_top (label, 50);
|
||||
@@ -58,7 +58,7 @@ do_transparent (GtkWidget *do_widget)
|
||||
blur_overlay_add_overlay (BLUR_OVERLAY (overlay), button, 5.0);
|
||||
|
||||
picture = gtk_picture_new_for_resource ("/transparent/portland-rose.jpg");
|
||||
gtk_container_add (GTK_CONTAINER (overlay), picture);
|
||||
blur_overlay_set_child (BLUR_OVERLAY (overlay), picture);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -402,7 +402,7 @@ do_tree_store (GtkWidget *do_widget)
|
||||
gtk_widget_set_margin_end (vbox, 8);
|
||||
gtk_widget_set_margin_top (vbox, 8);
|
||||
gtk_widget_set_margin_bottom (vbox, 8);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (vbox),
|
||||
gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
|
||||
@@ -426,7 +426,7 @@ do_tree_store (GtkWidget *do_widget)
|
||||
|
||||
add_columns (GTK_TREE_VIEW (treeview));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (sw), treeview);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), treeview);
|
||||
|
||||
/* expand all rows after the treeview widget has been realized */
|
||||
g_signal_connect (treeview, "realize",
|
||||
|
@@ -71,11 +71,10 @@ do_video_player (GtkWidget *do_widget)
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
video = gtk_video_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), video);
|
||||
gtk_window_set_child (GTK_WINDOW (window), video);
|
||||
|
||||
title = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (title), TRUE);
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (title), "Video Player");
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), title);
|
||||
|
||||
open_button = gtk_button_new_with_mnemonic ("_Open");
|
||||
|
@@ -228,7 +228,7 @@ selected_context_changed (GtkListBox *list, IconBrowserWindow *win)
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (win->search), FALSE);
|
||||
|
||||
label = gtk_bin_get_child (GTK_BIN (row));
|
||||
label = gtk_list_box_row_get_child (GTK_LIST_BOX_ROW (row));
|
||||
win->current_context = g_object_get_data (G_OBJECT (label), "context");
|
||||
gtk_tree_model_filter_refilter (win->filter_model);
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@
|
||||
<property name="default-height">768</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="title" translatable="yes">Icon Browser</property>
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child type="title">
|
||||
<object class="GtkBox">
|
||||
|
@@ -273,13 +273,13 @@ text_changed (GtkTextBuffer *buffer,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
text_view_query_tooltip_cb (GtkWidget *widget,
|
||||
int x,
|
||||
int y,
|
||||
gboolean keyboard_tip,
|
||||
GtkTooltip *tooltip,
|
||||
NodeEditorWindow *self)
|
||||
node_editor_query_tooltip (GtkWidget *widget,
|
||||
int x,
|
||||
int y,
|
||||
gboolean keyboard_tip,
|
||||
GtkTooltip *tooltip)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||
GtkTextIter iter;
|
||||
guint i;
|
||||
GString *text;
|
||||
@@ -295,6 +295,7 @@ text_view_query_tooltip_cb (GtkWidget *widget,
|
||||
{
|
||||
gint bx, by, trailing;
|
||||
|
||||
gtk_widget_translate_coordinates (widget, self->text_view, x, y, &x, &y);
|
||||
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (self->text_view), GTK_TEXT_WINDOW_TEXT,
|
||||
x, y, &bx, &by);
|
||||
gtk_text_view_get_iter_at_position (GTK_TEXT_VIEW (self->text_view), &iter, &trailing, bx, by);
|
||||
@@ -757,6 +758,7 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
|
||||
widget_class->realize = node_editor_window_realize;
|
||||
widget_class->unrealize = node_editor_window_unrealize;
|
||||
widget_class->query_tooltip = node_editor_query_tooltip;
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, picture);
|
||||
@@ -767,7 +769,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_name_entry);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, testcase_save_button);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, open_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, save_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, export_image_cb);
|
||||
@@ -796,7 +797,7 @@ node_editor_window_create_renderer_widget (gpointer item,
|
||||
gtk_container_add (GTK_CONTAINER (box), picture);
|
||||
|
||||
row = gtk_list_box_row_new ();
|
||||
gtk_container_add (GTK_CONTAINER (row), box);
|
||||
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
|
||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||
|
||||
return row;
|
||||
|
@@ -84,9 +84,9 @@
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
<property name="focus-widget">text_view</property>
|
||||
<property name="has-tooltip">1</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="title" translatable="yes">GTK Node Editor</property>
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
@@ -120,11 +120,6 @@
|
||||
<property name="popover">testcase_popover</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">GTK Node Editor</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -144,8 +139,6 @@
|
||||
<property name="left-margin">6</property>
|
||||
<property name="right-margin">6</property>
|
||||
<property name="bottom-margin">6</property>
|
||||
<property name="has-tooltip">1</property>
|
||||
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
|
||||
<style>
|
||||
<class name="editor" />
|
||||
</style>
|
||||
|
Binary file not shown.
@@ -1799,7 +1799,7 @@ activate (GApplication *app)
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "dark", NULL, NULL, "false", change_dark_state },
|
||||
{ "theme", NULL, "s", "'current'", change_theme_state },
|
||||
{ "transition", NULL, NULL, "false", change_transition_state },
|
||||
{ "transition", NULL, NULL, "true", change_transition_state },
|
||||
{ "search", activate_search, NULL, NULL, NULL },
|
||||
{ "delete", activate_delete, NULL, NULL, NULL },
|
||||
{ "busy", get_busy, NULL, NULL, NULL },
|
||||
@@ -1816,21 +1816,27 @@ activate (GApplication *app)
|
||||
{ "app.about", { "F1", NULL } },
|
||||
{ "app.quit", { "<Control>q", NULL } },
|
||||
{ "app.open-in", { "<Control>n", NULL } },
|
||||
{ "app.cut", { "<Control>x", NULL } },
|
||||
{ "app.copy", { "<Control>c", NULL } },
|
||||
{ "app.paste", { "<Control>v", NULL } },
|
||||
{ "win.dark", { "<Control>d", NULL } },
|
||||
{ "win.search", { "<Control>s", NULL } },
|
||||
{ "win.delete", { "Delete", NULL } },
|
||||
{ "win.background", { "<Control>b", NULL } },
|
||||
{ "win.open", { "<Control>o", NULL } },
|
||||
{ "win.record", { "<Control>r", NULL } },
|
||||
{ "win.lock", { "<Control>l", NULL } },
|
||||
};
|
||||
struct {
|
||||
const gchar *action_and_target;
|
||||
const gchar *accelerators[2];
|
||||
} late_accels[] = {
|
||||
{ "app.cut", { "<Control>x", NULL } },
|
||||
{ "app.copy", { "<Control>c", NULL } },
|
||||
{ "app.paste", { "<Control>v", NULL } },
|
||||
{ "win.delete", { "Delete", NULL } },
|
||||
};
|
||||
gint i;
|
||||
GPermission *permission;
|
||||
GAction *action;
|
||||
GError *error = NULL;
|
||||
GtkEventController *controller;
|
||||
|
||||
g_type_ensure (my_text_view_get_type ());
|
||||
|
||||
@@ -1870,6 +1876,24 @@ activate (GApplication *app)
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
window);
|
||||
|
||||
controller = gtk_shortcut_controller_new ();
|
||||
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (late_accels); i++)
|
||||
{
|
||||
guint key;
|
||||
GdkModifierType mods;
|
||||
GtkShortcutTrigger *trigger;
|
||||
GtkShortcutAction *ac;
|
||||
|
||||
gtk_accelerator_parse (late_accels[i].accelerators[0], &key, &mods);
|
||||
trigger = gtk_keyval_trigger_new (key, mods);
|
||||
ac = gtk_named_action_new (late_accels[i].action_and_target);
|
||||
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
gtk_shortcut_new (trigger, ac));
|
||||
}
|
||||
gtk_widget_add_controller (GTK_WIDGET (window), controller);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (accels); i++)
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app), accels[i].action_and_target, accels[i].accelerators);
|
||||
|
||||
|
@@ -3,24 +3,6 @@
|
||||
outline-width: 0;
|
||||
}
|
||||
|
||||
.border-inset {
|
||||
border-style: inset;
|
||||
}
|
||||
|
||||
.border-outset {
|
||||
border-style: outset;
|
||||
}
|
||||
|
||||
.border-groove {
|
||||
border-style: groove;
|
||||
}
|
||||
|
||||
.border-ridge {
|
||||
border-style: ridge;
|
||||
}
|
||||
|
||||
/* These effects use 2 lines, so show them */
|
||||
.border-groove,
|
||||
.border-ridge {
|
||||
border-width: 2px;
|
||||
.toolbar {
|
||||
-gtk-icon-style: symbolic;
|
||||
}
|
||||
|
@@ -461,10 +461,12 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkStack" id="toplevel_stack">
|
||||
<property name="transition-duration">250</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">page1</property>
|
||||
<property name="title" translatable="yes">Page 1</property>
|
||||
<property name="title" translatable="yes">Page _1</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox" id="page1">
|
||||
<property name="orientation">vertical</property>
|
||||
@@ -1458,7 +1460,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">page2</property>
|
||||
<property name="title" translatable="yes">Page 2</property>
|
||||
<property name="title" translatable="yes">Page _2</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkOverlay" id="page2">
|
||||
<child type="overlay">
|
||||
@@ -1776,6 +1779,10 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="margin-bottom">6</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -1793,7 +1800,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-start">6</property>
|
||||
<property name="margin-end">6</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="margin-bottom">6</property>
|
||||
@@ -1913,6 +1919,9 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="toolbar">
|
||||
<style>
|
||||
<class name="toolbar"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">New</property>
|
||||
@@ -2174,7 +2183,8 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<property name="name">page3</property>
|
||||
<property name="title" translatable="yes">Page 3</property>
|
||||
<property name="title" translatable="yes">Page _3</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">10</property>
|
||||
|
@@ -206,11 +206,17 @@
|
||||
During the Paint phase GTK receives a single #GdkSurface::render signal on
|
||||
the toplevel surface. The signal handler will create a snapshot object
|
||||
(which is a helper for creating a scene graph) and call the
|
||||
#GtkWidget::snapshot() vfunc, which will propagate down the widget hierarchy.
|
||||
#GtkWidget::snapshot() vfunc, which will propagate down the widget hierarchy.
|
||||
This lets each widget snapshot its content at the right place and time,
|
||||
correctly handling things like partial transparencies and overlapping widgets.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
During the snapshotting of each widget, GTK automatically handles the CSS
|
||||
rendering according to the CSS box model. It snapshots first the background,
|
||||
then the border, then the widget content itself, and finally the outline.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To avoid excessive work when generating scene graphs, GTK caches render nodes.
|
||||
Each widget keeps a reference to its render node (which in turn, will refer to
|
||||
|
@@ -551,7 +551,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_scrolled_window (GTK_SCROLLED_WINDOW (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
|
||||
|
@@ -304,7 +304,6 @@
|
||||
<title>Abstract Base Classes</title>
|
||||
<xi:include href="xml/gtkwidget.xml" />
|
||||
<xi:include href="xml/gtkcontainer.xml" />
|
||||
<xi:include href="xml/gtkbin.xml" />
|
||||
<xi:include href="xml/gtkrange.xml" />
|
||||
<xi:include href="xml/gtkimcontext.xml" />
|
||||
<xi:include href="xml/gtknativedialog.xml" />
|
||||
|
@@ -198,6 +198,8 @@ gtk_aspect_frame_set_ratio
|
||||
gtk_aspect_frame_get_ratio
|
||||
gtk_aspect_frame_set_obey_child
|
||||
gtk_aspect_frame_get_obey_child
|
||||
gtk_aspect_frame_set_child
|
||||
gtk_aspect_frame_get_child
|
||||
<SUBSECTION Standard>
|
||||
GTK_ASPECT_FRAME
|
||||
GTK_IS_ASPECT_FRAME
|
||||
@@ -209,24 +211,6 @@ GTK_ASPECT_FRAME_GET_CLASS
|
||||
gtk_aspect_frame_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkbin</FILE>
|
||||
<TITLE>GtkBin</TITLE>
|
||||
GtkBin
|
||||
GtkBinClass
|
||||
gtk_bin_get_child
|
||||
<SUBSECTION Standard>
|
||||
GTK_BIN
|
||||
GTK_IS_BIN
|
||||
GTK_TYPE_BIN
|
||||
GTK_BIN_CLASS
|
||||
GTK_IS_BIN_CLASS
|
||||
GTK_BIN_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkBinPrivate
|
||||
gtk_bin_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkbox</FILE>
|
||||
<TITLE>GtkBox</TITLE>
|
||||
@@ -537,6 +521,8 @@ gtk_button_get_use_underline
|
||||
gtk_button_set_use_underline
|
||||
gtk_button_set_icon_name
|
||||
gtk_button_get_icon_name
|
||||
gtk_button_set_child
|
||||
gtk_button_get_child
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_BUTTON
|
||||
@@ -659,6 +645,8 @@ gtk_combo_box_set_entry_text_column
|
||||
gtk_combo_box_get_entry_text_column
|
||||
gtk_combo_box_set_popup_fixed_width
|
||||
gtk_combo_box_get_popup_fixed_width
|
||||
gtk_combo_box_set_child
|
||||
gtk_combo_box_get_child
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_COMBO_BOX
|
||||
GTK_COMBO_BOX
|
||||
@@ -1382,6 +1370,8 @@ gtk_font_chooser_dialog_get_type
|
||||
GtkFrame
|
||||
GtkFrameClass
|
||||
gtk_frame_new
|
||||
gtk_frame_set_child
|
||||
gtk_frame_get_child
|
||||
gtk_frame_set_label
|
||||
gtk_frame_get_label
|
||||
gtk_frame_set_label_widget
|
||||
@@ -2200,6 +2190,8 @@ gtk_scrollbar_get_type
|
||||
<TITLE>GtkScrolledWindow</TITLE>
|
||||
GtkScrolledWindow
|
||||
gtk_scrolled_window_new
|
||||
gtk_scrolled_window_get_child
|
||||
gtk_scrolled_window_set_child
|
||||
gtk_scrolled_window_get_hadjustment
|
||||
gtk_scrolled_window_set_hadjustment
|
||||
gtk_scrolled_window_get_vadjustment
|
||||
@@ -2251,6 +2243,8 @@ GtkScrolledWindowPrivate
|
||||
<TITLE>GtkSearchBar</TITLE>
|
||||
GtkSearchBar
|
||||
gtk_search_bar_new
|
||||
gtk_search_bar_set_child
|
||||
gtk_search_bar_get_child
|
||||
gtk_search_bar_connect_entry
|
||||
gtk_search_bar_get_search_mode
|
||||
gtk_search_bar_set_search_mode
|
||||
@@ -3854,6 +3848,8 @@ GtkViewport
|
||||
gtk_viewport_new
|
||||
gtk_viewport_set_scroll_to_focus
|
||||
gtk_viewport_get_scroll_to_focus
|
||||
gtk_viewport_set_child
|
||||
gtk_viewport_get_child
|
||||
<SUBSECTION Standard>
|
||||
GTK_VIEWPORT
|
||||
GTK_IS_VIEWPORT
|
||||
@@ -4193,6 +4189,8 @@ gtk_requisition_get_type
|
||||
GtkWindow
|
||||
GtkWindowClass
|
||||
gtk_window_new
|
||||
gtk_window_get_child
|
||||
gtk_window_set_child
|
||||
gtk_window_set_title
|
||||
gtk_window_set_resizable
|
||||
gtk_window_get_resizable
|
||||
@@ -4472,7 +4470,6 @@ gtk_style_context_save
|
||||
gtk_style_context_add_class
|
||||
gtk_style_context_remove_class
|
||||
gtk_style_context_has_class
|
||||
gtk_style_context_list_classes
|
||||
gtk_style_context_set_display
|
||||
gtk_style_context_set_state
|
||||
gtk_style_context_set_scale
|
||||
@@ -5468,7 +5465,10 @@ GtkLockButtonPrivate
|
||||
GtkOverlay
|
||||
|
||||
gtk_overlay_new
|
||||
gtk_overlay_set_child
|
||||
gtk_overlay_get_child
|
||||
gtk_overlay_add_overlay
|
||||
gtk_overlay_remove_overlay
|
||||
gtk_overlay_get_measure_overlay
|
||||
gtk_overlay_set_measure_overlay
|
||||
gtk_overlay_get_clip_overlay
|
||||
@@ -5579,14 +5579,8 @@ gtk_action_bar_get_type
|
||||
<TITLE>GtkHeaderBar</TITLE>
|
||||
GtkHeaderBar
|
||||
gtk_header_bar_new
|
||||
gtk_header_bar_set_title
|
||||
gtk_header_bar_get_title
|
||||
gtk_header_bar_set_subtitle
|
||||
gtk_header_bar_get_subtitle
|
||||
gtk_header_bar_set_has_subtitle
|
||||
gtk_header_bar_get_has_subtitle
|
||||
gtk_header_bar_set_custom_title
|
||||
gtk_header_bar_get_custom_title
|
||||
gtk_header_bar_set_title_widget
|
||||
gtk_header_bar_get_title_widget
|
||||
gtk_header_bar_pack_start
|
||||
gtk_header_bar_pack_end
|
||||
gtk_header_bar_set_show_title_buttons
|
||||
@@ -5626,8 +5620,6 @@ gtk_stack_get_visible_child
|
||||
gtk_stack_set_visible_child_name
|
||||
gtk_stack_get_visible_child_name
|
||||
gtk_stack_set_visible_child_full
|
||||
gtk_stack_set_homogeneous
|
||||
gtk_stack_get_homogeneous
|
||||
gtk_stack_set_hhomogeneous
|
||||
gtk_stack_get_hhomogeneous
|
||||
gtk_stack_set_vhomogeneous
|
||||
@@ -5677,6 +5669,8 @@ gtk_stack_switcher_get_type
|
||||
<TITLE>GtkRevealer</TITLE>
|
||||
GtkRevealer
|
||||
gtk_revealer_new
|
||||
gtk_revealer_get_child
|
||||
gtk_revealer_set_child
|
||||
gtk_revealer_get_reveal_child
|
||||
gtk_revealer_set_reveal_child
|
||||
gtk_revealer_get_child_revealed
|
||||
@@ -5746,6 +5740,8 @@ gtk_flow_box_bind_model
|
||||
<SUBSECTION GtkFlowBoxChild>
|
||||
GtkFlowBoxChild
|
||||
gtk_flow_box_child_new
|
||||
gtk_flow_box_child_set_child
|
||||
gtk_flow_box_child_get_child
|
||||
gtk_flow_box_child_get_index
|
||||
gtk_flow_box_child_is_selected
|
||||
gtk_flow_box_child_changed
|
||||
@@ -5776,6 +5772,8 @@ GtkPopover
|
||||
gtk_popover_new
|
||||
gtk_popover_popup
|
||||
gtk_popover_popdown
|
||||
gtk_popover_set_child
|
||||
gtk_popover_get_child
|
||||
gtk_popover_set_pointing_to
|
||||
gtk_popover_get_pointing_to
|
||||
gtk_popover_set_position
|
||||
@@ -6225,8 +6223,6 @@ gtk_gesture_long_press_get_type
|
||||
<TITLE>GtkGestureClick</TITLE>
|
||||
GtkGestureClick
|
||||
gtk_gesture_click_new
|
||||
gtk_gesture_click_set_area
|
||||
gtk_gesture_click_get_area
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_GESTURE_CLICK
|
||||
|
@@ -16,7 +16,6 @@ gtk_application_window_get_type
|
||||
gtk_aspect_frame_get_type
|
||||
gtk_assistant_get_type
|
||||
gtk_assistant_page_get_type
|
||||
gtk_bin_get_type
|
||||
gtk_bin_layout_get_type
|
||||
gtk_box_get_type
|
||||
gtk_box_layout_get_type
|
||||
|
BIN
docs/reference/gtk/images/capture-bubble.png
Normal file
BIN
docs/reference/gtk/images/capture-bubble.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
@@ -61,16 +61,9 @@
|
||||
</para>
|
||||
<para>
|
||||
GDK translates these raw windowing system events into #GdkEvents.
|
||||
Typical input events are:
|
||||
<simplelist>
|
||||
<member>button clicks</member>
|
||||
<member>pointer motion</member>
|
||||
<member>key presses</member>
|
||||
<member>focus changes</member>
|
||||
<member>touch events</member>
|
||||
</simplelist>
|
||||
These are all represented as #GdkEvents, but you can differentiate
|
||||
between different events by looking at their type, using
|
||||
Typical input events are button clicks, pointer motion, key presses
|
||||
or touch events. These are all represented as #GdkEvents, but you can
|
||||
differentiate between different events by looking at their type, using
|
||||
gdk_event_get_event_type().
|
||||
</para>
|
||||
<para>
|
||||
@@ -103,34 +96,7 @@
|
||||
location change from one widget to another.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Then the event is pushed onto a stack so you can query the currently
|
||||
handled event with gtk_get_current_event().
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
The event is sent to a widget. If a grab is active all events for widgets
|
||||
that are not in the contained in the grab widget are sent to the latter
|
||||
with a few exceptions:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Deletion and destruction events are still sent to the event widget for
|
||||
obvious reasons.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Events which directly relate to the visual representation of the event
|
||||
widget.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Leave events are delivered to the event widget if there was an enter
|
||||
event delivered to it before without the paired leave event.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Drag events are not redirected because it is unclear what the semantics
|
||||
of that would be.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
After finishing the delivery the event is popped from the event stack.
|
||||
The event is sent to widgets.
|
||||
</para></listitem>
|
||||
</orderedlist>
|
||||
|
||||
@@ -139,6 +105,14 @@
|
||||
(see #GtkPropagationPhase) towards a target widget.
|
||||
</para>
|
||||
|
||||
<informalfigure>
|
||||
<mediaobject>
|
||||
<imageobject>
|
||||
<imagedata fileref="capture-bubble.png" format="PNG"/>
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
</informalfigure>
|
||||
|
||||
<para>
|
||||
For key events, the top-level window gets a first shot at activating
|
||||
mnemonics and accelerators. If that does not consume the events,
|
||||
@@ -224,6 +198,14 @@
|
||||
<para>
|
||||
GTK has traditionally supported different kinds of shortcuts:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>Accelerators</term>
|
||||
<listitem><para>
|
||||
Accelerators are any other shortcuts that can be activated regardless
|
||||
of where the focus is, and typically trigger global actions, such as
|
||||
Ctrl-Q to quit an application.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>Mnmemonics</term>
|
||||
<listitem><para>
|
||||
@@ -242,16 +224,12 @@
|
||||
triggered when the widget has focus.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>Accelerators</term>
|
||||
<listitem><para>
|
||||
Accelerators are any other shortcuts that can be activated regardless
|
||||
of where the focus is, and typically trigger global actions, such as
|
||||
Ctrl-Q to quit an application.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
<para>
|
||||
GTK traditionally handles accelerators and mnemonics in a global scope,
|
||||
during the capture phase, and key bindings locally, during the target phase.
|
||||
</para>
|
||||
<para>
|
||||
Under the hood, all shortcuts are represented as instances of #GtkShortcut,
|
||||
and they are managed by #GtkShortcutController.
|
||||
|
@@ -214,6 +214,7 @@ images = [
|
||||
'images/box-packing.png',
|
||||
'images/builder-shortcuts.png',
|
||||
'images/button.png',
|
||||
'images/capture-bubble.png',
|
||||
'images/check-button.png',
|
||||
'images/checks.png',
|
||||
'images/clocks-shortcuts.png',
|
||||
|
@@ -307,13 +307,13 @@ create_combo_box_entry (void)
|
||||
|
||||
model = (GtkTreeModel *)gtk_list_store_new (1, G_TYPE_STRING);
|
||||
widget = g_object_new (GTK_TYPE_COMBO_BOX,
|
||||
"has-entry", TRUE,
|
||||
"model", model,
|
||||
"entry-text-column", 0,
|
||||
NULL);
|
||||
"has-entry", TRUE,
|
||||
"model", model,
|
||||
"entry-text-column", 0,
|
||||
NULL);
|
||||
g_object_unref (model);
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
child = gtk_combo_box_get_child (GTK_COMBO_BOX (widget));
|
||||
gtk_editable_set_text (GTK_EDITABLE (child), "Combo Box Entry");
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
@@ -876,7 +876,7 @@ create_scrolledwindow (void)
|
||||
GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
||||
label = gtk_label_new ("Scrolled Window");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwin), label);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwin), label);
|
||||
|
||||
return new_widget_info ("scrolledwindow", scrolledwin, MEDIUM);
|
||||
}
|
||||
@@ -1122,16 +1122,15 @@ create_headerbar (void)
|
||||
GtkWidget *button;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Header Bar");
|
||||
view = gtk_text_view_new ();
|
||||
gtk_widget_show (view);
|
||||
gtk_widget_set_size_request (window, 220, 150);
|
||||
gtk_container_add (GTK_CONTAINER (window), view);
|
||||
gtk_window_set_child (GTK_WINDOW (window), view);
|
||||
bar = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (bar), "Header Bar");
|
||||
gtk_header_bar_set_subtitle (GTK_HEADER_BAR (bar), "(subtitle)");
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), bar);
|
||||
button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic"));
|
||||
gtk_button_set_child (GTK_BUTTON (button), gtk_image_new_from_icon_name ("bookmark-new-symbolic"));
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (bar), button);
|
||||
|
||||
return new_widget_info ("headerbar", window, ASIS);
|
||||
@@ -1233,7 +1232,7 @@ create_sidebar (void)
|
||||
gtk_container_add (GTK_CONTAINER (hbox), sidebar);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), gtk_separator_new (GTK_ORIENTATION_VERTICAL));
|
||||
gtk_container_add (GTK_CONTAINER (hbox), stack);
|
||||
gtk_container_add (GTK_CONTAINER (frame), hbox);
|
||||
gtk_frame_set_child (GTK_FRAME (frame), hbox);
|
||||
|
||||
return new_widget_info ("sidebar", frame, ASIS);
|
||||
}
|
||||
|
@@ -113,7 +113,7 @@ activate (GApplication *app,
|
||||
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), G_MENU_MODEL (button_menu));
|
||||
gtk_widget_set_halign (GTK_WIDGET (button), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (GTK_WIDGET (button), GTK_ALIGN_START);
|
||||
gtk_container_add (GTK_CONTAINER (win), button);
|
||||
gtk_window_set_child (GTK_WINDOW (window), button);
|
||||
gtk_widget_show (win);
|
||||
|
||||
g_object_unref (button_menu);
|
||||
|
@@ -37,7 +37,7 @@ search_text_changed (GtkEntry *entry,
|
||||
return;
|
||||
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
|
||||
view = gtk_bin_get_child (GTK_BIN (tab));
|
||||
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
/* Very simple-minded search implementation */
|
||||
@@ -77,7 +77,7 @@ update_words (ExampleAppWindow *win)
|
||||
if (tab == NULL)
|
||||
return;
|
||||
|
||||
view = gtk_bin_get_child (GTK_BIN (tab));
|
||||
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
strings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
@@ -130,7 +130,7 @@ update_lines (ExampleAppWindow *win)
|
||||
if (tab == NULL)
|
||||
return;
|
||||
|
||||
view = gtk_bin_get_child (GTK_BIN (tab));
|
||||
view = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (tab));
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
count = gtk_text_buffer_get_line_count (buffer);
|
||||
@@ -266,7 +266,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
@@ -49,7 +49,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
|
||||
|
@@ -49,7 +49,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
|
||||
|
@@ -72,7 +72,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
@@ -72,7 +72,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user