summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/a11y/appchooser.txt2
-rw-r--r--tests/a11y/colorchooser.txt12
-rw-r--r--tests/css/Makefile.am21
-rw-r--r--tests/css/api.c49
-rw-r--r--tests/css/parser/test-css-parser.c15
-rw-r--r--tests/prop-editor.c513
-rw-r--r--tests/reftests/Makefile.am2
-rw-r--r--tests/reftests/notebook-childproperties.ref.ui68
-rw-r--r--tests/reftests/notebook-childproperties.ui78
-rw-r--r--tests/testappchooser.c12
-rw-r--r--tests/testboxcss.c17
-rw-r--r--tests/testcalendar.c9
-rw-r--r--tests/testfontselectiondialog.c2
-rw-r--r--tests/testgrid.c35
-rw-r--r--tests/testgtk.c54
-rw-r--r--tests/widget-factory.ui3
16 files changed, 575 insertions, 317 deletions
diff --git a/tests/a11y/appchooser.txt b/tests/a11y/appchooser.txt
index 1a68ab35ca..7ee2fcc41c 100644
--- a/tests/a11y/appchooser.txt
+++ b/tests/a11y/appchooser.txt
@@ -378,7 +378,7 @@ Click "Show other applications", for more options, or "Find applications online"
parent: unnamed-GtkBoxAccessible-12
index: 0
name: Select
- state: enabled focusable sensitive showing visible default
+ state: focusable showing visible default
toolkit: gtk
<AtkComponent>
layer: widget
diff --git a/tests/a11y/colorchooser.txt b/tests/a11y/colorchooser.txt
index cdd5ffb36e..88f75c9338 100644
--- a/tests/a11y/colorchooser.txt
+++ b/tests/a11y/colorchooser.txt
@@ -130,7 +130,7 @@ window1
"panel"
parent: unnamed-GtkBoxAccessible-11
index: 0
- state: enabled sensitive showing visible
+ state: enabled horizontal sensitive showing visible
toolkit: gtk
<AtkComponent>
layer: widget
@@ -726,7 +726,7 @@ window1
wrap-mode: word
<AtkAction>
action 0 name: activate
- action 0 keybinding: <Alt>s
+ action 0 keybinding: <Alt>a
<AtkValue>
minimum value: 0.000000
maximum value: 100.000000
@@ -914,7 +914,7 @@ window1
"panel"
parent: unnamed-GtkBoxAccessible-15
index: 1
- state: enabled sensitive visible
+ state: enabled horizontal sensitive visible
toolkit: gtk
<AtkComponent>
layer: widget
@@ -1329,18 +1329,18 @@ window1
"push button"
parent: unnamed-GtkBoxAccessible-57
index: 1
- name: OK
+ name: Select
state: enabled focusable sensitive showing visible default
toolkit: gtk
<AtkComponent>
layer: widget
alpha: 1
<AtkImage>
- image size: 20 x 20
+ image size: -1 x -1
image description: (null)
<AtkAction>
action 0 name: click
- action 0 keybinding: <Alt>o
+ action 0 keybinding: <Alt>s
unnamed-GtkButtonAccessible-60
"push button"
parent: unnamed-GtkBoxAccessible-57
diff --git a/tests/css/Makefile.am b/tests/css/Makefile.am
index aeada80b30..f14e7b59b2 100644
--- a/tests/css/Makefile.am
+++ b/tests/css/Makefile.am
@@ -1 +1,22 @@
+include $(top_srcdir)/Makefile.decl
+
SUBDIRS = parser
+
+check_PROGRAMS = $(TEST_PROGS)
+
+AM_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_builddir)/gdk \
+ -I$(top_srcdir)/gdk \
+ -DGDK_DISABLE_DEPRECATED \
+ -DGTK_DISABLE_DEPRECATED \
+ -DGTK_VERSION=\"$(GTK_VERSION)\"\
+ $(GTK_DEBUG_FLAGS) \
+ $(GTK_DEP_CFLAGS)
+
+LDADD = \
+ $(top_builddir)/gdk/libgdk-3.la \
+ $(top_builddir)/gtk/libgtk-3.la \
+ $(GTK_DEP_LIBS)
+
+TEST_PROGS += api
diff --git a/tests/css/api.c b/tests/css/api.c
new file mode 100644
index 0000000000..a7c93dc4b2
--- /dev/null
+++ b/tests/css/api.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 Canonical Inc.
+ *
+ * Author:
+ * Michael Terry <michael.terry@canonical.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gtk/gtk.h>
+
+static void
+gtk_css_provider_load_data_not_null_terminated (void)
+{
+ GtkCssProvider *p;
+ const gchar data[3] = {'*', '{', '}'};
+
+ p = gtk_css_provider_new();
+
+ gtk_css_provider_load_from_data(p, data, sizeof (data), NULL);
+
+ g_object_unref (p);
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ gtk_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/gtk_css_provider_load_data/not_null_terminated",
+ gtk_css_provider_load_data_not_null_terminated);
+
+ return g_test_run ();
+}
+
diff --git a/tests/css/parser/test-css-parser.c b/tests/css/parser/test-css-parser.c
index 6329a20c39..60f77ded27 100644
--- a/tests/css/parser/test-css-parser.c
+++ b/tests/css/parser/test-css-parser.c
@@ -134,21 +134,16 @@ append_error_value (GString *string,
static void
parsing_error_cb (GtkCssProvider *provider,
- const gchar *path,
- guint line,
- guint position,
- const GError * error,
- GString * errors)
+ GtkCssSection *section,
+ const GError *error,
+ GString *errors)
{
char *basename;
- g_assert (path);
- g_assert (line > 0);
-
- basename = g_path_get_basename (path);
+ basename = g_file_get_basename (gtk_css_section_get_file (section));
g_string_append_printf (errors,
"%s:%u: error: ",
- basename, line);
+ basename, gtk_css_section_get_end_line (section) + 1);
g_free (basename);
if (error->domain == GTK_CSS_PROVIDER_ERROR)
diff --git a/tests/prop-editor.c b/tests/prop-editor.c
index df983dc52e..a12b77cf08 100644
--- a/tests/prop-editor.c
+++ b/tests/prop-editor.c
@@ -35,13 +35,13 @@ static void
disconnect_func (gpointer data)
{
DisconnectData *dd = data;
-
+
g_signal_handler_disconnect (dd->instance, dd->id);
}
static void
signal_removed (gpointer data,
- GClosure *closure)
+ GClosure *closure)
{
DisconnectData *dd = data;
@@ -58,13 +58,13 @@ is_child_property (GParamSpec *pspec)
static void
mark_child_property (GParamSpec *pspec)
{
- g_param_spec_set_qdata (pspec, g_quark_from_string ("is-child-prop"),
- GINT_TO_POINTER (TRUE));
+ g_param_spec_set_qdata (pspec, g_quark_from_string ("is-child-prop"),
+ GINT_TO_POINTER (TRUE));
}
static void
g_object_connect_property (GObject *object,
- GParamSpec *spec,
+ GParamSpec *spec,
GCallback func,
gpointer data,
GObject *alive_object)
@@ -85,20 +85,20 @@ g_object_connect_property (GObject *object,
g_closure_add_invalidate_notifier (closure, dd, signal_removed);
dd->id = g_signal_connect_closure (object, with_detail,
- closure, FALSE);
+ closure, FALSE);
dd->instance = object;
dd->alive_object = alive_object;
-
+
g_object_set_data_full (G_OBJECT (alive_object),
"alive-object-data",
dd,
disconnect_func);
-
+
g_free (with_detail);
}
-typedef struct
+typedef struct
{
GObject *obj;
GParamSpec *spec;
@@ -115,7 +115,7 @@ static void
connect_controller (GObject *controller,
const gchar *signal,
GObject *model,
- GParamSpec *spec,
+ GParamSpec *spec,
GCallback func)
{
ObjectProperty *p;
@@ -125,8 +125,8 @@ connect_controller (GObject *controller,
p->spec = spec;
p->modified_id = g_signal_connect_data (controller, signal, func, p,
- (GClosureNotify)free_object_property,
- 0);
+ (GClosureNotify)free_object_property,
+ 0);
g_object_set_data (controller, "object-property", p);
}
@@ -158,8 +158,8 @@ int_modified (GtkAdjustment *adj, gpointer data)
GtkWidget *widget = GTK_WIDGET (p->obj);
GtkWidget *parent = gtk_widget_get_parent (widget);
- gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, (int) gtk_adjustment_get_value (adj), NULL);
+ gtk_container_child_set (GTK_CONTAINER (parent),
+ widget, p->spec->name, (int) gtk_adjustment_get_value (adj), NULL);
}
else
g_object_set (p->obj, p->spec->name, (int) gtk_adjustment_get_value (adj), NULL);
@@ -174,7 +174,7 @@ get_property_value (GObject *object, GParamSpec *pspec, GValue *value)
GtkWidget *parent = gtk_widget_get_parent (widget);
gtk_container_child_get_property (GTK_CONTAINER (parent),
- widget, pspec->name, value);
+ widget, pspec->name, value);
}
else
g_object_get_property (object, pspec->name, value);
@@ -184,7 +184,7 @@ static void
int_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
- GValue val = { 0, };
+ GValue val = { 0, };
g_value_init (&val, G_TYPE_INT);
@@ -210,8 +210,8 @@ uint_modified (GtkAdjustment *adj, gpointer data)
GtkWidget *widget = GTK_WIDGET (p->obj);
GtkWidget *parent = gtk_widget_get_parent (widget);
- gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, (guint) gtk_adjustment_get_value (adj), NULL);
+ gtk_container_child_set (GTK_CONTAINER (parent),
+ widget, p->spec->name, (guint) gtk_adjustment_get_value (adj), NULL);
}
else
g_object_set (p->obj, p->spec->name, (guint) gtk_adjustment_get_value (adj), NULL);
@@ -221,7 +221,7 @@ static void
uint_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
- GValue val = { 0, };
+ GValue val = { 0, };
g_value_init (&val, G_TYPE_UINT);
get_property_value (object, pspec, &val);
@@ -246,8 +246,8 @@ float_modified (GtkAdjustment *adj, gpointer data)
GtkWidget *widget = GTK_WIDGET (p->obj);
GtkWidget *parent = gtk_widget_get_parent (widget);
- gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, (float) gtk_adjustment_get_value (adj), NULL);
+ gtk_container_child_set (GTK_CONTAINER (parent),
+ widget, p->spec->name, (float) gtk_adjustment_get_value (adj), NULL);
}
else
g_object_set (p->obj, p->spec->name, (float) gtk_adjustment_get_value (adj), NULL);
@@ -257,7 +257,7 @@ static void
float_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
- GValue val = { 0, };
+ GValue val = { 0, };
g_value_init (&val, G_TYPE_FLOAT);
get_property_value (object, pspec, &val);
@@ -282,8 +282,8 @@ double_modified (GtkAdjustment *adj, gpointer data)
GtkWidget *widget = GTK_WIDGET (p->obj);
GtkWidget *parent = gtk_widget_get_parent (widget);
- gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, (double) gtk_adjustment_get_value (adj), NULL);
+ gtk_container_child_set (GTK_CONTAINER (parent),
+ widget, p->spec->name, (double) gtk_adjustment_get_value (adj), NULL);
}
else
g_object_set (p->obj, p->spec->name, (double) gtk_adjustment_get_value (adj), NULL);
@@ -293,7 +293,7 @@ static void
double_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkAdjustment *adj = GTK_ADJUSTMENT (data);
- GValue val = { 0, };
+ GValue val = { 0, };
g_value_init (&val, G_TYPE_DOUBLE);
get_property_value (object, pspec, &val);
@@ -321,8 +321,8 @@ string_modified (GtkEntry *entry, gpointer data)
GtkWidget *widget = GTK_WIDGET (p->obj);
GtkWidget *parent = gtk_widget_get_parent (widget);
- gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, text, NULL);
+ gtk_container_child_set (GTK_CONTAINER (parent),
+ widget, p->spec->name, text, NULL);
}
else
g_object_set (p->obj, p->spec->name, text, NULL);
@@ -332,10 +332,10 @@ static void
string_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkEntry *entry = GTK_ENTRY (data);
- GValue val = { 0, };
+ GValue val = { 0, };
const gchar *str;
const gchar *text;
-
+
g_value_init (&val, G_TYPE_STRING);
get_property_value (object, pspec, &val);
@@ -350,7 +350,7 @@ string_changed (GObject *object, GParamSpec *pspec, gpointer data)
gtk_entry_set_text (entry, str);
unblock_controller (G_OBJECT (entry));
}
-
+
g_value_unset (&val);
}
@@ -377,8 +377,8 @@ bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkToggleButton *tb = GTK_TOGGLE_BUTTON (data);
GtkWidget *child;
- GValue val = { 0, };
-
+ GValue val = { 0, };
+
g_value_init (&val, G_TYPE_BOOLEAN);
get_property_value (object, pspec, &val);
@@ -392,7 +392,7 @@ bool_changed (GObject *object, GParamSpec *pspec, gpointer data)
child = gtk_bin_get_child (GTK_BIN (tb));
gtk_label_set_text (GTK_LABEL (child),
g_value_get_boolean (&val) ? "TRUE" : "FALSE");
-
+
g_value_unset (&val);
}
@@ -403,7 +403,7 @@ enum_modified (GtkComboBox *cb, gpointer data)
ObjectProperty *p = data;
gint i;
GEnumClass *eclass;
-
+
eclass = G_ENUM_CLASS (g_type_class_peek (p->spec->value_type));
i = gtk_combo_box_get_active (cb);
@@ -414,8 +414,8 @@ enum_modified (GtkComboBox *cb, gpointer data)
GtkWidget *widget = GTK_WIDGET (p->obj);
GtkWidget *parent = gtk_widget_get_parent (widget);
- gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, eclass->values[i].value, NULL);
+ gtk_container_child_set (GTK_CONTAINER (parent),
+ widget, p->spec->name, eclass->values[i].value, NULL);
}
else
g_object_set (p->obj, p->spec->name, eclass->values[i].value, NULL);
@@ -425,12 +425,12 @@ static void
enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GtkComboBox *cb = GTK_COMBO_BOX (data);
- GValue val = { 0, };
+ GValue val = { 0, };
GEnumClass *eclass;
gint i;
eclass = G_ENUM_CLASS (g_type_class_peek (pspec->value_type));
-
+
g_value_init (&val, pspec->value_type);
get_property_value (object, pspec, &val);
@@ -441,14 +441,14 @@ enum_changed (GObject *object, GParamSpec *pspec, gpointer data)
break;
++i;
}
-
+
if (gtk_combo_box_get_active (cb) != i)
{
block_controller (G_OBJECT (cb));
gtk_combo_box_set_active (cb, i);
unblock_controller (G_OBJECT (cb));
}
-
+
g_value_unset (&val);
}
@@ -461,9 +461,9 @@ flags_modified (GtkCheckButton *button, gpointer data)
GFlagsClass *fclass;
guint flags;
gint i;
-
+
fclass = G_FLAGS_CLASS (g_type_class_peek (p->spec->value_type));
-
+
active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
i = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (button), "index"));
@@ -472,15 +472,15 @@ flags_modified (GtkCheckButton *button, gpointer data)
GtkWidget *widget = GTK_WIDGET (p->obj);
GtkWidget *parent = gtk_widget_get_parent (widget);
- gtk_container_child_get (GTK_CONTAINER (parent),
- widget, p->spec->name, &flags, NULL);
+ gtk_container_child_get (GTK_CONTAINER (parent),
+ widget, p->spec->name, &flags, NULL);
if (active)
flags |= fclass->values[i].value;
else
flags &= ~fclass->values[i].value;
- gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, flags, NULL);
+ gtk_container_child_set (GTK_CONTAINER (parent),
+ widget, p->spec->name, flags, NULL);
}
else
{
@@ -499,13 +499,13 @@ static void
flags_changed (GObject *object, GParamSpec *pspec, gpointer data)
{
GList *children, *c;
- GValue val = { 0, };
+ GValue val = { 0, };
GFlagsClass *fclass;
guint flags;
gint i;
fclass = G_FLAGS_CLASS (g_type_class_peek (pspec->value_type));
-
+
g_value_init (&val, pspec->value_type);
get_property_value (object, pspec, &val);
flags = g_value_get_flags (&val);
@@ -528,7 +528,7 @@ static gunichar
unichar_get_value (GtkEntry *entry)
{
const gchar *text = gtk_entry_get_text (entry);
-
+
if (text[0])
return g_utf8_get_char (text);
else
@@ -546,8 +546,8 @@ unichar_modified (GtkEntry *entry, gpointer data)
GtkWidget *widget = GTK_WIDGET (p->obj);
GtkWidget *parent = gtk_widget_get_parent (widget);
- gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, val, NULL);
+ gtk_container_child_set (GTK_CONTAINER (parent),
+ widget, p->spec->name, val, NULL);
}
else
g_object_set (p->obj, p->spec->name, val, NULL);
@@ -562,7 +562,7 @@ unichar_changed (GObject *object, GParamSpec *pspec, gpointer data)
GValue val = { 0, };
gchar buf[7];
gint len;
-
+
g_value_init (&val, pspec->value_type);
get_property_value (object, pspec, &val);
new_val = (gunichar)g_value_get_uint (&val);
@@ -570,12 +570,12 @@ unichar_changed (GObject *object, GParamSpec *pspec, gpointer data)
if (new_val != old_val)
{
if (!new_val)
- len = 0;
+ len = 0;
else
- len = g_unichar_to_utf8 (new_val, buf);
-
+ len = g_unichar_to_utf8 (new_val, buf);
+
buf[len] = '\0';
-
+
block_controller (G_OBJECT (entry));
gtk_entry_set_text (entry, buf);
unblock_controller (G_OBJECT (entry));
@@ -588,7 +588,7 @@ pointer_changed (GObject *object, GParamSpec *pspec, gpointer data)
GtkLabel *label = GTK_LABEL (data);
gchar *str;
gpointer ptr;
-
+
g_object_get (object, pspec->name, &ptr, NULL);
str = g_strdup_printf ("Pointer: %p", ptr);
@@ -616,15 +616,15 @@ object_changed (GObject *object, GParamSpec *pspec, gpointer data)
GtkWidget *label, *button;
gchar *str;
GObject *obj;
-
- GList *children = gtk_container_get_children (GTK_CONTAINER (data));
+
+ GList *children = gtk_container_get_children (GTK_CONTAINER (data));
label = GTK_WIDGET (children->data);
button = GTK_WIDGET (children->next->data);
g_object_get (object, pspec->name, &obj, NULL);
g_list_free (children);
str = object_label (obj, pspec);
-
+
gtk_label_set_text (GTK_LABEL (label), str);
gtk_widget_set_sensitive (button, G_IS_OBJECT (obj));
@@ -648,18 +648,18 @@ window_destroy (gpointer data)
}
static void
-object_properties (GtkWidget *button,
- GObject *object)
+object_properties (GtkWidget *button,
+ GObject *object)
{
gchar *name;
GObject *obj;
name = (gchar *) g_object_get_data (G_OBJECT (button), "property-name");
g_object_get (object, name, &obj, NULL);
- if (G_IS_OBJECT (obj))
+ if (G_IS_OBJECT (obj))
create_prop_editor (obj, 0);
}
-
+
static void
color_modified (GtkColorButton *cb, gpointer data)
{
@@ -674,7 +674,7 @@ color_modified (GtkColorButton *cb, gpointer data)
GtkWidget *parent = gtk_widget_get_parent (widget);
gtk_container_child_set (GTK_CONTAINER (parent),
- widget, p->spec->name, &rgba, NULL);
+ widget, p->spec->name, &rgba, NULL);
}
else
g_object_set (p->obj, p->spec->name, &rgba, NULL);
@@ -705,9 +705,9 @@ color_changed (GObject *object, GParamSpec *pspec, gpointer data)
}
static GtkWidget *
-property_widget (GObject *object,
- GParamSpec *spec,
- gboolean can_modify)
+property_widget (GObject *object,
+ GParamSpec *spec,
+ gboolean can_modify)
{
GtkWidget *prop_edit;
GtkAdjustment *adj;
@@ -724,14 +724,14 @@ property_widget (GObject *object,
0.0);
prop_edit = gtk_spin_button_new (adj, 1.0, 0);
-
- g_object_connect_property (object, spec,
- G_CALLBACK (int_changed),
- adj, G_OBJECT (adj));
-
+
+ g_object_connect_property (object, spec,
+ G_CALLBACK (int_changed),
+ adj, G_OBJECT (adj));
+
if (can_modify)
- connect_controller (G_OBJECT (adj), "value_changed",
- object, spec, G_CALLBACK (int_modified));
+ connect_controller (G_OBJECT (adj), "value_changed",
+ object, spec, G_CALLBACK (int_modified));
}
else if (type == G_TYPE_PARAM_UINT)
{
@@ -743,14 +743,14 @@ property_widget (GObject *object,
0.0);
prop_edit = gtk_spin_button_new (adj, 1.0, 0);
-
- g_object_connect_property (object, spec,
- G_CALLBACK (uint_changed),
- adj, G_OBJECT (adj));
-
+
+ g_object_connect_property (object, spec,
+ G_CALLBACK (uint_changed),
+ adj, G_OBJECT (adj));
+
if (can_modify)
- connect_controller (G_OBJECT (adj), "value_changed",
- object, spec, G_CALLBACK (uint_modified));
+ connect_controller (G_OBJECT (adj), "value_changed",
+ object, spec, G_CALLBACK (uint_modified));
}
else if (type == G_TYPE_PARAM_FLOAT)
{
@@ -762,14 +762,14 @@ property_widget (GObject *object,
0.0);
prop_edit = gtk_spin_button_new (adj, 0.1, 2);
-
- g_object_connect_property (object, spec,
- G_CALLBACK (float_changed),
- adj, G_OBJECT (adj));
-
+
+ g_object_connect_property (object, spec,
+ G_CALLBACK (float_changed),
+ adj, G_OBJECT (adj));
+
if (can_modify)
- connect_controller (G_OBJECT (adj), "value_changed",
- object, spec, G_CALLBACK (float_modified));
+ connect_controller (G_OBJECT (adj), "value_changed",
+ object, spec, G_CALLBACK (float_modified));
}
else if (type == G_TYPE_PARAM_DOUBLE)
{
@@ -781,118 +781,118 @@ property_widget (GObject *object,
0.0);
prop_edit = gtk_spin_button_new (adj, 0.1, 2);
-
- g_object_connect_property (object, spec,
- G_CALLBACK (double_changed),
- adj, G_OBJECT (adj));
-
+
+ g_object_connect_property (object, spec,
+ G_CALLBACK (double_changed),
+ adj, G_OBJECT (adj));
+
if (can_modify)
- connect_controller (G_OBJECT (adj), "value_changed",
- object, spec, G_CALLBACK (double_modified));
+ connect_controller (G_OBJECT (adj), "value_changed",
+ object, spec, G_CALLBACK (double_modified));
}
else if (type == G_TYPE_PARAM_STRING)
{
prop_edit = gtk_entry_new ();
-
- g_object_connect_property (object, spec,
- G_CALLBACK (string_changed),
- prop_edit, G_OBJECT (prop_edit));
-
+
+ g_object_connect_property (object, spec,
+ G_CALLBACK (string_changed),
+ prop_edit, G_OBJECT (prop_edit));
+
if (can_modify)
- connect_controller (G_OBJECT (prop_edit), "changed",
- object, spec, G_CALLBACK (string_modified));
+ connect_controller (G_OBJECT (prop_edit), "changed",
+ object, spec, G_CALLBACK (string_modified));
}
else if (type == G_TYPE_PARAM_BOOLEAN)
{
prop_edit = gtk_toggle_button_new_with_label ("");
-
- g_object_connect_property (object, spec,
- G_CALLBACK (bool_changed),
- prop_edit, G_OBJECT (prop_edit));
-
+
+ g_object_connect_property (object, spec,
+ G_CALLBACK (bool_changed),
+ prop_edit, G_OBJECT (prop_edit));
+
if (can_modify)
- connect_controller (G_OBJECT (prop_edit), "toggled",
- object, spec, G_CALLBACK (bool_modified));
+ connect_controller (G_OBJECT (prop_edit), "toggled",
+ object, spec, G_CALLBACK (bool_modified));
}
else if (type == G_TYPE_PARAM_ENUM)
{
{
- GEnumClass *eclass;
- gint j;
-
- prop_edit = gtk_combo_box_text_new ();
-
- eclass = G_ENUM_CLASS (g_type_class_ref (spec->value_type));
-
- j = 0;
- while (j < eclass->n_values)
- {
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (prop_edit),
- eclass->values[j].value_name);
- ++j;
- }
-
- g_type_class_unref (eclass);
-
- g_object_connect_property (object, spec,
- G_CALLBACK (enum_changed),
- prop_edit, G_OBJECT (prop_edit));
-
- if (can_modify)
- connect_controller (G_OBJECT (prop_edit), "changed",
- object, spec, G_CALLBACK (enum_modified));
+ GEnumClass *eclass;
+ gint j;
+
+ prop_edit = gtk_combo_box_text_new ();
+
+ eclass = G_ENUM_CLASS (g_type_class_ref (spec->value_type));
+
+ j = 0;
+ while (j < eclass->n_values)
+ {
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (prop_edit),
+ eclass->values[j].value_name);
+ ++j;
+ }
+
+ g_type_class_unref (eclass);
+
+ g_object_connect_property (object, spec,
+ G_CALLBACK (enum_changed),
+ prop_edit, G_OBJECT (prop_edit));
+
+ if (can_modify)
+ connect_controller (G_OBJECT (prop_edit), "changed",
+ object, spec, G_CALLBACK (enum_modified));
}
}
else if (type == G_TYPE_PARAM_FLAGS)
{
{
- GFlagsClass *fclass;
- gint j;
-
- prop_edit = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-
- fclass = G_FLAGS_CLASS (g_type_class_ref (spec->value_type));
-
- for (j = 0; j < fclass->n_values; j++)
- {
- GtkWidget *b;
-
- b = gtk_check_button_new_with_label (fclass->values[j].value_name);
+ GFlagsClass *fclass;
+ gint j;
+
+ prop_edit = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+
+ fclass = G_FLAGS_CLASS (g_type_class_ref (spec->value_type));
+
+ for (j = 0; j < fclass->n_values; j++)
+ {
+ GtkWidget *b;
+
+ b = gtk_check_button_new_with_label (fclass->values[j].value_name);
g_object_set_data (G_OBJECT (b), "index", GINT_TO_POINTER (j));
- gtk_widget_show (b);
- gtk_box_pack_start (GTK_BOX (prop_edit), b, FALSE, FALSE, 0);
- if (can_modify)
- connect_controller (G_OBJECT (b), "toggled",
- object, spec, G_CALLBACK (flags_modified));
- }
-
- g_type_class_unref (fclass);
-
- g_object_connect_property (object, spec,
- G_CALLBACK (flags_changed),
- prop_edit, G_OBJECT (prop_edit));
+ gtk_widget_show (b);
+ gtk_box_pack_start (GTK_BOX (prop_edit), b, FALSE, FALSE, 0);
+ if (can_modify)
+ connect_controller (G_OBJECT (b), "toggled",
+ object, spec, G_CALLBACK (flags_modified));
+ }
+
+ g_type_class_unref (fclass);
+
+ g_object_connect_property (object, spec,
+ G_CALLBACK (flags_changed),
+ prop_edit, G_OBJECT (prop_edit));
}
}
else if (type == G_TYPE_PARAM_UNICHAR)
{
prop_edit = gtk_entry_new ();
gtk_entry_set_max_length (GTK_ENTRY (prop_edit), 1);
-
+
g_object_connect_property (object, spec,
- G_CALLBACK (unichar_changed),
- prop_edit, G_OBJECT (prop_edit));
-
+ G_CALLBACK (unichar_changed),
+ prop_edit, G_OBJECT (prop_edit));
+
if (can_modify)
- connect_controller (G_OBJECT (prop_edit), "changed",
- object, spec, G_CALLBACK (unichar_modified));
+ connect_controller (G_OBJECT (prop_edit), "changed",
+ object, spec, G_CALLBACK (unichar_modified));
}
else if (type == G_TYPE_PARAM_POINTER)
{
prop_edit = gtk_label_new ("");
-
- g_object_connect_property (object, spec,
- G_CALLBACK (pointer_changed),
- prop_edit, G_OBJECT (prop_edit));
+
+ g_object_connect_property (object, spec,
+ G_CALLBACK (pointer_changed),
+ prop_edit, G_OBJECT (prop_edit));
}
else if (type == G_TYPE_PARAM_OBJECT)
{
@@ -902,17 +902,17 @@ property_widget (GObject *object,
label = gtk_label_new ("");
button = gtk_button_new_with_label ("Properties");
- g_object_set_data (G_OBJECT (button), "property-name", spec->name);
- g_signal_connect (button, "clicked",
- G_CALLBACK (object_properties),
- object);
+ g_object_set_data (G_OBJECT (button), "property-name", (gpointer) spec->name);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (object_properties),
+ object);
gtk_container_add (GTK_CONTAINER (prop_edit), label);
gtk_container_add (GTK_CONTAINER (prop_edit), button);
g_object_connect_property (object, spec,
- G_CALLBACK (object_changed),
- prop_edit, G_OBJECT (label));
+ G_CALLBACK (object_changed),
+ prop_edit, G_OBJECT (label));
/* The Properties button is not really modifying, anyway */
can_modify = TRUE;
@@ -923,22 +923,23 @@ property_widget (GObject *object,
prop_edit = gtk_color_button_new ();
g_object_connect_property (object, spec,
- G_CALLBACK (color_changed),
- prop_edit, G_OBJECT (prop_edit));
+ G_CALLBACK (color_changed),
+ prop_edit, G_OBJECT (prop_edit));
if (can_modify)
- connect_controller (G_OBJECT (prop_edit), "color-set",
- object, spec, G_CALLBACK (color_modified));
+ connect_controller (G_OBJECT (prop_edit), "color-set",
+ object, spec, G_CALLBACK (color_modified));
}
else
- {
+ {
msg = g_strdup_printf ("uneditable property type: %s",
- g_type_name (G_PARAM_SPEC_TYPE (spec)));
- prop_edit = gtk_label_new (msg);
+ g_type_name (G_PARAM_SPEC_TYPE (spec)));
+ prop_edit = gtk_label_new (msg);
g_free (msg);
- gtk_misc_set_alignment (GTK_MISC (prop_edit), 0.0, 0.5);
+ gtk_widget_set_halign (prop_edit, GTK_ALIGN_START);
+ gtk_widget_set_valign (prop_edit, GTK_ALIGN_CENTER);
}
-
+
if (!can_modify)
gtk_widget_set_sensitive (prop_edit, FALSE);
@@ -950,7 +951,7 @@ property_widget (GObject *object,
static GtkWidget *
properties_from_type (GObject *object,
- GType type)
+ GType type)
{
GtkWidget *prop_edit;
GtkWidget *label;
@@ -971,12 +972,12 @@ properties_from_type (GObject *object,
GObjectClass *class = G_OBJECT_CLASS (g_type_class_peek (type));
specs = g_object_class_list_properties (class, &n_specs);
}
-
+
if (n_specs == 0) {
g_free (specs);
return NULL;
}
-
+
table = gtk_table_new (n_specs, 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
@@ -986,30 +987,31 @@ properties_from_type (GObject *object,
{
GParamSpec *spec = specs[i];
gboolean can_modify;
-
+
prop_edit = NULL;
can_modify = ((spec->flags & G_PARAM_WRITABLE) != 0 &&
(spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0);
-
+
if ((spec->flags & G_PARAM_READABLE) == 0)
{
/* can't display unreadable properties */
++i;
continue;
}
-
+
if (spec->owner_type != type)
- {
- /* we're only interested in params of type */
- ++i;
- continue;
- }
+ {
+ /* we're only interested in params of type */
+ ++i;
+ continue;
+ }
label = gtk_label_new (g_param_spec_get_nick (spec));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i + 1);
-
+
prop_edit = property_widget (object, spec, can_modify);
gtk_table_attach_defaults (GTK_TABLE (table), prop_edit, 1, 2, i, i + 1);
@@ -1026,7 +1028,7 @@ properties_from_type (GObject *object,
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
+
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), vbox);
g_free (specs);
@@ -1066,23 +1068,24 @@ child_properties_from_object (GObject *object)
{
GParamSpec *spec = specs[i];
gboolean can_modify;
-
+
prop_edit = NULL;
can_modify = ((spec->flags & G_PARAM_WRITABLE) != 0 &&
(spec->flags & G_PARAM_CONSTRUCT_ONLY) == 0);
-
+
if ((spec->flags & G_PARAM_READABLE) == 0)
{
/* can't display unreadable properties */
++i;
continue;
}
-
+
label = gtk_label_new (g_param_spec_get_nick (spec));
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i + 1);
-
+
mark_child_property (spec);
prop_edit = property_widget (object, spec, can_modify);
gtk_table_attach_defaults (GTK_TABLE (table), prop_edit, 1, 2, i, i + 1);
@@ -1099,7 +1102,7 @@ child_properties_from_object (GObject *object)
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
+
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), vbox);
g_free (specs);
@@ -1108,8 +1111,8 @@ child_properties_from_object (GObject *object)
}
static void
-child_properties (GtkWidget *button,
- GObject *object)
+child_properties (GtkWidget *button,
+ GObject *object)
{
create_prop_editor (object, 0);
}
@@ -1130,13 +1133,14 @@ children_from_object (GObject *object)
table = gtk_table_new (g_list_length (children), 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
-
+
for (c = children, i = 0; c; c = c->next, i++)
{
object = c->data;
label = gtk_label_new ("Child");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i + 1);
prop_edit = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
@@ -1161,7 +1165,7 @@ children_from_object (GObject *object)
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
+
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), vbox);
g_list_free (children);
@@ -1185,13 +1189,14 @@ cells_from_object (GObject *object)
table = gtk_table_new (g_list_length (cells), 2, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 0, 10);
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
-
+
for (c = cells, i = 0; c; c = c->next, i++)
{
object = c->data;
label = gtk_label_new ("Cell");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, i, i + 1);
prop_edit = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
@@ -1216,7 +1221,7 @@ cells_from_object (GObject *object)
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
+
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), vbox);
g_list_free (cells);
@@ -1227,7 +1232,7 @@ cells_from_object (GObject *object)
/* Pass zero for type if you want all properties */
GtkWidget*
create_prop_editor (GObject *object,
- GType type)
+ GType type)
{
GtkWidget *win;
GtkWidget *notebook;
@@ -1236,7 +1241,7 @@ create_prop_editor (GObject *object,
gchar *title;
GType *ifaces;
guint n_ifaces;
-
+
if ((win = g_object_get_data (G_OBJECT (object), "prop-editor-win")))
{
gtk_window_present (GTK_WINDOW (win));
@@ -1246,7 +1251,7 @@ create_prop_editor (GObject *object,
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
if (GTK_IS_WIDGET (object))
gtk_window_set_screen (GTK_WINDOW (win),
- gtk_widget_get_screen (GTK_WIDGET (object)));
+ gtk_widget_get_screen (GTK_WIDGET (object)));
/* hold a weak ref to the object we're editing */
g_object_set_data_full (G_OBJECT (object), "prop-editor-win", win, model_destroy);
@@ -1256,65 +1261,65 @@ create_prop_editor (GObject *object,
{
notebook = gtk_notebook_new ();
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_LEFT);
-
+
gtk_container_add (GTK_CONTAINER (win), notebook);
-
+
type = G_TYPE_FROM_INSTANCE (object);
title = g_strdup_printf ("Properties of %s widget", g_type_name (type));
gtk_window_set_title (GTK_WINDOW (win), title);
g_free (title);
-
+
while (type)
- {
- properties = properties_from_type (object, type);
- if (properties)
- {
- label = gtk_label_new (g_type_name (type));
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
- properties, label);
- }
-
- type = g_type_parent (type);
- }
+ {
+ properties = properties_from_type (object, type);
+ if (properties)
+ {
+ label = gtk_label_new (g_type_name (type));
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
+ properties, label);
+ }
+
+ type = g_type_parent (type);
+ }
ifaces = g_type_interfaces (G_TYPE_FROM_INSTANCE (object), &n_ifaces);
while (n_ifaces--)
- {
- properties = properties_from_type (object, ifaces[n_ifaces]);
- if (properties)
- {
- label = gtk_label_new (g_type_name (ifaces[n_ifaces]));
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
- properties, label);
- }
- }
+ {
+ properties = properties_from_type (object, ifaces[n_ifaces]);
+ if (properties)
+ {
+ label = gtk_label_new (g_type_name (ifaces[n_ifaces]));
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
+ properties, label);
+ }
+ }
g_free (ifaces);
properties = child_properties_from_object (object);
if (properties)
- {
- label = gtk_label_new ("Child properties");
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
- properties, label);
- }
+ {
+ label = gtk_label_new ("Child properties");
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
+ properties, label);
+ }
properties = children_from_object (object);
if (properties)
- {
- label = gtk_label_new ("Children");
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
- properties, label);
- }
+ {
+ label = gtk_label_new ("Children");
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
+ properties, label);
+ }
properties = cells_from_object (object);
if (properties)
- {
- label = gtk_label_new ("Cell renderers");
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
- properties, label);
- }
+ {
+ label = gtk_label_new ("Cell renderers");
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
+ properties, label);
+ }
}
else
{
@@ -1324,9 +1329,9 @@ create_prop_editor (GObject *object,
gtk_window_set_title (GTK_WINDOW (win), title);
g_free (title);
}
-
+
gtk_window_set_default_size (GTK_WINDOW (win), -1, 400);
-
+
gtk_widget_show_all (win);
return win;
diff --git a/tests/reftests/Makefile.am b/tests/reftests/Makefile.am
index 8364dde4f1..1b790b6d6f 100644
--- a/tests/reftests/Makefile.am
+++ b/tests/reftests/Makefile.am
@@ -132,6 +132,8 @@ EXTRA_DIST += \
no-colors.ui \
nonresizable-size.ref.ui \
nonresizable-size.ui \
+ notebook-childproperties.ui \
+ notebook-childproperties.ref.ui \
paned-undersized.css \
paned-undersized.ref.ui \
paned-undersized.ui \
diff --git a/tests/reftests/notebook-childproperties.ref.ui b/tests/reftests/notebook-childproperties.ref.ui
new file mode 100644
index 0000000000..d9bcb0da5e
--- /dev/null
+++ b/tests/reftests/notebook-childproperties.ref.ui
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="window1">
+ <property name="can_focus">False</property>
+ <property name="type">popup</property>
+ <child>
+ <object class="GtkNotebook" id="notebook1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 1</property>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 2</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 2</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 3</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 3</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/tests/reftests/notebook-childproperties.ui b/tests/reftests/notebook-childproperties.ui
new file mode 100644
index 0000000000..db68cd1fdc
--- /dev/null
+++ b/tests/reftests/notebook-childproperties.ui
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="window1">
+ <property name="can_focus">False</property>
+ <property name="type">popup</property>
+ <child>
+ <object class="GtkNotebook" id="notebook1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 1</property>
+ </object>
+ <packing>
+ <property name="tab_expand">True</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 1</property>
+ </object>
+ <packing>
+ <property name="tab_expand">True</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 2</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 2</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 3</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_expand">True</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">page 3</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_expand">True</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/tests/testappchooser.c b/tests/testappchooser.c
index 6bf121a685..dd40ed6b87 100644
--- a/tests/testappchooser.c
+++ b/tests/testappchooser.c
@@ -41,10 +41,14 @@ dialog_response (GtkDialog *d,
if (response_id == GTK_RESPONSE_OK)
{
app_info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (d));
- name = g_app_info_get_name (app_info);
- g_print ("Application selected: %s\n", name);
-
- g_object_unref (app_info);
+ if (app_info)
+ {
+ name = g_app_info_get_name (app_info);
+ g_print ("Application selected: %s\n", name);
+ g_object_unref (app_info);
+ }
+ else
+ g_print ("No application selected\n");
}
gtk_widget_destroy (GTK_WIDGET (d));
diff --git a/tests/testboxcss.c b/tests/testboxcss.c
index 2ae081b577..17d576e10c 100644
--- a/tests/testboxcss.c
+++ b/tests/testboxcss.c
@@ -49,20 +49,21 @@
static void
show_parsing_error (GtkCssProvider *provider,
- const gchar *path,
- guint line,
- guint position,
+ GtkCssSection *section,
const GError *error,
GtkTextBuffer *buffer)
{
GtkTextIter start, end;
const char *tag_name;
- gtk_text_buffer_get_iter_at_line (buffer, &start, line - 1);
- if (gtk_text_buffer_get_line_count (buffer) <= line)
- gtk_text_buffer_get_end_iter (buffer, &end);
- else
- gtk_text_buffer_get_iter_at_line (buffer, &end, line);
+ gtk_text_buffer_get_iter_at_line_index (buffer,
+ &start,
+ gtk_css_section_get_start_line (section),
+ gtk_css_section_get_start_position (section));
+ gtk_text_buffer_get_iter_at_line_index (buffer,
+ &end,
+ gtk_css_section_get_end_line (section),
+ gtk_css_section_get_end_position (section));
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
tag_name = "warning";
diff --git a/tests/testcalendar.c b/tests/testcalendar.c
index 2b0d162f34..bce73e258b 100644
--- a/tests/testcalendar.c
+++ b/tests/testcalendar.c
@@ -488,7 +488,8 @@ create_calendar(void)
label = gtk_label_new_with_mnemonic ("_Font:");
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_size_group_add_widget (size, label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL);
@@ -508,7 +509,8 @@ create_calendar(void)
label = gtk_label_new_with_mnemonic ("Details W_idth:");
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_size_group_add_widget (size, label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL);
@@ -528,7 +530,8 @@ create_calendar(void)
label = gtk_label_new_with_mnemonic ("Details H_eight:");
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_size_group_add_widget (size, label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, DEF_PAD_SMALL);
diff --git a/tests/testfontselectiondialog.c b/tests/testfontselectiondialog.c
index bcc1c80528..96f8652c73 100644
--- a/tests/testfontselectiondialog.c
+++ b/tests/testfontselectiondialog.c
@@ -27,7 +27,7 @@ int
main (int argc, char *argv[])
{
GtkWidget *dialog;
- GtkWidget *ok;
+ GtkWidget *ok G_GNUC_UNUSED;
gtk_init (&argc, &argv);
diff --git a/tests/testgrid.c b/tests/testgrid.c
index cb79b359f7..c756158f92 100644
--- a/tests/testgrid.c
+++ b/tests/testgrid.c
@@ -40,7 +40,7 @@ simple_grid (void)
{
GtkWidget *window;
GtkWidget *grid;
- GtkWidget *child;
+ GtkWidget *test1, *test2, *test3, *test4, *test5, *test6;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Orientation");
@@ -50,17 +50,28 @@ simple_grid (void)
gtk_grid_set_column_spacing (GTK_GRID (grid), 5);
gtk_grid_set_row_spacing (GTK_GRID (grid), 5);
- gtk_container_add (GTK_CONTAINER (grid), test_widget ("1", "red"));
- gtk_container_add (GTK_CONTAINER (grid), test_widget ("2", "green"));
- gtk_container_add (GTK_CONTAINER (grid), test_widget ("3", "blue"));
- child = test_widget ("4", "green");
- gtk_grid_attach (GTK_GRID (grid), child, 0, 1, 1, 1);
- gtk_widget_set_vexpand (child, TRUE);
- gtk_grid_attach_next_to (GTK_GRID (grid), test_widget ("5", "blue"), child, GTK_POS_RIGHT, 2, 1);
- child = test_widget ("6", "yellow");
- gtk_grid_attach (GTK_GRID (grid), child, -1, 0, 1, 2);
- gtk_widget_set_hexpand (child, TRUE);
-
+ test1 = test_widget ("1", "red");
+ gtk_container_add (GTK_CONTAINER (grid), test1);
+ test2 = test_widget ("2", "green");
+ gtk_container_add (GTK_CONTAINER (grid), test2);
+ test3 = test_widget ("3", "blue");
+ gtk_container_add (GTK_CONTAINER (grid), test3);
+ test4 = test_widget ("4", "green");
+ gtk_grid_attach (GTK_GRID (grid), test4, 0, 1, 1, 1);
+ gtk_widget_set_vexpand (test4, TRUE);
+ test5 = test_widget ("5", "blue");
+ gtk_grid_attach_next_to (GTK_GRID (grid), test5, test4, GTK_POS_RIGHT, 2, 1);
+ test6 = test_widget ("6", "yellow");
+ gtk_grid_attach (GTK_GRID (grid), test6, -1, 0, 1, 2);
+ gtk_widget_set_hexpand (test6, TRUE);
+
+ g_assert (gtk_grid_get_child_at (GTK_GRID (grid), 0, -1) == NULL);
+ g_assert (gtk_grid_get_child_at (GTK_GRID (grid), 0, 0) == test1);
+ g_assert (gtk_grid_get_child_at (GTK_GRID (grid), 1, 0) == test2);
+ g_assert (gtk_grid_get_child_at (GTK_GRID (grid), 0, 1) == test4);
+ g_assert (gtk_grid_get_child_at (GTK_GRID (grid), -1, 0) == test6);
+ g_assert (gtk_grid_get_child_at (GTK_GRID (grid), -1, 1) == test6);
+ g_assert (gtk_grid_get_child_at (GTK_GRID (grid), -1, 2) == NULL);
gtk_widget_show_all (window);
}
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 2a962c599a..1380a79805 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -2655,7 +2655,8 @@ create_saved_position (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("X Origin : ");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
x_label = gtk_label_new ("");
@@ -2667,7 +2668,8 @@ create_saved_position (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Y Origin : ");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
y_label = gtk_label_new ("");
@@ -4654,7 +4656,8 @@ create_spins (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 5);
label = gtk_label_new ("Time :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
adjustment = gtk_adjustment_new (0, 0, 1410, 30, 60, 0);
@@ -4672,7 +4675,8 @@ create_spins (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 5);
label = gtk_label_new ("Month :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
adjustment = gtk_adjustment_new (1.0, 1.0, 12.0, 1.0,
@@ -4696,7 +4700,8 @@ create_spins (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 5);
label = gtk_label_new ("Hex :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
adjustment = gtk_adjustment_new (0, 0, 255, 1, 16, 0);
@@ -4728,7 +4733,8 @@ create_spins (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 5);
label = gtk_label_new ("Value :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
adjustment = gtk_adjustment_new (0.0, -10000.0, 10000.0,
@@ -4741,7 +4747,8 @@ create_spins (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (hbox), vbox2, FALSE, FALSE, 5);
label = gtk_label_new ("Digits :");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
adjustment = gtk_adjustment_new (2, 1, 15, 1, 1, 0);
@@ -4979,7 +4986,8 @@ create_cursors (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Cursor Theme : ");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
entry = gtk_entry_new ();
@@ -5001,7 +5009,8 @@ create_cursors (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
label = gtk_label_new ("Cursor Value : ");
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
adjustment = gtk_adjustment_new (0,
@@ -8411,7 +8420,8 @@ create_progress_bar (GtkWidget *widget)
gtk_table_attach (GTK_TABLE (tab), label, 0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
pdata->omenu1 = build_option_menu (items1, 4, 0,
progressbar_toggle_orientation,
@@ -8458,7 +8468,8 @@ create_progress_bar (GtkWidget *widget)
gtk_table_attach (GTK_TABLE (tab), label, 0, 1, 10, 11,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
5, 5);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
pdata->elmenu = build_option_menu (ellipsize_items,
sizeof (ellipsize_items) / sizeof (ellipsize_items[0]),
2, // PANGO_ELLIPSIZE_MIDDLE
@@ -9860,7 +9871,8 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (content_area), vbox, FALSE, FALSE, 0);
label = gtk_label_new ("Font:");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
font_desc = pango_font_description_from_string ("Helvetica,Sans Oblique 18");
@@ -9870,7 +9882,8 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
label = gtk_label_new ("Foreground:");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Some Text");
@@ -9878,7 +9891,8 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
label = gtk_label_new ("Background:");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Some Text");
@@ -9886,7 +9900,8 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
label = gtk_label_new ("Text:");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
entry = gtk_entry_new ();
@@ -9895,7 +9910,8 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
label = gtk_label_new ("Base:");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
entry = gtk_entry_new ();
@@ -9904,7 +9920,8 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
label = gtk_label_new ("Cursor:");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
entry = gtk_entry_new ();
@@ -9913,7 +9930,8 @@ create_styles (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
label = gtk_label_new ("Multiple:");
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_widget_set_halign (label, GTK_ALIGN_START);
+ gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
button = gtk_button_new_with_label ("Some Text");
diff --git a/tests/widget-factory.ui b/tests/widget-factory.ui
index f78007d9da..d40e97efcf 100644
--- a/tests/widget-factory.ui
+++ b/tests/widget-factory.ui
@@ -242,6 +242,9 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
<object class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <style>
+ <class name="primary-toolbar"/>
+ </style>
<child>
<object class="GtkToolButton" id="toolbutton2">
<property name="visible">True</property>