From 1a3b233e55901ce76fb74ab80be6df3026f9b979 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Feb 14 2012 16:19:45 +0000 Subject: First %d in controller title should be substituted with window nth --- diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c index 1170071..985edca 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c @@ -414,7 +414,18 @@ virt_viewer_app_set_window_subtitle(VirtViewerApp *app, VirtViewerWindow *window, int nth) { - gchar *subtitle = app->priv->title ? g_strdup_printf("%s (%d)", app->priv->title, nth + 1) : NULL; + gchar *subtitle = NULL; + + if (app->priv->title != NULL) { + gchar *d = strstr(app->priv->title, "%d"); + if (d != NULL) { + *d = '\0'; + subtitle = g_strdup_printf("%s%d%s", app->priv->title, nth + 1, d + 2); + *d = '%'; + } else + subtitle = g_strdup_printf("%s (%d)", app->priv->title, nth + 1); + } + g_object_set(window, "subtitle", subtitle, NULL); g_free(subtitle); }