Merge branch 'demo-inscriptions' into 'main'

demo: Use GtkInscription more

See merge request GNOME/gtk!7874
This commit is contained in:
Matthias Clasen
2024-10-26 19:55:56 +00:00

View File

@@ -101,7 +101,7 @@ setup_centered_label (GtkSignalListItemFactory *factory,
GObject *listitem)
{
GtkWidget *label;
label = gtk_label_new ("");
label = gtk_inscription_new ("");
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
}
@@ -110,8 +110,8 @@ setup_label (GtkSignalListItemFactory *factory,
GObject *listitem)
{
GtkWidget *label;
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
label = gtk_inscription_new ("");
gtk_inscription_set_xalign (GTK_INSCRIPTION (label), 0);
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
}
@@ -120,10 +120,10 @@ setup_ellipsizing_label (GtkSignalListItemFactory *factory,
GObject *listitem)
{
GtkWidget *label;
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
gtk_label_set_width_chars (GTK_LABEL (label), 20);
label = gtk_inscription_new ("");
gtk_inscription_set_xalign (GTK_INSCRIPTION (label), 0);
gtk_inscription_set_text_overflow (GTK_INSCRIPTION (label), GTK_INSCRIPTION_OVERFLOW_ELLIPSIZE_END);
gtk_inscription_set_nat_chars (GTK_INSCRIPTION (label), 20);
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
}
@@ -141,7 +141,7 @@ bind_codepoint (GtkSignalListItemFactory *factory,
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
g_snprintf (buffer, 10, "%#06x", codepoint);
gtk_label_set_label (GTK_LABEL (label), buffer);
gtk_inscription_set_text (GTK_INSCRIPTION (label), buffer);
}
static void
@@ -160,7 +160,7 @@ bind_char (GtkSignalListItemFactory *factory,
if (g_unichar_isprint (codepoint))
g_unichar_to_utf8 (codepoint, buffer);
gtk_label_set_label (GTK_LABEL (label), buffer);
gtk_inscription_set_text (GTK_INSCRIPTION (label), buffer);
}
static void
@@ -175,7 +175,7 @@ bind_name (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
name = ucd_item_get_name (UCD_ITEM (item));
gtk_label_set_label (GTK_LABEL (label), name);
gtk_inscription_set_text (GTK_INSCRIPTION (label), name);
}
static void
@@ -190,7 +190,7 @@ bind_type (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
gtk_label_set_label (GTK_LABEL (label), get_unicode_type_name (g_unichar_type (codepoint)));
gtk_inscription_set_text (GTK_INSCRIPTION (label), get_unicode_type_name (g_unichar_type (codepoint)));
}
static void
@@ -205,7 +205,7 @@ bind_break_type (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
gtk_label_set_label (GTK_LABEL (label), get_break_type_name (g_unichar_break_type (codepoint)));
gtk_inscription_set_text (GTK_INSCRIPTION (label), get_break_type_name (g_unichar_break_type (codepoint)));
}
static void
@@ -220,7 +220,7 @@ bind_combining_class (GtkSignalListItemFactory *factory,
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
gtk_label_set_label (GTK_LABEL (label), get_combining_class_name (g_unichar_combining_class (codepoint)));
gtk_inscription_set_text (GTK_INSCRIPTION (label), get_combining_class_name (g_unichar_combining_class (codepoint)));
}
static void
@@ -237,7 +237,7 @@ bind_script (GtkSignalListItemFactory *factory,
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
script = g_unichar_get_script (codepoint);
gtk_label_set_label (GTK_LABEL (label), get_script_name (script));
gtk_inscription_set_text (GTK_INSCRIPTION (label), get_script_name (script));
}
static void
@@ -255,7 +255,7 @@ selection_changed (GObject *object,
if (g_unichar_isprint (codepoint))
g_unichar_to_utf8 (codepoint, buffer);
gtk_label_set_label (GTK_LABEL (label), buffer);
gtk_inscription_set_text (GTK_INSCRIPTION (label), buffer);
}
GtkWidget *