[libgda/LIBGDA_4.2] Improved browser window's title



commit a0e50021594b88bc30d17d1ea85a57fd1cac80d2
Author: Vivien Malerba <malerba gnome-db org>
Date:   Thu May 26 20:36:51 2011 +0200

    Improved browser window's title

 tools/browser/browser-window.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/tools/browser/browser-window.c b/tools/browser/browser-window.c
index 3ea2eab..12d03f7 100644
--- a/tools/browser/browser-window.c
+++ b/tools/browser/browser-window.c
@@ -378,7 +378,8 @@ browser_window_new (BrowserConnection *bcnc, BrowserPerspectiveFactory *factory)
 {
 	BrowserWindow *bwin;
 	const gchar *cncname;
-	gchar *str;
+	const GdaDsnInfo *dsn;
+	GString *title;
 
 	g_return_val_if_fail (BROWSER_IS_CONNECTION (bcnc), NULL);
 
@@ -387,12 +388,19 @@ browser_window_new (BrowserConnection *bcnc, BrowserPerspectiveFactory *factory)
 	g_signal_connect (bcnc, "transaction-status-changed",
 			  G_CALLBACK (transaction_status_changed_cb), bwin);
 
+	dsn = browser_connection_get_information (bcnc);
 	cncname = browser_connection_get_name (bcnc);
-	if (!cncname)
-		cncname = _("unnamed");
-	str = g_strdup_printf (_("Connection: %s"), cncname);
-	gtk_window_set_title (GTK_WINDOW (bwin), str);
-	g_free (str);
+	title = g_string_new (_("Connection"));
+	g_string_append (title, " ");
+	g_string_append_printf (title, "'%s'", cncname ? cncname : _("unnamed"));
+	if (dsn) {
+		if (dsn->name)
+			g_string_append_printf (title, ", %s '%s'", _("data source"), dsn->name);
+		if (dsn->provider)
+			g_string_append_printf (title, " (%s)", dsn->provider);
+	}
+	gtk_window_set_title (GTK_WINDOW (bwin), title->str);
+	g_string_free (title, TRUE);
 	gtk_window_set_default_size ((GtkWindow*) bwin, 900, 650);
 	g_signal_connect (G_OBJECT (bwin), "delete-event",
                           G_CALLBACK (delete_event), bwin);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]