Branch: refs/heads/master Author: Nick Treleaven ntrel002@gmail.com Committer: Nick Treleaven ntrel002@gmail.com Date: Wed, 08 Feb 2023 16:01:55 UTC Commit: 5c4632fe4b6272832f7614c218aaa571716a4c85 https://github.com/geany/geany/commit/5c4632fe4b6272832f7614c218aaa571716a4c...
Log Message: ----------- Show modified MRU docs in red
(Shown when pressing Ctrl-Tab).
Also use GString to build markup label text.
Modified Paths: -------------- src/notebook.c
Modified: src/notebook.c 16 lines changed, 10 insertions(+), 6 deletions(-) =================================================================== @@ -218,9 +218,9 @@ static GtkWidget *create_switch_dialog(void) static void update_filename_label(void) { guint i; - gchar *msg = NULL; guint queue_length; GeanyDocument *doc; + GString *markup = g_string_new(NULL);
if (!switch_dialog) { @@ -234,8 +234,10 @@ static void update_filename_label(void) gchar *basename;
basename = g_path_get_basename(DOC_FILENAME(doc)); + SETPTR(basename, g_markup_escape_text(basename, -1)); + if (i == mru_pos) - msg = g_markup_printf_escaped ("<b>%s</b>", basename); + g_string_printf(markup, "<b>%s</b>", basename); else if (i % queue_length == mru_pos) /* && i != mru_pos */ { /* We have wrapped around and got to the starting document again */ @@ -244,13 +246,15 @@ static void update_filename_label(void) } else { - SETPTR(basename, g_markup_printf_escaped ("\n%s", basename)); - SETPTR(msg, g_strconcat(msg, basename, NULL)); + g_string_append(markup, "\n"); + if (doc->changed) + SETPTR(basename, g_strconcat("<span color='red'>", basename, "</span>", NULL)); + g_string_append(markup, basename); } g_free(basename); } - gtk_label_set_markup(GTK_LABEL(switch_dialog_label), msg); - g_free(msg); + gtk_label_set_markup(GTK_LABEL(switch_dialog_label), markup->str); + g_string_free(markup, TRUE); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).