diff --git a/demos/gtk-demo/drawingarea.c b/demos/gtk-demo/drawingarea.c index 39254c67f5..68d4aee9e8 100644 --- a/demos/gtk-demo/drawingarea.c +++ b/demos/gtk-demo/drawingarea.c @@ -311,6 +311,7 @@ do_drawingarea (GtkWidget *do_widget) gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Drawing Area"); + gtk_window_set_default_size (GTK_WINDOW (window), 250, -1); g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL); diff --git a/demos/gtk-demo/fontify.c b/demos/gtk-demo/fontify.c index f66c04de45..62bc34b803 100644 --- a/demos/gtk-demo/fontify.c +++ b/demos/gtk-demo/fontify.c @@ -501,7 +501,7 @@ fontify (const char *format, char *theme; gboolean prefer_dark; const char *style_arg; - const char *text; + char *text; GtkTextIter start, end; GBytes *bytes; GError *error = NULL; @@ -553,7 +553,7 @@ fontify (const char *format, gtk_text_buffer_get_bounds (source_buffer, &start, &end); text = gtk_text_buffer_get_text (source_buffer, &start, &end, TRUE); - bytes = g_bytes_new_static (text, strlen (text)); + bytes = g_bytes_new_take (text, strlen (text)); #ifdef HAVE_GIO_UNIX /* Work around https://gitlab.gnome.org/GNOME/glib/-/issues/2182 */ @@ -570,4 +570,5 @@ fontify (const char *format, NULL, fontify_finish, g_object_ref (source_buffer)); + g_bytes_unref (bytes); } diff --git a/demos/gtk-demo/iconscroll.c b/demos/gtk-demo/iconscroll.c index d7a6c1b5e3..43d74c49f7 100644 --- a/demos/gtk-demo/iconscroll.c +++ b/demos/gtk-demo/iconscroll.c @@ -13,7 +13,7 @@ static GtkWidget *window = NULL; static GtkWidget *scrolledwindow; static int selected; -#define N_WIDGET_TYPES 6 +#define N_WIDGET_TYPES 7 static int hincrement = 5; @@ -177,6 +177,24 @@ populate_grid (void) gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), list); } +extern GtkWidget *create_ucd_view (GtkWidget *label); + +static void +populate_list2 (void) +{ + GtkWidget *list; + + list = create_ucd_view (NULL); + + hincrement = 0; + vincrement = 5; + + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), list); +} + static void set_widget_type (int type) { @@ -216,6 +234,11 @@ set_widget_type (int type) break; case 5: + gtk_window_set_title (GTK_WINDOW (window), "Scrolling a list"); + populate_list2 (); + break; + + case 6: gtk_window_set_title (GTK_WINDOW (window), "Scrolling a grid"); populate_grid (); break; diff --git a/demos/gtk-demo/listview_ucd.c b/demos/gtk-demo/listview_ucd.c index 9fe85fcbd1..df120fcb08 100644 --- a/demos/gtk-demo/listview_ucd.c +++ b/demos/gtk-demo/listview_ucd.c @@ -259,7 +259,7 @@ selection_changed (GObject *object, gtk_label_set_label (GTK_LABEL (label), buffer); } -static GtkWidget * +GtkWidget * create_ucd_view (GtkWidget *label) { GtkWidget *cv; @@ -273,7 +273,8 @@ create_ucd_view (GtkWidget *label) selection = gtk_single_selection_new (ucd_model); gtk_single_selection_set_autoselect (selection, TRUE); gtk_single_selection_set_can_unselect (selection, FALSE); - g_signal_connect (selection, "notify::selected", G_CALLBACK (selection_changed), label); + if (label) + g_signal_connect (selection, "notify::selected", G_CALLBACK (selection_changed), label); cv = gtk_column_view_new (GTK_SELECTION_MODEL (selection)); gtk_column_view_set_show_column_separators (GTK_COLUMN_VIEW (cv), TRUE); diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c index c24cc55d2d..bb1de0d6e9 100644 --- a/demos/gtk-demo/main.c +++ b/demos/gtk-demo/main.c @@ -337,8 +337,8 @@ display_text (const char *format, bytes = g_resources_lookup_data (resource, 0, NULL); g_assert (bytes); - - g_assert (g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL)); + text = g_bytes_get_data (bytes, &len); + g_assert (g_utf8_validate (text, len, NULL)); textview = gtk_text_view_new (); gtk_text_view_set_left_margin (GTK_TEXT_VIEW (textview), 20); @@ -354,9 +354,8 @@ display_text (const char *format, gtk_text_view_set_monospace (GTK_TEXT_VIEW (textview), TRUE); buffer = gtk_text_buffer_new (NULL); - - text = g_bytes_unref_to_data (bytes, &len); gtk_text_buffer_set_text (buffer, text, len); + g_bytes_unref (bytes); if (format) fontify (format, buffer); diff --git a/demos/gtk-demo/paintable_emblem.c b/demos/gtk-demo/paintable_emblem.c index 4c1ecf9b4c..d220c1d6ea 100644 --- a/demos/gtk-demo/paintable_emblem.c +++ b/demos/gtk-demo/paintable_emblem.c @@ -153,7 +153,7 @@ do_paintable_emblem (GtkWidget *do_widget) window = gtk_window_new (); gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); - gtk_window_set_title (GTK_WINDOW (window), "Emblems"); + gtk_window_set_title (GTK_WINDOW (window), "Paintable — Emblems"); gtk_window_set_default_size (GTK_WINDOW (window), 300, 200); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); diff --git a/demos/gtk-demo/paintable_svg.c b/demos/gtk-demo/paintable_svg.c index b2254a2348..975c650f93 100644 --- a/demos/gtk-demo/paintable_svg.c +++ b/demos/gtk-demo/paintable_svg.c @@ -208,7 +208,8 @@ do_paintable_svg (GtkWidget *do_widget) window = gtk_window_new (); header = gtk_header_bar_new (); gtk_window_set_titlebar (GTK_WINDOW (window), header); - gtk_window_set_default_size (GTK_WINDOW (window), 300, 200); + gtk_window_set_default_size (GTK_WINDOW (window), 330, 330); + gtk_window_set_title (GTK_WINDOW (window), "Paintable — SVG"); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); button = gtk_file_chooser_button_new ("Select an SVG file", GTK_FILE_CHOOSER_ACTION_OPEN); diff --git a/demos/gtk-demo/shortcut_triggers.c b/demos/gtk-demo/shortcut_triggers.c index 44b8839ca7..d5cb8627ab 100644 --- a/demos/gtk-demo/shortcut_triggers.c +++ b/demos/gtk-demo/shortcut_triggers.c @@ -57,6 +57,8 @@ do_shortcut_triggers (GtkWidget *do_widget) gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Shortcuts"); + gtk_window_set_default_size (GTK_WINDOW (window), 200, -1); + gtk_window_set_resizable (GTK_WINDOW (window), FALSE); g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window); list = gtk_list_box_new (); diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c index 7b3db2cf6b..98bde0a0e7 100644 --- a/gtk/a11y/gtkatspicontext.c +++ b/gtk/a11y/gtkatspicontext.c @@ -1387,9 +1387,11 @@ gtk_at_spi_context_unregister_object (GtkAtSpiContext *self) self->registration_ids[self->n_registered_objects]); self->registration_ids[self->n_registered_objects] = 0; } + + g_clear_pointer (&self->interfaces, g_variant_unref); } /* }}} */ -/* {{{ GObject boilerplate */ +/* {{{ GObject boilerplate */ static void gtk_at_spi_context_finalize (GObject *gobject) { @@ -1399,7 +1401,6 @@ gtk_at_spi_context_finalize (GObject *gobject) g_free (self->bus_address); g_free (self->context_path); - g_clear_pointer (&self->interfaces, g_variant_unref); G_OBJECT_CLASS (gtk_at_spi_context_parent_class)->finalize (gobject); }