From: Simon Tatham Date: Sat, 26 Sep 2015 09:42:02 +0000 (+0100) Subject: Visually distinguish charset headings in GTK3 unifontsel. X-Git-Tag: 0.68~355 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=3c7557dcd00819a28585c372da3f16b8c5f131f8;p=PuTTY.git Visually distinguish charset headings in GTK3 unifontsel. When displaying a server-side font, the unified font selector's font-style list box contains some lines which are character-set headings, and others which are actually selectable font styles. We tag the former with the "sensitive"=FALSE attribute, to prevent them from responding to clicks. In GTK2, this also made them visually distinct from the normal lines, by greying them out; in GTK3 it makes no visual difference. The simplest solution is to bold those lines, hinting that they're sort of section headings. That looks OK in GTK2 as well, so I've done it unconditionally. --- diff --git a/unix/gtkfont.c b/unix/gtkfont.c index 38a46a62..2f7e4a61 100644 --- a/unix/gtkfont.c +++ b/unix/gtkfont.c @@ -2355,7 +2355,7 @@ static void unifontsel_setup_stylelist(unifontsel_internal *fs, gtk_list_store_append(fs->style_model, &iter); gtk_list_store_set(fs->style_model, &iter, 0, currstyle, 1, minpos, 2, maxpos+1, - 3, TRUE, -1); + 3, TRUE, 4, PANGO_WEIGHT_NORMAL, -1); listindex++; } if (info) { @@ -2364,7 +2364,7 @@ static void unifontsel_setup_stylelist(unifontsel_internal *fs, gtk_list_store_append(fs->style_model, &iter); gtk_list_store_set(fs->style_model, &iter, 0, info->charset, 1, -1, 2, -1, - 3, FALSE, -1); + 3, FALSE, 4, PANGO_WEIGHT_BOLD, -1); listindex++; } currcs = info->charset; @@ -3204,19 +3204,21 @@ unifontsel *unifontsel_new(const char *wintitle) #endif /* - * The Style list box can contain insensitive elements - * (character set headings for server-side fonts), so we add - * an extra column to the list store to hold that information. + * The Style list box can contain insensitive elements (character + * set headings for server-side fonts), so we add an extra column + * to the list store to hold that information. Also, since GTK3 at + * least doesn't seem to display insensitive elements differently + * by default, we add a further column to change their style. */ - model = gtk_list_store_new(4, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, - G_TYPE_BOOLEAN); + model = gtk_list_store_new(5, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, + G_TYPE_BOOLEAN, G_TYPE_INT); w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), FALSE); gtk_label_set_mnemonic_widget(GTK_LABEL(label), w); gtk_widget_show(w); column = gtk_tree_view_column_new_with_attributes ("Style", gtk_cell_renderer_text_new(), - "text", 0, "sensitive", 3, (char *)NULL); + "text", 0, "sensitive", 3, "weight", 4, (char *)NULL); gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE); gtk_tree_view_append_column(GTK_TREE_VIEW(w), column); g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(w))),