mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 06:10:21 +00:00
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master See merge request GNOME/gtk!2802
This commit is contained in:
commit
2543c9f5a3
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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 ();
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user